diff --git a/kcms/kfontinst/dbus/Folder.cpp b/kcms/kfontinst/dbus/Folder.cpp --- a/kcms/kfontinst/dbus/Folder.cpp +++ b/kcms/kfontinst/dbus/Folder.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -94,7 +94,7 @@ itsDisabledCfg.name=QString::fromLatin1(KFI_ROOT_CFG_DIR)+fileName; else { - QString path=KGlobal::dirs()->localxdgconfdir(); + QString path=QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/'); if(!Misc::dExists(path)) Misc::createDir(path); diff --git a/kcms/kfontinst/kcmfontinst/FontsPackage.cpp b/kcms/kfontinst/kcmfontinst/FontsPackage.cpp --- a/kcms/kfontinst/kcmfontinst/FontsPackage.cpp +++ b/kcms/kfontinst/kcmfontinst/FontsPackage.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include "FontsPackage.h" #include "KfiConstants.h" #include "Misc.h" @@ -64,7 +64,7 @@ { if(!(*tempDir)) { - (*tempDir)=new KTempDir(KStandardDirs::locateLocal("tmp", KFI_TMP_DIR_PREFIX)); + (*tempDir)=new KTempDir(QDir::tempPath() + "/" KFI_TMP_DIR_PREFIX); (*tempDir)->setAutoRemove(true); } diff --git a/kcms/kfontinst/kcmfontinst/JobRunner.cpp b/kcms/kfontinst/kcmfontinst/JobRunner.cpp --- a/kcms/kfontinst/kcmfontinst/JobRunner.cpp +++ b/kcms/kfontinst/kcmfontinst/JobRunner.cpp @@ -27,7 +27,6 @@ #include "Fc.h" #include "ActionLabel.h" #include -#include #include #include #include @@ -687,7 +686,7 @@ // Need to do actual download... if(!itsTempDir) { - itsTempDir=new KTempDir(KStandardDirs::locateLocal("tmp", "fontinst")); + itsTempDir=new KTempDir(QDir::tempPath() + "/fontinst"); itsTempDir->setAutoRemove(true); } diff --git a/kcms/kfontinst/kio/KioFonts.cpp b/kcms/kfontinst/kio/KioFonts.cpp --- a/kcms/kfontinst/kio/KioFonts.cpp +++ b/kcms/kfontinst/kio/KioFonts.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -232,8 +231,8 @@ { if(!itsTempDir) { - itsTempDir=new KTempDir(KStandardDirs::locateLocal("tmp", - QString::fromLatin1("kio_fonts_")+QString::number(getpid()))); + itsTempDir=new KTempDir(QDir::tempPath() + + QString::fromLatin1("/kio_fonts_")+QString::number(getpid())); itsTempDir->setAutoRemove(true); } diff --git a/kcms/kfontinst/lib/CMakeLists.txt b/kcms/kfontinst/lib/CMakeLists.txt --- a/kcms/kfontinst/lib/CMakeLists.txt +++ b/kcms/kfontinst/lib/CMakeLists.txt @@ -1,6 +1,8 @@ set(kfontinst_LIB_SRCS Misc.cpp Fc.cpp Family.cpp Style.cpp File.cpp WritingSystems.cpp) set(kfontinstui_LIB_SRCS FcEngine.cpp ) +configure_file(config-paths.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-paths.h) + add_library(kfontinst SHARED ${kfontinst_LIB_SRCS}) target_link_libraries(kfontinst Qt5::Xml diff --git a/kcms/kfontinst/lib/Misc.cpp b/kcms/kfontinst/lib/Misc.cpp --- a/kcms/kfontinst/lib/Misc.cpp +++ b/kcms/kfontinst/lib/Misc.cpp @@ -22,6 +22,7 @@ */ #include "Misc.h" +#include "config-paths.h" #include #include #include @@ -32,7 +33,7 @@ #include #include #include -#include +#include #include #include #include @@ -114,13 +115,16 @@ bool createDir(const QString &dir) { + if (!QDir().mkpath(dir)) + return false; // - // Clear any umask before dir is created + // Clear any umask before setting dir perms mode_t oldMask(umask(0000)); - bool status(KStandardDirs::makeDir(dir, DIR_PERMS)); + const QByteArray d = QFile::encodeName(dir); + ::chmod(d.constData(), DIR_PERMS); // Reset umask ::umask(oldMask); - return status; + return true; } void setFilePerms(const QByteArray &f) @@ -475,8 +479,12 @@ { static QMap apps; - if(!apps.contains(name)) - apps[name]=KStandardDirs::findExe(name, path ? KStandardDirs::installPath(path) : QString()); + if(!apps.contains(name)) { + QStringList installPaths; + if (qstrcmp(path, "libexec") == 0) + installPaths.append(KFONTINST_LIBEXEC_DIR); + apps[name] = QStandardPaths::findExecutable(name, installPaths); + } return apps[name]; } diff --git a/kcms/kfontinst/lib/config-paths.h.cmake b/kcms/kfontinst/lib/config-paths.h.cmake new file mode 100644 --- /dev/null +++ b/kcms/kfontinst/lib/config-paths.h.cmake @@ -0,0 +1,6 @@ +#ifndef __CONFIG_KFONTINST_PATHS_H__ +#define __CONFIG_KFONTINST_PATHS_H__ + +#define KFONTINST_LIBEXEC_DIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}" + +#endif diff --git a/kcms/kfontinst/thumbnail/FontThumbnail.cpp b/kcms/kfontinst/thumbnail/FontThumbnail.cpp --- a/kcms/kfontinst/thumbnail/FontThumbnail.cpp +++ b/kcms/kfontinst/thumbnail/FontThumbnail.cpp @@ -31,8 +31,8 @@ #include #include #include -#include #include +#include #define KFI_DBUG kDebug(7115) @@ -83,7 +83,7 @@ if(entry && entry->isFile()) { delete tempDir; - tempDir=new KTempDir(KStandardDirs::locateLocal("tmp", KFI_TMP_DIR_PREFIX)); + tempDir=new KTempDir(QDir::tempPath() + "/" KFI_TMP_DIR_PREFIX); tempDir->setAutoRemove(true); ((KArchiveFile *)entry)->copyTo(tempDir->name()); diff --git a/kcms/kfontinst/viewpart/FontViewPart.cpp b/kcms/kfontinst/viewpart/FontViewPart.cpp --- a/kcms/kfontinst/viewpart/FontViewPart.cpp +++ b/kcms/kfontinst/viewpart/FontViewPart.cpp @@ -51,7 +51,6 @@ //#include #include #include -#include #include #include #include @@ -291,7 +290,7 @@ if(entry && entry->isFile()) { delete itsTempDir; - itsTempDir=new KTempDir(KStandardDirs::locateLocal("tmp", KFI_TMP_DIR_PREFIX)); + itsTempDir=new KTempDir(QDir::tempPath() + "/" KFI_TMP_DIR_PREFIX); itsTempDir->setAutoRemove(true); ((KArchiveFile *)entry)->copyTo(itsTempDir->name());