From 9d20e99fffeebe67fd8ff27cb4f9e353892f5190 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 25 Feb 2011 00:19:27 +0100 Subject: Coding style --- src/useragent/useragentinfo.cpp | 72 +++++++++++++++++++-------------------- src/useragent/useragentinfo.h | 12 +++---- src/useragent/useragentwidget.cpp | 28 +++++++-------- 3 files changed, 56 insertions(+), 56 deletions(-) (limited to 'src/useragent') diff --git a/src/useragent/useragentinfo.cpp b/src/useragent/useragentinfo.cpp index cf07d9a4..d6b286b6 100644 --- a/src/useragent/useragentinfo.cpp +++ b/src/useragent/useragentinfo.cpp @@ -44,8 +44,8 @@ UserAgentInfo::UserAgentInfo() { -/* KService::List m_providers = KServiceTypeTrader::self()->query("UserAgentStrings");*/ - + /* KService::List m_providers = KServiceTypeTrader::self()->query("UserAgentStrings");*/ + // NOTE: limiting User Agent Numbers m_providers << KService::serviceByDesktopName("firefox36oncurrent"); m_providers << KService::serviceByDesktopName("ie70onwinnt51"); @@ -61,76 +61,76 @@ UserAgentInfo::UserAgentInfo() QString UserAgentInfo::userAgentString(int i) { - if(i<0) + if (i < 0) { kDebug() << "oh oh... negative index on the user agent choice!"; return QL1S("Default"); } - + QString tmp = m_providers.at(i)->property("X-KDE-UA-FULL").toString(); - + struct utsname utsn; - uname( &utsn ); + uname(&utsn); - tmp.replace( QL1S("appSysName"), QString(utsn.sysname) ); - tmp.replace( QL1S("appSysRelease"), QString(utsn.release) ); - tmp.replace( QL1S("appMachineType"), QString(utsn.machine) ); + tmp.replace(QL1S("appSysName"), QString(utsn.sysname)); + tmp.replace(QL1S("appSysRelease"), QString(utsn.release)); + tmp.replace(QL1S("appMachineType"), QString(utsn.machine)); QStringList languageList = KGlobal::locale()->languageList(); - if ( languageList.count() ) + if (languageList.count()) { - int ind = languageList.indexOf( QL1S("C") ); - if( ind >= 0 ) + int ind = languageList.indexOf(QL1S("C")); + if (ind >= 0) { - if( languageList.contains( QL1S("en") ) ) - languageList.removeAt( ind ); + if (languageList.contains(QL1S("en"))) + languageList.removeAt(ind); else languageList.value(ind) = QL1S("en"); } } - tmp.replace( QL1S("appLanguage"), QString("%1").arg(languageList.join(", ")) ); - tmp.replace( QL1S("appPlatform"), QL1S("X11") ); - + tmp.replace(QL1S("appLanguage"), QString("%1").arg(languageList.join(", "))); + tmp.replace(QL1S("appPlatform"), QL1S("X11")); + return tmp; } QString UserAgentInfo::userAgentName(int i) { - if(i<0) + if (i < 0) { kDebug() << "oh oh... negative index on the user agent choice!"; return QL1S("Default"); } - + return m_providers.at(i)->property("X-KDE-UA-NAME").toString(); } QString UserAgentInfo::userAgentVersion(int i) { - if(i<0) + if (i < 0) { kDebug() << "oh oh... negative index on the user agent choice!"; return QL1S("Default"); } - + return m_providers.at(i)->property("X-KDE-UA-VERSION").toString(); } QString UserAgentInfo::userAgentDescription(int i) { - if(i<0) + if (i < 0) { kDebug() << "oh oh... negative index on the user agent choice!"; return QL1S("Default"); } - + QString tmp = m_providers.at(i)->property("Name").toString(); - tmp.remove( QL1S("UADescription (") ); - tmp.remove( QL1C(')') ); + tmp.remove(QL1S("UADescription (")); + tmp.remove(QL1C(')')); return tmp; } @@ -139,7 +139,7 @@ QStringList UserAgentInfo::availableUserAgents() { QStringList UAs; int n = m_providers.count(); - for(int i = 0; i -class UserAgentInfo +class UserAgentInfo { public: UserAgentInfo(); - + /** * Lists all available User Agents - * + * * @returns the list of the UA descriptions */ QStringList availableUserAgents(); - + /** * Set User Agent for host - * + * * @param uaIndex the index of the UA description. @see availableUserAgents() * @param host the host to se the UA */ bool setUserAgentForHost(int uaIndex, const QString &host); - + /** * @returns the index of the UA set for the @p host */ diff --git a/src/useragent/useragentwidget.cpp b/src/useragent/useragentwidget.cpp index dc4f10ea..0cdddadf 100644 --- a/src/useragent/useragentwidget.cpp +++ b/src/useragent/useragentwidget.cpp @@ -33,7 +33,7 @@ UserAgentWidget::UserAgentWidget(QWidget *parent) - : QWidget(parent) + : QWidget(parent) { setupUi(this); @@ -48,9 +48,9 @@ UserAgentWidget::UserAgentWidget(QWidget *parent) { QStringList tmp; tmp << host; - + KConfigGroup hostGroup(&config, host); - tmp << hostGroup.readEntry( QL1S("UserAgent"), QString()); + tmp << hostGroup.readEntry(QL1S("UserAgent"), QString()); kDebug() << "TMP: " << tmp; QTreeWidgetItem *item = new QTreeWidgetItem(sitePolicyTreeWidget, tmp); @@ -62,17 +62,17 @@ UserAgentWidget::UserAgentWidget(QWidget *parent) void UserAgentWidget::deleteUserAgent() { QTreeWidgetItem *item = sitePolicyTreeWidget->currentItem(); - if(!item) + if (!item) return; - - sitePolicyTreeWidget->takeTopLevelItem( sitePolicyTreeWidget->indexOfTopLevelItem(item) ); - + + sitePolicyTreeWidget->takeTopLevelItem(sitePolicyTreeWidget->indexOfTopLevelItem(item)); + QString host = item->text(0); kDebug() << "HOST: " << host; - + KConfig config("kio_httprc", KConfig::NoGlobals); KConfigGroup group(&config, host); - if(group.exists()) + if (group.exists()) { group.deleteGroup(); KProtocolManager::reparseConfiguration(); @@ -83,16 +83,16 @@ void UserAgentWidget::deleteUserAgent() void UserAgentWidget::deleteAll() { sitePolicyTreeWidget->clear(); - + KConfig config("kio_httprc", KConfig::NoGlobals); - + QStringList list = config.groupList(); Q_FOREACH(const QString &groupName, list) { - kDebug() << "HOST: " << groupName; - + kDebug() << "HOST: " << groupName; + KConfigGroup group(&config, groupName); - group.deleteGroup(); + group.deleteGroup(); } KConfigGroup group(&config, QString()); group.deleteGroup(); -- cgit v1.2.1