summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-01-28 15:58:37 +0100
committerAndrea Diamantini <adjam7@gmail.com>2009-01-28 15:58:37 +0100
commitd467ccf90fb3e8c851db97c44f551aeaa9fa289f (patch)
tree3f5e572c43101d680d20abcd6ffaabb7a3248aa7 /src
parentupdated TODO (diff)
downloadrekonq-d467ccf90fb3e8c851db97c44f551aeaa9fa289f.tar.xz
New BookmarkBar!! 1st version, Yeah!!
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks.cpp47
-rw-r--r--src/bookmarks.h25
-rw-r--r--src/mainwindow.cpp14
-rw-r--r--src/mainwindow.h4
-rw-r--r--src/rekonqui.rc6
5 files changed, 56 insertions, 40 deletions
diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp
index a736e378..584b2689 100644
--- a/src/bookmarks.cpp
+++ b/src/bookmarks.cpp
@@ -26,6 +26,7 @@
// KDE Includes
#include <KMimeType>
+#include <KMenu>
OwnBookMarks::OwnBookMarks(KMainWindow *parent)
: QObject(parent)
@@ -55,28 +56,52 @@ QString OwnBookMarks::currentTitle() const
}
-//---------------------------------------------------------------------------------------------------------------------
+// ------------------------------------------------------------------------------------------------------
-BookmarksMenu::BookmarksMenu(KMainWindow *parent, KBookmarkManager *manager)
- : KMenu(parent)
- , m_owner( new OwnBookMarks(parent) )
+BookmarksProvider::BookmarksProvider(KMainWindow* parent)
+ : m_parent(parent)
+ , m_owner(new OwnBookMarks(parent))
{
+ KUrl bookfile = KUrl( "~/.kde/share/apps/konqueror/bookmarks.xml" ); // share konqueror bookmarks
+ m_manager = KBookmarkManager::managerForExternalFile( bookfile.path() );
m_ac = new KActionCollection( this );
- m_menu = new KBookmarkMenu( manager , m_owner, this, m_ac );
}
-//---------------------------------------------------------------------------------------------------------------------
-
-
-BookmarksLine::BookmarksLine(KBookmarkManager *manager, KToolBar *toolbar)
+void BookmarksProvider::provideBmToolbar(KToolBar* toolbar)
{
- KBookmarkGroup toolbarGroup = manager->toolbar();
+ toolbar->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
+ KBookmarkGroup toolbarGroup = m_manager->toolbar();
KBookmark bm = toolbarGroup.first();
while(!bm.isNull())
{
- // TODO append bm to toolbar
+ if(bm.isGroup())
+ {
+ // do nothing!
+ }
+ else
+ {
+ if(bm.isSeparator())
+ {
+ toolbar->addSeparator();
+ }
+ else
+ {
+ KAction *a = new KBookmarkAction(bm, m_owner, m_ac);
+ toolbar->addAction(a);
+ }
+ }
+ // go ahead!
bm = toolbarGroup.next(bm);
}
}
+
+
+KMenu *BookmarksProvider::bookmarksMenu()
+{
+ KMenu *bmMenu = new KMenu(m_parent);
+ new KBookmarkMenu( m_manager, m_owner, bmMenu, m_ac );
+ return bmMenu;
+}
+
diff --git a/src/bookmarks.h b/src/bookmarks.h
index 5aa384a1..2bdfab0a 100644
--- a/src/bookmarks.h
+++ b/src/bookmarks.h
@@ -26,6 +26,7 @@
#include <KBookmarkMenu>
#include <KUrl>
+#include <KMenu>
#include <KActionCollection>
#include <KMainWindow>
@@ -35,7 +36,7 @@ class OwnBookMarks : public QObject , public KBookmarkOwner
{
Q_OBJECT
public:
- OwnBookMarks(KMainWindow * );
+ OwnBookMarks(KMainWindow *);
virtual void openBookmark (const KBookmark & , Qt::MouseButtons , Qt::KeyboardModifiers );
@@ -52,29 +53,19 @@ private:
// ------------------------------------------------------------------------------
-class BookmarksMenu : public KMenu
+class BookmarksProvider : public QObject
{
Q_OBJECT
public:
- BookmarksMenu(KMainWindow*, KBookmarkManager *);
+ BookmarksProvider(KMainWindow*);
-private:
- OwnBookMarks *m_owner;
- KActionCollection *m_ac;
- KBookmarkMenu *m_menu;
-};
-
-// ------------------------------------------------------------------------------
-
-class BookmarksLine : public QObject
-{
-Q_OBJECT
-public:
- BookmarksLine(KBookmarkManager *, KToolBar *toolbar);
+ void provideBmToolbar(KToolBar*);
+ KMenu *bookmarksMenu();
private:
+ KMainWindow *m_parent;
OwnBookMarks *m_owner;
+ KBookmarkManager *m_manager;
KActionCollection *m_ac;
};
-
#endif
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index d956642b..87ae0ac0 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -50,6 +50,7 @@
#include <KActionCollection>
#include <KMessageBox>
#include <KFileDialog>
+#include <KMenu>
// Qt Includes
#include <QPlainTextEdit>
@@ -65,7 +66,7 @@
MainWindow::MainWindow()
: KXmlGuiWindow()
, m_view( new MainView(this) )
- , m_manager(0)
+ , m_bookmarksProvider( new BookmarksProvider(this) )
{
// accept dnd
setAcceptDrops(true);
@@ -111,14 +112,10 @@ MainWindow::MainWindow()
statusBar()->show();
// ----- BOOKMARKS MENU: this has to be done BEFORE setupGUI!!
- KUrl bookfile = KUrl( "~/.kde/share/apps/konqueror/bookmarks.xml" ); // share konqueror bookmarks
- m_manager = KBookmarkManager::managerForExternalFile( bookfile.path() );
-
KAction *a = new KActionMenu( i18n("B&ookmarks"), this );
actionCollection()->addAction( QLatin1String("bookmarks"), a );
- BookmarksMenu *bookmarksMenu = new BookmarksMenu( this, m_manager );
- a->setMenu( bookmarksMenu );
-
+ KMenu *bmMenu = m_bookmarksProvider->bookmarksMenu();
+ a->setMenu( bmMenu );
// a call to KXmlGuiWindow::setupGUI() populates the GUI
// with actions, using KXMLGUI.
@@ -137,6 +134,9 @@ MainWindow::MainWindow()
KToolBar *navigationBar = toolBar( "mainToolBar" );
navigationBar->addWidget( m_view->lineEditStack() );
+ KToolBar *bmToolbar = toolBar("bookmarksToolBar");
+ m_bookmarksProvider->provideBmToolbar( bmToolbar );
+
m_searchBar = new SearchBar( this );
connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&)));
navigationBar->addWidget(m_searchBar);
diff --git a/src/mainwindow.h b/src/mainwindow.h
index d1eba1a4..2ec5c1bd 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -35,7 +35,7 @@
#include <KToggleAction>
#include <KMenu>
-class KBookmarkManager;
+class BookmarksProvider;
class MainView;
class QWebFrame;
class WebView;
@@ -121,7 +121,7 @@ private:
KMenu *m_historyBackMenu;
KMenu *m_windowMenu;
- KBookmarkManager *m_manager;
+ BookmarksProvider *m_bookmarksProvider;
QAction *m_stopReload;
diff --git a/src/rekonqui.rc b/src/rekonqui.rc
index 11897e03..5016192f 100644
--- a/src/rekonqui.rc
+++ b/src/rekonqui.rc
@@ -1,5 +1,5 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="rekonq" version="22">
+<kpartgui name="rekonq" version="25">
<MenuBar>
<!-- ============ FILE menu =========== -->
<Menu name="file" noMerge="1"><text>&amp;File</text>
@@ -59,7 +59,7 @@
</MenuBar>
<!-- ============ Main ToolBar =========== -->
-<ToolBar name="mainToolBar" fullWidth="true" iconText="iconOnly" position="top" noMerge="1"><text>Main Toolbar</text>
+<ToolBar name="mainToolBar" fullWidth="true" iconText="iconOnly" newline="true" position="top" noMerge="1"><text>Main Toolbar</text>
<Action name="history back" />
<Action name="history forward" />
<Action name="stop reload" />
@@ -67,7 +67,7 @@
</ToolBar>
<!-- ============ Bookmarks ToolBar =========== -->
-<ToolBar name="bookmarksToolBar" fullWidth="true" iconText="icontextright" newline="true" position="top" noMerge="1"><text>Bookmarks Toolbar</text>
+<ToolBar name="bookmarksToolBar" fullWidth="true" iconSize="16" newline="true" position="top"><text>Bookmarks Toolbar</text>
</ToolBar>
</kpartgui>