mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Automatically clear old icons and VACUUM database every 20 runs
This commit is contained in:
parent
5d2ffc30d1
commit
b5b2bf6a0b
|
@ -677,7 +677,7 @@ void MainApplication::postLaunch()
|
|||
|
||||
QtWin::createJumpList();
|
||||
|
||||
QTimer::singleShot(1000, this, SLOT(checkDefaultWebBrowser()));
|
||||
QTimer::singleShot(5000, this, &MainApplication::runDeferredPostLaunchActions);
|
||||
}
|
||||
|
||||
void MainApplication::saveSession()
|
||||
|
@ -828,6 +828,12 @@ void MainApplication::onFocusChanged()
|
|||
}
|
||||
}
|
||||
|
||||
void MainApplication::runDeferredPostLaunchActions()
|
||||
{
|
||||
checkDefaultWebBrowser();
|
||||
checkOptimizeDatabase();
|
||||
}
|
||||
|
||||
void MainApplication::downloadRequested(QWebEngineDownloadItem *download)
|
||||
{
|
||||
downloadManager()->download(download);
|
||||
|
@ -1067,6 +1073,22 @@ void MainApplication::checkDefaultWebBrowser()
|
|||
#endif
|
||||
}
|
||||
|
||||
void MainApplication::checkOptimizeDatabase()
|
||||
{
|
||||
Settings settings;
|
||||
settings.beginGroup(QSL("Browser"));
|
||||
const int numberOfRuns = settings.value(QSL("RunsWithoutOptimizeDb"), 0).toInt();
|
||||
settings.setValue(QSL("RunsWithoutOptimizeDb"), numberOfRuns + 1);
|
||||
|
||||
if (numberOfRuns > 20) {
|
||||
std::cout << "Optimizing database..." << std::endl;
|
||||
IconProvider::instance()->clearOldIconsInDatabase();
|
||||
settings.setValue(QSL("RunsWithoutOptimizeDb"), 0);
|
||||
}
|
||||
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
void MainApplication::setUserStyleSheet(const QString &filePath)
|
||||
{
|
||||
QString userCss;
|
||||
|
|
|
@ -129,7 +129,7 @@ private slots:
|
|||
void messageReceived(const QString &message);
|
||||
void windowDestroyed(QObject* window);
|
||||
void onFocusChanged();
|
||||
void checkDefaultWebBrowser();
|
||||
void runDeferredPostLaunchActions();
|
||||
|
||||
void downloadRequested(QWebEngineDownloadItem *download);
|
||||
|
||||
|
@ -148,6 +148,9 @@ private:
|
|||
|
||||
void setUserStyleSheet(const QString &filePath);
|
||||
|
||||
void checkDefaultWebBrowser();
|
||||
void checkOptimizeDatabase();
|
||||
|
||||
bool m_isPrivate;
|
||||
bool m_isPortable;
|
||||
bool m_isClosing;
|
||||
|
|
Loading…
Reference in New Issue
Block a user