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
This commit is contained in:
Jakub Stachowski 2005-03-12 15:39:04 +00:00
parent 65738852b8
commit 664d441534
5 changed files with 51 additions and 90 deletions

2
TODO
View file

@ -66,7 +66,6 @@ More items (first items will enter 'In progress list' first):
-> core: pdf forms support (BR91809)
-> 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: add shortcut for showing/hiding it (BR99316)
-> add OCR for building TextPages out of pure graphical (aka scanned) pages
-> rotate the whole document / individual pages (on screen/print?) (BR99352)
-> 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):
-> cleanup code and update README.png
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: Internal data structures for annotations handling.
-> FIX: rmb when no doc displayed to restore menu

View file

@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>320</width>
<height>253</height>
<width>328</width>
<height>305</height>
</rect>
</property>
<vbox>
@ -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>
<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>
<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>
</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">
@ -214,20 +187,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>

View file

@ -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()
@ -375,16 +378,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 )
@ -567,15 +568,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 );
@ -595,7 +597,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();
}

4
part.h
View file

@ -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();
@ -148,8 +148,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;

View file

@ -42,7 +42,7 @@
<Action name="mouse_toggle_annotate"/>
</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>