summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrius Štikonas <andrius@stikonas.eu>2016-07-15 11:59:33 (GMT)
committerAndrius Štikonas <andrius@stikonas.eu>2016-07-15 11:59:33 (GMT)
commitbe86ce09418e86c91561c9ede97b6837391b98d6 (patch)
tree031c8fd99c44a2f21e7870f3255a7bdf154a6d2d
parent0b5be818a994f09f9ee8b06be49542e23f45598e (diff)
Port away from KStandardDirs::makeDir.
umask is used to set proper permissions of newly created folder.
-rw-r--r--core/KGpgUatNode.cpp2
-rw-r--r--gpgproc.cpp14
-rw-r--r--klinebufferedprocessprivate.cpp2
3 files changed, 14 insertions, 4 deletions
diff --git a/core/KGpgUatNode.cpp b/core/KGpgUatNode.cpp
index c1fd852..8b2e70b 100644
--- a/core/KGpgUatNode.cpp
+++ b/core/KGpgUatNode.cpp
@@ -54,7 +54,7 @@ QPixmap
KGpgUatNodePrivate::loadImage(const KGpgKeyNode *parent, const QString &index)
{
QPixmap pixmap;
-#ifdef Q_OS_WIN32 //krazy:exclude=cpp
+#ifdef Q_OS_WIN //krazy:exclude=cpp
const QString pgpgoutput = QLatin1String("cmd /C \"echo %I\"");
#else
const QString pgpgoutput = QLatin1String("echo %I");
diff --git a/gpgproc.cpp b/gpgproc.cpp
index 99e0b6c..bc31a9a 100644
--- a/gpgproc.cpp
+++ b/gpgproc.cpp
@@ -24,6 +24,10 @@
#include <QStringList>
#include <QTextCodec>
+#ifndef Q_OS_WIN
+ #include <sys/stat.h>
+#endif
+
class GnupgBinary {
public:
GnupgBinary();
@@ -376,7 +380,7 @@ QString GPGProc::getGpgHome(const QString &binary)
// Third try: guess what it is.
if (gpgHome.isEmpty()) {
-#ifdef Q_OS_WIN32 //krazy:exclude=cpp
+#ifdef Q_OS_WIN //krazy:exclude=cpp
gpgHome = qgetenv("APPDATA") + QLatin1String( "/gnupg/" );
gpgHome.replace(QLatin1Char( '\\' ), QLatin1Char( '/' ));
#else
@@ -392,6 +396,12 @@ QString GPGProc::getGpgHome(const QString &binary)
if (gpgHome.startsWith(QLatin1String("~/")))
gpgHome.replace(0, 1, QDir::homePath());
- KStandardDirs::makeDir(gpgHome, 0700);
+#ifdef Q_OS_WIN
+ QDir().mkpath(gpgHome);
+#else
+ uint mask = umask(077);
+ QDir().mkpath(gpgHome);
+ umask(mask);
+#endif
return gpgHome;
}
diff --git a/klinebufferedprocessprivate.cpp b/klinebufferedprocessprivate.cpp
index 1265a2c..e262f05 100644
--- a/klinebufferedprocessprivate.cpp
+++ b/klinebufferedprocessprivate.cpp
@@ -18,7 +18,7 @@ KLineBufferedProcessPrivate::KLineBufferedProcessPrivate(KLineBufferedProcess *p
: m_newlineInStdout(-1),
m_newlineInStderr(-1),
m_parent(parent),
-#ifdef Q_OS_WIN32 //krazy:exclude=cpp
+#ifdef Q_OS_WIN //krazy:exclude=cpp
m_lineEnd("\r\n")
#else
m_lineEnd("\n")