summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Chauvin <megabigbug@yahoo.fr>2011-01-24 22:45:53 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-01-24 22:45:53 +0100
commit8a848ea5c4d3c82cd93abc05f270d10d92ccfb42 (patch)
treea70027bb14769ad3c99cac62caa85db0b1723c6b
parentThis evening I started working again on this bug. I did all the tests against... (diff)
downloadrekonq-8a848ea5c4d3c82cd93abc05f270d10d92ccfb42.tar.xz
If a cached suggestion is older than one week, it is downloaded again, allowing cache
to be updated. Reviewed and merged by me :)
-rw-r--r--src/opensearch/opensearchengine.cpp5
1 files changed, 4 insertions, 1 deletions
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 <QtCore/QRegExp>
#include <QtCore/QFile>
+#include <QtCore/QFileInfo>
+#include <QtCore/QDateTime>
// KDE Includes
#include <KStandardDirs>
@@ -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;
}