[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kde-workspace/plasma/bookmarksrunner-chrome-gulino] plasma/generic/runners/bookmarks: Huge refactor
From: Marco Gulino <marco.gulino () gmail ! com>
Date: 2012-07-20 16:56:39
Message-ID: 20120720165639.5FB09A6094 () git ! kde ! org
[Download RAW message or body]
Git commit 7a9d9ba39828990cc6c0175e28de59852793485d by Marco Gulino.
Committed on 19/07/2012 at 21:45.
Pushed by gulino into branch 'plasma/bookmarksrunner-chrome-gulino'.
Huge refactoring to browsers runner, in order to add chrome support and unit tests
A +1 -0 plasma/generic/runners/bookmarks/.gitignore
M +6 -1 plasma/generic/runners/bookmarks/CMakeLists.txt
A +92 -0 plasma/generic/runners/bookmarks/bookmarkmatch.cpp [License: LGPL \
(v2+)] A +47 -0 plasma/generic/runners/bookmarks/bookmarkmatch.h [License: \
LGPL (v2+)] M +22 -392 plasma/generic/runners/bookmarks/bookmarksrunner.cpp
M +8 -45 plasma/generic/runners/bookmarks/bookmarksrunner.h
A +26 -0 plasma/generic/runners/bookmarks/bookmarksrunner_defs.h [License: \
LGPL (v2+)] A +83 -0 plasma/generic/runners/bookmarks/browser.cpp [License: \
LGPL (v2+)] A +60 -0 plasma/generic/runners/bookmarks/browser.h [License: \
LGPL (v2+)] A +30 -0 \
plasma/generic/runners/bookmarks/browsers/bookmarksfinder.h [License: LGPL (v2+)] \
A +43 -0 plasma/generic/runners/bookmarks/browsers/chrome.cpp [License: \
LGPL (v2+)] A +42 -0 plasma/generic/runners/bookmarks/browsers/chrome.h \
[License: LGPL (v2+)] A +35 -0 \
plasma/generic/runners/bookmarks/browsers/chromebookmarksfinder.cpp [License: \
LGPL (v2+)] A +38 -0 \
plasma/generic/runners/bookmarks/browsers/chromebookmarksfinder.h [License: LGPL \
(v2+)] A +173 -0 plasma/generic/runners/bookmarks/browsers/firefox.cpp \
[License: LGPL (v2+)] A +51 -0 \
plasma/generic/runners/bookmarks/browsers/firefox.h [License: LGPL (v2+)] A +87 \
-0 plasma/generic/runners/bookmarks/browsers/kdebrowser.cpp [License: LGPL \
(v2+)] A +37 -0 plasma/generic/runners/bookmarks/browsers/kdebrowser.h \
[License: LGPL (v2+)] A +99 -0 \
plasma/generic/runners/bookmarks/browsers/opera.cpp [License: LGPL (v2+)] A +41 \
-0 plasma/generic/runners/bookmarks/browsers/opera.h [License: LGPL (v2+)] M \
+3 -3 plasma/generic/runners/bookmarks/plasma-runner-bookmarks.desktop A +13 \
-0 plasma/generic/runners/bookmarks/tests/CMakeLists.txt A +46 -0 \
plasma/generic/runners/bookmarks/tests/testchromebookmarks.cpp [License: LGPL \
(v2+)] A +47 -0 plasma/generic/runners/bookmarks/tests/testchromebookmarks.h \
[License: LGPL (v2+)]
http://commits.kde.org/kde-workspace/7a9d9ba39828990cc6c0175e28de59852793485d
diff --git a/plasma/generic/runners/bookmarks/.gitignore \
b/plasma/generic/runners/bookmarks/.gitignore new file mode 100644
index 0000000..b25c15b
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/.gitignore
@@ -0,0 +1 @@
+*~
diff --git a/plasma/generic/runners/bookmarks/CMakeLists.txt \
b/plasma/generic/runners/bookmarks/CMakeLists.txt index 39d7834..2389eff 100644
--- a/plasma/generic/runners/bookmarks/CMakeLists.txt
+++ b/plasma/generic/runners/bookmarks/CMakeLists.txt
@@ -1,8 +1,11 @@
########### next target ###############
-set(krunner_bookmarksrunner_SRCS
+set(krunner_bookmarksrunner_SRCS bookmarkmatch.cpp \
browsers/chromebookmarksfinder.cpp browsers/chrome.cpp browsers/opera.cpp \
bookmarksrunner.cpp + browser.cpp
+ browsers/kdebrowser.cpp
+ browsers/firefox.cpp
)
kde4_add_plugin(krunner_bookmarksrunner ${krunner_bookmarksrunner_SRCS})
@@ -16,3 +19,5 @@ install(TARGETS krunner_bookmarksrunner DESTINATION \
${PLUGIN_INSTALL_DIR} )
install(FILES plasma-runner-bookmarks.desktop DESTINATION ${SERVICES_INSTALL_DIR})
+
+add_subdirectory(tests)
\ No newline at end of file
diff --git a/plasma/generic/runners/bookmarks/bookmarkmatch.cpp \
b/plasma/generic/runners/bookmarks/bookmarkmatch.cpp new file mode 100644
index 0000000..3582554
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/bookmarkmatch.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#include "bookmarkmatch.h"
+#include <QVariant>
+// TODO: test
+
+BookmarkMatch::BookmarkMatch( const QIcon& icon, const QString& searchTerm, const \
QString& bookmarkTitle, const QString& bookmarkURL, const QString& description ) + : \
m_icon(icon), m_searchTerm(searchTerm), m_bookmarkTitle(bookmarkTitle), \
m_bookmarkURL(bookmarkURL), m_description(description) +{
+
+}
+
+Plasma::QueryMatch BookmarkMatch::asQueryMatch( Plasma::AbstractRunner* runner )
+{
+ Plasma::QueryMatch::Type type = Plasma::QueryMatch::NoMatch;
+ qreal relevance = 0;
+
+ if (m_bookmarkTitle.compare(m_searchTerm, Qt::CaseInsensitive) == 0 ||
+ (!m_description.isEmpty() && m_description.compare(m_searchTerm, \
Qt::CaseInsensitive) == 0) + ) {
+ type = Plasma::QueryMatch::ExactMatch;
+ relevance = 1.0;
+ } else if (m_bookmarkTitle.contains(m_searchTerm, Qt::CaseInsensitive)) {
+ type = Plasma::QueryMatch::PossibleMatch;
+ relevance = 0.45;
+ } else if (!m_description.isEmpty() && m_description.contains(m_searchTerm, \
Qt::CaseInsensitive)) { + type = Plasma::QueryMatch::PossibleMatch;
+ relevance = 0.3;
+ } else if (m_bookmarkURL.contains(m_searchTerm, Qt::CaseInsensitive)) {
+ type = Plasma::QueryMatch::PossibleMatch;
+ relevance = 0.2;
+ } else {
+ type = Plasma::QueryMatch::PossibleMatch;
+ relevance = 0.18;
+ }
+
+ bool isNameEmpty = m_bookmarkTitle.isEmpty();
+ bool isDescriptionEmpty = m_description.isEmpty();
+
+ Plasma::QueryMatch match(runner);
+ match.setType(type);
+ match.setRelevance(relevance);
+ match.setIcon(m_icon);
+
+ // Try to set the following as text in this order: name, description, url
+ match.setText( isNameEmpty
+ ?
+ (!isDescriptionEmpty ? m_description : m_bookmarkURL)
+ :
+ m_bookmarkTitle );
+
+ match.setData(m_bookmarkURL);
+ return match;
+}
+
+void BookmarkMatch::addTo(QList< BookmarkMatch >& listOfResults, bool \
addEvenOnNoMatch) +{
+ if(!addEvenOnNoMatch && ! (
+ matches(m_searchTerm, m_bookmarkTitle) ||
+ matches(m_searchTerm, m_description) ||
+ matches(m_searchTerm, m_bookmarkURL)
+ )) {
+ return;
+ }
+ listOfResults << *this;
+}
+
+bool BookmarkMatch::matches(const QString &search, const QString &matchingField)
+{
+ return !matchingField.simplified().isEmpty() && matchingField.contains(search, \
Qt::CaseInsensitive); +}
+
+
diff --git a/plasma/generic/runners/bookmarks/bookmarkmatch.h \
b/plasma/generic/runners/bookmarks/bookmarkmatch.h new file mode 100644
index 0000000..87bc6b4
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/bookmarkmatch.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef BOOKMARKMATCH_H
+#define BOOKMARKMATCH_H
+
+#include <QString>
+#include <QIcon>
+#include <QList>
+#include <Plasma/QueryMatch>
+
+class BookmarkMatch
+{
+
+public:
+ BookmarkMatch(const QIcon &icon, const QString &searchTerm, const QString \
&bookmarkTitle, const QString &bookmarkURL, const QString &description = QString()); \
+ void addTo(QList< BookmarkMatch >& listOfResults, bool addEvenOnNoMatch); + \
Plasma::QueryMatch asQueryMatch(Plasma::AbstractRunner *runner); +private:
+ bool matches(const QString &search, const QString &matchingField);
+private:
+ QIcon m_icon;
+ QString m_searchTerm;
+ QString m_bookmarkTitle;
+ QString m_bookmarkURL;
+ QString m_description;
+};
+
+#endif // BOOKMARKMATCH_H
diff --git a/plasma/generic/runners/bookmarks/bookmarksrunner.cpp \
b/plasma/generic/runners/bookmarks/bookmarksrunner.cpp index aa3d45d..100d7ce 100644
--- a/plasma/generic/runners/bookmarks/bookmarksrunner.cpp
+++ b/plasma/generic/runners/bookmarks/bookmarksrunner.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@@ -18,164 +19,52 @@
*/
#include "bookmarksrunner.h"
+#include "browser.h"
-#include <QDBusInterface>
-#include <QDBusReply>
#include <QList>
#include <QStack>
-#include <QSqlQuery>
#include <QDir>
-#include <KIcon>
-#include <KBookmarkManager>
#include <KMimeType>
#include <KMimeTypeTrader>
#include <KToolInvocation>
#include <KUrl>
#include <KStandardDirs>
#include <KDebug>
-#include <KIO/Job>
+#include "bookmarkmatch.h"
+#include "bookmarksrunner_defs.h"
BookmarksRunner::BookmarksRunner( QObject* parent, const QVariantList &args )
- : Plasma::AbstractRunner(parent, args)
+ : Plasma::AbstractRunner(parent, args), m_browser(0), m_browserFactory(new \
BrowserFactory(this)) {
Q_UNUSED(args)
+ kDebug(kdbg_code) << "Creating BookmarksRunner";
setObjectName( QLatin1String("Bookmarks" ));
- m_icon = KIcon("bookmarks");
- m_bookmarkManager = KBookmarkManager::userBookmarksManager();
- m_browser = whichBrowser();
addSyntax(Plasma::RunnerSyntax(":q:", i18n("Finds web browser bookmarks matching \
:q:.")));
setDefaultSyntax(Plasma::RunnerSyntax(i18nc("list of all web browser bookmarks", \
"bookmarks"),
i18n("List all web browser bookmarks")));
connect(this, SIGNAL(prepare()), this, SLOT(prep()));
- connect(this, SIGNAL(teardown()), this, SLOT(down()));
-
- reloadConfiguration();
}
BookmarksRunner::~BookmarksRunner()
{
- if (!m_dbCacheFile.isEmpty()) {
- QFile db_CacheFile(m_dbCacheFile);
- if (db_CacheFile.exists()) {
- kDebug() << "Cache file was removed: " << db_CacheFile.remove();
- }
- }
}
-void BookmarksRunner::reloadConfiguration()
-{
- if (m_browser == Firefox) {
- if (QSqlDatabase::isDriverAvailable("QSQLITE")) {
- KConfigGroup grp = config();
- /* This allows the user to specify a profile database */
- m_dbFile = grp.readEntry<QString>("dbfile", "");
- if (m_dbFile.isEmpty() || QFile::exists(m_dbFile)) {
- //Try to get the right database file, the default profile is used
- KConfig firefoxProfile(QDir::homePath() + \
"/.mozilla/firefox/profiles.ini",
- KConfig::SimpleConfig);
- QStringList profilesList = firefoxProfile.groupList();
- profilesList = profilesList.filter(QRegExp("^Profile\\d+$"));
- int size = profilesList.size();
-
- QString profilePath;
- if (size == 1) {
- // There is only 1 profile so we select it
- KConfigGroup fGrp = firefoxProfile.group(profilesList.first());
- profilePath = fGrp.readEntry("Path", "");
- } else {
- // There are multiple profiles, find the default one
- foreach(const QString & profileName, profilesList) {
- KConfigGroup fGrp = firefoxProfile.group(profileName);
- if (fGrp.readEntry<int>("Default", 0)) {
- profilePath = fGrp.readEntry("Path", "");
- break;
- }
- }
- }
-
- if (profilePath.isEmpty()) {
- kDebug() << "No default firefox profile found";
- m_db = QSqlDatabase();
- return;
- }
-
- profilePath.prepend(QString("%1/.mozilla/firefox/").arg(QDir::homePath()));
- m_dbFile = profilePath + "/places.sqlite";
- grp.writeEntry("dbfile", m_dbFile);
- }
- m_db = QSqlDatabase::addDatabase("QSQLITE");
- m_db.setHostName("localhost");
- } else {
- kDebug() << "SQLITE driver isn't available";
- m_db = QSqlDatabase();
- }
- }
-}
void BookmarksRunner::prep()
{
- m_browser = whichBrowser();
- if (m_browser == Firefox) {
- if (m_db.isValid()) {
- if (m_dbCacheFile.isEmpty()) {
- m_dbCacheFile = KStandardDirs::locateLocal("cache", "") + \
"bookmarkrunnerfirefoxdbfile.sqlite";
- }
-
- // ### DO NOT USE KIO FROM RUNNER THREADS!
- // ### This looks like a local copy, so use QFile::copy instead.
- KIO::Job *job = KIO::file_copy(m_dbFile, m_dbCacheFile, -1,
- KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(result(KJob*)), this, SLOT(dbCopied(KJob*)));
- }
- } else if (m_browser == Opera) {
- // open bookmarks file
- QString operaBookmarksFilePath = QDir::homePath() + "/.opera/bookmarks.adr";
- QFile operaBookmarksFile(operaBookmarksFilePath);
- if (!operaBookmarksFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
- kDebug() << "Could not open Operas Bookmark File " + \
operaBookmarksFilePath;
- return;
- }
-
- // check format
- QString firstLine = operaBookmarksFile.readLine();
- if (firstLine.compare("Opera Hotlist version 2.0\n")) {
- kDebug() << "Format of Opera Bookmarks File might have changed.";
- }
- operaBookmarksFile.readLine(); // skip options line ("Options: encoding = \
utf8, version=3")
- operaBookmarksFile.readLine(); // skip empty line
-
- // load contents
- QString contents = operaBookmarksFile.readAll();
- m_operaBookmarkEntries = contents.split("\n\n", QString::SkipEmptyParts);
-
- // close file
- operaBookmarksFile.close();
- }
+ kDebug(kdbg_code) << "**** prep called";
+ m_browser = m_browserFactory->find(findBrowserName(), this);
+ connect(this, SIGNAL(teardown()), m_browser, SLOT(teardown()));
+ m_browser->prepare();
}
-void BookmarksRunner::dbCopied(KJob *)
-{
- m_db.setDatabaseName(m_dbCacheFile);
- m_dbOK = m_db.open();
- kDebug() << "Database was opened: " << m_dbOK;
-}
-void BookmarksRunner::down()
-{
- if (m_browser == Firefox) {
- if (m_db.isOpen()) {
- m_db.close();
- m_dbOK = false;
- }
- } else if (m_browser == Opera) {
- m_operaBookmarkEntries.clear();
- }
-}
void BookmarksRunner::match(Plasma::RunnerContext &context)
{
+ if(! m_browser) return;
const QString term = context.query();
if ((term.length() < 3) && (!context.singleRunnerQueryMode())) {
return;
@@ -183,275 +72,21 @@ void BookmarksRunner::match(Plasma::RunnerContext &context)
bool allBookmarks = term.compare(i18nc("list of all konqueror bookmarks", \
"bookmarks"), Qt::CaseInsensitive) == 0;
- switch (m_browser) {
- case Firefox:
- matchFirefoxBookmarks(context, allBookmarks, term);
- break;
- case Opera:
- matchOperaBookmarks(context, allBookmarks, term);
- break;
- case Default:
- matchKonquerorBookmarks(context, allBookmarks, term);
- break;
- }
-}
-
-KIcon BookmarksRunner::favicon(const KUrl &url)
-{
- // query the favicons module
- const QString iconFile = KMimeType::favIconForUrl(url);
-
- if (iconFile.isEmpty()) {
- return m_icon;
- }
-
- return KIcon(iconFile);
-}
-
-void BookmarksRunner::matchOperaBookmarks(Plasma::RunnerContext& context, bool \
allBookmarks,
- const QString& term)
-{
- QList<Plasma::QueryMatch> matches;
-
- QLatin1String nameStart("\tNAME=");
- QLatin1String urlStart("\tURL=");
- QLatin1String descriptionStart("\tDESCRIPTION=");
-
- // search
- foreach (const QString & entry, m_operaBookmarkEntries) {
- if (!context.isValid()) {
+
+ QList<BookmarkMatch> matches = m_browser->match(term, allBookmarks);
+ foreach(BookmarkMatch match, matches) {
+ if(!context.isValid())
return;
- }
-
- QStringList entryLines = entry.split("\n");
- if (!entryLines.first().startsWith(QString("#URL"))) {
- continue; // skip folder entries
- }
- entryLines.pop_front();
-
- QString name;
- QString url;
- QString description;
-
- foreach (const QString & line, entryLines) {
- if (line.startsWith(nameStart)) {
- name = line.mid( QString(nameStart).length() ).simplified();
- } else if (line.startsWith(urlStart)) {
- url = line.mid( QString(urlStart).length() ).simplified();
- } else if (line.startsWith(descriptionStart)) {
- description = line.mid(QString(descriptionStart).length())
- .simplified();
- }
- }
-
- if (url.simplified().isEmpty())
- continue; // skip useless entries
-
- Plasma::QueryMatch::Type type = Plasma::QueryMatch::NoMatch;
- qreal relevance = 0;
-
- if (name.compare(term, Qt::CaseInsensitive) == 0
- || description.compare(term, Qt::CaseInsensitive) == 0) {
- type = Plasma::QueryMatch::ExactMatch;
- relevance = 1.0;
- } else if (name.contains(term, Qt::CaseInsensitive)) {
- type = Plasma::QueryMatch::PossibleMatch;
- relevance = 0.45;
- } else if (description.contains(term, Qt::CaseInsensitive)) {
- type = Plasma::QueryMatch::PossibleMatch;
- relevance = 0.3;
- } else if (url.contains(term, Qt::CaseInsensitive)) {
- type = Plasma::QueryMatch::PossibleMatch;
- relevance = 0.2;
- } else if (allBookmarks) {
- type = Plasma::QueryMatch::PossibleMatch;
- relevance = 0.18;
- }
-
- if (type != Plasma::QueryMatch::NoMatch) {
- bool isNameEmpty = name.isEmpty();
- bool isDescriptionEmpty = description.isEmpty();
-
- Plasma::QueryMatch match(this);
- match.setType(type);
- match.setRelevance(relevance);
- match.setIcon(m_icon);
-
- // Try to set the following as text in this order: name, description, \
url
- match.setText( isNameEmpty
- ?
- (!isDescriptionEmpty ? description : url)
- :
- name );
-
- match.setData(url);
- matches << match;
- }
- }
- context.addMatches(term, matches);
-}
-
-void BookmarksRunner::matchKonquerorBookmarks(Plasma::RunnerContext& context, bool \
allBookmarks,
- const QString& term)
-{
- KBookmarkGroup bookmarkGroup = m_bookmarkManager->root();
-
- QList<Plasma::QueryMatch> matches;
- QStack<KBookmarkGroup> groups;
-
- KBookmark bookmark = bookmarkGroup.first();
- while (!bookmark.isNull()) {
- if (!context.isValid()) {
- return;
- }
-
- if (bookmark.isSeparator()) {
- bookmark = bookmarkGroup.next(bookmark);
- continue;
- }
-
- if (bookmark.isGroup()) { // descend
- //kDebug () << "descending into" << bookmark.text();
- groups.push(bookmarkGroup);
- bookmarkGroup = bookmark.toGroup();
- bookmark = bookmarkGroup.first();
-
- while (bookmark.isNull() && !groups.isEmpty()) {
- if (!context.isValid()) {
- return;
- }
-
- bookmark = bookmarkGroup;
- bookmarkGroup = groups.pop();
- bookmark = bookmarkGroup.next(bookmark);
- }
-
- continue;
- }
-
- Plasma::QueryMatch::Type type = Plasma::QueryMatch::NoMatch;
- qreal relevance = 0;
-
- const QString text = bookmark.text();
- const QString url = bookmark.url().prettyUrl();
- if (text.compare(term, Qt::CaseInsensitive) == 0) {
- type = Plasma::QueryMatch::ExactMatch;
- relevance = 1.0;
- } else if (text.contains(term, Qt::CaseInsensitive)) {
- type = Plasma::QueryMatch::PossibleMatch;
- relevance = 0.45;
- } else if (url.contains(term, Qt::CaseInsensitive)) {
- type = Plasma::QueryMatch::PossibleMatch;
- relevance = 0.2;
- } else if (allBookmarks) {
- type = Plasma::QueryMatch::PossibleMatch;
- relevance = 0.18;
- }
-
- if (type != Plasma::QueryMatch::NoMatch) {
- //kDebug() << "Found bookmark: " << bookmark.text() << " (" << \
bookmark.url().prettyUrl() << ")";
- Plasma::QueryMatch match(this);
-
- QIcon icon = favicon(bookmark.url());
- if (icon.isNull()) {
- match.setIcon(m_icon);
- } else {
- match.setIcon(icon);
- }
-
- match.setType(type);
- match.setRelevance(relevance);
- match.setText(bookmark.text());
- match.setData(bookmark.url().url());
- matches << match;
- }
-
- bookmark = bookmarkGroup.next(bookmark);
- while (bookmark.isNull() && !groups.isEmpty()) {
- if (!context.isValid()) {
- return;
- }
-
- bookmark = bookmarkGroup;
- bookmarkGroup = groups.pop();
- //kDebug() << "ascending from" << bookmark.text() << "to" << \
bookmarkGroup.text();
- bookmark = bookmarkGroup.next(bookmark);
- }
+ context.addMatch(term, match.asQueryMatch(this));
}
- context.addMatches(term, matches);
}
-void BookmarksRunner::matchFirefoxBookmarks(Plasma::RunnerContext& context, bool \
allBookmarks, const QString& term)
-{
- if (!m_dbOK) {
- return;
- }
-
- QList<Plasma::QueryMatch> matches;
- QString tmpTerm = term;
- QSqlQuery query;
- if (allBookmarks) {
- query = QSqlQuery("SELECT moz_bookmarks.fk, moz_bookmarks.title, \
moz_places.url," \
- "moz_places.favicon_id FROM moz_bookmarks, moz_places WHERE " \
- "moz_bookmarks.type = 1 AND moz_bookmarks.fk = moz_places.id");
- } else {
- const QString escapedTerm = tmpTerm.replace('\'', "\\'");
- query = QSqlQuery("SELECT moz_bookmarks.fk, moz_bookmarks.title, \
moz_places.url," \
- "moz_places.favicon_id FROM moz_bookmarks, moz_places WHERE \
" \
- "moz_bookmarks.type = 1 AND moz_bookmarks.fk = moz_places.id \
AND " \
- "(moz_bookmarks.title LIKE '%" + escapedTerm + "%' or \
moz_places.url LIKE '%"
- + escapedTerm + "%')");
- }
-
- while (query.next() && context.isValid()) {
- const QString title = query.value(1).toString();
- const QUrl url = query.value(2).toString();
- //const int favicon_id = query.value(3).toInt();
-
- if (title.isEmpty() || url.isEmpty() || url.scheme().contains("place")) {
- //Don't use bookmarks with empty title, url or Firefox intern url
- kDebug() << "element was not added";
- continue;
- }
-
- Plasma::QueryMatch::Type type = Plasma::QueryMatch::NoMatch;
- qreal relevance = 0;
-
- if (title.compare(term, Qt::CaseInsensitive) == 0) {
- type = Plasma::QueryMatch::ExactMatch;
- relevance = 1.0;
- } else if (title.contains(term, Qt::CaseInsensitive)) {
- type = Plasma::QueryMatch::PossibleMatch;
- relevance = 0.45;
- } else if (url.toString().contains(term, Qt::CaseInsensitive)) {
- type = Plasma::QueryMatch::PossibleMatch;
- relevance = 0.2;
- } else if (allBookmarks) {
- type = Plasma::QueryMatch::PossibleMatch;
- relevance = 0.18;
- }
-
- Plasma::QueryMatch match(this);
- QIcon icon = favicon(url);
- if (icon.isNull()) {
- match.setIcon(m_icon);
- } else {
- match.setIcon(icon);
- }
- match.setText(title);
- match.setData(url);
- match.setType(type);
- match.setRelevance(relevance);
- matches << match;
- }
- context.addMatches(term, matches);
-}
-
-BookmarksRunner::Browser BookmarksRunner::whichBrowser()
+QString BookmarksRunner::findBrowserName()
{
//HACK find the default browser
KConfigGroup config(KSharedConfig::openConfig("kdeglobals"), \
QLatin1String("General") );
QString exec = config.readPathEntry(QLatin1String("BrowserApplication"), \
QString()); + kDebug(kdbg_code) << "Found exec string: " << exec;
if (exec.isEmpty()) {
KService::Ptr service = \
KMimeTypeTrader::self()->preferredService("text/html"); if (service) {
@@ -459,14 +94,9 @@ BookmarksRunner::Browser BookmarksRunner::whichBrowser()
}
}
- //kDebug() << exec;
- if (exec.contains("firefox", Qt::CaseInsensitive)) {
- return Firefox;
- } else if (exec.contains("opera", Qt::CaseInsensitive)) {
- return Opera;
- } else {
- return Default;
- }
+ kDebug(kdbg_code) << "KRunner::Bookmarks: found executable " << exec << " as \
default browser"; + return exec;
+
}
void BookmarksRunner::run(const Plasma::RunnerContext &context, const \
Plasma::QueryMatch &action) @@ -495,7 +125,7 @@ void BookmarksRunner::run(const \
Plasma::RunnerContext &context, const Plasma::Qu url.setProtocol("http");
}
- //kDebug() << "BookmarksRunner::run opening: " << url.url();
+ //kDebug(kdbg_code) << "BookmarksRunner::run opening: " << url.url();
KToolInvocation::invokeBrowser(url.url());
}
diff --git a/plasma/generic/runners/bookmarks/bookmarksrunner.h \
b/plasma/generic/runners/bookmarks/bookmarksrunner.h index d7545af..ef0b1ea 100644
--- a/plasma/generic/runners/bookmarks/bookmarksrunner.h
+++ b/plasma/generic/runners/bookmarks/bookmarksrunner.h
@@ -1,5 +1,6 @@
/*
* Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@@ -15,19 +16,18 @@
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+*/
#ifndef BOOKMARKSRUNNER_H
#define BOOKMARKSRUNNER_H
-#include <KIcon>
-#include <QSqlDatabase>
#include <QMimeData>
#include <Plasma/AbstractRunner>
class KBookmark;
-class KBookmarkManager;
+class Browser;
+class BrowserFactory;
class KJob;
/** This runner searchs for bookmarks in browsers like Konqueror, Firefox and Opera \
*/ @@ -41,59 +41,22 @@ class BookmarksRunner : public Plasma::AbstractRunner
void match(Plasma::RunnerContext &context);
void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch \
&action);
- void reloadConfiguration();
private:
- /** Defines the browser to get the bookmarks from
- * Add support for a browser by
- * -adding the browser as part of this enum
- * -adding an if-statement with the enum part
- * -adding a method getBrowserBookmarks
- * -adding a statement to whichBrowser()
- * @see whichBrowser()
- */
- enum Browser {
- Firefox, ///< the browser is Firefox
- Opera, ///< the browser is Opera
- Default ///< KDE bookmarks
- };
-
- /** @returns the favicon for the url */
- KIcon favicon(const KUrl &url);
-
- /** Get the bookmarks from Firefox */
- void matchFirefoxBookmarks(Plasma::RunnerContext& context, bool \
allBookmarks,
- const QString& term);
- /** Get the bookmarks from Konqueror */
- void matchKonquerorBookmarks(Plasma::RunnerContext& context, bool \
allBookmarks,
- const QString& term);
-
- /** Get the bookmarks from Opera */
- void matchOperaBookmarks(Plasma::RunnerContext& context, bool allBookmarks,
- const QString& term);
-
+
/** @returns the browser to get the bookmarks from
* @see Browser
*/
- Browser whichBrowser();
+ QString findBrowserName();
private:
- KIcon m_icon;
- bool m_dbOK;
- Browser m_browser;
- QString m_dbFile;
- QString m_dbCacheFile;
- QSqlDatabase m_db;
- KBookmarkManager *m_bookmarkManager;
- QStringList m_operaBookmarkEntries;
-
+ Browser *m_browser;
+ BrowserFactory * const m_browserFactory;
protected Q_SLOTS:
QMimeData * mimeDataForMatch(const Plasma::QueryMatch *match);
private Q_SLOTS:
void prep();
- void down();
- void dbCopied(KJob *);
};
K_EXPORT_PLASMA_RUNNER(bookmarksrunner, BookmarksRunner)
diff --git a/plasma/generic/runners/bookmarks/bookmarksrunner_defs.h \
b/plasma/generic/runners/bookmarks/bookmarksrunner_defs.h new file mode 100644
index 0000000..211925a
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/bookmarksrunner_defs.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef BOOKMARKS_RUNNER_DEFS
+#define BOOKMARKS_RUNNER_DEFS
+
+#define kdbg_code 1207
+
+#endif
\ No newline at end of file
diff --git a/plasma/generic/runners/bookmarks/browser.cpp \
b/plasma/generic/runners/bookmarks/browser.cpp new file mode 100644
index 0000000..c2a7d35
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/browser.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "browser.h"
+#include "browsers/kdebrowser.h"
+#include "browsers/firefox.h"
+#include "browsers/opera.h"
+#include <KMimeType>
+
+
+Browser *BrowserFactory::find(const QString& browserName, QObject* parent)
+{
+ if(m_previousBrowserName == browserName) {
+ return m_previousBrowser;
+ }
+ delete m_previousBrowser;
+ m_previousBrowserName = browserName;
+ if (browserName.contains("firefox", Qt::CaseInsensitive)) {
+ m_previousBrowser = new Firefox(parent);
+ } else if (browserName.contains("opera", Qt::CaseInsensitive)) {
+ m_previousBrowser = new Opera(parent);
+ } else {
+ m_previousBrowser = new KDEBrowser(parent);
+ }
+
+ return m_previousBrowser;
+}
+
+
+BrowserFactory::BrowserFactory(QObject *parent)
+ : QObject(parent), m_previousBrowser(0), m_previousBrowserName("invalid")
+{
+}
+
+Browser::Browser(QObject *parent)
+ : QObject(parent)
+{
+}
+
+Browser::~Browser()
+{
+ m_icon = KIcon("bookmarks");
+}
+
+
+void Browser::prepare()
+{
+}
+
+
+KIcon Browser::favicon(const KUrl &url)
+{
+ // query the favicons module
+ const QString iconFile = KMimeType::favIconForUrl(url);
+
+ if (iconFile.isEmpty()) {
+ return m_icon;
+ }
+
+ return KIcon(iconFile);
+}
+
+void Browser::teardown()
+{
+}
+
diff --git a/plasma/generic/runners/bookmarks/browser.h \
b/plasma/generic/runners/bookmarks/browser.h new file mode 100644
index 0000000..10a9b26
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/browser.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef BROWSER_H
+#define BROWSER_H
+#include <QObject>
+#include <QString>
+#include <Plasma/AbstractRunner>
+#include <KIcon>
+#include <KUrl>
+#include "bookmarkmatch.h"
+
+class Browser;
+
+class BrowserFactory : public QObject
+{
+ Q_OBJECT
+public:
+ BrowserFactory(QObject *parent =0);
+ Browser *find(const QString &browserName, QObject *parent = 0);
+private:
+ QString m_previousBrowserName;
+ Browser *m_previousBrowser;
+};
+
+
+class Browser: public QObject
+{
+ Q_OBJECT
+public:
+ Browser(QObject *parent = 0);
+ virtual ~Browser();
+ virtual QList<BookmarkMatch> match(const QString& term, bool addEveryThing) = 0;
+protected:
+ KIcon favicon(const KUrl &url);
+ KIcon m_icon; // TODO: move?
+
+public slots:
+ virtual void prepare();
+ virtual void teardown();
+};
+
+#endif // BROWSER_H
diff --git a/plasma/generic/runners/bookmarks/browsers/bookmarksfinder.h \
b/plasma/generic/runners/bookmarks/browsers/bookmarksfinder.h new file mode 100644
index 0000000..043dc32
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/browsers/bookmarksfinder.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef BOOKMARKS_FINDER_H
+#define BOOKMARKS_FINDER_H
+#include <QStringList>
+
+class BookmarksFinder {
+public:
+ virtual QStringList find() = 0;
+ virtual ~BookmarksFinder() {};
+};
+
+#endif
diff --git a/plasma/generic/runners/bookmarks/browsers/chrome.cpp \
b/plasma/generic/runners/bookmarks/browsers/chrome.cpp new file mode 100644
index 0000000..924cfce
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/browsers/chrome.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#include "chrome.h"
+#include "browsers/bookmarksfinder.h"
+
+void Chrome::match(Plasma::AbstractRunner* runner, Plasma::RunnerContext& context, \
bool allBookmarks, const QString& term) +{
+
+}
+
+Chrome::Chrome( BookmarksFinder* bookmarksFinder, QObject* parent ): \
Browser(parent), m_bookmarksFiles(bookmarksFinder->find()) +{
+}
+
+void Chrome::prepare()
+{
+ Browser::prepare();
+}
+
+void Chrome::teardown()
+{
+ Browser::teardown();
+}
+
diff --git a/plasma/generic/runners/bookmarks/browsers/chrome.h \
b/plasma/generic/runners/bookmarks/browsers/chrome.h new file mode 100644
index 0000000..3e2177f
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/browsers/chrome.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef CHROME_H
+#define CHROME_H
+
+#include "browser.h"
+
+class BookmarksFinder;
+class Chrome : public Browser
+{
+ Q_OBJECT
+public:
+ Chrome(BookmarksFinder *bookmarksFinder, QObject* parent = 0);
+ virtual void match(Plasma::AbstractRunner* runner, Plasma::RunnerContext& \
context, bool allBookmarks, const QString& term); +public slots:
+ virtual void prepare();
+ virtual void teardown();
+
+private:
+ QStringList const m_bookmarksFiles;
+};
+
+#endif // CHROME_H
diff --git a/plasma/generic/runners/bookmarks/browsers/chromebookmarksfinder.cpp \
b/plasma/generic/runners/bookmarks/browsers/chromebookmarksfinder.cpp new file mode \
100644 index 0000000..c14a40c
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/browsers/chromebookmarksfinder.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#include "chromebookmarksfinder.h"
+#include <QDir>
+
+ChromeBookmarksFinder::ChromeBookmarksFinder ( const QString &applicationName, \
QObject* parent ) + : QObject(parent), m_applicationName(applicationName)
+{
+}
+
+QStringList ChromeBookmarksFinder::find()
+{
+ QString configDir = QString("%1/.config/%2/Default/Bookmarks")
+ .arg(QDir::homePath()).arg(m_applicationName);
+ return QStringList(configDir);
+}
diff --git a/plasma/generic/runners/bookmarks/browsers/chromebookmarksfinder.h \
b/plasma/generic/runners/bookmarks/browsers/chromebookmarksfinder.h new file mode \
100644 index 0000000..9736adf
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/browsers/chromebookmarksfinder.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef CHROMEBOOKMARKSFINDER_H
+#define CHROMEBOOKMARKSFINDER_H
+
+#include <QObject>
+#include "browsers/bookmarksfinder.h"
+
+class ChromeBookmarksFinder : public QObject, public BookmarksFinder
+{
+
+public:
+ explicit ChromeBookmarksFinder ( const QString& applicationName, QObject* parent \
= 0 ); + virtual QStringList find();
+private:
+ QString const m_applicationName;
+};
+
+#endif // CHROMEBOOKMARKSFINDER_H
diff --git a/plasma/generic/runners/bookmarks/browsers/firefox.cpp \
b/plasma/generic/runners/bookmarks/browsers/firefox.cpp new file mode 100644
index 0000000..fb70c30
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/browsers/firefox.cpp
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "firefox.h"
+#include <KJob>
+#include <KStandardDirs>
+#include <KDebug>
+#include "bookmarksrunner_defs.h"
+#include <KIO/Job>
+#include <QSqlQuery>
+#include <QFile>
+#include <QDir>
+#include "bookmarkmatch.h"
+
+Firefox::Firefox(QObject *parent) :
+ Browser(parent)
+{
+ reloadConfiguration();
+ kDebug(kdbg_code) << "Loading Firefox Bookmarks Browser";
+}
+
+
+Firefox::~Firefox()
+{
+ if (!m_dbCacheFile.isEmpty()) {
+ QFile db_CacheFile(m_dbCacheFile);
+ if (db_CacheFile.exists()) {
+ kDebug(kdbg_code) << "Cache file was removed: " << \
db_CacheFile.remove(); + }
+ }
+ kDebug(kdbg_code) << "Deleted Firefox Bookmarks Browser";
+}
+
+void Firefox::prepare()
+{
+ if (m_db.isValid()) {
+ if (m_dbCacheFile.isEmpty()) {
+ m_dbCacheFile = KStandardDirs::locateLocal("cache", "") + \
"bookmarkrunnerfirefoxdbfile.sqlite"; + }
+
+ // ### DO NOT USE KIO FROM RUNNER THREADS!
+ // ### This looks like a local copy, so use QFile::copy instead.
+ KIO::Job *job = KIO::file_copy(m_dbFile, m_dbCacheFile, -1,
+ KIO::HideProgressInfo | KIO::Overwrite);
+ connect(job, SIGNAL(result(KJob*)), this, SLOT(dbCopied(KJob*)));
+ }
+}
+
+void Firefox::dbCopied(KJob *)
+{
+ m_db.setDatabaseName(m_dbCacheFile);
+ m_dbOK = m_db.open();
+ kDebug(kdbg_code) << "Database was opened: " << m_dbOK;
+}
+
+QList< BookmarkMatch > Firefox::match(const QString& term, bool addEverything)
+{
+ QList< BookmarkMatch > matches;
+ if (!m_dbOK) {
+ return matches;
+ }
+ kDebug(kdbg_code) << "Firefox bookmark: match " << term;
+
+ QString tmpTerm = term;
+ QSqlQuery query;
+ if (addEverything) {
+ query = QSqlQuery("SELECT moz_bookmarks.fk, moz_bookmarks.title, \
moz_places.url," \ + "moz_places.favicon_id FROM moz_bookmarks, \
moz_places WHERE " \ + "moz_bookmarks.type = 1 AND \
moz_bookmarks.fk = moz_places.id"); + } else {
+ const QString escapedTerm = tmpTerm.replace('\'', "\\'");
+ query = QSqlQuery("SELECT moz_bookmarks.fk, moz_bookmarks.title, \
moz_places.url," \ + "moz_places.favicon_id FROM \
moz_bookmarks, moz_places WHERE " \ + "moz_bookmarks.type = 1 \
AND moz_bookmarks.fk = moz_places.id AND " \ + \
"(moz_bookmarks.title LIKE '%" + escapedTerm + "%' or moz_places.url LIKE '%" + \
+ escapedTerm + "%')"); + }
+
+ while (query.next() /*&& context.isValid() TODO: restore? */) {
+ const QString title = query.value(1).toString();
+ const QUrl url = query.value(2).toString();
+ //const int favicon_id = query.value(3).toInt();
+ QIcon icon = favicon(url);
+
+ if (url.scheme().contains("place")) {
+ //Don't use bookmarks with empty title, url or Firefox intern url
+ kDebug(kdbg_code) << "element " << url << " was not added";
+ continue;
+ }
+
+ BookmarkMatch bookmarkMatch( (icon.isNull() ? m_icon : icon), term, title, \
url.toString()); + bookmarkMatch.addTo(matches, addEverything);
+
+ }
+ return matches;
+}
+
+
+void Firefox::teardown()
+{
+ if (m_db.isOpen()) {
+ m_db.close();
+ m_dbOK = false;
+ }
+}
+
+
+
+void Firefox::reloadConfiguration()
+{
+ KConfigGroup config(KSharedConfig::openConfig("kdeglobals"), \
QLatin1String("General") ); + if (QSqlDatabase::isDriverAvailable("QSQLITE")) {
+ KConfigGroup grp = config;
+ /* This allows the user to specify a profile database */
+ m_dbFile = grp.readEntry<QString>("dbfile", "");
+ if (m_dbFile.isEmpty() || QFile::exists(m_dbFile)) {
+ //Try to get the right database file, the default profile is used
+ KConfig firefoxProfile(QDir::homePath() + \
"/.mozilla/firefox/profiles.ini", + \
KConfig::SimpleConfig); + QStringList profilesList = \
firefoxProfile.groupList(); + profilesList = \
profilesList.filter(QRegExp("^Profile\\d+$")); + int size = \
profilesList.size(); +
+ QString profilePath;
+ if (size == 1) {
+ // There is only 1 profile so we select it
+ KConfigGroup fGrp = firefoxProfile.group(profilesList.first());
+ profilePath = fGrp.readEntry("Path", "");
+ } else {
+ // There are multiple profiles, find the default one
+ foreach(const QString & profileName, profilesList) {
+ KConfigGroup fGrp = firefoxProfile.group(profileName);
+ if (fGrp.readEntry<int>("Default", 0)) {
+ profilePath = fGrp.readEntry("Path", "");
+ break;
+ }
+ }
+ }
+
+ if (profilePath.isEmpty()) {
+ kDebug(kdbg_code) << "No default firefox profile found";
+ m_db = QSqlDatabase();
+ return;
+ }
+ kDebug(kdbg_code) << "Profile " << profilePath << " found";
+ profilePath.prepend(QString("%1/.mozilla/firefox/").arg(QDir::homePath()));
+ m_dbFile = profilePath + "/places.sqlite";
+ grp.writeEntry("dbfile", m_dbFile);
+ }
+ m_db = QSqlDatabase::addDatabase("QSQLITE");
+ m_db.setHostName("localhost");
+ } else {
+ kDebug(kdbg_code) << "SQLITE driver isn't available";
+ m_db = QSqlDatabase();
+ }
+}
diff --git a/plasma/generic/runners/bookmarks/browsers/firefox.h \
b/plasma/generic/runners/bookmarks/browsers/firefox.h new file mode 100644
index 0000000..b42c370
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/browsers/firefox.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef FIREFOX_H
+#define FIREFOX_H
+
+#include <QSqlDatabase>
+#include "browser.h"
+
+class KJob;
+class Firefox : public Browser
+{
+ Q_OBJECT
+public:
+ explicit Firefox(QObject *parent = 0);
+ virtual QList<BookmarkMatch> match(const QString& term, bool addEverything);
+ virtual ~Firefox();
+private:
+ virtual void reloadConfiguration();
+ QString m_dbFile;
+ QString m_dbCacheFile;
+ QSqlDatabase m_db;
+ bool m_dbOK;
+
+
+public slots:
+ virtual void teardown();
+ virtual void prepare();
+
+private slots:
+ void dbCopied(KJob *);
+};
+
+#endif // FIREFOX_H
diff --git a/plasma/generic/runners/bookmarks/browsers/kdebrowser.cpp \
b/plasma/generic/runners/bookmarks/browsers/kdebrowser.cpp new file mode 100644
index 0000000..afa460a
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/browsers/kdebrowser.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kdebrowser.h"
+#include <KBookmarkManager>
+#include <QStack>
+#include <QIcon>
+#include "bookmarkmatch.h"
+#include <KUrl>
+
+KDEBrowser::KDEBrowser(QObject *parent) :
+ Browser(parent), m_bookmarkManager(KBookmarkManager::userBookmarksManager())
+{
+}
+
+
+QList< BookmarkMatch > KDEBrowser::match(const QString& term, bool addEverything)
+{
+ KBookmarkGroup bookmarkGroup = m_bookmarkManager->root();
+
+ QList< BookmarkMatch > matches;
+ QStack<KBookmarkGroup> groups;
+
+ KBookmark bookmark = bookmarkGroup.first();
+ while (!bookmark.isNull()) {
+// if (!context.isValid()) {
+// return;
+// } TODO: restore?
+
+ if (bookmark.isSeparator()) {
+ bookmark = bookmarkGroup.next(bookmark);
+ continue;
+ }
+
+ if (bookmark.isGroup()) { // descend
+ //kDebug (kdbg_code) << "descending into" << bookmark.text();
+ groups.push(bookmarkGroup);
+ bookmarkGroup = bookmark.toGroup();
+ bookmark = bookmarkGroup.first();
+
+ while (bookmark.isNull() && !groups.isEmpty()) {
+// if (!context.isValid()) {
+// return;
+// } TODO: restore?
+
+ bookmark = bookmarkGroup;
+ bookmarkGroup = groups.pop();
+ bookmark = bookmarkGroup.next(bookmark);
+ }
+
+ continue;
+ }
+
+ BookmarkMatch bookmarkMatch(m_icon, term, bookmark.text(), \
bookmark.url().url() ); + bookmarkMatch.addTo(matches, addEverything);
+
+ bookmark = bookmarkGroup.next(bookmark);
+ while (bookmark.isNull() && !groups.isEmpty()) {
+// if (!context.isValid()) {
+// return;
+// } // TODO: restore?
+
+ bookmark = bookmarkGroup;
+ bookmarkGroup = groups.pop();
+ //kDebug(kdbg_code) << "ascending from" << bookmark.text() << "to" << \
bookmarkGroup.text(); + bookmark = bookmarkGroup.next(bookmark);
+ }
+ }
+ return matches;
+}
diff --git a/plasma/generic/runners/bookmarks/browsers/kdebrowser.h \
b/plasma/generic/runners/bookmarks/browsers/kdebrowser.h new file mode 100644
index 0000000..71d0ffd
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/browsers/kdebrowser.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KDEBROWSER_H
+#define KDEBROWSER_H
+
+#include "browser.h"
+class KBookmarkManager;
+class KDEBrowser : public Browser
+{
+ Q_OBJECT
+public:
+ explicit KDEBrowser(QObject *parent = 0);
+ virtual QList<BookmarkMatch> match(const QString& term, bool addEverything);
+private:
+ KBookmarkManager * const m_bookmarkManager;
+
+};
+
+#endif // KDEBROWSER_H
diff --git a/plasma/generic/runners/bookmarks/browsers/opera.cpp \
b/plasma/generic/runners/bookmarks/browsers/opera.cpp new file mode 100644
index 0000000..6af2a47
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/browsers/opera.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "opera.h"
+#include <KDebug>
+#include "bookmarksrunner_defs.h"
+#include <QDir>
+#include <QFile>
+
+QList<BookmarkMatch> Opera::match( const QString& term, bool addEverything )
+{
+ QList<BookmarkMatch> matches;
+
+ QLatin1String nameStart("\tNAME=");
+ QLatin1String urlStart("\tURL=");
+ QLatin1String descriptionStart("\tDESCRIPTION=");
+
+ // search
+ foreach (const QString & entry, m_operaBookmarkEntries) {
+ QStringList entryLines = entry.split("\n");
+ if (!entryLines.first().startsWith(QString("#URL"))) {
+ continue; // skip folder entries
+ }
+ entryLines.pop_front();
+
+ QString name;
+ QString url;
+ QString description;
+
+ foreach (const QString & line, entryLines) {
+ if (line.startsWith(nameStart)) {
+ name = line.mid( QString(nameStart).length() ).simplified();
+ } else if (line.startsWith(urlStart)) {
+ url = line.mid( QString(urlStart).length() ).simplified();
+ } else if (line.startsWith(descriptionStart)) {
+ description = line.mid(QString(descriptionStart).length())
+ .simplified();
+ }
+ }
+
+ BookmarkMatch bookmarkMatch(m_icon, term, name, url, description);
+ bookmarkMatch.addTo(matches, addEverything);
+ }
+ return matches;
+}
+
+Opera::Opera(QObject* parent): Browser(parent)
+{
+
+}
+
+void Opera::prepare()
+{
+ // open bookmarks file
+ QString operaBookmarksFilePath = QDir::homePath() + "/.opera/bookmarks.adr";
+ QFile operaBookmarksFile(operaBookmarksFilePath);
+ if (!operaBookmarksFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ kDebug(kdbg_code) << "Could not open Operas Bookmark File " + \
operaBookmarksFilePath; + return;
+ }
+
+ // check format
+ QString firstLine = operaBookmarksFile.readLine();
+ if (firstLine.compare("Opera Hotlist version 2.0\n")) {
+ kDebug(kdbg_code) << "Format of Opera Bookmarks File might have \
changed."; + }
+ operaBookmarksFile.readLine(); // skip options line ("Options: encoding = \
utf8, version=3") + operaBookmarksFile.readLine(); // skip empty line
+
+ // load contents
+ QString contents = operaBookmarksFile.readAll();
+ m_operaBookmarkEntries = contents.split("\n\n", QString::SkipEmptyParts);
+
+ // close file
+ operaBookmarksFile.close();
+}
+
+void Opera::teardown()
+{
+ m_operaBookmarkEntries.clear();
+}
+
diff --git a/plasma/generic/runners/bookmarks/browsers/opera.h \
b/plasma/generic/runners/bookmarks/browsers/opera.h new file mode 100644
index 0000000..3b6a08e
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/browsers/opera.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+
+#ifndef OPERA_H
+#define OPERA_H
+
+#include "browser.h"
+#include <QStringList>
+
+class Opera : public Browser
+{
+
+public:
+ virtual QList<BookmarkMatch> match(const QString& term, bool addEverything);
+ Opera(QObject* parent = 0);
+ virtual void prepare();
+ virtual void teardown();
+private:
+ QStringList m_operaBookmarkEntries;
+};
+
+#endif // OPERA_H
diff --git a/plasma/generic/runners/bookmarks/plasma-runner-bookmarks.desktop \
b/plasma/generic/runners/bookmarks/plasma-runner-bookmarks.desktop index \
b752591..32c12f3 100644
--- a/plasma/generic/runners/bookmarks/plasma-runner-bookmarks.desktop
+++ b/plasma/generic/runners/bookmarks/plasma-runner-bookmarks.desktop
@@ -150,10 +150,10 @@ X-KDE-ServiceTypes=Plasma/Runner
Type=Service
Icon=bookmarks
X-KDE-Library=krunner_bookmarksrunner
-X-KDE-PluginInfo-Author=Glenn Ergeerts
-X-KDE-PluginInfo-Email=glenn.ergeerts@telenet.be
+X-KDE-PluginInfo-Author=Glenn Ergeerts, Marco Gulino
+X-KDE-PluginInfo-Email=glenn.ergeerts@telenet.be, marco.gulino@gmail.com
X-KDE-PluginInfo-Name=bookmarks
-X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Version=1.1
X-KDE-PluginInfo-License=LGPL
X-KDE-PluginInfo-EnabledByDefault=true
X-Plasma-AdvertiseSingleRunnerQueryMode=true
diff --git a/plasma/generic/runners/bookmarks/tests/CMakeLists.txt \
b/plasma/generic/runners/bookmarks/tests/CMakeLists.txt new file mode 100644
index 0000000..c7bb1ed
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/tests/CMakeLists.txt
@@ -0,0 +1,13 @@
+enable_testing()
+set( testChromeBookmarks_SRCS testchromebookmarks.cpp
+ ../browsers/chrome.cpp
+ ../browser.cpp
+ ../browsers/firefox.cpp
+ ../browsers/kdebrowser.cpp
+ ../browsers/opera.cpp
+ ../browsers/chromebookmarksfinder.cpp
+)
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/.. )
+kde4_add_unit_test( testChromeBookmarks TESTNAME TestChromeBookmarks \
${testChromeBookmarks_SRCS} ) +
+target_link_libraries( testChromeBookmarks ${KDE4_KDECORE_LIBS} ${QT_QTTEST_LIBRARY} \
${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} )
diff --git a/plasma/generic/runners/bookmarks/tests/testchromebookmarks.cpp \
b/plasma/generic/runners/bookmarks/tests/testchromebookmarks.cpp new file mode 100644
index 0000000..66050eb
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/tests/testchromebookmarks.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "testchromebookmarks.h"
+#include <QTest>
+#include <QDir>
+#include "browsers/chrome.h"
+#include "browsers/chromebookmarksfinder.h"
+
+void TestChromeBookmarks::testBookmarksFinder()
+{
+ ChromeBookmarksFinder findChrome("chrome");
+ QString actualTemplate = \
QString("%1/.config/%2/Default/Bookmarks").arg(QDir::homePath()); + \
QCOMPARE(findChrome.find(), QStringList(actualTemplate.arg("chrome"))); + \
ChromeBookmarksFinder findChromium("chromium"); + QCOMPARE(findChromium.find(), \
QStringList(actualTemplate.arg("chromium"))); +}
+
+
+void TestChromeBookmarks::testFindBookmarks()
+{
+ FakeBookmarksFinder finder(QStringList("Bookmarks"));
+
+ Chrome *chrome = new Chrome(&finder, this);
+}
+
+#include "testchromebookmarks.moc"
+
+QTEST_MAIN(TestChromeBookmarks);
diff --git a/plasma/generic/runners/bookmarks/tests/testchromebookmarks.h \
b/plasma/generic/runners/bookmarks/tests/testchromebookmarks.h new file mode 100644
index 0000000..1a7b178
--- /dev/null
+++ b/plasma/generic/runners/bookmarks/tests/testchromebookmarks.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
+ * Copyright 2012 Glenn Ergeerts <marco.gulino@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef TESTCHROMEBOOKMARKS_H
+#define TESTCHROMEBOOKMARKS_H
+
+#include <QObject>
+#include "browsers/bookmarksfinder.h"
+
+class FakeBookmarksFinder : public BookmarksFinder {
+public:
+ FakeBookmarksFinder(const QStringList &bookmarks) : m_bookmarks(bookmarks) {}
+ virtual QStringList find() { return m_bookmarks; }
+private:
+ QStringList m_bookmarks;
+};
+
+class TestChromeBookmarks : public QObject
+{
+Q_OBJECT
+public:
+ explicit TestChromeBookmarks(QObject* parent = 0) : QObject(parent) {}
+
+private slots:
+ void testBookmarksFinder();
+ void testFindBookmarks();
+};
+
+#endif // TESTCHROMEBOOKMARKS_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic