Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Workspace
Commits
35eb251d
Commit
35eb251d
authored
Mar 18, 2021
by
Alexander Lohnau
💬
Browse files
bookmarksrunner: Apply improvements based on review
parent
ab2776f1
Changes
6
Hide whitespace changes
Inline
Side-by-side
runners/bookmarks/autotests/CMakeLists.txt
View file @
35eb251d
...
...
@@ -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
...
...
runners/bookmarks/autotests/bookmarksmatchtest.cpp
View file @
35eb251d
...
...
@@ -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"
runners/bookmarks/autotests/firefox/testfirefoxbookmarks.cpp
View file @
35eb251d
...
...
@@ -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
()
...
...
runners/bookmarks/browserfactory.cpp
View file @
35eb251d
...
...
@@ -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
))
{
...
...
runners/bookmarks/browsers/firefox.cpp
View file @
35eb251d
...
...
@@ -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
);
}
...
...
runners/bookmarks/browsers/firefox.h
View file @
35eb251d
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment