diff --git a/kcms/fonts/kxftconfig.h b/kcms/fonts/kxftconfig.h --- a/kcms/fonts/kxftconfig.h +++ b/kcms/fonts/kxftconfig.h @@ -24,8 +24,7 @@ #ifdef HAVE_FONTCONFIG -#include - +#include #include class KXftConfig @@ -187,7 +186,7 @@ QDomDocument m_doc; QString m_file; bool m_madeChanges; - time_t m_time; + QDateTime m_time; }; #endif diff --git a/kcms/fonts/kxftconfig.cpp b/kcms/fonts/kxftconfig.cpp --- a/kcms/fonts/kxftconfig.cpp +++ b/kcms/fonts/kxftconfig.cpp @@ -30,13 +30,13 @@ #include #include +#include #include #include #include #include #include -#include #include #include @@ -78,23 +78,15 @@ return d; } -static bool check(const QString &path, unsigned int fmt, bool checkW = false) -{ - KDE_struct_stat info; - QByteArray pathC(QFile::encodeName(path)); - - return 0 == KDE_lstat(pathC, &info) && (info.st_mode & S_IFMT) == fmt && - (!checkW || 0 ==::access(pathC, W_OK)); -} - inline bool fExists(const QString &p) { - return check(p, S_IFREG, false); + return QFileInfo(p).isFile(); } inline bool dWritable(const QString &p) { - return check(p, S_IFDIR, true); + QFileInfo info(p); + return info.isDir() && info.isWritable(); } static QString getDir(const QString &f) @@ -110,11 +102,9 @@ return dirSyntax(d); } -static time_t getTimeStamp(const QString &item) +static QDateTime getTimeStamp(const QString &item) { - KDE_struct_stat info; - - return !item.isNull() && 0 == KDE_lstat(QFile::encodeName(item), &info) ? info.st_mtime : 0; + return QFileInfo(item).lastModified(); } //