diff options
author | Pierre Rossi <pierre.rossi@gmail.com> | 2011-02-24 18:35:20 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-02-24 18:38:45 +0100 |
commit | 23b44d0344304499ba8e1f199720202381920827 (patch) | |
tree | edd144e38d6dc3619b8b889f3a80a69a8dc52180 /src | |
parent | Save one updateRightIcons call from the bookmark icon. (diff) | |
download | rekonq-23b44d0344304499ba8e1f199720202381920827.tar.xz |
No more static members in the Application class,
an rApp shortcut for Application::instance,
clean up code switching to use the new shortcut
Reviewed by: adjam
Diffstat (limited to 'src')
34 files changed, 206 insertions, 230 deletions
diff --git a/src/application.cpp b/src/application.cpp index 9702c139..9a0874d1 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -65,14 +65,6 @@ #include <QVBoxLayout> -QWeakPointer<AdBlockManager> Application::s_adblockManager; -QWeakPointer<BookmarkProvider> Application::s_bookmarkProvider; -QWeakPointer<HistoryManager> Application::s_historyManager; -QWeakPointer<IconManager> Application::s_iconManager; -QWeakPointer<OpenSearchManager> Application::s_opensearchManager; -QWeakPointer<SessionManager> Application::s_sessionManager; - - using namespace ThreadWeaver; @@ -96,26 +88,11 @@ Application::~Application() ReKonfig::setRecoverOnCrash(0); saveConfiguration(); - foreach(QWeakPointer<MainWindow> window, m_mainWindows) + Q_FOREACH(QWeakPointer<MainWindow> window, m_mainWindows) { delete window.data(); window.clear(); } - - delete s_bookmarkProvider.data(); - s_bookmarkProvider.clear(); - - delete s_historyManager.data(); - s_historyManager.clear(); - - delete s_sessionManager.data(); - s_sessionManager.clear(); - - delete s_adblockManager.data(); - s_adblockManager.clear(); - - delete s_opensearchManager.data(); - s_opensearchManager.clear(); } @@ -249,12 +226,12 @@ void Application::postLaunch() setWindowIcon(KIcon("rekonq")); - Application::historyManager(); - Application::sessionManager()->setSessionManagementEnabled(true); + historyManager(); + sessionManager()->setSessionManagementEnabled(true); // bookmarks loading - connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)), - Application::instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType&))); + connect(bookmarkProvider(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)), + instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType&))); // crash recovering ReKonfig::setRecoverOnCrash(ReKonfig::recoverOnCrash() + 1); @@ -285,52 +262,52 @@ MainWindow *Application::mainWindow() HistoryManager *Application::historyManager() { - if (s_historyManager.isNull()) + if (m_historyManager.isNull()) { - s_historyManager = new HistoryManager(); - QWebHistoryInterface::setDefaultInterface(s_historyManager.data()); + m_historyManager = new HistoryManager(instance()); + QWebHistoryInterface::setDefaultInterface(m_historyManager.data()); } - return s_historyManager.data(); + return m_historyManager.data(); } BookmarkProvider *Application::bookmarkProvider() { - if (s_bookmarkProvider.isNull()) + if (m_bookmarkProvider.isNull()) { - s_bookmarkProvider = new BookmarkProvider(instance()); + m_bookmarkProvider = new BookmarkProvider(instance()); } - return s_bookmarkProvider.data(); + return m_bookmarkProvider.data(); } SessionManager *Application::sessionManager() { - if (s_sessionManager.isNull()) + if (m_sessionManager.isNull()) { - s_sessionManager = new SessionManager(instance()); + m_sessionManager = new SessionManager(instance()); } - return s_sessionManager.data(); + return m_sessionManager.data(); } OpenSearchManager *Application::opensearchManager() { - if (s_opensearchManager.isNull()) + if (m_opensearchManager.isNull()) { - s_opensearchManager = new OpenSearchManager(instance()); + m_opensearchManager = new OpenSearchManager(instance()); } - return s_opensearchManager.data(); + return m_opensearchManager.data(); } IconManager *Application::iconManager() { - if (s_iconManager.isNull()) + if (m_iconManager.isNull()) { - s_iconManager = new IconManager(instance()); + m_iconManager = new IconManager(instance()); } - return s_iconManager.data(); + return m_iconManager.data(); } @@ -421,11 +398,11 @@ MainWindowList Application::mainWindowList() AdBlockManager *Application::adblockManager() { - if (s_adblockManager.isNull()) + if (m_adblockManager.isNull()) { - s_adblockManager = new AdBlockManager(instance()); + m_adblockManager = new AdBlockManager(instance()); } - return s_adblockManager.data(); + return m_adblockManager.data(); } @@ -534,8 +511,8 @@ void Application::updateConfiguration() defaultSettings->setUserStyleSheetUrl(ReKonfig::userCSS()); // ====== load Settings on main classes - Application::historyManager()->loadSettings(); - Application::adblockManager()->loadSettings(); + historyManager()->loadSettings(); + adblockManager()->loadSettings(); if(!ReKonfig::useFavicon()) mainWindow()->setWindowIcon(KIcon("rekonq")); else diff --git a/src/application.h b/src/application.h index b30e337c..a81eaf0d 100644 --- a/src/application.h +++ b/src/application.h @@ -52,7 +52,6 @@ class SessionManager; class KAction; - namespace ThreadWeaver {class Job;} @@ -81,6 +80,7 @@ public: // --------------------------------------------------------------------------------------------------------------- +#define rApp Application::instance() /** * @@ -99,12 +99,12 @@ public: MainWindow *newMainWindow(bool withTab = true); MainWindowList mainWindowList(); - static HistoryManager *historyManager(); - static BookmarkProvider *bookmarkProvider(); - static SessionManager *sessionManager(); - static AdBlockManager *adblockManager(); - static OpenSearchManager *opensearchManager(); - static IconManager *iconManager(); + HistoryManager *historyManager(); + BookmarkProvider *bookmarkProvider(); + SessionManager *sessionManager(); + AdBlockManager *adblockManager(); + OpenSearchManager *opensearchManager(); + IconManager *iconManager(); // DOWNLOADS MANAGEMENT METHODS void addDownload(const QString &srcUrl, const QString &destUrl); @@ -142,12 +142,12 @@ private slots: void setPrivateBrowsingMode(bool); private: - static QWeakPointer<HistoryManager> s_historyManager; - static QWeakPointer<BookmarkProvider> s_bookmarkProvider; - static QWeakPointer<SessionManager> s_sessionManager; - static QWeakPointer<AdBlockManager> s_adblockManager; - static QWeakPointer<OpenSearchManager> s_opensearchManager; - static QWeakPointer<IconManager> s_iconManager; + QWeakPointer<HistoryManager> m_historyManager; + QWeakPointer<BookmarkProvider> m_bookmarkProvider; + QWeakPointer<SessionManager> m_sessionManager; + QWeakPointer<AdBlockManager> m_adblockManager; + QWeakPointer<OpenSearchManager> m_opensearchManager; + QWeakPointer<IconManager> m_iconManager; MainWindowList m_mainWindows; diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp index b7aa4a4e..219834f0 100644 --- a/src/bookmarks/bookmarkowner.cpp +++ b/src/bookmarks/bookmarkowner.cpp @@ -97,20 +97,20 @@ KAction* BookmarkOwner::createAction(const KBookmark &bookmark, const BookmarkAc QString BookmarkOwner::currentTitle() const { - return Application::instance()->mainWindow()->currentTab()->view()->title(); + return rApp->mainWindow()->currentTab()->view()->title(); } QString BookmarkOwner::currentUrl() const { - return Application::instance()->mainWindow()->currentTab()->url().url(); + return rApp->mainWindow()->currentTab()->url().url(); } QList< QPair<QString, QString> > BookmarkOwner::currentBookmarkList() const { QList< QPair<QString, QString> > bkList; - MainView *view = Application::instance()->mainWindow()->mainView(); + MainView *view = rApp->mainWindow()->mainView(); int tabNumber = view->count(); for (int i = 0; i < tabNumber; ++i) @@ -143,7 +143,7 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bkGoup) if (urlList.length() > 8) { if (KMessageBox::warningContinueCancel( - Application::instance()->mainWindow(), + rApp->mainWindow(), i18ncp("%1=Number of tabs. Value is always >=8", "You are about to open %1 tabs.\nAre you sure?", "You are about to open %1 tabs.\nAre you sure?", urlList.length())) @@ -197,7 +197,7 @@ KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark) } else { - parent = Application::bookmarkProvider()->rootGroup(); + parent = rApp->bookmarkProvider()->rootGroup(); } KBookmark newBk = parent.addBookmark(currentTitle(), KUrl(currentUrl())); @@ -260,7 +260,7 @@ KBookmark BookmarkOwner::newSeparator(const KBookmark &bookmark) } else { - newBk = Application::bookmarkProvider()->rootGroup().createNewSeparator(); + newBk = rApp->bookmarkProvider()->rootGroup().createNewSeparator(); } newBk.setIcon("edit-clear"); diff --git a/src/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp index e4fb9e3a..9e16f774 100644 --- a/src/bookmarks/bookmarkprovider.cpp +++ b/src/bookmarks/bookmarkprovider.cpp @@ -147,7 +147,7 @@ void BookmarkProvider::removeBookmarkPanel(BookmarksPanel *panel) panel->disconnect(this); if (m_bookmarkPanels.isEmpty()) - Application::bookmarkProvider()->bookmarkManager()->emitChanged(); + rApp->bookmarkProvider()->bookmarkManager()->emitChanged(); } @@ -170,7 +170,7 @@ QList<KBookmark> BookmarkProvider::find(const QString &text) { QList<KBookmark> list; - KBookmarkGroup root = Application::bookmarkProvider()->rootGroup(); + KBookmarkGroup root = rApp->bookmarkProvider()->rootGroup(); if (!root.isNull()) for (KBookmark bookmark = root.first(); !bookmark.isNull(); bookmark = root.next(bookmark)) find(&list, bookmark, text); @@ -199,8 +199,8 @@ void BookmarkProvider::slotBookmarksChanged() fillBookmarkBar(bookmarkToolBar); } } - if(Application::instance()->mainWindow()->currentTab()->url().toMimeDataString().contains("about:bookmarks")) - Application::instance()->loadUrl(KUrl("about:bookmarks"), Rekonq::CurrentTab); + if(rApp->mainWindow()->currentTab()->url().toMimeDataString().contains("about:bookmarks")) + rApp->loadUrl(KUrl("about:bookmarks"), Rekonq::CurrentTab); } @@ -232,7 +232,7 @@ void BookmarkProvider::fillBookmarkBar(BookmarkToolBar *toolBar) else { KBookmarkAction *action = new KBookmarkAction(bookmark, m_owner, this); - action->setIcon(Application::iconManager()->iconForUrl( KUrl(bookmark.url()) )); + action->setIcon(rApp->iconManager()->iconForUrl( KUrl(bookmark.url()) )); connect(action, SIGNAL(hovered()), toolBar, SLOT(actionHovered())); toolBar->toolBar()->addAction(action); toolBar->toolBar()->widgetForAction(action)->installEventFilter(toolBar); @@ -248,8 +248,8 @@ void BookmarkProvider::slotPanelChanged() if (panel && panel != sender()) panel->loadFoldedState(); } - if(Application::instance()->mainWindow()->currentTab()->url().toMimeDataString().contains("about:bookmarks")) - Application::instance()->loadUrl(KUrl("about:bookmarks"), Rekonq::CurrentTab); + if(rApp->mainWindow()->currentTab()->url().toMimeDataString().contains("about:bookmarks")) + rApp->loadUrl(KUrl("about:bookmarks"), Rekonq::CurrentTab); } diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp index 1763a1e5..436ee8d7 100644 --- a/src/bookmarks/bookmarkspanel.cpp +++ b/src/bookmarks/bookmarkspanel.cpp @@ -75,8 +75,8 @@ void BookmarksPanel::contextMenu(const QPoint &pos) return; BookmarksContextMenu menu(bookmarkForIndex( panelTreeView()->indexAt(pos) ), - Application::bookmarkProvider()->bookmarkManager(), - Application::bookmarkProvider()->bookmarkOwner() + rApp->bookmarkProvider()->bookmarkManager(), + rApp->bookmarkProvider()->bookmarkOwner() ); menu.exec(panelTreeView()->mapToGlobal(pos)); @@ -89,7 +89,7 @@ void BookmarksPanel::deleteBookmark() if (_loadingState || !index.isValid()) return; - Application::bookmarkProvider()->bookmarkOwner()->deleteBookmark(bookmarkForIndex(index)); + rApp->bookmarkProvider()->bookmarkOwner()->deleteBookmark(bookmarkForIndex(index)); } diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index e239e235..12b1bc09 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -92,7 +92,7 @@ QAction * BookmarkMenu::actionForBookmark(const KBookmark &bookmark) else { KBookmarkAction *action = new KBookmarkAction(bookmark, owner(), this); - action->setIcon(Application::iconManager()->iconForUrl( KUrl(bookmark.url()) )); + action->setIcon(rApp->iconManager()->iconForUrl( KUrl(bookmark.url()) )); connect(action, SIGNAL(hovered()), this, SLOT(actionHovered())); return action; } @@ -139,7 +139,7 @@ void BookmarkMenu::addOpenFolderInTabs() if (!bookmark.isNull()) { - parentMenu()->addAction(Application::bookmarkProvider()->bookmarkOwner()->createAction(group, BookmarkOwner::OPEN_FOLDER)); + parentMenu()->addAction(rApp->bookmarkProvider()->bookmarkOwner()->createAction(group, BookmarkOwner::OPEN_FOLDER)); } } } @@ -149,7 +149,7 @@ void BookmarkMenu::actionHovered() { KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(sender()); if (action) - Application::instance()->mainWindow()->notifyMessage(action->bookmark().url().url()); + rApp->mainWindow()->notifyMessage(action->bookmark().url().url()); } @@ -166,14 +166,14 @@ BookmarkToolBar::BookmarkToolBar(KToolBar *toolBar, QObject *parent) { toolBar->setContextMenuPolicy(Qt::CustomContextMenu); connect(toolBar, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenu(const QPoint &))); - connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString, QString)), this, SLOT(hideMenu())); + connect(rApp->bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString, QString)), this, SLOT(hideMenu())); toolBar->setAcceptDrops(true); toolBar->installEventFilter(this); toolBar->setShortcutEnabled(false); if (toolBar->isVisible()) { - Application::bookmarkProvider()->fillBookmarkBar(this); + rApp->bookmarkProvider()->fillBookmarkBar(this); m_filled = true; } } @@ -198,8 +198,8 @@ void BookmarkToolBar::contextMenu(const QPoint &point) bookmark = action->bookmark(); BookmarksContextMenu menu(bookmark, - Application::bookmarkProvider()->bookmarkManager(), - Application::bookmarkProvider()->bookmarkOwner()); + rApp->bookmarkProvider()->bookmarkManager(), + rApp->bookmarkProvider()->bookmarkOwner()); menu.exec(toolBar()->mapToGlobal(point)); } @@ -244,7 +244,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) { if (!m_filled) { - Application::bookmarkProvider()->fillBookmarkBar(this); + rApp->bookmarkProvider()->fillBookmarkBar(this); m_filled = true; } } @@ -328,12 +328,12 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) { QDropEvent *dropEvent = static_cast<QDropEvent*>(event); KBookmark bookmark; - KBookmarkGroup root = Application::bookmarkProvider()->rootGroup(); + KBookmarkGroup root = rApp->bookmarkProvider()->rootGroup(); if (dropEvent->mimeData()->hasFormat("application/rekonq-bookmark")) { QByteArray addresses = dropEvent->mimeData()->data("application/rekonq-bookmark"); - bookmark = Application::bookmarkProvider()->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data())); + bookmark = rApp->bookmarkProvider()->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data())); if (bookmark.isNull()) return false; } @@ -380,7 +380,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) root.moveBookmark(bookmark, destBookmark.parentGroup().previous(destBookmark)); } - Application::bookmarkProvider()->bookmarkManager()->emitChanged(); + rApp->bookmarkProvider()->bookmarkManager()->emitChanged(); } } else @@ -392,7 +392,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) root.moveBookmark(bookmark, KBookmark()); } - Application::bookmarkProvider()->bookmarkManager()->emitChanged(); + rApp->bookmarkProvider()->bookmarkManager()->emitChanged(); } dropEvent->accept(); } @@ -445,7 +445,7 @@ void BookmarkToolBar::actionHovered() { KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(sender()); if (action) - Application::instance()->mainWindow()->notifyMessage(action->bookmark().url().url()); + rApp->mainWindow()->notifyMessage(action->bookmark().url().url()); } @@ -470,7 +470,7 @@ void BookmarkToolBar::startDrag() } else { - drag->setPixmap(Application::iconManager()->iconForUrl(action->bookmark().url()).pixmap(24, 24)); + drag->setPixmap(rApp->iconManager()->iconForUrl(action->bookmark().url()).pixmap(24, 24)); } drag->start(Qt::MoveAction); diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp index f13cee42..7e38b8aa 100644 --- a/src/bookmarks/bookmarkstreemodel.cpp +++ b/src/bookmarks/bookmarkstreemodel.cpp @@ -74,7 +74,7 @@ QVariant BtmItem::data(int role) const if (m_kbm.isGroup() || m_kbm.isSeparator()) return KIcon(m_kbm.icon()); else - return Application::iconManager()->iconForUrl(KUrl(m_kbm.url())); + return rApp->iconManager()->iconForUrl(KUrl(m_kbm.url())); } if (role == Qt::UserRole) @@ -160,7 +160,7 @@ BookmarksTreeModel::BookmarksTreeModel(QObject *parent) , m_root(0) { resetModel(); - connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(const QString &, const QString &)), this, SLOT(bookmarksChanged(const QString &))); + connect(rApp->bookmarkProvider()->bookmarkManager(), SIGNAL(changed(const QString &, const QString &)), this, SLOT(bookmarksChanged(const QString &))); } @@ -278,13 +278,13 @@ bool BookmarksTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction acti return false; QByteArray addresses = data->data("application/rekonq-bookmark"); - KBookmark bookmark = Application::bookmarkProvider()->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data())); + KBookmark bookmark = rApp->bookmarkProvider()->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data())); KBookmarkGroup root; if (parent.isValid()) root = bookmarkForIndex(parent).toGroup(); else - root = Application::bookmarkProvider()->rootGroup(); + root = rApp->bookmarkProvider()->rootGroup(); QModelIndex destIndex = index(row, column, parent); @@ -298,7 +298,7 @@ bool BookmarksTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction acti root.addBookmark(bookmark); } - Application::bookmarkProvider()->bookmarkManager()->emitChanged(); + rApp->bookmarkProvider()->bookmarkManager()->emitChanged(); return true; } @@ -349,7 +349,7 @@ void BookmarksTreeModel::bookmarksChanged(const QString &groupAddress) node = node->child( i ); nodeIndex = index( i, 0, nodeIndex ); } - populate(node, Application::bookmarkProvider()->bookmarkManager()->findByAddress(groupAddress).toGroup()); + populate(node, rApp->bookmarkProvider()->bookmarkManager()->findByAddress(groupAddress).toGroup()); endResetModel(); } @@ -359,7 +359,7 @@ void BookmarksTreeModel::bookmarksChanged(const QString &groupAddress) void BookmarksTreeModel::resetModel() { - setRoot(Application::bookmarkProvider()->rootGroup()); + setRoot(rApp->bookmarkProvider()->rootGroup()); } diff --git a/src/history/historymodels.cpp b/src/history/historymodels.cpp index d9d3efef..4ae58203 100644 --- a/src/history/historymodels.cpp +++ b/src/history/historymodels.cpp @@ -146,7 +146,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const case Qt::DecorationRole: if (index.column() == 0) { - return Application::iconManager()->iconForUrl(item.url); + return rApp->iconManager()->iconForUrl(item.url); } case Qt::ToolTipRole: QString tooltip = ""; diff --git a/src/history/historypanel.cpp b/src/history/historypanel.cpp index d1b02c42..54146520 100644 --- a/src/history/historypanel.cpp +++ b/src/history/historypanel.cpp @@ -146,5 +146,5 @@ void HistoryPanel::setup() QAbstractItemModel* HistoryPanel::model() { - return Application::historyManager()->historyTreeModel(); + return rApp->historyManager()->historyTreeModel(); } diff --git a/src/iconmanager.cpp b/src/iconmanager.cpp index f5b60ea6..ad1172e5 100644 --- a/src/iconmanager.cpp +++ b/src/iconmanager.cpp @@ -63,7 +63,7 @@ IconManager::~IconManager() KIcon IconManager::iconForUrl(const KUrl &url) { // first things first.. avoid infinite loop at startup - if (url.isEmpty() || Application::instance()->mainWindowList().isEmpty()) + if (url.isEmpty() || rApp->mainWindowList().isEmpty()) return KIcon("text-html"); QByteArray encodedUrl = url.toEncoded(); diff --git a/src/mainview.cpp b/src/mainview.cpp index dfa202dc..8907322e 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -98,7 +98,7 @@ MainView::MainView(MainWindow *parent) void MainView::postLaunch() { - QStringList list = Application::sessionManager()->closedSites(); + QStringList list = rApp->sessionManager()->closedSites(); Q_FOREACH(const QString &line, list) { if(line.startsWith( QL1S("about") )) @@ -111,7 +111,7 @@ void MainView::postLaunch() } // Session Manager - connect(this, SIGNAL(tabsChanged()), Application::sessionManager(), SLOT(saveSession())); + connect(this, SIGNAL(tabsChanged()), rApp->sessionManager(), SLOT(saveSession())); m_addTabButton->setDefaultAction(m_parentWindow->actionByName("new_tab")); @@ -411,7 +411,7 @@ void MainView::cloneTab(int index) KUrl url = webTab(index)->url(); - Application::instance()->loadUrl(url, Rekonq::NewTab); + rApp->loadUrl(url, Rekonq::NewTab); updateTabBar(); } @@ -555,7 +555,7 @@ void MainView::webViewIconChanged() if (-1 != index) { - KIcon icon = Application::iconManager()->iconForUrl(tab->url()); + KIcon icon = rApp->iconManager()->iconForUrl(tab->url()); QLabel *label = animatedLoading(index, false); QMovie *movie = label->movie(); delete movie; @@ -585,7 +585,7 @@ void MainView::webViewTitleChanged(const QString &title) { tabBar()->setTabHighlighted(index); } - Application::historyManager()->updateHistoryEntry(tab->url(), tabTitle); + rApp->historyManager()->updateHistoryEntry(tab->url(), tabTitle); if (ReKonfig::hoveringTabOption() == 1) tabBar()->setTabToolTip(index, tabTitle.remove('&')); } @@ -630,7 +630,7 @@ void MainView::openLastClosedTab() return; const HistoryItem item = m_recentlyClosedTabs.takeFirst(); - Application::instance()->loadUrl(KUrl(item.url), Rekonq::NewTab); + rApp->loadUrl(KUrl(item.url), Rekonq::NewTab); } @@ -639,7 +639,7 @@ void MainView::openClosedTab() KAction *action = qobject_cast<KAction *>(sender()); if (action) { - Application::instance()->loadUrl(action->data().toUrl(), Rekonq::NewTab); + rApp->loadUrl(action->data().toUrl(), Rekonq::NewTab); QString title = action->text(); title = title.remove('&'); @@ -704,7 +704,7 @@ void MainView::detachTab(int index, MainWindow *toWindow) if (u.scheme() == QL1S("about")) { closeTab(index); - Application::instance()->loadUrl(u, Rekonq::NewWindow); + rApp->loadUrl(u, Rekonq::NewWindow); } else { @@ -714,10 +714,10 @@ void MainView::detachTab(int index, MainWindow *toWindow) MainWindow *w; if( toWindow == NULL ) - w = Application::instance()->newMainWindow(false); + w = rApp->newMainWindow(false); else w = toWindow; - w->mainView()->addTab(tab, Application::iconManager()->iconForUrl(u), label); + w->mainView()->addTab(tab, rApp->iconManager()->iconForUrl(u), label); w->mainView()->widgetBar()->insertWidget(0, bar); w->mainView()->updateTabBar(); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 24dc8658..77269ebc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -162,9 +162,9 @@ MainWindow::MainWindow() MainWindow::~MainWindow() { - Application::bookmarkProvider()->removeBookmarkBar(m_bookmarksBar); - Application::bookmarkProvider()->removeBookmarkPanel(m_bookmarksPanel); - Application::instance()->removeMainWindow(this); + rApp->bookmarkProvider()->removeBookmarkBar(m_bookmarksBar); + rApp->bookmarkProvider()->removeBookmarkPanel(m_bookmarksPanel); + rApp->removeMainWindow(this); delete m_view; delete m_findBar; @@ -208,11 +208,11 @@ void MainWindow::initBookmarkBar() if (m_bookmarksBar) { - Application::bookmarkProvider()->removeBookmarkBar(m_bookmarksBar); + rApp->bookmarkProvider()->removeBookmarkBar(m_bookmarksBar); delete m_bookmarksBar; } m_bookmarksBar = new BookmarkToolBar(XMLGUIBkBar, this); - Application::bookmarkProvider()->registerBookmarkBar(m_bookmarksBar); + rApp->bookmarkProvider()->registerBookmarkBar(m_bookmarksBar); } @@ -289,7 +289,7 @@ void MainWindow::postLaunch() // setting popup notification m_popup->setAutoDelete(false); - connect(Application::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), m_popup, SLOT(hide())); + connect(rApp, SIGNAL(focusChanged(QWidget*, QWidget*)), m_popup, SLOT(hide())); m_popup->setFrameShape(QFrame::NoFrame); m_popup->setLineWidth(0); connect(m_hidePopup, SIGNAL(timeout()), m_popup, SLOT(hide())); @@ -350,7 +350,7 @@ void MainWindow::changeWindowIcon(int index) if (ReKonfig::useFavicon()) { KUrl url = mainView()->webTab(index)->url(); - QIcon icon = Application::iconManager()->iconForUrl(url).pixmap(QSize(32,32)); + QIcon icon = rApp->iconManager()->iconForUrl(url).pixmap(QSize(32,32)); setWindowIcon(icon); } } @@ -366,7 +366,7 @@ void MainWindow::setupActions() a = new KAction(KIcon("window-new"), i18n("&New Window"), this); a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_N)); actionCollection()->addAction(QL1S("new_window"), a); - connect(a, SIGNAL(triggered(bool)), Application::instance(), SLOT(newWindow())); + connect(a, SIGNAL(triggered(bool)), rApp, SLOT(newWindow())); // Standard Actions KStandardAction::open(this, SLOT(fileOpen()), actionCollection()); @@ -436,7 +436,7 @@ void MainWindow::setupActions() actionCollection()->addAction(QL1S("page_source"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(viewPageSource())); - a = Application::instance()->privateBrowsingAction(); + a = rApp->privateBrowsingAction(); a->setShortcut(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_P); actionCollection()->addAction(QL1S("private_browsing"), a); @@ -524,7 +524,7 @@ void MainWindow::setupActions() connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(detachTab())); // Bookmark Menu - KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(this); + KActionMenu *bmMenu = rApp->bookmarkProvider()->bookmarkActionMenu(this); bmMenu->setIcon(KIcon("bookmarks")); bmMenu->setDelayed(false); bmMenu->setShortcutConfigurable(true); @@ -567,9 +567,9 @@ void MainWindow::setupPanels() // STEP 1 // Setup history panel m_historyPanel = new HistoryPanel(i18n("History Panel"), this); - connect(m_historyPanel, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)), Application::instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType &))); + connect(m_historyPanel, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)), rApp, SLOT(loadUrl(const KUrl&, const Rekonq::OpenType &))); connect(m_historyPanel, SIGNAL(itemHovered(QString)), this, SLOT(notifyMessage(QString))); - connect(m_historyPanel, SIGNAL(destroyed()), Application::instance(), SLOT(saveConfiguration())); + connect(m_historyPanel, SIGNAL(destroyed()), rApp, SLOT(saveConfiguration())); addDockWidget(Qt::LeftDockWidgetArea, m_historyPanel); @@ -582,13 +582,13 @@ void MainWindow::setupPanels() // STEP 2 // Setup bookmarks panel m_bookmarksPanel = new BookmarksPanel(i18n("Bookmarks Panel"), this); - connect(m_bookmarksPanel, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)), Application::instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType &))); + connect(m_bookmarksPanel, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)), rApp, SLOT(loadUrl(const KUrl&, const Rekonq::OpenType &))); connect(m_bookmarksPanel, SIGNAL(itemHovered(QString)), this, SLOT(notifyMessage(QString))); - connect(m_bookmarksPanel, SIGNAL(destroyed()), Application::instance(), SLOT(saveConfiguration())); + connect(m_bookmarksPanel, SIGNAL(destroyed()), rApp, SLOT(saveConfiguration())); addDockWidget(Qt::LeftDockWidgetArea, m_bookmarksPanel); - Application::bookmarkProvider()->registerBookmarkPanel(m_bookmarksPanel); + rApp->bookmarkProvider()->registerBookmarkPanel(m_bookmarksPanel); // setup bookmarks panel action a = (KAction *) m_bookmarksPanel->toggleViewAction(); @@ -676,7 +676,7 @@ void MainWindow::preferences() QPointer<SettingsDialog> s = new SettingsDialog(this); // keep us informed when the user changes settings - connect(s, SIGNAL(settingsChanged(const QString&)), Application::instance(), SLOT(updateConfiguration())); + connect(s, SIGNAL(settingsChanged(const QString&)), rApp, SLOT(updateConfiguration())); s->exec(); delete s; @@ -738,7 +738,7 @@ void MainWindow::fileOpen() if (filePath.isEmpty()) return; - Application::instance()->loadUrl(filePath); + rApp->loadUrl(filePath); } @@ -965,7 +965,7 @@ void MainWindow::homePage(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers k : KUrl( ReKonfig::homePage() ); if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier) - Application::instance()->loadUrl( homeUrl, Rekonq::NewTab); + rApp->loadUrl( homeUrl, Rekonq::NewTab); else currentTab()->view()->load( homeUrl ); } @@ -979,7 +979,6 @@ WebTab *MainWindow::currentTab() const void MainWindow::browserLoading(bool v) { - kDebug() << "-------------------------------------------------------------------"; QAction *stop = actionCollection()->action( QL1S("stop") ); QAction *reload = actionCollection()->action( QL1S("view_redisplay") ); if (v) @@ -1027,7 +1026,7 @@ void MainWindow::openPrevious(Qt::MouseButtons mouseButtons, Qt::KeyboardModifie if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier) { - Application::instance()->loadUrl(item->url(), Rekonq::NewTab); + rApp->loadUrl(item->url(), Rekonq::NewTab); } else { @@ -1060,7 +1059,7 @@ void MainWindow::openNext(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers k if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier) { - Application::instance()->loadUrl(item->url(), Rekonq::NewTab); + rApp->loadUrl(item->url(), Rekonq::NewTab); } else { @@ -1238,12 +1237,12 @@ void MainWindow::clearPrivateData() if (clearWidget.clearHistory->isChecked()) { - Application::historyManager()->clear(); + rApp->historyManager()->clear(); } if (clearWidget.clearDownloads->isChecked()) { - Application::instance()->clearDownloadsHistory(); + rApp->clearDownloadsHistory(); } if (clearWidget.clearCookies->isChecked()) @@ -1260,7 +1259,7 @@ void MainWindow::clearPrivateData() if (clearWidget.clearWebIcons->isChecked()) { - Application::iconManager()->clearIconCache(); + rApp->iconManager()->clearIconCache(); } if (clearWidget.homePageThumbs->isChecked()) @@ -1299,7 +1298,7 @@ void MainWindow::aboutToShowBackMenu() QWebHistoryItem item = history->currentItem(); KAction *action = new KAction(this); action->setData(listCount + offset++); - KIcon icon = Application::iconManager()->iconForUrl(item.url()); + KIcon icon = rApp->iconManager()->iconForUrl(item.url()); action->setIcon(icon); action->setText(item.title()); m_historyBackMenu->addAction(action); @@ -1310,7 +1309,7 @@ void MainWindow::aboutToShowBackMenu() QWebHistoryItem item = historyList.at(i); KAction *action = new KAction(this); action->setData(i + offset); - KIcon icon = Application::iconManager()->iconForUrl(item.url()); + KIcon icon = rApp->iconManager()->iconForUrl(item.url()); action->setIcon(icon); action->setText(item.title()); m_historyBackMenu->addAction(action); @@ -1340,7 +1339,7 @@ void MainWindow::aboutToShowForwardMenu() QWebHistoryItem item = history->currentItem(); KAction *action = new KAction(this); action->setData(listCount + offset++); - KIcon icon = Application::iconManager()->iconForUrl(item.url()); + KIcon icon = rApp->iconManager()->iconForUrl(item.url()); action->setIcon(icon); action->setText(item.title()); m_historyForwardMenu->addAction(action); @@ -1351,7 +1350,7 @@ void MainWindow::aboutToShowForwardMenu() QWebHistoryItem item = historyList.at(i - 1); KAction *action = new KAction(this); action->setData(pivot +i + offset); - KIcon icon = Application::iconManager()->iconForUrl(item.url()); + KIcon icon = rApp->iconManager()->iconForUrl(item.url()); action->setIcon(icon); action->setText(item.title()); m_historyForwardMenu->addAction(action); @@ -1364,7 +1363,7 @@ void MainWindow::aboutToShowTabListMenu() m_tabListMenu->clear(); for( int i = 0; i < m_view->count(); ++i ){ KAction *action = new KAction(m_view->tabText(i), this); - action->setIcon(Application::iconManager()->iconForUrl(m_view->webTab(i)->url()).pixmap(16, 16)); + action->setIcon(rApp->iconManager()->iconForUrl(m_view->webTab(i)->url()).pixmap(16, 16)); action->setData(i); if(mainView()->tabBar()->currentIndex() == i) { @@ -1475,7 +1474,7 @@ void MainWindow::enableNetworkAnalysis(bool b) bool MainWindow::queryClose() { // this should fux bug 240432 - if(Application::instance()->sessionSaving()) + if(rApp->sessionSaving()) return true; // smooth private browsing mode diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp index 118d4b24..14600971 100644 --- a/src/networkaccessmanager.cpp +++ b/src/networkaccessmanager.cpp @@ -97,7 +97,7 @@ QNetworkReply *NetworkAccessManager::createRequest(QNetworkAccessManager::Operat break; case QNetworkAccessManager::GetOperation: - reply = Application::adblockManager()->block(req, parentPage); + reply = rApp->adblockManager()->block(req, parentPage); break; case QNetworkAccessManager::PutOperation: diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp index 7dcc9581..1ae1a7a9 100644 --- a/src/newtabpage.cpp +++ b/src/newtabpage.cpp @@ -110,19 +110,19 @@ void NewTabPage::generate(const KUrl &url) if (url.directory() == QL1S("preview/modify")) { int index = url.fileName().toInt(); - Application::instance()->mainWindow()->currentTab()->createPreviewSelectorBar(index); + rApp->mainWindow()->currentTab()->createPreviewSelectorBar(index); return; } } if (url.fileName() == QL1S("clear")) { - Application::instance()->mainWindow()->actionByName("clear_private_data")->trigger(); + rApp->mainWindow()->actionByName("clear_private_data")->trigger(); generate( QL1S("about:") + url.directory() ); return; } if (url == KUrl("about:bookmarks/edit")) { - Application::bookmarkProvider()->bookmarkManager()->slotEditBookmarks(); + rApp->bookmarkProvider()->bookmarkManager()->slotEditBookmarks(); return; } @@ -396,7 +396,7 @@ void NewTabPage::historyPage() KIconLoader::Toolbar); m_root.document().findFirst( QL1S("#actions") ).appendInside(clearData); - HistoryTreeModel *model = Application::historyManager()->historyTreeModel(); + HistoryTreeModel *model = rApp->historyManager()->historyTreeModel(); if (model->rowCount() == 0) { @@ -454,7 +454,7 @@ void NewTabPage::bookmarksPage() KIconLoader::Toolbar); m_root.document().findFirst( QL1S("#actions") ).appendInside(editBookmarks); - KBookmarkGroup bookGroup = Application::bookmarkProvider()->rootGroup(); + KBookmarkGroup bookGroup = rApp->bookmarkProvider()->rootGroup(); if (bookGroup.isNull()) { m_root.addClass( QL1S("empty") ); @@ -515,7 +515,7 @@ void NewTabPage::closedTabsPage() { m_root.addClass( QL1S("closedTabs") ); - QList<HistoryItem> links = Application::instance()->mainWindow()->mainView()->recentlyClosedTabs(); + QList<HistoryItem> links = rApp->mainWindow()->mainView()->recentlyClosedTabs(); if (links.isEmpty()) { @@ -565,7 +565,7 @@ void NewTabPage::downloadsPage() KIconLoader::Toolbar); m_root.document().findFirst( QL1S("#actions") ).appendInside(clearData); - DownloadList list = Application::instance()->downloads(); + DownloadList list = rApp->downloads(); if (list.isEmpty()) { diff --git a/src/opensearch/searchengine.cpp b/src/opensearch/searchengine.cpp index f407789b..9f46ad1a 100644 --- a/src/opensearch/searchengine.cpp +++ b/src/opensearch/searchengine.cpp @@ -68,7 +68,7 @@ void SearchEngine::reload() { QUrl url = service->property("Query").toUrl(); kDebug() << "ENGINE URL: " << url; - Application::iconManager()->downloadIconFromUrl(url); + rApp->iconManager()->downloadIconFromUrl(url); favorites << service; } diff --git a/src/paneltreeview.cpp b/src/paneltreeview.cpp index e44fa5fe..479bf018 100644 --- a/src/paneltreeview.cpp +++ b/src/paneltreeview.cpp @@ -164,7 +164,7 @@ void PanelTreeView::copyToClipboard() if (!index.isValid()) return; - QClipboard *cb = Application::clipboard(); + QClipboard *cb = QApplication::clipboard(); cb->setText(qVariantValue< KUrl >(index.data(Qt::UserRole)).url()); } diff --git a/src/previewselectorbar.cpp b/src/previewselectorbar.cpp index c8ab5b0a..8ca96360 100644 --- a/src/previewselectorbar.cpp +++ b/src/previewselectorbar.cpp @@ -89,7 +89,7 @@ PreviewSelectorBar::~PreviewSelectorBar() void PreviewSelectorBar::verifyUrl() { - if (Application::instance()->mainWindow()->currentTab()->page()->mainFrame()->url().scheme() != "about") + if (rApp->mainWindow()->currentTab()->page()->mainFrame()->url().scheme() != "about") { m_button->setEnabled(true); m_button->setToolTip(""); @@ -120,7 +120,7 @@ void PreviewSelectorBar::loadFinished() void PreviewSelectorBar::clicked() { - WebPage *page = Application::instance()->mainWindow()->currentTab()->page(); + WebPage *page = rApp->mainWindow()->currentTab()->page(); if (page) { diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp index 6dfc33a1..fa93f074 100644 --- a/src/protocolhandler.cpp +++ b/src/protocolhandler.cpp @@ -200,12 +200,12 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra // If rekonq cannot handle a protocol by itself, it will hand it over to KDE via KRun if(KProtocolInfo::isKnownProtocol(_url)) { - new KRun(_url, Application::instance()->mainWindow()); // No need to delete KRun, it autodeletes itself + new KRun(_url, rApp->mainWindow()); // No need to delete KRun, it autodeletes itself return true; } // Error Message, for those protocols even KDE cannot handle - KMessageBox::error(Application::instance()->mainWindow(), i18nc("@info", + KMessageBox::error(rApp->mainWindow(), i18nc("@info", "rekonq cannot handle this URL. \ Please use an appropriate application to open it.")); return false; @@ -275,9 +275,9 @@ void ProtocolHandler::showResults(const KFileItemList &list) _frame->setHtml(html); qobject_cast<WebPage *>(_frame->page())->setIsOnRekonqPage(true); - Application::instance()->mainWindow()->mainView()->currentUrlBar()->setQUrl(_url); - Application::instance()->mainWindow()->currentTab()->setFocus(); - Application::historyManager()->addHistoryEntry(_url.prettyUrl()); + rApp->mainWindow()->mainView()->currentUrlBar()->setQUrl(_url); + rApp->mainWindow()->currentTab()->setFocus(); + rApp->historyManager()->addHistoryEntry(_url.prettyUrl()); } } @@ -419,9 +419,9 @@ void ProtocolHandler::abpHandling() { if (!requireslocation.isEmpty() && !requirestitle.isEmpty()) { - Application::adblockManager()->addSubscription(requirestitle, requireslocation); + rApp->adblockManager()->addSubscription(requirestitle, requireslocation); } - Application::adblockManager()->addSubscription(title, location); - Application::adblockManager()->loadSettings(false); + rApp->adblockManager()->addSubscription(title, location); + rApp->adblockManager()->loadSettings(false); } } diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp index 87f25f43..f6f499d3 100644 --- a/src/sessionmanager.cpp +++ b/src/sessionmanager.cpp @@ -71,7 +71,7 @@ void SessionManager::saveSession() return; } QTextStream out(&sessionFile); - MainWindowList wl = Application::instance()->mainWindowList(); + MainWindowList wl = rApp->mainWindowList(); Q_FOREACH(const QWeakPointer<MainWindow> &w, wl) { out << "window\n"; @@ -104,7 +104,7 @@ bool SessionManager::restoreSession() QTextStream in(&sessionFile); QString line; - bool windowAlreadyOpen = Application::instance()->mainWindowList().count(); + bool windowAlreadyOpen = rApp->mainWindowList().count(); do { line = in.readLine(); @@ -112,10 +112,10 @@ bool SessionManager::restoreSession() { line = in.readLine(); if (windowAlreadyOpen) { - Application::instance()->loadUrl( KUrl(line), Rekonq::CurrentTab); + rApp->loadUrl( KUrl(line), Rekonq::CurrentTab); windowAlreadyOpen = false; } else { - Application::instance()->loadUrl( KUrl(line), Rekonq::NewWindow); + rApp->loadUrl( KUrl(line), Rekonq::NewWindow); } } else @@ -128,7 +128,7 @@ bool SessionManager::restoreSession() if (ok) { // Get last mainwindow created which will be first one in mainwindow list - MainWindowList wl = Application::instance()->mainWindowList(); + MainWindowList wl = rApp->mainWindowList(); if (wl.count() > 0) { MainView *mv = wl[0].data()->mainView(); @@ -138,7 +138,7 @@ bool SessionManager::restoreSession() } else { - Application::instance()->loadUrl( KUrl(line), Rekonq::NewFocusedTab); + rApp->loadUrl( KUrl(line), Rekonq::NewFocusedTab); } } } diff --git a/src/settings/generalwidget.cpp b/src/settings/generalwidget.cpp index 0128830c..812ae244 100644 --- a/src/settings/generalwidget.cpp +++ b/src/settings/generalwidget.cpp @@ -73,7 +73,7 @@ void GeneralWidget::hasChanged() void GeneralWidget::setHomeToCurrentPage() { - MainWindow *mw = Application::instance()->mainWindow(); + MainWindow *mw = rApp->mainWindow(); WebTab *webTab = mw->currentTab(); if (webTab) { diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index 84c6da12..f5ade187 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -123,7 +123,7 @@ Private::Private(SettingsDialog *parent) pageItem->setIcon(KIcon("preferences-web-browser-adblock")); // -- 7 - shortcutsEditor = new KShortcutsEditor(Application::instance()->mainWindow()->actionCollection(), parent); + shortcutsEditor = new KShortcutsEditor(rApp->mainWindow()->actionCollection(), parent); pageItem = parent->addPage(shortcutsEditor , i18n("Shortcuts")); pageItem->setIcon(KIcon("configure-shortcuts")); @@ -204,7 +204,7 @@ void SettingsDialog::saveSettings() d->ebrowsingModule->save(); SearchEngine::reload(); - Application::opensearchManager()->removeDeletedEngines(); + rApp->opensearchManager()->removeDeletedEngines(); updateButtons(); emit settingsChanged("ReKonfig"); diff --git a/src/tabbar.cpp b/src/tabbar.cpp index be20ecd3..fbf87145 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -308,7 +308,7 @@ void TabBar::contextMenu(int tab, const QPoint &pos) m_actualIndex = tab; KMenu menu; - MainWindow *mainWindow = Application::instance()->mainWindow(); + MainWindow *mainWindow = rApp->mainWindow(); menu.addAction(mainWindow->actionByName( QL1S("new_tab") )); menu.addAction(mainWindow->actionByName( QL1S("clone_tab") )); @@ -332,7 +332,7 @@ void TabBar::emptyAreaContextMenu(const QPoint &pos) setupHistoryActions(); KMenu menu; - MainWindow *mainWindow = Application::instance()->mainWindow(); + MainWindow *mainWindow = rApp->mainWindow(); menu.addAction(mainWindow->actionByName( QL1S("new_tab") )); menu.addAction(mainWindow->actionByName( QL1S("open_last_closed_tab") )); @@ -367,7 +367,7 @@ void TabBar::tabRemoved(int index) void TabBar::setupHistoryActions() { - MainWindow *w = Application::instance()->mainWindow(); + MainWindow *w = rApp->mainWindow(); MainView *mv = qobject_cast<MainView *>(parent()); QAction *openLastClosedTabAction = w->actionByName( QL1S("open_last_closed_tab") ); @@ -389,7 +389,7 @@ void TabBar::setupHistoryActions() Q_FOREACH(const HistoryItem &item, mv->recentlyClosedTabs()) { - KAction *a = new KAction(Application::iconManager()->iconForUrl(item.url), item.title, this); + KAction *a = new KAction(rApp->iconManager()->iconForUrl(item.url), item.title, this); a->setData(item.url); connect(a, SIGNAL(triggered()), mv, SLOT(openClosedTab())); am->addAction(a); diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp index 3252d9cc..374b325d 100644 --- a/src/urlbar/bookmarkwidget.cpp +++ b/src/urlbar/bookmarkwidget.cpp @@ -123,7 +123,7 @@ void BookmarkWidget::accept() if (!m_bookmark->isNull() && m_name->text() != m_bookmark->fullText()) { m_bookmark->setFullText(m_name->text()); - Application::bookmarkProvider()->bookmarkManager()->emitChanged(); + rApp->bookmarkProvider()->bookmarkManager()->emitChanged(); } close(); } @@ -131,7 +131,7 @@ void BookmarkWidget::accept() void BookmarkWidget::removeBookmark() { - Application::bookmarkProvider()->bookmarkOwner()->deleteBookmark(*m_bookmark); + rApp->bookmarkProvider()->bookmarkOwner()->deleteBookmark(*m_bookmark); close(); emit updateIcon(); diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp index 0d2026af..8064c5bb 100644 --- a/src/urlbar/completionwidget.cpp +++ b/src/urlbar/completionwidget.cpp @@ -329,11 +329,11 @@ void CompletionWidget::setVisible(bool visible) { if (visible) { - Application::instance()->installEventFilter(this); + rApp->installEventFilter(this); } else { - Application::instance()->removeEventFilter(this); + rApp->removeEventFilter(this); } diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index 1794233e..0afcd273 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -69,7 +69,7 @@ ListItem::ListItem(const UrlSearchItem &item, QWidget *parent) // use the same application palette (hence, the same colors) // Qt docs says that using this cctor is possible & fast (qt:qpalette) - QPalette p(Application::palette()); + QPalette p(rApp->palette()); setPalette(p); deactivate(); @@ -195,7 +195,7 @@ QLabel *TypeIconLabel::getIcon(QString icon) IconLabel::IconLabel(const QString &icon, QWidget *parent) : QLabel(parent) { - QPixmap pixmapIcon = Application::iconManager()->iconForUrl(KUrl(icon)).pixmap(16); + QPixmap pixmapIcon = rApp->iconManager()->iconForUrl(KUrl(icon)).pixmap(16); setFixedSize(16, 16); setPixmap(pixmapIcon); } @@ -481,7 +481,7 @@ KAction *EngineBar::newEngineAction(KService::Ptr engine, KService::Ptr selected KUrl url = KUrl( u.toString( QUrl::RemovePath | QUrl::RemoveQuery ) ); kDebug() << "Engine NAME: " << engine->name() << " URL: " << url; - KAction *a = new KAction(Application::iconManager()->iconForUrl(url), engine->name(), this); + KAction *a = new KAction(rApp->iconManager()->iconForUrl(url), engine->name(), this); a->setCheckable(true); if (engine->desktopEntryName() == selectedEngine->desktopEntryName()) a->setChecked(true); a->setData(engine->entryPath()); diff --git a/src/urlbar/rsswidget.cpp b/src/urlbar/rsswidget.cpp index b29ed0e8..9065dc80 100644 --- a/src/urlbar/rsswidget.cpp +++ b/src/urlbar/rsswidget.cpp @@ -74,7 +74,7 @@ RSSWidget::RSSWidget(const QMap< KUrl, QString > &map, QWidget *parent) m_agregators->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_agregators->addItem(KIcon("akregator"), QString("Akregator")); - m_agregators->addItem(Application::iconManager()->iconForUrl(KUrl("http://google.com/reader")), i18n("Google Reader")); + m_agregators->addItem(rApp->iconManager()->iconForUrl(KUrl("http://google.com/reader")), i18n("Google Reader")); layout->addRow(agregator, m_agregators); @@ -138,7 +138,7 @@ void RSSWidget::accept() void RSSWidget::addWithGoogleReader(const QString &url) { KUrl toLoad = KUrl("http://www.google.com/ig/add?feedurl=" + url); - Application::instance()->mainWindow()->currentTab()->view()->load(toLoad); + rApp->mainWindow()->currentTab()->view()->load(toLoad); } diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index ceecf211..0cc96f30 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -110,7 +110,7 @@ UrlBar::UrlBar(QWidget *parent) connect(_tab->view(), SIGNAL(iconChanged()), this, SLOT(refreshFavicon())); // search icon - connect(Application::opensearchManager(), SIGNAL(openSearchEngineAdded(const QString &, const QString &, const QString &)), this, SLOT(updateRightIcons())); + connect(rApp->opensearchManager(), SIGNAL(openSearchEngineAdded(const QString &, const QString &, const QString &)), this, SLOT(updateRightIcons())); _suggestionTimer->setSingleShot(true); connect(_suggestionTimer, SIGNAL(timeout()), this, SLOT(suggest())); @@ -149,7 +149,7 @@ void UrlBar::activated(const KUrl& url, Rekonq::OpenType type) activateSuggestions(false); clearFocus(); setUrl(url); - Application::instance()->loadUrl(url, type); + rApp->loadUrl(url, type); } @@ -165,8 +165,8 @@ void UrlBar::paintEvent(QPaintEvent *event) } else { - backgroundColor = Application::palette().color(QPalette::Base); - foregroundColor = Application::palette().color(QPalette::Text); + backgroundColor = rApp->palette().color(QPalette::Base); + foregroundColor = rApp->palette().color(QPalette::Text); } // set background color of UrlBar @@ -185,7 +185,7 @@ void UrlBar::paintEvent(QPaintEvent *event) } else { - QColor highlight = Application::palette().color(QPalette::Highlight); + QColor highlight = rApp->palette().color(QPalette::Highlight); int r = (highlight.red()+2*backgroundColor.red())/3; int g = (highlight.green()+2*backgroundColor.green())/3; @@ -356,7 +356,7 @@ void UrlBar::showBookmarkInfo(const QPoint &pos) if( _tab->url().scheme() == QL1S("about") ) return; - KBookmark bookmark = Application::bookmarkProvider()->bookmarkForUrl(_tab->url()); + KBookmark bookmark = rApp->bookmarkProvider()->bookmarkForUrl(_tab->url()); IconButton *bt = qobject_cast<IconButton *>(this->sender()); if (!bt) @@ -364,7 +364,7 @@ void UrlBar::showBookmarkInfo(const QPoint &pos) if (bookmark.isNull()) { - bookmark = Application::bookmarkProvider()->bookmarkOwner()->bookmarkCurrentPage(); + bookmark = rApp->bookmarkProvider()->bookmarkOwner()->bookmarkCurrentPage(); // set bk icon bt->setIcon(KIcon("bookmarks")); @@ -443,7 +443,7 @@ IconButton *UrlBar::addRightIcon(UrlBar::icon ic) rightIcon->setToolTip(i18n("Show SSL Info")); break; case UrlBar::BK: - if (Application::bookmarkProvider()->bookmarkForUrl(_tab->url()).isNull()) + if (rApp->bookmarkProvider()->bookmarkForUrl(_tab->url()).isNull()) { rightIcon->setIcon(KIcon("bookmarks").pixmap(32,32, QIcon::Disabled)); rightIcon->setToolTip(i18n("Bookmark this page")); @@ -540,5 +540,5 @@ void UrlBar::refreshFavicon() _icon->setIcon(KIcon("arrow-right")); return; } - _icon->setIcon(Application::iconManager()->iconForUrl(u)); + _icon->setIcon(rApp->iconManager()->iconForUrl(u)); } diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index 3797f51f..15445ee5 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -356,7 +356,7 @@ void UrlResolver::computeWebSearches() // history void UrlResolver::computeHistory() { - QList<HistoryItem> found = Application::historyManager()->find(_typedString); + QList<HistoryItem> found = rApp->historyManager()->find(_typedString); qSort(found); Q_FOREACH(const HistoryItem &i, found) @@ -373,7 +373,7 @@ void UrlResolver::computeHistory() // bookmarks void UrlResolver::computeBookmarks() { - QList<KBookmark> found = Application::bookmarkProvider()->find(_typedString); + QList<KBookmark> found = rApp->bookmarkProvider()->find(_typedString); kDebug() << "FOUND: " << found.count(); Q_FOREACH(const KBookmark &b, found) { @@ -388,7 +388,7 @@ void UrlResolver::computeSuggestions() { // if a string startsWith /, it is probably a local path // so, no need for suggestions... - if(_typedString.startsWith('/') || !Application::opensearchManager()->isSuggestionAvailable()) + if(_typedString.startsWith('/') || !rApp->opensearchManager()->isSuggestionAvailable()) { UrlSearchList list; emit suggestionsReady(list, _typedString); @@ -403,13 +403,13 @@ void UrlResolver::computeSuggestions() setSearchEngine(engine); } - connect(Application::opensearchManager(), + connect(rApp->opensearchManager(), SIGNAL(suggestionsReceived(const QString &, const ResponseList &)), this, SLOT(suggestionsReceived(const QString &, const ResponseList &))); _typedQuery = query; - Application::opensearchManager()->requestSuggestion(query); + rApp->opensearchManager()->requestSuggestion(query); } diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h index 43a4a43e..821287c8 100644 --- a/src/urlbar/urlresolver.h +++ b/src/urlbar/urlresolver.h @@ -133,7 +133,7 @@ public: { _searchEngine = engine; if(engine) - Application::opensearchManager()->setSearchProvider(engine->desktopEntryName()); + rApp->opensearchManager()->setSearchProvider(engine->desktopEntryName()); }; void computeSuggestions(); diff --git a/src/webicon.cpp b/src/webicon.cpp index e64db308..b091572a 100644 --- a/src/webicon.cpp +++ b/src/webicon.cpp @@ -64,7 +64,7 @@ void WebIcon::load() void WebIcon::saveIcon(bool b) { if(b) - Application::iconManager()->provideIcon(&m_page, m_url, false); + rApp->iconManager()->provideIcon(&m_page, m_url, false); this->deleteLater(); } diff --git a/src/webpage.cpp b/src/webpage.cpp index b44b2e4d..8e77ecfe 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -207,7 +207,7 @@ static bool downloadResource (const KUrl& srcUrl, const KIO::MetaData& metaData while (result == KIO::R_CANCEL && destUrl.isValid()); // Save download history - Application::instance()->addDownload(srcUrl.pathOrUrl() , destUrl.pathOrUrl()); + rApp->addDownload(srcUrl.pathOrUrl() , destUrl.pathOrUrl()); if (!KStandardDirs::findExe("kget").isNull() && ReKonfig::kgetDownload()) { @@ -280,7 +280,7 @@ WebPage::WebPage(QWidget *parent) // protocol handler signals connect(&_protHandler, SIGNAL(downloadUrl(const KUrl &)), this, SLOT(downloadUrl(const KUrl &))); - connect(Application::iconManager(), SIGNAL(iconChanged()), mainFrame(), SIGNAL(iconChanged())); + connect(rApp->iconManager(), SIGNAL(iconChanged()), mainFrame(), SIGNAL(iconChanged())); } @@ -368,11 +368,11 @@ WebPage *WebPage::createWindow(QWebPage::WebWindowType type) WebTab *w = 0; if (ReKonfig::openTabNoWindow()) { - w = Application::instance()->mainWindow()->mainView()->newWebTab( !ReKonfig::openTabsBack() ); + w = rApp->mainWindow()->mainView()->newWebTab( !ReKonfig::openTabsBack() ); } else { - w = Application::instance()->newMainWindow()->mainView()->currentWebTab(); + w = rApp->newMainWindow()->mainView()->currentWebTab(); } return w->page(); } @@ -434,7 +434,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) if (!isLocal) { - KParts::BrowserOpenOrSaveQuestion dlg(Application::instance()->mainWindow(), replyUrl, _mimeType); + KParts::BrowserOpenOrSaveQuestion dlg(rApp->mainWindow(), replyUrl, _mimeType); if(!_suggestedFileName.isEmpty()) dlg.setSuggestedFileName(_suggestedFileName); @@ -466,7 +466,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) destUrl.setPath(tempFile.fileName()); kDebug() << "First save content to" << destUrl; KIO::Job *job = KIO::file_copy(_loadingUrl, destUrl, 0600, KIO::Overwrite); - job->ui()->setWindow(Application::instance()->mainWindow()); + job->ui()->setWindow(rApp->mainWindow()); connect(job, SIGNAL(result(KJob *)), this, SLOT(copyToTempFileResult(KJob*))); return; } @@ -502,7 +502,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) UrlBar *bar = tab->urlBar(); bar->setQUrl(replyUrl); - Application::instance()->mainWindow()->updateActions(); + rApp->mainWindow()->updateActions(); } else { @@ -549,10 +549,10 @@ void WebPage::loadFinished(bool ok) mainFrame()->setZoomFactor(QVariant(value).toReal() / 10); // Don't allox max +1 values // Provide site icon. Can this be moved to loadStarted?? - Application::iconManager()->provideIcon(this, _loadingUrl); + rApp->iconManager()->provideIcon(this, _loadingUrl); // Apply adblock manager hiding rules - Application::adblockManager()->applyHidingRules(this); + rApp->adblockManager()->applyHidingRules(this); // KWallet Integration QStringList list = ReKonfig::walletBlackList(); @@ -633,7 +633,7 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply) UrlBar *bar = tab->urlBar(); bar->setQUrl(_loadingUrl); - Application::instance()->mainWindow()->updateActions(); + rApp->mainWindow()->updateActions(); } } break; @@ -797,5 +797,5 @@ void WebPage::copyToTempFileResult(KJob* job) if ( job->error() ) job->uiDelegate()->showErrorMessage(); else - (void)KRun::runUrl(static_cast<KIO::FileCopyJob *>(job)->destUrl(), _mimeType, Application::instance()->mainWindow()); + (void)KRun::runUrl(static_cast<KIO::FileCopyJob *>(job)->destUrl(), _mimeType, rApp->mainWindow()); } diff --git a/src/webtab.cpp b/src/webtab.cpp index c2f00160..be45aff5 100644 --- a/src/webtab.cpp +++ b/src/webtab.cpp @@ -267,7 +267,7 @@ KUrl WebTab::extractOpensearchUrl(QWebElement e) bool WebTab::hasNewSearchEngine() { QWebElement e = page()->mainFrame()->findFirstElement(QLatin1String("head >link[rel=\"search\"][ type=\"application/opensearchdescription+xml\"]")); - return !e.isNull() && !Application::opensearchManager()->engineExists(extractOpensearchUrl(e)); + return !e.isNull() && !rApp->opensearchManager()->engineExists(extractOpensearchUrl(e)); } @@ -281,8 +281,8 @@ void WebTab::showSearchEngine(const QPoint &pos) widget->setWindowFlags(Qt::Popup); connect(widget, SIGNAL(webShortcutSet(const KUrl &, const QString &, const QString &)), - Application::opensearchManager(), SLOT(addOpenSearchEngine(const KUrl &, const QString &, const QString &))); - connect(Application::opensearchManager(), SIGNAL(openSearchEngineAdded(const QString &, const QString &, const QString &)), + rApp->opensearchManager(), SLOT(addOpenSearchEngine(const KUrl &, const QString &, const QString &))); + connect(rApp->opensearchManager(), SIGNAL(openSearchEngineAdded(const QString &, const QString &, const QString &)), this, SLOT(openSearchEngineAdded())); widget->show(extractOpensearchUrl(e), title, pos); @@ -295,6 +295,6 @@ void WebTab::openSearchEngineAdded() // If the providers changed, tell sycoca to rebuild its database... KBuildSycocaProgressDialog::rebuildKSycoca(this); - disconnect(Application::opensearchManager(), SIGNAL(openSearchEngineAdded(const QString &, const QString &, const QString &)), + disconnect(rApp->opensearchManager(), SIGNAL(openSearchEngineAdded(const QString &, const QString &, const QString &)), this, SLOT(openSearchEngineAdded())); } diff --git a/src/webview.cpp b/src/webview.cpp index 18c7a730..a7a0e803 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -103,7 +103,7 @@ WebView::WebView(QWidget* parent) // loadUrl signal connect(this, SIGNAL(loadUrl(const KUrl &, const Rekonq::OpenType &)), - Application::instance(), SLOT(loadUrl(const KUrl &, const Rekonq::OpenType &))); + rApp, SLOT(loadUrl(const KUrl &, const Rekonq::OpenType &))); // Auto scroll timer connect(m_autoScrollTimer, SIGNAL(timeout()), this, SLOT(scrollFrameChanged())); @@ -134,7 +134,7 @@ void WebView::changeWindowIcon() { if (ReKonfig::useFavicon()) { - MainWindow *const mainWindow = Application::instance()->mainWindow(); + MainWindow *const mainWindow = rApp->mainWindow(); if (url() == mainWindow->currentTab()->url()) { const int index = mainWindow->mainView()->currentIndex(); @@ -154,7 +154,7 @@ WebPage *WebView::page() void WebView::contextMenuEvent(QContextMenuEvent *event) { QWebHitTestResult result = page()->mainFrame()->hitTestContent(event->pos()); - MainWindow *mainwindow = Application::instance()->mainWindow(); + MainWindow *mainwindow = rApp->mainWindow(); KMenu menu(this); QAction *a; @@ -241,14 +241,14 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) foreach(KService::Ptr engine, SearchEngine::favorites()) { a = new KAction(engine->name(), this); - a->setIcon(Application::iconManager()->iconForUrl(SearchEngine::buildQuery(engine, ""))); + a->setIcon(rApp->iconManager()->iconForUrl(SearchEngine::buildQuery(engine, ""))); a->setData(engine->entryPath()); connect(a, SIGNAL(triggered(bool)), this, SLOT(search())); searchMenu->addAction(a); } a = new KAction(KIcon("edit-find"), i18n("On Current Page"), this); - connect(a, SIGNAL(triggered()), Application::instance()->mainWindow(), SLOT(findSelectedText())); + connect(a, SIGNAL(triggered()), rApp->mainWindow(), SLOT(findSelectedText())); searchMenu->addAction(a); if (!searchMenu->menu()->isEmpty()) @@ -383,7 +383,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) menu.addAction(inspectAction); } - a = Application::bookmarkProvider()->actionByName("rekonq_add_bookmark"); + a = rApp->bookmarkProvider()->actionByName("rekonq_add_bookmark"); menu.addAction(a); } @@ -461,7 +461,7 @@ void WebView::mouseMoveEvent(QMouseEvent *event) return; } - MainWindow *w = Application::instance()->mainWindow(); + MainWindow *w = rApp->mainWindow(); if (w->isFullScreen()) { if (event->pos().y() >= 0 && event->pos().y() <= 4) @@ -492,10 +492,10 @@ void WebView::dropEvent(QDropEvent *event) if (event->mimeData()->hasFormat("application/rekonq-bookmark")) { QByteArray addresses = event->mimeData()->data("application/rekonq-bookmark"); - KBookmark bookmark = Application::bookmarkProvider()->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data())); + KBookmark bookmark = rApp->bookmarkProvider()->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data())); if (bookmark.isGroup()) { - Application::bookmarkProvider()->bookmarkOwner()->openFolderinTabs(bookmark.toGroup()); + rApp->bookmarkProvider()->bookmarkOwner()->openFolderinTabs(bookmark.toGroup()); } else { @@ -520,7 +520,7 @@ void WebView::search() void WebView::printFrame() { - Application::instance()->mainWindow()->printRequested(page()->currentFrame()); + rApp->mainWindow()->printRequested(page()->currentFrame()); } @@ -706,7 +706,7 @@ void WebView::wheelEvent(QWheelEvent *event) void WebView::inspect() { - QAction *a = Application::instance()->mainWindow()->actionByName("web_inspector"); + QAction *a = rApp->mainWindow()->actionByName("web_inspector"); if (a && !a->isChecked()) a->trigger(); pageAction(QWebPage::InspectElement)->trigger(); diff --git a/src/zoombar.cpp b/src/zoombar.cpp index 86791266..544cfa4b 100644 --- a/src/zoombar.cpp +++ b/src/zoombar.cpp @@ -135,7 +135,7 @@ void ZoomBar::show() { emit visibilityChanged(true); QWidget::show(); - m_zoomSlider->setValue(Application::instance()->mainWindow()->currentTab()->view()->zoomFactor()*10); + m_zoomSlider->setValue(rApp->mainWindow()->currentTab()->view()->zoomFactor()*10); } } @@ -168,8 +168,8 @@ void ZoomBar::zoomNormal() void ZoomBar::updateSlider(int webview) { WebTab *tab = 0; - if (!Application::instance()->mainWindowList().isEmpty()) - tab = Application::instance()->mainWindow()->mainView()->webTab(webview); + if (!rApp->mainWindowList().isEmpty()) + tab = rApp->mainWindow()->mainView()->webTab(webview); if (!tab) return; @@ -183,7 +183,7 @@ void ZoomBar::setValue(int value) m_zoomSlider->setValue(value); m_percentage->setText(i18nc("percentage of the website zoom", "%1%", QString::number(value*10))); - WebTab *tab = Application::instance()->mainWindow()->currentTab(); + WebTab *tab = rApp->mainWindow()->currentTab(); saveZoomValue(tab->url().host(), value); tab->view()->setZoomFactor(QVariant(value).toReal() / 10); // Don't allox max +1 values } |