From 8a848ea5c4d3c82cd93abc05f270d10d92ccfb42 Mon Sep 17 00:00:00 2001 From: Lionel Chauvin Date: Mon, 24 Jan 2011 22:45:53 +0100 Subject: If a cached suggestion is older than one week, it is downloaded again, allowing cache to be updated. Reviewed and merged by me :) --- src/opensearch/opensearchengine.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/opensearch/opensearchengine.cpp b/src/opensearch/opensearchengine.cpp index 15228455..926a9976 100644 --- a/src/opensearch/opensearchengine.cpp +++ b/src/opensearch/opensearchengine.cpp @@ -35,6 +35,8 @@ // Qt Includes #include #include +#include +#include // KDE Includes #include @@ -286,7 +288,8 @@ QString OpenSearchEngine::suggestionPathFor(const QString &searchTerm) bool OpenSearchEngine::hasCachedSuggestionsFor(const QString &searchTerm) { - return QFile::exists(suggestionPathFor(searchTerm)); + QFileInfo info(suggestionPathFor(searchTerm)); + return info.exists() && info.lastModified().daysTo(QDateTime::currentDateTime()) < 7; } -- cgit v1.2.1