diff --git a/kpdf/TODO b/kpdf/TODO index 6c1dda757..bb6e021a5 100644 --- a/kpdf/TODO +++ b/kpdf/TODO @@ -19,6 +19,7 @@ Porting / In progress on the branch (first item comes first): -> (store observers data into pages?) Done (sorted by inv.time) +-> added the TOC from head (missing click and go functionality because it needs link following) -> added a 'search bar' with prune-as-you-type feature -> ported Albert's search and implemented case sensitive -> smart handling of pixmap using an Observer ID (thumbnails are gone, only pixmaps now) diff --git a/kpdf/kpdf_part.cpp b/kpdf/kpdf_part.cpp index b3561614a..9a934052b 100644 --- a/kpdf/kpdf_part.cpp +++ b/kpdf/kpdf_part.cpp @@ -90,29 +90,30 @@ Part::Part(QWidget *parentWidget, const char *widgetName, setWidget( m_splitter ); // widgets: [left toolbox] | [] - QToolBox * toolBox = new QToolBox( m_splitter ); - toolBox->setMinimumWidth( 60 ); - toolBox->setMaximumWidth( 200 ); + m_toolBox = new QToolBox( m_splitter ); + m_toolBox->setMinimumWidth( 60 ); + m_toolBox->setMaximumWidth( 200 ); // TODO when links following is done connect the execute(LinkAction *action) signal from // tocFrame to the same slot - TOC * tocFrame = new TOC( toolBox, document ); - toolBox->addItem( tocFrame, QIconSet(SmallIcon("text_left")), i18n("Contents") ); + TOC * tocFrame = new TOC( m_toolBox, document ); + m_toolBox->addItem( tocFrame, QIconSet(SmallIcon("text_left")), i18n("Contents") ); + connect(tocFrame, SIGNAL(hasTOC(bool)), this, SLOT(enableTOC(bool))); - QVBox * thumbsBox = new ThumbnailsBox( toolBox ); + QVBox * thumbsBox = new ThumbnailsBox( m_toolBox ); m_thumbnailList = new ThumbnailList( thumbsBox, document ); m_searchWidget = new SearchWidget( thumbsBox, document ); - toolBox->addItem( thumbsBox, QIconSet(SmallIcon("thumbnail")), i18n("Thumbnails") ); - toolBox->setCurrentItem( thumbsBox ); + m_toolBox->addItem( thumbsBox, QIconSet(SmallIcon("thumbnail")), i18n("Thumbnails") ); + m_toolBox->setCurrentItem( thumbsBox ); - QFrame * bookmarksFrame = new QFrame( toolBox ); - toolBox->addItem( bookmarksFrame, QIconSet(SmallIcon("bookmark")), i18n("Bookmarks") ); + QFrame * bookmarksFrame = new QFrame( m_toolBox ); + m_toolBox->addItem( bookmarksFrame, QIconSet(SmallIcon("bookmark")), i18n("Bookmarks") ); - QFrame * editFrame = new QFrame( toolBox ); - toolBox->addItem( editFrame, QIconSet(SmallIcon("favorites")), i18n("Edited Chunks") ); + QFrame * editFrame = new QFrame( m_toolBox ); + m_toolBox->addItem( editFrame, QIconSet(SmallIcon("favorites")), i18n("Edited Chunks") ); - QFrame * moreFrame = new QFrame( toolBox ); - toolBox->addItem( moreFrame, QIconSet(SmallIcon("fork")), i18n("More stuff..") ); + QFrame * moreFrame = new QFrame( m_toolBox ); + m_toolBox->addItem( moreFrame, QIconSet(SmallIcon("fork")), i18n("More stuff..") ); // widgets: [] | [right 'pageView'] m_pageView = new PageView( m_splitter, document ); @@ -232,6 +233,11 @@ void Part::updateActions() } } +void Part::enableTOC(bool enable) +{ + m_toolBox->setItemEnabled(0, enable); +} + //BEGIN go to page dialog class KPDFGotoPageDialog : public KDialogBase { diff --git a/kpdf/kpdf_part.h b/kpdf/kpdf_part.h index 4bce21e1b..93a351515 100644 --- a/kpdf/kpdf_part.h +++ b/kpdf/kpdf_part.h @@ -21,6 +21,7 @@ class QWidget; class QSplitter; +class QToolBox; class KURL; class KAction; @@ -94,6 +95,7 @@ namespace KPDF void slotPrintPreview(); // can be connected to widget elements void updateActions(); + void enableTOC(bool enable); public slots: // connected to Shell action (and browserExtension), not local one @@ -112,6 +114,8 @@ namespace KPDF // static instances counter static unsigned int m_count; + QToolBox *m_toolBox; + // actions KAction *m_gotoPage; KAction *m_prevPage; diff --git a/kpdf/toc.cpp b/kpdf/toc.cpp index 5b3db5601..bf9e323bb 100644 --- a/kpdf/toc.cpp +++ b/kpdf/toc.cpp @@ -87,9 +87,9 @@ void TOC::pageSetup( const QValueVector & /*pages*/, bool documentCha addKids(last, kids, uMap); } } -// inform we have TOC + emit hasTOC(true); } -// inform we DO NOT have TOC + else emit hasTOC(false); } } diff --git a/kpdf/toc.h b/kpdf/toc.h index bc792b478..8eefc84f6 100644 --- a/kpdf/toc.h +++ b/kpdf/toc.h @@ -30,6 +30,7 @@ Q_OBJECT signals: void execute(LinkAction *action); + void hasTOC(bool has); private slots: void slotExecuted(QListViewItem *i);