summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-02-17 14:26:43 (UTC)
committer mickeyl <mickeyl>2005-02-17 14:26:43 (UTC)
commitfaaa7b79330fe3c5647182fafdb2bb584dc70638 (patch) (unidiff)
treeffa63faf248cf20f363b80b579855b124d34032f
parent766ac02e5586cd67b75b320fe1abee513384860c (diff)
downloadopie-faaa7b79330fe3c5647182fafdb2bb584dc70638.zip
opie-faaa7b79330fe3c5647182fafdb2bb584dc70638.tar.gz
opie-faaa7b79330fe3c5647182fafdb2bb584dc70638.tar.bz2
The response to the static background pixmap was overwhelmingly positive, hence:
* fix static background pixmap also for tiled pixmaps * make it customizable via LauncherSettings * enable it per default
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog2
-rw-r--r--core/launcher/launcher.cpp8
-rw-r--r--core/launcher/launcherview.cpp28
-rw-r--r--core/launcher/launcherview.h3
-rw-r--r--core/settings/launcher/tabssettings.cpp13
-rw-r--r--core/settings/launcher/tabssettings.h2
6 files changed, 43 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index fe763a5..8ac976d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,221 +1,223 @@
1 2005-??-??Opie 1.2.0 1 2005-??-??Opie 1.2.0
2 2
3 New Features 3 New Features
4 ------------ 4 ------------
5 * Launcher: Support a static background pixmap (mickeyl)
6 * LauncherSettings: Choose whether to have a static background pixmap (mickeyl)
5 7
6 Fixed Bugs 8 Fixed Bugs
7 ---------- 9 ----------
8 * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers) 10 * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers)
9 * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke) 11 * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke)
10 * #1482 - Fix double '/' in paths (zecke) 12 * #1482 - Fix double '/' in paths (zecke)
11 * #1536 - Autosave of custom locations in opie backup (ar) 13 * #1536 - Autosave of custom locations in opie backup (ar)
12 * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke) 14 * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke)
13 * #1540 - Implemented deletion of DocLnks in opie-eye (zecke) 15 * #1540 - Implemented deletion of DocLnks in opie-eye (zecke)
14 * #1542 - Fix Todo crash when priority < 1 or > 5 (drw) 16 * #1542 - Fix Todo crash when priority < 1 or > 5 (drw)
15 * #1554 - Fixed Opie-Console name in .desktop file (mickeyl) 17 * #1554 - Fixed Opie-Console name in .desktop file (mickeyl)
16 * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke) 18 * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke)
17 * #1558 - Fixed opie-login breaking opie startup (mickeyl) 19 * #1558 - Fixed opie-login breaking opie startup (mickeyl)
18 * n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw) 20 * n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw)
19 21
20 Internal 22 Internal
21 -------- 23 --------
22 * Work around bug in Qt/Embedded 2.3.10: qt_version() returns 231 (mickeyl) 24 * Work around bug in Qt/Embedded 2.3.10: qt_version() returns 231 (mickeyl)
23 * Killed the need for weak symbols in QtE (zecke) 25 * Killed the need for weak symbols in QtE (zecke)
24 26
25 2005-02-03Opie 1.1.9 27 2005-02-03Opie 1.1.9
26 28
27 New Features 29 New Features
28 ------------ 30 ------------
29 * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl) 31 * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl)
30 * Number of icon columns in Launcher is customizable through LauncherSettings (mickeyl) 32 * Number of icon columns in Launcher is customizable through LauncherSettings (mickeyl)
31 * Usability enhancements in OpieIRC (skyhusker) 33 * Usability enhancements in OpieIRC (skyhusker)
32 34
33 Fixed Bugs 35 Fixed Bugs
34 ---------- 36 ----------
35 * #1501 - Fixed bug in todo sql backend (eilers) 37 * #1501 - Fixed bug in todo sql backend (eilers)
36 * #1505 - Added more Swap sizes in memoryapplet (mickeyl) 38 * #1505 - Added more Swap sizes in memoryapplet (mickeyl)
37 * #1525 - Hopefully fixed double alarms and not removing alarms set with the Clock application (zecke) 39 * #1525 - Hopefully fixed double alarms and not removing alarms set with the Clock application (zecke)
38 * #1533 - Security Owner Dialog (shown in case of unsuccessfull authentiacation) wasn't able to display information in non latin1 encoding (zecke) 40 * #1533 - Security Owner Dialog (shown in case of unsuccessfull authentiacation) wasn't able to display information in non latin1 encoding (zecke)
39 * n.a. - Removed hard coded font sizes in a couple of inputmethods (mickeyl) 41 * n.a. - Removed hard coded font sizes in a couple of inputmethods (mickeyl)
40 * n.a. - Removed MediumDlg appearing prior to FirstUsage wizard (i.e. calibration) (mickeyl) 42 * n.a. - Removed MediumDlg appearing prior to FirstUsage wizard (i.e. calibration) (mickeyl)
41 * n.a. - Fixed numerous buglets in OpieIRC (skyhusker) 43 * n.a. - Fixed numerous buglets in OpieIRC (skyhusker)
42 44
43 Internal 45 Internal
44 -------- 46 --------
45 * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) 47 * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl)
46 * You can now use the Opie build system in combination with a OpenEmbedded staging area which makes a nice cross development environment (mickeyl) 48 * You can now use the Opie build system in combination with a OpenEmbedded staging area which makes a nice cross development environment (mickeyl)
47 * Made Opie compilable with Qt/Embedded 2.3.10 (ar) 49 * Made Opie compilable with Qt/Embedded 2.3.10 (ar)
48 * Changed Launcher to get default orientation from ODevice w/ QWS_DISPLAY overriding (mickeyl) 50 * Changed Launcher to get default orientation from ODevice w/ QWS_DISPLAY overriding (mickeyl)
49 * Build tree cleanups (mickeyl) 51 * Build tree cleanups (mickeyl)
50 52
51 2004-11-26Opie 1.1.8 53 2004-11-26Opie 1.1.8
52 54
53 New Features 55 New Features
54 ------------ 56 ------------
55 * PackageManager supports installation of local ipkg files (drw) 57 * PackageManager supports installation of local ipkg files (drw)
56 * PackageManager supports linking of applications to root (drw) 58 * PackageManager supports linking of applications to root (drw)
57 * PackageManager supports src/gz feeds (drw,wimpie) 59 * PackageManager supports src/gz feeds (drw,wimpie)
58 * Added a syslog information tab to sysinfo (mickeyl) 60 * Added a syslog information tab to sysinfo (mickeyl)
59 * Added new, more consistent, PIM icons + a GIMP teplate (ar) 61 * Added new, more consistent, PIM icons + a GIMP teplate (ar)
60 62
61 Fixed Bugs 63 Fixed Bugs
62 ---------- 64 ----------
63 * #1017 - Tetrix doesn't display correctly for high resolution screens (drw) 65 * #1017 - Tetrix doesn't display correctly for high resolution screens (drw)
64 * #1269 - VCards were imported into personal area if it was activated (eilers) 66 * #1269 - VCards were imported into personal area if it was activated (eilers)
65 * #1464 - Packagemanager dont set active filter after install a package (drw) 67 * #1464 - Packagemanager dont set active filter after install a package (drw)
66 * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers) 68 * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers)
67 * #1493 - Fixed one column layout bug of the launcher (hrw) 69 * #1493 - Fixed one column layout bug of the launcher (hrw)
68 * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw) 70 * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw)
69 * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw) 71 * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw)
70 * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl) 72 * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl)
71 73
72 Internal 74 Internal
73 -------- 75 --------
74 * Moved libopie1 to unsupported (mickeyl) 76 * Moved libopie1 to unsupported (mickeyl)
75 * Implemented generic queryByExample() with incremental searching. A lot of internal changes of the Pim2-library (eilers) 77 * Implemented generic queryByExample() with incremental searching. A lot of internal changes of the Pim2-library (eilers)
76 * Added fast and full featured and incremental sorted() for SQL addressbook backend (eilers) 78 * Added fast and full featured and incremental sorted() for SQL addressbook backend (eilers)
77 79
78 2004-11-14Opie 1.1.7 80 2004-11-14Opie 1.1.7
79 81
80 New Features 82 New Features
81 ------------ 83 ------------
82 * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers) 84 * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers)
83 * Backup now uses the busy indicator when backing up and restore (ar) 85 * Backup now uses the busy indicator when backing up and restore (ar)
84 * OpiePlayer2 gained adding of Directories to the playlist (zecke) 86 * OpiePlayer2 gained adding of Directories to the playlist (zecke)
85 * OpiePlayer2 better error handling (zecke) 87 * OpiePlayer2 better error handling (zecke)
86 * OpiePlayer2 progress indication while streaming (zecke) 88 * OpiePlayer2 progress indication while streaming (zecke)
87 * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke) 89 * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke)
88 * Ported brightnessapplet from Qtopia 1.7 (mickeyl) 90 * Ported brightnessapplet from Qtopia 1.7 (mickeyl)
89 * Opie-Eye got a Digital Camera File Backend (alwin,zecke) 91 * Opie-Eye got a Digital Camera File Backend (alwin,zecke)
90 * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke) 92 * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke)
91 * Opie-Console use Custom Font and Size in a Profile (harlekin) 93 * Opie-Console use Custom Font and Size in a Profile (harlekin)
92 * Opie-Console transparently log the Output and Input to a file (harlekin) 94 * Opie-Console transparently log the Output and Input to a file (harlekin)
93 * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem) 95 * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem)
94 * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem) 96 * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem)
95 * Opie-Security gained a 'test authentication' button (clem) 97 * Opie-Security gained a 'test authentication' button (clem)
96 * Opie-Eye got a more unique layout (menubar), a slideshow, user can setup some defaults 98 * Opie-Eye got a more unique layout (menubar), a slideshow, user can setup some defaults
97 * Opie-Mail improve the handling of POP mail boxes (alwin) 99 * Opie-Mail improve the handling of POP mail boxes (alwin)
98 * Both Opie-Eye and Opie-Mail were greatly improved due the hard work of Rajko Albrecht(alwin) 100 * Both Opie-Eye and Opie-Mail were greatly improved due the hard work of Rajko Albrecht(alwin)
99 * Opie IRC - backports of the 'NeIRC fork' (zecke) 101 * Opie IRC - backports of the 'NeIRC fork' (zecke)
100 102
101 Fixed Bugs 103 Fixed Bugs
102 ---------- 104 ----------
103 * #501 - Pickboard is able to show 'Umlaute' (TT,zecke) 105 * #501 - Pickboard is able to show 'Umlaute' (TT,zecke)
104 * #608 - Make Opie usable for left handed users (zecke) 106 * #608 - Make Opie usable for left handed users (zecke)
105 * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke) 107 * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke)
106 * #1245 - Opie-Go 'paused' (zecke) 108 * #1245 - Opie-Go 'paused' (zecke)
107 * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke) 109 * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke)
108 * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke) 110 * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke)
109 * #1395 - Build VNC Backend with gcc3.4 111 * #1395 - Build VNC Backend with gcc3.4
110 * #1440 - The icon of opie-mobilemsg is missing (CoreDump) 112 * #1440 - The icon of opie-mobilemsg is missing (CoreDump)
111 * #1426 - Add missing opie-bartender Icon (CoreDump) 113 * #1426 - Add missing opie-bartender Icon (CoreDump)
112 * #1445 - Opie-Sheet Has No Icon (CoreDump) 114 * #1445 - Opie-Sheet Has No Icon (CoreDump)
113 * #1448 - Brightness Applet added (mickeyl) 115 * #1448 - Brightness Applet added (mickeyl)
114 * #1450 - ZSame didn't clear the bonus item after winning a game (zecke) 116 * #1450 - ZSame didn't clear the bonus item after winning a game (zecke)
115 * #1482 - Fix OFileSelector to be able to sort by size (zecke) 117 * #1482 - Fix OFileSelector to be able to sort by size (zecke)
116 * n.a. - Opie-mail: fixed some crasher, some layout-problems 118 * n.a. - Opie-mail: fixed some crasher, some layout-problems
117 * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke) 119 * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke)
118 * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke) 120 * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke)
119 * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem) 121 * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem)
120 * n.a. - Build system: Fix deps in several config.in (and fix scripts/deps.pl too) to stop breaking builds, especially with make -j highNumber (clem) 122 * n.a. - Build system: Fix deps in several config.in (and fix scripts/deps.pl too) to stop breaking builds, especially with make -j highNumber (clem)
121 * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl) 123 * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl)
122 124
123 Internal 125 Internal
124 -------- 126 --------
125 * Opie-Qashmoney has been moved to unsupported (mickeyl) 127 * Opie-Qashmoney has been moved to unsupported (mickeyl)
126 * Opie-Ubrowser has been moved to unsupported (mickeyl) 128 * Opie-Ubrowser has been moved to unsupported (mickeyl)
127 129
128 2004-09-17Opie 1.1.6 130 2004-09-17Opie 1.1.6
129 131
130 New Features 132 New Features
131 ------------ 133 ------------
132 * Fifteen gained configurable number of items (zecke) 134 * Fifteen gained configurable number of items (zecke)
133 * Fifteen can have custom background images (zecke) 135 * Fifteen can have custom background images (zecke)
134 * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl) 136 * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl)
135 * Integrated the new security framework into libopie2 (zecke,clem) 137 * Integrated the new security framework into libopie2 (zecke,clem)
136 * Converted the launcher to use the new security framework (zecke) 138 * Converted the launcher to use the new security framework (zecke)
137 * Backup can now handle custom locations for backup and restore (ar) 139 * Backup can now handle custom locations for backup and restore (ar)
138 * Implemented right-on-hold feedback (wimpie,zecke) 140 * Implemented right-on-hold feedback (wimpie,zecke)
139 * Lots of new features in opie-reader (tim,pohly) 141 * Lots of new features in opie-reader (tim,pohly)
140 * Build system cleanups (schurig) 142 * Build system cleanups (schurig)
141 143
142 Fixed Bugs 144 Fixed Bugs
143 -------- 145 --------
144 * #1005 - Fixed backup to CompactFlash (ar) 146 * #1005 - Fixed backup to CompactFlash (ar)
145 * #1167 - Fixed Opie write crashing on more text than one page (ar) 147 * #1167 - Fixed Opie write crashing on more text than one page (ar)
146 * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl) 148 * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl)
147 * #1359 - Fixed bookmarks in Gutenbrowser (ljp) 149 * #1359 - Fixed bookmarks in Gutenbrowser (ljp)
148 * #1361 - Fixed auto upercase in Opie-Addressbook (eilers) 150 * #1361 - Fixed auto upercase in Opie-Addressbook (eilers)
149 * #1370 - Pimconverter now reacts on cancel key (eilers) 151 * #1370 - Pimconverter now reacts on cancel key (eilers)
150 * #1376 - Bring back the capslock/numlock display (zecke) 152 * #1376 - Bring back the capslock/numlock display (zecke)
151 * #1383 - Language settings now warns about losing open apps (Markus Litz) 153 * #1383 - Language settings now warns about losing open apps (Markus Litz)
152 * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl) 154 * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl)
153 * #1394 - Fixed oversized headline in opie-login (coredump) 155 * #1394 - Fixed oversized headline in opie-login (coredump)
154 * #1396 - Opie-console captures the escape key and vim is working (zecke) 156 * #1396 - Opie-console captures the escape key and vim is working (zecke)
155 * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl) 157 * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl)
156 158
157 2004-07-06Opie 1.1.4 159 2004-07-06Opie 1.1.4
158 160
159 New Features 161 New Features
160 ------------ 162 ------------
161 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) 163 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle)
162 * Added Conversion tool for pim-data (eilers) 164 * Added Conversion tool for pim-data (eilers)
163 * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers) 165 * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers)
164 * Modified the PIM API for providing generic use of OPimRecords (eilers) 166 * Modified the PIM API for providing generic use of OPimRecords (eilers)
165 * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke) 167 * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke)
166 168
167 Fixed Bugs 169 Fixed Bugs
168 -------- 170 --------
169 * #1068 - Country Drop Down Box Off Screen 171 * #1068 - Country Drop Down Box Off Screen
170 * #1291 - Opie tinykate does not open .desktop files (ar) 172 * #1291 - Opie tinykate does not open .desktop files (ar)
171 * #1291 - Opie sheet not saving correctly (ar) 173 * #1291 - Opie sheet not saving correctly (ar)
172 * #1294 - Opie does not know about British Summer Time 174 * #1294 - Opie does not know about British Summer Time
173 * #1314 - Drawpad initialization (mickeyl) 175 * #1314 - Drawpad initialization (mickeyl)
174 * #1317 - Packagemanager crashes on hold-down or install (chicken) 176 * #1317 - Packagemanager crashes on hold-down or install (chicken)
175 * #1321 - Batteryapplet graphic glitch (harlekin) 177 * #1321 - Batteryapplet graphic glitch (harlekin)
176 * #1324 - ZSafe not starting up (mickeyl) 178 * #1324 - ZSafe not starting up (mickeyl)
177 * #1328 - Personal Home Address fields is trimmed to 1char (eilers) 179 * #1328 - Personal Home Address fields is trimmed to 1char (eilers)
178 * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken) 180 * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken)
179 * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl) 181 * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl)
180 * #1348 - Datebook dependency on libopiedb2 (chicken) 182 * #1348 - Datebook dependency on libopiedb2 (chicken)
181 * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers) 183 * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers)
182 184
183 2004-04-25Opie 1.1.3 185 2004-04-25Opie 1.1.3
184 186
185 * Introduced first implementation of SQL-Support using SQLite (eilers) 187 * Introduced first implementation of SQL-Support using SQLite (eilers)
186 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) 188 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp)
187 * Added a real system graffiti character set (brad) 189 * Added a real system graffiti character set (brad)
188 * Added Generic Keyconfig Widget (zecke) 190 * Added Generic Keyconfig Widget (zecke)
189 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) 191 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke)
190 * Added new Bible reader app - opie-dagger (drw) 192 * Added new Bible reader app - opie-dagger (drw)
191 * Added a new Image Viewer. Work is ongoing (zecke,alwin) 193 * Added a new Image Viewer. Work is ongoing (zecke,alwin)
192 * Added namespace usage in libopie2 and everywhere (zecke,alwin) 194 * Added namespace usage in libopie2 and everywhere (zecke,alwin)
193 * Enabled the possibility to pass command line arguments to applications (mickeyl) 195 * Enabled the possibility to pass command line arguments to applications (mickeyl)
194 * Added an about applet showing some credits and information about Opie (mickeyl) 196 * Added an about applet showing some credits and information about Opie (mickeyl)
195 * Added benchmarking functionality to sysinfo (mickeyl) 197 * Added benchmarking functionality to sysinfo (mickeyl)
196 * Added applet and configuration application for switching hardware keyboard layouts (alwin) 198 * Added applet and configuration application for switching hardware keyboard layouts (alwin)
197 * Ported applications from libopie1 to libopie2* (drw,ar,alwin) 199 * Ported applications from libopie1 to libopie2* (drw,ar,alwin)
198 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) 200 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe)
199 * Clean-up of package information in control files (drw) 201 * Clean-up of package information in control files (drw)
200 * Repaired mediummount which was broken since integrating the quicklauncher (alwin) 202 * Repaired mediummount which was broken since integrating the quicklauncher (alwin)
201 * Improved big-screen support (zecke,ar) 203 * Improved big-screen support (zecke,ar)
202 * Improved multikeyboard support, added keyboard layout switching applet (mouse) 204 * Improved multikeyboard support, added keyboard layout switching applet (mouse)
203 * Added a new mail client based on libetpan (harlekin,alwin,jgf) 205 * Added a new mail client based on libetpan (harlekin,alwin,jgf)
204 * Added new package manager - opie-packagemanager (drw) 206 * Added new package manager - opie-packagemanager (drw)
205 * Improved light-n-power for C7x0 (mickeyl) 207 * Improved light-n-power for C7x0 (mickeyl)
206 * Added automatic rotation support for C7x0 (treke) 208 * Added automatic rotation support for C7x0 (treke)
207 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) 209 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl)
208 * Added scanning the wireless network neighbourhood to networksettings (mickeyl) 210 * Added scanning the wireless network neighbourhood to networksettings (mickeyl)
209 211
210 2003-11-29Opie 1.0.3 212 2003-11-29Opie 1.0.3
211 213
212 * Released as Version 1.0.3 214 * Released as Version 1.0.3
213 * Improved i18n (various contributors) 215 * Improved i18n (various contributors)
214 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) 216 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin)
215 * Made the Documents Tab optional (mickeyl) 217 * Made the Documents Tab optional (mickeyl)
216 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) 218 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken)
217 219
218 2003-08-04Opie 1.0.0 220 2003-08-04Opie 1.0.0
219 221
220 * Released as Version 1.0.0 222 * Released as Version 1.0.0
221 * Including a PPP module for easy dial up (tille,harlekin,zecke) 223 * Including a PPP module for easy dial up (tille,harlekin,zecke)
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 4255b44..4ec5f4c 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -1,819 +1,827 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "startmenu.h" 21#include "startmenu.h"
22#include "taskbar.h" 22#include "taskbar.h"
23#include "serverinterface.h" 23#include "serverinterface.h"
24#include "launcherview.h" 24#include "launcherview.h"
25#include "launcher.h" 25#include "launcher.h"
26#include "server.h" 26#include "server.h"
27 27
28/* OPIE */ 28/* OPIE */
29#include <opie2/odebug.h> 29#include <opie2/odebug.h>
30#include <qtopia/global.h> 30#include <qtopia/global.h>
31#ifdef Q_WS_QWS 31#ifdef Q_WS_QWS
32#include <qtopia/qcopenvelope_qws.h> 32#include <qtopia/qcopenvelope_qws.h>
33#endif 33#endif
34#include <qtopia/resource.h> 34#include <qtopia/resource.h>
35#include <qtopia/applnk.h> 35#include <qtopia/applnk.h>
36#include <qtopia/config.h> 36#include <qtopia/config.h>
37#include <qtopia/qpeapplication.h> 37#include <qtopia/qpeapplication.h>
38#include <qtopia/mimetype.h> 38#include <qtopia/mimetype.h>
39#include <qtopia/private/categories.h> 39#include <qtopia/private/categories.h>
40#define QTOPIA_INTERNAL_FSLP 40#define QTOPIA_INTERNAL_FSLP
41#include <qtopia/lnkproperties.h> 41#include <qtopia/lnkproperties.h>
42 42
43/* QT */ 43/* QT */
44#include <qdir.h> 44#include <qdir.h>
45#ifdef Q_WS_QWS 45#ifdef Q_WS_QWS
46#include <qkeyboard_qws.h> 46#include <qkeyboard_qws.h>
47#include <qwindowsystem_qws.h> 47#include <qwindowsystem_qws.h>
48#endif 48#endif
49#include <qtimer.h> 49#include <qtimer.h>
50#include <qcombobox.h> 50#include <qcombobox.h>
51#include <qvbox.h> 51#include <qvbox.h>
52#include <qlayout.h> 52#include <qlayout.h>
53#include <qstyle.h> 53#include <qstyle.h>
54#include <qpushbutton.h> 54#include <qpushbutton.h>
55#include <qtabbar.h> 55#include <qtabbar.h>
56#include <qwidgetstack.h> 56#include <qwidgetstack.h>
57#include <qregexp.h> 57#include <qregexp.h>
58#include <qmessagebox.h> 58#include <qmessagebox.h>
59#include <qframe.h> 59#include <qframe.h>
60#include <qpainter.h> 60#include <qpainter.h>
61#include <qlabel.h> 61#include <qlabel.h>
62#include <qtextstream.h> 62#include <qtextstream.h>
63#include <qpopupmenu.h> 63#include <qpopupmenu.h>
64 64
65/* STD */ 65/* STD */
66#include <stdlib.h> 66#include <stdlib.h>
67#include <assert.h> 67#include <assert.h>
68#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 68#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
69#include <unistd.h> 69#include <unistd.h>
70#include <stdio.h> 70#include <stdio.h>
71#include <sys/vfs.h> 71#include <sys/vfs.h>
72#include <mntent.h> 72#include <mntent.h>
73#endif 73#endif
74 74
75 75
76static bool isVisibleWindow( int ); 76static bool isVisibleWindow( int );
77//=========================================================================== 77//===========================================================================
78 78
79LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : 79LauncherTabWidget::LauncherTabWidget( Launcher* parent ) :
80 QVBox( parent ), docview( 0 ),docTabEnabled(true),m_DocumentTabId(0) 80 QVBox( parent ), docview( 0 ),docTabEnabled(true),m_DocumentTabId(0)
81{ 81{
82 docLoadingWidgetEnabled = false; 82 docLoadingWidgetEnabled = false;
83 docLoadingWidget = 0; 83 docLoadingWidget = 0;
84 docLoadingWidgetProgress = 0; 84 docLoadingWidgetProgress = 0;
85 launcher = parent; 85 launcher = parent;
86 categoryBar = new LauncherTabBar( this ); 86 categoryBar = new LauncherTabBar( this );
87 QPalette pal = categoryBar->palette(); 87 QPalette pal = categoryBar->palette();
88 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); 88 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) );
89 pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); 89 pal.setColor( QColorGroup::Background, pal.active().background().light(110) );
90 categoryBar->setPalette( pal ); 90 categoryBar->setPalette( pal );
91 stack = new QWidgetStack(this); 91 stack = new QWidgetStack(this);
92 connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); 92 connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) );
93 categoryBar->show(); 93 categoryBar->show();
94 stack->show(); 94 stack->show();
95 95
96#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 96#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
97 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); 97 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this );
98 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 98 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
99 this, SLOT(launcherMessage(const QCString&,const QByteArray&)) ); 99 this, SLOT(launcherMessage(const QCString&,const QByteArray&)) );
100 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), 100 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
101 this, SLOT(appMessage(const QCString&,const QByteArray&))); 101 this, SLOT(appMessage(const QCString&,const QByteArray&)));
102#endif 102#endif
103 103
104 createDocLoadingWidget(); 104 createDocLoadingWidget();
105} 105}
106 106
107void LauncherTabWidget::createDocLoadingWidget() 107void LauncherTabWidget::createDocLoadingWidget()
108{ 108{
109 // Construct the 'doc loading widget' shown when finding documents 109 // Construct the 'doc loading widget' shown when finding documents
110 110
111 // ### LauncherView class needs changing to be more generic so 111 // ### LauncherView class needs changing to be more generic so
112 // this widget can change its background similar to the iconviews 112 // this widget can change its background similar to the iconviews
113 // so the background for this matches 113 // so the background for this matches
114 docLoadingWidget = new LauncherView( stack ); 114 docLoadingWidget = new LauncherView( stack );
115 docLoadingWidget->hideIcons(); 115 docLoadingWidget->hideIcons();
116 QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); 116 QVBox *docLoadingVBox = new QVBox( docLoadingWidget );
117 117
118 docLoadingVBox->setSpacing( 20 ); 118 docLoadingVBox->setSpacing( 20 );
119 docLoadingVBox->setMargin( 10 ); 119 docLoadingVBox->setMargin( 10 );
120 120
121 QWidget *space1 = new QWidget( docLoadingVBox ); 121 QWidget *space1 = new QWidget( docLoadingVBox );
122 docLoadingVBox->setStretchFactor( space1, 1 ); 122 docLoadingVBox->setStretchFactor( space1, 1 );
123 123
124 QLabel *waitPixmap = new QLabel( docLoadingVBox ); 124 QLabel *waitPixmap = new QLabel( docLoadingVBox );
125 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); 125 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) );
126 waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); 126 waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) );
127 waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); 127 waitPixmap->setAlignment( int( QLabel::AlignCenter ) );
128 128
129 Config cfg( "Launcher" ); 129 Config cfg( "Launcher" );
130 cfg.setGroup( "DocTab" ); 130 cfg.setGroup( "DocTab" );
131 docTabEnabled = cfg.readBoolEntry( "Enable", true ); 131 docTabEnabled = cfg.readBoolEntry( "Enable", true );
132 132
133 QLabel *textLabel = new QLabel( docLoadingVBox ); 133 QLabel *textLabel = new QLabel( docLoadingVBox );
134 textLabel->setAlignment( int( QLabel::AlignCenter ) ); 134 textLabel->setAlignment( int( QLabel::AlignCenter ) );
135 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); 135 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox );
136 docLoadingWidgetProgress->setProgress( 0 ); 136 docLoadingWidgetProgress->setProgress( 0 );
137 docLoadingWidgetProgress->setCenterIndicator( TRUE ); 137 docLoadingWidgetProgress->setCenterIndicator( TRUE );
138 docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker 138 docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker
139 setProgressStyle(); 139 setProgressStyle();
140 140
141 if ( docTabEnabled ) 141 if ( docTabEnabled )
142 { 142 {
143 textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); 143 textLabel->setText( tr( "<b>Finding Documents...</b>" ) );
144 } 144 }
145 else 145 else
146 { 146 {
147 textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" 147 textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>"
148 "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); 148 "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) );
149 docLoadingWidgetProgress->hide(); 149 docLoadingWidgetProgress->hide();
150 docLoadingWidgetEnabled = true; 150 docLoadingWidgetEnabled = true;
151 } 151 }
152 152
153 QWidget *space2 = new QWidget( docLoadingVBox ); 153 QWidget *space2 = new QWidget( docLoadingVBox );
154 docLoadingVBox->setStretchFactor( space2, 1 ); 154 docLoadingVBox->setStretchFactor( space2, 1 );
155 155
156 cfg.setGroup( "Tab Documents" ); // No tr 156 cfg.setGroup( "Tab Documents" ); // No tr
157 setTabViewAppearance( docLoadingWidget, cfg ); 157 setTabViewAppearance( docLoadingWidget, cfg );
158 158
159 stack->addWidget( docLoadingWidget, 0 ); 159 stack->addWidget( docLoadingWidget, 0 );
160} 160}
161 161
162void LauncherTabWidget::initLayout() 162void LauncherTabWidget::initLayout()
163{ 163{
164 layout()->activate(); 164 layout()->activate();
165 docView()->setFocus(); 165 docView()->setFocus();
166 categoryBar->showTab("Documents"); 166 categoryBar->showTab("Documents");
167} 167}
168 168
169void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) 169void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&)
170{ 170{
171 if ( message == "nextView()" ) 171 if ( message == "nextView()" )
172 categoryBar->nextTab(); 172 categoryBar->nextTab();
173} 173}
174 174
175void LauncherTabWidget::raiseTabWidget() 175void LauncherTabWidget::raiseTabWidget()
176{ 176{
177 if ( categoryBar->currentView() == docView() 177 if ( categoryBar->currentView() == docView()
178 && docLoadingWidgetEnabled ) { 178 && docLoadingWidgetEnabled ) {
179 stack->raiseWidget( docLoadingWidget ); 179 stack->raiseWidget( docLoadingWidget );
180 docLoadingWidget->updateGeometry(); 180 docLoadingWidget->updateGeometry();
181 } else { 181 } else {
182 stack->raiseWidget( categoryBar->currentView() ); 182 stack->raiseWidget( categoryBar->currentView() );
183 } 183 }
184} 184}
185 185
186void LauncherTabWidget::tabProperties() 186void LauncherTabWidget::tabProperties()
187{ 187{
188 LauncherView *view = categoryBar->currentView(); 188 LauncherView *view = categoryBar->currentView();
189 QPopupMenu *m = new QPopupMenu( this ); 189 QPopupMenu *m = new QPopupMenu( this );
190 m->insertItem( tr("Icon View"), LauncherView::Icon ); 190 m->insertItem( tr("Icon View"), LauncherView::Icon );
191 m->insertItem( tr("List View"), LauncherView::List ); 191 m->insertItem( tr("List View"), LauncherView::List );
192 m->setItemChecked( (int)view->viewMode(), TRUE ); 192 m->setItemChecked( (int)view->viewMode(), TRUE );
193 int rv = m->exec( QCursor::pos() ); 193 int rv = m->exec( QCursor::pos() );
194 if ( rv >= 0 && rv != view->viewMode() ) { 194 if ( rv >= 0 && rv != view->viewMode() ) {
195 view->setViewMode( (LauncherView::ViewMode)rv ); 195 view->setViewMode( (LauncherView::ViewMode)rv );
196 } 196 }
197 197
198 delete m; 198 delete m;
199} 199}
200 200
201void LauncherTabWidget::deleteView( const QString& id ) 201void LauncherTabWidget::deleteView( const QString& id )
202{ 202{
203 LauncherTab *t = categoryBar->launcherTab(id); 203 LauncherTab *t = categoryBar->launcherTab(id);
204 if ( t ) { 204 if ( t ) {
205 stack->removeWidget( t->view ); 205 stack->removeWidget( t->view );
206 delete t->view; 206 delete t->view;
207 categoryBar->removeTab( t ); 207 categoryBar->removeTab( t );
208 } 208 }
209} 209}
210 210
211LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) 211LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label )
212{ 212{
213 LauncherView* view = new LauncherView( stack ); 213 LauncherView* view = new LauncherView( stack );
214 connect( view, SIGNAL(clicked(const AppLnk*)), 214 connect( view, SIGNAL(clicked(const AppLnk*)),
215 this, SIGNAL(clicked(const AppLnk*))); 215 this, SIGNAL(clicked(const AppLnk*)));
216 connect( view, SIGNAL(rightPressed(AppLnk*)), 216 connect( view, SIGNAL(rightPressed(AppLnk*)),
217 this, SIGNAL(rightPressed(AppLnk*))); 217 this, SIGNAL(rightPressed(AppLnk*)));
218 218
219 219
220 int n = categoryBar->count(); 220 int n = categoryBar->count();
221 221
222 stack->addWidget( view, n ); 222 stack->addWidget( view, n );
223 223
224 LauncherTab *tab = new LauncherTab( id, view, pm, label ); 224 LauncherTab *tab = new LauncherTab( id, view, pm, label );
225 categoryBar->insertTab( tab, n-1 ); 225 categoryBar->insertTab( tab, n-1 );
226 if ( id == "Documents" ) { 226 if ( id == "Documents" ) {
227 docview = view; 227 docview = view;
228 m_DocumentTabId = n; 228 m_DocumentTabId = n;
229 } 229 }
230 230
231 odebug << "inserting " << id << " at " << n-1 << "" << oendl; 231 odebug << "inserting " << id << " at " << n-1 << "" << oendl;
232 232
233 Config cfg("Launcher"); 233 Config cfg("Launcher");
234 setTabAppearance( tab, cfg ); 234 setTabAppearance( tab, cfg );
235 235
236 cfg.setGroup( "GUI" ); 236 cfg.setGroup( "GUI" );
237 view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) ); 237 view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) );
238 238
239 return view; 239 return view;
240} 240}
241 241
242LauncherView *LauncherTabWidget::view( const QString &id ) 242LauncherView *LauncherTabWidget::view( const QString &id )
243{ 243{
244 LauncherTab *t = categoryBar->launcherTab(id); 244 LauncherTab *t = categoryBar->launcherTab(id);
245 if ( !t ) 245 if ( !t )
246 return 0; 246 return 0;
247 return t->view; 247 return t->view;
248} 248}
249 249
250LauncherView *LauncherTabWidget::docView() 250LauncherView *LauncherTabWidget::docView()
251{ 251{
252 return docview; 252 return docview;
253} 253}
254 254
255void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) 255void LauncherTabWidget::setLoadingWidgetEnabled( bool v )
256{ 256{
257 if ( v != docLoadingWidgetEnabled && docLoadingWidget ) { 257 if ( v != docLoadingWidgetEnabled && docLoadingWidget ) {
258 docLoadingWidgetEnabled = v; 258 docLoadingWidgetEnabled = v;
259 raiseTabWidget(); 259 raiseTabWidget();
260 } 260 }
261} 261}
262 262
263void LauncherTabWidget::setLoadingProgress( int percent ) 263void LauncherTabWidget::setLoadingProgress( int percent )
264{ 264{
265 docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); 265 docLoadingWidgetProgress->setProgress( (percent / 4) * 4 );
266} 266}
267 267
268// ### this function could more to LauncherView 268// ### this function could more to LauncherView
269void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) 269void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg )
270{ 270{
271 // View 271 // View
272 QString view = cfg.readEntry( "View", "Icon" ); 272 QString view = cfg.readEntry( "View", "Icon" );
273 if ( view == "List" ) // No tr 273 if ( view == "List" ) // No tr
274 v->setViewMode( LauncherView::List ); 274 v->setViewMode( LauncherView::List );
275 QString bgType = cfg.readEntry( "BackgroundType", "Image" ); 275 QString bgType = cfg.readEntry( "BackgroundType", "Image" );
276 if ( bgType == "Image" ) { // No tr 276 if ( bgType == "Image" ) { // No tr
277 QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); 277 QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" );
278 v->setBackgroundType( LauncherView::Image, pm ); 278 v->setBackgroundType( LauncherView::Image, pm );
279 } else if ( bgType == "SolidColor" ) { 279 } else if ( bgType == "SolidColor" ) {
280 QString c = cfg.readEntry( "BackgroundColor" ); 280 QString c = cfg.readEntry( "BackgroundColor" );
281 v->setBackgroundType( LauncherView::SolidColor, c ); 281 v->setBackgroundType( LauncherView::SolidColor, c );
282 } else { 282 } else {
283 v->setBackgroundType( LauncherView::Ruled, QString::null ); 283 v->setBackgroundType( LauncherView::Ruled, QString::null );
284 } 284 }
285 QString textCol = cfg.readEntry( "TextColor" ); 285 QString textCol = cfg.readEntry( "TextColor" );
286 if ( textCol.isEmpty() ) 286 if ( textCol.isEmpty() )
287 v->setTextColor( QColor() ); 287 v->setTextColor( QColor() );
288 else 288 else
289 v->setTextColor( QColor(textCol) ); 289 v->setTextColor( QColor(textCol) );
290// bool customFont = cfg.readBoolEntry( "CustomFont", FALSE ); 290// bool customFont = cfg.readBoolEntry( "CustomFont", FALSE );
291 291
292 v->setColNumber( cfg.readNumEntry( "Columns", 0 ) ); 292 v->setColNumber( cfg.readNumEntry( "Columns", 0 ) );
293 293
294 QStringList font = cfg.readListEntry( "Font", ',' ); 294 QStringList font = cfg.readListEntry( "Font", ',' );
295 if ( font.count() == 4 ) 295 if ( font.count() == 4 )
296 v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); 296 v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) );
297 297
298 // ### FIXME TabColor TabTextColor 298 // ### FIXME TabColor TabTextColor
299 299
300} 300}
301 301
302// ### Could move to LauncherTab 302// ### Could move to LauncherTab
303void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg ) 303void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg )
304{ 304{
305 cfg.setGroup( QString( "Tab %1" ).arg(tab->type) ); // No tr 305 cfg.setGroup( QString( "Tab %1" ).arg(tab->type) ); // No tr
306 306
307 setTabViewAppearance( tab->view, cfg ); 307 setTabViewAppearance( tab->view, cfg );
308 308
309 // Tabs 309 // Tabs
310 QString tabCol = cfg.readEntry( "TabColor" ); 310 QString tabCol = cfg.readEntry( "TabColor" );
311 if ( tabCol.isEmpty() ) 311 if ( tabCol.isEmpty() )
312 tab->bgColor = QColor(); 312 tab->bgColor = QColor();
313 else 313 else
314 tab->bgColor = QColor(tabCol); 314 tab->bgColor = QColor(tabCol);
315 QString tabTextCol = cfg.readEntry( "TabTextColor" ); 315 QString tabTextCol = cfg.readEntry( "TabTextColor" );
316 if ( tabTextCol.isEmpty() ) 316 if ( tabTextCol.isEmpty() )
317 tab->fgColor = QColor(); 317 tab->fgColor = QColor();
318 else 318 else
319 tab->fgColor = QColor(tabTextCol); 319 tab->fgColor = QColor(tabTextCol);
320} 320}
321 321
322void LauncherTabWidget::paletteChange( const QPalette &p ) 322void LauncherTabWidget::paletteChange( const QPalette &p )
323{ 323{
324 QVBox::paletteChange( p ); 324 QVBox::paletteChange( p );
325 QPalette pal = palette(); 325 QPalette pal = palette();
326 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); 326 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) );
327 pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); 327 pal.setColor( QColorGroup::Background, pal.active().background().light(110) );
328 categoryBar->setPalette( pal ); 328 categoryBar->setPalette( pal );
329 categoryBar->update(); 329 categoryBar->update();
330} 330}
331 331
332void LauncherTabWidget::styleChange( QStyle & ) 332void LauncherTabWidget::styleChange( QStyle & )
333{ 333{
334 QTimer::singleShot( 0, this, SLOT(setProgressStyle()) ); 334 QTimer::singleShot( 0, this, SLOT(setProgressStyle()) );
335} 335}
336 336
337void LauncherTabWidget::setProgressStyle() 337void LauncherTabWidget::setProgressStyle()
338{ 338{
339 if (docLoadingWidgetProgress) { 339 if (docLoadingWidgetProgress) {
340 docLoadingWidgetProgress->setFrameShape( QProgressBar::Box ); 340 docLoadingWidgetProgress->setFrameShape( QProgressBar::Box );
341 docLoadingWidgetProgress->setFrameShadow( QProgressBar::Plain ); 341 docLoadingWidgetProgress->setFrameShadow( QProgressBar::Plain );
342 docLoadingWidgetProgress->setMargin( 1 ); 342 docLoadingWidgetProgress->setMargin( 1 );
343 docLoadingWidgetProgress->setLineWidth( 1 ); 343 docLoadingWidgetProgress->setLineWidth( 1 );
344 } 344 }
345} 345}
346 346
347/* 347/*
348 * FIXME 348 * FIXME
349 * The following NULL check is triggered by inserting, then removing a tab on the fly 349 * The following NULL check is triggered by inserting, then removing a tab on the fly
350 * as you would if you had removable media (which I do). Without this check 350 * as you would if you had removable media (which I do). Without this check
351 * the first app launched after a tab removal causes qpe to Segfault. 351 * the first app launched after a tab removal causes qpe to Segfault.
352 * This obviously has a more sinister cause, but this works around it with no 352 * This obviously has a more sinister cause, but this works around it with no
353 * obvious adverse effects. Please FIXME 353 * obvious adverse effects. Please FIXME
354 * bkc - 17/6/2004 354 * bkc - 17/6/2004
355 * 355 *
356 */ 356 */
357 357
358void LauncherTabWidget::setBusy(bool on) 358void LauncherTabWidget::setBusy(bool on)
359{ 359{
360 if ( on ) 360 if ( on )
361 currentView()->setBusy(TRUE); 361 currentView()->setBusy(TRUE);
362 else { 362 else {
363 for ( int i = 0; i < categoryBar->count(); i++ ) { 363 for ( int i = 0; i < categoryBar->count(); i++ ) {
364 if (categoryBar->tab(i)) { 364 if (categoryBar->tab(i)) {
365 LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view; 365 LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view;
366 view->setBusy( FALSE ); 366 view->setBusy( FALSE );
367 } else { 367 } else {
368 odebug << "Averting Disaster with tab " << i << " == NULL! " << oendl; 368 odebug << "Averting Disaster with tab " << i << " == NULL! " << oendl;
369 } 369 }
370 } 370 }
371 } 371 }
372} 372}
373 373
374void LauncherTabWidget::setBusyIndicatorType( const QString& str ) { 374void LauncherTabWidget::setBusyIndicatorType( const QString& str ) {
375 for (int i = 0; i < categoryBar->count(); i++ ) { 375 for (int i = 0; i < categoryBar->count(); i++ ) {
376 LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view; 376 LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view;
377 view->setBusyIndicatorType( str ); 377 view->setBusyIndicatorType( str );
378 } 378 }
379} 379}
380 380
381LauncherView *LauncherTabWidget::currentView(void) 381LauncherView *LauncherTabWidget::currentView(void)
382{ 382{
383 return (LauncherView*)stack->visibleWidget(); 383 return (LauncherView*)stack->visibleWidget();
384} 384}
385 385
386 386
387 387
388void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) 388void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data)
389{ 389{
390 QDataStream stream( data, IO_ReadOnly ); 390 QDataStream stream( data, IO_ReadOnly );
391 if ( msg == "setTabView(QString,int)" ) { 391 if ( msg == "setTabView(QString,int)" ) {
392 QString id; 392 QString id;
393 stream >> id; 393 stream >> id;
394 int mode; 394 int mode;
395 stream >> mode; 395 stream >> mode;
396 if ( view(id) ) 396 if ( view(id) )
397 view(id)->setViewMode( (LauncherView::ViewMode)mode ); 397 view(id)->setViewMode( (LauncherView::ViewMode)mode );
398 } else if ( msg == "setTabBackground(QString,int,QString)" ) { 398 } else if ( msg == "setTabBackground(QString,int,QString)" ) {
399 QString id; 399 QString id;
400 stream >> id; 400 stream >> id;
401 int mode; 401 int mode;
402 stream >> mode; 402 stream >> mode;
403 QString pixmapOrColor; 403 QString pixmapOrColor;
404 stream >> pixmapOrColor; 404 stream >> pixmapOrColor;
405 if ( view(id) ) 405 if ( view(id) )
406 view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); 406 view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
407 if ( id == "Documents" ) 407 if ( id == "Documents" )
408 docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); 408 docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
409 } else if ( msg == "setTextColor(QString,QString)" ) { 409 } else if ( msg == "setTextColor(QString,QString)" ) {
410 QString id; 410 QString id;
411 stream >> id; 411 stream >> id;
412 QString color; 412 QString color;
413 stream >> color; 413 stream >> color;
414 if ( view(id) ) 414 if ( view(id) )
415 view(id)->setTextColor( QColor(color) ); 415 view(id)->setTextColor( QColor(color) );
416 if ( id == "Documents" ) 416 if ( id == "Documents" )
417 docLoadingWidget->setTextColor( QColor(color) ); 417 docLoadingWidget->setTextColor( QColor(color) );
418 } else if ( msg == "setIconColumns(QString,int)" ) { 418 } else if ( msg == "setIconColumns(QString,int)" ) {
419 QString id; 419 QString id;
420 stream >> id; 420 stream >> id;
421 int number; 421 int number;
422 stream >> number; 422 stream >> number;
423 if ( view(id ) ) 423 if ( view(id ) )
424 view(id)->setColNumber( number ); 424 view(id)->setColNumber( number );
425 } else if ( msg == "setFont(QString,QString,int,int,int)" ) { 425 } else if ( msg == "setFont(QString,QString,int,int,int)" ) {
426 QString id; 426 QString id;
427 stream >> id; 427 stream >> id;
428 QString fam; 428 QString fam;
429 stream >> fam; 429 stream >> fam;
430 int size; 430 int size;
431 stream >> size; 431 stream >> size;
432 int weight; 432 int weight;
433 stream >> weight; 433 stream >> weight;
434 int italic; 434 int italic;
435 stream >> italic; 435 stream >> italic;
436 if ( view(id) ) { 436 if ( view(id) ) {
437 if ( !fam.isEmpty() ) { 437 if ( !fam.isEmpty() ) {
438 view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); 438 view(id)->setViewFont( QFont(fam, size, weight, italic!=0) );
439 odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; 439 odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl;
440 } else { 440 } else {
441 view(id)->clearViewFont(); 441 view(id)->clearViewFont();
442 } 442 }
443 } 443 }
444 }else if ( msg == "setBusyIndicatorType(QString)" ) { 444 }else if ( msg == "setBusyIndicatorType(QString)" ) {
445 QString type; 445 QString type;
446 stream >> type; 446 stream >> type;
447 setBusyIndicatorType( type ); 447 setBusyIndicatorType( type );
448 }else if ( msg == "home()" ) { 448 }else if ( msg == "home()" ) {
449 if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { 449 if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) {
450 if (categoryBar) 450 if (categoryBar)
451 categoryBar->nextTab(); 451 categoryBar->nextTab();
452 }else { 452 }else {
453 static_cast<QWidget*>(parent())->raise(); 453 static_cast<QWidget*>(parent())->raise();
454 } 454 }
455 } else if (msg=="doctabEnabled(int)") { 455 } else if (msg=="doctabEnabled(int)") {
456 int id; stream >> id; 456 int id; stream >> id;
457 odebug << "Doctab enabled " << id << oendl; 457 odebug << "Doctab enabled " << id << oendl;
458 reCheckDoctab(id); 458 reCheckDoctab(id);
459 } else if ( msg == "setStaticBackground(bool)" ) {
460 int set; stream >> set;
461 odebug << "setStaticBackground " << set << oendl;
462 for (int i = 0; i < categoryBar->count(); i++ )
463 {
464 LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view;
465 view->iconView()->setStaticBackgroundPicture( set );
466 }
459 } 467 }
460} 468}
461 469
462void LauncherTabWidget::reCheckDoctab(int how) 470void LauncherTabWidget::reCheckDoctab(int how)
463{ 471{
464 if ((bool)how == docTabEnabled) { 472 if ((bool)how == docTabEnabled) {
465 /* nothing to do */ 473 /* nothing to do */
466 return; 474 return;
467 } 475 }
468 if (docLoadingWidget) { 476 if (docLoadingWidget) {
469 stack->removeWidget(docLoadingWidget); 477 stack->removeWidget(docLoadingWidget);
470 delete docLoadingWidget; 478 delete docLoadingWidget;
471 docLoadingWidget = 0; 479 docLoadingWidget = 0;
472 } 480 }
473 createDocLoadingWidget(); 481 createDocLoadingWidget();
474 { 482 {
475 QCopEnvelope( "QPE/System", "reforceDocuments()" ); 483 QCopEnvelope( "QPE/System", "reforceDocuments()" );
476 odebug << "Sending doc rescan" << oendl; 484 odebug << "Sending doc rescan" << oendl;
477 } 485 }
478} 486}
479 487
480//--------------------------------------------------------------------------- 488//---------------------------------------------------------------------------
481 489
482Launcher::Launcher() 490Launcher::Launcher()
483 : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) 491 : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader )
484{ 492{
485 tabs = 0; 493 tabs = 0;
486 tb = 0; 494 tb = 0;
487 Config cfg( "Launcher" ); 495 Config cfg( "Launcher" );
488 cfg.setGroup( "DocTab" ); 496 cfg.setGroup( "DocTab" );
489 docTabEnabled = cfg.readBoolEntry( "Enable", true ); 497 docTabEnabled = cfg.readBoolEntry( "Enable", true );
490} 498}
491 499
492void Launcher::createGUI() 500void Launcher::createGUI()
493{ 501{
494 setCaption( tr("Launcher") ); 502 setCaption( tr("Launcher") );
495 503
496 // we have a pretty good idea how big we'll be 504 // we have a pretty good idea how big we'll be
497 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); 505 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() );
498 506
499 tb = new TaskBar; 507 tb = new TaskBar;
500 tabs = new LauncherTabWidget( this ); 508 tabs = new LauncherTabWidget( this );
501 setCentralWidget( tabs ); 509 setCentralWidget( tabs );
502 510
503 ServerInterface::dockWidget( tb, ServerInterface::Bottom ); 511 ServerInterface::dockWidget( tb, ServerInterface::Bottom );
504 tb->show(); 512 tb->show();
505 513
506 qApp->installEventFilter( this ); 514 qApp->installEventFilter( this );
507 515
508 connect( tb, SIGNAL(tabSelected(const QString&)), 516 connect( tb, SIGNAL(tabSelected(const QString&)),
509 this, SLOT(showTab(const QString&)) ); 517 this, SLOT(showTab(const QString&)) );
510 connect( tabs, SIGNAL(selected(const QString&)), 518 connect( tabs, SIGNAL(selected(const QString&)),
511 this, SLOT(viewSelected(const QString&)) ); 519 this, SLOT(viewSelected(const QString&)) );
512 connect( tabs, SIGNAL(clicked(const AppLnk*)), 520 connect( tabs, SIGNAL(clicked(const AppLnk*)),
513 this, SLOT(select(const AppLnk*))); 521 this, SLOT(select(const AppLnk*)));
514 connect( tabs, SIGNAL(rightPressed(AppLnk*)), 522 connect( tabs, SIGNAL(rightPressed(AppLnk*)),
515 this, SLOT(properties(AppLnk*))); 523 this, SLOT(properties(AppLnk*)));
516 524
517#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 525#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
518 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 526 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
519 connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), 527 connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)),
520 this, SLOT(systemMessage(const QCString&,const QByteArray&)) ); 528 this, SLOT(systemMessage(const QCString&,const QByteArray&)) );
521#endif 529#endif
522 530
523 // all documents 531 // all documents
524 QImage img( Resource::loadImage( "DocsIcon" ) ); 532 QImage img( Resource::loadImage( "DocsIcon" ) );
525 QPixmap pm; 533 QPixmap pm;
526 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 534 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
527 // It could add this itself if it handles docs 535 // It could add this itself if it handles docs
528 536
529 tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); 537 tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE );
530 538
531 QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); 539 QTimer::singleShot( 0, tabs, SLOT( initLayout() ) );
532 qApp->setMainWidget( this ); 540 qApp->setMainWidget( this );
533 QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); 541 QTimer::singleShot( 500, this, SLOT( makeVisible() ) );
534} 542}
535 543
536Launcher::~Launcher() 544Launcher::~Launcher()
537{ 545{
538 if ( tb ) 546 if ( tb )
539 destroyGUI(); 547 destroyGUI();
540} 548}
541 549
542 bool Launcher::requiresDocuments() const 550 bool Launcher::requiresDocuments() const
543 { 551 {
544 Config cfg( "Launcher" ); 552 Config cfg( "Launcher" );
545 cfg.setGroup( "DocTab" ); 553 cfg.setGroup( "DocTab" );
546 return cfg.readBoolEntry( "Enable", true ); 554 return cfg.readBoolEntry( "Enable", true );
547} 555}
548 556
549void Launcher::makeVisible() 557void Launcher::makeVisible()
550{ 558{
551 showMaximized(); 559 showMaximized();
552} 560}
553 561
554void Launcher::destroyGUI() 562void Launcher::destroyGUI()
555{ 563{
556 delete tb; 564 delete tb;
557 tb = 0; 565 tb = 0;
558 delete tabs; 566 delete tabs;
559 tabs =0; 567 tabs =0;
560} 568}
561 569
562bool Launcher::eventFilter( QObject*, QEvent *ev ) 570bool Launcher::eventFilter( QObject*, QEvent *ev )
563{ 571{
564#ifdef QT_QWS_CUSTOM 572#ifdef QT_QWS_CUSTOM
565 if ( ev->type() == QEvent::KeyPress ) { 573 if ( ev->type() == QEvent::KeyPress ) {
566 QKeyEvent *ke = (QKeyEvent *)ev; 574 QKeyEvent *ke = (QKeyEvent *)ev;
567 if ( ke->key() == Qt::Key_F11 ) { // menu key 575 if ( ke->key() == Qt::Key_F11 ) { // menu key
568 QWidget *active = qApp->activeWindow(); 576 QWidget *active = qApp->activeWindow();
569 if ( active && active->isPopup() ) 577 if ( active && active->isPopup() )
570 active->close(); 578 active->close();
571 else { 579 else {
572 Global::terminateBuiltin("calibrate"); // No tr 580 Global::terminateBuiltin("calibrate"); // No tr
573 tb->launchStartMenu(); 581 tb->launchStartMenu();
574 } 582 }
575 return TRUE; 583 return TRUE;
576 } 584 }
577 } 585 }
578#else 586#else
579 Q_UNUSED(ev); 587 Q_UNUSED(ev);
580#endif 588#endif
581 return FALSE; 589 return FALSE;
582} 590}
583 591
584static bool isVisibleWindow(int wid) 592static bool isVisibleWindow(int wid)
585{ 593{
586#ifdef Q_WS_QWS 594#ifdef Q_WS_QWS
587 const QList<QWSWindow> &list = qwsServer->clientWindows(); 595 const QList<QWSWindow> &list = qwsServer->clientWindows();
588 QWSWindow* w; 596 QWSWindow* w;
589 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 597 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
590 if ( w->winId() == wid ) 598 if ( w->winId() == wid )
591 return !w->isFullyObscured(); 599 return !w->isFullyObscured();
592 } 600 }
593#endif 601#endif
594 return FALSE; 602 return FALSE;
595} 603}
596 604
597void Launcher::viewSelected(const QString& s) 605void Launcher::viewSelected(const QString& s)
598{ 606{
599 setCaption( s + tr(" - Launcher") ); 607 setCaption( s + tr(" - Launcher") );
600} 608}
601 609
602void Launcher::showTab(const QString& id) 610void Launcher::showTab(const QString& id)
603{ 611{
604 tabs->categoryBar->showTab(id); 612 tabs->categoryBar->showTab(id);
605 raise(); 613 raise();
606} 614}
607 615
608void Launcher::select( const AppLnk *appLnk ) 616void Launcher::select( const AppLnk *appLnk )
609{ 617{
610 if ( appLnk->type() == "Folder" ) { // No tr 618 if ( appLnk->type() == "Folder" ) { // No tr
611 // Not supported: flat is simpler for the user 619 // Not supported: flat is simpler for the user
612 } else { 620 } else {
613 if ( appLnk->exec().isNull() ) { 621 if ( appLnk->exec().isNull() ) {
614 int i = QMessageBox::information(this,tr("No application"), 622 int i = QMessageBox::information(this,tr("No application"),
615 tr("<p>No application is defined for this document." 623 tr("<p>No application is defined for this document."
616 "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); 624 "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1);
617 625
618 /* ### Fixme */ 626 /* ### Fixme */
619 if ( i == 1 ) 627 if ( i == 1 )
620 Global::execute("textedit",appLnk->file()); 628 Global::execute("textedit",appLnk->file());
621 629
622 return; 630 return;
623 } 631 }
624 tabs->setBusy(TRUE); 632 tabs->setBusy(TRUE);
625 emit executing( appLnk ); 633 emit executing( appLnk );
626 appLnk->execute(); 634 appLnk->execute();
627 } 635 }
628} 636}
629 637
630void Launcher::properties( AppLnk *appLnk ) 638void Launcher::properties( AppLnk *appLnk )
631{ 639{
632 if ( appLnk->type() == "Folder" ) { // No tr 640 if ( appLnk->type() == "Folder" ) { // No tr
633 // Not supported: flat is simpler for the user 641 // Not supported: flat is simpler for the user
634 } else { 642 } else {
635/* ### libqtopia FIXME also moving docLnks... */ 643/* ### libqtopia FIXME also moving docLnks... */
636 LnkProperties prop(appLnk,0 ); 644 LnkProperties prop(appLnk,0 );
637 645
638 if (QPEApplication::execDialog( &prop )==QDialog::Accepted && tabs->currentView()==tabs->docView()) { 646 if (QPEApplication::execDialog( &prop )==QDialog::Accepted && tabs->currentView()==tabs->docView()) {
639 } 647 }
640 } 648 }
641} 649}
642 650
643void Launcher::storageChanged( const QList<FileSystem> & ) 651void Launcher::storageChanged( const QList<FileSystem> & )
644{ 652{
645 // ### update combo boxes if we had a combo box for the storage type 653 // ### update combo boxes if we had a combo box for the storage type
646} 654}
647 655
648void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 656void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
649{ 657{
650 QDataStream stream( data, IO_ReadOnly ); 658 QDataStream stream( data, IO_ReadOnly );
651 if ( msg == "busy()" ) { 659 if ( msg == "busy()" ) {
652 tb->startWait(); 660 tb->startWait();
653 } else if ( msg == "notBusy(QString)" ) { 661 } else if ( msg == "notBusy(QString)" ) {
654 QString app; 662 QString app;
655 stream >> app; 663 stream >> app;
656 tabs->setBusy(FALSE); 664 tabs->setBusy(FALSE);
657 tb->stopWait(app); 665 tb->stopWait(app);
658 } else if (msg == "applyStyle()") { 666 } else if (msg == "applyStyle()") {
659 tabs->currentView()->relayout(); 667 tabs->currentView()->relayout();
660 } 668 }
661} 669}
662 670
663// These are the update functions from the server 671// These are the update functions from the server
664void Launcher::typeAdded( const QString& type, const QString& name, 672void Launcher::typeAdded( const QString& type, const QString& name,
665 const QPixmap& pixmap, const QPixmap& ) 673 const QPixmap& pixmap, const QPixmap& )
666{ 674{
667 tabs->newView( type, pixmap, name ); 675 tabs->newView( type, pixmap, name );
668 ids.append( type ); 676 ids.append( type );
669 /* this will be called in applicationScanningProgress with value 100! */ 677 /* this will be called in applicationScanningProgress with value 100! */
670// tb->refreshStartMenu(); 678// tb->refreshStartMenu();
671 679
672 static bool first = TRUE; 680 static bool first = TRUE;
673 if ( first ) { 681 if ( first ) {
674 first = FALSE; 682 first = FALSE;
675 tabs->categoryBar->showTab(type); 683 tabs->categoryBar->showTab(type);
676 } 684 }
677 685
678 tabs->view( type )->setUpdatesEnabled( FALSE ); 686 tabs->view( type )->setUpdatesEnabled( FALSE );
679 tabs->view( type )->setSortEnabled( FALSE ); 687 tabs->view( type )->setSortEnabled( FALSE );
680} 688}
681 689
682void Launcher::typeRemoved( const QString& type ) 690void Launcher::typeRemoved( const QString& type )
683{ 691{
684 tabs->view( type )->removeAllItems(); 692 tabs->view( type )->removeAllItems();
685 tabs->deleteView( type ); 693 tabs->deleteView( type );
686 ids.remove( type ); 694 ids.remove( type );
687 /* this will be called in applicationScanningProgress with value 100! */ 695 /* this will be called in applicationScanningProgress with value 100! */
688// tb->refreshStartMenu(); 696// tb->refreshStartMenu();
689} 697}
690 698
691void Launcher::applicationAdded( const QString& type, const AppLnk& app ) 699void Launcher::applicationAdded( const QString& type, const AppLnk& app )
692{ 700{
693 if ( app.type() == "Separator" ) // No tr 701 if ( app.type() == "Separator" ) // No tr
694 return; 702 return;
695 703
696 LauncherView *view = tabs->view( type ); 704 LauncherView *view = tabs->view( type );
697 if ( view ) 705 if ( view )
698 view->addItem( new AppLnk( app ), FALSE ); 706 view->addItem( new AppLnk( app ), FALSE );
699 else 707 else
700 owarn << "addAppLnk: No view for type " << type.latin1() << ". Can't add app " 708 owarn << "addAppLnk: No view for type " << type.latin1() << ". Can't add app "
701 << app.name().latin1() << "!", 709 << app.name().latin1() << "!",
702 710
703 MimeType::registerApp( app ); 711 MimeType::registerApp( app );
704} 712}
705 713
706void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) 714void Launcher::applicationRemoved( const QString& type, const AppLnk& app )
707{ 715{
708 LauncherView *view = tabs->view( type ); 716 LauncherView *view = tabs->view( type );
709 if ( view ) 717 if ( view )
710 view->removeLink( app.linkFile() ); 718 view->removeLink( app.linkFile() );
711 else 719 else
712 owarn << "removeAppLnk: No view for " << type << "!" << oendl; 720 owarn << "removeAppLnk: No view for " << type << "!" << oendl;
713} 721}
714 722
715void Launcher::allApplicationsRemoved() 723void Launcher::allApplicationsRemoved()
716{ 724{
717 MimeType::clear(); 725 MimeType::clear();
718 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) 726 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it)
719 tabs->view( (*it) )->removeAllItems(); 727 tabs->view( (*it) )->removeAllItems();
720} 728}
721 729
722void Launcher::documentAdded( const DocLnk& doc ) 730void Launcher::documentAdded( const DocLnk& doc )
723{ 731{
724 tabs->docView()->addItem( new DocLnk( doc ), FALSE ); 732 tabs->docView()->addItem( new DocLnk( doc ), FALSE );
725} 733}
726 734
727void Launcher::aboutToAddBegin() 735void Launcher::aboutToAddBegin()
728{ 736{
729 tabs->docView()->setUpdatesEnabled( false ); 737 tabs->docView()->setUpdatesEnabled( false );
730} 738}
731 739
732void Launcher::aboutToAddEnd() 740void Launcher::aboutToAddEnd()
733{ 741{
734 tabs->docView()->setUpdatesEnabled( true ); 742 tabs->docView()->setUpdatesEnabled( true );
735} 743}
736 744
737void Launcher::showLoadingDocs() 745void Launcher::showLoadingDocs()
738{ 746{
739 tabs->docView()->hide(); 747 tabs->docView()->hide();
740} 748}
741 749
742void Launcher::showDocTab() 750void Launcher::showDocTab()
743{ 751{
744 if ( tabs->categoryBar->currentView() == tabs->docView() ) 752 if ( tabs->categoryBar->currentView() == tabs->docView() )
745 tabs->docView()->show(); 753 tabs->docView()->show();
746} 754}
747 755
748void Launcher::documentRemoved( const DocLnk& doc ) 756void Launcher::documentRemoved( const DocLnk& doc )
749{ 757{
750 tabs->docView()->removeLink( doc.linkFile() ); 758 tabs->docView()->removeLink( doc.linkFile() );
751} 759}
752 760
753void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) 761void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc )
754{ 762{
755#if 0 763#if 0
756 documentRemoved( oldDoc ); 764 documentRemoved( oldDoc );
757 documentAdded( newDoc ); 765 documentAdded( newDoc );
758// tabs->docView()->updateTools(); 766// tabs->docView()->updateTools();
759#else 767#else
760 tabs->docView()->changeItem(oldDoc,new DocLnk(newDoc)); 768 tabs->docView()->changeItem(oldDoc,new DocLnk(newDoc));
761#endif 769#endif
762} 770}
763 771
764void Launcher::allDocumentsRemoved() 772void Launcher::allDocumentsRemoved()
765{ 773{
766 tabs->docView()->removeAllItems(); 774 tabs->docView()->removeAllItems();
767} 775}
768 776
769void Launcher::applicationStateChanged( const QString& name, ApplicationState state ) 777void Launcher::applicationStateChanged( const QString& name, ApplicationState state )
770{ 778{
771 tb->setApplicationState( name, state ); 779 tb->setApplicationState( name, state );
772} 780}
773 781
774void Launcher::applicationScanningProgress( int percent ) 782void Launcher::applicationScanningProgress( int percent )
775{ 783{
776 switch ( percent ) { 784 switch ( percent ) {
777 case 0: { 785 case 0: {
778 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { 786 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) {
779 tabs->view( (*it) )->setUpdatesEnabled( FALSE ); 787 tabs->view( (*it) )->setUpdatesEnabled( FALSE );
780 tabs->view( (*it) )->setSortEnabled( FALSE ); 788 tabs->view( (*it) )->setSortEnabled( FALSE );
781 } 789 }
782 break; 790 break;
783 } 791 }
784 case 100: { 792 case 100: {
785 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { 793 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) {
786 tabs->view( (*it) )->setUpdatesEnabled( TRUE ); 794 tabs->view( (*it) )->setUpdatesEnabled( TRUE );
787 tabs->view( (*it) )->setSortEnabled( TRUE ); 795 tabs->view( (*it) )->setSortEnabled( TRUE );
788 } 796 }
789 tb->refreshStartMenu(); 797 tb->refreshStartMenu();
790 break; 798 break;
791 } 799 }
792 default: 800 default:
793 break; 801 break;
794 } 802 }
795} 803}
796 804
797void Launcher::documentScanningProgress( int percent ) 805void Launcher::documentScanningProgress( int percent )
798{ 806{
799 switch ( percent ) { 807 switch ( percent ) {
800 case 0: { 808 case 0: {
801 tabs->setLoadingProgress( 0 ); 809 tabs->setLoadingProgress( 0 );
802 tabs->setLoadingWidgetEnabled( TRUE ); 810 tabs->setLoadingWidgetEnabled( TRUE );
803 tabs->docView()->setUpdatesEnabled( FALSE ); 811 tabs->docView()->setUpdatesEnabled( FALSE );
804 tabs->docView()->setSortEnabled( FALSE ); 812 tabs->docView()->setSortEnabled( FALSE );
805 break; 813 break;
806 } 814 }
807 case 100: { 815 case 100: {
808 tabs->docView()->updateTools(); 816 tabs->docView()->updateTools();
809 tabs->docView()->setSortEnabled( TRUE ); 817 tabs->docView()->setSortEnabled( TRUE );
810 tabs->docView()->setUpdatesEnabled( TRUE ); 818 tabs->docView()->setUpdatesEnabled( TRUE );
811 tabs->setLoadingWidgetEnabled( FALSE ); 819 tabs->setLoadingWidgetEnabled( FALSE );
812 break; 820 break;
813 } 821 }
814 default: 822 default:
815 tabs->setLoadingProgress( percent ); 823 tabs->setLoadingProgress( percent );
816 break; 824 break;
817 } 825 }
818} 826}
819 827
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index e7229ee..a4c7561 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -1,1250 +1,1260 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "launcherview.h" 21#include "launcherview.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/odebug.h> 24#include <opie2/odebug.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qtopia/qpeapplication.h> 26#include <qtopia/qpeapplication.h>
27#include <qtopia/private/categories.h> 27#include <qtopia/private/categories.h>
28#include <qtopia/categoryselect.h> 28#include <qtopia/categoryselect.h>
29#include <qtopia/mimetype.h> 29#include <qtopia/mimetype.h>
30#include <qtopia/resource.h> 30#include <qtopia/resource.h>
31using namespace Opie::Core; 31using namespace Opie::Core;
32 32
33#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
34 34
35/* QT */ 35/* QT */
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qfileinfo.h> 37#include <qfileinfo.h>
38#include <qiconview.h> 38#include <qiconview.h>
39#include <qobjectlist.h> 39#include <qobjectlist.h>
40 40
41 41
42// These define how the busy icon is animated and highlighted 42// These define how the busy icon is animated and highlighted
43#define BRIGHTEN_BUSY_ICON 43#define BRIGHTEN_BUSY_ICON
44//#define ALPHA_FADE_BUSY_ICON 44//#define ALPHA_FADE_BUSY_ICON
45//#define USE_ANIMATED_BUSY_ICON_OVERLAY 45//#define USE_ANIMATED_BUSY_ICON_OVERLAY
46#define BOUNCE_BUSY_ICON 46#define BOUNCE_BUSY_ICON
47 47
48typedef QMap<QString,QPixmap>::Iterator pixiter; 48typedef QMap<QString,QPixmap>::Iterator pixiter;
49 49
50class BgPixmap 50class BgPixmap
51{ 51{
52public: 52public:
53 BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} 53 BgPixmap( const QPixmap &p ) : pm(p), ref(1) {}
54 QPixmap pm; 54 QPixmap pm;
55 int ref; 55 int ref;
56}; 56};
57 57
58 58
59static QMap<QString,BgPixmap*> *bgCache = 0; 59static QMap<QString,BgPixmap*> *bgCache = 0;
60 60
61static void cleanup_cache() 61static void cleanup_cache()
62{ 62{
63 QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); 63 QMap<QString,BgPixmap*>::Iterator it = bgCache->begin();
64 while ( it != bgCache->end() ) { 64 while ( it != bgCache->end() ) {
65 QMap<QString,BgPixmap*>::Iterator curr = it; 65 QMap<QString,BgPixmap*>::Iterator curr = it;
66 ++it; 66 ++it;
67 delete (*curr); 67 delete (*curr);
68 bgCache->remove( curr ); 68 bgCache->remove( curr );
69 } 69 }
70 delete bgCache; 70 delete bgCache;
71 bgCache = 0; 71 bgCache = 0;
72} 72}
73 73
74 74
75class LauncherItem : public QIconViewItem 75class LauncherItem : public QIconViewItem
76{ 76{
77public: 77public:
78 enum iconstate_t { 78 enum iconstate_t {
79 BASE_ICON, 79 BASE_ICON,
80 WAITING_ICON, 80 WAITING_ICON,
81 EYE_ICON 81 EYE_ICON
82 }; 82 };
83 83
84 LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE ); 84 LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE );
85 ~LauncherItem(); 85 ~LauncherItem();
86 86
87 AppLnk *appLnk() const { return app; } 87 AppLnk *appLnk() const { return app; }
88 AppLnk *takeAppLnk() { AppLnk* r=app; app=0; return r; } 88 AppLnk *takeAppLnk() { AppLnk* r=app; app=0; return r; }
89 89
90 void animateIcon(); 90 void animateIcon();
91 void resetIcon(); 91 void resetIcon();
92 bool isEyeImage()const{return m_EyeImage;} 92 bool isEyeImage()const{return m_EyeImage;}
93 93
94 virtual int compare ( QIconViewItem * i ) const; 94 virtual int compare ( QIconViewItem * i ) const;
95 void paintItem( QPainter *p, const QColorGroup &cg ); 95 void paintItem( QPainter *p, const QColorGroup &cg );
96 96
97 void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } 97 void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; }
98 void setEyePixmap(const QPixmap&aIcon); 98 void setEyePixmap(const QPixmap&aIcon);
99 virtual QPixmap*pixmap()const; 99 virtual QPixmap*pixmap()const;
100 100
101protected: 101protected:
102 bool isBigIcon; 102 bool isBigIcon;
103 int iteration; 103 int iteration;
104 AppLnk* app; 104 AppLnk* app;
105 105
106private: 106private:
107 void paintAnimatedIcon( QPainter *p ); 107 void paintAnimatedIcon( QPainter *p );
108 BusyIndicatorType busyType; 108 BusyIndicatorType busyType;
109 int psize; 109 int psize;
110 bool m_EyeImage; 110 bool m_EyeImage;
111 iconstate_t m_EyeImageSet; 111 iconstate_t m_EyeImageSet;
112}; 112};
113 113
114LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) 114LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon )
115 : QIconViewItem( parent, applnk->name(), 115 : QIconViewItem( parent, applnk->name(),
116 bigIcon ? applnk->bigPixmap() :applnk->pixmap() ), 116 bigIcon ? applnk->bigPixmap() :applnk->pixmap() ),
117 isBigIcon( bigIcon ), 117 isBigIcon( bigIcon ),
118 iteration(0), 118 iteration(0),
119 app(applnk), // Takes ownership 119 app(applnk), // Takes ownership
120 psize( (bigIcon ? applnk->bigPixmap().width() :applnk->pixmap().width() ) ), 120 psize( (bigIcon ? applnk->bigPixmap().width() :applnk->pixmap().width() ) ),
121 m_EyeImage(false), 121 m_EyeImage(false),
122 m_EyeImageSet(BASE_ICON) 122 m_EyeImageSet(BASE_ICON)
123{ 123{
124 if (applnk->type().lower().startsWith("image/") && applnk->exec().contains("opie-eye",false)) { 124 if (applnk->type().lower().startsWith("image/") && applnk->exec().contains("opie-eye",false)) {
125 m_EyeImage = true; 125 m_EyeImage = true;
126 QMap<QString,QPixmap>::Iterator it = LauncherIconView::sm_EyeCache->find(applnk->file()); 126 QMap<QString,QPixmap>::Iterator it = LauncherIconView::sm_EyeCache->find(applnk->file());
127 if (it != LauncherIconView::sm_EyeCache->end()) { 127 if (it != LauncherIconView::sm_EyeCache->end()) {
128 m_EyeImageSet = EYE_ICON; 128 m_EyeImageSet = EYE_ICON;
129 setPixmap(*it); 129 setPixmap(*it);
130 } 130 }
131 } 131 }
132} 132}
133 133
134LauncherItem::~LauncherItem() 134LauncherItem::~LauncherItem()
135{ 135{
136 LauncherIconView* liv = (LauncherIconView*)iconView(); 136 LauncherIconView* liv = (LauncherIconView*)iconView();
137 if ( liv->busyItem() == this ) 137 if ( liv->busyItem() == this )
138 liv->setBusy(FALSE); 138 liv->setBusy(FALSE);
139 delete app; 139 delete app;
140} 140}
141 141
142QPixmap*LauncherItem::pixmap()const 142QPixmap*LauncherItem::pixmap()const
143{ 143{
144 if (m_EyeImage && m_EyeImageSet == BASE_ICON) { 144 if (m_EyeImage && m_EyeImageSet == BASE_ICON) {
145 LauncherIconView* liv = (LauncherIconView*)iconView(); 145 LauncherIconView* liv = (LauncherIconView*)iconView();
146 liv->requestEyePix(this); 146 liv->requestEyePix(this);
147 } 147 }
148 return QIconViewItem::pixmap(); 148 return QIconViewItem::pixmap();
149} 149}
150 150
151int LauncherItem::compare ( QIconViewItem * i ) const 151int LauncherItem::compare ( QIconViewItem * i ) const
152{ 152{
153 LauncherIconView* view = (LauncherIconView*)iconView(); 153 LauncherIconView* view = (LauncherIconView*)iconView();
154 return view->compare(app,((LauncherItem *)i)->appLnk()); 154 return view->compare(app,((LauncherItem *)i)->appLnk());
155} 155}
156 156
157void LauncherItem::paintItem( QPainter *p, const QColorGroup &cg ) 157void LauncherItem::paintItem( QPainter *p, const QColorGroup &cg )
158{ 158{
159 LauncherIconView* liv = (LauncherIconView*)iconView(); 159 LauncherIconView* liv = (LauncherIconView*)iconView();
160 QBrush oldBrush( liv->itemTextBackground() ); 160 QBrush oldBrush( liv->itemTextBackground() );
161 QColorGroup mycg( cg ); 161 QColorGroup mycg( cg );
162 if ( liv->currentItem() == this ) { 162 if ( liv->currentItem() == this ) {
163 liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) ); 163 liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) );
164 mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) ); 164 mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) );
165 } 165 }
166 166
167 QIconViewItem::paintItem(p,mycg); 167 QIconViewItem::paintItem(p,mycg);
168 168
169 // Paint animation overlay 169 // Paint animation overlay
170 if ( liv->busyItem() == this ) 170 if ( liv->busyItem() == this )
171 paintAnimatedIcon(p); 171 paintAnimatedIcon(p);
172 172
173 if ( liv->currentItem() == this ) 173 if ( liv->currentItem() == this )
174 liv->setItemTextBackground( oldBrush ); 174 liv->setItemTextBackground( oldBrush );
175} 175}
176 176
177void LauncherItem::paintAnimatedIcon( QPainter *p ) 177void LauncherItem::paintAnimatedIcon( QPainter *p )
178{ 178{
179 LauncherIconView* liv = (LauncherIconView*)iconView(); 179 LauncherIconView* liv = (LauncherIconView*)iconView();
180 int pic = iteration % 16; 180 int pic = iteration % 16;
181 int w = pixmap()->width(), h = pixmap()->height(); 181 int w = pixmap()->width(), h = pixmap()->height();
182 QPixmap dblBuf( w, h + 4 ); 182 QPixmap dblBuf( w, h + 4 );
183 QPainter p2( &dblBuf ); 183 QPainter p2( &dblBuf );
184 int x1, y1; 184 int x1, y1;
185 if ( liv->itemTextPos() == QIconView::Bottom ) { 185 if ( liv->itemTextPos() == QIconView::Bottom ) {
186 x1 = x() + (width() - w) / 2 - liv->contentsX(); 186 x1 = x() + (width() - w) / 2 - liv->contentsX();
187 y1 = y() - liv->contentsY(); 187 y1 = y() - liv->contentsY();
188 } else { 188 } else {
189 x1 = x() - liv->contentsX(); 189 x1 = x() - liv->contentsX();
190 y1 = y() + (height() - h) / 2 - liv->contentsY(); 190 y1 = y() + (height() - h) / 2 - liv->contentsY();
191 } 191 }
192 y1 -= 2; 192 y1 -= 2;
193 p2.translate(-x1,-y1); 193 p2.translate(-x1,-y1);
194 liv->drawBackground( &p2, QRect(x1,y1,w,h+4) ); 194 liv->drawBackground( &p2, QRect(x1,y1,w,h+4) );
195 int bounceY = 2; 195 int bounceY = 2;
196#ifdef BOUNCE_BUSY_ICON 196#ifdef BOUNCE_BUSY_ICON
197 if ( busyType == BIT_Animated ) { 197 if ( busyType == BIT_Animated ) {
198 bounceY = 4 - ((iteration+2)%8); 198 bounceY = 4 - ((iteration+2)%8);
199 bounceY = bounceY < 0 ? -bounceY : bounceY; 199 bounceY = bounceY < 0 ? -bounceY : bounceY;
200 } 200 }
201#endif 201#endif
202 p2.drawPixmap( x1, y1 + bounceY, *pixmap() ); 202 p2.drawPixmap( x1, y1 + bounceY, *pixmap() );
203#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 203#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
204 p2.drawPixmap( x1, y1 + bounceY, liv->busyPixmap(), w * pic, 0, w, h ); 204 p2.drawPixmap( x1, y1 + bounceY, liv->busyPixmap(), w * pic, 0, w, h );
205#else 205#else
206 Q_UNUSED( pic ) 206 Q_UNUSED( pic )
207#endif 207#endif
208 p->drawPixmap( x1, y1, dblBuf ); 208 p->drawPixmap( x1, y1, dblBuf );
209} 209}
210 210
211void LauncherItem::animateIcon() 211void LauncherItem::animateIcon()
212{ 212{
213 LauncherIconView* liv = (LauncherIconView*)iconView(); 213 LauncherIconView* liv = (LauncherIconView*)iconView();
214 214
215 if ( liv->busyItem() != this || !app ) 215 if ( liv->busyItem() != this || !app )
216 return; 216 return;
217 217
218 // Highlight the icon 218 // Highlight the icon
219 if ( iteration == 0 ) { 219 if ( iteration == 0 ) {
220 QPixmap src; 220 QPixmap src;
221 pixiter it; 221 pixiter it;
222 if (isEyeImage() && (it=LauncherIconView::sm_EyeCache->find(appLnk()->file()))!=LauncherIconView::sm_EyeCache->end()) { 222 if (isEyeImage() && (it=LauncherIconView::sm_EyeCache->find(appLnk()->file()))!=LauncherIconView::sm_EyeCache->end()) {
223 src = (*it); 223 src = (*it);
224 } else { 224 } else {
225 src = ((isBigIcon ? app->bigPixmap() : app->pixmap())); 225 src = ((isBigIcon ? app->bigPixmap() : app->pixmap()));
226 } 226 }
227 QImage img = src.convertToImage(); 227 QImage img = src.convertToImage();
228 QRgb *rgb; 228 QRgb *rgb;
229 int count; 229 int count;
230 if ( img.depth() == 32 ) { 230 if ( img.depth() == 32 ) {
231 rgb = (QRgb*)img.bits(); 231 rgb = (QRgb*)img.bits();
232 count = img.bytesPerLine()/sizeof(QRgb)*img.height(); 232 count = img.bytesPerLine()/sizeof(QRgb)*img.height();
233 } else { 233 } else {
234 rgb = img.colorTable(); 234 rgb = img.colorTable();
235 count = img.numColors(); 235 count = img.numColors();
236 } 236 }
237 for ( int r = 0; r < count; r++, rgb++ ) { 237 for ( int r = 0; r < count; r++, rgb++ ) {
238#if defined(BRIGHTEN_BUSY_ICON) 238#if defined(BRIGHTEN_BUSY_ICON)
239 QColor c(*rgb); 239 QColor c(*rgb);
240 int h, s, v; 240 int h, s, v;
241 c.hsv(&h,&s,&v); 241 c.hsv(&h,&s,&v);
242 c.setHsv(h,QMAX(s-24,0),QMIN(v+48,255)); 242 c.setHsv(h,QMAX(s-24,0),QMIN(v+48,255));
243 *rgb = qRgba(c.red(),c.green(),c.blue(),qAlpha(*rgb)); 243 *rgb = qRgba(c.red(),c.green(),c.blue(),qAlpha(*rgb));
244#elif defined(ALPHA_FADE_BUSY_ICON) 244#elif defined(ALPHA_FADE_BUSY_ICON)
245 *rgb = qRgba(qRed(*rgb),qGreen(*rgb),qBlue(*rgb),qAlpha(*rgb)/2); 245 *rgb = qRgba(qRed(*rgb),qGreen(*rgb),qBlue(*rgb),qAlpha(*rgb)/2);
246#endif 246#endif
247 } 247 }
248 src.convertFromImage( img ); 248 src.convertFromImage( img );
249 setPixmap( src ); 249 setPixmap( src );
250 } 250 }
251 251
252 iteration++; 252 iteration++;
253 253
254 // Paint animation overlay 254 // Paint animation overlay
255 QPainter p( liv->viewport() ); 255 QPainter p( liv->viewport() );
256 paintAnimatedIcon( &p ); 256 paintAnimatedIcon( &p );
257} 257}
258 258
259void LauncherItem::resetIcon() 259void LauncherItem::resetIcon()
260{ 260{
261 iteration = 0; 261 iteration = 0;
262 if (isEyeImage()) { 262 if (isEyeImage()) {
263 QMap<QString,QPixmap>::Iterator it = LauncherIconView::sm_EyeCache->find(appLnk()->file()); 263 QMap<QString,QPixmap>::Iterator it = LauncherIconView::sm_EyeCache->find(appLnk()->file());
264 if (it != LauncherIconView::sm_EyeCache->end()) { 264 if (it != LauncherIconView::sm_EyeCache->end()) {
265 setPixmap(*it); 265 setPixmap(*it);
266 return; 266 return;
267 } 267 }
268 } 268 }
269 setPixmap(isBigIcon ? app->bigPixmap() : app->pixmap()); 269 setPixmap(isBigIcon ? app->bigPixmap() : app->pixmap());
270} 270}
271 271
272void LauncherItem::setEyePixmap(const QPixmap&aIcon) 272void LauncherItem::setEyePixmap(const QPixmap&aIcon)
273{ 273{
274 if (!isEyeImage()) return; 274 if (!isEyeImage()) return;
275 setPixmap(aIcon); 275 setPixmap(aIcon);
276 m_EyeImageSet = EYE_ICON; 276 m_EyeImageSet = EYE_ICON;
277} 277}
278 278
279//=========================================================================== 279//===========================================================================
280// Implemantation of LauncherIconview start 280// Implemantation of LauncherIconview start
281//=========================================================================== 281//===========================================================================
282 282
283QMap<QString,QPixmap>* LauncherIconView::sm_EyeCache=0; 283QMap<QString,QPixmap>* LauncherIconView::sm_EyeCache=0;
284 284
285LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) 285LauncherIconView::LauncherIconView( QWidget* parent, const char* name )
286 : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white),numColumns(0) 286 : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white),numColumns(0)
287{ 287{
288 m_EyeCallBack = 0; 288 m_EyeCallBack = 0;
289 if (!sm_EyeCache) sm_EyeCache = new QMap<QString,QPixmap>(); 289 if (!sm_EyeCache) sm_EyeCache = new QMap<QString,QPixmap>();
290 sortmeth = Name; 290 sortmeth = Name;
291 hidden.setAutoDelete(TRUE); 291 hidden.setAutoDelete(TRUE);
292 ike = FALSE; 292 ike = FALSE;
293 calculateGrid( Bottom ); 293 calculateGrid( Bottom );
294 connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer())); 294 connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer()));
295 Config config( "Launcher" ); 295 Config config( "Launcher" );
296 config.setGroup( "GUI" ); 296 config.setGroup( "GUI" );
297 staticBackground = config.readEntry( "StaticBackground", false ); 297 setStaticBackgroundPicture( config.readBoolEntry( "StaticBackground", true ) );
298 if ( staticBackground )
299 {
300 setStaticBackground( true );
301 verticalScrollBar()->setTracking( false );
302 }
303} 298}
304 299
305LauncherIconView::~LauncherIconView() 300LauncherIconView::~LauncherIconView()
306{ 301{
307 odebug << "LauncherIconView::~LauncherIconView()" << oendl; 302 odebug << "LauncherIconView::~LauncherIconView()" << oendl;
308#if 0 // debuggery 303#if 0 // debuggery
309 QListIterator<AppLnk> it(hidden); 304 QListIterator<AppLnk> it(hidden);
310 AppLnk* l; 305 AppLnk* l;
311 while ((l=it.current())) { 306 while ((l=it.current())) {
312 ++it; 307 ++it;
313 //odebug << "" << l << ": hidden (should remove)" << oendl; 308 //odebug << "" << l << ": hidden (should remove)" << oendl;
314 } 309 }
315#endif 310#endif
316} 311}
317 312
313void LauncherIconView::setStaticBackgroundPicture( bool enable )
314{
315 staticBackground = enable;
316 if ( staticBackground )
317 {
318 setStaticBackground( true );
319 verticalScrollBar()->setTracking( false );
320 }
321 else
322 {
323 setStaticBackground( false );
324 verticalScrollBar()->setTracking( true );
325 }
326}
327
318int LauncherIconView::compare(const AppLnk* a, const AppLnk* b) 328int LauncherIconView::compare(const AppLnk* a, const AppLnk* b)
319{ 329{
320 switch (sortmeth) { 330 switch (sortmeth) {
321 case Name: 331 case Name:
322 return a->name().lower().compare(b->name().lower()); 332 return a->name().lower().compare(b->name().lower());
323 case Date: { 333 case Date: {
324 QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file()); 334 QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file());
325 QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file()); 335 QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file());
326 return fa.lastModified().secsTo(fb.lastModified()); 336 return fa.lastModified().secsTo(fb.lastModified());
327 } 337 }
328 case Type: 338 case Type:
329 return a->type().compare(b->type()); 339 return a->type().compare(b->type());
330 } 340 }
331 return 0; 341 return 0;
332} 342}
333 343
334void LauncherIconView::setSortMethod( SortMethod m ) 344void LauncherIconView::setSortMethod( SortMethod m )
335{ 345{
336 if ( sortmeth != m ) { 346 if ( sortmeth != m ) {
337 sortmeth = m; 347 sortmeth = m;
338 sort(); 348 sort();
339 } 349 }
340} 350}
341 351
342void LauncherIconView::setCategoryFilter( int catfilter, bool resort ) 352void LauncherIconView::setCategoryFilter( int catfilter, bool resort )
343{ 353{
344 if ( catfilter == -2 ) 354 if ( catfilter == -2 )
345 cf = 0; 355 cf = 0;
346 else 356 else
347 cf = catfilter; 357 cf = catfilter;
348 hideOrShowItems(resort); 358 hideOrShowItems(resort);
349} 359}
350 360
351void LauncherIconView::setTypeFilter(const QString& typefilter, bool resort) 361void LauncherIconView::setTypeFilter(const QString& typefilter, bool resort)
352{ 362{
353 tf = QRegExp(typefilter,FALSE,TRUE); 363 tf = QRegExp(typefilter,FALSE,TRUE);
354 hideOrShowItems(resort); 364 hideOrShowItems(resort);
355} 365}
356 366
357void LauncherIconView::setItemTextPos( ItemTextPos pos ) 367void LauncherIconView::setItemTextPos( ItemTextPos pos )
358{ 368{
359 calculateGrid( pos ); 369 calculateGrid( pos );
360 QIconView::setItemTextPos( pos ); 370 QIconView::setItemTextPos( pos );
361} 371}
362 372
363void LauncherIconView::drawBackground( QPainter *p, const QRect &r ) 373void LauncherIconView::drawBackground( QPainter *p, const QRect &r )
364{ 374{
365 if ( bgPixmap.isNull() ) 375 if ( bgPixmap.isNull() )
366 { 376 {
367 p->fillRect( r, bgColor ); 377 p->fillRect( r, bgColor );
368 } 378 }
369 else 379 else
370 { 380 {
371 if ( staticBackground ) 381 if ( staticBackground )
372 { 382 {
373 p->drawPixmap( r.x(), r.y(), bgPixmap, r.x(), r.y(), r.width(), r.height() ); 383 p->drawTiledPixmap( r, bgPixmap, QPoint( r.x() % bgPixmap.width(), r.y() % bgPixmap.height() ) );
374 } 384 }
375 else 385 else
376 { 386 {
377 p->drawTiledPixmap( r, bgPixmap, QPoint( (r.x() + contentsX()) % bgPixmap.width(), 387 p->drawTiledPixmap( r, bgPixmap, QPoint( (r.x() + contentsX()) % bgPixmap.width(),
378 (r.y() + contentsY()) % bgPixmap.height() ) ); 388 (r.y() + contentsY()) % bgPixmap.height() ) );
379 } 389 }
380 } 390 }
381} 391}
382 392
383void LauncherIconView::addCatsAndMimes(AppLnk* app) 393void LauncherIconView::addCatsAndMimes(AppLnk* app)
384{ 394{
385 // QStringList c = app->categories(); 395 // QStringList c = app->categories();
386 // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) { 396 // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) {
387 // cats.replace(*cit,(void*)1); 397 // cats.replace(*cit,(void*)1);
388 // } 398 // }
389 QString maj=app->type(); 399 QString maj=app->type();
390 int sl=maj.find('/'); 400 int sl=maj.find('/');
391 if (sl>=0) { 401 if (sl>=0) {
392 QString k; 402 QString k;
393 k = maj.left(12) == "application/" ? maj : maj.left(sl); 403 k = maj.left(12) == "application/" ? maj : maj.left(sl);
394 mimes.replace(k,(void*)1); 404 mimes.replace(k,(void*)1);
395 } 405 }
396} 406}
397 407
398void LauncherIconView::setBusy(bool on) 408void LauncherIconView::setBusy(bool on)
399{ 409{
400#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 410#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
401 if ( busyPix.isNull() ) { 411 if ( busyPix.isNull() ) {
402 int size = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); 412 int size = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
403 busyPix.convertFromImage( Resource::loadImage( "busy" ).smoothScale( size * 16, size ) ); 413 busyPix.convertFromImage( Resource::loadImage( "busy" ).smoothScale( size * 16, size ) );
404 } 414 }
405#endif 415#endif
406 416
407 if ( on ) { 417 if ( on ) {
408 busyTimer = startTimer( 100 ); 418 busyTimer = startTimer( 100 );
409 } else { 419 } else {
410 if ( busyTimer ) { 420 if ( busyTimer ) {
411 killTimer( busyTimer ); 421 killTimer( busyTimer );
412 busyTimer = 0; 422 busyTimer = 0;
413 } 423 }
414 } 424 }
415 425
416 LauncherItem *c = on ? (LauncherItem*)currentItem() : 0; 426 LauncherItem *c = on ? (LauncherItem*)currentItem() : 0;
417 427
418 if ( bsy != c ) { 428 if ( bsy != c ) {
419 LauncherItem *oldBusy = bsy; 429 LauncherItem *oldBusy = bsy;
420 bsy = c; 430 bsy = c;
421 if ( oldBusy ) { 431 if ( oldBusy ) {
422 oldBusy->resetIcon(); 432 oldBusy->resetIcon();
423 } 433 }
424 if ( bsy ) { 434 if ( bsy ) {
425 bsy->setBusyIndicatorType( busyType ) ; 435 bsy->setBusyIndicatorType( busyType ) ;
426 bsy->animateIcon(); 436 bsy->animateIcon();
427 } 437 }
428 } 438 }
429} 439}
430 440
431void LauncherIconView::clear() 441void LauncherIconView::clear()
432{ 442{
433 mimes.clear(); 443 mimes.clear();
434 cats.clear(); 444 cats.clear();
435 QIconView::clear(); 445 QIconView::clear();
436 hidden.clear(); 446 hidden.clear();
437} 447}
438 448
439QStringList LauncherIconView::mimeTypes() const 449QStringList LauncherIconView::mimeTypes() const
440{ 450{
441 QStringList r; 451 QStringList r;
442 QDictIterator<void> it(mimes); 452 QDictIterator<void> it(mimes);
443 while (it.current()) { 453 while (it.current()) {
444 r.append(it.currentKey()); 454 r.append(it.currentKey());
445 ++it; 455 ++it;
446 } 456 }
447 r.sort(); 457 r.sort();
448 return r; 458 return r;
449} 459}
450 460
451LauncherItem*LauncherIconView::findDocItem(const QString&fname) 461LauncherItem*LauncherIconView::findDocItem(const QString&fname)
452{ 462{
453 LauncherItem* item = (LauncherItem*)firstItem(); 463 LauncherItem* item = (LauncherItem*)firstItem();
454 while (item) { 464 while (item) {
455 if (item->appLnk()->file()==fname) { 465 if (item->appLnk()->file()==fname) {
456 break; 466 break;
457 } 467 }
458 item = (LauncherItem*)item->nextItem(); 468 item = (LauncherItem*)item->nextItem();
459 } 469 }
460 return item; 470 return item;
461} 471}
462 472
463void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width) 473void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width)
464{ 474{
465 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); 475 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
466 if (s!=width) return; 476 if (s!=width) return;
467 LauncherItem*item = findDocItem(aFile); 477 LauncherItem*item = findDocItem(aFile);
468 if (!item||!item->isEyeImage()) return; 478 if (!item||!item->isEyeImage()) return;
469 (*sm_EyeCache)[aFile]=aPixmap; 479 (*sm_EyeCache)[aFile]=aPixmap;
470 item->setEyePixmap(aPixmap); 480 item->setEyePixmap(aPixmap);
471} 481}
472 482
473void LauncherIconView::checkCallback() 483void LauncherIconView::checkCallback()
474{ 484{
475 if (!m_EyeCallBack) { 485 if (!m_EyeCallBack) {
476 m_EyeCallBack = new LauncherThumbReceiver(); 486 m_EyeCallBack = new LauncherThumbReceiver();
477 connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)), 487 connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)),
478 this,SLOT(setEyePixmap(const QPixmap&,const QString&,int))); 488 this,SLOT(setEyePixmap(const QPixmap&,const QString&,int)));
479 } 489 }
480 m_eyeTimer.changeInterval(600000); 490 m_eyeTimer.changeInterval(600000);
481} 491}
482 492
483void LauncherIconView::addCheckItem(AppLnk* app) 493void LauncherIconView::addCheckItem(AppLnk* app)
484{ 494{
485 LauncherItem*item = new LauncherItem( this, app, bigIcns ); 495 LauncherItem*item = new LauncherItem( this, app, bigIcns );
486 if (item->isEyeImage()) { 496 if (item->isEyeImage()) {
487 checkCallback(); 497 checkCallback();
488 } 498 }
489} 499}
490 500
491void LauncherIconView::requestEyePix(const LauncherItem*item) 501void LauncherIconView::requestEyePix(const LauncherItem*item)
492{ 502{
493 if (!item) return; 503 if (!item) return;
494 if (item->isEyeImage()) { 504 if (item->isEyeImage()) {
495 checkCallback(); 505 checkCallback();
496 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); 506 int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
497 m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s); 507 m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s);
498 } 508 }
499} 509}
500 510
501void LauncherIconView::stopEyeTimer() 511void LauncherIconView::stopEyeTimer()
502{ 512{
503 if (m_EyeCallBack) { 513 if (m_EyeCallBack) {
504 disconnect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)), 514 disconnect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)),
505 this,SLOT(setEyePixmap(const QPixmap&,const QString&,int))); 515 this,SLOT(setEyePixmap(const QPixmap&,const QString&,int)));
506 delete m_EyeCallBack; 516 delete m_EyeCallBack;
507 m_EyeCallBack=0; 517 m_EyeCallBack=0;
508 } 518 }
509 m_eyeTimer.stop(); 519 m_eyeTimer.stop();
510} 520}
511 521
512void LauncherIconView::updateCategoriesAndMimeTypes() 522void LauncherIconView::updateCategoriesAndMimeTypes()
513{ 523{
514 mimes.clear(); 524 mimes.clear();
515 cats.clear(); 525 cats.clear();
516 LauncherItem* item = (LauncherItem*)firstItem(); 526 LauncherItem* item = (LauncherItem*)firstItem();
517 while (item) { 527 while (item) {
518 addCatsAndMimes(item->appLnk()); 528 addCatsAndMimes(item->appLnk());
519 item = (LauncherItem*)item->nextItem(); 529 item = (LauncherItem*)item->nextItem();
520 } 530 }
521 QListIterator<AppLnk> it(hidden); 531 QListIterator<AppLnk> it(hidden);
522 AppLnk* l; 532 AppLnk* l;
523 while ((l=it.current())) { 533 while ((l=it.current())) {
524 addCatsAndMimes(l); 534 addCatsAndMimes(l);
525 ++it; 535 ++it;
526 } 536 }
527} 537}
528 538
529void LauncherIconView::hideOrShowItems(bool resort) 539void LauncherIconView::hideOrShowItems(bool resort)
530{ 540{
531 viewport()->setUpdatesEnabled( FALSE ); 541 viewport()->setUpdatesEnabled( FALSE );
532 hidden.setAutoDelete(FALSE); 542 hidden.setAutoDelete(FALSE);
533 QList<AppLnk> links=hidden; 543 QList<AppLnk> links=hidden;
534 hidden.clear(); 544 hidden.clear();
535 hidden.setAutoDelete(TRUE); 545 hidden.setAutoDelete(TRUE);
536 LauncherItem* item = (LauncherItem*)firstItem(); 546 LauncherItem* item = (LauncherItem*)firstItem();
537 while (item) { 547 while (item) {
538 links.append(item->takeAppLnk()); 548 links.append(item->takeAppLnk());
539 item = (LauncherItem*)item->nextItem(); 549 item = (LauncherItem*)item->nextItem();
540 } 550 }
541 clear(); 551 clear();
542 QListIterator<AppLnk> it(links); 552 QListIterator<AppLnk> it(links);
543 AppLnk* l; 553 AppLnk* l;
544 while ((l=it.current())) { 554 while ((l=it.current())) {
545 addItem(l,FALSE); 555 addItem(l,FALSE);
546 ++it; 556 ++it;
547 } 557 }
548 if ( resort && !autoArrange() ) 558 if ( resort && !autoArrange() )
549 sort(); 559 sort();
550 viewport()->setUpdatesEnabled( TRUE ); 560 viewport()->setUpdatesEnabled( TRUE );
551} 561}
552 562
553bool LauncherIconView::removeLink(const QString& linkfile,bool removeCache) 563bool LauncherIconView::removeLink(const QString& linkfile,bool removeCache)
554{ 564{
555 LauncherItem* item = (LauncherItem*)firstItem(); 565 LauncherItem* item = (LauncherItem*)firstItem();
556 AppLnk* l; 566 AppLnk* l;
557 bool did = FALSE; 567 bool did = FALSE;
558 DocLnk dl(linkfile); 568 DocLnk dl(linkfile);
559 while (item) { 569 while (item) {
560 l = item->appLnk(); 570 l = item->appLnk();
561 LauncherItem *nextItem = (LauncherItem *)item->nextItem(); 571 LauncherItem *nextItem = (LauncherItem *)item->nextItem();
562 if ( l->linkFileKnown() && l->linkFile() == linkfile || l->fileKnown() && 572 if ( l->linkFileKnown() && l->linkFile() == linkfile || l->fileKnown() &&
563 ( l->file() == linkfile || dl.isValid() && dl.file() == l->file() ) ) { 573 ( l->file() == linkfile || dl.isValid() && dl.file() == l->file() ) ) {
564 if (removeCache) sm_EyeCache->remove(l->file()); 574 if (removeCache) sm_EyeCache->remove(l->file());
565 delete item; 575 delete item;
566 did = TRUE; 576 did = TRUE;
567 } 577 }
568 item = nextItem; 578 item = nextItem;
569 } 579 }
570 QListIterator<AppLnk> it(hidden); 580 QListIterator<AppLnk> it(hidden);
571 while ((l=it.current())) { 581 while ((l=it.current())) {
572 ++it; 582 ++it;
573 if ( l->linkFileKnown() && l->linkFile() == linkfile 583 if ( l->linkFileKnown() && l->linkFile() == linkfile
574 || l->file() == linkfile 584 || l->file() == linkfile
575 || dl.isValid() && dl.file() == l->file() ) { 585 || dl.isValid() && dl.file() == l->file() ) {
576 hidden.removeRef(l); 586 hidden.removeRef(l);
577 did = TRUE; 587 did = TRUE;
578 } 588 }
579 } 589 }
580 return did; 590 return did;
581} 591}
582 592
583void LauncherIconView::addItem(AppLnk* app, bool resort) 593void LauncherIconView::addItem(AppLnk* app, bool resort)
584{ 594{
585 addCatsAndMimes(app); 595 addCatsAndMimes(app);
586 if ( (tf.isEmpty() || tf.match(app->type()) >= 0) 596 if ( (tf.isEmpty() || tf.match(app->type()) >= 0)
587 && (cf == 0 || app->categories().contains(cf) 597 && (cf == 0 || app->categories().contains(cf)
588 || cf == -1 && app->categories().count() == 0 ) ) { 598 || cf == -1 && app->categories().count() == 0 ) ) {
589 addCheckItem(app); 599 addCheckItem(app);
590 } else { 600 } else {
591 hidden.append(app); 601 hidden.append(app);
592 } 602 }
593 if ( resort ){ 603 if ( resort ){
594 sort(); 604 sort();
595 } 605 }
596} 606}
597 607
598void LauncherIconView::changeItem(const AppLnk&old,AppLnk*nlink) 608void LauncherIconView::changeItem(const AppLnk&old,AppLnk*nlink)
599{ 609{
600 QString oldfile = old.file(); 610 QString oldfile = old.file();
601 QString newfile = nlink->file(); 611 QString newfile = nlink->file();
602 612
603 if (newfile != oldfile) { 613 if (newfile != oldfile) {
604 QMap<QString,QPixmap>::Iterator it = sm_EyeCache->find(oldfile); 614 QMap<QString,QPixmap>::Iterator it = sm_EyeCache->find(oldfile);
605 if (it != sm_EyeCache->end()) { 615 if (it != sm_EyeCache->end()) {
606 (*sm_EyeCache)[newfile]=(*it); 616 (*sm_EyeCache)[newfile]=(*it);
607 } 617 }
608 removeLink(old.linkFile()); 618 removeLink(old.linkFile());
609 } else { 619 } else {
610 removeLink(old.linkFile(),false); 620 removeLink(old.linkFile(),false);
611 } 621 }
612 addItem(nlink,false); 622 addItem(nlink,false);
613} 623}
614 624
615void LauncherIconView::timerEvent( QTimerEvent *te ) 625void LauncherIconView::timerEvent( QTimerEvent *te )
616{ 626{
617 if ( te->timerId() == busyTimer ) { 627 if ( te->timerId() == busyTimer ) {
618 if ( bsy ) 628 if ( bsy )
619 bsy->animateIcon(); 629 bsy->animateIcon();
620 } else { 630 } else {
621 QIconView::timerEvent( te ); 631 QIconView::timerEvent( te );
622 } 632 }
623} 633}
624 634
625void LauncherIconView::setBigIcons( bool bi ) 635void LauncherIconView::setBigIcons( bool bi )
626{ 636{
627 sm_EyeCache->clear(); 637 sm_EyeCache->clear();
628 bigIcns = bi; 638 bigIcns = bi;
629#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 639#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
630 busyPix.resize(0,0); 640 busyPix.resize(0,0);
631#endif 641#endif
632} 642}
633 643
634QIconViewItem* LauncherIconView::busyItem() const 644QIconViewItem* LauncherIconView::busyItem() const
635{ 645{
636 return bsy; 646 return bsy;
637} 647}
638 648
639void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } 649void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; }
640 650
641void LauncherIconView::calculateGrid( ItemTextPos pos ) 651void LauncherIconView::calculateGrid( ItemTextPos pos )
642{ 652{
643 int dw = QApplication::desktop()->width(); 653 int dw = QApplication::desktop()->width();
644 int viewerWidth = dw-style().scrollBarExtent().width(); 654 int viewerWidth = dw-style().scrollBarExtent().width();
645 if ( pos == Bottom ) { 655 if ( pos == Bottom ) {
646 if( !numColumns ) { 656 if( !numColumns ) {
647 if ( viewerWidth <= 200 ) numColumns = 2; 657 if ( viewerWidth <= 200 ) numColumns = 2;
648 else if ( viewerWidth >= 400 ) numColumns = viewerWidth/96; 658 else if ( viewerWidth >= 400 ) numColumns = viewerWidth/96;
649 else numColumns = 3; 659 else numColumns = 3;
650 } 660 }
651 setSpacing( 4 ); 661 setSpacing( 4 );
652 setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns ); 662 setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns );
653 setGridY( fontMetrics().height()*2+24 ); 663 setGridY( fontMetrics().height()*2+24 );
654 } else { 664 } else {
655 if( !numColumns ) { 665 if( !numColumns ) {
656 if ( viewerWidth < 150 ) numColumns = 1; 666 if ( viewerWidth < 150 ) numColumns = 1;
657 else if ( viewerWidth >= 400 ) numColumns = viewerWidth/150; 667 else if ( viewerWidth >= 400 ) numColumns = viewerWidth/150;
658 else numColumns = 2; 668 else numColumns = 2;
659 } 669 }
660 setSpacing( 2 ); 670 setSpacing( 2 );
661 setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns ); 671 setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns );
662 setGridY( fontMetrics().height()+2 ); 672 setGridY( fontMetrics().height()+2 );
663 } 673 }
664} 674}
665 675
666void LauncherIconView::styleChange( QStyle &old ) 676void LauncherIconView::styleChange( QStyle &old )
667{ 677{
668 QIconView::styleChange( old ); 678 QIconView::styleChange( old );
669 calculateGrid( itemTextPos() ); 679 calculateGrid( itemTextPos() );
670} 680}
671 681
672void LauncherIconView::keyPressEvent(QKeyEvent* e) 682void LauncherIconView::keyPressEvent(QKeyEvent* e)
673{ 683{
674 ike = TRUE; 684 ike = TRUE;
675 if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) { 685 if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) {
676 if ( (e->state() & ShiftButton) ) 686 if ( (e->state() & ShiftButton) )
677 emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() ); 687 emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() );
678 else 688 else
679 returnPressed(currentItem()); 689 returnPressed(currentItem());
680 } 690 }
681 691
682 QIconView::keyPressEvent(e); 692 QIconView::keyPressEvent(e);
683 ike = FALSE; 693 ike = FALSE;
684} 694}
685 695
686//=========================================================================== 696//===========================================================================
687// Implemantation of LauncherIconview end 697// Implemantation of LauncherIconview end
688//=========================================================================== 698//===========================================================================
689 699
690 700
691//=========================================================================== 701//===========================================================================
692LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) 702LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl )
693 : QVBox( parent, name, fl ) 703 : QVBox( parent, name, fl )
694{ 704{
695 catmb = 0; 705 catmb = 0;
696 icons = new LauncherIconView( this ); 706 icons = new LauncherIconView( this );
697 setFocusProxy(icons); 707 setFocusProxy(icons);
698 QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold ); 708 QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold );
699 709
700 icons->setItemsMovable( FALSE ); 710 icons->setItemsMovable( FALSE );
701 icons->setAutoArrange( TRUE ); 711 icons->setAutoArrange( TRUE );
702 icons->setSorting( TRUE ); 712 icons->setSorting( TRUE );
703 icons->setFrameStyle( QFrame::NoFrame ); 713 icons->setFrameStyle( QFrame::NoFrame );
704 icons->setMargin( 0 ); 714 icons->setMargin( 0 );
705 icons->setSelectionMode( QIconView::NoSelection ); 715 icons->setSelectionMode( QIconView::NoSelection );
706 icons->setBackgroundMode( PaletteBase ); 716 icons->setBackgroundMode( PaletteBase );
707 icons->setResizeMode( QIconView::Adjust ); 717 icons->setResizeMode( QIconView::Adjust );
708 vmode = (ViewMode)-1; 718 vmode = (ViewMode)-1;
709 setViewMode( Icon ); 719 setViewMode( Icon );
710 720
711 connect( icons, SIGNAL(mouseButtonClicked(int,QIconViewItem*,const QPoint&)), 721 connect( icons, SIGNAL(mouseButtonClicked(int,QIconViewItem*,const QPoint&)),
712 SLOT(itemClicked(int,QIconViewItem*)) ); 722 SLOT(itemClicked(int,QIconViewItem*)) );
713 connect( icons, SIGNAL(selectionChanged()), 723 connect( icons, SIGNAL(selectionChanged()),
714 SLOT(selectionChanged()) ); 724 SLOT(selectionChanged()) );
715 connect( icons, SIGNAL(returnPressed(QIconViewItem*)), 725 connect( icons, SIGNAL(returnPressed(QIconViewItem*)),
716 SLOT(returnPressed(QIconViewItem*)) ); 726 SLOT(returnPressed(QIconViewItem*)) );
717 connect( icons, SIGNAL(mouseButtonPressed(int,QIconViewItem*,const QPoint&)), 727 connect( icons, SIGNAL(mouseButtonPressed(int,QIconViewItem*,const QPoint&)),
718 SLOT(itemPressed(int,QIconViewItem*)) ); 728 SLOT(itemPressed(int,QIconViewItem*)) );
719 729
720 tools = 0; 730 tools = 0;
721 setBackgroundType( Ruled, QString::null ); 731 setBackgroundType( Ruled, QString::null );
722} 732}
723 733
724LauncherView::~LauncherView() 734LauncherView::~LauncherView()
725{ 735{
726 if ( bgCache && bgCache->contains( bgName ) ) 736 if ( bgCache && bgCache->contains( bgName ) )
727 (*bgCache)[bgName]->ref--; 737 (*bgCache)[bgName]->ref--;
728} 738}
729 739
730 740
731bool LauncherView::bsy=FALSE; 741bool LauncherView::bsy=FALSE;
732 742
733void LauncherView::setBusy(bool on) 743void LauncherView::setBusy(bool on)
734{ 744{
735 icons->setBusy(on); 745 icons->setBusy(on);
736} 746}
737 747
738void LauncherView::setBusyIndicatorType( const QString& type ) { 748void LauncherView::setBusyIndicatorType( const QString& type ) {
739 if ( type. lower ( ) == "animated" ) 749 if ( type. lower ( ) == "animated" )
740 icons->setBusyIndicatorType( BIT_Animated ) ; 750 icons->setBusyIndicatorType( BIT_Animated ) ;
741 else 751 else
742 icons->setBusyIndicatorType( BIT_Normal ) ; 752 icons->setBusyIndicatorType( BIT_Normal ) ;
743} 753}
744 754
745void LauncherView::hideIcons() 755void LauncherView::hideIcons()
746{ 756{
747 icons->hide(); 757 icons->hide();
748} 758}
749 759
750void LauncherView::setToolsEnabled(bool y) 760void LauncherView::setToolsEnabled(bool y)
751{ 761{
752 if ( !y != !tools ) { 762 if ( !y != !tools ) {
753 if ( y ) { 763 if ( y ) {
754 tools = new QHBox(this); 764 tools = new QHBox(this);
755 // Type filter 765 // Type filter
756 typemb = new QComboBox(tools); 766 typemb = new QComboBox(tools);
757 QSizePolicy p = typemb->sizePolicy(); 767 QSizePolicy p = typemb->sizePolicy();
758 p.setHorData(QSizePolicy::Expanding); 768 p.setHorData(QSizePolicy::Expanding);
759 typemb->setSizePolicy(p); 769 typemb->setSizePolicy(p);
760 // Category filter 770 // Category filter
761 updateTools(); 771 updateTools();
762 tools->show(); 772 tools->show();
763 } else { 773 } else {
764 delete tools; 774 delete tools;
765 tools = 0; 775 tools = 0;
766 } 776 }
767 } 777 }
768} 778}
769 779
770void LauncherView::updateTools() 780void LauncherView::updateTools()
771{ 781{
772 disconnect( typemb, SIGNAL(activated(int)), 782 disconnect( typemb, SIGNAL(activated(int)),
773 this, SLOT(showType(int)) ); 783 this, SLOT(showType(int)) );
774 if ( catmb ) { 784 if ( catmb ) {
775 disconnect( catmb, SIGNAL(signalSelected(int)),this,SLOT(showCategory(int))); 785 disconnect( catmb, SIGNAL(signalSelected(int)),this,SLOT(showCategory(int)));
776 } 786 }
777 787
778 // ### I want to remove this 788 // ### I want to remove this
779 icons->updateCategoriesAndMimeTypes(); 789 icons->updateCategoriesAndMimeTypes();
780 790
781 QString prev; 791 QString prev;
782 792
783 // Type filter 793 // Type filter
784 QStringList types; 794 QStringList types;
785 typelist = icons->mimeTypes(); 795 typelist = icons->mimeTypes();
786 for (QStringList::ConstIterator it = typelist.begin(); it!=typelist.end(); ++it) { 796 for (QStringList::ConstIterator it = typelist.begin(); it!=typelist.end(); ++it) {
787 QString t = *it; 797 QString t = *it;
788 if ( t.left(12) == "application/" ) { 798 if ( t.left(12) == "application/" ) {
789 MimeType mt(t); 799 MimeType mt(t);
790 const AppLnk* app = mt.application(); 800 const AppLnk* app = mt.application();
791 if ( app ) 801 if ( app )
792 t = app->name(); 802 t = app->name();
793 else 803 else
794 t = t.mid(12); 804 t = t.mid(12);
795 } else { 805 } else {
796 t[0] = t[0].upper(); 806 t[0] = t[0].upper();
797 } 807 }
798 types += t; 808 types += t;
799 } 809 }
800 types << tr("All types"); 810 types << tr("All types");
801 prev = typemb->currentText(); 811 prev = typemb->currentText();
802 typemb->clear(); 812 typemb->clear();
803 typemb->insertStringList(types); 813 typemb->insertStringList(types);
804 for (int i=0; i<typemb->count(); i++) { 814 for (int i=0; i<typemb->count(); i++) {
805 if ( typemb->text(i) == prev ) { 815 if ( typemb->text(i) == prev ) {
806 typemb->setCurrentItem(i); 816 typemb->setCurrentItem(i);
807 break; 817 break;
808 } 818 }
809 } 819 }
810 if ( prev.isNull() ) { 820 if ( prev.isNull() ) {
811 typemb->setCurrentItem(typemb->count()-1); 821 typemb->setCurrentItem(typemb->count()-1);
812 } 822 }
813 823
814 int pcat = catmb ? catmb->currentCategory() : -2; 824 int pcat = catmb ? catmb->currentCategory() : -2;
815 if ( !catmb ) { 825 if ( !catmb ) {
816 catmb = new CategorySelect(tools); 826 catmb = new CategorySelect(tools);
817 } else if (pcat!=-2) { 827 } else if (pcat!=-2) {
818 828
819 } 829 }
820 Categories cats( 0 ); 830 Categories cats( 0 );
821 cats.load( categoryFileName() ); 831 cats.load( categoryFileName() );
822 QArray<int> vl( 0 ); 832 QArray<int> vl( 0 );
823 catmb->setCategories( vl, "Document View", // No tr 833 catmb->setCategories( vl, "Document View", // No tr
824 tr("Document View") ); 834 tr("Document View") );
825 catmb->setRemoveCategoryEdit( TRUE ); 835 catmb->setRemoveCategoryEdit( TRUE );
826 catmb->setAllCategories( TRUE ); 836 catmb->setAllCategories( TRUE );
827 catmb->setCurrentCategory(pcat); 837 catmb->setCurrentCategory(pcat);
828 838
829 // if type has changed we need to redisplay 839 // if type has changed we need to redisplay
830 if ( typemb->currentText() != prev ) 840 if ( typemb->currentText() != prev )
831 showType( typemb->currentItem() ); 841 showType( typemb->currentItem() );
832 842
833 connect(typemb, SIGNAL(activated(int)), this, SLOT(showType(int))); 843 connect(typemb, SIGNAL(activated(int)), this, SLOT(showType(int)));
834 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); 844 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int)));
835} 845}
836 846
837void LauncherView::sortBy(int s) 847void LauncherView::sortBy(int s)
838{ 848{
839 icons->setSortMethod((LauncherIconView::SortMethod)s); 849 icons->setSortMethod((LauncherIconView::SortMethod)s);
840} 850}
841 851
842void LauncherView::showType(int t) 852void LauncherView::showType(int t)
843{ 853{
844 if ( t >= (int)typelist.count() ) { 854 if ( t >= (int)typelist.count() ) {
845 icons->setTypeFilter("",TRUE); 855 icons->setTypeFilter("",TRUE);
846 } else { 856 } else {
847 QString ty = typelist[t]; 857 QString ty = typelist[t];
848 if ( !ty.contains('/') ) 858 if ( !ty.contains('/') )
849 ty += "/*"; 859 ty += "/*";
850 icons->setTypeFilter(ty,TRUE); 860 icons->setTypeFilter(ty,TRUE);
851 } 861 }
852} 862}
853 863
854void LauncherView::showCategory( int c ) 864void LauncherView::showCategory( int c )
855{ 865{
856 icons->setCategoryFilter( c, TRUE ); 866 icons->setCategoryFilter( c, TRUE );
857} 867}
858 868
859void LauncherView::setViewMode( ViewMode m ) 869void LauncherView::setViewMode( ViewMode m )
860{ 870{
861 odebug << "LauncherView::setViewMode( ViewMode m )" << oendl; 871 odebug << "LauncherView::setViewMode( ViewMode m )" << oendl;
862 if ( vmode != m ) { 872 if ( vmode != m ) {
863 bool bigIcons = m == Icon; 873 bool bigIcons = m == Icon;
864 icons->viewport()->setUpdatesEnabled( FALSE ); 874 icons->viewport()->setUpdatesEnabled( FALSE );
865 icons->setBigIcons( bigIcons ); 875 icons->setBigIcons( bigIcons );
866 switch ( m ) { 876 switch ( m ) {
867 case List: 877 case List:
868 icons->setItemTextPos( QIconView::Right ); 878 icons->setItemTextPos( QIconView::Right );
869 break; 879 break;
870 case Icon: 880 case Icon:
871 icons->setItemTextPos( QIconView::Bottom ); 881 icons->setItemTextPos( QIconView::Bottom );
872 break; 882 break;
873 } 883 }
874 icons->hideOrShowItems( FALSE ); 884 icons->hideOrShowItems( FALSE );
875 icons->viewport()->setUpdatesEnabled( TRUE ); 885 icons->viewport()->setUpdatesEnabled( TRUE );
876 vmode = m; 886 vmode = m;
877 } 887 }
878} 888}
879 889
880// 890//
881// User images may require scaling. 891// User images may require scaling.
882// 892//
883QImage LauncherView::loadBackgroundImage(QString &bgName) 893QImage LauncherView::loadBackgroundImage(QString &bgName)
884{ 894{
885 QImageIO imgio; 895 QImageIO imgio;
886 QSize ds = qApp->desktop()->size(); // should be launcher, not desktop 896 QSize ds = qApp->desktop()->size(); // should be launcher, not desktop
887 bool further_scaling = TRUE; 897 bool further_scaling = TRUE;
888 898
889 imgio.setFileName( bgName ); 899 imgio.setFileName( bgName );
890 imgio.setParameters("GetHeaderInformation"); 900 imgio.setParameters("GetHeaderInformation");
891 901
892 if (imgio.read() == FALSE) { 902 if (imgio.read() == FALSE) {
893 return imgio.image(); 903 return imgio.image();
894 } 904 }
895 905
896 if (imgio.image().width() < ds.width() && 906 if (imgio.image().width() < ds.width() &&
897 imgio.image().height() < ds.height()) { 907 imgio.image().height() < ds.height()) {
898 further_scaling = FALSE; 908 further_scaling = FALSE;
899 } 909 }
900 910
901 if (!imgio.image().bits()) { 911 if (!imgio.image().bits()) {
902 // 912 //
903 // Scale and load. Note we don't scale up. 913 // Scale and load. Note we don't scale up.
904 // 914 //
905 QString param( "Scale( %1, %2, ScaleMin )" ); // No tr 915 QString param( "Scale( %1, %2, ScaleMin )" ); // No tr
906 imgio.setParameters(further_scaling ? 916 imgio.setParameters(further_scaling ?
907 param.arg(ds.width()).arg(ds.height()).latin1() : 917 param.arg(ds.width()).arg(ds.height()).latin1() :
908 ""); 918 "");
909 imgio.read(); 919 imgio.read();
910 } else { 920 } else {
911 if (further_scaling) { 921 if (further_scaling) {
912 int t1 = imgio.image().width() * ds.height(); 922 int t1 = imgio.image().width() * ds.height();
913 int t2 = imgio.image().height() * ds.width(); 923 int t2 = imgio.image().height() * ds.width();
914 int dsth = ds.height(); 924 int dsth = ds.height();
915 int dstw = ds.width(); 925 int dstw = ds.width();
916 926
917 if (t1 > t2) { 927 if (t1 > t2) {
918 dsth = t2 / imgio.image().width(); 928 dsth = t2 / imgio.image().width();
919 } else { 929 } else {
920 dstw = t1 / imgio.image().height(); 930 dstw = t1 / imgio.image().height();
921 } 931 }
922 932
923 // 933 //
924 // Loader didn't scale for us. Do it manually. 934 // Loader didn't scale for us. Do it manually.
925 // 935 //
926 return imgio.image().smoothScale(dstw, dsth); 936 return imgio.image().smoothScale(dstw, dsth);
927 } 937 }
928 } 938 }
929 939
930 return imgio.image(); 940 return imgio.image();
931} 941}
932 942
933void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) 943void LauncherView::setBackgroundType( BackgroundType t, const QString &val )
934{ 944{
935 if ( !bgCache ) { 945 if ( !bgCache ) {
936 bgCache = new QMap<QString,BgPixmap*>; 946 bgCache = new QMap<QString,BgPixmap*>;
937 qAddPostRoutine( cleanup_cache ); 947 qAddPostRoutine( cleanup_cache );
938 } 948 }
939 949
940 if ( bgCache->contains( bgName ) ) 950 if ( bgCache->contains( bgName ) )
941 (*bgCache)[bgName]->ref--; 951 (*bgCache)[bgName]->ref--;
942 bgName = ""; 952 bgName = "";
943 953
944 QPixmap bg; 954 QPixmap bg;
945 955
946 switch ( t ) { 956 switch ( t ) {
947 case Ruled: { 957 case Ruled: {
948 bgName = QString("Ruled_%1").arg(colorGroup().background().name()); // No tr 958 bgName = QString("Ruled_%1").arg(colorGroup().background().name()); // No tr
949 if ( bgCache->contains( bgName ) ) { 959 if ( bgCache->contains( bgName ) ) {
950 (*bgCache)[bgName]->ref++; 960 (*bgCache)[bgName]->ref++;
951 bg = (*bgCache)[bgName]->pm; 961 bg = (*bgCache)[bgName]->pm;
952 } else { 962 } else {
953 bg.resize( width(), 9 ); 963 bg.resize( width(), 9 );
954 QPainter painter( &bg ); 964 QPainter painter( &bg );
955 for ( int i = 0; i < 3; i++ ) { 965 for ( int i = 0; i < 3; i++ ) {
956 painter.setPen( white ); 966 painter.setPen( white );
957 painter.drawLine( 0, i*3, width()-1, i*3 ); 967 painter.drawLine( 0, i*3, width()-1, i*3 );
958 painter.drawLine( 0, i*3+1, width()-1, i*3+1 ); 968 painter.drawLine( 0, i*3+1, width()-1, i*3+1 );
959 painter.setPen( colorGroup().background().light(105) ); 969 painter.setPen( colorGroup().background().light(105) );
960 painter.drawLine( 0, i*3+2, width()-1, i*3+2 ); 970 painter.drawLine( 0, i*3+2, width()-1, i*3+2 );
961 } 971 }
962 painter.end(); 972 painter.end();
963 bgCache->insert( bgName, new BgPixmap(bg) ); 973 bgCache->insert( bgName, new BgPixmap(bg) );
964 } 974 }
965 break; 975 break;
966 } 976 }
967 977
968 case Image: 978 case Image:
969 if (!val.isEmpty()) { 979 if (!val.isEmpty()) {
970 bgName = val; 980 bgName = val;
971 if ( bgCache->contains( bgName ) ) { 981 if ( bgCache->contains( bgName ) ) {
972 (*bgCache)[bgName]->ref++; 982 (*bgCache)[bgName]->ref++;
973 bg = (*bgCache)[bgName]->pm; 983 bg = (*bgCache)[bgName]->pm;
974 } else { 984 } else {
975 QString imgFile = bgName; 985 QString imgFile = bgName;
976 bool tile = FALSE; 986 bool tile = FALSE;
977 if ( imgFile[0]!='/' || !QFile::exists(imgFile) ) { 987 if ( imgFile[0]!='/' || !QFile::exists(imgFile) ) {
978 imgFile = Resource::findPixmap( imgFile ); 988 imgFile = Resource::findPixmap( imgFile );
979 tile = TRUE; 989 tile = TRUE;
980 } 990 }
981 QImage img = loadBackgroundImage(imgFile); 991 QImage img = loadBackgroundImage(imgFile);
982 992
983 993
984 if ( img.depth() == 1 ) 994 if ( img.depth() == 1 )
985 img = img.convertDepth(8); 995 img = img.convertDepth(8);
986 img.setAlphaBuffer(FALSE); 996 img.setAlphaBuffer(FALSE);
987 bg.convertFromImage(img); 997 bg.convertFromImage(img);
988 bgCache->insert( bgName, new BgPixmap(bg) ); 998 bgCache->insert( bgName, new BgPixmap(bg) );
989 } 999 }
990 } 1000 }
991 break; 1001 break;
992 1002
993 case SolidColor: 1003 case SolidColor:
994 default: 1004 default:
995 break; 1005 break;
996 } 1006 }
997 1007
998 const QObjectList *list = queryList( "QWidget", 0, FALSE ); 1008 const QObjectList *list = queryList( "QWidget", 0, FALSE );
999 QObject *obj; 1009 QObject *obj;
1000 for ( QObjectListIt it( *list ); (obj=it.current()); ++it ) { 1010 for ( QObjectListIt it( *list ); (obj=it.current()); ++it ) {
1001 if ( obj->isWidgetType() ) { 1011 if ( obj->isWidgetType() ) {
1002 QWidget *w = (QWidget*)obj; 1012 QWidget *w = (QWidget*)obj;
1003 w->setBackgroundPixmap( bg ); 1013 w->setBackgroundPixmap( bg );
1004 if ( bgName.isEmpty() ) { 1014 if ( bgName.isEmpty() ) {
1005 // Solid Color 1015 // Solid Color
1006 if ( val.isEmpty() ) 1016 if ( val.isEmpty() )
1007 w->setBackgroundColor( colorGroup().base() ); 1017 w->setBackgroundColor( colorGroup().base() );
1008 else 1018 else
1009 w->setBackgroundColor( val ); 1019 w->setBackgroundColor( val );
1010 } else { 1020 } else {
1011 // Ruled or Image pixmap 1021 // Ruled or Image pixmap
1012 w->setBackgroundOrigin( ParentOrigin ); 1022 w->setBackgroundOrigin( ParentOrigin );
1013 } 1023 }
1014 } 1024 }
1015 } 1025 }
1016 delete list; 1026 delete list;
1017 1027
1018 bgType = t; 1028 bgType = t;
1019 icons->viewport()->update(); 1029 icons->viewport()->update();
1020 1030
1021 QTimer::singleShot( 1000, this, SLOT(flushBgCache()) ); 1031 QTimer::singleShot( 1000, this, SLOT(flushBgCache()) );
1022} 1032}
1023 1033
1024void LauncherView::setColNumber( int num ) 1034void LauncherView::setColNumber( int num )
1025{ 1035{
1026 icons->setColNumber( num ); 1036 icons->setColNumber( num );
1027} 1037}
1028 1038
1029void LauncherIconView::setColNumber( int num ) 1039void LauncherIconView::setColNumber( int num )
1030{ 1040{
1031 numColumns = num; 1041 numColumns = num;
1032 calculateGrid( Bottom ); 1042 calculateGrid( Bottom );
1033} 1043}
1034 1044
1035void LauncherView::setTextColor( const QColor &tc ) 1045void LauncherView::setTextColor( const QColor &tc )
1036{ 1046{
1037 textCol = tc; 1047 textCol = tc;
1038 QColorGroup cg = icons->colorGroup(); 1048 QColorGroup cg = icons->colorGroup();
1039 cg.setColor( QColorGroup::Text, tc ); 1049 cg.setColor( QColorGroup::Text, tc );
1040 icons->setPalette( QPalette(cg,cg,cg) ); 1050 icons->setPalette( QPalette(cg,cg,cg) );
1041 icons->viewport()->update(); 1051 icons->viewport()->update();
1042} 1052}
1043 1053
1044void LauncherView::setViewFont( const QFont &f ) 1054void LauncherView::setViewFont( const QFont &f )
1045{ 1055{
1046 icons->setFont( f ); 1056 icons->setFont( f );
1047 icons->hideOrShowItems( FALSE ); 1057 icons->hideOrShowItems( FALSE );
1048} 1058}
1049 1059
1050void LauncherView::clearViewFont() 1060void LauncherView::clearViewFont()
1051{ 1061{
1052 icons->unsetFont(); 1062 icons->unsetFont();
1053 icons->hideOrShowItems( FALSE ); 1063 icons->hideOrShowItems( FALSE );
1054} 1064}
1055 1065
1056void LauncherView::resizeEvent(QResizeEvent *e) 1066void LauncherView::resizeEvent(QResizeEvent *e)
1057{ 1067{
1058// qDebug("LauncherView resize event"); 1068// qDebug("LauncherView resize event");
1059 QVBox::resizeEvent( e ); 1069 QVBox::resizeEvent( e );
1060// commented out for launcherview and qt/e 2.3.8 problems, probably needs real fixing somewhere... 1070// commented out for launcherview and qt/e 2.3.8 problems, probably needs real fixing somewhere...
1061// if ( e->size().width() != e->oldSize().width() ) 1071// if ( e->size().width() != e->oldSize().width() )
1062 sort(); 1072 sort();
1063} 1073}
1064 1074
1065void LauncherView::selectionChanged() 1075void LauncherView::selectionChanged()
1066{ 1076{
1067 QIconViewItem* item = icons->currentItem(); 1077 QIconViewItem* item = icons->currentItem();
1068 if ( item && item->isSelected() ) { 1078 if ( item && item->isSelected() ) {
1069 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 1079 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
1070 if ( icons->inKeyEvent() ) // not for mouse press 1080 if ( icons->inKeyEvent() ) // not for mouse press
1071 emit clicked( appLnk ); 1081 emit clicked( appLnk );
1072 item->setSelected(FALSE); 1082 item->setSelected(FALSE);
1073 } 1083 }
1074} 1084}
1075 1085
1076void LauncherView::returnPressed( QIconViewItem *item ) 1086void LauncherView::returnPressed( QIconViewItem *item )
1077{ 1087{
1078 if ( item ) { 1088 if ( item ) {
1079 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 1089 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
1080 emit clicked( appLnk ); 1090 emit clicked( appLnk );
1081 } 1091 }
1082} 1092}
1083 1093
1084void LauncherView::itemClicked( int btn, QIconViewItem *item ) 1094void LauncherView::itemClicked( int btn, QIconViewItem *item )
1085{ 1095{
1086 if ( item ) { 1096 if ( item ) {
1087 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 1097 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
1088 if ( btn == LeftButton ) { 1098 if ( btn == LeftButton ) {
1089 // Make sure it's the item we execute that gets highlighted 1099 // Make sure it's the item we execute that gets highlighted
1090 icons->setCurrentItem( item ); 1100 icons->setCurrentItem( item );
1091 emit clicked( appLnk ); 1101 emit clicked( appLnk );
1092 } 1102 }
1093 item->setSelected(FALSE); 1103 item->setSelected(FALSE);
1094 } 1104 }
1095} 1105}
1096 1106
1097void LauncherView::itemPressed( int btn, QIconViewItem *item ) 1107void LauncherView::itemPressed( int btn, QIconViewItem *item )
1098{ 1108{
1099 if ( item ) { 1109 if ( item ) {
1100 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 1110 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
1101 if ( btn == RightButton ) 1111 if ( btn == RightButton )
1102 emit rightPressed( appLnk ); 1112 emit rightPressed( appLnk );
1103 else if ( btn == ShiftButton ) 1113 else if ( btn == ShiftButton )
1104 emit rightPressed( appLnk ); 1114 emit rightPressed( appLnk );
1105 item->setSelected(FALSE); 1115 item->setSelected(FALSE);
1106 } 1116 }
1107} 1117}
1108 1118
1109void LauncherView::removeAllItems() 1119void LauncherView::removeAllItems()
1110{ 1120{
1111 odebug << "LauncherView::removeAllItems()" << oendl; 1121 odebug << "LauncherView::removeAllItems()" << oendl;
1112 if (LauncherIconView::sm_EyeCache) LauncherIconView::sm_EyeCache->clear(); 1122 if (LauncherIconView::sm_EyeCache) LauncherIconView::sm_EyeCache->clear();
1113 icons->clear(); 1123 icons->clear();
1114} 1124}
1115 1125
1116bool LauncherView::removeLink(const QString& linkfile) 1126bool LauncherView::removeLink(const QString& linkfile)
1117{ 1127{
1118 return icons->removeLink(linkfile); 1128 return icons->removeLink(linkfile);
1119} 1129}
1120 1130
1121void LauncherView::addItem(AppLnk* app, bool resort) 1131void LauncherView::addItem(AppLnk* app, bool resort)
1122{ 1132{
1123 icons->addItem(app,resort); 1133 icons->addItem(app,resort);
1124} 1134}
1125 1135
1126void LauncherView::changeItem(const AppLnk&old,AppLnk*nlink) 1136void LauncherView::changeItem(const AppLnk&old,AppLnk*nlink)
1127{ 1137{
1128 icons->changeItem(old,nlink); 1138 icons->changeItem(old,nlink);
1129} 1139}
1130 1140
1131void LauncherView::setSortEnabled( bool v ) 1141void LauncherView::setSortEnabled( bool v )
1132{ 1142{
1133 icons->setSorting( v ); 1143 icons->setSorting( v );
1134 if ( v ) 1144 if ( v )
1135 sort(); 1145 sort();
1136} 1146}
1137 1147
1138void LauncherView::setUpdatesEnabled( bool u ) 1148void LauncherView::setUpdatesEnabled( bool u )
1139{ 1149{
1140 icons->setUpdatesEnabled( u ); 1150 icons->setUpdatesEnabled( u );
1141} 1151}
1142 1152
1143void LauncherView::sort() 1153void LauncherView::sort()
1144{ 1154{
1145 icons->sort(); 1155 icons->sort();
1146} 1156}
1147 1157
1148void LauncherView::paletteChange( const QPalette &p ) 1158void LauncherView::paletteChange( const QPalette &p )
1149{ 1159{
1150 icons->unsetPalette(); 1160 icons->unsetPalette();
1151 QVBox::paletteChange( p ); 1161 QVBox::paletteChange( p );
1152 if ( bgType == Ruled ) 1162 if ( bgType == Ruled )
1153 setBackgroundType( Ruled, QString::null ); 1163 setBackgroundType( Ruled, QString::null );
1154 QColorGroup cg = icons->colorGroup(); 1164 QColorGroup cg = icons->colorGroup();
1155 cg.setColor( QColorGroup::Text, textCol ); 1165 cg.setColor( QColorGroup::Text, textCol );
1156 icons->setPalette( QPalette(cg,cg,cg) ); 1166 icons->setPalette( QPalette(cg,cg,cg) );
1157} 1167}
1158 1168
1159void LauncherView::fontChanged(const QFont&) 1169void LauncherView::fontChanged(const QFont&)
1160{ 1170{
1161 odebug << "LauncherView::fontChanged()" << oendl; 1171 odebug << "LauncherView::fontChanged()" << oendl;
1162 icons->hideOrShowItems( FALSE ); 1172 icons->hideOrShowItems( FALSE );
1163} 1173}
1164 1174
1165void LauncherView::relayout(void) 1175void LauncherView::relayout(void)
1166{ 1176{
1167 icons->hideOrShowItems(FALSE); 1177 icons->hideOrShowItems(FALSE);
1168} 1178}
1169 1179
1170void LauncherView::flushBgCache() 1180void LauncherView::flushBgCache()
1171{ 1181{
1172 if ( !bgCache ) 1182 if ( !bgCache )
1173 return; 1183 return;
1174 // remove unreferenced backgrounds. 1184 // remove unreferenced backgrounds.
1175 QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); 1185 QMap<QString,BgPixmap*>::Iterator it = bgCache->begin();
1176 while ( it != bgCache->end() ) { 1186 while ( it != bgCache->end() ) {
1177 QMap<QString,BgPixmap*>::Iterator curr = it; 1187 QMap<QString,BgPixmap*>::Iterator curr = it;
1178 ++it; 1188 ++it;
1179 if ( (*curr)->ref == 0 ) { 1189 if ( (*curr)->ref == 0 ) {
1180 delete (*curr); 1190 delete (*curr);
1181 bgCache->remove( curr ); 1191 bgCache->remove( curr );
1182 } 1192 }
1183 } 1193 }
1184} 1194}
1185 1195
1186/* 1196/*
1187 * Launcherthumbnail handling for image files 1197 * Launcherthumbnail handling for image files
1188 */ 1198 */
1189 1199
1190/* special image handling - based on opie eye */ 1200/* special image handling - based on opie eye */
1191QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { 1201QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) {
1192 s >> inf.file >> inf.pixmap >> inf.width >> inf.height; 1202 s >> inf.file >> inf.pixmap >> inf.width >> inf.height;
1193 return s; 1203 return s;
1194} 1204}
1195 1205
1196QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { 1206QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) {
1197 return s << inf.file << inf.width << inf.height; 1207 return s << inf.file << inf.width << inf.height;
1198} 1208}
1199 1209
1200LauncherThumbReceiver::LauncherThumbReceiver() 1210LauncherThumbReceiver::LauncherThumbReceiver()
1201 :QObject() 1211 :QObject()
1202{ 1212{
1203 QCopChannel * chan = new QCopChannel( "QPE/opie-eye",this ); 1213 QCopChannel * chan = new QCopChannel( "QPE/opie-eye",this );
1204 connect(chan, SIGNAL(received(const QCString&,const QByteArray&)), 1214 connect(chan, SIGNAL(received(const QCString&,const QByteArray&)),
1205 this, SLOT(recieve(const QCString&,const QByteArray&)) ); 1215 this, SLOT(recieve(const QCString&,const QByteArray&)) );
1206 1216
1207 { 1217 {
1208 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); 1218 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
1209 } 1219 }
1210} 1220}
1211 1221
1212LauncherThumbReceiver::~LauncherThumbReceiver() 1222LauncherThumbReceiver::~LauncherThumbReceiver()
1213{ 1223{
1214 { 1224 {
1215 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); 1225 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
1216 } 1226 }
1217} 1227}
1218 1228
1219void LauncherThumbReceiver::recieve( const QCString&str, const QByteArray&at ) 1229void LauncherThumbReceiver::recieve( const QCString&str, const QByteArray&at )
1220{ 1230{
1221 PixmapInfos pixinfos; 1231 PixmapInfos pixinfos;
1222 QDataStream stream( at, IO_ReadOnly ); 1232 QDataStream stream( at, IO_ReadOnly );
1223 1233
1224 /* we are just interested in thumbmails */ 1234 /* we are just interested in thumbmails */
1225 if ( str == "pixmapsHandled(PixmapList)" ) 1235 if ( str == "pixmapsHandled(PixmapList)" )
1226 stream >> pixinfos; 1236 stream >> pixinfos;
1227 1237
1228 for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) { 1238 for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) {
1229 emit sig_Thumbnail((*it).pixmap,(*it).file,(*it).width); 1239 emit sig_Thumbnail((*it).pixmap,(*it).file,(*it).width);
1230 } 1240 }
1231} 1241}
1232 1242
1233void LauncherThumbReceiver::requestThumb(const QString&file,int width,int height) 1243void LauncherThumbReceiver::requestThumb(const QString&file,int width,int height)
1234{ 1244{
1235 PixmapInfo rItem; 1245 PixmapInfo rItem;
1236 rItem.file = file; 1246 rItem.file = file;
1237 rItem.width = width; 1247 rItem.width = width;
1238 rItem.height = height; 1248 rItem.height = height;
1239 m_inThumbNail.append(rItem); 1249 m_inThumbNail.append(rItem);
1240 QTimer::singleShot(2, this, SLOT(sendRequest())); 1250 QTimer::singleShot(2, this, SLOT(sendRequest()));
1241} 1251}
1242 1252
1243void LauncherThumbReceiver::sendRequest() 1253void LauncherThumbReceiver::sendRequest()
1244{ 1254{
1245 if (m_inThumbNail.count()>0) { 1255 if (m_inThumbNail.count()>0) {
1246 QCopEnvelope env("QPE/opie-eye_slave", "pixmapInfos(PixmapInfos)" ); 1256 QCopEnvelope env("QPE/opie-eye_slave", "pixmapInfos(PixmapInfos)" );
1247 env << m_inThumbNail; 1257 env << m_inThumbNail;
1248 m_inThumbNail.clear(); 1258 m_inThumbNail.clear();
1249 } 1259 }
1250} 1260}
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h
index 97b1dea..6a2d197 100644
--- a/core/launcher/launcherview.h
+++ b/core/launcher/launcherview.h
@@ -1,254 +1,255 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef LAUNCHERVIEW_H 20#ifndef LAUNCHERVIEW_H
21#define LAUNCHERVIEW_H 21#define LAUNCHERVIEW_H
22 22
23#include <qtopia/storage.h> 23#include <qtopia/storage.h>
24#include <qtopia/applnk.h> 24#include <qtopia/applnk.h>
25 25
26#include <qvbox.h> 26#include <qvbox.h>
27#include <qiconview.h> 27#include <qiconview.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qmap.h> 29#include <qmap.h>
30 30
31class CategorySelect; 31class CategorySelect;
32class LauncherIconView; 32class LauncherIconView;
33class LauncherItem; 33class LauncherItem;
34class QIconViewItem; 34class QIconViewItem;
35class QLabel; 35class QLabel;
36class QWidgetStack; 36class QWidgetStack;
37class MenuButton; 37class MenuButton;
38class QComboBox; 38class QComboBox;
39 39
40enum BusyIndicatorType { 40enum BusyIndicatorType {
41 BIT_Normal = 0, 41 BIT_Normal = 0,
42 BIT_Animated 42 BIT_Animated
43}; 43};
44 44
45class LauncherView : public QVBox 45class LauncherView : public QVBox
46{ 46{
47 Q_OBJECT 47 Q_OBJECT
48 48
49public: 49public:
50 LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 50 LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
51 ~LauncherView(); 51 ~LauncherView();
52 52
53 void hideIcons(); 53 void hideIcons();
54 54
55 bool removeLink(const QString& linkfile); 55 bool removeLink(const QString& linkfile);
56 void addItem(AppLnk* app, bool resort=TRUE); 56 void addItem(AppLnk* app, bool resort=TRUE);
57 void changeItem(const AppLnk&old,AppLnk*nlink); 57 void changeItem(const AppLnk&old,AppLnk*nlink);
58 58
59 void removeAllItems(); 59 void removeAllItems();
60 void setSortEnabled(bool); 60 void setSortEnabled(bool);
61 void setUpdatesEnabled(bool); 61 void setUpdatesEnabled(bool);
62 void sort(); 62 void sort();
63 63
64 void setToolsEnabled(bool); 64 void setToolsEnabled(bool);
65 void updateTools(); 65 void updateTools();
66 66
67 void setBusy(bool); 67 void setBusy(bool);
68 void setBusyIndicatorType( const QString& ); 68 void setBusyIndicatorType( const QString& );
69 69
70 enum ViewMode { Icon, List }; 70 enum ViewMode { Icon, List };
71 void setViewMode( ViewMode m ); 71 void setViewMode( ViewMode m );
72 ViewMode viewMode() const { return vmode; } 72 ViewMode viewMode() const { return vmode; }
73 73
74 enum BackgroundType { Ruled, SolidColor, Image }; 74 enum BackgroundType { Ruled, SolidColor, Image };
75 void setBackgroundType( BackgroundType t, const QString & ); 75 void setBackgroundType( BackgroundType t, const QString & );
76 BackgroundType backgroundType() const { return bgType; } 76 BackgroundType backgroundType() const { return bgType; }
77 77
78 void setTextColor( const QColor & ); 78 void setTextColor( const QColor & );
79 QColor textColor() const { return textCol; } 79 QColor textColor() const { return textCol; }
80 80
81 void setViewFont( const QFont & ); 81 void setViewFont( const QFont & );
82 void clearViewFont(); 82 void clearViewFont();
83 83
84 void setColNumber( int ); 84 void setColNumber( int );
85
86 void relayout(void); 85 void relayout(void);
86 LauncherIconView* iconView() { return icons; };
87 87
88signals: 88signals:
89 void clicked( const AppLnk * ); 89 void clicked( const AppLnk * );
90 void rightPressed( AppLnk * ); 90 void rightPressed( AppLnk * );
91 91
92protected slots: 92protected slots:
93 void selectionChanged(); 93 void selectionChanged();
94 void returnPressed( QIconViewItem *item ); 94 void returnPressed( QIconViewItem *item );
95 void itemClicked( int, QIconViewItem * ); 95 void itemClicked( int, QIconViewItem * );
96 void itemPressed( int, QIconViewItem * ); 96 void itemPressed( int, QIconViewItem * );
97 void sortBy(int); 97 void sortBy(int);
98 void showType(int); 98 void showType(int);
99 void showCategory( int ); 99 void showCategory( int );
100 void resizeEvent(QResizeEvent *); 100 void resizeEvent(QResizeEvent *);
101 void flushBgCache(); 101 void flushBgCache();
102 102
103protected: 103protected:
104 void paletteChange( const QPalette & ); 104 void paletteChange( const QPalette & );
105 105
106 void fontChanged(const QFont &); 106 void fontChanged(const QFont &);
107 107
108private: 108private:
109 static bool bsy; 109 static bool bsy;
110 QWidget* tools; 110 QWidget* tools;
111 LauncherIconView* icons; 111 LauncherIconView* icons;
112 QComboBox *typemb; 112 QComboBox *typemb;
113 QStringList typelist; 113 QStringList typelist;
114 CategorySelect *catmb; 114 CategorySelect *catmb;
115 ViewMode vmode; 115 ViewMode vmode;
116 BackgroundType bgType; 116 BackgroundType bgType;
117 QString bgName; 117 QString bgName;
118 QColor textCol; 118 QColor textCol;
119 119
120 QImage loadBackgroundImage(QString &fname); 120 QImage loadBackgroundImage(QString &fname);
121 121
122}; 122};
123 123
124/* from opie-eye */ 124/* from opie-eye */
125struct PixmapInfo { 125struct PixmapInfo {
126 PixmapInfo() : width( -1 ), height( -1 ) {} 126 PixmapInfo() : width( -1 ), height( -1 ) {}
127 bool operator==( const PixmapInfo& r ) { 127 bool operator==( const PixmapInfo& r ) {
128 if ( width != r.width ) return false; 128 if ( width != r.width ) return false;
129 if ( height != r.height ) return false; 129 if ( height != r.height ) return false;
130 if ( file != r.file ) return false; 130 if ( file != r.file ) return false;
131 return true; 131 return true;
132 } 132 }
133 int width, height; 133 int width, height;
134 QString file; 134 QString file;
135 QPixmap pixmap; 135 QPixmap pixmap;
136}; 136};
137 137
138class LauncherThumbReceiver:public QObject 138class LauncherThumbReceiver:public QObject
139{ 139{
140 Q_OBJECT 140 Q_OBJECT
141 typedef QValueList<PixmapInfo> PixmapInfos; 141 typedef QValueList<PixmapInfo> PixmapInfos;
142public: 142public:
143 LauncherThumbReceiver(); 143 LauncherThumbReceiver();
144 ~LauncherThumbReceiver(); 144 ~LauncherThumbReceiver();
145 void requestThumb(const QString&file,int width,int height); 145 void requestThumb(const QString&file,int width,int height);
146 146
147public slots: 147public slots:
148 void recieve( const QCString&, const QByteArray& ); 148 void recieve( const QCString&, const QByteArray& );
149protected slots: 149protected slots:
150 virtual void sendRequest(); 150 virtual void sendRequest();
151 151
152signals: 152signals:
153 void sig_Thumbnail(const QPixmap&,const QString&,int); 153 void sig_Thumbnail(const QPixmap&,const QString&,int);
154 154
155protected: 155protected:
156 PixmapInfos m_inThumbNail; 156 PixmapInfos m_inThumbNail;
157}; 157};
158 158
159class LauncherIconView : public QIconView { 159class LauncherIconView : public QIconView {
160 Q_OBJECT 160 Q_OBJECT
161public: 161public:
162 LauncherIconView( QWidget* parent, const char* name=0 ); 162 LauncherIconView( QWidget* parent, const char* name=0 );
163 ~LauncherIconView(); 163 ~LauncherIconView();
164 QIconViewItem* busyItem() const; 164 QIconViewItem* busyItem() const;
165 165
166#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 166#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
167 QPixmap busyPixmap() const { return busyPix; } 167 QPixmap busyPixmap() const { return busyPix; }
168#endif 168#endif
169 void setBigIcons( bool bi ); 169 void setBigIcons( bool bi );
170 void updateCategoriesAndMimeTypes(); 170 void updateCategoriesAndMimeTypes();
171 void setBusyIndicatorType ( BusyIndicatorType t ); 171 void setBusyIndicatorType ( BusyIndicatorType t );
172 void setStaticBackgroundPicture( bool enable );
172 void doAutoScroll() 173 void doAutoScroll()
173 { 174 {
174 // We don't want rubberbanding (yet) 175 // We don't want rubberbanding (yet)
175 } 176 }
176 177
177 void setBusy(bool on); 178 void setBusy(bool on);
178 bool inKeyEvent() const { return ike; } 179 bool inKeyEvent() const { return ike; }
179 180
180 void addItem(AppLnk* app, bool resort=TRUE); 181 void addItem(AppLnk* app, bool resort=TRUE);
181 bool removeLink(const QString& linkfile,bool removeCache = true); 182 bool removeLink(const QString& linkfile,bool removeCache = true);
182 void changeItem(const AppLnk&old,AppLnk*nlink); 183 void changeItem(const AppLnk&old,AppLnk*nlink);
183 184
184 QStringList mimeTypes() const; 185 QStringList mimeTypes() const;
185 QStringList categories() const; 186 QStringList categories() const;
186 void clear(); 187 void clear();
187 void addCatsAndMimes(AppLnk* app); 188 void addCatsAndMimes(AppLnk* app);
188 189
189 void setBackgroundOrigin( QWidget::BackgroundOrigin ) {} 190 void setBackgroundOrigin( QWidget::BackgroundOrigin ) {}
190 191
191 void setBackgroundPixmap( const QPixmap &pm ) { 192 void setBackgroundPixmap( const QPixmap &pm ) {
192 bgPixmap = pm; 193 bgPixmap = pm;
193 } 194 }
194 195
195 void setBackgroundColor( const QColor &c ) { 196 void setBackgroundColor( const QColor &c ) {
196 bgColor = c; 197 bgColor = c;
197 } 198 }
198 199
199 void setColNumber( int ); 200 void setColNumber( int );
200 201
201 void drawBackground( QPainter *p, const QRect &r ); 202 void drawBackground( QPainter *p, const QRect &r );
202 void setItemTextPos( ItemTextPos pos ); 203 void setItemTextPos( ItemTextPos pos );
203 void hideOrShowItems(bool resort); 204 void hideOrShowItems(bool resort);
204 205
205 void setTypeFilter(const QString& typefilter, bool resort); 206 void setTypeFilter(const QString& typefilter, bool resort);
206 void setCategoryFilter( int catfilter, bool resort ); 207 void setCategoryFilter( int catfilter, bool resort );
207 208
208 enum SortMethod { Name, Date, Type }; 209 enum SortMethod { Name, Date, Type };
209 210
210 void setSortMethod( SortMethod m ); 211 void setSortMethod( SortMethod m );
211 int compare(const AppLnk* a, const AppLnk* b); 212 int compare(const AppLnk* a, const AppLnk* b);
212 void requestEyePix(const LauncherItem*which); 213 void requestEyePix(const LauncherItem*which);
213 214
214 static QMap<QString,QPixmap>* sm_EyeCache; 215 static QMap<QString,QPixmap>* sm_EyeCache;
215 216
216protected: 217protected:
217 virtual void timerEvent( QTimerEvent *te ); 218 virtual void timerEvent( QTimerEvent *te );
218 void styleChange( QStyle &old ); 219 void styleChange( QStyle &old );
219 void calculateGrid( ItemTextPos pos ); 220 void calculateGrid( ItemTextPos pos );
220 void focusInEvent( QFocusEvent * ) {} 221 void focusInEvent( QFocusEvent * ) {}
221 void focusOutEvent( QFocusEvent * ) {} 222 void focusOutEvent( QFocusEvent * ) {}
222 LauncherItem*findDocItem(const QString&); 223 LauncherItem*findDocItem(const QString&);
223 void addCheckItem(AppLnk* app); 224 void addCheckItem(AppLnk* app);
224 void checkCallback(); 225 void checkCallback();
225 virtual void keyPressEvent(QKeyEvent* e); 226 virtual void keyPressEvent(QKeyEvent* e);
226 227
227protected slots: 228protected slots:
228 void setEyePixmap(const QPixmap&,const QString&,int width); 229 void setEyePixmap(const QPixmap&,const QString&,int width);
229 void stopEyeTimer(); 230 void stopEyeTimer();
230 231
231private: 232private:
232 QList<AppLnk> hidden; 233 QList<AppLnk> hidden;
233 QDict<void> mimes; 234 QDict<void> mimes;
234 QDict<void> cats; 235 QDict<void> cats;
235 SortMethod sortmeth; 236 SortMethod sortmeth;
236 QRegExp tf; 237 QRegExp tf;
237 int cf; 238 int cf;
238 LauncherItem* bsy; 239 LauncherItem* bsy;
239 int busyTimer; 240 int busyTimer;
240 bool ike; 241 bool ike;
241 bool bigIcns; 242 bool bigIcns;
242 QPixmap bgPixmap; 243 QPixmap bgPixmap;
243 QColor bgColor; 244 QColor bgColor;
244 LauncherThumbReceiver*m_EyeCallBack; 245 LauncherThumbReceiver*m_EyeCallBack;
245#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 246#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
246 QPixmap busyPix; 247 QPixmap busyPix;
247#endif 248#endif
248 BusyIndicatorType busyType; 249 BusyIndicatorType busyType;
249 QTimer m_eyeTimer; 250 QTimer m_eyeTimer;
250 int numColumns; 251 int numColumns;
251 bool staticBackground; 252 bool staticBackground;
252}; 253};
253 254
254#endif // LAUNCHERVIEW_H 255#endif // LAUNCHERVIEW_H
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index 42f0568..fca6b20 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -1,330 +1,339 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#include "tabssettings.h" 28#include "tabssettings.h"
29 29
30#include <qpe/resource.h> 30#include <qpe/resource.h>
31#include <qpe/applnk.h> 31#include <qpe/applnk.h>
32#include <qpe/mimetype.h> 32#include <qpe/mimetype.h>
33#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36 36
37#include <qlistbox.h> 37#include <qlistbox.h>
38#include <qpushbutton.h> 38#include <qpushbutton.h>
39#include <qlayout.h> 39#include <qlayout.h>
40#include <qlabel.h> 40#include <qlabel.h>
41#include <qwhatsthis.h> 41#include <qwhatsthis.h>
42#include <qcheckbox.h> 42#include <qcheckbox.h>
43 43
44#include "tabdialog.h" 44#include "tabdialog.h"
45 45
46#include <stdlib.h> 46#include <stdlib.h>
47#include <qmessagebox.h> 47#include <qmessagebox.h>
48 48
49 49
50 #define GLOBALID ".global." 50 #define GLOBALID ".global."
51 51
52 52
53TabsSettings::TabsSettings ( QWidget *parent, const char *name ) 53TabsSettings::TabsSettings ( QWidget *parent, const char *name )
54 : QWidget ( parent, name ) 54 : QWidget ( parent, name )
55{ 55{
56 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); 56 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 );
57 57
58 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); 58 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this );
59 lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); 59 lay-> addMultiCellWidget ( l, 0, 0, 0, 1 );
60 60
61 m_list = new QListBox ( this ); 61 m_list = new QListBox ( this );
62 lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); 62 lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 );
63 63
64 QWhatsThis::add ( m_list, tr( "foobar" )); 64 QWhatsThis::add ( m_list, tr( "foobar" ));
65 65
66 QPushButton *p1, *p2, *p3; 66 QPushButton *p1, *p2, *p3;
67 p1 = new QPushButton ( tr( "New" ), this ); 67 p1 = new QPushButton ( tr( "New" ), this );
68 lay-> addWidget ( p1, 1, 1 ); 68 lay-> addWidget ( p1, 1, 1 );
69 connect ( p1, SIGNAL( clicked()), this, SLOT( newClicked())); 69 connect ( p1, SIGNAL( clicked()), this, SLOT( newClicked()));
70 70
71 p2 = new QPushButton ( tr( "Edit" ), this ); 71 p2 = new QPushButton ( tr( "Edit" ), this );
72 lay-> addWidget ( p2, 2, 1 ); 72 lay-> addWidget ( p2, 2, 1 );
73 connect ( p2, SIGNAL( clicked()), this, SLOT( editClicked())); 73 connect ( p2, SIGNAL( clicked()), this, SLOT( editClicked()));
74 74
75 p3 = new QPushButton ( tr( "Delete" ), this ); 75 p3 = new QPushButton ( tr( "Delete" ), this );
76 lay-> addWidget ( p3, 3, 1 ); 76 lay-> addWidget ( p3, 3, 1 );
77 connect ( p3, SIGNAL( clicked()), this, SLOT( deleteClicked())); 77 connect ( p3, SIGNAL( clicked()), this, SLOT( deleteClicked()));
78 78
79 lay-> setRowStretch ( 4, 10 ); 79 lay-> setRowStretch ( 4, 10 );
80 80
81 m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this ); 81 m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this );
82 lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 ); 82 lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 );
83 83
84 m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this ); 84 m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this );
85 lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 ); 85 lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 );
86
87 m_staticbackground = new QCheckBox( tr( "Enable static background pixmap" ), this );
88 lay->addMultiCellWidget( m_staticbackground, 7, 7, 0, 1 );
86 89
87 p1-> setEnabled ( false ); 90 p1-> setEnabled ( false );
88 p3-> setEnabled ( false ); 91 p3-> setEnabled ( false );
89 92
90 init ( ); 93 init ( );
91 94
92 QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." )); 95 QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." ));
93 QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); 96 QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." ));
94 QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." )); 97 QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." ));
95 QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); 98 QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." ));
96 QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." )); 99 QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." ));
97 QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." )); 100 QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." ));
101 QWhatsThis::add ( m_staticbackground, tr( "Activate this, if you want the background pixmap not to scroll with the icons." ));
98} 102}
99 103
100void TabsSettings::init ( ) 104void TabsSettings::init ( )
101{ 105{
102 AppLnkSet rootFolder( MimeType::appsFolderName ( )); 106 AppLnkSet rootFolder( MimeType::appsFolderName ( ));
103 QStringList types = rootFolder. types ( ); 107 QStringList types = rootFolder. types ( );
104 108
105 m_list-> insertItem ( tr( "All Tabs" )); 109 m_list-> insertItem ( tr( "All Tabs" ));
106 m_ids << GLOBALID; 110 m_ids << GLOBALID;
107 111
108 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { 112 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) {
109 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); 113 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it ));
110 m_ids << *it; 114 m_ids << *it;
111 } 115 }
112 QImage img ( Resource::loadImage ( "DocsIcon" )); 116 QImage img ( Resource::loadImage ( "DocsIcon" ));
113 QPixmap pix; 117 QPixmap pix;
114 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); 118 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( ));
115 m_list-> insertItem ( pix, tr( "Documents" )); 119 m_list-> insertItem ( pix, tr( "Documents" ));
116 m_ids += "Documents"; // No tr 120 m_ids += "Documents"; // No tr
117 121
118 Config cfg ( "Launcher" ); 122 Config cfg ( "Launcher" );
119 123
120 readTabSettings ( cfg ); 124 readTabSettings ( cfg );
121 125
122 cfg. setGroup ( "GUI" ); 126 cfg. setGroup ( "GUI" );
123 m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); 127 m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" );
124 m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); 128 m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) );
129 m_staticbackground->setChecked( cfg.readBoolEntry( "StaticBackground", true ) );
125} 130}
126 131
127 132
128void TabsSettings::readTabSettings ( Config &cfg ) 133void TabsSettings::readTabSettings ( Config &cfg )
129{ 134{
130 QString grp ( "Tab %1" ); // No tr 135 QString grp ( "Tab %1" ); // No tr
131 m_tabs. clear ( ); 136 m_tabs. clear ( );
132 137
133 TabConfig global_def; 138 TabConfig global_def;
134 global_def. m_view = TabConfig::Icon; 139 global_def. m_view = TabConfig::Icon;
135 global_def. m_bg_type = TabConfig::Ruled; 140 global_def. m_bg_type = TabConfig::Ruled;
136 global_def. m_bg_image = "launcher/opie-background"; 141 global_def. m_bg_image = "launcher/opie-background";
137 global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); 142 global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( );
138 global_def. m_iconcolumns = 0; // automatic 143 global_def. m_iconcolumns = 0; // automatic
139 global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); 144 global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( );
140 global_def. m_font_use = false; 145 global_def. m_font_use = false;
141 global_def. m_font_family = font ( ). family ( ); 146 global_def. m_font_family = font ( ). family ( );
142 global_def. m_font_size = font ( ). pointSize ( ); 147 global_def. m_font_size = font ( ). pointSize ( );
143 global_def. m_font_weight = 50; 148 global_def. m_font_weight = 50;
144 global_def. m_font_italic = false; 149 global_def. m_font_italic = false;
145 global_def. m_changed = false; 150 global_def. m_changed = false;
146 151
147 Config cfg2 = Config( "Launchersettings" ); 152 Config cfg2 = Config( "Launchersettings" );
148 153
149 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 154 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
150 TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; 155 TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def;
151 156
152 cfg. setGroup ( grp. arg ( *it )); 157 cfg. setGroup ( grp. arg ( *it ));
153 cfg2. setGroup( grp. arg ( *it )); 158 cfg2. setGroup( grp. arg ( *it ));
154 159
155 QString view = cfg. readEntry ( "View" ); 160 QString view = cfg. readEntry ( "View" );
156 if ( view == "Icon" ) // No tr 161 if ( view == "Icon" ) // No tr
157 tc. m_view = TabConfig::Icon; 162 tc. m_view = TabConfig::Icon;
158 if ( view == "List" ) // No tr 163 if ( view == "List" ) // No tr
159 tc. m_view = TabConfig::List; 164 tc. m_view = TabConfig::List;
160 165
161 QString bgType = cfg. readEntry ( "BackgroundType" ); 166 QString bgType = cfg. readEntry ( "BackgroundType" );
162 if ( bgType == "Image" ) 167 if ( bgType == "Image" )
163 tc. m_bg_type = TabConfig::Image; 168 tc. m_bg_type = TabConfig::Image;
164 else if ( bgType == "SolidColor" ) 169 else if ( bgType == "SolidColor" )
165 tc. m_bg_type = TabConfig::SolidColor; 170 tc. m_bg_type = TabConfig::SolidColor;
166 else if ( bgType == "Image" ) // No tr 171 else if ( bgType == "Image" ) // No tr
167 tc. m_bg_type = TabConfig::Image; 172 tc. m_bg_type = TabConfig::Image;
168 173
169 tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); 174 tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image );
170 tc. m_last_directory = cfg2.readEntry( "DefaultDir", "" ); 175 tc. m_last_directory = cfg2.readEntry( "DefaultDir", "" );
171 tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); 176 tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color );
172 tc. m_iconcolumns = cfg. readNumEntry ( "Columns", tc. m_iconcolumns ); 177 tc. m_iconcolumns = cfg. readNumEntry ( "Columns", tc. m_iconcolumns );
173 qDebug( "m_iconcolumns for %s = %d", (const char*) *it, tc.m_iconcolumns ); 178 qDebug( "m_iconcolumns for %s = %d", (const char*) *it, tc.m_iconcolumns );
174 tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); 179 tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color );
175 QStringList f = cfg. readListEntry ( "Font", ',' ); 180 QStringList f = cfg. readListEntry ( "Font", ',' );
176 if ( f. count ( ) == 4 ) { 181 if ( f. count ( ) == 4 ) {
177 tc. m_font_use = true; 182 tc. m_font_use = true;
178 tc. m_font_family = f [0]; 183 tc. m_font_family = f [0];
179 tc. m_font_size = f [1]. toInt ( ); 184 tc. m_font_size = f [1]. toInt ( );
180 tc. m_font_weight = f [2]. toInt ( ); 185 tc. m_font_weight = f [2]. toInt ( );
181 tc. m_font_italic = ( f [3]. toInt ( )); 186 tc. m_font_italic = ( f [3]. toInt ( ));
182 } 187 }
183 m_tabs [*it] = tc; 188 m_tabs [*it] = tc;
184 } 189 }
185 190
186 // if all tabs have the same config, then initialize the GLOBALID tab to these values 191 // if all tabs have the same config, then initialize the GLOBALID tab to these values
187 192
188 TabConfig *first = 0; 193 TabConfig *first = 0;
189 bool same = true; 194 bool same = true;
190 195
191 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 196 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
192 if ( *it == GLOBALID ) 197 if ( *it == GLOBALID )
193 continue; 198 continue;
194 else if ( !first ) 199 else if ( !first )
195 first = &m_tabs [*it]; 200 first = &m_tabs [*it];
196 else 201 else
197 same &= ( *first == m_tabs [*it] ); 202 same &= ( *first == m_tabs [*it] );
198 } 203 }
199 if ( same ) { 204 if ( same ) {
200 m_tabs [GLOBALID] = *first; 205 m_tabs [GLOBALID] = *first;
201 m_tabs [GLOBALID]. m_changed = true; 206 m_tabs [GLOBALID]. m_changed = true;
202 } 207 }
203} 208}
204 209
205 210
206void TabsSettings::accept ( ) 211void TabsSettings::accept ( )
207{ 212{
208 Config cfg ( "Launcher" ); 213 Config cfg ( "Launcher" );
209 Config cfg2 ( "Launchersettings" ); 214 Config cfg2 ( "Launchersettings" );
210 215
211 // Launcher Tab 216 // Launcher Tab
212 QString grp ( "Tab %1" ); // No tr 217 QString grp ( "Tab %1" ); // No tr
213 218
214 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 219 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
215 TabConfig &tc = m_tabs [*it]; 220 TabConfig &tc = m_tabs [*it];
216 221
217 if ( !tc. m_changed ) 222 if ( !tc. m_changed )
218 continue; 223 continue;
219 224
220 cfg. setGroup ( grp. arg ( *it )); 225 cfg. setGroup ( grp. arg ( *it ));
221 cfg2. setGroup ( grp. arg ( *it )); 226 cfg2. setGroup ( grp. arg ( *it ));
222 switch ( tc. m_view ) { 227 switch ( tc. m_view ) {
223 case TabConfig::Icon: 228 case TabConfig::Icon:
224 cfg.writeEntry ( "View", "Icon" ); 229 cfg.writeEntry ( "View", "Icon" );
225 break; 230 break;
226 case TabConfig::List: 231 case TabConfig::List:
227 cfg.writeEntry ( "View", "List" ); 232 cfg.writeEntry ( "View", "List" );
228 break; 233 break;
229 } 234 }
230 235
231 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); 236 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" );
232 e << *it << tc. m_view; 237 e << *it << tc. m_view;
233 238
234 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); 239 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image );
235 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); 240 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color );
236 cfg. writeEntry ( "Columns", tc. m_iconcolumns ); 241 cfg. writeEntry ( "Columns", tc. m_iconcolumns );
237 cfg. writeEntry ( "TextColor", tc. m_text_color ); 242 cfg. writeEntry ( "TextColor", tc. m_text_color );
238 cfg2. writeEntry ( "DefaultDir", tc.m_last_directory ); 243 cfg2. writeEntry ( "DefaultDir", tc.m_last_directory );
239 244
240 if ( tc. m_font_use ) { 245 if ( tc. m_font_use ) {
241 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); 246 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" );
242 cfg. writeEntry ( "Font", f ); 247 cfg. writeEntry ( "Font", f );
243 } 248 }
244 else 249 else
245 cfg. removeEntry ( "Font" ); 250 cfg. removeEntry ( "Font" );
246 251
247 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); 252 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" );
248 253
249 switch ( tc. m_bg_type ) { 254 switch ( tc. m_bg_type ) {
250 case TabConfig::Ruled: 255 case TabConfig::Ruled:
251 cfg.writeEntry( "BackgroundType", "Ruled" ); 256 cfg.writeEntry( "BackgroundType", "Ruled" );
252 be << *it << tc. m_bg_type << QString(""); 257 be << *it << tc. m_bg_type << QString("");
253 break; 258 break;
254 case TabConfig::SolidColor: 259 case TabConfig::SolidColor:
255 cfg.writeEntry( "BackgroundType", "SolidColor" ); 260 cfg.writeEntry( "BackgroundType", "SolidColor" );
256 be << *it << tc. m_bg_type << tc. m_bg_color; 261 be << *it << tc. m_bg_type << tc. m_bg_color;
257 break; 262 break;
258 case TabConfig::Image: 263 case TabConfig::Image:
259 cfg.writeEntry( "BackgroundType", "Image" ); 264 cfg.writeEntry( "BackgroundType", "Image" );
260 be << *it << tc. m_bg_type << tc. m_bg_image; 265 be << *it << tc. m_bg_type << tc. m_bg_image;
261 break; 266 break;
262 } 267 }
263 268
264 QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); 269 QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" );
265 te << *it << tc. m_text_color; 270 te << *it << tc. m_text_color;
266 271
267 QCopEnvelope ic( "QPE/Launcher", "setIconColumns(QString,int)" ); 272 QCopEnvelope ic( "QPE/Launcher", "setIconColumns(QString,int)" );
268 ic << *it << tc. m_iconcolumns; 273 ic << *it << tc. m_iconcolumns;
269 274
270 QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); 275 QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" );
271 fe << *it; 276 fe << *it;
272 fe << ( tc. m_font_use ? tc. m_font_family : QString::null ); 277 fe << ( tc. m_font_use ? tc. m_font_family : QString::null );
273 fe << tc. m_font_size; 278 fe << tc. m_font_size;
274 fe << tc. m_font_weight; 279 fe << tc. m_font_weight;
275 fe << ( tc. m_font_italic ? 1 : 0 ); 280 fe << ( tc. m_font_italic ? 1 : 0 );
276 281
277 tc. m_changed = false; 282 tc. m_changed = false;
278 } 283 }
279 cfg. setGroup ( "GUI" ); 284 cfg. setGroup ( "GUI" );
280 QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" ); 285 QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" );
281 cfg. writeEntry ( "BusyType", busytype ); 286 cfg. writeEntry ( "BusyType", busytype );
282 287 cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) );
283 cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) ); 288 cfg. writeEntry ( "StaticBackground", m_staticbackground->isChecked( ) );
284 289
285 { 290 {
286 QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); 291 QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" );
287 e << busytype; 292 e << busytype;
288 } 293 }
294 {
295 QCopEnvelope e ( "QPE/Launcher", "setStaticBackground(bool)" );
296 e << m_staticbackground->isChecked();
297 }
289} 298}
290 299
291void TabsSettings::newClicked ( ) 300void TabsSettings::newClicked ( )
292{ 301{
293 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); 302 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
294} 303}
295 304
296void TabsSettings::deleteClicked ( ) 305void TabsSettings::deleteClicked ( )
297{ 306{
298 int ind = m_list-> currentItem ( ); 307 int ind = m_list-> currentItem ( );
299 308
300 if ( ind < 0 ) 309 if ( ind < 0 )
301 return; 310 return;
302 311
303 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); 312 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
304} 313}
305 314
306void TabsSettings::editClicked ( ) 315void TabsSettings::editClicked ( )
307{ 316{
308 int ind = m_list-> currentItem ( ); 317 int ind = m_list-> currentItem ( );
309 318
310 if ( ind < 0 ) 319 if ( ind < 0 )
311 return; 320 return;
312 321
313 TabConfig tc = m_tabs [m_ids [ind]]; 322 TabConfig tc = m_tabs [m_ids [ind]];
314 323
315 TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); 324 TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true );
316 325
317 if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) { 326 if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) {
318 tc. m_changed = true; 327 tc. m_changed = true;
319 m_tabs [m_ids [ind]] = tc; 328 m_tabs [m_ids [ind]] = tc;
320 329
321 if ( m_ids [ind] == GLOBALID ) { 330 if ( m_ids [ind] == GLOBALID ) {
322 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 331 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
323 if ( *it != GLOBALID ) 332 if ( *it != GLOBALID )
324 m_tabs [*it] = tc; 333 m_tabs [*it] = tc;
325 } 334 }
326 } 335 }
327 } 336 }
328 337
329 delete d; 338 delete d;
330} 339}
diff --git a/core/settings/launcher/tabssettings.h b/core/settings/launcher/tabssettings.h
index 600c65c..bbe1e72 100644
--- a/core/settings/launcher/tabssettings.h
+++ b/core/settings/launcher/tabssettings.h
@@ -1,68 +1,68 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27#ifndef __TABS_SETTINGS_H__ 27#ifndef __TABS_SETTINGS_H__
28#define __TABS_SETTINGS_H__ 28#define __TABS_SETTINGS_H__
29 29
30#include <qwidget.h> 30#include <qwidget.h>
31#include <qmap.h> 31#include <qmap.h>
32 32
33#include "tabconfig.h" 33#include "tabconfig.h"
34 34
35class QListBox; 35class QListBox;
36class QCheckBox; 36class QCheckBox;
37class Config; 37class Config;
38 38
39 39
40class TabsSettings : public QWidget { 40class TabsSettings : public QWidget {
41 Q_OBJECT 41 Q_OBJECT
42 42
43public: 43public:
44 TabsSettings ( QWidget *parent = 0, const char *name = 0 ); 44 TabsSettings ( QWidget *parent = 0, const char *name = 0 );
45 45
46 void accept ( ); 46 void accept ( );
47 47
48protected slots: 48protected slots:
49 void newClicked ( ); 49 void newClicked ( );
50 void deleteClicked ( ); 50 void deleteClicked ( );
51 void editClicked ( ); 51 void editClicked ( );
52 52
53protected: 53protected:
54 void init ( ); 54 void init ( );
55 void readTabSettings ( Config & ); 55 void readTabSettings ( Config & );
56 56
57private: 57private:
58 QListBox *m_list; 58 QListBox *m_list;
59 //QString currentTab; 59 //QString currentTab;
60 QStringList m_ids; 60 QStringList m_ids;
61 QMap <QString, TabConfig> m_tabs; 61 QMap <QString, TabConfig> m_tabs;
62 QCheckBox *m_busyani, *m_bigbusy; 62 QCheckBox *m_busyani, *m_bigbusy, *m_staticbackground;
63}; 63};
64 64
65 65
66 66
67 67
68#endif 68#endif