summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYoann Laissus <yoann.laissus@gmail.com>2010-04-14 11:58:50 +0200
committerYoann Laissus <yoann.laissus@gmail.com>2010-04-14 12:03:27 +0200
commita219ae2f7306d2d513eccf988ad9d2fd679c934c (patch)
tree53138b2e8ae3a4c72cd9ab801cff43aee537b501 /src
parentProper solutions are always the best ones :) (diff)
downloadrekonq-a219ae2f7306d2d513eccf988ad9d2fd679c934c.tar.xz
Don't create "Open Folder in Tabs" action when there are only folders or separators
Implement a missing method : currentBookmarkList() which now allow "Bookmarks Tabs as Folder BUG: 234234
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/bookmarksmanager.cpp34
-rw-r--r--src/bookmarks/bookmarksmanager.h2
2 files changed, 32 insertions, 4 deletions
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index d54abb3c..7e933599 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -35,6 +35,7 @@
#include "mainwindow.h"
#include "webtab.h"
#include "webview.h"
+#include "mainview.h"
#include "bookmarkcontextmenu.h"
// KDE Includes
@@ -53,7 +54,6 @@
#include <QtGui/QActionGroup>
-
BookmarkOwner::BookmarkOwner(QObject *parent)
: QObject(parent)
, KBookmarkOwner()
@@ -112,6 +112,22 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bm)
}
+QList< QPair<QString, QString> > BookmarkOwner::currentBookmarkList() const
+{
+ QList< QPair<QString, QString> > bkList;
+ int tabNumber = Application::instance()->mainWindow()->mainView()->count();
+
+ for(int i = 0; i < tabNumber; i++)
+ {
+ QPair<QString, QString> item;
+ item.first = Application::instance()->mainWindow()->mainView()->webTab(i)->view()->title();
+ item.second = Application::instance()->mainWindow()->mainView()->webTab(i)->url().url();
+ bkList += item;
+ }
+ return bkList;
+}
+
+
// ------------------------------------------------------------------------------------------------------
@@ -405,9 +421,19 @@ void BookmarkActionMenu::addFolderActions()
if(!m_group.first().isNull())
{
- action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this);
- connect(action, SIGNAL(triggered(bool)), this, SLOT(openActionInTabs()));
- addAction(action);
+ KBookmark bookmark = m_group.first();
+
+ while(bookmark.isGroup() || bookmark.isSeparator())
+ {
+ bookmark = m_group.next(bookmark);
+ }
+
+ if(!bookmark.isNull())
+ {
+ action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this);
+ connect(action, SIGNAL(triggered(bool)), this, SLOT(openActionInTabs()));
+ addAction(action);
+ }
}
action = new KAction(KIcon("bookmark-new"), i18n("Add Bookmark Here"), this);
diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h
index c8264633..7fb02970 100644
--- a/src/bookmarks/bookmarksmanager.h
+++ b/src/bookmarks/bookmarksmanager.h
@@ -115,6 +115,8 @@ public:
*/
virtual void openFolderinTabs(const KBookmarkGroup &bm);
+ virtual QList< QPair<QString, QString> > currentBookmarkList() const;
+
signals:
/**
* This signal is emitted when an url has to be loaded