X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/fda88516e9c32ed93cb4fe47a3a9a9bf2aecc456..9aee5d22513f0367febab54b38b3a7dc58d120bb:/src/settings/services/servicessettingspage.cpp diff --git a/src/settings/services/servicessettingspage.cpp b/src/settings/services/servicessettingspage.cpp index 9adca9baf..f258b53e2 100644 --- a/src/settings/services/servicessettingspage.cpp +++ b/src/settings/services/servicessettingspage.cpp @@ -22,18 +22,17 @@ #include "dolphin_generalsettings.h" #include "dolphin_versioncontrolsettings.h" -#include #include #include #include #include -#include -#include +#include +#include #include -#include +#include #include #include -#include +#include #include #include @@ -50,9 +49,9 @@ namespace { const bool ShowDeleteDefault = false; - const char* VersionControlServicePrefix = "_version_control_"; - const char* DeleteService = "_delete"; - const char* CopyToMoveToService ="_copy_to_move_to"; + const char VersionControlServicePrefix[] = "_version_control_"; + const char DeleteService[] = "_delete"; + const char CopyToMoveToService[] ="_copy_to_move_to"; } ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) : @@ -79,12 +78,12 @@ ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) : m_listView->setModel(m_sortModel); m_listView->setItemDelegate(delegate); m_listView->setVerticalScrollMode(QListView::ScrollPerPixel); - connect(m_listView, SIGNAL(clicked(QModelIndex)), this, SIGNAL(changed())); + connect(m_listView, &QListView::clicked, this, &ServicesSettingsPage::changed); KNS3::Button* downloadButton = new KNS3::Button(i18nc("@action:button", "Download New Services..."), "servicemenu.knsrc", this); - connect(downloadButton, SIGNAL(dialogFinished(KNS3::Entry::List)), this, SLOT(loadServices())); + connect(downloadButton, &KNS3::Button::dialogFinished, this, &ServicesSettingsPage::loadServices); topLayout->addWidget(label); topLayout->addWidget(m_listView); @@ -126,7 +125,7 @@ void ServicesSettingsPage::applySettings() configGroup.sync(); } else if (service == QLatin1String(CopyToMoveToService)) { GeneralSettings::setShowCopyMoveMenu(checked); - GeneralSettings::self()->writeConfig(); + GeneralSettings::self()->save(); } else { showGroup.writeEntry(service, checked); } @@ -136,7 +135,7 @@ void ServicesSettingsPage::applySettings() if (m_enabledVcsPlugins != enabledPlugins) { VersionControlSettings::setEnabledPlugins(enabledPlugins); - VersionControlSettings::self()->writeConfig(); + VersionControlSettings::self()->save(); KMessageBox::information(window(), i18nc("@info", "Dolphin must be restarted to apply the " @@ -195,8 +194,8 @@ void ServicesSettingsPage::loadServices() // Load generic services const KService::List entries = KServiceTypeTrader::self()->query("KonqPopupMenu/Plugin"); - foreach (const KSharedPtr& service, entries) { - const QString file = KStandardDirs::locate("services", service->entryPath()); + foreach (const KService::Ptr& service, entries) { + const QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kservices5/" % service->entryPath()); const QList serviceActions = KDesktopFileActions::userDefinedServices(file, true); @@ -221,18 +220,10 @@ void ServicesSettingsPage::loadServices() // Load service plugins that implement the KFileItemActionPlugin interface const KService::List pluginServices = KServiceTypeTrader::self()->query("KFileItemAction/Plugin"); - foreach (const KSharedPtr& service, pluginServices) { + foreach (const KService::Ptr& service, pluginServices) { const QString desktopEntryName = service->desktopEntryName(); if (!isInServicesList(desktopEntryName)) { - bool checked; - - KAbstractFileItemActionPlugin* abstractPlugin = service->createInstance(); - if (abstractPlugin) { - checked = showGroup.readEntry(desktopEntryName, abstractPlugin->enabledByDefault()); - } else { - checked = showGroup.readEntry(desktopEntryName, true); - } - + const bool checked = showGroup.readEntry(desktopEntryName, true); addRow(service->icon(), service->name(), desktopEntryName, checked); } } @@ -282,4 +273,3 @@ void ServicesSettingsPage::addRow(const QString& icon, m_serviceModel->setData(index, checked, Qt::CheckStateRole); } -#include "servicessettingspage.moc"