From 23b44d0344304499ba8e1f199720202381920827 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Thu, 24 Feb 2011 18:35:20 +0100 Subject: 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 --- src/bookmarks/bookmarkowner.cpp | 12 ++++++------ src/bookmarks/bookmarkprovider.cpp | 14 +++++++------- src/bookmarks/bookmarkspanel.cpp | 6 +++--- src/bookmarks/bookmarkstoolbar.cpp | 28 ++++++++++++++-------------- src/bookmarks/bookmarkstreemodel.cpp | 14 +++++++------- 5 files changed, 37 insertions(+), 37 deletions(-) (limited to 'src/bookmarks') 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 > BookmarkOwner::currentBookmarkList() const { QList< QPair > 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 BookmarkProvider::find(const QString &text) { QList 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(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(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(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()); } -- cgit v1.2.1