diff --git a/src/torrentpersistentdata.cpp b/src/torrentpersistentdata.cpp index 569dcb3dc..5144a7a4c 100644 --- a/src/torrentpersistentdata.cpp +++ b/src/torrentpersistentdata.cpp @@ -30,6 +30,7 @@ #include "torrentpersistentdata.h" +#include #include #include @@ -247,7 +248,7 @@ QDateTime TorrentPersistentData::getAddedDate(const QString &hash) { const QHash data = all_data.value(hash).toHash(); QDateTime dt = data.value("add_date").toDateTime(); if (!dt.isValid()) { - setAddedDate(hash); + setAddedDate(hash, QDateTime::currentDateTime()); dt = QDateTime::currentDateTime(); } return dt; @@ -312,7 +313,7 @@ void TorrentPersistentData::saveTorrentPersistentData(const QTorrentHandle &h, c settings.setValue("torrents", all_data); qDebug("TorrentPersistentData: Saving save_path %s, hash: %s", qPrintable(h.save_path()), qPrintable(h.hash())); // Set Added date - setAddedDate(h.hash()); + setAddedDate(h.hash(), QDateTime::currentDateTime()); // Finally, remove temp data TorrentTempData::deleteTempData(h.hash()); } diff --git a/src/torrentpersistentdata.h b/src/torrentpersistentdata.h index 56d02ec3a..b5ef335bb 100644 --- a/src/torrentpersistentdata.h +++ b/src/torrentpersistentdata.h @@ -31,11 +31,14 @@ #ifndef TORRENTPERSISTENTDATA_H #define TORRENTPERSISTENTDATA_H -#include #include #include #include +QT_BEGIN_NAMESPACE +class QDateTime; +QT_END_NAMESPACE + class QTorrentHandle; class TorrentTempData { @@ -119,7 +122,7 @@ public: static void setRatioLimit(const QString &hash, const qreal &ratio); static qreal getRatioLimit(const QString &hash); static bool hasPerTorrentRatioLimit() ; - static void setAddedDate(const QString &hash, const QDateTime &time = QDateTime::currentDateTime()); + static void setAddedDate(const QString &hash, const QDateTime &time); static QDateTime getAddedDate(const QString &hash); static void setErrorState(const QString &hash, const bool has_error); static bool hasError(const QString &hash);