summaryrefslogtreecommitdiffstats
path: root/installerbuilder/installerbase/installerbase.cpp
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@nokia.com>2011-07-29 16:10:54 +0200
committerTim Jenssen <tim.jenssen@nokia.com>2011-07-29 16:12:20 +0200
commit6f811f4895bf3e9e2605b926a2e4e82cd5350a71 (patch)
tree437c78ab113b4ca5c2a464402f1639938511a753 /installerbuilder/installerbase/installerbase.cpp
parent1b6209a1502f28bc22011f0fb8b3607d4f4099d2 (diff)
now we forward exceptions from script and queue slots
Diffstat (limited to 'installerbuilder/installerbase/installerbase.cpp')
-rw-r--r--installerbuilder/installerbase/installerbase.cpp40
1 files changed, 37 insertions, 3 deletions
diff --git a/installerbuilder/installerbase/installerbase.cpp b/installerbuilder/installerbase/installerbase.cpp
index 18352d058..f7d611375 100644
--- a/installerbuilder/installerbase/installerbase.cpp
+++ b/installerbuilder/installerbase/installerbase.cpp
@@ -72,6 +72,40 @@ public:
}
};
+class MyApplication : public QApplication {
+public:
+ MyApplication(int& argc, char ** argv) :
+ QApplication(argc, argv) { }
+ virtual ~MyApplication() { }
+
+ // reimplemented from QApplication so we can throw exceptions in scripts and slots
+ virtual bool notify(QObject * receiver, QEvent * event) {
+ try {
+ return QApplication::notify(receiver, event);
+ } catch(std::exception& e) {
+ qCritical() << "Exception thrown:" << e.what();
+ }
+ return false;
+ }
+};
+
+class MyCoreApplication : public QCoreApplication {
+public:
+ MyCoreApplication(int& argc, char ** argv) :
+ QCoreApplication(argc, argv) { }
+ virtual ~MyCoreApplication() { }
+
+ // reimplemented from QCoreApplication so we can throw exceptions in scripts and slots
+ virtual bool notify(QObject * receiver, QEvent * event) {
+ try {
+ return QCoreApplication::notify(receiver, event);
+ } catch(std::exception& e) {
+ qCritical() << "Exception thrown:" << e.what();
+ }
+ return false;
+ }
+};
+
static QList<Repository> repositories(const QStringList &arguments, const int index)
{
QList<Repository> repoList;
@@ -98,7 +132,7 @@ int main(int argc, char *argv[])
try {
// this is the FSEngineServer as an admin rights process upon request:
if (args.count() >= 3 && args[1] == QLatin1String("--startserver")) {
- QCoreApplication app(argc, argv);
+ MyCoreApplication app(argc, argv);
FSEngineServer* const server = new FSEngineServer(args[2].toInt());
if (args.count() >= 4)
server->setAuthorizationKey(args[3]);
@@ -120,7 +154,7 @@ int main(int argc, char *argv[])
#endif
if (args.contains(QLatin1String("--checkupdates"))) {
- QCoreApplication app(argc, argv);
+ MyCoreApplication app(argc, argv);
if (runCheck.isRunning(KDRunOnceChecker::ProcessList))
return 0;
@@ -130,7 +164,7 @@ int main(int argc, char *argv[])
}
// from here, the "normal" installer binary is running
- QApplication app(argc, argv);
+ MyApplication app(argc, argv);
if (runCheck.isRunning(KDRunOnceChecker::ProcessList)) {
if (runCheck.isRunning(KDRunOnceChecker::Lockfile))