summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/useragent/useragentinfo.cpp28
-rw-r--r--src/useragent/useragentinfo.h2
2 files changed, 22 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;
+}
diff --git a/src/useragent/useragentinfo.h b/src/useragent/useragentinfo.h
index 68af50ab..f95c696c 100644
--- a/src/useragent/useragentinfo.h
+++ b/src/useragent/useragentinfo.h
@@ -71,6 +71,8 @@ private:
QString userAgentVersion(int);
QString userAgentDescription(int);
+ bool providerExists(int);
+
private:
KService::List m_providers;
};