summaryrefslogtreecommitdiff
path: root/src/bookmarks
diff options
context:
space:
mode:
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/bookmarksmanager.cpp14
-rw-r--r--src/bookmarks/bookmarksmanager.h7
2 files changed, 20 insertions, 1 deletions
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index 9feed63a..89e39ef8 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -161,7 +161,12 @@ BookmarkProvider::BookmarkProvider(QObject *parent)
, m_actionCollection(new KActionCollection(this))
, m_bookmarkMenu(0)
, m_bookmarkToolBar(0)
+ , m_completion(0)
{
+ // take care of the completion object
+ m_completion = new KCompletion;
+ m_completion->setOrder( KCompletion::Weighted );
+
KUrl bookfile = KUrl("~/.kde/share/apps/konqueror/bookmarks.xml"); // share konqueror bookmarks
if (!QFile::exists(bookfile.path()))
@@ -222,6 +227,7 @@ void BookmarkProvider::slotBookmarksChanged(const QString &group, const QString
return;
m_bookmarkToolBar->clear(); // FIXME CRASH
+ m_completion->clear();
KBookmark bookmark = toolBarGroup.first();
while (!bookmark.isNull())
@@ -287,7 +293,8 @@ KAction *BookmarkProvider::fillBookmarkBar(const KBookmark &bookmark)
return a;
}
else
- {
+ {
+ m_completion->addItem(bookmark.url().path());
return new KBookmarkAction(bookmark, m_owner, this);
}
}
@@ -297,3 +304,8 @@ KBookmarkGroup BookmarkProvider::rootGroup()
{
return m_manager->root();
}
+
+KCompletion *BookmarkProvider::completionObject() const
+{
+ return m_completion;
+}
diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h
index e50148e4..18ff3ef0 100644
--- a/src/bookmarks/bookmarksmanager.h
+++ b/src/bookmarks/bookmarksmanager.h
@@ -39,6 +39,7 @@
// KDE Includes
#include <KBookmarkOwner>
+#include <KCompletion>
// Forward Declarations
class BookmarkProvider;
@@ -213,6 +214,11 @@ public:
KBookmarkManager *bookmarkManager() { return m_manager; }
BookmarkOwner *bookmarkOwner() { return m_owner; }
+ /**
+ * @returns the KCompletion object.
+ */
+ KCompletion *completionObject() const;
+
signals:
/**
* @short This signal is emitted when an url has to be loaded
@@ -247,6 +253,7 @@ private:
KActionCollection *m_actionCollection;
BookmarkMenu *m_bookmarkMenu;
KToolBar *m_bookmarkToolBar;
+ KCompletion *m_completion;
};
#endif