Use QHostInfo to get local host name.

Added dependency on QtNetwork for Qt4, too. In Qt5 we depend through
QtQuick.
This commit is contained in:
Abdurrahman AVCI 2013-01-28 12:43:32 +00:00
parent 5e9269b854
commit 541fcee7a4
2 changed files with 3 additions and 5 deletions

View File

@ -33,6 +33,7 @@ if (USE_QT5)
qt5_use_modules(sddm Widgets Quick)
else()
find_package(Qt4 REQUIRED)
set(QT_USE_QTNETWORK TRUE)
set(QT_USE_QTDECLARATIVE TRUE)
include(${QT_USE_FILE})

View File

@ -25,11 +25,10 @@
#include <QCoreApplication>
#include <QDir>
#include <QFile>
#include <QHostInfo>
#include <QProcess>
#include <QTextStream>
#include <unistd.h>
using namespace SDE;
namespace SDE {
class SessionInfo {
@ -87,9 +86,7 @@ namespace SDE {
d->lastSessionIndex = i;
}
// get hostname
char hostName[100];
gethostname(hostName, 100);
d->hostName = hostName;
d->hostName = QHostInfo::localHostName();
}
SessionManager::~SessionManager() {