setButtons(KCModule::Help | KCModule::Apply);
- connect(pluginstable, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(slotPluginItemChanged(QTableWidgetItem*)));
+ connect(
+ pluginstree, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
+ this, SLOT(slotPluginItemChanged(QTreeWidgetItem*,int))
+ );
- connect(metainfolist, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(slotMetaItemChanged(QListWidgetItem*)));
+ connect(
+ metainfolist, SIGNAL(itemChanged(QListWidgetItem*)),
+ this, SLOT(slotMetaItemChanged(QListWidgetItem*))
+ );
load();
}
{
{
KConfig config("kmetainformationrc", KConfig::NoGlobals);
- pluginstable->clearContents();
- pluginstable->setRowCount(0);
- int rowcount = 0;
+ pluginstree->clear();
KConfigGroup pluginsgroup = config.group("Plugins");
const KService::List kfmdplugins = KServiceTypeTrader::self()->query("KFileMetaData/Plugin");
foreach (const KService::Ptr &kfmdplugin, kfmdplugins) {
const QString key = kfmdplugin->desktopEntryName();
-
- pluginstable->setRowCount(rowcount + 1);
-
- QTableWidgetItem* nameitem = new QTableWidgetItem();
- nameitem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
- nameitem->setText(kfmdplugin->genericName());
- nameitem->setData(Qt::UserRole, key);
const bool enable = pluginsgroup.readEntry(key, true);
- nameitem->setCheckState(enable ? Qt::Checked : Qt::Unchecked);
- pluginstable->setItem(rowcount, 0, nameitem);
-
- QTableWidgetItem* descitem = new QTableWidgetItem();
- descitem->setFlags(Qt::ItemIsEnabled);
- descitem->setText(kfmdplugin->comment());
- pluginstable->setItem(rowcount, 1, descitem);
- rowcount++;
+ QTreeWidgetItem* pluginitem = new QTreeWidgetItem();
+ pluginitem->setData(0, Qt::UserRole, key);
+ pluginitem->setCheckState(0, enable ? Qt::Checked : Qt::Unchecked);
+ pluginitem->setText(1, kfmdplugin->genericName());
+ pluginitem->setText(2, kfmdplugin->comment());
+ pluginstree->addTopLevelItem(pluginitem);
}
+ pluginstree->resizeColumnToContents(0);
+ pluginstree->resizeColumnToContents(1);
+ pluginstree->resizeColumnToContents(2);
}
loadMetaInfo();
{
KConfig config("kmetainformationrc", KConfig::NoGlobals);
KConfigGroup pluginsgroup = config.group("Plugins");
- for (int i = 0; i < pluginstable->rowCount(); ++i) {
- QTableWidgetItem* item = pluginstable->item(i, 0);
- const bool enable = (item->checkState() == Qt::Checked);
- const QString key = item->data(Qt::UserRole).toString();
+ for (int i = 0; i < pluginstree->topLevelItemCount(); ++i) {
+ QTreeWidgetItem* item = pluginstree->topLevelItem(i);
+ const bool enable = (item->checkState(0) == Qt::Checked);
+ const QString key = item->data(0, Qt::UserRole).toString();
pluginsgroup.writeEntry(key, enable);
}
loadMetaInfo();
}
-void KCMMetaInfo::slotPluginItemChanged(QTableWidgetItem *item)
+void KCMMetaInfo::slotPluginItemChanged(QTreeWidgetItem *item, int column)
{
Q_UNUSED(item);
+ Q_UNUSED(column);
emit changed(true);
}
<property name="toolTip">
<string><html><head/><body><p>Meta information shown in tooltips and properties dialogs.</p></body></html></string>
</property>
- <property name="selectionMode">
- <enum>QAbstractItemView::NoSelection</enum>
+ <property name="selectionBehavior">
+ <enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
- <widget class="QTableWidget" name="pluginstable">
+ <widget class="QTreeWidget" name="pluginstree">
<property name="toolTip">
- <string><html><head/><body><p>Disabling undesired plugins can reduce the disk I/O during directory listing</p></body></html></string>
+ <string><html><head/><body><p>Disabling undesired plugins can reduce the disk I/O during directory listing.</p></body></html></string>
</property>
- <property name="selectionMode">
- <enum>QAbstractItemView::NoSelection</enum>
+ <property name="rootIsDecorated">
+ <bool>false</bool>
</property>
- <property name="sortingEnabled">
- <bool>true</bool>
+ <property name="columnCount">
+ <number>3</number>
</property>
- <attribute name="horizontalHeaderStretchLastSection">
- <bool>true</bool>
- </attribute>
- <attribute name="verticalHeaderVisible">
- <bool>false</bool>
- </attribute>
+ <column>
+ <property name="text">
+ <string notr="true">Use</string>
+ </property>
+ </column>
<column>
<property name="text">
<string>Plugin</string>