Commit e7fadb9a authored by Enrico Ros's avatar Enrico Ros

merged patch_088 (tinyurl.com/8t5ec)

svn path=/branches/kpdf/annotations/kdegraphics/kpdf/; revision=428593
parent 51b07b31
......@@ -69,9 +69,8 @@ int main(int argc, char** argv)
{
for (int i = 0; i < args->count(); ++i)
{
KPDF::Shell* widget = new KPDF::Shell;
KPDF::Shell* widget = new KPDF::Shell(args->url(i));
widget->show();
widget->openURL(args->url(i));
}
}
args->clear();
......
......@@ -19,6 +19,7 @@
// qt/kde includes
#include <qcursor.h>
#include <qtimer.h>
#include <kaction.h>
#include <kapplication.h>
#include <kedittoolbar.h>
......@@ -41,6 +42,18 @@ using namespace KPDF;
Shell::Shell()
: KParts::MainWindow(0, "KPDF::Shell"), m_menuBarWasShown(true), m_toolBarWasShown(true)
{
init();
}
Shell::Shell(const KURL &url)
: KParts::MainWindow(0, "KPDF::Shell"), m_menuBarWasShown(true), m_toolBarWasShown(true)
{
m_openUrl = url;
init();
}
void Shell::init()
{
// set the shell's ui resource file
setXMLFile("shell.rc");
......@@ -83,6 +96,14 @@ Shell::Shell()
KMainWindowInterface kmwi(this);
kmwi.maximize();
}
setAutoSaveSettings();
if (m_openUrl.isValid()) QTimer::singleShot(0, this, SLOT(delayedOpen()));
}
void Shell::delayedOpen()
{
openURL(m_openUrl);
}
Shell::~Shell()
......@@ -140,7 +161,6 @@ void Shell::readSettings()
void Shell::writeSettings()
{
saveMainWindowSettings(KGlobal::config(), "MainWindow");
m_recent->saveEntries( KGlobal::config() );
KGlobal::config()->setDesktopGroup();
KGlobal::config()->writeEntry( "FullScreen", m_fullScreenAction->isChecked());
......@@ -200,7 +220,6 @@ Shell::fileOpen()
void
Shell::optionsConfigureToolbars()
{
saveMainWindowSettings(KGlobal::config(), "MainWindow");
KEditToolbar dlg(factory());
connect(&dlg, SIGNAL(newToolbarConfig()), this, SLOT(applyNewToolbarConfig()));
dlg.exec();
......
......@@ -24,7 +24,6 @@
namespace KPDF
{
class Part;
/**
* This is the application "Shell". It has a menubar and a toolbar
* but relies on the "Part" to do all the real work.
......@@ -43,6 +42,11 @@ namespace KPDF
*/
Shell();
/**
* Open an url
*/
Shell(const KURL &url);
/**
* Default Destructor
*/
......@@ -67,7 +71,6 @@ namespace KPDF
private slots:
void fileOpen();
void slotQuit();
void optionsConfigureToolbars();
......@@ -75,27 +78,28 @@ namespace KPDF
void slotUpdateFullScreen();
void slotShowMenubar();
public slots:
void openURL( const KURL & url );
void openURL( const KURL & url );
void delayedOpen();
signals:
void restoreDocument(const KURL &url, int page);
void saveDocumentRestoreInfo(KConfig* config);
void restoreDocument(const KURL &url, int page);
void saveDocumentRestoreInfo(KConfig* config);
private:
void setupAccel();
void setupActions();
void init();
private:
KParts::ReadOnlyPart* m_part;
KRecentFilesAction* m_recent;
KAction* m_printAction;
KToggleAction* m_fullScreenAction;
KToggleAction* m_showMenuBarAction;
KToggleAction* m_showToolBarAction;
bool m_menuBarWasShown, m_toolBarWasShown;
KParts::ReadOnlyPart* m_part;
KRecentFilesAction* m_recent;
KAction* m_printAction;
KToggleAction* m_fullScreenAction;
KToggleAction* m_showMenuBarAction;
KToggleAction* m_showToolBarAction;
bool m_menuBarWasShown, m_toolBarWasShown;
KURL m_openUrl;
};
}
#endif
......
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