summaryrefslogtreecommitdiff
path: root/src/bookmarks
diff options
context:
space:
mode:
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/bookmarkowner.cpp46
-rw-r--r--src/bookmarks/bookmarkprovider.cpp56
-rw-r--r--src/bookmarks/bookmarkscontextmenu.cpp16
-rw-r--r--src/bookmarks/bookmarkspanel.cpp18
-rw-r--r--src/bookmarks/bookmarkstoolbar.cpp112
-rw-r--r--src/bookmarks/bookmarkstreemodel.cpp70
6 files changed, 159 insertions, 159 deletions
diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp
index 75b5f12d..b15bf28b 100644
--- a/src/bookmarks/bookmarkowner.cpp
+++ b/src/bookmarks/bookmarkowner.cpp
@@ -57,7 +57,7 @@ BookmarkOwner::BookmarkOwner(KBookmarkManager *manager, QObject *parent)
KAction* BookmarkOwner::createAction(const KBookmark &bookmark, const BookmarkAction &bmAction)
{
- switch(bmAction)
+ switch (bmAction)
{
case OPEN:
return createAction(i18n("Open"), "tab-new",
@@ -119,7 +119,7 @@ QList< QPair<QString, QString> > BookmarkOwner::currentBookmarkList() const
MainView *view = rApp->mainWindow()->mainView();
int tabNumber = view->count();
- for(int i = 0; i < tabNumber; ++i)
+ for (int i = 0; i < tabNumber; ++i)
{
QPair<QString, QString> item;
item.first = view->webTab(i)->view()->title();
@@ -135,7 +135,7 @@ void BookmarkOwner::openBookmark(const KBookmark &bookmark,
Qt::MouseButtons mouseButtons,
Qt::KeyboardModifiers keyboardModifiers)
{
- if(keyboardModifiers & Qt::ControlModifier || mouseButtons & Qt::MidButton)
+ if (keyboardModifiers & Qt::ControlModifier || mouseButtons & Qt::MidButton)
openBookmarkInNewTab(bookmark);
else
openBookmark(bookmark);
@@ -146,15 +146,15 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bkGoup)
{
QList<KUrl> urlList = bkGoup.groupUrlList();
- if(urlList.length() > 8)
+ if (urlList.length() > 8)
{
- if(KMessageBox::warningContinueCancel(
+ if (KMessageBox::warningContinueCancel(
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()))
!= KMessageBox::Continue
- )
+ )
return;
}
@@ -194,9 +194,9 @@ KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark)
{
KBookmarkGroup parent;
- if(!bookmark.isNull())
+ if (!bookmark.isNull())
{
- if(bookmark.isGroup())
+ if (bookmark.isGroup())
parent = bookmark.toGroup();
else
parent = bookmark.parentGroup();
@@ -207,7 +207,7 @@ KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark)
}
KBookmark newBk = parent.addBookmark(currentTitle(), KUrl(currentUrl()));
- if(!bookmark.isNull())
+ if (!bookmark.isNull())
parent.moveBookmark(newBk, bookmark);
m_manager->emitChanged(parent);
@@ -221,16 +221,16 @@ KBookmarkGroup BookmarkOwner::newBookmarkFolder(const KBookmark &bookmark)
KBookmarkDialog *dialog = bookmarkDialog(m_manager, 0);
QString folderName = i18n("New folder");
- if(!bookmark.isNull())
+ if (!bookmark.isNull())
{
- if(bookmark.isGroup())
+ if (bookmark.isGroup())
{
newBk = dialog->createNewFolder(folderName, bookmark);
}
else
{
newBk = dialog->createNewFolder(folderName, bookmark.parentGroup());
- if(!newBk.isNull())
+ if (!newBk.isNull())
{
KBookmarkGroup parent = newBk.parentGroup();
parent.moveBookmark(newBk, bookmark);
@@ -252,9 +252,9 @@ KBookmark BookmarkOwner::newSeparator(const KBookmark &bookmark)
{
KBookmark newBk;
- if(!bookmark.isNull())
+ if (!bookmark.isNull())
{
- if(bookmark.isGroup())
+ if (bookmark.isGroup())
{
newBk = bookmark.toGroup().createNewSeparator();
}
@@ -278,7 +278,7 @@ KBookmark BookmarkOwner::newSeparator(const KBookmark &bookmark)
void BookmarkOwner::copyLink(const KBookmark &bookmark)
{
- if(bookmark.isNull())
+ if (bookmark.isNull())
return;
QApplication::clipboard()->setText(bookmark.url().url());
@@ -287,7 +287,7 @@ void BookmarkOwner::copyLink(const KBookmark &bookmark)
void BookmarkOwner::editBookmark(KBookmark bookmark)
{
- if(bookmark.isNull())
+ if (bookmark.isNull())
return;
KBookmarkDialog *dialog = bookmarkDialog(m_manager, 0);
@@ -299,18 +299,18 @@ void BookmarkOwner::editBookmark(KBookmark bookmark)
bool BookmarkOwner::deleteBookmark(const KBookmark &bookmark)
{
- if(bookmark.isNull())
+ if (bookmark.isNull())
return false;
KBookmarkGroup bmg = bookmark.parentGroup();
QString dialogCaption, dialogText;
- if(bookmark.isGroup())
+ if (bookmark.isGroup())
{
dialogCaption = i18n("Bookmark Folder Deletion");
dialogText = i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", bookmark.fullText());
}
- else if(bookmark.isSeparator())
+ else if (bookmark.isSeparator())
{
dialogCaption = i18n("Separator Deletion");
dialogText = i18n("Are you sure you wish to remove this separator?");
@@ -321,7 +321,7 @@ bool BookmarkOwner::deleteBookmark(const KBookmark &bookmark)
dialogText = i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", bookmark.fullText());
}
- if(KMessageBox::warningContinueCancel(
+ if (KMessageBox::warningContinueCancel(
0,
dialogText,
dialogCaption,
@@ -329,7 +329,7 @@ bool BookmarkOwner::deleteBookmark(const KBookmark &bookmark)
KStandardGuiItem::cancel(),
"bookmarkDeletition_askAgain")
!= KMessageBox::Continue
- )
+ )
return false;
bmg.deleteBookmark(bookmark);
@@ -340,7 +340,7 @@ bool BookmarkOwner::deleteBookmark(const KBookmark &bookmark)
void BookmarkOwner::setToolBarFolder(KBookmark bookmark)
{
- if(!bookmark.isGroup())
+ if (!bookmark.isGroup())
return;
unsetToolBarFolder();
@@ -354,7 +354,7 @@ void BookmarkOwner::setToolBarFolder(KBookmark bookmark)
void BookmarkOwner::unsetToolBarFolder()
{
KBookmarkGroup toolbar = m_manager->toolbar();
- if(!toolbar.isNull())
+ if (!toolbar.isNull())
{
toolbar.internalElement().setAttribute("toolbar", "no");
toolbar.setIcon("");
diff --git a/src/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp
index 62f2433b..9b4be96f 100644
--- a/src/bookmarks/bookmarkprovider.cpp
+++ b/src/bookmarks/bookmarkprovider.cpp
@@ -57,7 +57,7 @@ BookmarkProvider::BookmarkProvider(QObject *parent)
m_manager = KBookmarkManager::userBookmarksManager();
const QString bookmarksFile = KStandardDirs::locateLocal("data", QString::fromLatin1("konqueror/bookmarks.xml"));
- if(!QFile::exists(bookmarksFile))
+ if (!QFile::exists(bookmarksFile))
{
kDebug() << "copying of defaultbookmarks.xbel ...";
@@ -103,7 +103,7 @@ KActionMenu* BookmarkProvider::bookmarkActionMenu(QWidget *parent)
void BookmarkProvider::registerBookmarkBar(BookmarkToolBar *toolbar)
{
- if(m_bookmarkToolBars.contains(toolbar))
+ if (m_bookmarkToolBars.contains(toolbar))
return;
m_bookmarkToolBars.append(toolbar);
@@ -118,7 +118,7 @@ void BookmarkProvider::removeBookmarkBar(BookmarkToolBar *toolbar)
void BookmarkProvider::registerBookmarkPanel(BookmarksPanel *panel)
{
- if(panel && !m_bookmarkPanels.contains(panel))
+ if (panel && !m_bookmarkPanels.contains(panel))
{
m_bookmarkPanels.append(panel);
connect(panel, SIGNAL(expansionChanged()), this, SLOT(slotPanelChanged()));
@@ -128,13 +128,13 @@ void BookmarkProvider::registerBookmarkPanel(BookmarksPanel *panel)
void BookmarkProvider::removeBookmarkPanel(BookmarksPanel *panel)
{
- if(!panel)
+ if (!panel)
return;
m_bookmarkPanels.removeOne(panel);
panel->disconnect(this);
- if(m_bookmarkPanels.isEmpty())
+ if (m_bookmarkPanels.isEmpty())
rApp->bookmarkProvider()->bookmarkManager()->emitChanged();
}
@@ -142,7 +142,7 @@ void BookmarkProvider::removeBookmarkPanel(BookmarksPanel *panel)
QAction* BookmarkProvider::actionByName(const QString &name)
{
QAction *action = m_actionCollection->action(name);
- if(action)
+ if (action)
return action;
return new QAction(this);
}
@@ -159,8 +159,8 @@ QList<KBookmark> BookmarkProvider::find(const QString &text)
QList<KBookmark> list;
KBookmarkGroup root = rApp->bookmarkProvider()->rootGroup();
- if(!root.isNull())
- for(KBookmark bookmark = root.first(); !bookmark.isNull(); bookmark = root.next(bookmark))
+ if (!root.isNull())
+ for (KBookmark bookmark = root.first(); !bookmark.isNull(); bookmark = root.next(bookmark))
find(&list, bookmark, text);
return list;
@@ -170,7 +170,7 @@ QList<KBookmark> BookmarkProvider::find(const QString &text)
KBookmark BookmarkProvider::bookmarkForUrl(const KUrl &url)
{
KBookmarkGroup root = rootGroup();
- if(root.isNull())
+ if (root.isNull())
return KBookmark();
return bookmarkForUrl(root, url);
@@ -181,13 +181,13 @@ void BookmarkProvider::slotBookmarksChanged()
{
foreach(BookmarkToolBar * bookmarkToolBar, m_bookmarkToolBars)
{
- if(bookmarkToolBar)
+ if (bookmarkToolBar)
{
bookmarkToolBar->toolBar()->clear();
fillBookmarkBar(bookmarkToolBar);
}
}
- if(rApp->mainWindow() && rApp->mainWindow()->currentTab() && rApp->mainWindow()->currentTab()->url().toMimeDataString().contains("about:bookmarks"))
+ if (rApp->mainWindow() && rApp->mainWindow()->currentTab() && rApp->mainWindow()->currentTab()->url().toMimeDataString().contains("about:bookmarks"))
rApp->loadUrl(KUrl("about:bookmarks"), Rekonq::CurrentTab);
}
@@ -195,12 +195,12 @@ void BookmarkProvider::slotBookmarksChanged()
void BookmarkProvider::fillBookmarkBar(BookmarkToolBar *toolBar)
{
KBookmarkGroup root = m_manager->toolbar();
- if(root.isNull())
+ if (root.isNull())
return;
- for(KBookmark bookmark = root.first(); !bookmark.isNull(); bookmark = root.next(bookmark))
+ for (KBookmark bookmark = root.first(); !bookmark.isNull(); bookmark = root.next(bookmark))
{
- if(bookmark.isGroup())
+ if (bookmark.isGroup())
{
KBookmarkActionMenu *menuAction = new KBookmarkActionMenu(bookmark.toGroup(), this);
menuAction->setDelayed(false);
@@ -213,7 +213,7 @@ void BookmarkProvider::fillBookmarkBar(BookmarkToolBar *toolBar)
toolBar->toolBar()->addAction(menuAction);
toolBar->toolBar()->widgetForAction(menuAction)->installEventFilter(toolBar);
}
- else if(bookmark.isSeparator())
+ else if (bookmark.isSeparator())
{
toolBar->toolBar()->addSeparator();
}
@@ -233,20 +233,20 @@ void BookmarkProvider::slotPanelChanged()
{
foreach(BookmarksPanel * panel, m_bookmarkPanels)
{
- if(panel && panel != sender())
+ if (panel && panel != sender())
panel->loadFoldedState();
}
- if(rApp->mainWindow() && rApp->mainWindow()->currentTab() && rApp->mainWindow()->currentTab()->url().toMimeDataString().contains("about:bookmarks"))
+ if (rApp->mainWindow() && rApp->mainWindow()->currentTab() && rApp->mainWindow()->currentTab()->url().toMimeDataString().contains("about:bookmarks"))
rApp->loadUrl(KUrl("about:bookmarks"), Rekonq::CurrentTab);
}
void BookmarkProvider::find(QList<KBookmark> *list, const KBookmark &bookmark, const QString &text)
{
- if(bookmark.isGroup())
+ if (bookmark.isGroup())
{
KBookmarkGroup group = bookmark.toGroup();
- for(KBookmark bm = group.first(); !bm.isNull(); bm = group.next(bm))
+ for (KBookmark bm = group.first(); !bm.isNull(); bm = group.next(bm))
find(list, bm, text);
}
else
@@ -255,14 +255,14 @@ void BookmarkProvider::find(QList<KBookmark> *list, const KBookmark &bookmark, c
bool matches = true;
foreach(const QString & word, words)
{
- if(!bookmark.url().url().contains(word, Qt::CaseInsensitive)
+ if (!bookmark.url().url().contains(word, Qt::CaseInsensitive)
&& !bookmark.fullText().contains(word, Qt::CaseInsensitive))
{
matches = false;
break;
}
}
- if(matches)
+ if (matches)
*list << bookmark;
}
}
@@ -272,18 +272,18 @@ KBookmark BookmarkProvider::bookmarkForUrl(const KBookmark &bookmark, const KUrl
{
KBookmark found;
- if(bookmark.isGroup())
+ if (bookmark.isGroup())
{
KBookmarkGroup group = bookmark.toGroup();
KBookmark bookmark = group.first();
- while(!bookmark.isNull() && found.isNull())
+ while (!bookmark.isNull() && found.isNull())
{
found = bookmarkForUrl(bookmark, url);
bookmark = group.next(bookmark);
}
}
- else if(!bookmark.isSeparator() && bookmark.url() == url)
+ else if (!bookmark.isSeparator() && bookmark.url() == url)
{
found = bookmark;
}
@@ -295,19 +295,19 @@ KBookmark BookmarkProvider::bookmarkForUrl(const KBookmark &bookmark, const KUrl
void BookmarkProvider::copyBookmarkGroup(const KBookmarkGroup &groupToCopy, KBookmarkGroup destGroup)
{
KBookmark bookmark = groupToCopy.first();
- while(!bookmark.isNull())
+ while (!bookmark.isNull())
{
- if(bookmark.isGroup())
+ if (bookmark.isGroup())
{
KBookmarkGroup newDestGroup = destGroup.createNewFolder(bookmark.text());
- if(bookmark.toGroup().isToolbarGroup())
+ if (bookmark.toGroup().isToolbarGroup())
{
newDestGroup.internalElement().setAttribute("toolbar", "yes");
newDestGroup.setIcon("bookmark-toolbar");
}
copyBookmarkGroup(bookmark.toGroup(), newDestGroup);
}
- else if(bookmark.isSeparator())
+ else if (bookmark.isSeparator())
{
destGroup.createNewSeparator();
}
diff --git a/src/bookmarks/bookmarkscontextmenu.cpp b/src/bookmarks/bookmarkscontextmenu.cpp
index 16936682..735e3412 100644
--- a/src/bookmarks/bookmarkscontextmenu.cpp
+++ b/src/bookmarks/bookmarkscontextmenu.cpp
@@ -70,7 +70,7 @@ void BookmarksContextMenu::addFolderActions()
{
KBookmarkGroup group = bookmark().toGroup();
- if(bookmark().internalElement().attributeNode("toolbar").value() == "yes")
+ if (bookmark().internalElement().attributeNode("toolbar").value() == "yes")
{
addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::UNSET_TOOLBAR_FOLDER));
}
@@ -79,16 +79,16 @@ void BookmarksContextMenu::addFolderActions()
addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::SET_TOOLBAR_FOLDER));
}
- if(!group.first().isNull())
+ if (!group.first().isNull())
{
KBookmark child = group.first();
- while(child.isGroup() || child.isSeparator())
+ while (child.isGroup() || child.isSeparator())
{
child = group.next(child);
}
- if(!child.isNull())
+ if (!child.isNull())
{
addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::OPEN_FOLDER));
addSeparator();
@@ -121,7 +121,7 @@ void BookmarksContextMenu::addSeparatorActions()
void BookmarksContextMenu::addNullActions()
{
KBookmarkManager *manager = rApp->bookmarkProvider()->bookmarkManager();
- if(manager->toolbar().hasParent())
+ if (manager->toolbar().hasParent())
{
addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::UNSET_TOOLBAR_FOLDER));
}
@@ -133,15 +133,15 @@ void BookmarksContextMenu::addNullActions()
void BookmarksContextMenu::addActions()
{
- if(bookmark().isNull() || m_nullForced)
+ if (bookmark().isNull() || m_nullForced)
{
addNullActions();
}
- else if(bookmark().isSeparator())
+ else if (bookmark().isSeparator())
{
addSeparatorActions();
}
- else if(bookmark().isGroup())
+ else if (bookmark().isGroup())
{
addFolderActions();
}
diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp
index fcd62f6c..eb46119e 100644
--- a/src/bookmarks/bookmarkspanel.cpp
+++ b/src/bookmarks/bookmarkspanel.cpp
@@ -71,7 +71,7 @@ void BookmarksPanel::loadFoldedState()
void BookmarksPanel::contextMenu(const QPoint &pos)
{
- if(_loadingState)
+ if (_loadingState)
return;
BookmarksContextMenu menu(bookmarkForIndex(panelTreeView()->indexAt(pos)),
@@ -86,7 +86,7 @@ void BookmarksPanel::contextMenu(const QPoint &pos)
void BookmarksPanel::deleteBookmark()
{
QModelIndex index = panelTreeView()->currentIndex();
- if(_loadingState || !index.isValid())
+ if (_loadingState || !index.isValid())
return;
rApp->bookmarkProvider()->bookmarkOwner()->deleteBookmark(bookmarkForIndex(index));
@@ -95,7 +95,7 @@ void BookmarksPanel::deleteBookmark()
void BookmarksPanel::onCollapse(const QModelIndex &index)
{
- if(_loadingState)
+ if (_loadingState)
return;
bookmarkForIndex(index).internalElement().setAttribute("folded", "yes");
@@ -105,7 +105,7 @@ void BookmarksPanel::onCollapse(const QModelIndex &index)
void BookmarksPanel::onExpand(const QModelIndex &index)
{
- if(_loadingState)
+ if (_loadingState)
return;
bookmarkForIndex(index).internalElement().setAttribute("folded", "no");
@@ -128,19 +128,19 @@ void BookmarksPanel::setup()
void BookmarksPanel::loadFoldedState(const QModelIndex &root)
{
QAbstractItemModel *model = panelTreeView()->model();
- if(!model)
+ if (!model)
return;
int count = model->rowCount(root);
QModelIndex index;
- for(int i = 0; i < count; ++i)
+ for (int i = 0; i < count; ++i)
{
index = model->index(i, 0, root);
- if(index.isValid())
+ if (index.isValid())
{
KBookmark bm = bookmarkForIndex(index);
- if(bm.isGroup())
+ if (bm.isGroup())
{
panelTreeView()->setExpanded(index, bm.toGroup().isOpen());
loadFoldedState(index);
@@ -152,7 +152,7 @@ void BookmarksPanel::loadFoldedState(const QModelIndex &root)
KBookmark BookmarksPanel::bookmarkForIndex(const QModelIndex &index)
{
- if(!index.isValid())
+ if (!index.isValid())
return KBookmark();
const UrlFilterProxyModel *proxyModel = static_cast<const UrlFilterProxyModel*>(index.model());
diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp
index efa1e1cc..6fa8fdec 100644
--- a/src/bookmarks/bookmarkstoolbar.cpp
+++ b/src/bookmarks/bookmarkstoolbar.cpp
@@ -70,7 +70,7 @@ BookmarkMenu::~BookmarkMenu()
KMenu * BookmarkMenu::contextMenu(QAction *act)
{
KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(act);
- if(!action)
+ if (!action)
return 0;
return new BookmarksContextMenu(action->bookmark(), manager(), static_cast<BookmarkOwner*>(owner()));
}
@@ -78,7 +78,7 @@ KMenu * BookmarkMenu::contextMenu(QAction *act)
QAction * BookmarkMenu::actionForBookmark(const KBookmark &bookmark)
{
- if(bookmark.isGroup())
+ if (bookmark.isGroup())
{
KBookmarkActionMenu *actionMenu = new KBookmarkActionMenu(bookmark, this);
BookmarkMenu *menu = new BookmarkMenu(manager(), owner(), actionMenu->menu(), bookmark.address());
@@ -86,7 +86,7 @@ QAction * BookmarkMenu::actionForBookmark(const KBookmark &bookmark)
connect(actionMenu, SIGNAL(hovered()), menu, SLOT(slotAboutToShow()));
return actionMenu;
}
- else if(bookmark.isSeparator())
+ else if (bookmark.isSeparator())
{
return KBookmarkMenu::actionForBookmark(bookmark);
}
@@ -105,10 +105,10 @@ void BookmarkMenu::refill()
clear();
fillBookmarks();
- if(parentMenu()->actions().count() > 0)
+ if (parentMenu()->actions().count() > 0)
parentMenu()->addSeparator();
- if(isRoot())
+ if (isRoot())
{
addAddBookmark();
addAddBookmarksList();
@@ -129,16 +129,16 @@ void BookmarkMenu::addOpenFolderInTabs()
{
KBookmarkGroup group = manager()->findByAddress(parentAddress()).toGroup();
- if(!group.first().isNull())
+ if (!group.first().isNull())
{
KBookmark bookmark = group.first();
- while(bookmark.isGroup() || bookmark.isSeparator())
+ while (bookmark.isGroup() || bookmark.isSeparator())
{
bookmark = group.next(bookmark);
}
- if(!bookmark.isNull())
+ if (!bookmark.isNull())
{
parentMenu()->addAction(rApp->bookmarkProvider()->bookmarkOwner()->createAction(group, BookmarkOwner::OPEN_FOLDER));
}
@@ -149,7 +149,7 @@ void BookmarkMenu::addOpenFolderInTabs()
void BookmarkMenu::actionHovered()
{
KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(sender());
- if(action)
+ if (action)
rApp->mainWindow()->notifyMessage(action->bookmark().url().url());
}
@@ -173,7 +173,7 @@ BookmarkToolBar::BookmarkToolBar(KToolBar *toolBar, QObject *parent)
toolBar->installEventFilter(this);
toolBar->setShortcutEnabled(false);
- if(toolBar->isVisible())
+ if (toolBar->isVisible())
{
rApp->bookmarkProvider()->fillBookmarkBar(this);
m_filled = true;
@@ -192,7 +192,7 @@ void BookmarkToolBar::contextMenu(const QPoint &point)
KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface*>(toolBar()->actionAt(point));
KBookmark bookmark = rApp->bookmarkProvider()->bookmarkManager()->toolbar();
bool nullAction = true;
- if(action)
+ if (action)
{
bookmark = action->bookmark();
nullAction = false;
@@ -222,27 +222,27 @@ void BookmarkToolBar::menuHidden()
void BookmarkToolBar::hideMenu()
{
- if(m_currentMenu)
+ if (m_currentMenu)
m_currentMenu->hide();
}
bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
{
- if(m_currentMenu && m_currentMenu->isVisible()
+ if (m_currentMenu && m_currentMenu->isVisible()
&& !m_currentMenu->rect().contains(m_currentMenu->mapFromGlobal(QCursor::pos())))
{
// To switch root folders as in a menubar
KBookmarkActionMenu* act = dynamic_cast<KBookmarkActionMenu *>(toolBar()->actionAt(toolBar()->mapFromGlobal(QCursor::pos())));
- if(event->type() == QEvent::MouseMove && act && act->menu() != m_currentMenu)
+ if (event->type() == QEvent::MouseMove && act && act->menu() != m_currentMenu)
{
m_currentMenu->hide();
QPoint pos = toolBar()->mapToGlobal(toolBar()->widgetForAction(act)->pos());
act->menu()->popup(QPoint(pos.x(), pos.y() + toolBar()->widgetForAction(act)->height()));
}
- else if(event->type() == QEvent::MouseButtonPress && act)
+ else if (event->type() == QEvent::MouseButtonPress && act)
{
m_currentMenu->hide();
}
@@ -250,11 +250,11 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
return QObject::eventFilter(watched, event);
}
- switch(event->type())
+ switch (event->type())
{
case QEvent::Show:
{
- if(!m_filled)
+ if (!m_filled)
{
rApp->bookmarkProvider()->fillBookmarkBar(this);
m_filled = true;
@@ -265,10 +265,10 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
case QEvent::ActionRemoved:
{
QActionEvent *actionEvent = static_cast<QActionEvent*>(event);
- if(actionEvent && actionEvent->action() != m_dropAction)
+ if (actionEvent && actionEvent->action() != m_dropAction)
{
QWidget *widget = toolBar()->widgetForAction(actionEvent->action());
- if(widget)
+ if (widget)
{
widget->removeEventFilter(this);
}
@@ -279,10 +279,10 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
case QEvent::ParentChange:
{
QActionEvent *actionEvent = static_cast<QActionEvent*>(event);
- if(actionEvent && actionEvent->action() != m_dropAction)
+ if (actionEvent && actionEvent->action() != m_dropAction)
{
QWidget *widget = toolBar()->widgetForAction(actionEvent->action());
- if(widget)
+ if (widget)
{
widget->removeEventFilter(this);
}
@@ -293,7 +293,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
case QEvent::DragEnter:
{
QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent*>(event);
- if(dragEvent->mimeData()->hasFormat("application/rekonq-bookmark") || dragEvent->mimeData()->hasFormat("text/uri-list") || dragEvent->mimeData()->hasFormat("text/plain"))
+ if (dragEvent->mimeData()->hasFormat("application/rekonq-bookmark") || dragEvent->mimeData()->hasFormat("text/uri-list") || dragEvent->mimeData()->hasFormat("text/plain"))
{
QFrame* dropIndicatorWidget = new QFrame(toolBar());
dropIndicatorWidget->setFrameShape(QFrame::VLine);
@@ -308,7 +308,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
{
QDragLeaveEvent *dragEvent = static_cast<QDragLeaveEvent*>(event);
- if(m_checkedAction)
+ if (m_checkedAction)
{
m_checkedAction->setCheckable(false);
m_checkedAction->setChecked(false);
@@ -323,26 +323,26 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
case QEvent::DragMove:
{
QDragMoveEvent *dragEvent = static_cast<QDragMoveEvent*>(event);
- if(dragEvent->mimeData()->hasFormat("application/rekonq-bookmark") || dragEvent->mimeData()->hasFormat("text/uri-list") || dragEvent->mimeData()->hasFormat("text/plain"))
+ if (dragEvent->mimeData()->hasFormat("application/rekonq-bookmark") || dragEvent->mimeData()->hasFormat("text/uri-list") || dragEvent->mimeData()->hasFormat("text/plain"))
{
QAction *overAction = toolBar()->actionAt(dragEvent->pos());
KBookmarkActionInterface *overActionBK = dynamic_cast<KBookmarkActionInterface*>(overAction);
QWidget *widgetAction = toolBar()->widgetForAction(overAction);
- if(overAction != m_dropAction && overActionBK && widgetAction && m_dropAction)
+ if (overAction != m_dropAction && overActionBK && widgetAction && m_dropAction)
{
toolBar()->removeAction(m_dropAction);
- if(m_checkedAction)
+ if (m_checkedAction)
{
m_checkedAction->setCheckable(false);
m_checkedAction->setChecked(false);
}
- if(!overActionBK->bookmark().isGroup())
+ if (!overActionBK->bookmark().isGroup())
{
- if((dragEvent->pos().x() - widgetAction->pos().x()) > (widgetAction->width() / 2))
+ if ((dragEvent->pos().x() - widgetAction->pos().x()) > (widgetAction->width() / 2))
{
- if(toolBar()->actions().count() > toolBar()->actions().indexOf(overAction) + 1)
+ if (toolBar()->actions().count() > toolBar()->actions().indexOf(overAction) + 1)
{
toolBar()->insertAction(toolBar()->actions().at(toolBar()->actions().indexOf(overAction) + 1), m_dropAction);
}
@@ -358,9 +358,9 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
}
else
{
- if((dragEvent->pos().x() - widgetAction->pos().x()) >= (widgetAction->width() * 0.75))
+ if ((dragEvent->pos().x() - widgetAction->pos().x()) >= (widgetAction->width() * 0.75))
{
- if(toolBar()->actions().count() > toolBar()->actions().indexOf(overAction) + 1)
+ if (toolBar()->actions().count() > toolBar()->actions().indexOf(overAction) + 1)
{
toolBar()->insertAction(toolBar()->actions().at(toolBar()->actions().indexOf(overAction) + 1), m_dropAction);
}
@@ -369,7 +369,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
toolBar()->addAction(m_dropAction);
}
}
- else if((dragEvent->pos().x() - widgetAction->pos().x()) <= (widgetAction->width() * 0.25))
+ else if ((dragEvent->pos().x() - widgetAction->pos().x()) <= (widgetAction->width() * 0.25))
{
toolBar()->insertAction(overAction, m_dropAction);
}
@@ -394,14 +394,14 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
KBookmark bookmark;
KBookmarkGroup root = rApp->bookmarkProvider()->bookmarkManager()->toolbar();
- if(dropEvent->mimeData()->hasFormat("application/rekonq-bookmark"))
+ if (dropEvent->mimeData()->hasFormat("application/rekonq-bookmark"))
{
QByteArray addresses = dropEvent->mimeData()->data("application/rekonq-bookmark");
bookmark = rApp->bookmarkProvider()->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data()));
- if(bookmark.isNull())
+ if (bookmark.isNull())
return false;
}
- else if(dropEvent->mimeData()->hasFormat("text/uri-list"))
+ else if (dropEvent->mimeData()->hasFormat("text/uri-list"))
{
// DROP is URL
QString url = dropEvent->mimeData()->urls().at(0).toString();
@@ -410,12 +410,12 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
: url;
bookmark = root.addBookmark(title, url);
}
- else if(dropEvent->mimeData()->hasFormat("text/plain"))
+ else if (dropEvent->mimeData()->hasFormat("text/plain"))
{
// DROP is TEXT
QString url = dropEvent->mimeData()->text();
KUrl u(url);
- if(u.isValid())
+ if (u.isValid())
{
QString title = url.contains(rApp->mainWindow()->currentTab()->url().url())
? rApp->mainWindow()->currentTab()->view()->title()
@@ -429,9 +429,9 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
}
QAction *destAction = toolBar()->actionAt(dropEvent->pos());
- if(destAction && destAction == m_dropAction)
+ if (destAction && destAction == m_dropAction)
{
- if(toolBar()->actions().indexOf(m_dropAction) > 0)
+ if (toolBar()->actions().indexOf(m_dropAction) > 0)
{
destAction = toolBar()->actions().at(toolBar()->actions().indexOf(m_dropAction) - 1);
}
@@ -441,19 +441,19 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
}
}
- if(destAction)
+ if (destAction)
{
KBookmarkActionInterface *destBookmarkAction = dynamic_cast<KBookmarkActionInterface *>(destAction);
QWidget *widgetAction = toolBar()->widgetForAction(destAction);
- if(destBookmarkAction && !destBookmarkAction->bookmark().isNull() && widgetAction
+ if (destBookmarkAction && !destBookmarkAction->bookmark().isNull() && widgetAction
&& bookmark.address() != destBookmarkAction->bookmark().address())
{
KBookmark destBookmark = destBookmarkAction->bookmark();
- if(!destBookmark.isGroup())
+ if (!destBookmark.isGroup())
{
- if((dropEvent->pos().x() - widgetAction->pos().x()) >= (widgetAction->width() / 2))
+ if ((dropEvent->pos().x() - widgetAction->pos().x()) >= (widgetAction->width() / 2))
{
root.moveBookmark(bookmark, destBookmark);
}
@@ -464,11 +464,11 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
}
else
{
- if((dropEvent->pos().x() - widgetAction->pos().x()) >= (widgetAction->width() * 0.75))
+ if ((dropEvent->pos().x() - widgetAction->pos().x()) >= (widgetAction->width() * 0.75))
{
root.moveBookmark(bookmark, destBookmark);
}
- else if((dropEvent->pos().x() - widgetAction->pos().x()) <= (widgetAction->width() * 0.25))
+ else if ((dropEvent->pos().x() - widgetAction->pos().x()) <= (widgetAction->width() * 0.25))
{
root.moveBookmark(bookmark, destBookmark.parentGroup().previous(destBookmark));
}
@@ -486,7 +486,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
{
root.deleteBookmark(bookmark);
bookmark = root.addBookmark(bookmark);
- if(dropEvent->pos().x() < toolBar()->widgetForAction(toolBar()->actions().first())->pos().x())
+ if (dropEvent->pos().x() < toolBar()->widgetForAction(toolBar()->actions().first())->pos().x())
{
root.moveBookmark(bookmark, KBookmark());
}
@@ -502,22 +502,22 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
}
// These events need to be handled only for Bookmark actions and not the bar
- if(watched != toolBar())
+ if (watched != toolBar())
{
- switch(event->type())
+ switch (event->type())
{
case QEvent::MouseButtonPress: // drag handling
{
QPoint pos = toolBar()->mapFromGlobal(QCursor::pos());
KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface *>(toolBar()->actionAt(pos));
- if(action)
+ if (action)
{
m_dragAction = toolBar()->actionAt(pos);
m_startDragPos = pos;
// The menu is displayed only when the mouse button is released
- if(action->bookmark().isGroup())
+ if (action->bookmark().isGroup())
return true;
}
}
@@ -526,7 +526,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
case QEvent::MouseMove:
{
int distance = (toolBar()->mapFromGlobal(QCursor::pos()) - m_startDragPos).manhattanLength();
- if(!m_currentMenu && distance >= QApplication::startDragDistance())
+ if (!m_currentMenu && distance >= QApplication::startDragDistance())
{
startDrag();
}
@@ -538,7 +538,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
int distance = (toolBar()->mapFromGlobal(QCursor::pos()) - m_startDragPos).manhattanLength();
KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface *>(toolBar()->actionAt(m_startDragPos));
- if(action && action->bookmark().isGroup() && distance < QApplication::startDragDistance())
+ if (action && action->bookmark().isGroup() && distance < QApplication::startDragDistance())
{
KBookmarkActionMenu *menu = dynamic_cast<KBookmarkActionMenu *>(toolBar()->actionAt(m_startDragPos));
QPoint actionPos = toolBar()->mapToGlobal(toolBar()->widgetForAction(menu)->pos());
@@ -559,7 +559,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
void BookmarkToolBar::actionHovered()
{
KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(sender());
- if(action)
+ if (action)
rApp->mainWindow()->notifyMessage(action->bookmark().url().url());
}
@@ -567,7 +567,7 @@ void BookmarkToolBar::actionHovered()
void BookmarkToolBar::startDrag()
{
KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface *>(m_dragAction);
- if(action)
+ if (action)
{
QMimeData *mimeData = new QMimeData;
KBookmark bookmark = action->bookmark();
@@ -579,7 +579,7 @@ void BookmarkToolBar::startDrag()
QDrag *drag = new QDrag(toolBar());
drag->setMimeData(mimeData);
- if(bookmark.isGroup())
+ if (bookmark.isGroup())
{
drag->setPixmap(KIcon(bookmark.icon()).pixmap(24, 24));
}
@@ -597,7 +597,7 @@ void BookmarkToolBar::startDrag()
void BookmarkToolBar::dragDestroyed()
{
// A workaround to get rid of the checked state of the dragged action
- if(m_dragAction)
+ if (m_dragAction)
{
m_dragAction->setVisible(false);
m_dragAction->setVisible(true);
diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp
index f29e866f..42cd7b28 100644
--- a/src/bookmarks/bookmarkstreemodel.cpp
+++ b/src/bookmarks/bookmarkstreemodel.cpp
@@ -58,45 +58,45 @@ BtmItem::~BtmItem()
QVariant BtmItem::data(int role) const
{
- if(m_kbm.isNull())
+ if (m_kbm.isNull())
return QVariant(); // should only happen for root item
- if(role == Qt::DisplayRole)
+ if (role == Qt::DisplayRole)
return m_kbm.text();
- if(role == Qt::DecorationRole)
+ if (role == Qt::DecorationRole)
{
// NOTE
// this should be:
// return KIcon(m_kbm.icon());
// but I cannot let it work :(
// I really cannot understand how let this work properly...
- if(m_kbm.isGroup() || m_kbm.isSeparator())
+ if (m_kbm.isGroup() || m_kbm.isSeparator())
return KIcon(m_kbm.icon());
else
return rApp->iconManager()->iconForUrl(KUrl(m_kbm.url()));
}
- if(role == Qt::UserRole)
+ if (role == Qt::UserRole)
return m_kbm.url();
- if(role == Qt::ToolTipRole)
+ if (role == Qt::ToolTipRole)
{
QString tooltip = m_kbm.fullText();
- if(m_kbm.isGroup())
+ if (m_kbm.isGroup())
tooltip += i18ncp("%1=Number of items in bookmark folder", " (1 item)", " (%1 items)", childCount());
QString url = m_kbm.url().url();
- if(!url.isEmpty())
+ if (!url.isEmpty())
{
- if(!tooltip.isEmpty())
+ if (!tooltip.isEmpty())
tooltip += '\n';
tooltip += url;
}
- if(!m_kbm.description().isEmpty())
+ if (!m_kbm.description().isEmpty())
{
- if(!tooltip.isEmpty())
+ if (!tooltip.isEmpty())
tooltip += '\n';
tooltip += m_kbm.description();
}
@@ -110,7 +110,7 @@ QVariant BtmItem::data(int role) const
int BtmItem::row() const
{
- if(m_parent)
+ if (m_parent)
return m_parent->m_children.indexOf(const_cast< BtmItem* >(this));
return 0;
}
@@ -139,7 +139,7 @@ BtmItem* BtmItem::parent() const
void BtmItem::appendChild(BtmItem *child)
{
- if(!child)
+ if (!child)
return;
child->m_parent = this;
@@ -180,7 +180,7 @@ BookmarksTreeModel::~BookmarksTreeModel()
int BookmarksTreeModel::rowCount(const QModelIndex &parent) const
{
BtmItem *parentItem = 0;
- if(!parent.isValid())
+ if (!parent.isValid())
{
parentItem = m_root;
}
@@ -203,12 +203,12 @@ Qt::ItemFlags BookmarksTreeModel::flags(const QModelIndex &index) const
{
Qt::ItemFlags flags = QAbstractItemModel::flags(index);
- if(!index.isValid())
+ if (!index.isValid())
return flags | Qt::ItemIsDropEnabled;
flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
- if(bookmarkForIndex(index).isGroup())
+ if (bookmarkForIndex(index).isGroup())
flags |= Qt::ItemIsDropEnabled;
return flags;
@@ -217,18 +217,18 @@ Qt::ItemFlags BookmarksTreeModel::flags(const QModelIndex &index) const
QModelIndex BookmarksTreeModel::index(int row, int column, const QModelIndex &parent) const
{
- if(!hasIndex(row, column, parent))
+ if (!hasIndex(row, column, parent))
return QModelIndex();
BtmItem *parentItem;
- if(!parent.isValid())
+ if (!parent.isValid())
parentItem = m_root;
else
parentItem = static_cast<BtmItem*>(parent.internalPointer());
BtmItem *childItem = parentItem->child(row);
- if(childItem)
+ if (childItem)
return createIndex(row, column, childItem);
return QModelIndex();
@@ -237,13 +237,13 @@ QModelIndex BookmarksTreeModel::index(int row, int column, const QModelIndex &pa
QModelIndex BookmarksTreeModel::parent(const QModelIndex &index) const
{
- if(!index.isValid())
+ if (!index.isValid())
return QModelIndex();
BtmItem *childItem = static_cast<BtmItem*>(index.internalPointer());
BtmItem *parentItem = childItem->parent();
- if(parentItem == m_root)
+ if (parentItem == m_root)
return QModelIndex();
return createIndex(parentItem->row(), 0, parentItem);
@@ -252,20 +252,20 @@ QModelIndex BookmarksTreeModel::parent(const QModelIndex &index) const
QVariant BookmarksTreeModel::data(const QModelIndex &index, int role) const
{
- if(!index.isValid())
+ if (!index.isValid())
return QVariant();
BtmItem *node = static_cast<BtmItem*>(index.internalPointer());
- if(node && node == m_root)
+ if (node && node == m_root)
{
- if(role == Qt::DisplayRole)
+ if (role == Qt::DisplayRole)
return i18n("Bookmarks");
- if(role == Qt::DecorationRole)
+ if (role == Qt::DecorationRole)
return KIcon("bookmarks");
}
else
{
- if(node)
+ if (node)
return node->data(role);
}
@@ -281,21 +281,21 @@ QStringList BookmarksTreeModel::mimeTypes() const
bool BookmarksTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
- if(action != Qt::MoveAction || !data->hasFormat("application/rekonq-bookmark"))
+ if (action != Qt::MoveAction || !data->hasFormat("application/rekonq-bookmark"))
return false;
QByteArray addresses = data->data("application/rekonq-bookmark");
KBookmark bookmark = rApp->bookmarkProvider()->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data()));
KBookmarkGroup root;
- if(parent.isValid())
+ if (parent.isValid())
root = bookmarkForIndex(parent).toGroup();
else
root = rApp->bookmarkProvider()->rootGroup();
QModelIndex destIndex = index(row, column, parent);
- if(destIndex.isValid() && row != -1)
+ if (destIndex.isValid() && row != -1)
{
root.moveBookmark(bookmark, root.previous(bookmarkForIndex(destIndex)));
}
@@ -331,7 +331,7 @@ QMimeData* BookmarksTreeModel::mimeData(const QModelIndexList &indexes) const
void BookmarksTreeModel::bookmarksChanged(const QString &groupAddress)
{
- if(groupAddress.isEmpty())
+ if (groupAddress.isEmpty())
{
resetModel();
}
@@ -347,10 +347,10 @@ void BookmarksTreeModel::bookmarksChanged(const QString &groupAddress)
foreach(const QString & sIndex, indexChain)
{
i = sIndex.toInt(&ok);
- if(!ok)
+ if (!ok)
break;
- if(i < 0 || i >= node->childCount())
+ if (i < 0 || i >= node->childCount())
break;
node = node->child(i);
@@ -384,14 +384,14 @@ void BookmarksTreeModel::populate(BtmItem *node, KBookmarkGroup bmg)
{
node->clear();
- if(bmg.isNull())
+ if (bmg.isNull())
return;
KBookmark bm = bmg.first();
- while(!bm.isNull())
+ while (!bm.isNull())
{
BtmItem *newChild = new BtmItem(bm);
- if(bm.isGroup())
+ if (bm.isGroup())
populate(newChild, bm.toGroup());
node->appendChild(newChild);