From 6ee9f08e8fc90cc67cd2ed83ae6f2dd5c1846ba3 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Thu, 22 Mar 2007 07:19:07 +0000 Subject: Use KUniqueApplication::newInstance() as David suggested some time ago. This simplifies the code and solves the issue that the window is not moved to the foreground when opening new main windows. svn path=/trunk/KDE/kdebase/apps/; revision=645276 --- src/main.cpp | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 5a6d3dd8e..47095c3a5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,18 +33,6 @@ static KCmdLineOptions options[] = KCmdLineLastOption }; -void openWindow(DolphinApplication* app, const QString& url = QString()) -{ - if (app != 0) { - app->openWindow(url); - return; - } - - static QDBusInterface dbusIface("org.kde.dolphin", "/dolphin/Application", "", - QDBusConnection::connectToBus(QDBusConnection::SessionBus, "session_bus")); - QDBusReply reply = dbusIface.call("openWindow", url); -} - int main(int argc, char **argv) { KAboutData about("dolphin", @@ -67,11 +55,10 @@ int main(int argc, char **argv) KCmdLineArgs::init(argc, argv, &about); KCmdLineArgs::addCmdLineOptions(options); - DolphinApplication *app = 0; + + DolphinApplication* app = 0; if (DolphinApplication::start()) { app = new DolphinApplication(); - } - #ifdef __GNUC__ #warning TODO, SessionManagement @@ -85,18 +72,11 @@ int main(int argc, char **argv) } } else { #endif - - KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); - if (args->count() > 0) { - for (int i = 0; i < args->count(); ++i) { - openWindow(app, args->arg(i)); - } - } - else { - openWindow(app); - } - args->clear(); - if (app != 0) { return app->exec(); } + + static QDBusInterface dbusIface("org.kde.dolphin", "/dolphin/Application", "", + QDBusConnection::connectToBus(QDBusConnection::SessionBus, "session_bus")); + dbusIface.call("openWindow"); + return 0; } -- cgit v1.3