Changeset View
Changeset View
Standalone View
Standalone View
src/kcms/kio/useragentinfo.cpp
Show All 16 Lines | |||||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | // Own | 19 | // Own | ||
20 | #include "useragentinfo.h" | 20 | #include "useragentinfo.h" | ||
21 | 21 | | |||
22 | // std | 22 | // std | ||
23 | #include <time.h> | 23 | #include <time.h> | ||
24 | 24 | | |||
25 | #ifndef Q_OS_WIN | | |||
26 | #include <sys/utsname.h> | | |||
27 | #else | | |||
28 | #include <QSysInfo> | | |||
29 | #endif | | |||
30 | | ||||
31 | // Qt | 25 | // Qt | ||
32 | #include <QLocale> | 26 | #include <QLocale> | ||
27 | #include <QSysInfo> | ||||
33 | 28 | | |||
34 | // KDE | 29 | // KDE | ||
35 | #include <kservicetypetrader.h> | 30 | #include <kservicetypetrader.h> | ||
36 | 31 | | |||
37 | #define UA_PTOS(x) (*it)->property(x).toString() | 32 | #define UA_PTOS(x) (*it)->property(x).toString() | ||
38 | #define QFL(x) QLatin1String(x) | 33 | #define QFL(x) QLatin1String(x) | ||
39 | 34 | | |||
40 | UserAgentInfo::UserAgentInfo() | 35 | UserAgentInfo::UserAgentInfo() | ||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 81 | { | |||
90 | KService::List::ConstIterator lastItem = m_providers.constEnd(); | 85 | KService::List::ConstIterator lastItem = m_providers.constEnd(); | ||
91 | 86 | | |||
92 | for ( ; it != lastItem; ++it ) | 87 | for ( ; it != lastItem; ++it ) | ||
93 | { | 88 | { | ||
94 | tmp = UA_PTOS(QStringLiteral("X-KDE-UA-FULL")); | 89 | tmp = UA_PTOS(QStringLiteral("X-KDE-UA-FULL")); | ||
95 | 90 | | |||
96 | if ( (*it)->property(QStringLiteral("X-KDE-UA-DYNAMIC-ENTRY")).toBool() ) | 91 | if ( (*it)->property(QStringLiteral("X-KDE-UA-DYNAMIC-ENTRY")).toBool() ) | ||
97 | { | 92 | { | ||
98 | #ifndef Q_OS_WIN | 93 | tmp.replace( QFL("appSysName"), QSysInfo::productType() ); | ||
99 | struct utsname utsn; | | |||
100 | uname( &utsn ); | | |||
101 | | ||||
102 | tmp.replace( QFL("appSysName"), QString::fromUtf8(utsn.sysname) ); | | |||
103 | tmp.replace( QFL("appSysRelease"), QString::fromUtf8(utsn.release) ); | | |||
104 | tmp.replace( QFL("appMachineType"), QString::fromUtf8(utsn.machine) ); | | |||
105 | #else | | |||
106 | tmp.replace( QFL("appSysName"), QLatin1String("Windows") ); | | |||
107 | // TODO: maybe we can use QSysInfo also on linux? | | |||
108 | tmp.replace( QFL("appSysRelease"), QSysInfo::kernelVersion() ); | 94 | tmp.replace( QFL("appSysRelease"), QSysInfo::kernelVersion() ); | ||
109 | tmp.replace( QFL("appMachineType"), QSysInfo::currentCpuArchitecture() ); | 95 | tmp.replace( QFL("appMachineType"), QSysInfo::currentCpuArchitecture() ); | ||
110 | #endif | 96 | | ||
111 | QStringList languageList = QLocale().uiLanguages(); | 97 | QStringList languageList = QLocale().uiLanguages(); | ||
112 | if ( !languageList.isEmpty() ) | 98 | if ( !languageList.isEmpty() ) | ||
113 | { | 99 | { | ||
114 | int ind = languageList.indexOf( QStringLiteral("C") ); | 100 | int ind = languageList.indexOf( QStringLiteral("C") ); | ||
115 | if( ind >= 0 ) | 101 | if( ind >= 0 ) | ||
116 | { | 102 | { | ||
117 | if( languageList.contains( QStringLiteral("en") ) ) | 103 | if( languageList.contains( QStringLiteral("en") ) ) | ||
118 | languageList.removeAt( ind ); | 104 | languageList.removeAt( ind ); | ||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |