Commit 664d4415 authored by Jakub Stachowski's avatar Jakub Stachowski

Added action for showing/hiding left panel and removed it from settings.

"Watch file" moved to settings dialog.
BUG: 99316

svn path=/branches/kpdf_annotations/kdegraphics/kpdf/; revision=396976
parent 65738852
...@@ -66,7 +66,6 @@ More items (first items will enter 'In progress list' first): ...@@ -66,7 +66,6 @@ More items (first items will enter 'In progress list' first):
-> core: pdf forms support (BR91809) -> core: pdf forms support (BR91809)
-> evaluate wether to add find icon to the toolbar. poll/usab? (BR92620) -> evaluate wether to add find icon to the toolbar. poll/usab? (BR92620)
-> sidebar: evaluate wether to make the left toolbox auto-hiding (kicker like) (BR94495) -> sidebar: evaluate wether to make the left toolbox auto-hiding (kicker like) (BR94495)
-> sidebar: add shortcut for showing/hiding it (BR99316)
-> add OCR for building TextPages out of pure graphical (aka scanned) pages -> add OCR for building TextPages out of pure graphical (aka scanned) pages
-> rotate the whole document / individual pages (on screen/print?) (BR99352) -> rotate the whole document / individual pages (on screen/print?) (BR99352)
-> presentation: provide a pageX/totalPages indicator in addition to the circle one -> presentation: provide a pageX/totalPages indicator in addition to the circle one
...@@ -90,6 +89,7 @@ More items (first items will enter 'In progress list' first): ...@@ -90,6 +89,7 @@ More items (first items will enter 'In progress list' first):
-> cleanup code and update README.png -> cleanup code and update README.png
Done (newest features come first): Done (newest features come first):
-> ADD: sidebar: add shortcut for showing/hiding it (BR99316)
-> ADD: PDF1.6 annotations parser (PDF's annotations -> our data structures). -> ADD: PDF1.6 annotations parser (PDF's annotations -> our data structures).
-> ADD: Internal data structures for annotations handling. -> ADD: Internal data structures for annotations handling.
-> FIX: rmb when no doc displayed to restore menu -> FIX: rmb when no doc displayed to restore menu
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>320</width> <width>328</width>
<height>253</height> <height>305</height>
</rect> </rect>
</property> </property>
<vbox> <vbox>
...@@ -40,60 +40,25 @@ ...@@ -40,60 +40,25 @@
</property> </property>
<widget class="QCheckBox"> <widget class="QCheckBox">
<property name="name"> <property name="name">
<cstring>kcfg_ShowLeftPanel</cstring> <cstring>kcfg_ShowSearchBar</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Show &amp;left panel</string> <string>Show &amp;search bar in thumbnails list</string>
</property> </property>
</widget> </widget>
<widget class="QLayoutWidget"> <widget class="QCheckBox">
<property name="name"> <property name="name">
<cstring>layout5</cstring> <cstring>kcfg_SyncThumbnailsViewport</cstring>
</property> </property>
<grid> <property name="enabled">
<property name="name"> <bool>true</bool>
<cstring>unnamed</cstring> </property>
</property> <property name="text">
<widget class="QCheckBox" row="0" column="1"> <string>Link the &amp;thumbnails with the page</string>
<property name="name"> </property>
<cstring>kcfg_ShowSearchBar</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Show &amp;search bar in thumbnails list</string>
</property>
</widget>
<spacer row="0" column="0" rowspan="2" colspan="1">
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<size>
<width>16</width>
<height>30</height>
</size>
</property>
</spacer>
<widget class="QCheckBox" row="1" column="1">
<property name="name">
<cstring>kcfg_SyncThumbnailsViewport</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Link the &amp;thumbnails with the page</string>
</property>
</widget>
</grid>
</widget> </widget>
<widget class="QCheckBox"> <widget class="QCheckBox">
<property name="name"> <property name="name">
...@@ -119,6 +84,14 @@ ...@@ -119,6 +84,14 @@
<string>&amp;Obey DRM limitations</string> <string>&amp;Obey DRM limitations</string>
</property> </property>
</widget> </widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_WatchFile</cstring>
</property>
<property name="text">
<string>&amp;Watch File</string>
</property>
</widget>
</vbox> </vbox>
</widget> </widget>
<widget class="QLayoutWidget"> <widget class="QLayoutWidget">
...@@ -214,20 +187,6 @@ ...@@ -214,20 +187,6 @@
</spacer> </spacer>
</vbox> </vbox>
</widget> </widget>
<connections>
<connection>
<sender>kcfg_ShowLeftPanel</sender>
<signal>toggled(bool)</signal>
<receiver>kcfg_ShowSearchBar</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>kcfg_ShowLeftPanel</sender>
<signal>toggled(bool)</signal>
<receiver>kcfg_SyncThumbnailsViewport</receiver>
<slot>setEnabled(bool)</slot>
</connection>
</connections>
<includes> <includes>
<include location="global" impldecl="in implementation">kdialog.h</include> <include location="global" impldecl="in implementation">kdialog.h</include>
<include location="global" impldecl="in implementation">kiconloader.h</include> <include location="global" impldecl="in implementation">kiconloader.h</include>
......
...@@ -116,8 +116,10 @@ Part::Part(QWidget *parentWidget, const char *widgetName, ...@@ -116,8 +116,10 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
m_splitter = new QSplitter( parentWidget, widgetName ); m_splitter = new QSplitter( parentWidget, widgetName );
m_splitter->setOpaqueResize( true ); m_splitter->setOpaqueResize( true );
setWidget( m_splitter ); setWidget( m_splitter );
m_watchFile = new KToggleAction( i18n( "&Watch File" ), 0, this, SLOT( slotWatchFile() ), actionCollection(), "watch_file" );
m_watchFile->setChecked( Settings::watchFile() ); m_showLeftPanel = new KToggleAction( i18n( "Show &left panel"), 0, this, SLOT( slotShowLeftPanel() ), actionCollection(), "show_leftpanel" );
m_showLeftPanel->setShortcut( "CTRL+L" );
m_showLeftPanel->setChecked( Settings::showLeftPanel() );
// widgets: [left panel] | [] // widgets: [left panel] | []
m_leftPanel = new QWidget( m_splitter ); m_leftPanel = new QWidget( m_splitter );
...@@ -149,6 +151,8 @@ Part::Part(QWidget *parentWidget, const char *widgetName, ...@@ -149,6 +151,8 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
m_toolBox->addItem( thumbsBox, QIconSet(SmallIcon("thumbnail")), i18n("Thumbnails") ); m_toolBox->addItem( thumbsBox, QIconSet(SmallIcon("thumbnail")), i18n("Thumbnails") );
m_toolBox->setCurrentItem( thumbsBox ); m_toolBox->setCurrentItem( thumbsBox );
slotShowLeftPanel();
/* // [left toolbox: Annotations] | [] /* // [left toolbox: Annotations] | []
QFrame * editFrame = new QFrame( m_toolBox ); QFrame * editFrame = new QFrame( m_toolBox );
int iIdx = m_toolBox->addItem( editFrame, QIconSet(SmallIcon("pencil")), i18n("Annotations") ); int iIdx = m_toolBox->addItem( editFrame, QIconSet(SmallIcon("pencil")), i18n("Annotations") );
...@@ -244,13 +248,13 @@ Part::Part(QWidget *parentWidget, const char *widgetName, ...@@ -244,13 +248,13 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
splitterSizes.push_back( 500 ); splitterSizes.push_back( 500 );
} }
m_splitter->setSizes( splitterSizes ); m_splitter->setSizes( splitterSizes );
slotNewConfig();
m_watcher = new KDirWatch( this ); m_watcher = new KDirWatch( this );
connect( m_watcher, SIGNAL( dirty( const QString& ) ), this, SLOT( slotFileDirty( const QString& ) ) ); connect( m_watcher, SIGNAL( dirty( const QString& ) ), this, SLOT( slotFileDirty( const QString& ) ) );
m_dirtyHandler = new QTimer( this ); m_dirtyHandler = new QTimer( this );
connect( m_dirtyHandler, SIGNAL( timeout() ),this, SLOT( slotDoFileDirty() ) ); connect( m_dirtyHandler, SIGNAL( timeout() ),this, SLOT( slotDoFileDirty() ) );
slotNewConfig();
// [SPEECH] check for KTTSD presence and usability // [SPEECH] check for KTTSD presence and usability
KTrader::OfferList offers = KTrader::self()->query("DCOP/Text-to-Speech", "Name == 'KTTSD'"); KTrader::OfferList offers = KTrader::self()->query("DCOP/Text-to-Speech", "Name == 'KTTSD'");
Settings::setUseKTTSD( (offers.count() > 0) ); Settings::setUseKTTSD( (offers.count() > 0) );
...@@ -258,7 +262,6 @@ Part::Part(QWidget *parentWidget, const char *widgetName, ...@@ -258,7 +262,6 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
// set our XML-UI resource file // set our XML-UI resource file
setXMLFile("part.rc"); setXMLFile("part.rc");
updateViewActions(); updateViewActions();
slotWatchFile();
} }
Part::~Part() Part::~Part()
...@@ -375,16 +378,14 @@ bool Part::closeURL() ...@@ -375,16 +378,14 @@ bool Part::closeURL()
return KParts::ReadOnlyPart::closeURL(); return KParts::ReadOnlyPart::closeURL();
} }
void Part::slotWatchFile() void Part::slotShowLeftPanel()
{ {
Settings::setWatchFile(m_watchFile->isChecked()); bool showLeft = m_showLeftPanel->isChecked();
if( m_watchFile->isChecked() ) Settings::setShowLeftPanel(showLeft);
m_watcher->startScan(); // show/hide left qtoolbox
else m_leftPanel->setShown( showLeft );
{ // this needs to be hidden explicitly to disable thumbnails gen
m_dirtyHandler->stop(); m_thumbnailList->setShown( showLeft );
m_watcher->stopScan();
}
} }
void Part::slotFileDirty( const QString& fileName ) void Part::slotFileDirty( const QString& fileName )
...@@ -567,15 +568,16 @@ void Part::slotNewConfig() ...@@ -567,15 +568,16 @@ void Part::slotNewConfig()
// Apply settings here. A good policy is to check wether the setting has // Apply settings here. A good policy is to check wether the setting has
// changed before applying changes. // changed before applying changes.
// Left Panel and search Widget // Watch File
bool showLeft = Settings::showLeftPanel(); bool watchFile = Settings::watchFile();
if ( m_leftPanel->isShown() != showLeft ) if ( watchFile && m_watcher->isStopped() )
m_watcher->startScan();
if ( !watchFile && !m_watcher->isStopped() )
{ {
// show/hide left qtoolbox m_dirtyHandler->stop();
m_leftPanel->setShown( showLeft ); m_watcher->stopScan();
// this needs to be hidden explicitly to disable thumbnails gen
m_thumbnailList->setShown( showLeft );
} }
bool showSearch = Settings::showSearchBar(); bool showSearch = Settings::showSearchBar();
if ( m_searchWidget->isShown() != showSearch ) if ( m_searchWidget->isShown() != showSearch )
m_searchWidget->setShown( showSearch ); m_searchWidget->setShown( showSearch );
...@@ -595,7 +597,7 @@ void Part::slotNewConfig() ...@@ -595,7 +597,7 @@ void Part::slotNewConfig()
// update Main View and ThumbnailList contents // update Main View and ThumbnailList contents
// TODO do this only when changing Settings::renderMode() // TODO do this only when changing Settings::renderMode()
m_pageView->updateContents(); m_pageView->updateContents();
if ( showLeft && m_thumbnailList->isShown() ) if ( Settings::showLeftPanel() && m_thumbnailList->isShown() )
m_thumbnailList->updateWidgets(); m_thumbnailList->updateWidgets();
} }
......
...@@ -99,6 +99,7 @@ protected slots: ...@@ -99,6 +99,7 @@ protected slots:
void slotPrintPreview(); void slotPrintPreview();
void slotShowMenu(const KPDFPage *page, const QPoint &point); void slotShowMenu(const KPDFPage *page, const QPoint &point);
void slotShowProperties(); void slotShowProperties();
void slotShowLeftPanel();
void slotShowPresentation(); void slotShowPresentation();
// can be connected to widget elements // can be connected to widget elements
void updateViewActions(); void updateViewActions();
...@@ -109,7 +110,6 @@ public slots: ...@@ -109,7 +110,6 @@ public slots:
void slotPrint(); void slotPrint();
void restoreDocument(const KURL &url, int page); void restoreDocument(const KURL &url, int page);
void saveDocumentRestoreInfo(KConfig* config); void saveDocumentRestoreInfo(KConfig* config);
void slotWatchFile();
void slotFileDirty( const QString& ); void slotFileDirty( const QString& );
void slotDoFileDirty(); void slotDoFileDirty();
...@@ -148,8 +148,8 @@ private: ...@@ -148,8 +148,8 @@ private:
KAction *m_printPreview; KAction *m_printPreview;
KAction *m_showProperties; KAction *m_showProperties;
KAction *m_showPresentation; KAction *m_showPresentation;
KToggleAction* m_watchFile;
KToggleAction* m_showMenuBarAction; KToggleAction* m_showMenuBarAction;
KToggleAction* m_showLeftPanel;
KToggleAction* m_showFullScreenAction; KToggleAction* m_showFullScreenAction;
bool m_actionsSearched; bool m_actionsSearched;
bool m_searchStarted; bool m_searchStarted;
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<Action name="mouse_toggle_annotate"/> <Action name="mouse_toggle_annotate"/>
</Menu> </Menu>
<Menu name="settings"><text>&amp;Settings</text> <Menu name="settings"><text>&amp;Settings</text>
<Action name="watch_file" group="show_merge"/> <Action name="show_leftpanel" group="show_merge"/>
<Action name="preferences"/> <Action name="preferences"/>
</Menu> </Menu>
</MenuBar> </MenuBar>
......
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