X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/e15a9f3a8da1907b26195a1833588fc86a9d50ca..747a86573feb65e2ffe57cdae7dedf6ad272e789:/src/dolphinapplication.cpp diff --git a/src/dolphinapplication.cpp b/src/dolphinapplication.cpp index c418f4540..468c7a0f7 100644 --- a/src/dolphinapplication.cpp +++ b/src/dolphinapplication.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006 by Peter Penz * + * Copyright (C) 2006 by Peter Penz * * Copyright (C) 2006 by Holger 'zecke' Freyther * * * * This program is free software; you can redistribute it and/or modify * @@ -23,8 +23,8 @@ #include "dolphinviewcontainer.h" #include -#include -#include +#include +#include #include DolphinApplication::DolphinApplication() : @@ -37,7 +37,7 @@ DolphinApplication::DolphinApplication() : DolphinApplication::~DolphinApplication() { // cleanup what ever is left from the MainWindows - while (m_mainWindows.count() != 0) { + while (!m_mainWindows.isEmpty()) { delete m_mainWindows.takeFirst(); } } @@ -72,23 +72,27 @@ void DolphinApplication::refreshMainWindows() int DolphinApplication::newInstance() { KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); + static bool first = true; - QList urls; const int argsCount = args->count(); - for (int i = 0; i < argsCount; ++i) { - urls.append(args->url(i)); - } + if ((argsCount > 0) || !first || !isSessionRestored()) { + QList urls; + for (int i = 0; i < argsCount; ++i) { + urls.append(args->url(i)); + } - DolphinMainWindow* win = createMainWindow(); - if (urls.count() > 0) { - if (args->isSet("select")) { - win->openFiles(urls); - } else { - win->openDirectories(urls); + DolphinMainWindow* win = createMainWindow(); + if (urls.count() > 0) { + if (args->isSet("select")) { + win->openFiles(urls); + } else { + win->openDirectories(urls); + } } + win->show(); } - win->show(); + first = false; args->clear(); return 0; }