/***************************************************************************
- * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
+ * Copyright (C) 2006 by Peter Penz <peter.penz19@gmail.com> *
* Copyright (C) 2006 by Holger 'zecke' Freyther <freyther@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
#include "dolphinviewcontainer.h"
#include <applicationadaptor.h>
-#include <kcmdlineargs.h>
-#include <kurl.h>
+#include <KCmdLineArgs>
+#include <KUrl>
#include <QtDBus/QDBusConnection>
DolphinApplication::DolphinApplication() :
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
static bool first = true;
- switch (args->count()) {
- case 0:
- if( !first || !isSessionRestored()) {
- openWindow(KUrl());
+ const int argsCount = args->count();
+ if ((argsCount > 0) || !first || !isSessionRestored()) {
+ QList<KUrl> urls;
+ for (int i = 0; i < argsCount; ++i) {
+ urls.append(args->url(i));
}
- 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));
+ DolphinMainWindow* win = createMainWindow();
+ if (urls.count() > 0) {
+ if (args->isSet("select")) {
+ win->openFiles(urls);
+ } else {
+ win->openDirectories(urls);
+ }
}
+ win->show();
}
first = false;
return 0;
}
-int DolphinApplication::openWindow(const KUrl& url)
+int DolphinApplication::openWindow(const QString& urlString)
{
DolphinMainWindow* win = createMainWindow();
- if ((win->activeViewContainer() != 0) && url.isValid()) {
- win->activeViewContainer()->setUrl(url);
+ const KUrl url(urlString);
+ if (!url.isEmpty()) {
+ win->openDirectories(QList<KUrl>() << url);
}
win->show();
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"