KUtils
kpluginselector.cpp
Go to the documentation of this file.
136 link->setText(i18n("Automatic changes have been performed due to plugin dependencies. Click here for further information"));
149 void KPluginSelector::Private::DependenciesWidget::addDependency(const QString &dependency, const QString &pluginCausant, bool added)
158 if (dependencyMap.contains(dependency)) // The dependency moved from added to removed or vice-versa
178 void KPluginSelector::Private::DependenciesWidget::userOverrideDependency(const QString &dependency)
203 QString message = i18n("Automatic changes have been performed in order to satisfy plugin dependencies:\n");
207 message += i18n("\n %1 plugin has been automatically checked because of the dependency of %2 plugin", dependency, dependencyMap[dependency].pluginCausant);
209 message += i18n("\n %1 plugin has been automatically unchecked because of its dependency on %2 plugin", dependency, dependencyMap[dependency].pluginCausant);
229 message += i18np("%1 plugin automatically added due to plugin dependencies", "%1 plugins automatically added due to plugin dependencies", addedByDependencies);
235 message += i18np("%1 plugin automatically removed due to plugin dependencies", "%1 plugins automatically removed due to plugin dependencies", removedByDependencies);
279 connect(pluginDelegate, SIGNAL(configCommitted(QByteArray)), this, SIGNAL(configCommitted(QByteArray)));
337 d->pluginModel->addPlugins(pluginInfoList, categoryName, categoryKey, cfgGroup, pluginLoadMethod, true /* manually added */);
371 d->pluginModel->setData(index, pluginEntry->pluginInfo.isPluginEnabledByDefault(), Qt::CheckStateRole);
382 if (d->pluginModel->data(index, Qt::CheckStateRole).toBool() != pluginEntry->pluginInfo.isPluginEnabledByDefault()) {
401 KPluginSelector::Private::PluginModel::PluginModel(KPluginSelector::Private *pluginSelector_d, QObject *parent)
411 void KPluginSelector::Private::PluginModel::addPlugins(const QList<KPluginInfo> &pluginList, const QString &categoryName, const QString &categoryKey, const KConfigGroup &cfgGroup, PluginLoadMethod pluginLoadMethod, bool manuallyAdded)
431 pluginEntry.isCheckable = !pluginInfo.isValid() || !pluginEntry.cfgGroup.isEntryImmutable(pluginInfo.pluginName() + QLatin1String("Enabled"));
435 !pluginInfo.property("X-KDE-PluginInfo-Category").toString().compare(categoryKey, Qt::CaseInsensitive)) &&
446 beginInsertRows(QModelIndex(), pluginEntryList.count(), pluginEntryList.count() + listToAdd.count() - 1);
452 QList<KService::Ptr> KPluginSelector::Private::PluginModel::pluginServices(const QModelIndex &index) const
457 QModelIndex KPluginSelector::Private::PluginModel::index(int row, int column, const QModelIndex &parent) const
461 return createIndex(row, column, (row < pluginEntryList.count()) ? (void*) &pluginEntryList.at(row)
510 bool KPluginSelector::Private::PluginModel::setData(const QModelIndex &index, const QVariant &value, int role)
539 KPluginSelector::Private::ProxyModel::ProxyModel(KPluginSelector::Private *pluginSelector_d, QObject *parent)
550 bool KPluginSelector::Private::ProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
564 bool KPluginSelector::Private::ProxyModel::subSortLessThan(const QModelIndex &left, const QModelIndex &right) const
566 return static_cast<PluginEntry*>(left.internalPointer())->pluginInfo.name().compare(static_cast<PluginEntry*>(right.internalPointer())->pluginInfo.name(), Qt::CaseInsensitive) < 0;
569 KPluginSelector::Private::PluginDelegate::PluginDelegate(KPluginSelector::Private *pluginSelector_d, QObject *parent)
584 void KPluginSelector::Private::PluginDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
599 QPixmap pixmap = KIconLoader::global()->loadIcon(index.model()->data(index, Qt::DecorationRole).toString(),
600 KIconLoader::Desktop, iconSize, disabled ? KIconLoader::DisabledState : KIconLoader::DefaultState);
602 painter->drawPixmap(QRect(pluginSelector_d->dependantLayoutValue(MARGIN + option.rect.left() + xOffset, iconSize, option.rect.width()), MARGIN + option.rect.top(), iconSize, iconSize), pixmap, QRect(0, 0, iconSize, iconSize));
607 QRect contentsRect(pluginSelector_d->dependantLayoutValue(MARGIN * 2 + iconSize + option.rect.left() + xOffset, option.rect.width() - MARGIN * 3 - iconSize - xOffset, option.rect.width()), MARGIN + option.rect.top(), option.rect.width() - MARGIN * 3 - iconSize - xOffset, option.rect.height() - MARGIN * 2);
635 painter->drawText(contentsRect, Qt::AlignLeft | Qt::AlignTop, fmTitle.elidedText(index.model()->data(index, Qt::DisplayRole).toString(), Qt::ElideRight, contentsRect.width()));
638 painter->drawText(contentsRect, Qt::AlignLeft | Qt::AlignBottom, option.fontMetrics.elidedText(index.model()->data(index, CommentRole).toString(), Qt::ElideRight, contentsRect.width()));
644 QSize KPluginSelector::Private::PluginDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
662 (pluginSelector_d->showIcons ? KIconLoader::SizeMedium : 0) + MARGIN * i + pushButton->sizeHint().width() * j,
663 qMax(KIconLoader::SizeMedium + MARGIN * 2, fmTitle.height() + option.fontMetrics.height() + MARGIN * 2));
705 checkBox->move(pluginSelector_d->dependantLayoutValue(MARGIN, checkBox->sizeHint().width(), option.rect.width()), option.rect.height() / 2 - checkBox->sizeHint().height() / 2);
710 aboutPushButton->move(pluginSelector_d->dependantLayoutValue(option.rect.width() - MARGIN - aboutPushButtonSizeHint.width(), aboutPushButtonSizeHint.width(), option.rect.width()), option.rect.height() / 2 - aboutPushButtonSizeHint.height() / 2);
715 configurePushButton->move(pluginSelector_d->dependantLayoutValue(option.rect.width() - MARGIN * 2 - configurePushButtonSizeHint.width() - aboutPushButtonSizeHint.width(), configurePushButtonSizeHint.width(), option.rect.width()), option.rect.height() / 2 - configurePushButtonSizeHint.height() / 2);
767 aboutPlugin.setPlainCaption(i18nc("Used only for plugins", "About %1", aboutData->programName()));
782 KAboutData aboutData(name.toUtf8(), name.toUtf8(), ki18n(name.toUtf8()), version.toUtf8(), ki18n(comment.toUtf8()), KAboutLicense::byKeyword(license).key(), ki18n(QByteArray()), ki18n(QByteArray()), website.toLatin1());
796 aboutPlugin.setPlainCaption(i18nc("Used only for plugins", "About %1", aboutData.programName()));
870 QStringList parentComponents = moduleProxy->moduleInfo().service()->property("X-KDE-ParentComponents").toStringList();
QList< KService::Ptr > pluginServices(const QModelIndex &index) const
Definition: kpluginselector.cpp:452
void message(KMessage::MessageType messageType, const QString &text, const QString &caption=QString())
QString i18n(const char *text)
void addPlugins(const QList< KPluginInfo > &pluginList, const QString &categoryName, const QString &categoryKey, const KConfigGroup &cfgGroup, PluginLoadMethod pluginLoadMethod=ReadConfigFile, bool manuallyAdded=false)
Definition: kpluginselector.cpp:411
Definition: kpluginselector_p.h:44
QVariant property(const QString &key) const
bool noDisplay() const
KAboutData & addAuthor(const KLocalizedString &name, const KLocalizedString &task=KLocalizedString(), const QByteArray &emailAddress=QByteArray(), const QByteArray &webAddress=QByteArray())
QString email() const
static KPluginInfo::List fromFiles(const QStringList &files, const KConfigGroup &config=KConfigGroup())
void userOverrideDependency(const QString &dependency)
Definition: kpluginselector.cpp:178
KAboutData::LicenseKey key() const
static KIconLoader * global()
void setHighlightedColor(const QColor &highcolor)
virtual QSize sizeHint() const
PluginDelegate(KPluginSelector::Private *pluginSelector_d, QObject *parent=0)
Definition: kpluginselector.cpp:569
KLocalizedString ki18n(const char *msg)
QString i18np(const char *sing, const char *plur, const A1 &a1)
bool isPluginEnabled() const
KService::Ptr service() const
QString label(StandardShortcut id)
static void information(QWidget *parent, const QString &text, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
This widget will inform the user about changes that happened automatically due to plugin dependencies...
Definition: kpluginselector_p.h:111
bool isEntryImmutable(const QString &key) const
void changed(bool hasChanged)
Tells you whether the configuration is changed or not.
QVariant property(const QString &_name, QVariant::Type t) const
bool isValid() const
KStandardDirs * dirs()
void setUnderline(bool on=true)
QString license() const
const char * name(StandardAction id)
QString comment() const
void load()
Load the state of the plugins (selected or not) from the KPluginInfo objects.
Definition: kpluginselector.cpp:341
QString version() const
bool isValid() const
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
int dependantLayoutValue(int value, int width, int totalWidth) const
Definition: kpluginselector.cpp:99
QString i18nc(const char *ctxt, const char *text)
KSharedConfigPtr config()
void setCategoryDrawer(KCategoryDrawer *categoryDrawer)
void setCategorizedModel(bool categorizedModel)
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: kpluginselector.cpp:530
QStringList dependencies() const
void load(const KConfigGroup &config=KConfigGroup())
QPixmap loadIcon(const QString &name, KIconLoader::Group group, int size=0, int state=KIconLoader::DefaultState, const QStringList &overlays=QStringList(), QString *path_store=0L, bool canReturnNull=false) const
void load()
Calling it will cause the contained module to run its load() routine.
Definition: kcmoduleproxy.cpp:265
void setPluginEnabled(bool enabled)
QList< KService::Ptr > kcmServices() const
ProxyModel(KPluginSelector::Private *pluginSelector_d, QObject *parent=0)
Definition: kpluginselector.cpp:539
~PluginDelegate()
Definition: kpluginselector.cpp:578
void addPlugins(const QString &componentName, const QString &categoryName=QString(), const QString &categoryKey=QString(), KSharedConfig::Ptr config=KSharedConfig::Ptr())
Add a list of KParts plugins.
Definition: kpluginselector.cpp:293
DependenciesWidget * dependenciesWidget
Definition: kpluginselector_p.h:83
CopyJob * link(const KUrl &src, const KUrl &destDir, JobFlags flags=DefaultFlags)
QString componentName() const
KConfigGroup config() const
virtual void setModel(QAbstractItemModel *model)
void setFloatEnabled(bool do_float=true)
void defaults()
Calling it will cause the contained module to load its default values.
Definition: kcmoduleproxy.cpp:285
QString name() const
QString website() const
#define MARGIN
This file is part of the KDE project Copyright (C) 2007, 2006 Rafael Fernández López ereslibre@kde...
Definition: kpluginselector.cpp:48
bool isPluginEnabledByDefault() const
~PluginModel()
Definition: kpluginselector.cpp:407
~DependenciesWidget()
Definition: kpluginselector.cpp:145
void save(KConfigGroup config=KConfigGroup())
QString programName() const
PluginModel(KPluginSelector::Private *pluginSelector_d, QObject *parent=0)
Definition: kpluginselector.cpp:401
Definition: kpluginselector_p.h:87
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: kpluginselector.cpp:644
virtual QModelIndex index(int row, int column=0, const QModelIndex &parent=QModelIndex()) const
Definition: kpluginselector.cpp:457
void configCommitted(const QByteArray &componentName)
Emitted after the config of an embedded KCM has been saved.
virtual void updateItemWidgets(const QList< QWidget * > widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const
Definition: kpluginselector.cpp:699
void setIcon(const KIcon &icon)
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: kpluginselector.cpp:510
QString icon() const
unsigned int version()
static KAboutLicense byKeyword(const QString &keyword)
void setUseCursor(bool on, QCursor *cursor=0L)
void setClearButtonShown(bool show)
KAboutData & setProgramIconName(const QString &iconName)
virtual QList< QWidget * > createItemWidgets() const
Definition: kpluginselector.cpp:666
void setSelectedColor(const QColor &color)
void setClickMessage(const QString &msg)
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: kpluginselector.cpp:465
void sync()
QStringList findAllResources(const char *type, const QString &filter=QString(), SearchOptions options=NoSearchOptions) const
void save()
Calling it will cause the contained module to run its save() routine.
Definition: kcmoduleproxy.cpp:275
virtual void sort(int column, Qt::SortOrder order=Qt::AscendingOrder)
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
Definition: kpluginselector.cpp:550
QString author() const
bool isDefault() const
Returns true if the plugin selector does not have any changes to application defaults.
Definition: kpluginselector.cpp:377
void setGlowEnabled(bool glow=true)
void updateDependencies(PluginEntry *pluginEntry, bool added)
Definition: kpluginselector.cpp:64
DependenciesWidget(QWidget *parent=0)
Definition: kpluginselector.cpp:108
KCategoryDrawer * categoryDrawer
Definition: kpluginselector_p.h:79
virtual bool subSortLessThan(const QModelIndex &left, const QModelIndex &right) const
Definition: kpluginselector.cpp:564
void clearDependencies()
Definition: kpluginselector.cpp:193
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: kpluginselector.cpp:584
A widget to select what plugins to load and configure the plugins.
Definition: kpluginselector.h:58
QString pluginName() const
void addDependency(const QString &dependency, const QString &pluginCausant, bool added)
Definition: kpluginselector.cpp:149
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:34 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:34 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.