PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) : SettingsPageBase(parent), m_initialized(false), m_listView(0), m_enabledPreviewPlugins(), m_remoteFileSizeBox(0) { QVBoxLayout* topLayout = new QVBoxLayout(this); QLabel* showPreviewsLabel = new QLabel(i18nc("@title:group", "Show previews for:"), this); m_listView = new QListView(this); ServiceItemDelegate* delegate = new ServiceItemDelegate(m_listView, m_listView); connect(delegate, SIGNAL(requestServiceConfiguration(QModelIndex)), this, SLOT(configureService(QModelIndex))); ServiceModel* serviceModel = new ServiceModel(this); QSortFilterProxyModel* proxyModel = new QSortFilterProxyModel(this); proxyModel->setSourceModel(serviceModel); proxyModel->setSortRole(Qt::DisplayRole); m_listView->setModel(proxyModel); m_listView->setItemDelegate(delegate); m_listView->setVerticalScrollMode(QListView::ScrollPerPixel); QLabel* remoteFileSizeLabel = new QLabel(i18nc("@label", "Skip previews for remote files above:"), this); m_remoteFileSizeBox = new KIntSpinBox(this); m_remoteFileSizeBox->setSingleStep(1); m_remoteFileSizeBox->setSuffix(QLatin1String(" MB")); m_remoteFileSizeBox->setRange(0, 9999999); /* MB */ QHBoxLayout* fileSizeBoxLayout = new QHBoxLayout(this); fileSizeBoxLayout->addWidget(remoteFileSizeLabel, 0, Qt::AlignRight); fileSizeBoxLayout->addWidget(m_remoteFileSizeBox); topLayout->addSpacing(KDialog::spacingHint()); topLayout->addWidget(showPreviewsLabel); topLayout->addWidget(m_listView); topLayout->addLayout(fileSizeBoxLayout); loadSettings(); connect(m_listView, SIGNAL(clicked(QModelIndex)), this, SIGNAL(changed())); connect(m_remoteFileSizeBox, SIGNAL(valueChanged(int)), this, SIGNAL(changed())); }
void ServiceItemDelegate::slotConfigureButtonClicked() { emit requestServiceConfiguration(focusedIndex()); }