summaryrefslogtreecommitdiff
path: root/src/bookmarks
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-07-22 01:00:40 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-07-22 01:00:40 +0200
commitbbab050a3b1c6a631aed8fdf5b0ab484378e0cef (patch)
tree10798d78258216ebdfabc8ba6c04b8034dc9dd4e /src/bookmarks
parentMerge commit 'refs/merge-requests/152' of git://gitorious.org/rekonq/mainline (diff)
parentfix suggestion type (diff)
downloadrekonq-bbab050a3b1c6a631aed8fdf5b0ab484378e0cef.tar.xz
Merge commit 'refs/merge-requests/153' of git://gitorious.org/rekonq/mainline into m153
Conflicts: src/history/historymanager.cpp src/history/historymanager.h
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/bookmarksmanager.cpp44
-rw-r--r--src/bookmarks/bookmarksmanager.h10
2 files changed, 15 insertions, 39 deletions
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index 57a29907..d0062ae1 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -185,8 +185,6 @@ QAction * BookmarkMenu::actionForBookmark(const KBookmark &bookmark)
}
else
{
- UrlSearchItem urlSearchItem(UrlSearchItem::Bookmark, bookmark.url().prettyUrl() , bookmark.fullText(), QDateTime(), 1, bookmark.description(), QString());
- Application::bookmarkProvider()->completionObject()->addItem(urlSearchItem);
return new KBookmarkAction(bookmark, owner(), this);
}
}
@@ -250,13 +248,9 @@ BookmarkProvider::BookmarkProvider(QObject *parent)
, m_manager(0)
, m_owner(0)
, m_actionCollection(new KActionCollection(this))
- , m_completion(0)
, _bookmarkActionMenu(0)
{
kDebug() << "Loading Bookmarks Manager...";
- // take care of the completion object
- m_completion = new AwesomeUrlCompletion;
- m_completion->setOrder(KCompletion::Weighted);
KUrl bookfile = KUrl("~/.kde/share/apps/konqueror/bookmarks.xml"); // share konqueror bookmarks
@@ -296,8 +290,6 @@ BookmarkProvider::~BookmarkProvider()
delete m_actionCollection;
delete m_owner;
delete m_manager;
-
- delete m_completion;
}
@@ -324,8 +316,6 @@ void BookmarkProvider::slotBookmarksChanged(const QString &group, const QString
Q_UNUSED(group)
Q_UNUSED(caller)
- m_completion->clear();
-
foreach(KToolBar *bookmarkToolBar, m_bookmarkToolBars)
{
if (bookmarkToolBar)
@@ -334,7 +324,6 @@ void BookmarkProvider::slotBookmarksChanged(const QString &group, const QString
fillBookmarkBar(bookmarkToolBar);
}
}
- //TODO: also change completion object
}
@@ -429,51 +418,44 @@ KBookmarkGroup BookmarkProvider::rootGroup()
}
-AwesomeUrlCompletion *BookmarkProvider::completionObject() const
-{
- return m_completion;
-}
-
-
-QString BookmarkProvider::titleForBookmarkUrl(QString url)
+QList<KBookmark> BookmarkProvider::find(QString text)
{
- QString title = "";
+ QList<KBookmark> list;
KBookmarkGroup bookGroup = Application::bookmarkProvider()->rootGroup();
if (bookGroup.isNull())
{
- return title;
+ return list;
}
- KBookmark bookmark = bookGroup.first();
- while (!bookmark.isNull() && title.isEmpty())
+ KBookmark bookmark = bookGroup.first();
+ while (!bookmark.isNull())
{
- title = titleForBookmarkUrl(bookmark, url);
+ list = find(list, bookmark, text);
bookmark = bookGroup.next(bookmark);
}
- return title;
+ return list;
}
-QString BookmarkProvider::titleForBookmarkUrl(const KBookmark &bookmark, QString url)
+QList<KBookmark> BookmarkProvider::find(QList<KBookmark> list, const KBookmark &bookmark, QString text)
{
- QString title = "";
if (bookmark.isGroup())
{
KBookmarkGroup group = bookmark.toGroup();
KBookmark bm = group.first();
- while (!bm.isNull() && title.isEmpty())
+ while (!bm.isNull())
{
- title = titleForBookmarkUrl(bm, url); // it is .bookfolder
+ list = find(list, bm, text); // it is .bookfolder
bm = group.next(bm);
}
}
- else if (!bookmark.isSeparator() && bookmark.url() == url)
+ else if (bookmark.url().url().contains(text) || bookmark.fullText().contains(text))
{
- title = bookmark.fullText();
+ list << bookmark;
}
- return title;
+ return list;
}
diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h
index 0915e894..64945eab 100644
--- a/src/bookmarks/bookmarksmanager.h
+++ b/src/bookmarks/bookmarksmanager.h
@@ -228,12 +228,7 @@ public:
inline BookmarkOwner *bookmarkOwner() { return m_owner; }
- /**
- * @returns the AwesomeUrlCompletion object.
- */
- AwesomeUrlCompletion *completionObject() const;
-
- QString titleForBookmarkUrl(QString url);
+ QList<KBookmark> find(QString text);
void registerBookmarkPanel(BookmarksPanel *panel);
void removeBookmarkPanel(BookmarksPanel *panel);
@@ -271,14 +266,13 @@ private slots:
private:
void fillBookmarkBar(KToolBar *toolBar);
- QString titleForBookmarkUrl(const KBookmark &bookmark, QString url);
+ QList<KBookmark> find(QList<KBookmark> list, const KBookmark &bookmark, QString text);
KBookmarkManager *m_manager;
BookmarkOwner *m_owner;
KActionCollection *m_actionCollection;
QList<KToolBar*> m_bookmarkToolBars;
QList<BookmarksPanel*> m_bookmarkPanels;
- AwesomeUrlCompletion *m_completion;
KActionMenu *_bookmarkActionMenu;
};