summaryrefslogtreecommitdiff
path: root/noncore/settings/appearance2/appearance.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/appearance2/appearance.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index 2f3ba74..e9e0ad9 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -399,54 +399,56 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
m_original_tabstyle = style;
m_original_tabpos = tabtop;
return tab;
}
Appearance::Appearance( QWidget* parent, const char* name, WFlags )
: QDialog ( parent, name, true, WStyle_ContextHelp )
{
setCaption( tr( "Appearance" ) );
Config config( "qpe" );
config.setGroup( "Appearance" );
QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
m_sample = new SampleWindow ( this );
m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
QWidget *styletab;
-
- tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance/style.png", tr( "Style" ));
- tw-> addTab ( createFontTab ( tw, config ), "appearance/font.png", tr( "Font" ));
- tw-> addTab ( createColorTab ( tw, config ), "appearance/color.png", tr( "Colors" ) );
- tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco.png", tr( "Windows" ) );
- tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "appearance/advanced.png", tr( "Advanced" ) );
+
+ m_color_list = 0;
+
+ tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance/style", tr( "Style" ));
+ tw-> addTab ( createFontTab ( tw, config ), "appearance/font", tr( "Font" ));
+ tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) );
+ tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) );
+ tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "appearance/advanced", tr( "Advanced" ) );
top-> addWidget ( tw, 10 );
top-> addWidget ( m_sample, 1 );
tw-> setCurrentTab ( styletab );
connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * )));
m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false;
}
Appearance::~Appearance()
{
}
void Appearance::tabChanged ( QWidget *w )
{
if ( w == m_advtab ) {
m_sample-> hide ( );
updateGeometry ( ); // shouldn't be necessary ...
}
else
m_sample-> show ( );
}
@@ -507,52 +509,55 @@ void Appearance::accept ( )
config. writeEntry ( "NoStyle", sl, ';' );
config. writeEntry ( "ForceStyle", m_force-> isChecked ( ));
config. write ( ); // need to flush the config info first
Global::applyStyle ( );
if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart %1 now?" ). arg ( ODevice::inst ( )-> system ( ) == System_Zaurus ? "Qtopia" : "Opie" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) {
QCopEnvelope e( "QPE/System", "restart()" );
}
QDialog::accept ( );
}
void Appearance::done ( int r )
{
QDialog::done ( r );
close ( );
}
void Appearance::styleClicked ( int index )
{
StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index );
m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false );
-
- if ( m_sample && sli && sli-> style ( ))
- m_sample-> setStyle2 ( sli-> style ( ));
-
+
+ if ( m_sample && sli && sli-> style ( )) {
+ int ci = m_color_list ? m_color_list-> currentItem ( ) : -1;
+
+ m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( ));
+ }
+
m_style_changed |= ( index != m_original_style );
}
void Appearance::styleSettingsClicked ( )
{
StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
if ( item && item-> hasSettings ( )) {
QDialog *d = new QDialog ( this, "SETTINGS-DLG", true );
QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 );
QWidget *w = item-> settings ( d );
if ( w ) {
vbox-> addWidget ( w );
d-> setCaption ( w-> caption ( ));
d-> showMaximized ( );
bool accepted = ( d-> exec ( ) == QDialog::Accepted );
if ( item-> setSettings ( accepted ))
m_style_changed = true;
}