Commit 768fa11c authored by Alexander Volkov's avatar Alexander Volkov

Fonts KCM: Port from kde_file.h to QFileInfo

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D18454
parent ed840a53
......@@ -30,13 +30,13 @@
#include <QRegExp>
#include <QFile>
#include <QFileInfo>
#include <QDir>
#include <QX11Info>
#include <QByteArray>
#include <QDebug>
#include <KLocalizedString>
#include <kde_file.h>
#include <KGlobal>
#include <KStandardDirs>
......@@ -78,23 +78,15 @@ static QString dirSyntax(const QString &d)
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 @@ static QString getDir(const QString &f)
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();
}
//
......
......@@ -24,8 +24,7 @@
#ifdef HAVE_FONTCONFIG
#include <time.h>
#include <QDateTime>
#include <QDomDocument>
class KXftConfig
......@@ -187,7 +186,7 @@ private:
QDomDocument m_doc;
QString m_file;
bool m_madeChanges;
time_t m_time;
QDateTime m_time;
};
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment