diff options
| author | Peter Penz <[email protected]> | 2008-03-23 15:50:58 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-03-23 15:50:58 +0000 |
| commit | acb61c69a6191bee82bb87f04153300ab0c86859 (patch) | |
| tree | 542cbcac3d6f9ce81f47fcfff1be20e491609b12 /src/dolphinapplication.cpp | |
| parent | ca1c2308314036f7f8a2ee812672704460a15c3a (diff) | |
Open Dolphin in the split-view when started with 2 URLs from the command line. Thanks to David Edmundson for the patch!
CCMAIL: [email protected]
svn path=/trunk/KDE/kdebase/apps/; revision=789204
Diffstat (limited to 'src/dolphinapplication.cpp')
| -rw-r--r-- | src/dolphinapplication.cpp | 38 |
1 files changed, 33 insertions, 5 deletions
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" |
