aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2014-01-21 22:32:18 (GMT)
committerChristoph Cullmann <cullmann@kde.org>2014-01-21 22:32:18 (GMT)
commit7c6ca9880540cbc49085485b764181ba781a2931 (patch)
treea2b46aa5b6aec899b071e5a799578c822ef8ca70
parent63497b565dcfbe7402af97ce1005e38bb3ae9509 (diff)
port away from plain C to QHostInfo, want windows to work ;)
-rw-r--r--src/utils/templateinterface.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/utils/templateinterface.cpp b/src/utils/templateinterface.cpp
index 74e965e..c489bfa 100644
--- a/src/utils/templateinterface.cpp
+++ b/src/utils/templateinterface.cpp
@@ -24,10 +24,10 @@
#include <QDate>
#include <QRegExp>
#include <KMessageBox>
-#include <unistd.h>
#include <KLibrary>
#include <KLocalizedString>
#include <QLocale>
+#include <QHostInfo>
#define DUMMY_VALUE QLatin1String("!KTE:TEMPLATEHANDLER_DUMMY_VALUE!")
@@ -79,11 +79,7 @@ bool TemplateInterface::expandMacros(QMap<QString, QString> &map, QWidget *paren
} else if (placeholder == QLatin1String("day")) {
map[ placeholder ] = date.toString(QLatin1String("dd"));
} else if (placeholder == QLatin1String("hostname")) {
- char hostname[ 256 ];
- hostname[ 0 ] = 0;
- gethostname(hostname, 255);
- hostname[ 255 ] = 0;
- map[ placeholder ] = QString::fromLocal8Bit(hostname);
+ map[ placeholder ] = QHostInfo::localHostName();
} else if (placeholder == QLatin1String("cursor")) {
map[ placeholder ] = QLatin1Char('|');
} else if (placeholder == QLatin1String("selection")) {