author | ar <ar> | 2004-05-02 17:31:50 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-02 17:31:50 (UTC) |
commit | a210b9a597ba0c929d95c38ffbaf972916c7b8a7 (patch) (unidiff) | |
tree | ce121d5017eb054222c86e0afb6057a28ea7bf8a /core/settings/launcher/taskbarsettings.cpp | |
parent | 18759e9156c96795831120408a9da0d3b4ec71a4 (diff) | |
download | opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.zip opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.tar.gz opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.tar.bz2 |
- convert qDebug to odebug
Diffstat (limited to 'core/settings/launcher/taskbarsettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/launcher/taskbarsettings.cpp | 196 |
1 files changed, 100 insertions, 96 deletions
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp index 43886c9..8dd9e97 100644 --- a/core/settings/launcher/taskbarsettings.cpp +++ b/core/settings/launcher/taskbarsettings.cpp | |||
@@ -13,160 +13,164 @@ | |||
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "taskbarsettings.h" | 29 | #include "taskbarsettings.h" |
30 | 30 | ||
31 | /* OPIE */ | ||
31 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
32 | #include <qpe/qlibrary.h> | 33 | #include <qpe/qlibrary.h> |
33 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
34 | #include <qpe/taskbarappletinterface.h> | 35 | #include <qpe/taskbarappletinterface.h> |
35 | #include <qpe/qcopenvelope_qws.h> | 36 | #include <qpe/qcopenvelope_qws.h> |
37 | #include <opie2/odebug.h> | ||
36 | 38 | ||
39 | /* QT */ | ||
37 | #include <qdir.h> | 40 | #include <qdir.h> |
38 | #include <qlistview.h> | 41 | #include <qlistview.h> |
39 | #include <qheader.h> | 42 | #include <qheader.h> |
40 | #include <qlayout.h> | 43 | #include <qlayout.h> |
41 | #include <qlabel.h> | 44 | #include <qlabel.h> |
42 | #include <qwhatsthis.h> | 45 | #include <qwhatsthis.h> |
43 | 46 | ||
47 | /* STD */ | ||
44 | #include <stdlib.h> | 48 | #include <stdlib.h> |
45 | 49 | ||
46 | 50 | ||
47 | TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) | 51 | TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) |
48 | : QWidget ( parent, name ) | 52 | : QWidget ( parent, name ) |
49 | { | 53 | { |
50 | m_applets_changed = false; | 54 | m_applets_changed = false; |
51 | 55 | ||
52 | QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); | 56 | QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); |
53 | 57 | ||
54 | QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this ); | 58 | QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this ); |
55 | lay-> addWidget ( l ); | 59 | lay-> addWidget ( l ); |
56 | 60 | ||
57 | m_list = new QListView ( this ); | 61 | m_list = new QListView ( this ); |
58 | m_list-> addColumn ( "foobar" ); | 62 | m_list-> addColumn ( "foobar" ); |
59 | m_list-> header ( )-> hide ( ); | 63 | m_list-> header ( )-> hide ( ); |
60 | 64 | ||
61 | lay-> addWidget ( m_list ); | 65 | lay-> addWidget ( m_list ); |
62 | 66 | ||
63 | QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); | 67 | QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); |
64 | 68 | ||
65 | connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged())); | 69 | connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged())); |
66 | 70 | ||
67 | init ( ); | 71 | init ( ); |
68 | } | 72 | } |
69 | 73 | ||
70 | void TaskbarSettings::init ( ) | 74 | void TaskbarSettings::init ( ) |
71 | { | 75 | { |
72 | Config cfg ( "Taskbar" ); | 76 | Config cfg ( "Taskbar" ); |
73 | cfg. setGroup ( "Applets" ); | 77 | cfg. setGroup ( "Applets" ); |
74 | QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); | 78 | QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); |
75 | 79 | ||
76 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; | 80 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; |
77 | #ifdef Q_OS_MACX | 81 | #ifdef Q_OS_MACX |
78 | QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); | 82 | QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); |
79 | #else | 83 | #else |
80 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); | 84 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); |
81 | #endif /* Q_OS_MACX */ | 85 | #endif /* Q_OS_MACX */ |
82 | 86 | ||
83 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { | 87 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { |
84 | QString name; | 88 | QString name; |
85 | QPixmap icon; | 89 | QPixmap icon; |
86 | TaskbarNamedAppletInterface *iface = 0; | 90 | TaskbarNamedAppletInterface *iface = 0; |
87 | 91 | ||
88 | qWarning("Load applet: %s", (*it).latin1() ); | 92 | owarn << "Load applet: " << (*it) << "" << oendl; |
89 | QLibrary *lib = new QLibrary ( path + "/" + *it ); | 93 | QLibrary *lib = new QLibrary ( path + "/" + *it ); |
90 | lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); | 94 | lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); |
91 | qWarning("<1>"); | 95 | owarn << "<1>" << oendl; |
92 | if ( iface ) { | 96 | if ( iface ) { |
93 | qWarning("<2>"); | 97 | owarn << "<2>" << oendl; |
94 | QString lang = getenv( "LANG" ); | 98 | QString lang = getenv( "LANG" ); |
95 | QTranslator *trans = new QTranslator ( qApp ); | 99 | QTranslator *trans = new QTranslator ( qApp ); |
96 | QString type = (*it). left ((*it). find (".")); | 100 | QString type = (*it). left ((*it). find (".")); |
97 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; | 101 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; |
98 | if ( trans-> load ( tfn )) | 102 | if ( trans-> load ( tfn )) |
99 | qApp-> installTranslator ( trans ); | 103 | qApp-> installTranslator ( trans ); |
100 | else | 104 | else |
101 | delete trans; | 105 | delete trans; |
102 | name = iface-> name ( ); | 106 | name = iface-> name ( ); |
103 | icon = iface-> icon ( ); | 107 | icon = iface-> icon ( ); |
104 | iface-> release ( ); | 108 | iface-> release ( ); |
105 | } | 109 | } |
106 | qWarning("<3>"); | 110 | owarn << "<3>" << oendl; |
107 | if ( !iface ) { | 111 | if ( !iface ) { |
108 | qWarning("<4>"); | 112 | owarn << "<4>" << oendl; |
109 | lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); | 113 | lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); |
110 | 114 | ||
111 | if ( iface ) { | 115 | if ( iface ) { |
112 | qWarning("<5>"); | 116 | owarn << "<5>" << oendl; |
113 | name = (*it). mid ( 3 ); | 117 | name = (*it). mid ( 3 ); |
114 | qWarning("Found applet: %s", name.latin1() ); | 118 | owarn << "Found applet: " << name << "" << oendl; |
115 | #ifdef Q_OS_MACX | 119 | #ifdef Q_OS_MACX |
116 | int sep = name. find( ".dylib" ); | 120 | int sep = name. find( ".dylib" ); |
117 | #else | 121 | #else |
118 | int sep = name. find( ".so" ); | 122 | int sep = name. find( ".so" ); |
119 | #endif /* Q_OS_MACX */ | 123 | #endif /* Q_OS_MACX */ |
120 | if ( sep > 0 ) | 124 | if ( sep > 0 ) |
121 | name. truncate ( sep ); | 125 | name. truncate ( sep ); |
122 | sep = name. find ( "applet" ); | 126 | sep = name. find ( "applet" ); |
123 | if ( sep == (int) name.length ( ) - 6 ) | 127 | if ( sep == (int) name.length ( ) - 6 ) |
124 | name. truncate ( sep ); | 128 | name. truncate ( sep ); |
125 | name[0] = name[0]. upper ( ); | 129 | name[0] = name[0]. upper ( ); |
126 | iface-> release ( ); | 130 | iface-> release ( ); |
127 | } | 131 | } |
128 | } | 132 | } |
129 | qWarning("<6>"); | 133 | owarn << "<6>" << oendl; |
130 | 134 | ||
131 | if ( iface ) { | 135 | if ( iface ) { |
132 | qWarning("<7>"); | 136 | owarn << "<7>" << oendl; |
133 | QCheckListItem *item; | 137 | QCheckListItem *item; |
134 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); | 138 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); |
135 | if ( !icon. isNull ( )) | 139 | if ( !icon. isNull ( )) |
136 | item-> setPixmap ( 0, icon ); | 140 | item-> setPixmap ( 0, icon ); |
137 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); | 141 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); |
138 | m_applets [*it] = item; | 142 | m_applets [*it] = item; |
139 | } | 143 | } |
140 | lib-> unload ( ); | 144 | lib-> unload ( ); |
141 | delete lib; | 145 | delete lib; |
142 | } | 146 | } |
143 | } | 147 | } |
144 | 148 | ||
145 | void TaskbarSettings::appletChanged() | 149 | void TaskbarSettings::appletChanged() |
146 | { | 150 | { |
147 | m_applets_changed = true; | 151 | m_applets_changed = true; |
148 | } | 152 | } |
149 | 153 | ||
150 | void TaskbarSettings::accept ( ) | 154 | void TaskbarSettings::accept ( ) |
151 | { | 155 | { |
152 | Config cfg ( "Taskbar" ); | 156 | Config cfg ( "Taskbar" ); |
153 | cfg. setGroup ( "Applets" ); | 157 | cfg. setGroup ( "Applets" ); |
154 | 158 | ||
155 | if ( m_applets_changed ) { | 159 | if ( m_applets_changed ) { |
156 | QStringList exclude; | 160 | QStringList exclude; |
157 | QMap <QString, QCheckListItem *>::Iterator it; | 161 | QMap <QString, QCheckListItem *>::Iterator it; |
158 | for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { | 162 | for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { |
159 | if ( !(*it)-> isOn ( )) | 163 | if ( !(*it)-> isOn ( )) |
160 | exclude << it. key ( ); | 164 | exclude << it. key ( ); |
161 | } | 165 | } |
162 | cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); | 166 | cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); |
163 | } | 167 | } |
164 | cfg. writeEntry ( "SafeMode", false ); | 168 | cfg. writeEntry ( "SafeMode", false ); |
165 | cfg. write ( ); | 169 | cfg. write ( ); |
166 | 170 | ||
167 | if ( m_applets_changed ) { | 171 | if ( m_applets_changed ) { |
168 | QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" ); | 172 | QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" ); |
169 | m_applets_changed = false; | 173 | m_applets_changed = false; |
170 | } | 174 | } |
171 | } | 175 | } |
172 | 176 | ||