#include "dolphin_generalsettings.h"
-#include <QCheckBox>
-#include <QEvent>
-#include <QGroupBox>
-#include <QLabel>
-#include <QListWidget>
-#include <QRadioButton>
-#include <QSlider>
-#include <QBoxLayout>
-
#include <kconfiggroup.h>
#include <kdialog.h>
#include <kglobal.h>
#include <KNumInput>
#include <kservicetypetrader.h>
#include <kservice.h>
-#include <kvbox.h>
+
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QLabel>
+#include <QListWidget>
+#include <QRadioButton>
+#include <QShowEvent>
+#include <QSlider>
+#include <QBoxLayout>
// default settings
const bool USE_THUMBNAILS = true;
m_useFileThumbnails->setChecked(USE_THUMBNAILS);
}
-bool PreviewsSettingsPage::event(QEvent* event)
+void PreviewsSettingsPage::showEvent(QShowEvent* event)
{
- if ((event->type() == QEvent::Polish) && !m_initialized) {
- // load all available plugins for previews
- const KService::List plugins = KServiceTypeTrader::self()->query("ThumbCreator");
- foreach (const KSharedPtr<KService>& service, plugins) {
- QListWidgetItem* item = new QListWidgetItem(service->name(),
- m_previewPluginsList);
- item->setData(Qt::UserRole, service->desktopEntryName());
- const bool show = m_enabledPreviewPlugins.contains(service->desktopEntryName());
- item->setCheckState(show ? Qt::Checked : Qt::Unchecked);
- }
-
+ if (!event->spontaneous() && !m_initialized) {
+ QMetaObject::invokeMethod(this, "loadPreviewPlugins", Qt::QueuedConnection);
m_initialized = true;
}
- return SettingsPageBase::event(event);
+ SettingsPageBase::showEvent(event);
+}
+
+void PreviewsSettingsPage::loadPreviewPlugins()
+{
+ const KService::List plugins = KServiceTypeTrader::self()->query("ThumbCreator");
+ foreach (const KSharedPtr<KService>& service, plugins) {
+ QListWidgetItem* item = new QListWidgetItem(service->name(),
+ m_previewPluginsList);
+ item->setData(Qt::UserRole, service->desktopEntryName());
+ const bool show = m_enabledPreviewPlugins.contains(service->desktopEntryName());
+ item->setCheckState(show ? Qt::Checked : Qt::Unchecked);
+ }
}
void PreviewsSettingsPage::loadSettings()
#include <kstandarddirs.h>
#include <QCheckBox>
-#include <QEvent>
#include <QGridLayout>
#include <QGroupBox>
#include <QLabel>
#include <QListWidget>
#include <QPushButton>
+#include <QShowEvent>
ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) :
SettingsPageBase(parent),
}
}
-bool ServicesSettingsPage::event(QEvent* event)
+void ServicesSettingsPage::showEvent(QShowEvent* event)
{
- if ((event->type() == QEvent::Polish) && !m_initialized) {
+ if (!event->spontaneous() && !m_initialized) {
QMetaObject::invokeMethod(this, "loadServices", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "loadVersionControlSystems", Qt::QueuedConnection);
m_initialized = true;
}
- return SettingsPageBase::event(event);
+ SettingsPageBase::showEvent(event);
}
void ServicesSettingsPage::loadServices()