From: Peter Penz Date: Sun, 23 Mar 2008 15:50:58 +0000 (+0000) Subject: Open Dolphin in the split-view when started with 2 URLs from the command line. Thanks... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/acb61c69a6191bee82bb87f04153300ab0c86859?ds=sidebyside Open Dolphin in the split-view when started with 2 URLs from the command line. Thanks to David Edmundson for the patch! CCMAIL: david@davidedmundson.co.uk svn path=/trunk/KDE/kdebase/apps/; revision=789204 --- diff --git a/src/dolphinapplication.cpp b/src/dolphinapplication.cpp index 4bec27492..c5c1969e5 100644 --- a/src/dolphinapplication.cpp +++ b/src/dolphinapplication.cpp @@ -76,17 +76,30 @@ int DolphinApplication::newInstance() KCmdLineArgs::setCwd(QDir::currentPath().toUtf8()); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); static bool first = true; - if (args->count() > 0) { + + switch (args->count()) { + case 0: + if( !first || !isSessionRestored()) { + openWindow(KUrl()); + } + break; + + case 1: + openWindow(args->url(0)); + break; + + case 2: + openSplitWindow(args->url(0),args->url(1)); + break; + + default: for (int i = 0; i < args->count(); ++i) { openWindow(args->url(i)); } - } else if( !first || !isSessionRestored()) { - openWindow(KUrl()); } - first = false; + first = false; args->clear(); - return 0; } @@ -100,4 +113,19 @@ int DolphinApplication::openWindow(const KUrl& url) return win->getId(); } +int DolphinApplication::openSplitWindow(const KUrl& leftUrl, const KUrl& rightUrl) +{ + DolphinMainWindow* win = createMainWindow(); + if ((win->activeViewContainer() != 0) && leftUrl.isValid()) { + win->activeViewContainer()->setUrl(leftUrl); + } + win->toggleSplitView(); + if ((win->activeViewContainer() != 0) && rightUrl.isValid()){ + win->activeViewContainer()->setUrl(rightUrl); + } + win->show(); + return win->getId(); +} + + #include "dolphinapplication.moc" diff --git a/src/dolphinapplication.h b/src/dolphinapplication.h index 8b19e6ef2..af2006e7d 100644 --- a/src/dolphinapplication.h +++ b/src/dolphinapplication.h @@ -58,6 +58,7 @@ public: public slots: int openWindow(const KUrl& url); + int openSplitWindow(const KUrl& leftUrl,const KUrl& rightUrl); protected: /** Called by the DolphinMainWindow to deregister. */