diff options
author | Jon Ander Peñalba <jonan88@gmail.com> | 2010-08-17 22:32:35 +0200 |
---|---|---|
committer | Jon Ander Peñalba <jonan88@gmail.com> | 2010-08-19 12:53:52 +0200 |
commit | 63dac5edf257b0c5bdee44212769da132220c0a0 (patch) | |
tree | 43584d8a98d0f69fad2da476da2b70bda38fa45c /src/bookmarks/bookmarksmanager.cpp | |
parent | Minor improvements in the insertion and deletion of bookmarks code (diff) | |
download | rekonq-63dac5edf257b0c5bdee44212769da132220c0a0.tar.xz |
Create and store all bookmark actions in BookmarkOwner
Diffstat (limited to 'src/bookmarks/bookmarksmanager.cpp')
-rw-r--r-- | src/bookmarks/bookmarksmanager.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index c9a79fa8..c4fa68a1 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -57,7 +57,15 @@ BookmarkOwner::BookmarkOwner(QObject *parent) : QObject(parent) , KBookmarkOwner() + , actions(QVector<KAction*>(NUM_ACTIONS)) { + setupActions(); +} + + +KAction* BookmarkOwner::action(const BookmarkAction &bmAction) +{ + return static_cast<KAction*>(actions.at(bmAction)); } @@ -277,6 +285,41 @@ QList< QPair<QString, QString> > BookmarkOwner::currentBookmarkList() const } +void BookmarkOwner::setupActions() +{ + 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(openBookmarkGroup())); + 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(newBookmarkGroup())); + createAction(NEW_SEPARATOR, i18n("New Separator"), "edit-clear", + i18n("Create a new bookmark separatork"), 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())); +} + + +void BookmarkOwner::createAction(const BookmarkAction &action, const QString &text, + const QString &icon, const QString &help, const char *slot) +{ + KAction *act = new KAction(KIcon(icon), text, this); + act->setHelpText(help); + actions[action] = act; + connect(act, SIGNAL(triggered()), this, slot); +} + + // ------------------------------------------------------------------------------------------------------ |