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