From 963853f94a8eff8b1b8973ddd7e6f1185883feab Mon Sep 17 00:00:00 2001 From: Don Sanders Date: Fri, 3 Jun 2011 11:57:37 +0300 Subject: Fix for NB#259331 - does not show new emails immediately Patch from Eric. --- CHANGES | 1 + src/libraries/qmfclient/support/qmailnamespace.cpp | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 67d9f0b9..c591a37e 100644 --- a/CHANGES +++ b/CHANGES @@ -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(); } -- cgit v1.2.3