diff --git a/gwenview/importer/filenameformater.cpp b/gwenview/importer/filenameformater.cpp index 2dd249d2..65368073 100644 --- a/gwenview/importer/filenameformater.cpp +++ b/gwenview/importer/filenameformater.cpp @@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA #include // KDE -#include #include #include @@ -52,7 +51,7 @@ FileNameFormater::~FileNameFormater() delete d; } -QString FileNameFormater::format(const KUrl& url, const KDateTime& dateTime) +QString FileNameFormater::format(const KUrl& url, const QDateTime& dateTime) { QFileInfo info(url.fileName()); diff --git a/gwenview/importer/filenameformater.h b/gwenview/importer/filenameformater.h index 291f7f3b..7b40c1ec 100644 --- a/gwenview/importer/filenameformater.h +++ b/gwenview/importer/filenameformater.h @@ -23,14 +23,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA // Qt #include +#include +#include // KDE // Local -#include - -class KDateTime; class KUrl; namespace Gwenview @@ -49,7 +48,7 @@ public: * Given an url and its dateTime, returns a filename according to the * format passed to the constructor */ - QString format(const KUrl& url, const KDateTime& dateTime); + QString format(const KUrl& url, const QDateTime& dateTime); /** * Returns a map whose keys are the available keywords and values are the diff --git a/gwenview/importer/importer.cpp b/gwenview/importer/importer.cpp index 50a0fa72..d567d5b8 100644 --- a/gwenview/importer/importer.cpp +++ b/gwenview/importer/importer.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA // Qt // KDE -#include #include #include #include @@ -118,7 +117,7 @@ struct ImporterPrivate // 'src' url is temporary: if we import "foo/image.jpg" and // "bar/image.jpg", both images will be temporarily saved in the // 'src' url. - KDateTime dateTime = TimeUtils::dateTimeForFileItem(item, TimeUtils::SkipCache); + QDateTime dateTime = TimeUtils::dateTimeForFileItem(item, TimeUtils::SkipCache); fileName = mFileNameFormater->format(src, dateTime); } else { fileName = src.fileName(); diff --git a/gwenview/importer/importerconfigdialog.cpp b/gwenview/importer/importerconfigdialog.cpp index 1b7d93f2..b08ab9d5 100644 --- a/gwenview/importer/importerconfigdialog.cpp +++ b/gwenview/importer/importerconfigdialog.cpp @@ -23,9 +23,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA // Qt #include +#include // KDE -#include #include // Local @@ -37,7 +37,7 @@ namespace Gwenview { static const QString PREVIEW_FILENAME = "PICT0012.JPG"; -static const KDateTime PREVIEW_DATETIME = KDateTime(QDate(2009, 10, 25), QTime(17, 51, 18)); +static const QDateTime PREVIEW_DATETIME = QDateTime(QDate(2009, 10, 25), QTime(17, 51, 18)); struct ImporterConfigDialogPrivate : public Ui_ImporterConfigDialog { diff --git a/gwenview/lib/sorteddirmodel.cpp b/gwenview/lib/sorteddirmodel.cpp index 08644dcc..5cb9aad8 100644 --- a/gwenview/lib/sorteddirmodel.cpp +++ b/gwenview/lib/sorteddirmodel.cpp @@ -21,10 +21,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Qt #include +#include // KDE #include -#include #include // Local @@ -224,9 +224,8 @@ bool SortedDirModel::lessThan(const QModelIndex& left, const QModelIndex& right) return KDirSortFilterProxyModel::lessThan(left, right); } - const KDateTime leftDate = TimeUtils::dateTimeForFileItem(leftItem); - const KDateTime rightDate = TimeUtils::dateTimeForFileItem(rightItem); - + const QDateTime leftDate = TimeUtils::dateTimeForFileItem(leftItem); + const QDateTime rightDate = TimeUtils::dateTimeForFileItem(rightItem); return leftDate < rightDate; } diff --git a/gwenview/lib/thumbnailview/previewitemdelegate.cpp b/gwenview/lib/thumbnailview/previewitemdelegate.cpp index eb73bbfc..b93e640f 100644 --- a/gwenview/lib/thumbnailview/previewitemdelegate.cpp +++ b/gwenview/lib/thumbnailview/previewitemdelegate.cpp @@ -591,7 +591,7 @@ void PreviewItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem & } if (!isDir && (d->mDetails & PreviewItemDelegate::DateDetail)) { - const KDateTime dt = TimeUtils::dateTimeForFileItem(fileItem); + const QDateTime dt = TimeUtils::dateTimeForFileItem(fileItem); d->drawText(painter, textRect, fgColor, KGlobal::locale()->formatDateTime(dt)); textRect.moveTop(textRect.bottom()); } diff --git a/gwenview/lib/thumbnailview/thumbnailview.cpp b/gwenview/lib/thumbnailview/thumbnailview.cpp index 9d35b08d..a04facdb 100644 --- a/gwenview/lib/thumbnailview/thumbnailview.cpp +++ b/gwenview/lib/thumbnailview/thumbnailview.cpp @@ -79,7 +79,7 @@ static KUrl urlForIndex(const QModelIndex& index) struct Thumbnail { - Thumbnail(const QPersistentModelIndex& index_, const KDateTime& mtime) + Thumbnail(const QPersistentModelIndex& index_, const QDateTime& mtime) : mIndex(index_) , mModificationTime(mtime) , mRough(true) @@ -117,7 +117,7 @@ struct Thumbnail return groupSize == qMax(mFullSize.width(), mFullSize.height()); } - void prepareForRefresh(const KDateTime& mtime) + void prepareForRefresh(const QDateTime& mtime) { mModificationTime = mtime; mGroupPix = QPixmap(); @@ -129,7 +129,7 @@ struct Thumbnail } QPersistentModelIndex mIndex; - KDateTime mModificationTime; + QDateTime mModificationTime; /// The pix loaded from .thumbnails/{large,normal} QPixmap mGroupPix; /// Scaled version of mGroupPix, adjusted to ThumbnailView::thumbnailSize @@ -208,7 +208,7 @@ struct ThumbnailViewPrivate QPixmap pix; QSize fullSize; mDocumentInfoProvider->thumbnailForDocument(url, group, &pix, &fullSize); - mThumbnailForUrl[url] = Thumbnail(QPersistentModelIndex(index), KDateTime::currentLocalDateTime()); + mThumbnailForUrl[url] = Thumbnail(QPersistentModelIndex(index), QDateTime::currentDateTime()); q->setThumbnail(item, pix); } @@ -485,7 +485,7 @@ void ThumbnailView::dataChanged(const QModelIndex& topLeft, const QModelIndex& b // result this method will also be called for views which are not // currently visible, and do not yet have a thumbnail for the // modified url. - KDateTime mtime = item.time(KFileItem::ModificationTime); + QDateTime mtime = item.time(KFileItem::ModificationTime); if (it->mModificationTime != mtime) { // dataChanged() is called when the file changes but also when // the model fetched additional data such as semantic info. To diff --git a/gwenview/lib/timeutils.cpp b/gwenview/lib/timeutils.cpp index 7d396cae..d0816982 100644 --- a/gwenview/lib/timeutils.cpp +++ b/gwenview/lib/timeutils.cpp @@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA #include // KDE -#include #include #include #include @@ -41,12 +40,12 @@ namespace TimeUtils struct CacheItem { - KDateTime fileMTime; - KDateTime realTime; + QDateTime fileMTime; + QDateTime realTime; void update(const KFileItem& fileItem) { - KDateTime time = fileItem.time(KFileItem::ModificationTime); + QDateTime time = fileItem.time(KFileItem::ModificationTime); if (fileMTime == time) { return; } @@ -89,7 +88,7 @@ struct CacheItem return false; } - KDateTime dt = KDateTime::fromString(exifvalue, "yyyy:MM:dd hh:mm:ss"); + QDateTime dt = QDateTime::fromString(exifvalue, "yyyy:MM:dd hh:mm:ss"); if (!dt.isValid()) { kWarning() << "Invalid date in exif header of" << path << exifvalue; return false; @@ -102,7 +101,7 @@ struct CacheItem typedef QHash Cache; -KDateTime dateTimeForFileItem(const KFileItem& fileItem, CachePolicy cachePolicy) +QDateTime dateTimeForFileItem(const KFileItem& fileItem, CachePolicy cachePolicy) { if (cachePolicy == SkipCache) { CacheItem item; diff --git a/gwenview/lib/timeutils.h b/gwenview/lib/timeutils.h index 198e48be..35abceff 100644 --- a/gwenview/lib/timeutils.h +++ b/gwenview/lib/timeutils.h @@ -21,11 +21,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA #ifndef TIMEUTILS_H #define TIMEUTILS_H +#include + // Local #include class KFileItem; -class KDateTime; namespace Gwenview { @@ -39,7 +40,7 @@ enum CachePolicy UseCache }; -GWENVIEWLIB_EXPORT KDateTime dateTimeForFileItem(const KFileItem&, CachePolicy cachePolicy = UseCache); +GWENVIEWLIB_EXPORT QDateTime dateTimeForFileItem(const KFileItem&, CachePolicy cachePolicy = UseCache); } // namespace diff --git a/gwenview/tests/auto/importertest.cpp b/gwenview/tests/auto/importertest.cpp index 4936f735..2b5bbc57 100644 --- a/gwenview/tests/auto/importertest.cpp +++ b/gwenview/tests/auto/importertest.cpp @@ -24,9 +24,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Qt #include +#include // KDE -#include #include #include @@ -183,7 +183,7 @@ void ImporterTest::testFileNameFormater() KUrl url = KUrl("file://foo/bar/" + fileName); FileNameFormater fileNameFormater(format); - QCOMPARE(fileNameFormater.format(url, KDateTime::fromString(dateTime, Qt::ISODate)), expected); + QCOMPARE(fileNameFormater.format(url, QDateTime::fromString(dateTime, Qt::ISODate)), expected); } #define NEW_ROW(fileName, dateTime, format, expected) QTest::newRow(fileName) << fileName << dateTime << format << expected diff --git a/gwenview/tests/auto/timeutilstest.cpp b/gwenview/tests/auto/timeutilstest.cpp index 8db3dd72..3590dc08 100644 --- a/gwenview/tests/auto/timeutilstest.cpp +++ b/gwenview/tests/auto/timeutilstest.cpp @@ -46,10 +46,10 @@ static void touchFile(const QString& path) void TimeUtilsTest::testBasic_data() { QTest::addColumn("fileName"); - QTest::addColumn("expectedDateTime"); + QTest::addColumn("expectedDateTime"); - NEW_ROW("date/exif-datetimeoriginal.jpg", KDateTime(KDateTime::fromString("2003-03-10T17:45:21", Qt::ISODate))); - NEW_ROW("date/exif-datetime-only.jpg", KDateTime(KDateTime::fromString("2003-03-25T02:02:21", Qt::ISODate))); + NEW_ROW("date/exif-datetimeoriginal.jpg", QDateTime::fromString("2003-03-10T17:45:21", Qt::ISODate)); + NEW_ROW("date/exif-datetime-only.jpg", QDateTime::fromString("2003-03-25T02:02:21", Qt::ISODate)); KUrl url = urlForTestFile("test.png"); KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url); @@ -59,8 +59,8 @@ void TimeUtilsTest::testBasic_data() void TimeUtilsTest::testBasic() { QFETCH(QString, fileName); - QFETCH(KDateTime, expectedDateTime); - KDateTime dateTime; + QFETCH(QDateTime, expectedDateTime); + QDateTime dateTime; KUrl url = urlForTestFile(fileName); KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url); @@ -77,14 +77,14 @@ void TimeUtilsTest::testCache() QVERIFY(tempFile.open()); KUrl url = KUrl::fromLocalFile(tempFile.fileName()); KFileItem item1(KFileItem::Unknown, KFileItem::Unknown, url); - KDateTime dateTime1 = TimeUtils::dateTimeForFileItem(item1); + QDateTime dateTime1 = TimeUtils::dateTimeForFileItem(item1); QCOMPARE(dateTime1, item1.time(KFileItem::ModificationTime)); QTest::qWait(1200); touchFile(url.toLocalFile()); KFileItem item2(KFileItem::Unknown, KFileItem::Unknown, url); - KDateTime dateTime2 = TimeUtils::dateTimeForFileItem(item2); + QDateTime dateTime2 = TimeUtils::dateTimeForFileItem(item2); QVERIFY(dateTime1 != dateTime2); diff --git a/kdeplasma-addons/runners/datetime/datetimerunner.cpp b/kdeplasma-addons/runners/datetime/datetimerunner.cpp index e770072a..d9f3fb59 100644 --- a/kdeplasma-addons/runners/datetime/datetimerunner.cpp +++ b/kdeplasma-addons/runners/datetime/datetimerunner.cpp @@ -21,7 +21,7 @@ #include -#include +#include #include #include #include @@ -87,25 +87,26 @@ QDateTime DateTimeRunner::datetime(const QString &tz, QString &tzName) if (tz.compare(QLatin1String("UTC"), Qt::CaseInsensitive) == 0) { tzName = QLatin1String( "UTC" ); - dt = KDateTime::currentDateTime(KTimeZone::utc()); + dt = KTimeZone::utc().toZoneTime(QDateTime::currentDateTimeUtc()); return dt; } foreach (const KTimeZone &zone, KSystemTimeZones::zones()) { const QString zoneName = zone.name(); + const QDateTime zoneDateTime = zone.toZoneTime(QDateTime::currentDateTimeUtc()); if (zoneName.compare(tz, Qt::CaseInsensitive) == 0) { tzName = zoneName; - dt = KDateTime::currentDateTime(zone); + dt = zoneDateTime; break; } else if (!dt.isValid()) { if (zoneName.contains(tz, Qt::CaseInsensitive)) { tzName = zoneName; - dt = KDateTime::currentDateTime(zone); + dt = zoneDateTime; } else { foreach (const QByteArray &abbrev, zone.abbreviations()) { if (QString(abbrev).contains(tz, Qt::CaseInsensitive)) { tzName = abbrev; - dt = KDateTime::currentDateTime(zone); + dt = zoneDateTime; } } } diff --git a/krdc/connectiondelegate.cpp b/krdc/connectiondelegate.cpp index d6fa9db9..3fe7ba7c 100644 --- a/krdc/connectiondelegate.cpp +++ b/krdc/connectiondelegate.cpp @@ -24,7 +24,7 @@ #include "connectiondelegate.h" #include "remotedesktopsmodel.h" -#include +#include #include #include #include @@ -38,8 +38,8 @@ ConnectionDelegate::ConnectionDelegate(QObject *parent) : QString ConnectionDelegate::displayText(const QVariant &value, const QLocale& locale) const { if (value.type() == QVariant::DateTime) { - KDateTime lastConnected = KDateTime(value.toDateTime()); - KDateTime currentTime = KDateTime::currentUtcDateTime(); + QDateTime lastConnected = value.toDateTime(); + QDateTime currentTime = QDateTime::currentDateTimeUtc(); int daysAgo = lastConnected.daysTo(currentTime); if (daysAgo <= 1 && lastConnected.secsTo(currentTime) < 86400) { diff --git a/krdc/remotedesktopsmodel.cpp b/krdc/remotedesktopsmodel.cpp index bc0b9d66..ed86ad05 100644 --- a/krdc/remotedesktopsmodel.cpp +++ b/krdc/remotedesktopsmodel.cpp @@ -235,8 +235,8 @@ void RemoteDesktopsModel::buildModelFromBookmarkGroup(const KBookmarkGroup &grou item.favorite = false; // since we are in the history folder collect statitics and add them - KDateTime connected = KDateTime(); - KDateTime created = KDateTime(); + QDateTime connected = QDateTime(); + QDateTime created = QDateTime(); bool ok = false; // first the created datetime created.setTime_t(bm.metaDataItem("time_added").toLongLong(&ok)); @@ -252,8 +252,8 @@ void RemoteDesktopsModel::buildModelFromBookmarkGroup(const KBookmarkGroup &grou } else { if (newItem) { // if this is a new item, just add the rest of the required data - item.lastConnected = KDateTime(); - item.created = KDateTime(); + item.lastConnected = QDateTime(); + item.created = QDateTime(); item.visits = 0; item.favorite = true; item.source = RemoteDesktop::Bookmarks; @@ -289,7 +289,7 @@ void RemoteDesktopsModel::servicesChanged() if (!remoteDesktops.contains(item)) { item.title = service.name; item.source = RemoteDesktop::Zeroconf; - item.created = KDateTime::currentLocalDateTime(); + item.created = QDateTime::currentDateTime(); item.favorite = false; item.visits = 0; remoteDesktops.append(item); diff --git a/krdc/remotedesktopsmodel.h b/krdc/remotedesktopsmodel.h index 6fcafbe2..0989040f 100644 --- a/krdc/remotedesktopsmodel.h +++ b/krdc/remotedesktopsmodel.h @@ -25,8 +25,8 @@ #ifndef REMOTEDESKTOPSMODEL_H #define REMOTEDESKTOPSMODEL_H -#include -#include +#include +#include #ifdef BUILD_ZEROCONF #include @@ -41,8 +41,8 @@ public: Q_DECLARE_FLAGS(Sources, Source) QString title; QString url; - KDateTime lastConnected; - KDateTime created; + QDateTime lastConnected; + QDateTime created; int visits; RemoteDesktop::Source source; bool favorite; @@ -75,7 +75,7 @@ public: private: QList remoteDesktops; - QString getLastConnectedString(KDateTime lastConnected, bool fuzzy = false) const; + QString getLastConnectedString(QDateTime lastConnected, bool fuzzy = false) const; void removeAllItemsFromSources(RemoteDesktop::Sources sources); void buildModelFromBookmarkGroup(const KBookmarkGroup &group); KBookmarkManager *m_manager; diff --git a/partitionmanager/src/util/htmlreport.cpp b/partitionmanager/src/util/htmlreport.cpp index 5cd7a0a0..fc6be6b5 100644 --- a/partitionmanager/src/util/htmlreport.cpp +++ b/partitionmanager/src/util/htmlreport.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -32,6 +31,7 @@ #include #include #include +#include #include #include @@ -77,7 +77,7 @@ QString HtmlReport::header() const QString unameString = QString(info.sysname) + ' ' + info.nodename + ' ' + info.release + ' ' + info.version + ' ' + info.machine; s << "\n" - << tableLine(i18n("Date:"), KGlobal::locale()->formatDateTime(KDateTime::currentLocalDateTime())) + << tableLine(i18n("Date:"), KGlobal::locale()->formatDateTime(QDateTime::currentDateTime())) << tableLine(i18n("Program version:"), KGlobal::mainComponent().aboutData()->version()) << tableLine(i18n("Backend:"), QString("%1 (%2)").arg(CoreBackendManager::self()->backend()->about().programName()).arg(CoreBackendManager::self()->backend()->about().version())) << tableLine(i18n("KDE version:"), KDE_VERSION_STRING) diff --git a/partitionmanager/src/util/report.cpp b/partitionmanager/src/util/report.cpp index 0b159f40..902b2f7c 100644 --- a/partitionmanager/src/util/report.cpp +++ b/partitionmanager/src/util/report.cpp @@ -26,7 +26,6 @@ #include #include -#include #include #include #include