summaryrefslogtreecommitdiff
path: root/src/bookmarks.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2008-12-02 16:22:28 +0100
committerAndrea Diamantini <adjam7@gmail.com>2008-12-02 16:22:28 +0100
commit15ecefe10101dd068c4e075fca23ba64519bedb1 (patch)
tree0985bb87525a74c1bc2d6edb5bca29fff8140301 /src/bookmarks.cpp
parentNew BookmarkMenu implementation (diff)
downloadrekonq-15ecefe10101dd068c4e075fca23ba64519bedb1.tar.xz
New Bookmarks menu, sharing bkmrs with Konqueror0.0.1
(And that's reKonq 1st feature!!)
Diffstat (limited to 'src/bookmarks.cpp')
-rw-r--r--src/bookmarks.cpp41
1 files changed, 27 insertions, 14 deletions
diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp
index 29c175e8..6f9c3beb 100644
--- a/src/bookmarks.cpp
+++ b/src/bookmarks.cpp
@@ -17,42 +17,55 @@
 *
 * ============================================================ */
+// Local Includes
#include "bookmarks.h"
#include "bookmarks.moc"
+#include "browsermainwindow.h"
+#include "webview.h"
+
+// KDE Includes
+#include <KMimeType>
OwnBookMarks::OwnBookMarks(KMainWindow *parent)
+ : QObject(parent)
+ , KBookmarkOwner()
+{
+ m_parent = qobject_cast<BrowserMainWindow*>( parent );
+ connect( this, SIGNAL( openUrl( const QUrl &) ) , parent , SLOT( loadUrl( const QUrl & ) ) );
+}
+
+
+void OwnBookMarks::openBookmark (const KBookmark & b, Qt::MouseButtons , Qt::KeyboardModifiers )
{
+ emit openUrl( (QUrl)b.url() );
+}
+QString OwnBookMarks::currentUrl() const
+{
+ QUrl url = m_parent->currentTab()->url();
+ return url.path();
}
-virtual void OwnBookMarks::openBookmark (const KBookmark & , Qt::MouseButtons , Qt::KeyboardModifiers )
+QString OwnBookMarks::currentTitle() const
{
+ QString title = m_parent->windowTitle();
+ return title.remove( " - reKonq" );
}
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-BookmarkMenu::BookmarkMenu(KMainWindow *parent)
+BookmarksMenu::BookmarksMenu(KMainWindow *parent)
: KMenu(parent)
+ , m_owner( new OwnBookMarks( parent ) )
{
- m_parent = parent;
-
KUrl bookfile = KUrl( "~/.kde/share/apps/konqueror/bookmarks.xml" ); // share konqueror bookmarks
m_manager = KBookmarkManager::managerForExternalFile( bookfile.path() );
- m_owner = new OwnBookMarks(parent);
-
m_ac = new KActionCollection( this );
- setActions();
- m_menu = m_bookmarkMenu = new KBookmarkMenu( m_manager , m_owner, this, m_ac );
+ m_menu = new KBookmarkMenu( m_manager , m_owner, this, m_ac );
}
-
-
- void BookmarkMenu::setActions()
-{
- m_ac->addAction( KStandardAction::addBookmark( m_parent, SLOT( slotAddBookmark() ) , this ) );
-} \ No newline at end of file