Changeset View
Changeset View
Standalone View
Standalone View
src/kpluginselector.cpp
Show First 20 Lines • Show All 200 Lines • ▼ Show 20 Line(s) | 199 | { | |||
---|---|---|---|---|---|
201 | removedByDependencies = 0; | 201 | removedByDependencies = 0; | ||
202 | dependencyMap.clear(); | 202 | dependencyMap.clear(); | ||
203 | updateDetails(); | 203 | updateDetails(); | ||
204 | } | 204 | } | ||
205 | 205 | | |||
206 | void KPluginSelector::Private::DependenciesWidget::showDependencyDetails() | 206 | void KPluginSelector::Private::DependenciesWidget::showDependencyDetails() | ||
207 | { | 207 | { | ||
208 | QString message = i18n("Automatic changes have been performed in order to satisfy plugin dependencies:\n"); | 208 | QString message = i18n("Automatic changes have been performed in order to satisfy plugin dependencies:\n"); | ||
209 | foreach (const QString &dependency, dependencyMap.keys()) { | 209 | const auto lstKeys = dependencyMap.keys(); | ||
210 | for (const QString &dependency : lstKeys) { | ||||
210 | if (dependencyMap[dependency].added) { | 211 | if (dependencyMap[dependency].added) { | ||
211 | message += i18n("\n %1 plugin has been automatically checked because of the dependency of %2 plugin", dependency, dependencyMap[dependency].pluginCausant); | 212 | message += i18n("\n %1 plugin has been automatically checked because of the dependency of %2 plugin", dependency, dependencyMap[dependency].pluginCausant); | ||
212 | } else { | 213 | } else { | ||
213 | message += i18n("\n %1 plugin has been automatically unchecked because of its dependency on %2 plugin", dependency, dependencyMap[dependency].pluginCausant); | 214 | message += i18n("\n %1 plugin has been automatically unchecked because of its dependency on %2 plugin", dependency, dependencyMap[dependency].pluginCausant); | ||
214 | } | 215 | } | ||
215 | } | 216 | } | ||
216 | KMessageBox::information(this, message, i18n("Dependency Check")); | 217 | KMessageBox::information(this, message, i18n("Dependency Check")); | ||
217 | 218 | | |||
▲ Show 20 Lines • Show All 225 Lines • ▼ Show 20 Line(s) | |||||
443 | KPluginSelector::Private::PluginModel::~PluginModel() | 444 | KPluginSelector::Private::PluginModel::~PluginModel() | ||
444 | { | 445 | { | ||
445 | } | 446 | } | ||
446 | 447 | | |||
447 | void KPluginSelector::Private::PluginModel::addPlugins(const QList<KPluginInfo> &pluginList, const QString &categoryName, const QString &categoryKey, const KConfigGroup &cfgGroup, PluginLoadMethod pluginLoadMethod, bool manuallyAdded) | 448 | void KPluginSelector::Private::PluginModel::addPlugins(const QList<KPluginInfo> &pluginList, const QString &categoryName, const QString &categoryKey, const KConfigGroup &cfgGroup, PluginLoadMethod pluginLoadMethod, bool manuallyAdded) | ||
448 | { | 449 | { | ||
449 | QList<PluginEntry> listToAdd; | 450 | QList<PluginEntry> listToAdd; | ||
450 | 451 | | |||
451 | foreach (const KPluginInfo &pluginInfo, pluginList) { | 452 | for (const KPluginInfo &pluginInfo : pluginList) { | ||
452 | PluginEntry pluginEntry; | 453 | PluginEntry pluginEntry; | ||
453 | pluginEntry.category = categoryName; | 454 | pluginEntry.category = categoryName; | ||
454 | pluginEntry.pluginInfo = pluginInfo; | 455 | pluginEntry.pluginInfo = pluginInfo; | ||
455 | if (pluginLoadMethod == ReadConfigFile) { | 456 | if (pluginLoadMethod == ReadConfigFile) { | ||
456 | pluginEntry.pluginInfo.load(cfgGroup); | 457 | pluginEntry.pluginInfo.load(cfgGroup); | ||
457 | } | 458 | } | ||
458 | pluginEntry.checked = pluginInfo.isPluginEnabled(); | 459 | pluginEntry.checked = pluginInfo.isPluginEnabled(); | ||
459 | pluginEntry.manuallyAdded = manuallyAdded; | 460 | pluginEntry.manuallyAdded = manuallyAdded; | ||
▲ Show 20 Lines • Show All 337 Lines • ▼ Show 20 Line(s) | 788 | { | |||
797 | const QString license = model->data(index, LicenseRole).toString(); | 798 | const QString license = model->data(index, LicenseRole).toString(); | ||
798 | 799 | | |||
799 | KAboutData aboutData(name, name, version, comment, KAboutLicense::byKeyword(license).key(), QString(), QString(), website); | 800 | KAboutData aboutData(name, name, version, comment, KAboutLicense::byKeyword(license).key(), QString(), QString(), website); | ||
800 | aboutData.setProgramIconName(index.model()->data(index, Qt::DecorationRole).toString()); | 801 | aboutData.setProgramIconName(index.model()->data(index, Qt::DecorationRole).toString()); | ||
801 | const QStringList authors = author.split(QLatin1Char(',')); | 802 | const QStringList authors = author.split(QLatin1Char(',')); | ||
802 | const QStringList emails = email.split(QLatin1Char(',')); | 803 | const QStringList emails = email.split(QLatin1Char(',')); | ||
803 | if (authors.count() == emails.count()) { | 804 | if (authors.count() == emails.count()) { | ||
804 | int i = 0; | 805 | int i = 0; | ||
805 | foreach (const QString &author, authors) { | 806 | for (const QString &author : authors) { | ||
806 | if (!author.isEmpty()) { | 807 | if (!author.isEmpty()) { | ||
807 | aboutData.addAuthor(author, QString(), emails[i]); | 808 | aboutData.addAuthor(author, QString(), emails[i]); | ||
808 | } | 809 | } | ||
809 | i++; | 810 | i++; | ||
810 | } | 811 | } | ||
811 | } | 812 | } | ||
812 | KAboutApplicationDialog aboutPlugin(aboutData, itemView()); | 813 | KAboutApplicationDialog aboutPlugin(aboutData, itemView()); | ||
813 | aboutPlugin.setWindowTitle(i18nc("Used only for plugins", "About %1", aboutData.displayName())); | 814 | aboutPlugin.setWindowTitle(i18nc("Used only for plugins", "About %1", aboutData.displayName())); | ||
Show All 18 Lines | 824 | { | |||
832 | QTabWidget *newTabWidget = nullptr; | 833 | QTabWidget *newTabWidget = nullptr; | ||
833 | // Widget to use for the setting dialog's main widget, | 834 | // Widget to use for the setting dialog's main widget, | ||
834 | // either a QTabWidget or a KCModuleProxy | 835 | // either a QTabWidget or a KCModuleProxy | ||
835 | QWidget *mainWidget = nullptr; | 836 | QWidget *mainWidget = nullptr; | ||
836 | // Widget to use as the KCModuleProxy's parent. | 837 | // Widget to use as the KCModuleProxy's parent. | ||
837 | // The first proxy is owned by the dialog itself | 838 | // The first proxy is owned by the dialog itself | ||
838 | QWidget *moduleProxyParentWidget = &configDialog; | 839 | QWidget *moduleProxyParentWidget = &configDialog; | ||
839 | 840 | | |||
840 | foreach (const KService::Ptr &servicePtr, pluginInfo.kcmServices()) { | 841 | const auto lstServices = pluginInfo.kcmServices(); | ||
842 | for (const KService::Ptr &servicePtr : lstServices) { | ||||
841 | if (!servicePtr->noDisplay()) { | 843 | if (!servicePtr->noDisplay()) { | ||
842 | KCModuleInfo moduleInfo(servicePtr); | 844 | KCModuleInfo moduleInfo(servicePtr); | ||
843 | KCModuleProxy *currentModuleProxy = new KCModuleProxy(moduleInfo, moduleProxyParentWidget, pluginSelector_d->kcmArguments); | 845 | KCModuleProxy *currentModuleProxy = new KCModuleProxy(moduleInfo, moduleProxyParentWidget, pluginSelector_d->kcmArguments); | ||
844 | if (currentModuleProxy->realModule()) { | 846 | if (currentModuleProxy->realModule()) { | ||
845 | moduleProxyList << currentModuleProxy; | 847 | moduleProxyList << currentModuleProxy; | ||
846 | if (mainWidget && !newTabWidget) { | 848 | if (mainWidget && !newTabWidget) { | ||
847 | // we already created one KCModuleProxy, so we need a tab widget. | 849 | // we already created one KCModuleProxy, so we need a tab widget. | ||
848 | // Move the first proxy into the tab widget and ensure this and subsequent | 850 | // Move the first proxy into the tab widget and ensure this and subsequent | ||
Show All 39 Lines | 879 | if (!moduleProxyList.isEmpty()) { | |||
888 | connect(buttonBox, &QDialogButtonBox::accepted, &configDialog, &QDialog::accept); | 890 | connect(buttonBox, &QDialogButtonBox::accepted, &configDialog, &QDialog::accept); | ||
889 | connect(buttonBox, &QDialogButtonBox::rejected, &configDialog, &QDialog::reject); | 891 | connect(buttonBox, &QDialogButtonBox::rejected, &configDialog, &QDialog::reject); | ||
890 | connect(buttonBox->button(QDialogButtonBox::RestoreDefaults), &QAbstractButton::clicked, this, &PluginDelegate::slotDefaultClicked); | 892 | connect(buttonBox->button(QDialogButtonBox::RestoreDefaults), &QAbstractButton::clicked, this, &PluginDelegate::slotDefaultClicked); | ||
891 | layout->addWidget(buttonBox); | 893 | layout->addWidget(buttonBox); | ||
892 | 894 | | |||
893 | configDialog.setLayout(layout); | 895 | configDialog.setLayout(layout); | ||
894 | 896 | | |||
895 | if (configDialog.exec() == QDialog::Accepted) { | 897 | if (configDialog.exec() == QDialog::Accepted) { | ||
896 | foreach (KCModuleProxy *moduleProxy, moduleProxyList) { | 898 | for (KCModuleProxy *moduleProxy : qAsConst(moduleProxyList)) { | ||
897 | QStringList parentComponents = moduleProxy->moduleInfo().service()->property(QStringLiteral("X-KDE-ParentComponents")).toStringList(); | 899 | const QStringList parentComponents = moduleProxy->moduleInfo().service()->property(QStringLiteral("X-KDE-ParentComponents")).toStringList(); | ||
898 | moduleProxy->save(); | 900 | moduleProxy->save(); | ||
899 | foreach (const QString &parentComponent, parentComponents) { | 901 | for (const QString &parentComponent : parentComponents) { | ||
900 | emit configCommitted(parentComponent.toLatin1()); | 902 | emit configCommitted(parentComponent.toLatin1()); | ||
901 | } | 903 | } | ||
902 | } | 904 | } | ||
903 | } else { | 905 | } else { | ||
904 | foreach (KCModuleProxy *moduleProxy, moduleProxyList) { | 906 | for (KCModuleProxy *moduleProxy : qAsConst(moduleProxyList)) { | ||
905 | moduleProxy->load(); | 907 | moduleProxy->load(); | ||
906 | } | 908 | } | ||
907 | } | 909 | } | ||
908 | 910 | | |||
909 | qDeleteAll(moduleProxyList); | 911 | qDeleteAll(moduleProxyList); | ||
910 | moduleProxyList.clear(); | 912 | moduleProxyList.clear(); | ||
911 | } | 913 | } | ||
912 | } | 914 | } | ||
913 | 915 | | |||
914 | void KPluginSelector::Private::PluginDelegate::slotDefaultClicked() | 916 | void KPluginSelector::Private::PluginDelegate::slotDefaultClicked() | ||
915 | { | 917 | { | ||
916 | foreach (KCModuleProxy *moduleProxy, moduleProxyList) { | 918 | for (KCModuleProxy *moduleProxy : qAsConst(moduleProxyList)) { | ||
917 | moduleProxy->defaults(); | 919 | moduleProxy->defaults(); | ||
918 | } | 920 | } | ||
919 | } | 921 | } | ||
920 | 922 | | |||
921 | QFont KPluginSelector::Private::PluginDelegate::titleFont(const QFont &baseFont) const | 923 | QFont KPluginSelector::Private::PluginDelegate::titleFont(const QFont &baseFont) const | ||
922 | { | 924 | { | ||
923 | QFont retFont(baseFont); | 925 | QFont retFont(baseFont); | ||
924 | retFont.setBold(true); | 926 | retFont.setBold(true); | ||
925 | 927 | | |||
926 | return retFont; | 928 | return retFont; | ||
927 | } | 929 | } | ||
928 | 930 | | |||
929 | #include "moc_kpluginselector_p.cpp" | 931 | #include "moc_kpluginselector_p.cpp" | ||
930 | #include "moc_kpluginselector.cpp" | 932 | #include "moc_kpluginselector.cpp" |