5
#include <kiconloader.h>
11
NoatunPreferences::NoatunPreferences(QWidget *parent)
12
: KDialogBase(TreeList, i18n("Preferences - Noatun"),
13
Ok|Apply|Cancel|Help, Ok, parent, "NoatunPreferences", false, true)
15
resize(640, 480); // KDE is required to support 800x600 min.
16
setShowIconsInTreeList(true);
17
setRootIsDecorated(false);
20
void NoatunPreferences::slotOk()
26
void NoatunPreferences::show()
28
for (CModule *i=mModules.first(); i != 0; i=mModules.next())
33
void NoatunPreferences::show(CModule *page)
35
int index = pageIndex( static_cast<QWidget *>(page->parent()) );
41
void NoatunPreferences::slotApply()
43
for (CModule *i=mModules.first(); i != 0; i=mModules.next())
47
void NoatunPreferences::add(CModule *page)
49
mModules.append(page);
52
void NoatunPreferences::remove(CModule *page)
54
mModules.removeRef(page);
57
CModule::CModule(const QString &name, const QString &description, const QString &icon, QObject *owner)
58
: QWidget(napp->preferencesBox()->addPage(name, description, KGlobal::iconLoader()->loadIcon(
59
icon, KIcon::Small,0, KIcon::DefaultState,0, true)))
62
connect(owner, SIGNAL(destroyed()), SLOT(ownerDeleted()));
64
//kdDebug(66666) << k_funcinfo << "name = " << name << endl;
66
napp->preferencesBox()->add(this);
68
QFrame *page=static_cast<QFrame*>(parent());
69
(new QHBoxLayout(page))->addWidget(this);
74
//kdDebug(66666) << k_funcinfo << endl;
75
#if QT_VERSION < 0x030102 && KDE_VERSION < KDE_MAKE_VERSION( 3, 1, 90 )
76
// Due to a bug in Qt 3.1 and 3.1.1 no close events are sent to hidden
77
// widgets, causing the KJanusWidget to crash. This workaround is
78
// rather intrusive and should be used only in the affected versions
79
// to avoid hard to track bugs in the future. KDE HEAD (to become 3.2)
80
// has a workaround for this problem, and additionally it's fixed in
82
napp->sendPostedEvents();
85
napp->preferencesBox()->remove(this);
88
void CModule::ownerDeleted()