Commit 35eb251d authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

bookmarksrunner: Apply improvements based on review

parent ab2776f1
......@@ -4,9 +4,8 @@
include(ECMAddTests)
ecm_add_test(chrome/testchromebookmarks.cpp TEST_NAME testChromeBookmarks
LINK_LIBRARIES Qt::Test krunner_bookmarks_common
LINK_LIBRARIES Qt::Test krunner_bookmarks_common
)
file(COPY chrome/chrome-config-home DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/chrome/)
ecm_add_test(firefox/testfirefoxbookmarks.cpp TEST_NAME testFirefoxBookmarks
LINK_LIBRARIES Qt::Test krunner_bookmarks_common
......
......@@ -14,13 +14,7 @@ class TestBookmarksMatch : public QObject
{
Q_OBJECT
public:
explicit TestBookmarksMatch(QObject *parent = nullptr)
: QObject(parent)
{
}
private:
Firefox *m_firefox;
using QObject::QObject;
private Q_SLOTS:
void testQueryMatchConversion();
......@@ -84,4 +78,4 @@ void TestBookmarksMatch::testAddToList()
QTEST_MAIN(TestBookmarksMatch)
#include "bookmarksmatchtest.moc"
\ No newline at end of file
#include "bookmarksmatchtest.moc"
......@@ -13,13 +13,10 @@ class TestBookmarksMatch : public QObject
{
Q_OBJECT
public:
explicit TestBookmarksMatch(QObject *parent = nullptr)
: QObject(parent)
{
}
using QObject::QObject;
private:
Firefox *m_firefox;
Firefox *m_firefox = nullptr;
private Q_SLOTS:
void initTestCase();
......@@ -31,7 +28,7 @@ private Q_SLOTS:
void TestBookmarksMatch::initTestCase()
{
QStandardPaths::setTestModeEnabled(true);
m_firefox = new Firefox(this, QFINDTESTDATA("firefox-config-home"));
m_firefox = new Firefox(QFINDTESTDATA("firefox-config-home"), this);
}
void TestBookmarksMatch::testAllBookmarks()
......
......@@ -35,7 +35,7 @@ Browser *BrowserFactory::find(const QString &browserName, QObject *parent)
delete m_previousBrowser;
m_previousBrowserName = browserName;
if (browserName.contains(QLatin1String("firefox"), Qt::CaseInsensitive) || browserName.contains(QLatin1String("iceweasel"), Qt::CaseInsensitive)) {
m_previousBrowser = new Firefox(parent);
m_previousBrowser = new Firefox(QDir::homePath() + QStringLiteral("/.mozilla/firefox"), parent);
} else if (browserName.contains(QLatin1String("opera"), Qt::CaseInsensitive)) {
m_previousBrowser = new Opera(parent);
} else if (browserName.contains(QLatin1String("chrome"), Qt::CaseInsensitive)) {
......
......@@ -30,14 +30,14 @@
#include <QFile>
#include <QRegularExpression>
Firefox::Firefox(QObject *parent, const QString &firefoxConfigDir)
Firefox::Firefox(const QString &firefoxConfigDir, QObject *parent)
: QObject(parent)
, m_dbCacheFile(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/bookmarkrunnerfirefoxdbfile.sqlite"))
, m_dbCacheFile_fav(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/bookmarkrunnerfirefoxfavdbfile.sqlite"))
, m_favicon(new FallbackFavicon(this))
, m_fetchsqlite(nullptr)
, m_fetchsqlite_fav(nullptr)
{
m_dbCacheFile = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/bookmarkrunnerfirefoxdbfile.sqlite");
m_dbCacheFile_fav = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/bookmarkrunnerfirefoxfavdbfile.sqlite");
init(firefoxConfigDir);
}
......
......@@ -31,7 +31,7 @@ class Firefox : public QObject, public Browser
{
Q_OBJECT
public:
explicit Firefox(QObject *parent = nullptr, const QString &firefoxConfigDir = QDir::homePath() + QStringLiteral("/.mozilla/firefox"));
explicit Firefox(const QString &firefoxConfigDir, QObject *parent = nullptr);
~Firefox() override;
QList<BookmarkMatch> match(const QString &term, bool addEverything) override;
public Q_SLOTS:
......@@ -42,8 +42,8 @@ private:
void init(const QString &firefoxConfigDir);
QString m_dbFile;
QString m_dbFile_fav;
QString m_dbCacheFile;
QString m_dbCacheFile_fav;
const QString m_dbCacheFile;
const QString m_dbCacheFile_fav;
Favicon *m_favicon;
FetchSqlite *m_fetchsqlite;
FetchSqlite *m_fetchsqlite_fav;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment