Commit 81f89096 authored by Albert Astals Cid's avatar Albert Astals Cid

Enable/disable the contents tab on the toolbox wheter the document has TOC or...

Enable/disable the contents tab on the toolbox wheter the document has TOC or not. BTW i like a lot the toolbox look

svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=348927
parent 545117b3
......@@ -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)
......
......@@ -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
{
......
......@@ -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;
......
......@@ -87,9 +87,9 @@ void TOC::pageSetup( const QValueVector<KPDFPage*> & /*pages*/, bool documentCha
addKids(last, kids, uMap);
}
}
// inform we have TOC
emit hasTOC(true);
}
// inform we DO NOT have TOC
else emit hasTOC(false);
}
}
......
......@@ -30,6 +30,7 @@ Q_OBJECT
signals:
void execute(LinkAction *action);
void hasTOC(bool has);
private slots:
void slotExecuted(QListViewItem *i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment