From 9277cc537a85de7faaf2144126c05e02580d7acb Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sun, 19 Apr 2020 22:40:49 +0200 Subject: [PATCH] Implement basic device type detection --- core/kdeconnectconfig.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/core/kdeconnectconfig.cpp b/core/kdeconnectconfig.cpp index a23f0924b..917193030 100644 --- a/core/kdeconnectconfig.cpp +++ b/core/kdeconnectconfig.cpp @@ -109,7 +109,23 @@ void KdeConnectConfig::setName(const QString& name) QString KdeConnectConfig::deviceType() { - return QStringLiteral("desktop"); // TODO +#ifdef SAILFISHOS + return QStringLiteral("phone"); +#else + const QByteArrayList platforms = qgetenv("PLASMA_PLATFORM").split(':'); + + if (platforms.contains("phone")) { + return QStringLiteral("phone"); + } else if (platforms.contains("tablet")) { + return QStringLiteral("tablet"); + } else if(platforms.contains("mediacenter")) { + return QStringLiteral("tv"); + } + + // TODO non-Plasma mobile platforms + + return QStringLiteral("desktop"); +#endif } QString KdeConnectConfig::deviceId()