summaryrefslogtreecommitdiff
path: root/src/useragent/useragentinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/useragent/useragentinfo.cpp')
-rw-r--r--src/useragent/useragentinfo.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/useragent/useragentinfo.cpp b/src/useragent/useragentinfo.cpp
index d6b286b6..67390e94 100644
--- a/src/useragent/useragentinfo.cpp
+++ b/src/useragent/useragentinfo.cpp
@@ -61,9 +61,9 @@ UserAgentInfo::UserAgentInfo()
QString UserAgentInfo::userAgentString(int i)
{
- if (i < 0)
+ if (i < 0 || !providerExists(i))
{
- kDebug() << "oh oh... negative index on the user agent choice!";
+ kDebug() << "oh oh... wrong index on the user agent choice! INDEX = " << i;
return QL1S("Default");
}
@@ -98,9 +98,9 @@ QString UserAgentInfo::userAgentString(int i)
QString UserAgentInfo::userAgentName(int i)
{
- if (i < 0)
+ if (i < 0 || !providerExists(i))
{
- kDebug() << "oh oh... negative index on the user agent choice!";
+ kDebug() << "oh oh... wrong index on the user agent choice! INDEX = " << i;
return QL1S("Default");
}
@@ -110,9 +110,9 @@ QString UserAgentInfo::userAgentName(int i)
QString UserAgentInfo::userAgentVersion(int i)
{
- if (i < 0)
+ if (i < 0 || !providerExists(i))
{
- kDebug() << "oh oh... negative index on the user agent choice!";
+ kDebug() << "oh oh... wrong index on the user agent choice! INDEX = " << i;
return QL1S("Default");
}
@@ -122,9 +122,9 @@ QString UserAgentInfo::userAgentVersion(int i)
QString UserAgentInfo::userAgentDescription(int i)
{
- if (i < 0)
+ if (i < 0 || !providerExists(i))
{
- kDebug() << "oh oh... negative index on the user agent choice!";
+ kDebug() << "oh oh... wrong index on the user agent choice! INDEX = " << i;
return QL1S("Default");
}
@@ -186,3 +186,15 @@ int UserAgentInfo::uaIndexForHost(const QString &host)
}
return -1;
}
+
+
+bool UserAgentInfo::providerExists(int i)
+{
+ KService::Ptr s = m_providers.at(i);
+ if(s.isNull())
+ {
+ //FIXME Add me when string freeze has been reopened: KMessageBox::error(...)
+ return false;
+ }
+ return true;
+}