• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

okular

  • sources
  • kde-4.12
  • kdegraphics
  • okular
  • active
  • components
documentitem.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 by Marco Martin <mart@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2,
7  * or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef QDOCUMENTITEM_H
21 #define QDOCUMENTITEM_H
22 
23 #include <QObject>
24 
25 #include "settings.h"
26 
27 #include <core/document.h>
28 #include <core/observer.h>
29 
30 namespace Okular {
31  class Document;
32 }
33 
34 class Observer;
35 class TOCModel;
36 
37 class DocumentItem : public QObject
38 {
39  Q_OBJECT
40 
44  Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged)
45 
46 
49  Q_PROPERTY(QString windowTitleForDocument READ windowTitleForDocument NOTIFY windowTitleForDocumentChanged)
50 
54  Q_PROPERTY(int currentPage READ currentPage WRITE setCurrentPage NOTIFY currentPageChanged)
55 
59  Q_PROPERTY(bool opened READ isOpened NOTIFY openedChanged)
60 
64  Q_PROPERTY(int pageCount READ pageCount NOTIFY pageCountChanged)
65 
69  Q_PROPERTY(bool supportsSearching READ supportsSearching NOTIFY supportsSearchingChanged)
70 
74  Q_PROPERTY(bool searchInProgress READ isSearchInProgress NOTIFY searchInProgressChanged)
75 
79  Q_PROPERTY(QList<int> matchingPages READ matchingPages NOTIFY matchingPagesChanged)
80 
84  Q_PROPERTY(TOCModel *tableOfContents READ tableOfContents CONSTANT)
85 
89  Q_PROPERTY(QList<int> bookmarkedPages READ bookmarkedPages NOTIFY bookmarkedPagesChanged)
90 
94  Q_PROPERTY(QStringList bookmarks READ bookmarks NOTIFY bookmarksChanged)
95 
96 public:
97 
98  DocumentItem(QObject *parent=0);
99  ~DocumentItem();
100 
101  void setPath(const QString &path);
102  QString path() const;
103 
104  QString windowTitleForDocument() const;
105 
106  void setCurrentPage(int page);
107  int currentPage() const;
108 
109  bool isOpened() const;
110 
111  int pageCount() const;
112 
113  bool supportsSearching() const;
114 
115  bool isSearchInProgress() const;
116 
117  QList<int> matchingPages() const;
118 
119  TOCModel *tableOfContents() const;
120 
121  QList<int> bookmarkedPages() const;
122 
123  QStringList bookmarks() const;
124 
125  //This could be a property, but maybe we want to have parameter for searchText
131  Q_INVOKABLE void searchText(const QString &text);
132 
136  Q_INVOKABLE void resetSearch();
137 
138  //Internal, not binded to qml
139  Okular::Document *document();
140  Observer *pageviewObserver();
141  Observer *thumbnailObserver();
142 
143 Q_SIGNALS:
144  void pathChanged();
145  void pageCountChanged();
146  void openedChanged();
147  void searchInProgressChanged();
148  void matchingPagesChanged();
149  void currentPageChanged();
150  void supportsSearchingChanged();
151  void bookmarkedPagesChanged();
152  void bookmarksChanged();
153  void windowTitleForDocumentChanged();
154 
155 private Q_SLOTS:
156  void searchFinished(int id, Okular::Document::SearchStatus endStatus);
157 
158 private:
159  Okular::Document *m_document;
160  TOCModel *m_tocModel;
161  Observer *m_thumbnailObserver;
162  Observer *m_pageviewObserver;
163  QList<int> m_matchingPages;
164  bool m_searchInProgress;
165 };
166 
167 class Observer : public QObject, public Okular::DocumentObserver
168 {
169  Q_OBJECT
170 
171 public:
172  Observer(DocumentItem *parent);
173  ~Observer();
174 
175  // inherited from DocumentObserver
176  void notifyPageChanged(int page, int flags);
177 
178 Q_SIGNALS:
179  void pageChanged(int page, int flags);
180 
181 private:
182  DocumentItem *m_document;
183 };
184 
185 #endif
DocumentItem::pageCountChanged
void pageCountChanged()
DocumentItem::pageviewObserver
Observer * pageviewObserver()
Definition: documentitem.cpp:206
DocumentItem::windowTitleForDocument
QString windowTitleForDocument() const
DocumentItem::path
QString path() const
DocumentItem::tableOfContents
TOCModel * tableOfContents() const
DocumentItem::thumbnailObserver
Observer * thumbnailObserver()
Definition: documentitem.cpp:198
DocumentItem::bookmarksChanged
void bookmarksChanged()
QObject
DocumentItem
Definition: documentitem.h:37
DocumentItem::supportsSearching
bool supportsSearching() const
observer.h
DocumentItem::pageCount
int pageCount() const
DocumentItem::bookmarkedPagesChanged
void bookmarkedPagesChanged()
DocumentItem::isSearchInProgress
bool isSearchInProgress() const
Definition: documentitem.cpp:156
DocumentItem::setCurrentPage
void setCurrentPage(int page)
Definition: documentitem.cpp:97
DocumentItem::currentPage
int currentPage() const
DocumentItem::pathChanged
void pathChanged()
Okular::Document
The Document.
Definition: document.h:84
DocumentItem::openedChanged
void openedChanged()
document.h
DocumentItem::resetSearch
Q_INVOKABLE void resetSearch()
Reset the search over the document.
Definition: documentitem.cpp:178
DocumentItem::bookmarkedPages
QList< int > bookmarkedPages() const
DocumentItem::matchingPagesChanged
void matchingPagesChanged()
DocumentItem::document
Okular::Document * document()
Definition: documentitem.cpp:193
Observer
Definition: documentitem.h:167
DocumentItem::matchingPages
QList< int > matchingPages() const
DocumentItem::searchText
Q_INVOKABLE void searchText(const QString &text)
Performs a search in the document.
Definition: documentitem.cpp:161
DocumentItem::isOpened
bool isOpened() const
Definition: documentitem.cpp:109
DocumentItem::windowTitleForDocumentChanged
void windowTitleForDocumentChanged()
DocumentItem::opened
bool opened
True if this DocumentItem instance has a document file opened.
Definition: documentitem.h:59
DocumentItem::bookmarks
QStringList bookmarks() const
DocumentItem::searchInProgress
bool searchInProgress
True if a search is currently in progress and results didn't arrive yet.
Definition: documentitem.h:74
DocumentItem::setPath
void setPath(const QString &path)
Definition: documentitem.cpp:55
DocumentItem::supportsSearchingChanged
void supportsSearchingChanged()
DocumentItem::currentPageChanged
void currentPageChanged()
DocumentItem::searchInProgressChanged
void searchInProgressChanged()
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:45:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okular

Skip menu "okular"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal