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();
QLayout * layout() const
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
const QPalette & palette() const
Definition: kpluginselector_p.h:44
void insertSpacing(int index, int size)
void setAlternatingRowColors(bool enable)
QVariant property(const QString &key) const
int width() const
bool noDisplay() const
KAboutData & addAuthor(const KLocalizedString &name, const KLocalizedString &task=KLocalizedString(), const QByteArray &emailAddress=QByteArray(), const QByteArray &webAddress=QByteArray())
const QBrush & text() const
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()
QRect contentsRect() const
void setHighlightedColor(const QColor &highcolor)
virtual QSize sizeHint() const
virtual void setSourceModel(QAbstractItemModel *sourceModel)
PluginDelegate(KPluginSelector::Private *pluginSelector_d, QObject *parent=0)
Definition: kpluginselector.cpp:569
KLocalizedString ki18n(const char *msg)
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
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
void setPixmap(const QPixmap &)
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
virtual QSize sizeHint() const
bool isValid() const
KStandardDirs * dirs()
void setUnderline(bool on=true)
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QString license() const
void translate(int dx, int dy)
virtual void setVisible(bool visible)
void save()
QString comment() const
void setAttribute(Qt::WidgetAttribute attribute, bool on)
T value() const
void setAlignment(QFlags< Qt::AlignmentFlag >)
QWidget * viewport() const
void load()
Load the state of the plugins (selected or not) from the KPluginInfo objects.
Definition: kpluginselector.cpp:341
QString version() const
void setVerticalScrollMode(ScrollMode mode)
bool isValid() const
const QAbstractItemModel * model() const
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
void setIcon(const QIcon &icon)
int dependantLayoutValue(int value, int width, int totalWidth) const
Definition: kpluginselector.cpp:99
void setParent(QWidget *parent)
QString i18nc(const char *ctxt, const char *text)
KSharedConfigPtr config()
void setCategoryDrawer(KCategoryDrawer *categoryDrawer)
void setCategorizedModel(bool categorizedModel)
int width() const
const QColor & color() const
void resize(int w, int h)
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: kpluginselector.cpp:530
const char * name() const
QStringList dependencies() const
bool isValid() const
void setFont(const QFont &font)
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 setEnabled(bool)
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
int count(const T &value) const
bool isValid() const
QString & insert(int position, QChar ch)
void setLayout(QLayout *layout)
void load()
Calling it will cause the contained module to run its load() routine.
Definition: kcmoduleproxy.cpp:265
void setPen(const QColor &color)
void setPluginEnabled(bool enabled)
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
bool isEmpty() const
QList< KService::Ptr > kcmServices() const
void setWidth(int width)
bool isEmpty() const
void setItemDelegate(QAbstractItemDelegate *delegate)
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags) const
int addTab(QWidget *page, const QString &label)
ProxyModel(KPluginSelector::Private *pluginSelector_d, QObject *parent=0)
Definition: kpluginselector.cpp:539
QAbstractItemDelegate * itemDelegate() const
void move(int x, int y)
~PluginDelegate()
Definition: kpluginselector.cpp:578
void drawText(const QPointF &position, const QString &text)
void * internalPointer() const
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
virtual QVariant data(const QModelIndex &index, int role) const =0
CopyJob * link(const KUrl &src, const KUrl &destDir, JobFlags flags=DefaultFlags)
QString componentName() const
void setText(const QString &)
KConfigGroup config() const
void setMargin(int margin)
void setSizePolicy(QSizePolicy)
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
bool contains(QChar ch, Qt::CaseSensitivity cs) 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
const QFont & font() const
int width(const QString &text, int len) const
bool contains(const T &value) const
bool isPluginEnabledByDefault() const
QVariant fromValue(const T &value)
~PluginModel()
Definition: kpluginselector.cpp:407
~DependenciesWidget()
Definition: kpluginselector.cpp:145
void save(KConfigGroup config=KConfigGroup())
void restore()
void setChecked(bool)
QString programName() const
PluginModel(KPluginSelector::Private *pluginSelector_d, QObject *parent=0)
Definition: kpluginselector.cpp:401
bool setAlignment(QWidget *w, QFlags< Qt::AlignmentFlag > alignment)
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
QByteArray toLatin1() const
int width() const
const QAbstractItemModel * model() const
QStringList toStringList() const
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)
QStyle * style()
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)
QWidget(QWidget *parent, QFlags< Qt::WindowType > f)
int height() const
int height() const
void setUseCursor(bool on, QCursor *cursor=0L)
bool toBool() const
void setMouseTracking(bool enable)
virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0
bool isValid() const
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
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * parent() const
int compare(const QString &other) const
void setGlowEnabled(bool glow=true)
QString toString() const
void updateDependencies(PluginEntry *pluginEntry, bool added)
Definition: kpluginselector.cpp:64
void setCurrentColorGroup(ColorGroup cg)
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
void addLayout(QLayout *layout, int stretch)
QString pluginName() const
void addDependency(const QString &dependency, const QString &pluginCausant, bool added)
Definition: kpluginselector.cpp:149
QByteArray toUtf8() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:25:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:25:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.