1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

ClearPrivateData: Delete old favicons in Optimize DB option

This should help anyone having issues with slow loading of bookmarks
or searching in locationbar.
This commit is contained in:
David Rosca 2014-10-14 17:46:52 +02:00
parent e5065185fd
commit 1a54cda705

View File

@ -174,7 +174,16 @@ void ClearPrivateData::optimizeDb()
const QString profilePath = DataPaths::currentProfilePath();
QString sizeBefore = QzTools::fileSizeToString(QFileInfo(profilePath + "/browsedata.db").size());
mApp->history()->optimizeHistory();
// Delete icons for entries older than 6 months
const QDateTime date = QDateTime::currentDateTime().addMonths(-6);
QSqlQuery query;
query.prepare(QSL("DELETE FROM icons WHERE id IN (SELECT id FROM history WHERE date < ?)"));
query.addBindValue(date.toMSecsSinceEpoch());
query.exec();
query.clear();
query.exec(QSL("VACUUM"));
QString sizeAfter = QzTools::fileSizeToString(QFileInfo(profilePath + "/browsedata.db").size());