Commit 7fb48499 authored by Jakub Stachowski's avatar Jakub Stachowski

Backport fix for bug 99316 (accel for showing/hiding sidebar) from

experimental branch to HEAD.

svn path=/trunk/kdegraphics/kpdf/; revision=396986
parent 742ed0b9
......@@ -40,60 +40,25 @@
</property>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_ShowLeftPanel</cstring>
<cstring>kcfg_ShowSearchBar</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Show &amp;left panel</string>
<string>Show &amp;search bar in thumbnails list</string>
</property>
</widget>
<widget class="QLayoutWidget">
<widget class="QCheckBox">
<property name="name">
<cstring>layout5</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QCheckBox" row="0" column="1">
<property name="name">
<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>
<cstring>kcfg_SyncThumbnailsViewport</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Link the &amp;thumbnails with the page</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
......@@ -119,6 +84,14 @@
<string>&amp;Obey DRM limitations</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_WatchFile</cstring>
</property>
<property name="text">
<string>&amp;Watch File</string>
</property>
</widget>
</vbox>
</widget>
<widget class="QLayoutWidget">
......@@ -185,20 +158,6 @@
</spacer>
</vbox>
</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>
<include location="global" impldecl="in implementation">kdialog.h</include>
<include location="global" impldecl="in implementation">kiconloader.h</include>
......
......@@ -116,8 +116,10 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
m_splitter = new QSplitter( parentWidget, widgetName );
m_splitter->setOpaqueResize( true );
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] | []
m_leftPanel = new QWidget( m_splitter );
......@@ -149,6 +151,8 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
m_toolBox->addItem( thumbsBox, QIconSet(SmallIcon("thumbnail")), i18n("Thumbnails") );
m_toolBox->setCurrentItem( thumbsBox );
slotShowLeftPanel();
/* // [left toolbox: Annotations] | []
QFrame * editFrame = new QFrame( m_toolBox );
int iIdx = m_toolBox->addItem( editFrame, QIconSet(SmallIcon("pencil")), i18n("Annotations") );
......@@ -244,13 +248,13 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
splitterSizes.push_back( 500 );
}
m_splitter->setSizes( splitterSizes );
slotNewConfig();
m_watcher = new KDirWatch( this );
connect( m_watcher, SIGNAL( dirty( const QString& ) ), this, SLOT( slotFileDirty( const QString& ) ) );
m_dirtyHandler = new QTimer( this );
connect( m_dirtyHandler, SIGNAL( timeout() ),this, SLOT( slotDoFileDirty() ) );
slotNewConfig();
// [SPEECH] check for KTTSD presence and usability
KTrader::OfferList offers = KTrader::self()->query("DCOP/Text-to-Speech", "Name == 'KTTSD'");
Settings::setUseKTTSD( (offers.count() > 0) );
......@@ -258,7 +262,6 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
// set our XML-UI resource file
setXMLFile("part.rc");
updateViewActions();
slotWatchFile();
}
Part::~Part()
......@@ -377,16 +380,14 @@ bool Part::closeURL()
return KParts::ReadOnlyPart::closeURL();
}
void Part::slotWatchFile()
void Part::slotShowLeftPanel()
{
Settings::setWatchFile(m_watchFile->isChecked());
if( m_watchFile->isChecked() )
m_watcher->startScan();
else
{
m_dirtyHandler->stop();
m_watcher->stopScan();
}
bool showLeft = m_showLeftPanel->isChecked();
Settings::setShowLeftPanel(showLeft);
// show/hide left qtoolbox
m_leftPanel->setShown( showLeft );
// this needs to be hidden explicitly to disable thumbnails gen
m_thumbnailList->setShown( showLeft );
}
void Part::slotFileDirty( const QString& fileName )
......@@ -580,15 +581,16 @@ void Part::slotNewConfig()
// Apply settings here. A good policy is to check wether the setting has
// changed before applying changes.
// Left Panel and search Widget
bool showLeft = Settings::showLeftPanel();
if ( m_leftPanel->isShown() != showLeft )
// Watch File
bool watchFile = Settings::watchFile();
if ( watchFile && m_watcher->isStopped() )
m_watcher->startScan();
if ( !watchFile && !m_watcher->isStopped() )
{
// show/hide left qtoolbox
m_leftPanel->setShown( showLeft );
// this needs to be hidden explicitly to disable thumbnails gen
m_thumbnailList->setShown( showLeft );
m_dirtyHandler->stop();
m_watcher->stopScan();
}
bool showSearch = Settings::showSearchBar();
if ( m_searchWidget->isShown() != showSearch )
m_searchWidget->setShown( showSearch );
......@@ -608,7 +610,7 @@ void Part::slotNewConfig()
// update Main View and ThumbnailList contents
// TODO do this only when changing Settings::renderMode()
m_pageView->updateContents();
if ( showLeft && m_thumbnailList->isShown() )
if ( Settings::showLeftPanel() && m_thumbnailList->isShown() )
m_thumbnailList->updateWidgets();
}
......
......@@ -99,6 +99,7 @@ protected slots:
void slotPrintPreview();
void slotShowMenu(const KPDFPage *page, const QPoint &point);
void slotShowProperties();
void slotShowLeftPanel();
void slotShowPresentation();
// can be connected to widget elements
void updateViewActions();
......@@ -109,7 +110,6 @@ public slots:
void slotPrint();
void restoreDocument(const KURL &url, int page);
void saveDocumentRestoreInfo(KConfig* config);
void slotWatchFile();
void slotFileDirty( const QString& );
void slotDoFileDirty();
......@@ -149,8 +149,8 @@ private:
KAction *m_printPreview;
KAction *m_showProperties;
KAction *m_showPresentation;
KToggleAction* m_watchFile;
KToggleAction* m_showMenuBarAction;
KToggleAction* m_showLeftPanel;
KToggleAction* m_showFullScreenAction;
bool m_actionsSearched;
bool m_searchStarted;
......
......@@ -40,7 +40,7 @@
<Action name="mouse_select"/>
</Menu>
<Menu name="settings"><text>&amp;Settings</text>
<Action name="watch_file" group="show_merge"/>
<Action name="show_leftpanel" group="show_merge"/>
<Action name="preferences"/>
</Menu>
</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