author | mickeyl <mickeyl> | 2004-02-26 09:31:23 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-26 09:31:23 (UTC) |
commit | d26a7814b7b454583a136a78aeb7016467ec9ff8 (patch) (unidiff) | |
tree | 1520794c87c956c6d6e7701e26600fa9f2321da9 | |
parent | b339031e14a607ff18e404e0395b1c2782b92fdc (diff) | |
download | opie-d26a7814b7b454583a136a78aeb7016467ec9ff8.zip opie-d26a7814b7b454583a136a78aeb7016467ec9ff8.tar.gz opie-d26a7814b7b454583a136a78aeb7016467ec9ff8.tar.bz2 |
UI FIX: Indicate that the setting "Show applications in subpopups" is only
relevant if "Show tabs in O-Menu" is checked by enabling/disabling dynamically.
-rw-r--r-- | core/settings/launcher/menusettings.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp index faa7cf4..dc8e993 100644 --- a/core/settings/launcher/menusettings.cpp +++ b/core/settings/launcher/menusettings.cpp | |||
@@ -35,123 +35,126 @@ | |||
35 | #include <qpe/qcopenvelope_qws.h> | 35 | #include <qpe/qcopenvelope_qws.h> |
36 | 36 | ||
37 | #include <qdir.h> | 37 | #include <qdir.h> |
38 | #include <qlistview.h> | 38 | #include <qlistview.h> |
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qheader.h> | 40 | #include <qheader.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
43 | #include <qwhatsthis.h> | 43 | #include <qwhatsthis.h> |
44 | 44 | ||
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | 46 | ||
47 | 47 | ||
48 | MenuSettings::MenuSettings ( QWidget *parent, const char *name ) | 48 | MenuSettings::MenuSettings ( QWidget *parent, const char *name ) |
49 | : QWidget ( parent, name ) | 49 | : QWidget ( parent, name ) |
50 | { | 50 | { |
51 | m_applets_changed = false; | 51 | m_applets_changed = false; |
52 | 52 | ||
53 | QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); | 53 | QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); |
54 | 54 | ||
55 | QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this ); | 55 | QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this ); |
56 | lay-> addWidget ( l ); | 56 | lay-> addWidget ( l ); |
57 | 57 | ||
58 | m_list = new QListView ( this ); | 58 | m_list = new QListView ( this ); |
59 | m_list-> addColumn ( "foobar" ); | 59 | m_list-> addColumn ( "foobar" ); |
60 | m_list-> header ( )-> hide ( ); | 60 | m_list-> header ( )-> hide ( ); |
61 | 61 | ||
62 | lay-> addWidget ( m_list ); | 62 | lay-> addWidget ( m_list ); |
63 | 63 | ||
64 | m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this ); | 64 | m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this ); |
65 | lay-> addWidget ( m_menutabs ); | 65 | lay-> addWidget ( m_menutabs ); |
66 | 66 | ||
67 | m_menusubpopup = new QCheckBox ( tr( "Show Applications in subpopups" ), this ); | 67 | m_menusubpopup = new QCheckBox ( tr( "Show Applications in Subpopups" ), this ); |
68 | lay-> addWidget ( m_menusubpopup ); | 68 | lay-> addWidget ( m_menusubpopup ); |
69 | 69 | ||
70 | QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." )); | 70 | QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." )); |
71 | QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." )); | 71 | QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." )); |
72 | 72 | ||
73 | connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); | 73 | connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); |
74 | 74 | ||
75 | init ( ); | 75 | init ( ); |
76 | } | 76 | } |
77 | 77 | ||
78 | void MenuSettings::init ( ) | 78 | void MenuSettings::init ( ) |
79 | { | 79 | { |
80 | Config cfg ( "StartMenu" ); | 80 | Config cfg ( "StartMenu" ); |
81 | cfg. setGroup ( "Applets" ); | 81 | cfg. setGroup ( "Applets" ); |
82 | QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); | 82 | QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); |
83 | 83 | ||
84 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; | 84 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; |
85 | #ifdef Q_OS_MACX | 85 | #ifdef Q_OS_MACX |
86 | QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); | 86 | QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); |
87 | #else | 87 | #else |
88 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); | 88 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); |
89 | #endif /* Q_OS_MACX */ | 89 | #endif /* Q_OS_MACX */ |
90 | 90 | ||
91 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { | 91 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { |
92 | QString name; | 92 | QString name; |
93 | QPixmap icon; | 93 | QPixmap icon; |
94 | MenuAppletInterface *iface = 0; | 94 | MenuAppletInterface *iface = 0; |
95 | 95 | ||
96 | QLibrary *lib = new QLibrary ( path + "/" + *it ); | 96 | QLibrary *lib = new QLibrary ( path + "/" + *it ); |
97 | lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); | 97 | lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); |
98 | if ( iface ) { | 98 | if ( iface ) { |
99 | QString lang = getenv( "LANG" ); | 99 | QString lang = getenv( "LANG" ); |
100 | QTranslator *trans = new QTranslator ( qApp ); | 100 | QTranslator *trans = new QTranslator ( qApp ); |
101 | QString type = (*it). left ((*it). find (".")); | 101 | QString type = (*it). left ((*it). find (".")); |
102 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; | 102 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; |
103 | if ( trans-> load ( tfn )) | 103 | if ( trans-> load ( tfn )) |
104 | qApp-> installTranslator ( trans ); | 104 | qApp-> installTranslator ( trans ); |
105 | else | 105 | else |
106 | delete trans; | 106 | delete trans; |
107 | name = iface-> name ( ); | 107 | name = iface-> name ( ); |
108 | icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); | 108 | icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); |
109 | iface-> release ( ); | 109 | iface-> release ( ); |
110 | lib-> unload ( ); | 110 | lib-> unload ( ); |
111 | 111 | ||
112 | QCheckListItem *item; | 112 | QCheckListItem *item; |
113 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); | 113 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); |
114 | if ( !icon. isNull ( )) | 114 | if ( !icon. isNull ( )) |
115 | item-> setPixmap ( 0, icon ); | 115 | item-> setPixmap ( 0, icon ); |
116 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); | 116 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); |
117 | m_applets [*it] = item; | 117 | m_applets [*it] = item; |
118 | } else { | 118 | } else { |
119 | delete lib; | 119 | delete lib; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | cfg. setGroup ( "Menu" ); | 123 | cfg. setGroup ( "Menu" ); |
124 | m_menutabs-> setChecked ( cfg. readBoolEntry ( "LauncherTabs", true )); | 124 | m_menutabs->setChecked( cfg.readBoolEntry( "LauncherTabs", true ) ); |
125 | m_menusubpopup-> setChecked ( cfg. readBoolEntry ( "LauncherSubPopup", true )); | 125 | m_menusubpopup->setChecked( cfg.readBoolEntry( "LauncherSubPopup", true ) ); |
126 | m_menusubpopup->setEnabled( m_menutabs->isChecked() ); | ||
127 | connect( m_menutabs, SIGNAL( stateChanged( int ) ), m_menusubpopup, SLOT( setEnabled( bool ) ) ); | ||
128 | |||
126 | } | 129 | } |
127 | 130 | ||
128 | void MenuSettings::appletChanged() | 131 | void MenuSettings::appletChanged() |
129 | { | 132 | { |
130 | m_applets_changed = true; | 133 | m_applets_changed = true; |
131 | } | 134 | } |
132 | 135 | ||
133 | void MenuSettings::accept ( ) | 136 | void MenuSettings::accept ( ) |
134 | { | 137 | { |
135 | bool apps_changed = false; | 138 | bool apps_changed = false; |
136 | 139 | ||
137 | Config cfg ( "StartMenu" ); | 140 | Config cfg ( "StartMenu" ); |
138 | cfg. setGroup ( "Applets" ); | 141 | cfg. setGroup ( "Applets" ); |
139 | if ( m_applets_changed ) { | 142 | if ( m_applets_changed ) { |
140 | QStringList exclude; | 143 | QStringList exclude; |
141 | QMap <QString, QCheckListItem *>::Iterator it; | 144 | QMap <QString, QCheckListItem *>::Iterator it; |
142 | for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { | 145 | for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { |
143 | if ( !(*it)-> isOn ( )) | 146 | if ( !(*it)-> isOn ( )) |
144 | exclude << it. key ( ); | 147 | exclude << it. key ( ); |
145 | } | 148 | } |
146 | cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); | 149 | cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); |
147 | } | 150 | } |
148 | cfg. writeEntry ( "SafeMode", false ); | 151 | cfg. writeEntry ( "SafeMode", false ); |
149 | 152 | ||
150 | cfg. setGroup ( "Menu" ); | 153 | cfg. setGroup ( "Menu" ); |
151 | 154 | ||
152 | if ( m_menutabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) { | 155 | if ( m_menutabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) { |
153 | apps_changed = true; | 156 | apps_changed = true; |
154 | cfg. writeEntry ( "LauncherTabs", m_menutabs-> isChecked ( )); | 157 | cfg. writeEntry ( "LauncherTabs", m_menutabs-> isChecked ( )); |
155 | } | 158 | } |
156 | 159 | ||
157 | if ( m_menusubpopup-> isChecked ( ) != cfg. readBoolEntry ( "LauncherSubPopup", true )) { | 160 | if ( m_menusubpopup-> isChecked ( ) != cfg. readBoolEntry ( "LauncherSubPopup", true )) { |