diff options
Diffstat (limited to 'src/application.cpp')
-rw-r--r-- | src/application.cpp | 98 |
1 files changed, 19 insertions, 79 deletions
diff --git a/src/application.cpp b/src/application.cpp index f3bb5559..126eb020 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -38,17 +38,13 @@ Application::~Application() // saveConfiguration(); // Destroy all windows... - /*Q_FOREACH(QWeakPointer<RekonqWindow> pointer, m_rekonqWindows) - { - delete pointer.data(); - pointer.clear(); - }*/ + for (const auto &window : m_windows) delete window; // Destroy all web apps - for (auto *webApp : m_webApps) delete webApp; + for (const auto &view : m_views) delete view; // Unload all plugins - for (auto *plugin : m_plugins) { + for (const auto &plugin : m_plugins) { plugin->unload(); delete plugin; } @@ -322,74 +318,6 @@ void Application::saveConfiguration() const // -------------------------------------------------------------------------------------------------------------------- -RekonqWindow *Application::rekonqWindow(const QString & activityID) -{ - RekonqWindow *active = qobject_cast<RekonqWindow*>(QApplication::activeWindow()); - - if (!active) - { - RekonqWindowList wList = m_rekonqWindows; -#ifdef HAVE_KACTIVITIES - wList = tabsForActivity(activityID); -#endif - - if (wList.isEmpty()) - return 0; - - Q_FOREACH(const QWeakPointer<RekonqWindow> &pointer, wList) - { - if (KWindowInfo(pointer.data()->effectiveWinId(), NET::WMDesktop, 0).isOnCurrentDesktop()) - return pointer.data(); - } - return wList.at(0).data(); - } - return active; -} - - -RekonqWindowList Application::tabsForActivity(const QString & activityID) -{ -#ifdef HAVE_KACTIVITIES - QString id = activityID; - if ( id.isEmpty() ) - id = m_activityConsumer->currentActivity(); - - return m_activityRekonqWindowsMap[id]; -#else - return m_rekonqWindows; -#endif -} - - -bool Application::haveWindowsForActivity(const QString & activityID) -{ - return (!tabsForActivity(activityID).isEmpty()); -} - - -// ----------------------------------------------------------------------------------------------------------- - - -RekonqWindow *Application::newWindow(bool withTab, bool PrivateBrowsingMode) -{ - RekonqWindow *w = new RekonqWindow(withTab, PrivateBrowsingMode); - setWindowInfo(w); - w->show(); - - return w; -} - - -RekonqWindow *Application::newWindow(WebPage *pg) -{ - RekonqWindow *w = new RekonqWindow(pg); - setWindowInfo(w); - w->show(); - - return w; -} - - void Application::setWindowInfo(RekonqWindow *w) { // set object name @@ -410,10 +338,19 @@ void Application::setWindowInfo(RekonqWindow *w) // ----------------------------------------------------------------------------------------------------------- // Slots -rView *Application::newWebApp(const QUrl &url) +RekonqWindow *Application::newWindow() +{ + auto *window = new RekonqWindow; + m_windows.append(window); + + window->show(); + return window; +} + +rView *Application::newView(const QUrl &url, RekonqWindow *window) { RekonqPluginInterface *interface = nullptr; - for (auto *plugin : m_plugins) + for (const auto &plugin : m_plugins) if (plugin->hasScheme(url.scheme())) { interface = plugin->interface(); break; @@ -425,9 +362,12 @@ rView *Application::newWebApp(const QUrl &url) Q_CHECK_PTR(view); // tab->installEventFilter(this); - m_webApps.append(view); + if (window) window->addView(view); + else { + m_views.append(view); + view->show(); + } - view->show(); return view; } |