summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-08-30 02:11:18 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-08-30 02:11:18 +0200
commit5447e970c3f2074836344c7ac03429efb930ae8a (patch)
treef829bd7cc6553e4ff2c5bb2f2ed45a94822ccd1c /src
parentFirst changes to bookmarks system (diff)
downloadrekonq-5447e970c3f2074836344c7ac03429efb930ae8a.tar.xz
Bookmark Bar fixes
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks.cpp27
-rw-r--r--src/bookmarks.h8
-rw-r--r--src/mainwindow.cpp29
3 files changed, 27 insertions, 37 deletions
diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp
index fae94b35..65c5846f 100644
--- a/src/bookmarks.cpp
+++ b/src/bookmarks.cpp
@@ -152,10 +152,9 @@ void BookmarkMenu::slotAddBookmark()
BookmarkProvider::BookmarkProvider(QWidget *parent)
: QObject(parent)
- , m_parent(parent)
, m_manager(KBookmarkManager::userBookmarksManager())
, m_owner(0)
- , m_menu(new KMenu(m_parent))
+ , m_menu(new KMenu(parent))
, m_actionCollection(new KActionCollection(this))
, m_bookmarkMenu(0)
, m_bookmarkToolBar(0)
@@ -167,15 +166,11 @@ BookmarkProvider::BookmarkProvider(QWidget *parent)
m_owner = new BookmarkOwner(this);
connect(m_owner, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)), this, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)));
m_bookmarkMenu = new BookmarkMenu(m_manager, m_owner, m_menu, m_actionCollection);
-
- // setup toolbar
- setupToolBar();
}
BookmarkProvider::~BookmarkProvider()
{
- delete m_bookmarkToolBar;
delete m_bookmarkMenu;
delete m_actionCollection;
delete m_menu;
@@ -184,15 +179,9 @@ BookmarkProvider::~BookmarkProvider()
}
-void BookmarkProvider::setupToolBar()
+void BookmarkProvider::setupBookmarkBar(KToolBar *t)
{
- m_bookmarkToolBar = new KToolBar("bmToolBar", m_parent, Qt::TopToolBarArea);
- m_bookmarkToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
- m_bookmarkToolBar->setIconDimensions(16);
- m_bookmarkToolBar->setAcceptDrops(true);
- m_bookmarkToolBar->setContentsMargins(0, 0, 0, 0);
- m_bookmarkToolBar->setMinimumHeight(16);
- m_bookmarkToolBar->setContextMenuPolicy(Qt::CustomContextMenu);
+ m_bookmarkToolBar = t;
connect(m_bookmarkToolBar, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(contextMenu(const QPoint &)));
@@ -258,16 +247,6 @@ KActionMenu* BookmarkProvider::bookmarkActionMenu()
}
-KAction* BookmarkProvider::bookmarkToolBarAction()
-{
- KAction *bookmarkToolBarAction = new KAction(this);
- bookmarkToolBarAction->setDefaultWidget(m_bookmarkToolBar); // The ownership is transferred to action
- bookmarkToolBarAction->setText(i18n("Bookmarks Bar"));
- bookmarkToolBarAction->setShortcutConfigurable(false);
- return bookmarkToolBarAction;
-}
-
-
KAction *BookmarkProvider::fillBookmarkBar(const KBookmark &bookmark)
{
if (bookmark.isGroup())
diff --git a/src/bookmarks.h b/src/bookmarks.h
index 13562f06..9e901e11 100644
--- a/src/bookmarks.h
+++ b/src/bookmarks.h
@@ -188,10 +188,9 @@ public:
/**
- * @short Get the Bookmarks Toolbar Action
- * @return the Bookmarks Toolbar Action
+ * @short set the Bookmarks Toolbar Action
*/
- KAction *bookmarkToolBarAction();
+ void setupBookmarkBar(KToolBar *);
/**
@@ -231,9 +230,6 @@ public slots:
private:
KAction *fillBookmarkBar(const KBookmark &bookmark);
- void setupToolBar();
-
- QWidget *m_parent;
KBookmarkManager *m_manager;
BookmarkOwner *m_owner;
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 2a733c63..6d5c9c16 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -159,7 +159,8 @@ SidePanel *MainWindow::sidePanel()
void MainWindow::setupToolbar()
{
- KToolBar *mainToolBar = new KToolBar( QString("MainToolBar"), this, Qt::TopToolBarArea);
+ // ============ Main ToolBar ================================
+ KToolBar *mainToolBar = new KToolBar( i18n("Main ToolBar"), this, Qt::TopToolBarArea, true, false, false);
mainToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
mainToolBar->addAction( actionByName("history_back") );
mainToolBar->addAction( actionByName("history_forward") );
@@ -170,8 +171,26 @@ void MainWindow::setupToolbar()
mainToolBar->addAction( actionByName("bookmarksActionMenu") );
mainToolBar->addAction( actionByName("rekonq_tools") );
- KToolBar::setToolBarsEditable(false);
- KToolBar::setToolBarsLocked(true);
+ // =========== Bookmarks ToolBar ================================
+ KToolBar *bmToolBar= new KToolBar( i18n("Bookmarks ToolBar"), this, Qt::TopToolBarArea, true, false, true);
+ bmToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ bmToolBar->setIconDimensions(16);
+ bmToolBar->setAcceptDrops(true);
+ bmToolBar->setContentsMargins(0, 0, 0, 0);
+ bmToolBar->setMinimumHeight(16);
+ bmToolBar->setContextMenuPolicy(Qt::CustomContextMenu);
+
+ Application::bookmarkProvider()->setupBookmarkBar(bmToolBar);
+
+ // Bookmarks ToolBar Action
+ QAction *a = bmToolBar->toggleViewAction();
+ a->setIcon( KIcon("bookmark-toolbar") );
+ actionCollection()->addAction(QLatin1String("bm_bar"), a);
+
+// connect(a, SIGNAL(triggered(bool)), this, SLOT(showBookmarkToolBar(bool)));
+
+// KToolBar::setToolBarsEditable(false);
+// KToolBar::setToolBarsLocked(true);
}
@@ -232,10 +251,6 @@ void MainWindow::setupActions()
a->setDefaultWidget(m_view->urlBar());
actionCollection()->addAction(QLatin1String("url_bar"), a);
- // bookmarks bar
- KAction *bookmarkBarAction = Application::bookmarkProvider()->bookmarkToolBarAction();
- a = actionCollection()->addAction(QLatin1String("bookmarks_bar"), bookmarkBarAction);
-
// Standard Actions
KStandardAction::open(this, SLOT(slotFileOpen()), actionCollection());
KStandardAction::saveAs(this, SLOT(slotFileSaveAs()), actionCollection());