Skip to content

Commit

Permalink
[office] Add a placeholder for the table of content of PDF documents.
Browse files Browse the repository at this point in the history
  • Loading branch information
dcaliste committed Apr 23, 2015
1 parent 4e42d2f commit 447d502
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pdf/pdftocmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,8 @@ int PDFTocModel::rowCount(const QModelIndex& parent) const
return 0;
return d->entries.count();
}

int PDFTocModel::count() const
{
return d->entries.count();
}
6 changes: 6 additions & 0 deletions pdf/pdftocmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace Poppler { class Document; }
class PDFTocModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(int count READ count NOTIFY countChanged)

public:
enum PDFTocModelRoles {
Expand All @@ -39,6 +40,11 @@ class PDFTocModel : public QAbstractListModel
virtual int rowCount(const QModelIndex& parent) const;
virtual QHash<int, QByteArray> roleNames() const;

int count() const;

Q_SIGNALS:
void countChanged();

private:
class Private;
Private * const d;
Expand Down
7 changes: 7 additions & 0 deletions plugin/PDFDocumentToCPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ Page {
//% "Index"
header: PageHeader { title: qsTrId( "sailfish-office-he-pdf_index" ); }

ViewPlaceholder {
id: placeholder
//% "Document has no table of content"
text: qsTrId("sailfish-office-me-no-toc")
}
onModelChanged: placeholder.enabled = !model || (model.count == 0)

delegate: BackgroundItem {
id: bg;

Expand Down

0 comments on commit 447d502

Please sign in to comment.