3 #include <kapplication.h>
5 #include <q3whatsthis.h>
11 extern "C" KDE_EXPORT QObject
* allocate_config( KConfig
* conf
, QWidget
* parent
)
13 return new CdeConfig(conf
, parent
);
18 * 'conf' is a pointer to the kwindecoration modules open kwin config,
19 * and is by default set to the "Style" group.
21 * 'parent' is the parent of the QObject, which is a VBox inside the
22 * Configure tab in kwindecoration
25 CdeConfig::CdeConfig( KConfig
* conf
, QWidget
* parent
)
28 cdeConfig
= new KConfig("kwincderc");
29 KGlobal::locale()->insertCatalog("kwin_art_clients");
31 groupBox
= new Q3VBox( parent
);
33 bgAlign
= new Q3ButtonGroup( 3, Qt::Horizontal
, i18n("Text &Alignment"), groupBox
);
34 bgAlign
->setExclusive( true );
35 Q3WhatsThis::add( bgAlign
, i18n("Use these buttons to set the alignment of the titlebar caption text.") );
36 new QRadioButton( i18n("Left"), bgAlign
, "AlignLeft" );
37 QRadioButton
*radio2
= new QRadioButton( i18n("Centered"), bgAlign
, "AlignHCenter" );
38 radio2
->setChecked( true );
39 new QRadioButton( i18n("Right"), bgAlign
, "AlignRight" );
41 cbColorBorder
= new QCheckBox( i18n("Draw window frames using &titlebar colors"), groupBox
);
42 Q3WhatsThis::add( cbColorBorder
, i18n("When selected, the window decoration borders "
43 "are drawn using the titlebar colors. Otherwise, they are "
44 "drawn using normal border colors instead.") );
46 // cbTitlebarButton = new QCheckBox( i18n("Titlebar acts like a &pushbutton when clicked"), groupBox );
47 // QWhatsThis::add( cbTitlebarButton, i18n("When selected, this option causes the window titlebar to behave "
48 // "as if it was a pushbutton when you click it to move the window.") );
50 (void) new QLabel( i18n("Tip: If you want the look of the original Motif(tm) Window Manager,\n"
51 "click the \"Buttons\" tab above and remove the help\n"
52 "and close buttons from the titlebar."), groupBox
);
54 // Load configuration options
57 // Ensure we track user changes properly
58 connect( cbColorBorder
, SIGNAL(clicked()), SLOT(slotSelectionChanged()) );
59 // connect( cbTitlebarButton, SIGNAL(clicked()), SLOT(slotSelectionChanged()) );
60 connect( bgAlign
, SIGNAL(clicked(int)), SLOT(slotSelectionChanged(int)) );
62 // Make the widgets visible in kwindecoration
67 CdeConfig::~CdeConfig()
75 void CdeConfig::slotSelectionChanged()
80 void CdeConfig::slotSelectionChanged( int )
85 // Loads the configurable options from the kwinrc config file
86 // It is passed the open config from kwindecoration to improve efficiency
87 void CdeConfig::load( KConfig
* /*conf*/ )
89 cdeConfig
->setGroup("General");
91 QString value
= cdeConfig
->readEntry( "TextAlignment", "AlignHCenter" );
92 QRadioButton
*button
= (QRadioButton
*)bgAlign
->child( (const char *)value
.latin1() );
94 button
->setChecked( true );
96 bool coloredFrame
= cdeConfig
->readBoolEntry( "UseTitleBarBorderColors", true );
97 cbColorBorder
->setChecked( coloredFrame
);
99 // bool titlebarButton = cdeConfig->readBoolEntry( "TitlebarButtonMode", true );
100 // cbTitlebarButton->setChecked( titlebarButton );
104 // Saves the configurable options to the kwinrc config file
105 void CdeConfig::save( KConfig
* /*conf*/ )
107 cdeConfig
->setGroup("General");
109 QRadioButton
*button
= (QRadioButton
*)bgAlign
->selected();
111 cdeConfig
->writeEntry( "TextAlignment", QString(button
->name()) );
113 cdeConfig
->writeEntry( "UseTitleBarBorderColors", cbColorBorder
->isChecked() );
114 // cdeConfig->writeEntry( "TitlebarButtonMode", cbTitlebarButton->isChecked() );
116 // Ensure others trying to read this config get updated
121 // Sets UI widget defaults which must correspond to style defaults
122 void CdeConfig::defaults()
124 QRadioButton
*button
= (QRadioButton
*)bgAlign
->child( "AlignHCenter" );
126 button
->setChecked( true );
128 cbColorBorder
->setChecked( true );
129 // cbTitlebarButton->setChecked( true );
132 #include "config.moc"