┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorEmmanuel Pescosta <[email protected]>2015-04-27 12:55:53 +0200
committerEmmanuel Pescosta <[email protected]>2015-04-27 12:55:53 +0200
commit5acfb27760f3da1d4f794e820008f8a4c8ff7533 (patch)
tree8e35c3dd495c0c7d999fadbf9e25b66433572111 /src/main.cpp
parent06776451a72c395fca4b40196a6617366167ad66 (diff)
Simplify startup split view handling
* Instead of setting and resetting GeneralSettings's split view option, just pass it on to openFiles/openDirectories. * Require at least one url in openFiles/openDirectories REVIEW: 123395
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp38
1 files changed, 12 insertions, 26 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 105330059..cbfc6b72f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -113,36 +113,22 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
const QStringList args = parser.positionalArguments();
QList<QUrl> urls = Dolphin::validateUris(args);
- bool resetSplitSettings = false;
- if (parser.isSet("split") && !GeneralSettings::splitView()) {
- // Dolphin should be opened with a split view although this is not
- // set in the GeneralSettings. Temporary adjust the setting until
- // all passed URLs have been opened.
- GeneralSettings::setSplitView(true);
- resetSplitSettings = true;
-
- // We need 2 URLs to open Dolphin in split view mode
- if (urls.isEmpty()) { // No URL given - Open home URL in all two views
- urls.append(GeneralSettings::homeUrl());
- urls.append(GeneralSettings::homeUrl());
- } else if (urls.length() == 1) { // Only 1 URL given - Open given URL in all two views
- urls.append(urls.at(0));
- }
+ if (urls.isEmpty()) {
+ // We need at least one URL to open Dolphin
+ const QUrl homeUrl(QUrl::fromLocalFile(GeneralSettings::homeUrl()));
+ urls.append(homeUrl);
}
- if (!urls.isEmpty()) {
- if (parser.isSet("select")) {
- m_mainWindow->openFiles(urls);
- } else {
- m_mainWindow->openDirectories(urls);
- }
- } else {
- const QUrl homeUrl(QUrl::fromLocalFile(GeneralSettings::homeUrl()));
- m_mainWindow->openNewActivatedTab(homeUrl);
+ const bool splitView = parser.isSet("split") || GeneralSettings::splitView();
+ if (splitView && urls.size() < 2) {
+ // Split view does only make sense if we have at least 2 URLs
+ urls.append(urls.last());
}
- if (resetSplitSettings) {
- GeneralSettings::setSplitView(false);
+ if (parser.isSet("select")) {
+ m_mainWindow->openFiles(urls, splitView);
+ } else {
+ m_mainWindow->openDirectories(urls, splitView);
}
m_mainWindow->show();