mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-19 16:31:21 +00:00
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
This commit is contained in:
parent
5ecc19e789
commit
0801e50cfd
|
@ -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"
|
||||
|
|
|
@ -45,6 +45,7 @@ protected:
|
|||
|
||||
private slots:
|
||||
void loadServices();
|
||||
bool isInServicesList(const QString& service) const;
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
|
Loading…
Reference in a new issue