property that tells if the doc supports search

This commit is contained in:
Marco Martin 2012-05-15 13:56:08 +02:00
parent c8d078b1fd
commit 57311442b1
3 changed files with 12 additions and 0 deletions

View file

@ -200,6 +200,7 @@ PlasmaComponents.Page {
height: searchField.height + 10
MobileComponents.ViewSearch {
id: searchField
enabled: documentItem.supportsSearch
anchors.centerIn: parent
busy: documentItem.searchInProgress
onSearchQueryChanged: {

View file

@ -51,6 +51,7 @@ void DocumentItem::setPath(const QString &path)
emit pathChanged();
emit pageCountChanged();
emit openedChanged();
emit supportsSearchingChanged();
}
QString DocumentItem::path() const
@ -84,6 +85,11 @@ QList<int> DocumentItem::matchingPages() const
return m_matchingPages;
}
bool DocumentItem::supportsSearching() const
{
return m_document->supportsSearching();
}
bool DocumentItem::isSearchInProgress() const
{
return m_searchInProgress;
@ -95,6 +101,7 @@ void DocumentItem::searchText(const QString &text)
resetSearch();
return;
}
m_document->cancelSearch();
m_document->resetSearch(PAGEVIEW_SEARCH_ID);
m_document->searchText(PAGEVIEW_SEARCH_ID, text, 1, Qt::CaseInsensitive,
Okular::Document::AllDocument, true, QColor(100,100,200,40), true);

View file

@ -41,6 +41,7 @@ class DocumentItem : public QObject
Q_PROPERTY(int currentPage READ currentPage WRITE setCurrentPage NOTIFY currentPageChanged)
Q_PROPERTY(bool opened READ isOpened NOTIFY openedChanged)
Q_PROPERTY(int pageCount READ pageCount NOTIFY pageCountChanged)
Q_PROPERTY(bool supportsSearching READ supportsSearching NOTIFY supportsSearchingChanged)
Q_PROPERTY(bool searchInProgress READ isSearchInProgress NOTIFY searchInProgressChanged)
Q_PROPERTY(QList<int> matchingPages READ matchingPages NOTIFY matchingPagesChanged)
@ -59,6 +60,8 @@ public:
int pageCount() const;
bool supportsSearching() const;
bool isSearchInProgress() const;
QList<int> matchingPages() const;
@ -78,6 +81,7 @@ Q_SIGNALS:
void searchInProgressChanged();
void matchingPagesChanged();
void currentPageChanged();
void supportsSearchingChanged();
private Q_SLOTS:
void searchFinished(int id, Okular::Document::SearchStatus endStatus);