Implement basic device type detection

This commit is contained in:
Nicolas Fella 2020-04-19 22:40:49 +02:00
parent 95a62f4fdb
commit 9277cc537a

View file

@ -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()