Commit 7c8cc68a authored by Pino Toscano's avatar Pino Toscano

Add a Reload menu item to manually reload a document.

Useful for example when not using the watching file features.
Implements KPDF bug #136820.

svn path=/trunk/KDE/kdegraphics/okular/; revision=661681
parent c2b0c102
......@@ -46,6 +46,7 @@
#include <kxmlguifactory.h>
#include <kservicetypetrader.h>
#include <kstandarddirs.h>
#include <kstandardshortcut.h>
#include <ktemporaryfile.h>
#include <ktoggleaction.h>
#include <ktogglefullscreenaction.h>
......@@ -405,6 +406,14 @@ m_searchStarted(false), m_cliPresentation(false)
m_aboutBackend->setText(i18n("About backend..."));
connect(m_aboutBackend, SIGNAL(triggered()), this, SLOT(slotAboutBackend()));
KAction *reload = ac->add<KAction>( "file_reload" );
reload->setText( i18n( "Reloa&d" ) );
reload->setIcon( KIcon( "view-refresh" ) );
reload->setWhatsThis( i18n( "Reload the current document from disk." ) );
connect( reload, SIGNAL(triggered()), this, SLOT(slotReload()) );
reload->setShortcut( KStandardShortcut::reload() );
m_reload = reload;
KAction *closeFindBar = new KAction( i18n( "Close &Find Bar" ), ac );
ac->addAction("close_find_bar", closeFindBar);
connect(closeFindBar, SIGNAL(triggered()), this, SLOT(slotHideFindBar()));
......@@ -933,6 +942,7 @@ void Part::updateViewActions()
m_nextPage->setEnabled( !atEnd );
m_historyBack->setEnabled( !m_document->historyAtBegin() );
m_historyNext->setEnabled( !m_document->historyAtEnd() );
m_reload->setEnabled( true );
}
else
{
......@@ -943,6 +953,7 @@ void Part::updateViewActions()
m_nextPage->setEnabled( false );
m_historyBack->setEnabled( false );
m_historyNext->setEnabled( false );
m_reload->setEnabled( false );
}
updateBookmarksActions();
}
......@@ -1410,6 +1421,16 @@ void Part::slotExportAs(QAction * act)
}
void Part::slotReload()
{
// stop the dirty handler timer, otherwise we may conflict with the
// auto-refresh system
m_dirtyHandler->stop();
slotDoFileDirty();
}
void Part::slotPrint()
{
if (m_document->pages() == 0) return;
......
......@@ -140,6 +140,7 @@ class Part : public KParts::ReadOnlyPart, public Okular::DocumentObserver, publi
void slotExportAs(QAction *);
bool slotImportPSFile();
void slotAboutBackend();
void slotReload();
void close();
void cannotQuit();
void splitterMoved( int pos, int index );
......@@ -227,6 +228,7 @@ class Part : public KParts::ReadOnlyPart, public Okular::DocumentObserver, publi
KToggleAction* m_showLeftPanel;
KToggleFullScreenAction* m_showFullScreenAction;
QAction *m_aboutBackend;
QAction *m_reload;
bool m_actionsSearched;
bool m_searchStarted;
......
......@@ -5,6 +5,7 @@
<Action name="get_new_stuff" group="file_open"/>
<Action name="import_ps" group="file_open"/>
<Action name="save" group="file_save"/>
<Action name="file_reload" group="file_save"/>
<Action name="file_print" group="file_print"/>
<Action name="file_print_preview" group="file_print"/>
<Action name="properties" group="file_print"/>
......
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