summaryrefslogtreecommitdiff
path: root/noncore/settings/appearance2/appearance.cpp
Unidiff
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 )
399 399
400 m_original_tabstyle = style; 400 m_original_tabstyle = style;
401 m_original_tabpos = tabtop; 401 m_original_tabpos = tabtop;
402 402
403 return tab; 403 return tab;
404} 404}
405 405
406 406
407Appearance::Appearance( QWidget* parent, const char* name, WFlags ) 407Appearance::Appearance( QWidget* parent, const char* name, WFlags )
408 : QDialog ( parent, name, true, WStyle_ContextHelp ) 408 : QDialog ( parent, name, true, WStyle_ContextHelp )
409{ 409{
410 setCaption( tr( "Appearance" ) ); 410 setCaption( tr( "Appearance" ) );
411 411
412 Config config( "qpe" ); 412 Config config( "qpe" );
413 config.setGroup( "Appearance" ); 413 config.setGroup( "Appearance" );
414 414
415 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); 415 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
416 416
417 m_sample = new SampleWindow ( this ); 417 m_sample = new SampleWindow ( this );
418 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 418 m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
419 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); 419 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
420 420
421 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 421 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
422 QWidget *styletab; 422 QWidget *styletab;
423 423
424 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance/style.png", tr( "Style" )); 424 m_color_list = 0;
425 tw-> addTab ( createFontTab ( tw, config ), "appearance/font.png", tr( "Font" )); 425
426 tw-> addTab ( createColorTab ( tw, config ), "appearance/color.png", tr( "Colors" ) ); 426 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance/style", tr( "Style" ));
427 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco.png", tr( "Windows" ) ); 427 tw-> addTab ( createFontTab ( tw, config ), "appearance/font", tr( "Font" ));
428 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "appearance/advanced.png", tr( "Advanced" ) ); 428 tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) );
429 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) );
430 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "appearance/advanced", tr( "Advanced" ) );
429 431
430 top-> addWidget ( tw, 10 ); 432 top-> addWidget ( tw, 10 );
431 top-> addWidget ( m_sample, 1 ); 433 top-> addWidget ( m_sample, 1 );
432 434
433 tw-> setCurrentTab ( styletab ); 435 tw-> setCurrentTab ( styletab );
434 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); 436 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * )));
435 437
436 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; 438 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false;
437} 439}
438 440
439Appearance::~Appearance() 441Appearance::~Appearance()
440{ 442{
441} 443}
442 444
443void Appearance::tabChanged ( QWidget *w ) 445void Appearance::tabChanged ( QWidget *w )
444{ 446{
445 if ( w == m_advtab ) { 447 if ( w == m_advtab ) {
446 m_sample-> hide ( ); 448 m_sample-> hide ( );
447 updateGeometry ( ); // shouldn't be necessary ... 449 updateGeometry ( ); // shouldn't be necessary ...
448 } 450 }
449 else 451 else
450 m_sample-> show ( ); 452 m_sample-> show ( );
451} 453}
452 454
@@ -507,52 +509,55 @@ void Appearance::accept ( )
507 config. writeEntry ( "NoStyle", sl, ';' ); 509 config. writeEntry ( "NoStyle", sl, ';' );
508 config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); 510 config. writeEntry ( "ForceStyle", m_force-> isChecked ( ));
509 511
510 config. write ( ); // need to flush the config info first 512 config. write ( ); // need to flush the config info first
511 Global::applyStyle ( ); 513 Global::applyStyle ( );
512 514
513 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 ) { 515 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 ) {
514 QCopEnvelope e( "QPE/System", "restart()" ); 516 QCopEnvelope e( "QPE/System", "restart()" );
515 } 517 }
516 518
517 QDialog::accept ( ); 519 QDialog::accept ( );
518} 520}
519 521
520void Appearance::done ( int r ) 522void Appearance::done ( int r )
521{ 523{
522 QDialog::done ( r ); 524 QDialog::done ( r );
523 close ( ); 525 close ( );
524} 526}
525 527
526 528
527void Appearance::styleClicked ( int index ) 529void Appearance::styleClicked ( int index )
528{ 530{
529 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); 531 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index );
530 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); 532 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false );
531 533
532 if ( m_sample && sli && sli-> style ( )) 534 if ( m_sample && sli && sli-> style ( )) {
533 m_sample-> setStyle2 ( sli-> style ( )); 535 int ci = m_color_list ? m_color_list-> currentItem ( ) : -1;
534 536
537 m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( ));
538 }
539
535 m_style_changed |= ( index != m_original_style ); 540 m_style_changed |= ( index != m_original_style );
536} 541}
537 542
538void Appearance::styleSettingsClicked ( ) 543void Appearance::styleSettingsClicked ( )
539{ 544{
540 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 545 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
541 546
542 if ( item && item-> hasSettings ( )) { 547 if ( item && item-> hasSettings ( )) {
543 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); 548 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true );
544 QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); 549 QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 );
545 550
546 QWidget *w = item-> settings ( d ); 551 QWidget *w = item-> settings ( d );
547 552
548 if ( w ) { 553 if ( w ) {
549 vbox-> addWidget ( w ); 554 vbox-> addWidget ( w );
550 555
551 d-> setCaption ( w-> caption ( )); 556 d-> setCaption ( w-> caption ( ));
552 557
553 d-> showMaximized ( ); 558 d-> showMaximized ( );
554 bool accepted = ( d-> exec ( ) == QDialog::Accepted ); 559 bool accepted = ( d-> exec ( ) == QDialog::Accepted );
555 560
556 if ( item-> setSettings ( accepted )) 561 if ( item-> setSettings ( accepted ))
557 m_style_changed = true; 562 m_style_changed = true;
558 } 563 }