summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/bookmarkowner.cpp212
-rw-r--r--src/bookmarks/bookmarkowner.h57
-rw-r--r--src/bookmarks/bookmarkscontextmenu.cpp44
-rw-r--r--src/bookmarks/bookmarkstoolbar.cpp7
-rw-r--r--src/paneltreeview.cpp22
-rw-r--r--src/paneltreeview.h5
6 files changed, 173 insertions, 174 deletions
diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp
index e1b9a567..77af9b1f 100644
--- a/src/bookmarks/bookmarkowner.cpp
+++ b/src/bookmarks/bookmarkowner.cpp
@@ -53,15 +53,47 @@ BookmarkOwner::BookmarkOwner(KBookmarkManager *manager, QObject *parent)
: QObject(parent)
, KBookmarkOwner()
, m_manager(manager)
- , m_actions(QVector<KAction*>(NUM_ACTIONS))
{
- setupActions();
}
-KAction* BookmarkOwner::action(const BookmarkAction &bmAction)
+KAction* BookmarkOwner::action(const KBookmark &bookmark, const BookmarkAction &bmAction)
{
- return static_cast<KAction*>(m_actions.at(bmAction));
+ switch (bmAction)
+ {
+ case OPEN:
+ return createAction(i18n("Open"), "tab-new",
+ i18n("Open bookmark in current tab"), SLOT(openBookmark(const KBookmark &)), bookmark);
+ case OPEN_IN_TAB:
+ return createAction(i18n("Open in New Tab"), "tab-new",
+ i18n("Open bookmark in new tab"), SLOT(openBookmarkInNewTab(const KBookmark &)), bookmark);
+ case OPEN_IN_WINDOW:
+ return createAction(i18n("Open in New Window"), "window-new",
+ i18n("Open bookmark in new window"), SLOT(openBookmarkInNewWindow(const KBookmark &)), bookmark);
+ case OPEN_FOLDER:
+ return createAction(i18n("Open Folder in Tabs"), "tab-new",
+ i18n("Open all the bookmarks in folder in tabs"), SLOT(openBookmarkFolder(const KBookmark &)), bookmark);
+ case BOOKMARK_PAGE:
+ return createAction(i18n("Add Bookmark"), "bookmark-new",
+ i18n("Bookmark current page"), SLOT(bookmarkCurrentPage(const KBookmark &)), bookmark);
+ case NEW_FOLDER:
+ return createAction(i18n("New Folder"), "folder-new",
+ i18n("Create a new bookmark folder"), SLOT(newBookmarkFolder(const KBookmark &)), bookmark);
+ case NEW_SEPARATOR:
+ return createAction(i18n("New Separator"), "edit-clear",
+ i18n("Create a new bookmark separator"), SLOT(newSeparator(const KBookmark &)), bookmark);
+ case COPY:
+ return createAction(i18n("Copy Link"), "edit-copy",
+ i18n("Copy the bookmark's link address"), SLOT(copyLink(const KBookmark &)), bookmark);
+ case EDIT:
+ return createAction(i18n("Edit"), "configure",
+ i18n("Edit the bookmark"), SLOT(editBookmark(const KBookmark &)), bookmark);
+ case DELETE:
+ return createAction(i18n("Delete"), "edit-delete",
+ i18n("Delete the bookmark"), SLOT(deleteBookmark(const KBookmark &)), bookmark);
+ default:
+ return 0;
+ }
}
@@ -118,85 +150,66 @@ void BookmarkOwner::openBookmark(const KBookmark &bookmark,
void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bookmark)
{
- openBookmarkFolder(bookmark);
-}
+ QList<KUrl> urlList = bookmark.groupUrlList();
+ if (urlList.length() > 8)
+ {
+ if (KMessageBox::warningContinueCancel(
+ Application::instance()->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;
+ }
-void BookmarkOwner::setCurrentBookmark(const KBookmark &bookmark)
-{
- m_currentBookmark = bookmark;
+ Q_FOREACH(const KUrl &url, urlList)
+ {
+ emit openUrl(url, Rekonq::NewFocusedTab);
+ }
}
-void BookmarkOwner::unsetCurrentBookmark()
+void BookmarkOwner::openBookmarkFolder(const KBookmark &bookmark)
{
- m_currentBookmark = KBookmark();
+ if (bookmark.isGroup())
+ openFolderinTabs(bookmark.toGroup());
}
void BookmarkOwner::openBookmark(const KBookmark &bookmark)
{
- KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
- emit openUrl(selected.url(), Rekonq::CurrentTab);
+ emit openUrl(bookmark.url(), Rekonq::CurrentTab);
}
void BookmarkOwner::openBookmarkInNewTab(const KBookmark &bookmark)
{
- KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
- emit openUrl(selected.url(), Rekonq::NewTab);
+ emit openUrl(bookmark.url(), Rekonq::NewTab);
}
void BookmarkOwner::openBookmarkInNewWindow(const KBookmark &bookmark)
{
- KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
- emit openUrl(selected.url(), Rekonq::NewWindow);
-}
-
-
-void BookmarkOwner::openBookmarkFolder(const KBookmark &bookmark)
-{
- KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
- if (!selected.isGroup())
- return;
-
- QList<KUrl> urlList = selected.toGroup().groupUrlList();
-
- if (urlList.length() > 8)
- {
- if (KMessageBox::warningContinueCancel(
- Application::instance()->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;
- }
-
- Q_FOREACH(const KUrl &url, urlList)
- {
- emit openUrl(url, Rekonq::NewFocusedTab);
- }
+ emit openUrl(bookmark.url(), Rekonq::NewWindow);
}
KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark)
{
- KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
KBookmark newBk;
KBookmarkGroup parent;
- if (!selected.isNull())
+ if (!bookmark.isNull())
{
- if (selected.isGroup())
- parent = selected.toGroup();
+ if (bookmark.isGroup())
+ parent = bookmark.toGroup();
else
- parent = selected.parentGroup();
+ parent = bookmark.parentGroup();
newBk = parent.addBookmark(currentTitle().replace('&', "&&"), KUrl(currentUrl()) );
- parent.moveBookmark(newBk, selected);
+ parent.moveBookmark(newBk, bookmark);
}
else
{
@@ -211,24 +224,23 @@ KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark)
KBookmarkGroup BookmarkOwner::newBookmarkFolder(const KBookmark &bookmark)
{
- KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
KBookmarkGroup newBk;
KBookmarkDialog *dialog = bookmarkDialog(m_manager, QApplication::activeWindow());
QString folderName = i18n("New folder");
- if (!selected.isNull())
+ if (!bookmark.isNull())
{
- if (selected.isGroup())
+ if (bookmark.isGroup())
{
- newBk = dialog->createNewFolder(folderName, selected);
+ newBk = dialog->createNewFolder(folderName, bookmark);
}
else
{
- newBk = dialog->createNewFolder(folderName, selected.parentGroup());
+ newBk = dialog->createNewFolder(folderName, bookmark.parentGroup());
if (!newBk.isNull())
{
KBookmarkGroup parent = newBk.parentGroup();
- parent.moveBookmark(newBk, selected);
+ parent.moveBookmark(newBk, bookmark);
m_manager->emitChanged(parent);
}
}
@@ -245,19 +257,18 @@ KBookmarkGroup BookmarkOwner::newBookmarkFolder(const KBookmark &bookmark)
KBookmark BookmarkOwner::newSeparator(const KBookmark &bookmark)
{
- KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
KBookmark newBk;
- if (!selected.isNull())
+ if (!bookmark.isNull())
{
- if (selected.isGroup())
+ if (bookmark.isGroup())
{
- newBk = selected.toGroup().createNewSeparator();
+ newBk = bookmark.toGroup().createNewSeparator();
}
else
{
- newBk = selected.parentGroup().createNewSeparator();
- newBk.parentGroup().moveBookmark(newBk, selected);
+ newBk = bookmark.parentGroup().createNewSeparator();
+ newBk.parentGroup().moveBookmark(newBk, bookmark);
}
}
else
@@ -274,25 +285,23 @@ KBookmark BookmarkOwner::newSeparator(const KBookmark &bookmark)
void BookmarkOwner::copyLink(const KBookmark &bookmark)
{
- KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
- if (selected.isNull())
+ if (bookmark.isNull())
return;
- QApplication::clipboard()->setText(selected.url().url());
+ QApplication::clipboard()->setText(bookmark.url().url());
}
void BookmarkOwner::editBookmark(KBookmark bookmark)
{
- KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
- if (selected.isNull())
+ if (bookmark.isNull())
return;
- selected.setFullText(selected.fullText().replace("&&", "&"));
+ bookmark.setFullText(bookmark.fullText().replace("&&", "&"));
KBookmarkDialog *dialog = bookmarkDialog(m_manager, QApplication::activeWindow());
- dialog->editBookmark(selected);
- selected.setFullText(selected.fullText().replace('&', "&&"));
+ dialog->editBookmark(bookmark);
+ bookmark.setFullText(bookmark.fullText().replace('&', "&&"));
delete dialog;
}
@@ -300,20 +309,19 @@ void BookmarkOwner::editBookmark(KBookmark bookmark)
bool BookmarkOwner::deleteBookmark(KBookmark bookmark)
{
- KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
- if (selected.isNull())
+ if (bookmark.isNull())
return false;
- KBookmarkGroup bmg = selected.parentGroup();
- QString name = QString(selected.fullText()).replace("&&", "&");
+ KBookmarkGroup bmg = bookmark.parentGroup();
+ QString name = QString(bookmark.fullText()).replace("&&", "&");
QString dialogCaption, dialogText;
- if (selected.isGroup())
+ if (bookmark.isGroup())
{
dialogCaption = i18n("Bookmark Folder Deletion");
dialogText = i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", name);
}
- else if (selected.isSeparator())
+ else if (bookmark.isSeparator())
{
dialogCaption = i18n("Separator Deletion");
dialogText = i18n("Are you sure you wish to remove this separator?");
@@ -335,42 +343,38 @@ bool BookmarkOwner::deleteBookmark(KBookmark bookmark)
)
return false;
- bmg.deleteBookmark(selected);
+ bmg.deleteBookmark(bookmark);
m_manager->emitChanged(bmg);
return true;
}
-void BookmarkOwner::setupActions()
+KAction* BookmarkOwner::createAction(const QString &text,
+ const QString &icon, const QString &help, const char *slot,
+ const KBookmark & bookmark)
{
- createAction(OPEN, i18n("Open"), "tab-new",
- i18n("Open bookmark in current tab"), SLOT(openBookmark()));
- createAction(OPEN_IN_TAB, i18n("Open in New Tab"), "tab-new",
- i18n("Open bookmark in new tab"), SLOT(openBookmarkInNewTab()));
- createAction(OPEN_IN_WINDOW, i18n("Open in New Window"), "window-new",
- i18n("Open bookmark in new window"), SLOT(openBookmarkInNewWindow()));
- createAction(OPEN_FOLDER, i18n("Open Folder in Tabs"), "tab-new",
- i18n("Open all the bookmarks in folder in tabs"), SLOT(openBookmarkFolder()));
- createAction(BOOKMARK_PAGE, i18n("Add Bookmark"), "bookmark-new",
- i18n("Bookmark current page"), SLOT(bookmarkCurrentPage()));
- createAction(NEW_FOLDER, i18n("New Folder"), "folder-new",
- i18n("Create a new bookmark folder"), SLOT(newBookmarkFolder()));
- createAction(NEW_SEPARATOR, i18n("New Separator"), "edit-clear",
- i18n("Create a new bookmark separator"), SLOT(newSeparator()));
- createAction(COPY, i18n("Copy Link"), "edit-copy",
- i18n("Copy the bookmark's link address"), SLOT(copyLink()));
- createAction(EDIT, i18n("Edit"), "configure",
- i18n("Edit the bookmark"), SLOT(editBookmark()));
- createAction(DELETE, i18n("Delete"), "edit-delete",
- i18n("Delete the bookmark"), SLOT(deleteBookmark()));
+ CustomBookmarkAction *act = new CustomBookmarkAction(bookmark, KIcon(icon), text, this);
+ act->setHelpText(help);
+ connect(act, SIGNAL(triggered(const KBookmark &)), this, slot);
+ return act;
}
-void BookmarkOwner::createAction(const BookmarkAction &action, const QString &text,
- const QString &icon, const QString &help, const char *slot)
+// -------------------------------------------------------------------------------------------------
+
+
+CustomBookmarkAction::CustomBookmarkAction(const KBookmark &bookmark, const KIcon &icon, const QString &text, QObject *parent)
+ : KAction(icon, text, parent)
+ , m_bookmark(bookmark)
{
- KAction *act = new KAction(KIcon(icon), text, this);
- act->setHelpText(help);
- m_actions[action] = act;
- connect(act, SIGNAL(triggered()), this, slot);
+ connect(this, SIGNAL(triggered()), this, SLOT(onActionTriggered()));
+}
+
+CustomBookmarkAction::~CustomBookmarkAction()
+{
+}
+
+void CustomBookmarkAction::onActionTriggered()
+{
+ emit triggered(m_bookmark);
}
diff --git a/src/bookmarks/bookmarkowner.h b/src/bookmarks/bookmarkowner.h
index febff3b0..573e4ee0 100644
--- a/src/bookmarks/bookmarkowner.h
+++ b/src/bookmarks/bookmarkowner.h
@@ -36,9 +36,8 @@
// KDE Includes
#include <KBookmarkOwner>
-
-// Forward Declarations
-class KAction;
+#include <KIcon>
+#include <KAction>
/**
@@ -69,9 +68,9 @@ public:
};
/**
- * @return the action or 0 if it doesn't exist.
+ * @return the action connected to the bookmark or 0 if it doesn't exist.
*/
- KAction* action(const BookmarkAction &bmAction);
+ KAction* action(const KBookmark &bookmark, const BookmarkAction &bmAction);
/**
* @return the current page's title.
@@ -113,19 +112,16 @@ public:
virtual void openFolderinTabs(const KBookmarkGroup &bookmark);
public Q_SLOTS:
- void setCurrentBookmark(const KBookmark &bookmark);
- void unsetCurrentBookmark();
-
- void openBookmark(const KBookmark &bookmark = KBookmark());
- void openBookmarkInNewTab(const KBookmark &bookmark = KBookmark());
- void openBookmarkInNewWindow(const KBookmark &bookmark = KBookmark());
- void openBookmarkFolder(const KBookmark &bookmark = KBookmark());
+ void openBookmark(const KBookmark &bookmark);
+ void openBookmarkInNewTab(const KBookmark &bookmark);
+ void openBookmarkInNewWindow(const KBookmark &bookmark);
+ void openBookmarkFolder(const KBookmark &bookmark);
KBookmark bookmarkCurrentPage(const KBookmark &bookmark = KBookmark());
KBookmarkGroup newBookmarkFolder(const KBookmark &bookmark = KBookmark());
KBookmark newSeparator(const KBookmark &bookmark = KBookmark());
- void copyLink(const KBookmark &bookmark = KBookmark());
- void editBookmark(KBookmark bookmark = KBookmark());
- bool deleteBookmark(KBookmark bookmark = KBookmark());
+ void copyLink(const KBookmark &bookmark);
+ void editBookmark(KBookmark bookmark);
+ bool deleteBookmark(KBookmark bookmark);
Q_SIGNALS:
/**
@@ -135,15 +131,34 @@ Q_SIGNALS:
void openUrl(const KUrl &, const Rekonq::OpenType &);
private:
- void setupActions();
- void createAction(const BookmarkAction &action,
- const QString &text, const QString &icon,
- const QString &help, const char *slot);
+ KAction* createAction(const QString &text, const QString &icon,
+ const QString &help, const char *slot,
+ const KBookmark &bookmark);
KBookmarkManager *m_manager;
- QVector<KAction*> m_actions;
- KBookmark m_currentBookmark;
+};
+
+
+// -----------------------------------------------------------------------------------------------
+
+
+class CustomBookmarkAction : public KAction
+{
+ Q_OBJECT
+
+public:
+ CustomBookmarkAction(const KBookmark &bookmark, const KIcon &icon, const QString &text, QObject *parent);
+ ~CustomBookmarkAction();
+
+Q_SIGNALS:
+ void triggered(const KBookmark &);
+
+private Q_SLOTS:
+ void onActionTriggered();
+
+private:
+ KBookmark m_bookmark;
};
#endif // BOOKMARKOWNER_H
diff --git a/src/bookmarks/bookmarkscontextmenu.cpp b/src/bookmarks/bookmarkscontextmenu.cpp
index 8f1a570c..93df6ce3 100644
--- a/src/bookmarks/bookmarkscontextmenu.cpp
+++ b/src/bookmarks/bookmarkscontextmenu.cpp
@@ -35,35 +35,33 @@ BookmarksContextMenu::BookmarksContextMenu(const KBookmark &bookmark, KBookmarkM
: KBookmarkContextMenu(bookmark, manager, owner, parent)
, m_bmOwner(owner)
{
- m_bmOwner->setCurrentBookmark(bookmark);
}
BookmarksContextMenu::~BookmarksContextMenu()
{
- m_bmOwner->unsetCurrentBookmark();
}
void BookmarksContextMenu::addBookmarkActions()
{
- addAction(m_bmOwner->action(BookmarkOwner::OPEN_IN_TAB));
- addAction(m_bmOwner->action(BookmarkOwner::OPEN_IN_WINDOW));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::OPEN_IN_TAB));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::OPEN_IN_WINDOW));
addSeparator();
- addAction(m_bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
- addAction(m_bmOwner->action(BookmarkOwner::NEW_FOLDER));
- addAction(m_bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::BOOKMARK_PAGE));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_FOLDER));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_SEPARATOR));
addSeparator();
- addAction(m_bmOwner->action(BookmarkOwner::COPY));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::COPY));
addSeparator();
- addAction(m_bmOwner->action(BookmarkOwner::EDIT));
- addAction(m_bmOwner->action(BookmarkOwner::DELETE));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::EDIT));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::DELETE));
}
@@ -82,39 +80,39 @@ void BookmarksContextMenu::addFolderActions()
if (!child.isNull())
{
- addAction(m_bmOwner->action(BookmarkOwner::OPEN_FOLDER));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::OPEN_FOLDER));
addSeparator();
}
}
- addAction(m_bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
- addAction(m_bmOwner->action(BookmarkOwner::NEW_FOLDER));
- addAction(m_bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::BOOKMARK_PAGE));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_FOLDER));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_SEPARATOR));
addSeparator();
- addAction(m_bmOwner->action(BookmarkOwner::EDIT));
- addAction(m_bmOwner->action(BookmarkOwner::DELETE));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::EDIT));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::DELETE));
}
void BookmarksContextMenu::addSeparatorActions()
{
- addAction(m_bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
- addAction(m_bmOwner->action(BookmarkOwner::NEW_FOLDER));
- addAction(m_bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::BOOKMARK_PAGE));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_FOLDER));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_SEPARATOR));
addSeparator();
- addAction(m_bmOwner->action(BookmarkOwner::DELETE));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::DELETE));
}
void BookmarksContextMenu::addNullActions()
{
- addAction(m_bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
- addAction(m_bmOwner->action(BookmarkOwner::NEW_FOLDER));
- addAction(m_bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::BOOKMARK_PAGE));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_FOLDER));
+ addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_SEPARATOR));
}
diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp
index 60b59a3f..74f400d1 100644
--- a/src/bookmarks/bookmarkstoolbar.cpp
+++ b/src/bookmarks/bookmarkstoolbar.cpp
@@ -125,8 +125,6 @@ void BookmarkMenu::refill()
void BookmarkMenu::addOpenFolderInTabs()
{
- // TODO: Needs to be ported to the new BookmarkOwner API
- KAction *action;
KBookmarkGroup group = manager()->findByAddress(parentAddress()).toGroup();
if (!group.first().isNull())
@@ -140,10 +138,7 @@ void BookmarkMenu::addOpenFolderInTabs()
if (!bookmark.isNull())
{
- action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this);
- action->setHelpText(i18n("Open all bookmarks in this folder as new tabs."));
- connect(action, SIGNAL(triggered(bool)), this, SLOT(slotOpenFolderInTabs()));
- parentMenu()->addAction(action);
+ parentMenu()->addAction(Application::bookmarkProvider()->bookmarkOwner()->action(group, BookmarkOwner::OPEN_FOLDER));
}
}
}
diff --git a/src/paneltreeview.cpp b/src/paneltreeview.cpp
index 8e4add2d..e44fa5fe 100644
--- a/src/paneltreeview.cpp
+++ b/src/paneltreeview.cpp
@@ -100,12 +100,12 @@ void PanelTreeView::mouseReleaseEvent(QMouseEvent *event)
return;
if (event->button() == Qt::MidButton || event->modifiers() == Qt::ControlModifier)
- validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::NewTab);
+ emit openUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::NewTab);
else if (event->button() == Qt::LeftButton)
{
if (model()->rowCount(index) == 0)
- validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)));
+ emit openUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)));
else
setExpanded(index, !isExpanded(index));
}
@@ -123,7 +123,7 @@ void PanelTreeView::keyPressEvent(QKeyEvent *event)
if (event->key() == Qt::Key_Return)
{
if (model()->rowCount(index) == 0)
- validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)));
+ openUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)));
else
setExpanded(index, !isExpanded(index));
}
@@ -135,16 +135,6 @@ void PanelTreeView::keyPressEvent(QKeyEvent *event)
}
-void PanelTreeView::validOpenUrl(const KUrl &url, Rekonq::OpenType openType)
-{
- // To workaround a crash when the url is about:blank
- if (url.url() == "about:blank")
- emit openUrl(KUrl("about:home"), openType);
- else
- emit openUrl(url, openType);
-}
-
-
void PanelTreeView::mouseMoveEvent(QMouseEvent *event)
{
QTreeView::mouseMoveEvent(event);
@@ -164,7 +154,7 @@ void PanelTreeView::openInCurrentTab()
if (!index.isValid())
return;
- validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)));
+ emit openUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)));
}
@@ -185,7 +175,7 @@ void PanelTreeView::openInNewTab()
if (!index.isValid())
return;
- validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::NewTab);
+ emit openUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::NewTab);
}
@@ -195,5 +185,5 @@ void PanelTreeView::openInNewWindow()
if (!index.isValid())
return;
- validOpenUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::NewWindow);
+ emit openUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::NewWindow);
}
diff --git a/src/paneltreeview.h b/src/paneltreeview.h
index 2385978e..79d4bdfd 100644
--- a/src/paneltreeview.h
+++ b/src/paneltreeview.h
@@ -46,7 +46,7 @@ public:
~PanelTreeView();
signals:
- void openUrl(const KUrl &, const Rekonq::OpenType &);
+ void openUrl(const KUrl &, const Rekonq::OpenType & = Rekonq::CurrentTab);
void itemHovered(const QString &);
void delKeyPressed();
void contextMenuItemRequested(const QPoint &pos);
@@ -64,9 +64,6 @@ protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void keyPressEvent(QKeyEvent *event);
-
-private:
- void validOpenUrl(const KUrl &url, Rekonq::OpenType openType = Rekonq::CurrentTab);
};
#endif // PANELTREEVIEW_H