diff options
| author | Mathieu Tarral <[email protected]> | 2015-02-04 10:22:03 +0100 |
|---|---|---|
| committer | Emmanuel Pescosta <[email protected]> | 2015-02-04 10:22:03 +0100 |
| commit | c7258487094c7e16258ad90e384c3a87605dfc95 (patch) | |
| tree | 78d6a990ebf0569bd9fe609913143f064f1d09c5 /src/dolphinapplication.cpp | |
| parent | b15ee4cf70a23e04a74b368dce7ab2a20afe944d (diff) | |
Port Dolphin away from KApplication, KCmdLineArgs and K4AboutData
Diffstat (limited to 'src/dolphinapplication.cpp')
| -rw-r--r-- | src/dolphinapplication.cpp | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/src/dolphinapplication.cpp b/src/dolphinapplication.cpp deleted file mode 100644 index da9358e37..000000000 --- a/src/dolphinapplication.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2011 by Peter Penz <[email protected]> * - * Copyright (C) 2006 by Holger 'zecke' Freyther <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "dolphinapplication.h" -#include "dolphinmainwindow.h" -#include "dolphin_generalsettings.h" - -#include <KCmdLineArgs> -#include <KDebug> -#include <QUrl> - -DolphinApplication::DolphinApplication() : - m_mainWindow(0) -{ - m_mainWindow = new DolphinMainWindow(); - m_mainWindow->setAttribute(Qt::WA_DeleteOnClose); - - KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); - - const int argsCount = args->count(); - - QList<QUrl> urls; - for (int i = 0; i < argsCount; ++i) { - const QUrl url = args->url(i); - if (url.isValid()) { - urls.append(url); - } - } - - bool resetSplitSettings = false; - if (args->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()) { - if (args->isSet("select")) { - m_mainWindow->openFiles(urls); - } else { - m_mainWindow->openDirectories(urls); - } - } else { - const QUrl homeUrl(QUrl::fromLocalFile(GeneralSettings::homeUrl())); - m_mainWindow->openNewActivatedTab(homeUrl); - } - - if (resetSplitSettings) { - GeneralSettings::setSplitView(false); - } - - args->clear(); - - m_mainWindow->show(); -} - -DolphinApplication::~DolphinApplication() -{ -} - -DolphinApplication* DolphinApplication::app() -{ - return qobject_cast<DolphinApplication*>(qApp); -} - -void DolphinApplication::restoreSession() -{ - const QString className = KXmlGuiWindow::classNameOfToplevel(1); - if (className == QLatin1String("DolphinMainWindow")) { - m_mainWindow->restore(1); - } else { - kWarning() << "Unknown class " << className << " in session saved data!"; - } -} - |
