summaryrefslogtreecommitdiff
path: root/src/useragent
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-02-25 00:19:27 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-02-25 00:19:27 +0100
commit9d20e99fffeebe67fd8ff27cb4f9e353892f5190 (patch)
tree23462fac2e862a2f408a26f94ab024c4174c3458 /src/useragent
parentrekonq 0.6.82 (diff)
downloadrekonq-9d20e99fffeebe67fd8ff27cb4f9e353892f5190.tar.xz
Coding style
Diffstat (limited to 'src/useragent')
-rw-r--r--src/useragent/useragentinfo.cpp72
-rw-r--r--src/useragent/useragentinfo.h12
-rw-r--r--src/useragent/useragentwidget.cpp28
3 files changed, 56 insertions, 56 deletions
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<n; ++i)
+ for (int i = 0; i < n; ++i)
{
UAs << userAgentDescription(i);
}
@@ -150,13 +150,13 @@ QStringList UserAgentInfo::availableUserAgents()
bool UserAgentInfo::setUserAgentForHost(int uaIndex, const QString &host)
{
KConfig config("kio_httprc", KConfig::NoGlobals);
-
+
QStringList modifiedHosts = config.groupList();
KConfigGroup hostGroup(&config, host);
-
- if(uaIndex == -1)
+
+ if (uaIndex == -1)
{
- if(!hostGroup.exists())
+ if (!hostGroup.exists())
{
kDebug() << "Host does NOT exists!";
return false;
@@ -165,9 +165,9 @@ bool UserAgentInfo::setUserAgentForHost(int uaIndex, const QString &host)
KProtocolManager::reparseConfiguration();
return true;
}
-
- hostGroup.writeEntry( QL1S("UserAgent"), userAgentString(uaIndex));
-
+
+ hostGroup.writeEntry(QL1S("UserAgent"), userAgentString(uaIndex));
+
KProtocolManager::reparseConfiguration();
return true;
}
@@ -176,12 +176,12 @@ bool UserAgentInfo::setUserAgentForHost(int uaIndex, const QString &host)
int UserAgentInfo::uaIndexForHost(const QString &host)
{
QString KDEUserAgent = KProtocolManager::userAgentForHost(host);
-
+
int n = m_providers.count();
- for(int i=0; i<n; ++i)
+ for (int i = 0; i < n; ++i)
{
QString rekonqUserAgent = userAgentString(i);
- if(KDEUserAgent == rekonqUserAgent)
+ if (KDEUserAgent == rekonqUserAgent)
return i;
}
return -1;
diff --git a/src/useragent/useragentinfo.h b/src/useragent/useragentinfo.h
index 6a62b415..68af50ab 100644
--- a/src/useragent/useragentinfo.h
+++ b/src/useragent/useragentinfo.h
@@ -40,26 +40,26 @@
#include <QString>
-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();