diff options
author | Don Sanders <don.sanders@nokia.com> | 2011-06-03 11:57:37 +0300 |
---|---|---|
committer | Don Sanders <don.sanders@nokia.com> | 2011-06-03 11:57:37 +0300 |
commit | 963853f94a8eff8b1b8973ddd7e6f1185883feab (patch) | |
tree | cb8a77e82afc86f4d889065f2e405d1a5dbaa7d5 | |
parent | 5c3347ccbdd493f5cb61bb6501df953bec6fb1ef (diff) |
Fix for NB#259331 - does not show new emails immediately
Patch from Eric.
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | src/libraries/qmfclient/support/qmailnamespace.cpp | 20 |
2 files changed, 18 insertions, 3 deletions
@@ -2,6 +2,7 @@ Latest Changes --------------- 201122 + * Fixes: NB#259331 Does not show new emails immediately * Fixes: NB#249858 Random crash observed with assert 201121 diff --git a/src/libraries/qmfclient/support/qmailnamespace.cpp b/src/libraries/qmfclient/support/qmailnamespace.cpp index 56256475..368f9479 100644 --- a/src/libraries/qmfclient/support/qmailnamespace.cpp +++ b/src/libraries/qmfclient/support/qmailnamespace.cpp @@ -235,11 +235,25 @@ QString QMail::dataPath() */ QDateTime QMail::lastDbUpdated() { - static QString path(dataPath() + "database/qmailstore.db"); - QFileInfo info(path); + static QString database_path(dataPath() + "database"); + QDir dir(database_path); + + if (!dir.exists()) { + qWarning() << Q_FUNC_INFO << " database dir doesn't exist"; + return QDateTime(); + } + + QStringList entries(dir.entryList(QDir::NoFilter, QDir::Time)); + + if (entries.empty()) { + qWarning() << Q_FUNC_INFO << " found nothing in database dir"; + return QDateTime(); + } + + QFileInfo info(dir, entries.first()); if (!info.exists()) { - qWarning() << Q_FUNC_INFO << "Store file does not exist"; + qWarning() << Q_FUNC_INFO << "Could not open file we just found?"; return QDateTime(); } |