Commit 7c92c4a4 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Adapt to r676616

Start the part in dummy mode if one of the args we get passed is "Print/Preview"

svn path=/trunk/KDE/kdegraphics/okular/; revision=676617
parent fcc47e41
......@@ -94,7 +94,7 @@ static QAction* actionForExportFormat( const Okular::ExportFormat& format, QObje
Part::Part(QWidget *parentWidget,
QObject *parent,
const QStringList & /*args*/ )
const QStringList &args )
: KParts::ReadOnlyPart(parent),
m_showMenuBarAction(0), m_showFullScreenAction(0), m_actionsSearched(false),
m_searchStarted(false), m_cliPresentation(false)
......@@ -292,13 +292,9 @@ m_searchStarted(false), m_cliPresentation(false)
ac->addAction("last_page",m_lastPage);
m_lastPage->setWhatsThis( i18n( "Moves to the last page of the document" ) );
m_historyBack = KStandardAction::back( this, SLOT( slotHistoryBack() ), ac );
ac->addAction("history_back",m_historyBack);
m_historyBack->setWhatsThis( i18n( "Go to the place you were before" ) );
m_historyNext = KStandardAction::forward( this, SLOT( slotHistoryNext() ), ac);
ac->addAction("history_forward",m_historyNext);
m_historyNext->setWhatsThis( i18n( "Go to the place you were after" ) );
// we do not want back and next in history in the dummy mode
m_historyBack = 0;
m_historyNext = 0;
m_addBookmark = KStandardAction::addBookmark( this, SLOT( slotAddBookmark() ), ac );
m_addBookmarkText = m_addBookmark->text();
......@@ -445,10 +441,9 @@ m_searchStarted(false), m_cliPresentation(false)
//
updateViewActions();
// By default we start with a clean UI so that for example print preview
// does not get all the stuff embedded
m_dummyMode = true;
m_leftPanel->hide();
if (!args.contains("Print/Preview")) unsetDummyMode();
}
......@@ -960,8 +955,8 @@ void Part::updateViewActions()
m_prevPage->setEnabled( !atBegin );
m_lastPage->setEnabled( !atEnd );
m_nextPage->setEnabled( !atEnd );
m_historyBack->setEnabled( !m_document->historyAtBegin() );
m_historyNext->setEnabled( !m_document->historyAtEnd() );
if (m_historyBack) m_historyBack->setEnabled( !m_document->historyAtBegin() );
if (m_historyNext) m_historyNext->setEnabled( !m_document->historyAtEnd() );
m_reload->setEnabled( true );
}
else
......@@ -971,8 +966,8 @@ void Part::updateViewActions()
m_lastPage->setEnabled( false );
m_prevPage->setEnabled( false );
m_nextPage->setEnabled( false );
m_historyBack->setEnabled( false );
m_historyNext->setEnabled( false );
if (m_historyBack) m_historyBack->setEnabled( false );
if (m_historyNext) m_historyNext->setEnabled( false );
m_reload->setEnabled( false );
}
updateBookmarksActions();
......@@ -1610,6 +1605,15 @@ void Part::unsetDummyMode()
m_leftPanel->setVisible( Okular::Settings::showLeftPanel() );
// add back and next in history
m_historyBack = KStandardAction::back( this, SLOT( slotHistoryBack() ), actionCollection() );
actionCollection()->addAction("history_back",m_historyBack);
m_historyBack->setWhatsThis( i18n( "Go to the place you were before" ) );
m_historyNext = KStandardAction::forward( this, SLOT( slotHistoryNext() ), actionCollection());
actionCollection()->addAction("history_forward",m_historyNext);
m_historyNext->setWhatsThis( i18n( "Go to the place you were after" ) );
// apply configuration (both internal settings and GUI configured items)
QList<int> splitterSizes = Okular::Settings::splitterSizes();
if ( !splitterSizes.count() )
......@@ -1626,6 +1630,9 @@ void Part::unsetDummyMode()
// attach the actions of the children widgets too
m_formsMessage->setActionButton( m_pageView->toggleFormsAction() );
// ensure history actions are in the correct state
updateViewActions();
}
......
......@@ -164,13 +164,14 @@ class Part : public KParts::ReadOnlyPart, public Okular::DocumentObserver, publi
void slotFileDirty( const QString& );
void slotDoFileDirty();
void psTransformEnded(int, QProcess::ExitStatus);
void unsetDummyMode();
private:
void doPrint( KPrinter& printer );
bool handleCompressed(KUrl & url, const QString &path, const KMimeType::Ptr mimetype);
void rebuildBookmarkMenu( bool unplugActions = true );
void updateAboutBackendAction();
void unsetDummyMode();
KTemporaryFile *m_tempfile;
// the document
......
......@@ -71,9 +71,6 @@ void Shell::init()
m_part = (KParts::ReadOnlyPart*) factory->createPart(this, this);
if (m_part)
{
// we don't want the dummy mode
QMetaObject::invokeMethod(m_part, "unsetDummyMode");
// then, setup our actions
setupActions();
// tell the KParts::MainWindow that this is indeed the main widget
......
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