Changeset View
Changeset View
Standalone View
Standalone View
runners/bookmarks/browsers/firefox.cpp
Show All 31 Lines | |||||
32 | 32 | | |||
33 | Firefox::Firefox(QObject *parent) : | 33 | Firefox::Firefox(QObject *parent) : | ||
34 | QObject(parent), | 34 | QObject(parent), | ||
35 | m_favicon(new FallbackFavicon(this)), | 35 | m_favicon(new FallbackFavicon(this)), | ||
36 | m_fetchsqlite(nullptr), | 36 | m_fetchsqlite(nullptr), | ||
37 | m_fetchsqlite_fav(nullptr) | 37 | m_fetchsqlite_fav(nullptr) | ||
38 | { | 38 | { | ||
39 | reloadConfiguration(); | 39 | reloadConfiguration(); | ||
40 | m_dbCacheFile = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) | ||||
41 | + QStringLiteral("/bookmarkrunnerfirefoxdbfile.sqlite"); | ||||
42 | m_dbCacheFile_fav = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) | ||||
43 | + QStringLiteral("/bookmarkrunnerfirefoxfavdbfile.sqlite"); | ||||
40 | } | 44 | } | ||
41 | 45 | | |||
42 | Firefox::~Firefox() | 46 | Firefox::~Firefox() | ||
43 | { | 47 | { | ||
44 | if (!m_dbCacheFile.isEmpty()) { | 48 | // Delete the cached databases | ||
49 | if (!m_dbFile.isEmpty()) { | ||||
45 | QFile db_CacheFile(m_dbCacheFile); | 50 | QFile db_CacheFile(m_dbCacheFile); | ||
46 | if (db_CacheFile.exists()) { | 51 | if (db_CacheFile.exists()) { | ||
47 | //qDebug() << "Cache file was removed: " << db_CacheFile.remove(); | 52 | db_CacheFile.remove(); | ||
53 | } | ||||
54 | } | ||||
55 | if (!m_dbFile_fav.isEmpty()) { | ||||
56 | QFile db_CacheFileFav(m_dbCacheFile_fav); | ||||
57 | if (db_CacheFileFav.exists()) { | ||||
58 | db_CacheFileFav.remove(); | ||||
48 | } | 59 | } | ||
49 | } | 60 | } | ||
50 | //qDebug() << "Deleted Firefox Bookmarks Browser"; | | |||
51 | } | 61 | } | ||
52 | 62 | | |||
53 | void Firefox::prepare() | 63 | void Firefox::prepare() | ||
54 | { | 64 | { | ||
55 | if (m_dbCacheFile.isEmpty()) { | 65 | if (updateCacheFile(m_dbFile, m_dbCacheFile) != Error) { | ||
56 | m_dbCacheFile = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) | 66 | m_fetchsqlite = new FetchSqlite(m_dbCacheFile); | ||
57 | + QStringLiteral("/bookmarkrunnerfirefoxdbfile.sqlite"); | | |||
58 | } | | |||
59 | if (m_dbCacheFile_fav.isEmpty()) { | | |||
60 | m_dbCacheFile_fav = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) | | |||
61 | + QStringLiteral("/bookmarkrunnerfirefoxfavdbfile.sqlite"); | | |||
62 | } | | |||
63 | if (!m_dbFile.isEmpty()) { | | |||
64 | m_fetchsqlite = new FetchSqlite(m_dbFile, m_dbCacheFile); | | |||
65 | m_fetchsqlite->prepare(); | 67 | m_fetchsqlite->prepare(); | ||
66 | } | 68 | } | ||
67 | if (!m_dbFile_fav.isEmpty()) { | 69 | if (updateCacheFile(m_dbFile_fav, m_dbCacheFile_fav) != Error) { | ||
68 | m_fetchsqlite_fav = new FetchSqlite(m_dbFile_fav, m_dbCacheFile_fav); | 70 | m_fetchsqlite_fav = new FetchSqlite(m_dbCacheFile_fav); | ||
meven: Maybe add a if block | |||||
69 | m_fetchsqlite_fav->prepare(); | 71 | m_fetchsqlite_fav->prepare(); | ||
70 | 72 | | |||
71 | delete m_favicon; | 73 | delete m_favicon; | ||
72 | m_favicon = nullptr; | 74 | m_favicon = nullptr; | ||
73 | 75 | | |||
74 | m_favicon = FaviconFromBlob::firefox(m_fetchsqlite_fav, this); | 76 | m_favicon = FaviconFromBlob::firefox(m_fetchsqlite_fav, this); | ||
75 | } | 77 | } | ||
76 | } | 78 | } | ||
▲ Show 20 Lines • Show All 134 Lines • Show Last 20 Lines |
Maybe add a if block