Changeset View
Changeset View
Standalone View
Standalone View
src/kpluginselector.cpp
Show First 20 Lines • Show All 408 Lines • ▼ Show 20 Line(s) | 408 | { | |||
---|---|---|---|---|---|
409 | d->kcmArguments = arguments; | 409 | d->kcmArguments = arguments; | ||
410 | } | 410 | } | ||
411 | 411 | | |||
412 | QStringList KPluginSelector::configurationArguments() const | 412 | QStringList KPluginSelector::configurationArguments() const | ||
413 | { | 413 | { | ||
414 | return d->kcmArguments; | 414 | return d->kcmArguments; | ||
415 | } | 415 | } | ||
416 | 416 | | |||
417 | void KPluginSelector::showConfiguration(const QString& componentName) | ||||
418 | { | ||||
419 | QModelIndex idx; | ||||
420 | for (int i = 0, c = d->proxyModel->rowCount(); i<c; ++i) { | ||||
421 | const auto currentIndex = d->proxyModel->index(i, 0); | ||||
422 | const auto entry = currentIndex.data(KPluginSelector::Private::PluginEntryRole).value<PluginEntry *>(); | ||||
423 | if (entry->pluginInfo.pluginName() == componentName) { | ||||
424 | idx = currentIndex; | ||||
425 | break; | ||||
426 | } | ||||
427 | } | ||||
428 | | ||||
429 | if (idx.isValid()) { | ||||
430 | auto delegate = static_cast<KPluginSelector::Private::PluginDelegate*>(d->listView->itemDelegate()); | ||||
431 | delegate->configure(idx); | ||||
432 | } else { | ||||
433 | qWarning() << "Could not find plugin" << componentName; | ||||
434 | } | ||||
435 | } | ||||
436 | | ||||
417 | KPluginSelector::Private::PluginModel::PluginModel(KPluginSelector::Private *pluginSelector_d, QObject *parent) | 437 | KPluginSelector::Private::PluginModel::PluginModel(KPluginSelector::Private *pluginSelector_d, QObject *parent) | ||
418 | : QAbstractListModel(parent) | 438 | : QAbstractListModel(parent) | ||
419 | , pluginSelector_d(pluginSelector_d) | 439 | , pluginSelector_d(pluginSelector_d) | ||
420 | { | 440 | { | ||
421 | } | 441 | } | ||
422 | 442 | | |||
423 | KPluginSelector::Private::PluginModel::~PluginModel() | 443 | KPluginSelector::Private::PluginModel::~PluginModel() | ||
424 | { | 444 | { | ||
▲ Show 20 Lines • Show All 366 Lines • ▼ Show 20 Line(s) | 787 | { | |||
791 | } | 811 | } | ||
792 | KAboutApplicationDialog aboutPlugin(aboutData, itemView()); | 812 | KAboutApplicationDialog aboutPlugin(aboutData, itemView()); | ||
793 | aboutPlugin.setWindowTitle(i18nc("Used only for plugins", "About %1", aboutData.displayName())); | 813 | aboutPlugin.setWindowTitle(i18nc("Used only for plugins", "About %1", aboutData.displayName())); | ||
794 | aboutPlugin.exec(); | 814 | aboutPlugin.exec(); | ||
795 | } | 815 | } | ||
796 | 816 | | |||
797 | void KPluginSelector::Private::PluginDelegate::slotConfigureClicked() | 817 | void KPluginSelector::Private::PluginDelegate::slotConfigureClicked() | ||
798 | { | 818 | { | ||
799 | const QModelIndex index = focusedIndex(); | 819 | configure(focusedIndex()); | ||
820 | } | ||||
821 | | ||||
822 | void KPluginSelector::Private::PluginDelegate::configure(const QModelIndex& index) | ||||
823 | { | ||||
800 | const QAbstractItemModel *model = index.model(); | 824 | const QAbstractItemModel *model = index.model(); | ||
801 | 825 | | |||
802 | PluginEntry *pluginEntry = model->data(index, PluginEntryRole).value<PluginEntry *>(); | 826 | PluginEntry *pluginEntry = model->data(index, PluginEntryRole).value<PluginEntry *>(); | ||
803 | KPluginInfo pluginInfo = pluginEntry->pluginInfo; | 827 | KPluginInfo pluginInfo = pluginEntry->pluginInfo; | ||
804 | 828 | | |||
805 | QDialog configDialog(itemView()); | 829 | QDialog configDialog(itemView()); | ||
806 | configDialog.setWindowTitle(model->data(index, NameRole).toString()); | 830 | configDialog.setWindowTitle(model->data(index, NameRole).toString()); | ||
807 | // The number of KCModuleProxies in use determines whether to use a tabwidget | 831 | // The number of KCModuleProxies in use determines whether to use a tabwidget | ||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |