Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 6d6a3bfc authored by Jaydeep Solanki's avatar Jaydeep Solanki Committed by Albert Astals Cid

Open a new Shell when opening a new file

BUGS: 166645
FIXED-IN: 4.10.0
REVIEW: 105965
GUI
parent 88a1a1aa
......@@ -1197,6 +1197,7 @@ bool Part::openFile()
bool canSearch = m_document->supportsSearching();
// update one-time actions
emit enableCloseAction( ok );
m_find->setEnabled( ok && canSearch );
m_findNext->setEnabled( ok && canSearch );
m_findPrev->setEnabled( ok && canSearch );
......@@ -1247,6 +1248,7 @@ bool Part::openFile()
// if can't open document, update windows so they display blank contents
m_pageView->viewport()->update();
m_thumbnailList->update();
setUrl( KUrl() );
return false;
}
......@@ -1371,6 +1373,7 @@ bool Part::closeUrl(bool promptToSave)
}
slotHidePresentation();
emit enableCloseAction( false );
m_find->setEnabled( false );
m_findNext->setEnabled( false );
m_findPrev->setEnabled( false );
......
......@@ -150,6 +150,7 @@ class Part : public KParts::ReadWritePart, public Okular::DocumentObserver, publ
void enablePrintAction(bool enable);
void openSourceReference(const QString& absFileName, int line, int column);
void viewerMenuStateChange(bool enabled);
void enableCloseAction(bool enable);
protected:
// reimplemented from KParts::ReadWritePart
......
......@@ -102,6 +102,7 @@ void Shell::init()
connect( this, SIGNAL(restoreDocument(KConfigGroup)),m_part, SLOT(restoreDocument(KConfigGroup)));
connect( this, SIGNAL(saveDocumentRestoreInfo(KConfigGroup&)), m_part, SLOT(saveDocumentRestoreInfo(KConfigGroup&)));
connect( m_part, SIGNAL(enablePrintAction(bool)), m_printAction, SLOT(setEnabled(bool)));
connect( m_part, SIGNAL(enableCloseAction(bool)), m_closeAction, SLOT(setEnabled(bool)));
readSettings();
......@@ -142,6 +143,13 @@ void Shell::openUrl( const KUrl & url )
{
if ( m_part )
{
if( !m_part->url().isEmpty() )
{
Shell* newShell = new Shell();
newShell->openUrl( url );
newShell->show();
return;
}
if ( m_doc && m_args && m_args->isSet( "presentation" ) )
m_doc->startPresentation();
bool openOk = m_part->openUrl( url );
......@@ -156,6 +164,10 @@ void Shell::openUrl( const KUrl & url )
}
}
void Shell::closeUrl()
{
m_part->closeUrl();
}
void Shell::readSettings()
{
......@@ -196,6 +208,8 @@ void Shell::setupActions()
m_recent->setWhatsThis( i18n( "<b>Click</b> to open a file or <b>Click and hold</b> to select a recent file" ) );
m_printAction = KStandardAction::print( m_part, SLOT(slotPrint()), actionCollection() );
m_printAction->setEnabled( false );
m_closeAction = KStandardAction::close( this, SLOT(closeUrl()), actionCollection() );
m_closeAction->setEnabled( false );
KStandardAction::quit(this, SLOT(slotQuit()), actionCollection());
setStandardToolBarMenuEnabled(true);
......@@ -284,7 +298,6 @@ void Shell::fileOpen()
KUrl url = dlg.selectedUrl();
if ( !url.isEmpty() )
{
m_part->closeUrl( false );
openUrl( url );
}
}
......
......@@ -86,6 +86,7 @@ private slots:
void openUrl( const KUrl & url );
void delayedOpen();
void showOpenRecentMenu();
void closeUrl();
signals:
void restoreDocument(const KConfigGroup &group);
......@@ -105,6 +106,7 @@ private:
QStringList m_fileformats;
bool m_fileformatsscanned;
KAction* m_printAction;
KAction* m_closeAction;
KToggleAction* m_fullScreenAction;
KToggleAction* m_showMenuBarAction;
bool m_menuBarWasShown, m_toolBarWasShown;
......
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