okmarks also for document

Please enter the commit message for your changes. Lines starting
This commit is contained in:
Marco Martin 2012-10-05 16:15:55 +02:00
parent ae5ddd097c
commit 08303618d1
2 changed files with 20 additions and 1 deletions

View file

@ -37,8 +37,10 @@ DocumentItem::DocumentItem(QObject *parent)
connect(m_document, SIGNAL(searchFinished(int,Okular::Document::SearchStatus)),
this, SLOT(searchFinished(int,Okular::Document::SearchStatus)));
connect(m_document->bookmarkManager(), SIGNAL(bookmarkedPagesChanged(KUrl)),
connect(m_document->bookmarkManager(), SIGNAL(bookmarksChanged(KUrl)),
this, SIGNAL(bookmarkedPagesChanged()));
connect(m_document->bookmarkManager(), SIGNAL(bookmarksChanged(KUrl)),
this, SIGNAL(bookmarksChanged()));
}
@ -133,6 +135,15 @@ QList<int> DocumentItem::bookmarkedPages() const
return list;
}
QStringList DocumentItem::bookmarks() const
{
QStringList list;
foreach(const KBookmark &bookmark, m_document->bookmarkManager()->bookmarks()) {
list << bookmark.url().fragment();
}
return list;
}
bool DocumentItem::supportsSearching() const
{
return m_document->supportsSearching();

View file

@ -88,6 +88,11 @@ class DocumentItem : public QObject
*/
Q_PROPERTY(QList<int> bookmarkedPages READ bookmarkedPages NOTIFY bookmarkedPagesChanged)
/**
* list of bookmarks urls valid on this page
*/
Q_PROPERTY(QStringList bookmarks READ bookmarks NOTIFY bookmarksChanged)
public:
DocumentItem(QObject *parent=0);
@ -115,6 +120,8 @@ public:
QList<int> bookmarkedPages() const;
QStringList bookmarks() const;
//This could be a property, but maybe we want to have parameter for searchText
/**
* Performs a search in the document
@ -141,6 +148,7 @@ Q_SIGNALS:
void currentPageChanged();
void supportsSearchingChanged();
void bookmarkedPagesChanged();
void bookmarksChanged();
void windowTitleForDocumentChanged();
private Q_SLOTS: