-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 6b9fe4d..f918767 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -616,152 +616,152 @@ void Appearance::styleSettingsClicked ( ) | |||
616 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 616 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
617 | 617 | ||
618 | if ( item && item-> hasSettings ( )) | 618 | if ( item && item-> hasSettings ( )) |
619 | { | 619 | { |
620 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); | 620 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); |
621 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); | 621 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); |
622 | 622 | ||
623 | QWidget *w = item-> settings ( d ); | 623 | QWidget *w = item-> settings ( d ); |
624 | 624 | ||
625 | if ( w ) | 625 | if ( w ) |
626 | { | 626 | { |
627 | vbox-> addWidget ( w ); | 627 | vbox-> addWidget ( w ); |
628 | 628 | ||
629 | d-> setCaption ( w-> caption ( )); | 629 | d-> setCaption ( w-> caption ( )); |
630 | 630 | ||
631 | bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); | 631 | bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); |
632 | 632 | ||
633 | if ( item-> setSettings ( accepted )) | 633 | if ( item-> setSettings ( accepted )) |
634 | m_style_changed = true; | 634 | m_style_changed = true; |
635 | } | 635 | } |
636 | delete d; | 636 | delete d; |
637 | } | 637 | } |
638 | } | 638 | } |
639 | 639 | ||
640 | void Appearance::decoClicked ( int index ) | 640 | void Appearance::decoClicked ( int index ) |
641 | { | 641 | { |
642 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); | 642 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); |
643 | 643 | ||
644 | if ( m_sample ) | 644 | if ( m_sample ) |
645 | { | 645 | { |
646 | if ( dli && dli-> interface ( )) | 646 | if ( dli && dli-> interface ( )) |
647 | m_sample-> setDecoration ( dli-> interface ( )); | 647 | m_sample-> setDecoration ( dli-> interface ( )); |
648 | else | 648 | else |
649 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); | 649 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); |
650 | m_sample-> repaint ( ); | 650 | m_sample-> repaint ( ); |
651 | } | 651 | } |
652 | m_deco_changed |= ( index != m_original_deco ); | 652 | m_deco_changed |= ( index != m_original_deco ); |
653 | } | 653 | } |
654 | 654 | ||
655 | void Appearance::fontClicked ( const QFont &f ) | 655 | void Appearance::fontClicked ( const QFont &f ) |
656 | { | 656 | { |
657 | m_font_changed |= ( f != m_sample-> font ( )); | 657 | m_font_changed |= ( f != m_sample-> font ( )); |
658 | m_sample-> setFont ( f ); | 658 | m_sample-> setFont ( f ); |
659 | } | 659 | } |
660 | 660 | ||
661 | void Appearance::colorClicked ( int index ) | 661 | void Appearance::colorClicked ( int index ) |
662 | { | 662 | { |
663 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); | 663 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); |
664 | 664 | ||
665 | if ( item ) | 665 | if ( item ) |
666 | m_sample-> setPalette ( item-> palette ( )); | 666 | m_sample-> setPalette ( item-> palette ( )); |
667 | 667 | ||
668 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); | 668 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); |
669 | } | 669 | } |
670 | 670 | ||
671 | 671 | ||
672 | void Appearance::editSchemeClicked ( ) | 672 | void Appearance::editSchemeClicked ( ) |
673 | { | 673 | { |
674 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 674 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
675 | 675 | ||
676 | int cnt = 0; | 676 | int cnt = 0; |
677 | QString labels [QColorGroup::NColorRoles]; | 677 | QString labels [QColorGroup::NColorRoles]; |
678 | QColor colors [QColorGroup::NColorRoles]; | 678 | QColor colors [QColorGroup::NColorRoles]; |
679 | 679 | ||
680 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) | 680 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) |
681 | { | 681 | { |
682 | QColor col = item-> color ( role ); | 682 | QColor col = item->color( static_cast<QColorGroup::ColorRole>( role ) ); |
683 | 683 | ||
684 | if ( col. isValid ( )) | 684 | if ( col. isValid ( )) |
685 | { | 685 | { |
686 | labels [cnt] = item-> label ( role ); | 686 | labels[cnt] = item->label( static_cast<QColorGroup::ColorRole>( role ) ); |
687 | colors [cnt] = col; | 687 | colors[cnt] = col; |
688 | 688 | ||
689 | cnt++; | 689 | cnt++; |
690 | } | 690 | } |
691 | } | 691 | } |
692 | 692 | ||
693 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); | 693 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); |
694 | if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted ) | 694 | if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted ) |
695 | { | 695 | { |
696 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); | 696 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); |
697 | cnt = 0; | 697 | cnt = 0; |
698 | 698 | ||
699 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) | 699 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) |
700 | { | 700 | { |
701 | if ( item-> color ( role ). isValid ( )) | 701 | if ( item->color( static_cast<QColorGroup::ColorRole>( role ) ).isValid() ) |
702 | { | 702 | { |
703 | citem-> setColor ( role, colors [cnt] ); | 703 | citem->setColor( static_cast<QColorGroup::ColorRole>( role ), colors[cnt] ); |
704 | cnt++; | 704 | cnt++; |
705 | } | 705 | } |
706 | } | 706 | } |
707 | 707 | ||
708 | m_color_list-> setCurrentItem ( 0 ); | 708 | m_color_list-> setCurrentItem ( 0 ); |
709 | colorClicked ( 0 ); | 709 | colorClicked ( 0 ); |
710 | 710 | ||
711 | m_color_changed = true; | 711 | m_color_changed = true; |
712 | } | 712 | } |
713 | delete editdlg; | 713 | delete editdlg; |
714 | } | 714 | } |
715 | 715 | ||
716 | 716 | ||
717 | void Appearance::saveSchemeClicked() | 717 | void Appearance::saveSchemeClicked() |
718 | { | 718 | { |
719 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 719 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
720 | 720 | ||
721 | if ( !item ) | 721 | if ( !item ) |
722 | return; | 722 | return; |
723 | 723 | ||
724 | QDialog *d = new QDialog ( this, 0, true ); | 724 | QDialog *d = new QDialog ( this, 0, true ); |
725 | d-> setCaption ( tr( "Save Scheme" )); | 725 | d-> setCaption ( tr( "Save Scheme" )); |
726 | QLineEdit *ed = new QLineEdit ( d ); | 726 | QLineEdit *ed = new QLineEdit ( d ); |
727 | ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); | 727 | ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); |
728 | ed-> setFocus ( ); | 728 | ed-> setFocus ( ); |
729 | 729 | ||
730 | if ( d-> exec ( ) == QDialog::Accepted ) | 730 | if ( d-> exec ( ) == QDialog::Accepted ) |
731 | { | 731 | { |
732 | QString schemename = ed-> text ( ); | 732 | QString schemename = ed-> text ( ); |
733 | QString filestr = QPEApplication::qpeDir(); | 733 | QString filestr = QPEApplication::qpeDir(); |
734 | filestr.append( "/etc/colors/" ); | 734 | filestr.append( "/etc/colors/" ); |
735 | filestr.append( schemename ); | 735 | filestr.append( schemename ); |
736 | filestr.append( ".scheme" ); | 736 | filestr.append( ".scheme" ); |
737 | QFile file ( filestr ); | 737 | QFile file ( filestr ); |
738 | if ( !file. exists ( )) | 738 | if ( !file. exists ( )) |
739 | { | 739 | { |
740 | QPalette p = item-> palette ( ); | 740 | QPalette p = item-> palette ( ); |
741 | 741 | ||
742 | Config config ( file.name(), Config::File ); | 742 | Config config ( file.name(), Config::File ); |
743 | config. setGroup( "Colors" ); | 743 | config. setGroup( "Colors" ); |
744 | 744 | ||
745 | item-> save ( config ); | 745 | item-> save ( config ); |
746 | 746 | ||
747 | config. write ( ); // need to flush the config info first | 747 | config. write ( ); // need to flush the config info first |
748 | 748 | ||
749 | m_color_list-> insertItem ( new ColorListItem ( schemename, config )); | 749 | m_color_list-> insertItem ( new ColorListItem ( schemename, config )); |
750 | } | 750 | } |
751 | else | 751 | else |
752 | { | 752 | { |
753 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); | 753 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); |
754 | } | 754 | } |
755 | } | 755 | } |
756 | delete d; | 756 | delete d; |
757 | } | 757 | } |
758 | 758 | ||
759 | void Appearance::deleteSchemeClicked() | 759 | void Appearance::deleteSchemeClicked() |
760 | { | 760 | { |
761 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 761 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
762 | 762 | ||
763 | if ( !item ) | 763 | if ( !item ) |
764 | return; | 764 | return; |
765 | 765 | ||
766 | if ( m_color_list-> currentItem ( ) > 0 ) | 766 | if ( m_color_list-> currentItem ( ) > 0 ) |
767 | { | 767 | { |