#include <QLabel>
#include <QListView>
#include <QPainter>
+#include <QScroller>
#include <QShowEvent>
#include <QSortFilterProxyModel>
#include <QSpinBox>
QLabel* showPreviewsLabel = new QLabel(i18nc("@title:group", "Show previews in the view for:"), this);
m_listView = new QListView(this);
+ QScroller::grabGesture(m_listView->viewport(), QScroller::TouchGesture);
ServiceItemDelegate* delegate = new ServiceItemDelegate(m_listView, m_listView);
connect(delegate, &ServiceItemDelegate::requestServiceConfiguration,
m_listView->setModel(proxyModel);
m_listView->setItemDelegate(delegate);
m_listView->setVerticalScrollMode(QListView::ScrollPerPixel);
+ m_listView->setUniformItemSizes(true);
QLabel* localFileSizeLabel = new QLabel(i18n("Skip previews for local files above:"), this);
loadSettings();
connect(m_listView, &QListView::clicked, this, &PreviewsSettingsPage::changed);
- connect(m_localFileSizeBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &PreviewsSettingsPage::changed);
- connect(m_remoteFileSizeBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &PreviewsSettingsPage::changed);
+ connect(m_localFileSizeBox, &QSpinBox::valueChanged, this, &PreviewsSettingsPage::changed);
+ connect(m_remoteFileSizeBox, &QSpinBox::valueChanged, this, &PreviewsSettingsPage::changed);
}
PreviewsSettingsPage::~PreviewsSettingsPage()
globalConfig.writeEntry("MaximumRemoteSize",
maximumRemoteSize,
KConfigBase::Normal | KConfigBase::Global);
+
globalConfig.sync();
}
{
QAbstractItemModel* model = m_listView->model();
- const KService::List plugins = KServiceTypeTrader::self()->query(QStringLiteral("ThumbCreator"));
- foreach (const KService::Ptr& service, plugins) {
- const bool configurable = service->property(QStringLiteral("Configurable"), QVariant::Bool).toBool();
- const bool show = m_enabledPreviewPlugins.contains(service->desktopEntryName());
+ const QVector<KPluginMetaData> plugins = KIO::PreviewJob::availableThumbnailerPlugins();
+ for (const KPluginMetaData &plugin : plugins) {
+ const bool configurable = plugin.value(QStringLiteral("Configurable"), false);
+ const bool show = m_enabledPreviewPlugins.contains(plugin.pluginId());
model->insertRow(0);
const QModelIndex index = model->index(0, 0);
model->setData(index, show, Qt::CheckStateRole);
model->setData(index, configurable, ServiceModel::ConfigurableRole);
- model->setData(index, service->name(), Qt::DisplayRole);
- model->setData(index, service->desktopEntryName(), ServiceModel::DesktopEntryNameRole);
+ model->setData(index, plugin.name(), Qt::DisplayRole);
+ model->setData(index, plugin.pluginId(), ServiceModel::DesktopEntryNameRole);
}
model->sort(Qt::DisplayRole);