┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/settings/servicessettingspage.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2009-03-03 19:39:36 +0000
committerPeter Penz <[email protected]>2009-03-03 19:39:36 +0000
commit0801e50cfd52720577e40c28e576fe4a9baebc4b (patch)
tree1686ed977f17bd7b7d6370d163f85518bdbcd54f /src/settings/servicessettingspage.cpp
parent5ecc19e7896b9f04cde0314a6d4c6c6108c48e02 (diff)
only add the service to the list, if there is no other service using the same name
svn path=/trunk/KDE/kdebase/apps/; revision=934788
Diffstat (limited to 'src/settings/servicessettingspage.cpp')
-rw-r--r--src/settings/servicessettingspage.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/settings/servicessettingspage.cpp b/src/settings/servicessettingspage.cpp
index 57e91e5dd..18f93dfa3 100644
--- a/src/settings/servicessettingspage.cpp
+++ b/src/settings/servicessettingspage.cpp
@@ -102,11 +102,15 @@ void ServicesSettingsPage::loadServices()
KDesktopFileActions::userDefinedServices(file, true);
foreach (const KServiceAction& action, serviceActions) {
- if (!action.noDisplay() && !action.isSeparator()) {
+ const QString service = action.name();
+ const bool addService = !action.noDisplay()
+ && !action.isSeparator()
+ && !isInServicesList(service);
+
+ if (addService) {
QListWidgetItem* item = new QListWidgetItem(KIcon(action.icon()),
action.text(),
m_servicesList);
- const QString service = action.name();
item->setData(Qt::UserRole, service);
const bool show = showGroup.readEntry(service, true);
item->setCheckState(show ? Qt::Checked : Qt::Unchecked);
@@ -115,4 +119,16 @@ void ServicesSettingsPage::loadServices()
}
}
+bool ServicesSettingsPage::isInServicesList(const QString& service) const
+{
+ const int count = m_servicesList->count();
+ for (int i = 0; i < count; ++i) {
+ QListWidgetItem* item = m_servicesList->item(i);
+ if (item->data(Qt::UserRole).toString() == service) {
+ return true;
+ }
+ }
+ return false;
+}
+
#include "servicessettingspage.moc"