[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdegraphics/kpdf/kpdf
From: Albert Astals Cid <tsdgeos () terra ! es>
Date: 2004-11-01 18:53:05
Message-ID: 20041101185305.211FA16C75 () office ! kde ! org
[Download RAW message or body]
CVS commit by aacid:
Do not crash when we do not find the kpart
M +10 -4 kpdf_shell.cpp 1.36
M +2 -0 kpdf_shell.h 1.16
M +5 -3 main.cpp 1.16
--- kdegraphics/kpdf/kpdf/kpdf_shell.cpp #1.35:1.36
@@ -75,7 +75,5 @@ Shell::Shell()
// itself can't do anything useful
KMessageBox::error(this, i18n("Unable to find kpdf part."));
- kapp->quit();
- // we return here, cause kapp->quit() only means "exit the
- // next time we enter the event loop...
+ m_part = 0;
return;
}
@@ -88,5 +86,10 @@ Shell::Shell()
Shell::~Shell()
{
- writeSettings();
+ if(m_part) writeSettings();
+}
+
+bool Shell::foundPart() const
+{
+ return m_part;
}
@@ -163,7 +166,10 @@ void Shell::readProperties(KConfig* conf
// the app is being restored. read in here whatever you wrote
// in 'saveProperties'
+ if(m_part)
+ {
KURL url ( config->readPathEntry( "URL" ) );
if ( url.isValid() )
openURL( url );
+ }
}
--- kdegraphics/kpdf/kpdf/kpdf_shell.h #1.15:1.16
@@ -45,4 +45,6 @@ namespace KPDF
Shell();
+ bool foundPart() const;
+
/**
* Default Destructor
--- kdegraphics/kpdf/kpdf/main.cpp #1.15:1.16
@@ -49,4 +49,5 @@ int main(int argc, char** argv)
KCmdLineArgs::addCmdLineOptions( options );
KApplication app;
+ KPDF::Shell* widget;
// see if we are starting with session management
@@ -60,5 +61,5 @@ int main(int argc, char** argv)
if (args->count() == 0)
{
- KPDF::Shell* widget = new KPDF::Shell;
+ widget = new KPDF::Shell;
widget->show();
}
@@ -67,5 +68,5 @@ int main(int argc, char** argv)
for (int i = 0; i < args->count(); ++i)
{
- KPDF::Shell* widget = new KPDF::Shell;
+ widget = new KPDF::Shell;
widget->show();
widget->openURL(args->url(i));
@@ -75,5 +76,6 @@ int main(int argc, char** argv)
}
- return app.exec();
+ if (widget -> foundPart()) return app.exec();
+ else return 1;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic