summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-01-12 18:49:19 (UTC)
committer mickeyl <mickeyl>2005-01-12 18:49:19 (UTC)
commit6bc672f252c624eb1468222c5f9037a671967aef (patch) (unidiff)
treeb0acd7027c33d10b45d72bfe694da75f77c17033
parenteaaafd114a8210b0d434231290ec5e294aae91bb (diff)
downloadopie-6bc672f252c624eb1468222c5f9037a671967aef.zip
opie-6bc672f252c624eb1468222c5f9037a671967aef.tar.gz
opie-6bc672f252c624eb1468222c5f9037a671967aef.tar.bz2
Removed MediumDlg appearing prior to FirstUsage wizard (i.e. calibration)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog3
-rw-r--r--core/launcher/documentlist.cpp4
2 files changed, 5 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 9b31725..2b7bc35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,187 +1,188 @@
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 * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl)
6 * Number of icon columns in Launcher is customizable through LauncherSettings (mickeyl) 6 * Number of icon columns in Launcher is customizable through LauncherSettings (mickeyl)
7 7
8 Fixed Bugs 8 Fixed Bugs
9 ---------- 9 ----------
10 * #1501 - Fixed bug in todo sql backend (eilers) 10 * #1501 - Fixed bug in todo sql backend (eilers)
11 * n.a - Removed hard coded font sizes in a couple of inputmethods (mickeyl) 11 * n.a. - Removed hard coded font sizes in a couple of inputmethods (mickeyl)
12 * n.a. - Removed MediumDlg appearing prior to FirstUsage wizard (i.e. calibration) (mickeyl)
12 13
13 Internal 14 Internal
14 -------- 15 --------
15 * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) 16 * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl)
16 17
17 2004-11-26Opie 1.1.8 18 2004-11-26Opie 1.1.8
18 19
19 New Features 20 New Features
20 ------------ 21 ------------
21 * PackageManager supports installation of local ipkg files (drw) 22 * PackageManager supports installation of local ipkg files (drw)
22 * PackageManager supports linking of applications to root (drw) 23 * PackageManager supports linking of applications to root (drw)
23 * PackageManager supports src/gz feeds (drw,wimpie) 24 * PackageManager supports src/gz feeds (drw,wimpie)
24 * Added a syslog information tab to sysinfo (mickeyl) 25 * Added a syslog information tab to sysinfo (mickeyl)
25 * Added new, more consistent, PIM icons + a GIMP teplate (ar) 26 * Added new, more consistent, PIM icons + a GIMP teplate (ar)
26 27
27 Fixed Bugs 28 Fixed Bugs
28 ---------- 29 ----------
29 * #1017 - Tetrix doesn't display correctly for high resolution screens (drw) 30 * #1017 - Tetrix doesn't display correctly for high resolution screens (drw)
30 * #1269 - VCards were imported into personal area if it was activated (eilers) 31 * #1269 - VCards were imported into personal area if it was activated (eilers)
31 * #1464 - Packagemanager dont set active filter after install a package (drw) 32 * #1464 - Packagemanager dont set active filter after install a package (drw)
32 * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers) 33 * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers)
33 * #1493 - Fixed one column layout bug of the launcher (hrw) 34 * #1493 - Fixed one column layout bug of the launcher (hrw)
34 * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw) 35 * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw)
35 * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw) 36 * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw)
36 * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl) 37 * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl)
37 38
38 Internal 39 Internal
39 -------- 40 --------
40 * Moved libopie1 to unsupported (mickeyl) 41 * Moved libopie1 to unsupported (mickeyl)
41 * Implemented generic queryByExample() with incremental searching. A lot of internal changes of the Pim2-library (eilers) 42 * Implemented generic queryByExample() with incremental searching. A lot of internal changes of the Pim2-library (eilers)
42 * Added fast and full featured and incremental sorted() for SQL addressbook backend (eilers) 43 * Added fast and full featured and incremental sorted() for SQL addressbook backend (eilers)
43 44
44 2004-11-14Opie 1.1.7 45 2004-11-14Opie 1.1.7
45 46
46 New Features 47 New Features
47 ------------ 48 ------------
48 * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers) 49 * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers)
49 * Backup now uses the busy indicator when backing up and restore (ar) 50 * Backup now uses the busy indicator when backing up and restore (ar)
50 * OpiePlayer2 gained adding of Directories to the playlist (zecke) 51 * OpiePlayer2 gained adding of Directories to the playlist (zecke)
51 * OpiePlayer2 better error handling (zecke) 52 * OpiePlayer2 better error handling (zecke)
52 * OpiePlayer2 progress indication while streaming (zecke) 53 * OpiePlayer2 progress indication while streaming (zecke)
53 * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke) 54 * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke)
54 * Ported brightnessapplet from Qtopia 1.7 (mickeyl) 55 * Ported brightnessapplet from Qtopia 1.7 (mickeyl)
55 * Opie-Eye got a Digital Camera File Backend (alwin,zecke) 56 * Opie-Eye got a Digital Camera File Backend (alwin,zecke)
56 * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke) 57 * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke)
57 * Opie-Console use Custom Font and Size in a Profile (harlekin) 58 * Opie-Console use Custom Font and Size in a Profile (harlekin)
58 * Opie-Console transparently log the Output and Input to a file (harlekin) 59 * Opie-Console transparently log the Output and Input to a file (harlekin)
59 * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem) 60 * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem)
60 * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem) 61 * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem)
61 * Opie-Security gained a 'test authentication' button (clem) 62 * Opie-Security gained a 'test authentication' button (clem)
62 * Opie-Eye got a more unique layout (menubar), a slideshow, user can setup some defaults 63 * Opie-Eye got a more unique layout (menubar), a slideshow, user can setup some defaults
63 * Opie-Mail improve the handling of POP mail boxes (alwin) 64 * Opie-Mail improve the handling of POP mail boxes (alwin)
64 * Both Opie-Eye and Opie-Mail were greatly improved due the hard work of Rajko Albrecht(alwin) 65 * Both Opie-Eye and Opie-Mail were greatly improved due the hard work of Rajko Albrecht(alwin)
65 * Opie IRC - backports of the 'NeIRC fork' (zecke) 66 * Opie IRC - backports of the 'NeIRC fork' (zecke)
66 67
67 Fixed Bugs 68 Fixed Bugs
68 ---------- 69 ----------
69 * #501 - Pickboard is able to show 'Umlaute' (TT,zecke) 70 * #501 - Pickboard is able to show 'Umlaute' (TT,zecke)
70 * #608 - Make Opie usable for left handed users (zecke) 71 * #608 - Make Opie usable for left handed users (zecke)
71 * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke) 72 * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke)
72 * #1245 - Opie-Go 'paused' (zecke) 73 * #1245 - Opie-Go 'paused' (zecke)
73 * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke) 74 * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke)
74 * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke) 75 * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke)
75 * #1395 - Build VNC Backend with gcc3.4 76 * #1395 - Build VNC Backend with gcc3.4
76 * #1440 - The icon of opie-mobilemsg is missing (CoreDump) 77 * #1440 - The icon of opie-mobilemsg is missing (CoreDump)
77 * #1426 - Add missing opie-bartender Icon (CoreDump) 78 * #1426 - Add missing opie-bartender Icon (CoreDump)
78 * #1445 - Opie-Sheet Has No Icon (CoreDump) 79 * #1445 - Opie-Sheet Has No Icon (CoreDump)
79 * #1448 - Brightness Applet added (mickeyl) 80 * #1448 - Brightness Applet added (mickeyl)
80 * #1450 - ZSame didn't clear the bonus item after winning a game (zecke) 81 * #1450 - ZSame didn't clear the bonus item after winning a game (zecke)
81 * #1482 - Fix OFileSelector to be able to sort by size (zecke) 82 * #1482 - Fix OFileSelector to be able to sort by size (zecke)
82 * n.a. - Opie-mail: fixed some crasher, some layout-problems 83 * n.a. - Opie-mail: fixed some crasher, some layout-problems
83 * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke) 84 * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke)
84 * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke) 85 * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke)
85 * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem) 86 * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem)
86 * 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) 87 * 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)
87 * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl) 88 * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl)
88 89
89 Internal 90 Internal
90 -------- 91 --------
91 * Opie-Qashmoney has been moved to unsupported (mickeyl) 92 * Opie-Qashmoney has been moved to unsupported (mickeyl)
92 * Opie-Ubrowser has been moved to unsupported (mickeyl) 93 * Opie-Ubrowser has been moved to unsupported (mickeyl)
93 94
94 2004-09-17Opie 1.1.6 95 2004-09-17Opie 1.1.6
95 96
96 New Features 97 New Features
97 ------------ 98 ------------
98 * Fifteen gained configurable number of items (zecke) 99 * Fifteen gained configurable number of items (zecke)
99 * Fifteen can have custom background images (zecke) 100 * Fifteen can have custom background images (zecke)
100 * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl) 101 * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl)
101 * Integrated the new security framework into libopie2 (zecke,clem) 102 * Integrated the new security framework into libopie2 (zecke,clem)
102 * Converted the launcher to use the new security framework (zecke) 103 * Converted the launcher to use the new security framework (zecke)
103 * Backup can now handle custom locations for backup and restore (ar) 104 * Backup can now handle custom locations for backup and restore (ar)
104 * Implemented right-on-hold feedback (wimpie,zecke) 105 * Implemented right-on-hold feedback (wimpie,zecke)
105 * Lots of new features in opie-reader (tim,pohly) 106 * Lots of new features in opie-reader (tim,pohly)
106 * Build system cleanups (schurig) 107 * Build system cleanups (schurig)
107 108
108 Fixed Bugs 109 Fixed Bugs
109 -------- 110 --------
110 * #1005 - Fixed backup to CompactFlash (ar) 111 * #1005 - Fixed backup to CompactFlash (ar)
111 * #1167 - Fixed Opie write crashing on more text than one page (ar) 112 * #1167 - Fixed Opie write crashing on more text than one page (ar)
112 * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl) 113 * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl)
113 * #1359 - Fixed bookmarks in Gutenbrowser (ljp) 114 * #1359 - Fixed bookmarks in Gutenbrowser (ljp)
114 * #1361 - Fixed auto upercase in Opie-Addressbook (eilers) 115 * #1361 - Fixed auto upercase in Opie-Addressbook (eilers)
115 * #1370 - Pimconverter now reacts on cancel key (eilers) 116 * #1370 - Pimconverter now reacts on cancel key (eilers)
116 * #1376 - Bring back the capslock/numlock display (zecke) 117 * #1376 - Bring back the capslock/numlock display (zecke)
117 * #1383 - Language settings now warns about losing open apps (Markus Litz) 118 * #1383 - Language settings now warns about losing open apps (Markus Litz)
118 * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl) 119 * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl)
119 * #1394 - Fixed oversized headline in opie-login (coredump) 120 * #1394 - Fixed oversized headline in opie-login (coredump)
120 * #1396 - Opie-console captures the escape key and vim is working (zecke) 121 * #1396 - Opie-console captures the escape key and vim is working (zecke)
121 * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl) 122 * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl)
122 123
123 2004-07-06Opie 1.1.4 124 2004-07-06Opie 1.1.4
124 125
125 New Features 126 New Features
126 ------------ 127 ------------
127 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) 128 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle)
128 * Added Conversion tool for pim-data (eilers) 129 * Added Conversion tool for pim-data (eilers)
129 * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers) 130 * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers)
130 * Modified the PIM API for providing generic use of OPimRecords (eilers) 131 * Modified the PIM API for providing generic use of OPimRecords (eilers)
131 * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke) 132 * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke)
132 133
133 Fixed Bugs 134 Fixed Bugs
134 -------- 135 --------
135 * #1068 - Country Drop Down Box Off Screen 136 * #1068 - Country Drop Down Box Off Screen
136 * #1291 - Opie tinykate does not open .desktop files (ar) 137 * #1291 - Opie tinykate does not open .desktop files (ar)
137 * #1291 - Opie sheet not saving correctly (ar) 138 * #1291 - Opie sheet not saving correctly (ar)
138 * #1294 - Opie does not know about British Summer Time 139 * #1294 - Opie does not know about British Summer Time
139 * #1314 - Drawpad initialization (mickeyl) 140 * #1314 - Drawpad initialization (mickeyl)
140 * #1317 - Packagemanager crashes on hold-down or install (chicken) 141 * #1317 - Packagemanager crashes on hold-down or install (chicken)
141 * #1321 - Batteryapplet graphic glitch (harlekin) 142 * #1321 - Batteryapplet graphic glitch (harlekin)
142 * #1324 - ZSafe not starting up (mickeyl) 143 * #1324 - ZSafe not starting up (mickeyl)
143 * #1328 - Personal Home Address fields is trimmed to 1char (eilers) 144 * #1328 - Personal Home Address fields is trimmed to 1char (eilers)
144 * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken) 145 * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken)
145 * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl) 146 * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl)
146 * #1348 - Datebook dependency on libopiedb2 (chicken) 147 * #1348 - Datebook dependency on libopiedb2 (chicken)
147 * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers) 148 * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers)
148 149
149 2004-04-25Opie 1.1.3 150 2004-04-25Opie 1.1.3
150 151
151 * Introduced first implementation of SQL-Support using SQLite (eilers) 152 * Introduced first implementation of SQL-Support using SQLite (eilers)
152 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) 153 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp)
153 * Added a real system graffiti character set (brad) 154 * Added a real system graffiti character set (brad)
154 * Added Generic Keyconfig Widget (zecke) 155 * Added Generic Keyconfig Widget (zecke)
155 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) 156 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke)
156 * Added new Bible reader app - opie-dagger (drw) 157 * Added new Bible reader app - opie-dagger (drw)
157 * Added a new Image Viewer. Work is ongoing (zecke,alwin) 158 * Added a new Image Viewer. Work is ongoing (zecke,alwin)
158 * Added namespace usage in libopie2 and everywhere (zecke,alwin) 159 * Added namespace usage in libopie2 and everywhere (zecke,alwin)
159 * Enabled the possibility to pass command line arguments to applications (mickeyl) 160 * Enabled the possibility to pass command line arguments to applications (mickeyl)
160 * Added an about applet showing some credits and information about Opie (mickeyl) 161 * Added an about applet showing some credits and information about Opie (mickeyl)
161 * Added benchmarking functionality to sysinfo (mickeyl) 162 * Added benchmarking functionality to sysinfo (mickeyl)
162 * Added applet and configuration application for switching hardware keyboard layouts (alwin) 163 * Added applet and configuration application for switching hardware keyboard layouts (alwin)
163 * Ported applications from libopie1 to libopie2* (drw,ar,alwin) 164 * Ported applications from libopie1 to libopie2* (drw,ar,alwin)
164 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) 165 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe)
165 * Clean-up of package information in control files (drw) 166 * Clean-up of package information in control files (drw)
166 * Repaired mediummount which was broken since integrating the quicklauncher (alwin) 167 * Repaired mediummount which was broken since integrating the quicklauncher (alwin)
167 * Improved big-screen support (zecke,ar) 168 * Improved big-screen support (zecke,ar)
168 * Improved multikeyboard support, added keyboard layout switching applet (mouse) 169 * Improved multikeyboard support, added keyboard layout switching applet (mouse)
169 * Added a new mail client based on libetpan (harlekin,alwin,jgf) 170 * Added a new mail client based on libetpan (harlekin,alwin,jgf)
170 * Added new package manager - opie-packagemanager (drw) 171 * Added new package manager - opie-packagemanager (drw)
171 * Improved light-n-power for C7x0 (mickeyl) 172 * Improved light-n-power for C7x0 (mickeyl)
172 * Added automatic rotation support for C7x0 (treke) 173 * Added automatic rotation support for C7x0 (treke)
173 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) 174 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl)
174 * Added scanning the wireless network neighbourhood to networksettings (mickeyl) 175 * Added scanning the wireless network neighbourhood to networksettings (mickeyl)
175 176
176 2003-11-29Opie 1.0.3 177 2003-11-29Opie 1.0.3
177 178
178 * Released as Version 1.0.3 179 * Released as Version 1.0.3
179 * Improved i18n (various contributors) 180 * Improved i18n (various contributors)
180 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) 181 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin)
181 * Made the Documents Tab optional (mickeyl) 182 * Made the Documents Tab optional (mickeyl)
182 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) 183 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken)
183 184
184 2003-08-04Opie 1.0.0 185 2003-08-04Opie 1.0.0
185 186
186 * Released as Version 1.0.0 187 * Released as Version 1.0.0
187 * Including a PPP module for easy dial up (tille,harlekin,zecke) 188 * Including a PPP module for easy dial up (tille,harlekin,zecke)
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp
index 9781a32..d2b9afa 100644
--- a/core/launcher/documentlist.cpp
+++ b/core/launcher/documentlist.cpp
@@ -1,811 +1,813 @@
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#include "documentlist.h" 20#include "documentlist.h"
21#include "serverinterface.h" 21#include "serverinterface.h"
22#include "mediadlg.h" 22#include "mediadlg.h"
23 23
24/* OPIE */ 24/* OPIE */
25#include <opie2/oglobal.h> 25#include <opie2/oglobal.h>
26#include <opie2/odebug.h> 26#include <opie2/odebug.h>
27#include <qtopia/config.h> 27#include <qtopia/config.h>
28#include <qtopia/mimetype.h> 28#include <qtopia/mimetype.h>
29#include <qtopia/resource.h> 29#include <qtopia/resource.h>
30#include <qtopia/private/categories.h> 30#include <qtopia/private/categories.h>
31#include <qtopia/qpeapplication.h> 31#include <qtopia/qpeapplication.h>
32#include <qtopia/applnk.h> 32#include <qtopia/applnk.h>
33#include <qtopia/storage.h> 33#include <qtopia/storage.h>
34#ifdef Q_WS_QWS 34#ifdef Q_WS_QWS
35#include <qtopia/qcopenvelope_qws.h> 35#include <qtopia/qcopenvelope_qws.h>
36#endif 36#endif
37using namespace Opie::Core; 37using namespace Opie::Core;
38 38
39/* QT */ 39/* QT */
40#include <qtimer.h> 40#include <qtimer.h>
41#include <qfileinfo.h> 41#include <qfileinfo.h>
42#include <qtextstream.h> 42#include <qtextstream.h>
43#include <qfile.h> 43#include <qfile.h>
44#include <qdir.h> 44#include <qdir.h>
45#include <qpainter.h> 45#include <qpainter.h>
46#include <qimage.h> 46#include <qimage.h>
47#include <qcopchannel_qws.h> 47#include <qcopchannel_qws.h>
48#include <qlistview.h> 48#include <qlistview.h>
49#include <qlist.h> 49#include <qlist.h>
50#include <qpixmap.h> 50#include <qpixmap.h>
51 51
52 52
53AppLnkSet *DocumentList::appLnkSet = 0; 53AppLnkSet *DocumentList::appLnkSet = 0;
54 54
55static const int MAX_SEARCH_DEPTH = 10; 55static const int MAX_SEARCH_DEPTH = 10;
56 56
57 57
58class DocumentListPrivate : public QObject { 58class DocumentListPrivate : public QObject {
59 Q_OBJECT 59 Q_OBJECT
60public: 60public:
61 DocumentListPrivate( ServerInterface *gui ); 61 DocumentListPrivate( ServerInterface *gui );
62 ~DocumentListPrivate(); 62 ~DocumentListPrivate();
63 63
64 void initialize(); 64 void initialize();
65 65
66 const QString nextFile(); 66 const QString nextFile();
67 const DocLnk *iterate(); 67 const DocLnk *iterate();
68 bool store( DocLnk* dl ); 68 bool store( DocLnk* dl );
69 void estimatedPercentScanned(); 69 void estimatedPercentScanned();
70 void appendDocpath(FileSystem*); 70 void appendDocpath(FileSystem*);
71 71
72 72
73 DocLnkSet dls; 73 DocLnkSet dls;
74 QDict<void> reference; 74 QDict<void> reference;
75 QDictIterator<void> *dit; 75 QDictIterator<void> *dit;
76 enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; 76 enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state;
77 77
78 QStringList docPaths; 78 QStringList docPaths;
79 unsigned int docPathsSearched; 79 unsigned int docPathsSearched;
80 80
81 int searchDepth; 81 int searchDepth;
82 QDir *listDirs[MAX_SEARCH_DEPTH]; 82 QDir *listDirs[MAX_SEARCH_DEPTH];
83 const QFileInfoList *lists[MAX_SEARCH_DEPTH]; 83 const QFileInfoList *lists[MAX_SEARCH_DEPTH];
84 unsigned int listPositions[MAX_SEARCH_DEPTH]; 84 unsigned int listPositions[MAX_SEARCH_DEPTH];
85 85
86 StorageInfo *storage; 86 StorageInfo *storage;
87 87
88 int tid; 88 int tid;
89 89
90 ServerInterface *serverGui; 90 ServerInterface *serverGui;
91 91
92 bool needToSendAllDocLinks; 92 bool needToSendAllDocLinks;
93 bool sendAppLnks; 93 bool sendAppLnks;
94 bool sendDocLnks; 94 bool sendDocLnks;
95 bool scanDocs; 95 bool scanDocs;
96}; 96};
97 97
98 98
99/* 99/*
100 * scandocs will be read from Config 100 * scandocs will be read from Config
101 */ 101 */
102DocumentList::DocumentList( ServerInterface *serverGui, bool /*scanDocs*/, 102DocumentList::DocumentList( ServerInterface *serverGui, bool /*scanDocs*/,
103 QObject *parent, const char *name ) 103 QObject *parent, const char *name )
104 : QObject( parent, name ) 104 : QObject( parent, name )
105{ 105{
106 appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); 106 appLnkSet = new AppLnkSet( MimeType::appsFolderName() );
107 d = new DocumentListPrivate( serverGui ); 107 d = new DocumentListPrivate( serverGui );
108 d->needToSendAllDocLinks = false; 108 d->needToSendAllDocLinks = false;
109 109
110 Config cfg( "Launcher" ); 110 Config cfg( "Launcher" );
111 cfg.setGroup( "DocTab" ); 111 cfg.setGroup( "DocTab" );
112 d->scanDocs = cfg.readBoolEntry( "Enable", true ); 112 d->scanDocs = cfg.readBoolEntry( "Enable", true );
113 odebug << "DocumentList::DocumentList() : scanDocs = " << d->scanDocs << "" << oendl; 113 odebug << "DocumentList::DocumentList() : scanDocs = " << d->scanDocs << "" << oendl;
114 114
115 QTimer::singleShot( 10, this, SLOT( startInitialScan() ) ); 115 QTimer::singleShot( 10, this, SLOT( startInitialScan() ) );
116} 116}
117 117
118void DocumentList::startInitialScan() 118void DocumentList::startInitialScan()
119{ 119{
120 reloadAppLnks(); 120 reloadAppLnks();
121 reloadDocLnks(); 121 reloadDocLnks();
122} 122}
123 123
124DocumentList::~DocumentList() 124DocumentList::~DocumentList()
125{ 125{
126 delete appLnkSet; 126 delete appLnkSet;
127 delete d; 127 delete d;
128} 128}
129 129
130 130
131void DocumentList::add( const DocLnk& doc ) 131void DocumentList::add( const DocLnk& doc )
132{ 132{
133 if ( d->serverGui && QFile::exists( doc.file() ) ) 133 if ( d->serverGui && QFile::exists( doc.file() ) )
134 d->serverGui->documentAdded( doc ); 134 d->serverGui->documentAdded( doc );
135} 135}
136 136
137 137
138void DocumentList::start() 138void DocumentList::start()
139{ 139{
140 resume(); 140 resume();
141} 141}
142 142
143 143
144void DocumentList::pause() 144void DocumentList::pause()
145{ 145{
146 //odebug << "pause " << d->tid << "" << oendl; 146 //odebug << "pause " << d->tid << "" << oendl;
147 killTimer( d->tid ); 147 killTimer( d->tid );
148 d->tid = 0; 148 d->tid = 0;
149} 149}
150 150
151 151
152void DocumentList::resume() 152void DocumentList::resume()
153{ 153{
154 if ( d->tid == 0 ) { 154 if ( d->tid == 0 ) {
155 d->tid = startTimer( 20 ); 155 d->tid = startTimer( 20 );
156 //odebug << "resumed " << d->tid << "" << oendl; 156 //odebug << "resumed " << d->tid << "" << oendl;
157 } 157 }
158} 158}
159 159
160/* 160/*
161void DocumentList::resend() 161void DocumentList::resend()
162{ 162{
163 // Re-emits all the added items to the list (firstly letting everyone know to 163 // Re-emits all the added items to the list (firstly letting everyone know to
164 // clear what they have as it is being sent again) 164 // clear what they have as it is being sent again)
165 pause(); 165 pause();
166 emit allRemoved(); 166 emit allRemoved();
167 QTimer::singleShot( 5, this, SLOT( resendWorker() ) ); 167 QTimer::singleShot( 5, this, SLOT( resendWorker() ) );
168} 168}
169 169
170 170
171void DocumentList::resendWorker() 171void DocumentList::resendWorker()
172{ 172{
173 const QList<DocLnk> &list = d->dls.children(); 173 const QList<DocLnk> &list = d->dls.children();
174 for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) 174 for ( QListIterator<DocLnk> it( list ); it.current(); ++it )
175 add( *(*it) ); 175 add( *(*it) );
176 resume(); 176 resume();
177} 177}
178*/ 178*/
179 179
180void DocumentList::rescan() 180void DocumentList::rescan()
181{ 181{
182 //odebug << "rescan" << oendl; 182 //odebug << "rescan" << oendl;
183 pause(); 183 pause();
184 d->initialize(); 184 d->initialize();
185 resume(); 185 resume();
186} 186}
187 187
188 188
189void DocumentList::timerEvent( QTimerEvent *te ) 189void DocumentList::timerEvent( QTimerEvent *te )
190{ 190{
191 if ( te->timerId() == d->tid ) { 191 if ( te->timerId() == d->tid ) {
192 // Do 3 at a time 192 // Do 3 at a time
193 if ( d->serverGui ) 193 if ( d->serverGui )
194 d->serverGui->aboutToAddBegin(); 194 d->serverGui->aboutToAddBegin();
195 for (int i = 0; i < 3; i++ ) { 195 for (int i = 0; i < 3; i++ ) {
196 const DocLnk *lnk = d->iterate(); 196 const DocLnk *lnk = d->iterate();
197 if ( lnk ) { 197 if ( lnk ) {
198 add( *lnk ); 198 add( *lnk );
199 } else { 199 } else {
200 // stop when done 200 // stop when done
201 pause(); 201 pause();
202 if ( d->serverGui ) 202 if ( d->serverGui )
203 d->serverGui->documentScanningProgress( 100 ); 203 d->serverGui->documentScanningProgress( 100 );
204 if ( d->needToSendAllDocLinks ) 204 if ( d->needToSendAllDocLinks )
205 sendAllDocLinks(); 205 sendAllDocLinks();
206 break; 206 break;
207 } 207 }
208 } 208 }
209 if ( d->serverGui ) 209 if ( d->serverGui )
210 d->serverGui->aboutToAddEnd(); 210 d->serverGui->aboutToAddEnd();
211 } 211 }
212} 212}
213 213
214 214
215void DocumentList::reloadAppLnks() 215void DocumentList::reloadAppLnks()
216{ 216{
217 if ( d->sendAppLnks && d->serverGui ) { 217 if ( d->sendAppLnks && d->serverGui ) {
218 d->serverGui->applicationScanningProgress( 0 ); 218 d->serverGui->applicationScanningProgress( 0 );
219 d->serverGui->allApplicationsRemoved(); 219 d->serverGui->allApplicationsRemoved();
220 } 220 }
221 221
222 delete appLnkSet; 222 delete appLnkSet;
223 appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); 223 appLnkSet = new AppLnkSet( MimeType::appsFolderName() );
224 224
225 if ( d->sendAppLnks && d->serverGui ) { 225 if ( d->sendAppLnks && d->serverGui ) {
226 static QStringList prevTypeList; 226 static QStringList prevTypeList;
227 QStringList types = appLnkSet->types(); 227 QStringList types = appLnkSet->types();
228 for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { 228 for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) {
229 if ( !(*ittypes).isEmpty() ) { 229 if ( !(*ittypes).isEmpty() ) {
230 if ( !prevTypeList.contains(*ittypes) ) { 230 if ( !prevTypeList.contains(*ittypes) ) {
231 QString name = appLnkSet->typeName(*ittypes); 231 QString name = appLnkSet->typeName(*ittypes);
232 QPixmap pm = appLnkSet->typePixmap(*ittypes); 232 QPixmap pm = appLnkSet->typePixmap(*ittypes);
233 QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); 233 QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes);
234 234
235 if (pm.isNull()) { 235 if (pm.isNull()) {
236 QImage img( Resource::loadImage( "UnknownDocument" ) ); 236 QImage img( Resource::loadImage( "UnknownDocument" ) );
237 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 237 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
238 bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); 238 bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() );
239 } 239 }
240 240
241 //odebug << "adding type " << (*ittypes) << "" << oendl; 241 //odebug << "adding type " << (*ittypes) << "" << oendl;
242 242
243 // ### our current launcher expects docs tab to be last 243 // ### our current launcher expects docs tab to be last
244 d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); 244 d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm );
245 } 245 }
246 prevTypeList.remove(*ittypes); 246 prevTypeList.remove(*ittypes);
247 } 247 }
248 } 248 }
249 for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { 249 for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) {
250 //odebug << "removing type " << (*ittypes) << "" << oendl; 250 //odebug << "removing type " << (*ittypes) << "" << oendl;
251 d->serverGui->typeRemoved(*ittypes); 251 d->serverGui->typeRemoved(*ittypes);
252 } 252 }
253 prevTypeList = types; 253 prevTypeList = types;
254 } 254 }
255 255
256 QListIterator<AppLnk> itapp( appLnkSet->children() ); 256 QListIterator<AppLnk> itapp( appLnkSet->children() );
257 AppLnk* l; 257 AppLnk* l;
258 while ( (l=itapp.current()) ) { 258 while ( (l=itapp.current()) ) {
259 ++itapp; 259 ++itapp;
260 if ( d->sendAppLnks && d->serverGui ) 260 if ( d->sendAppLnks && d->serverGui )
261 d->serverGui->applicationAdded( l->type(), *l ); 261 d->serverGui->applicationAdded( l->type(), *l );
262 } 262 }
263 263
264 if ( d->sendAppLnks && d->serverGui ) 264 if ( d->sendAppLnks && d->serverGui )
265 d->serverGui->applicationScanningProgress( 100 ); 265 d->serverGui->applicationScanningProgress( 100 );
266} 266}
267 267
268void DocumentList::reloadDocLnks() 268void DocumentList::reloadDocLnks()
269{ 269{
270 if ( !d->scanDocs ) 270 if ( !d->scanDocs )
271 return; 271 return;
272 272
273 if ( d->sendDocLnks && d->serverGui ) { 273 if ( d->sendDocLnks && d->serverGui ) {
274 d->serverGui->documentScanningProgress( 0 ); 274 d->serverGui->documentScanningProgress( 0 );
275 d->serverGui->allDocumentsRemoved(); 275 d->serverGui->allDocumentsRemoved();
276 } 276 }
277 277
278 rescan(); 278 rescan();
279} 279}
280 280
281void DocumentList::reforceDocuments() 281void DocumentList::reforceDocuments()
282{ 282{
283 Config cfg( "Launcher" ); 283 Config cfg( "Launcher" );
284 cfg.setGroup( "DocTab" ); 284 cfg.setGroup( "DocTab" );
285 d->scanDocs = cfg.readBoolEntry( "Enable", true ); 285 d->scanDocs = cfg.readBoolEntry( "Enable", true );
286 reloadDocLnks(); 286 reloadDocLnks();
287} 287}
288 288
289void DocumentList::linkChanged( QString arg ) 289void DocumentList::linkChanged( QString arg )
290{ 290{
291 odebug << "linkchanged( " << arg << " )" << oendl; 291 odebug << "linkchanged( " << arg << " )" << oendl;
292 292
293 if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) { 293 if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) {
294 reloadAppLnks(); 294 reloadAppLnks();
295 } else { 295 } else {
296 296
297 const QList<DocLnk> &list = d->dls.children(); 297 const QList<DocLnk> &list = d->dls.children();
298 QListIterator<DocLnk> it( list ); 298 QListIterator<DocLnk> it( list );
299 while ( it.current() ) { 299 while ( it.current() ) {
300 DocLnk *doc = it.current(); 300 DocLnk *doc = it.current();
301 ++it; 301 ++it;
302 if ( ( doc->linkFileKnown() && doc->linkFile() == arg ) 302 if ( ( doc->linkFileKnown() && doc->linkFile() == arg )
303 || ( doc->fileKnown() && doc->file() == arg ) ) { 303 || ( doc->fileKnown() && doc->file() == arg ) ) {
304 //odebug << "found old link" << oendl; 304 //odebug << "found old link" << oendl;
305 DocLnk* dl = new DocLnk( arg ); 305 DocLnk* dl = new DocLnk( arg );
306 // add new one if it exists and matches the mimetype 306 // add new one if it exists and matches the mimetype
307 if ( d->store( dl ) ) { 307 if ( d->store( dl ) ) {
308 // Existing link has been changed, send old link ref and a ref 308 // Existing link has been changed, send old link ref and a ref
309 // to the new link 309 // to the new link
310 //odebug << "change case" << oendl; 310 //odebug << "change case" << oendl;
311 if ( d->serverGui ) 311 if ( d->serverGui )
312 d->serverGui->documentChanged( *doc, *dl ); 312 d->serverGui->documentChanged( *doc, *dl );
313 313
314 } else { 314 } else {
315 // Link has been removed or doesn't match the mimetypes any more 315 // Link has been removed or doesn't match the mimetypes any more
316 // so we aren't interested in it, so take it away from the list 316 // so we aren't interested in it, so take it away from the list
317 //odebug << "removal case" << oendl; 317 //odebug << "removal case" << oendl;
318 if ( d->serverGui ) 318 if ( d->serverGui )
319 d->serverGui->documentRemoved( *doc ); 319 d->serverGui->documentRemoved( *doc );
320 320
321 } 321 }
322 d->dls.remove( doc ); // remove old link from docLnkSet 322 d->dls.remove( doc ); // remove old link from docLnkSet
323 delete doc; 323 delete doc;
324 return; 324 return;
325 } 325 }
326 } 326 }
327 // Didn't find existing link, must be new 327 // Didn't find existing link, must be new
328 DocLnk* dl = new DocLnk( arg ); 328 DocLnk* dl = new DocLnk( arg );
329 if ( d->store( dl ) ) { 329 if ( d->store( dl ) ) {
330 // Add if it's a link we are interested in 330 // Add if it's a link we are interested in
331 //odebug << "add case" << oendl; 331 //odebug << "add case" << oendl;
332 add( *dl ); 332 add( *dl );
333 } 333 }
334 334
335 } 335 }
336} 336}
337 337
338void DocumentList::restoreDone() 338void DocumentList::restoreDone()
339{ 339{
340 reloadAppLnks(); 340 reloadAppLnks();
341 reloadDocLnks(); 341 reloadDocLnks();
342} 342}
343 343
344void DocumentList::DiffAppLnks() 344void DocumentList::DiffAppLnks()
345{ 345{
346 static AppLnkSet *appLnkSet2; 346 static AppLnkSet *appLnkSet2;
347 347
348 appLnkSet2 = new AppLnkSet( MimeType::appsFolderName() ); 348 appLnkSet2 = new AppLnkSet( MimeType::appsFolderName() );
349 349
350 if ( d->sendAppLnks && d->serverGui ) { 350 if ( d->sendAppLnks && d->serverGui ) {
351 static QStringList prevTypeList = appLnkSet->types(); 351 static QStringList prevTypeList = appLnkSet->types();
352 QStringList types = appLnkSet2->types(); 352 QStringList types = appLnkSet2->types();
353 for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { 353 for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) {
354 if ( !(*ittypes).isEmpty() ) { 354 if ( !(*ittypes).isEmpty() ) {
355 if ( !prevTypeList.contains(*ittypes) ) { 355 if ( !prevTypeList.contains(*ittypes) ) {
356 QString name = appLnkSet2->typeName(*ittypes); 356 QString name = appLnkSet2->typeName(*ittypes);
357 QPixmap pm = appLnkSet2->typePixmap(*ittypes); 357 QPixmap pm = appLnkSet2->typePixmap(*ittypes);
358 QPixmap bgPm = appLnkSet2->typeBigPixmap(*ittypes); 358 QPixmap bgPm = appLnkSet2->typeBigPixmap(*ittypes);
359 359
360 if (pm.isNull()) { 360 if (pm.isNull()) {
361 QImage img( Resource::loadImage( "UnknownDocument" ) ); 361 QImage img( Resource::loadImage( "UnknownDocument" ) );
362 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 362 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
363 bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); 363 bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() );
364 } 364 }
365 365
366 odebug << "adding type " << (*ittypes) << "" << oendl; 366 odebug << "adding type " << (*ittypes) << "" << oendl;
367 367
368 // ### our current launcher expects docs tab to be last 368 // ### our current launcher expects docs tab to be last
369 d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); 369 d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm );
370 } 370 }
371 prevTypeList.remove(*ittypes); 371 prevTypeList.remove(*ittypes);
372 } 372 }
373 } 373 }
374 for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { 374 for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) {
375 odebug << "removing type " << (*ittypes) << "" << oendl; 375 odebug << "removing type " << (*ittypes) << "" << oendl;
376 d->serverGui->typeRemoved(*ittypes); 376 d->serverGui->typeRemoved(*ittypes);
377 } 377 }
378 prevTypeList = types; 378 prevTypeList = types;
379 } 379 }
380 380
381 381
382 QListIterator<AppLnk> it1( appLnkSet->children() ); 382 QListIterator<AppLnk> it1( appLnkSet->children() );
383 QListIterator<AppLnk> it2( appLnkSet2->children() ); 383 QListIterator<AppLnk> it2( appLnkSet2->children() );
384 384
385 AppLnk *i; 385 AppLnk *i;
386 AppLnk *j; 386 AppLnk *j;
387 bool found; 387 bool found;
388 388
389 while ( (j=it2.current()) ) { 389 while ( (j=it2.current()) ) {
390 it1 = appLnkSet->children(); 390 it1 = appLnkSet->children();
391 found = false; 391 found = false;
392 while ( (i=it1.current()) ){ 392 while ( (i=it1.current()) ){
393 if (strcmp(i->name().ascii(),j->name().ascii()) == 0) 393 if (strcmp(i->name().ascii(),j->name().ascii()) == 0)
394 found = true; 394 found = true;
395 ++it1; 395 ++it1;
396 } 396 }
397 if (!found) { 397 if (!found) {
398 odebug << "Item " << j->name().ascii() << " needs to be added" << oendl; 398 odebug << "Item " << j->name().ascii() << " needs to be added" << oendl;
399 d->serverGui->applicationAdded( j->type(), *j ); 399 d->serverGui->applicationAdded( j->type(), *j );
400 } 400 }
401 ++it2; 401 ++it2;
402 } 402 }
403 403
404 it1 = appLnkSet->children(); 404 it1 = appLnkSet->children();
405 while ( (i=it1.current()) ) { 405 while ( (i=it1.current()) ) {
406 it2 = appLnkSet2->children(); 406 it2 = appLnkSet2->children();
407 found = false; 407 found = false;
408 while ( (j=it2.current()) ){ 408 while ( (j=it2.current()) ){
409 if (strcmp(i->name().ascii(),j->name().ascii()) == 0) 409 if (strcmp(i->name().ascii(),j->name().ascii()) == 0)
410 found = true; 410 found = true;
411 ++it2; 411 ++it2;
412 } 412 }
413 if (!found) { 413 if (!found) {
414 odebug << "Item " << i->name().ascii() << " needs to be removed" << oendl; 414 odebug << "Item " << i->name().ascii() << " needs to be removed" << oendl;
415 d->serverGui->applicationRemoved( i->type(), *i ); 415 d->serverGui->applicationRemoved( i->type(), *i );
416 } 416 }
417 417
418 ++it1; 418 ++it1;
419 } 419 }
420 420
421 delete appLnkSet; 421 delete appLnkSet;
422 appLnkSet = appLnkSet2; 422 appLnkSet = appLnkSet2;
423 423
424} 424}
425void DocumentList::storageChanged() 425void DocumentList::storageChanged()
426{ 426{
427 QTime t; 427 QTime t;
428 // ### can implement better 428 // ### can implement better
429 429
430 t.start(); 430 t.start();
431 DiffAppLnks(); 431 DiffAppLnks();
432// reloadAppLnks(); 432// reloadAppLnks();
433 odebug << "Reload App links took " << t.elapsed() << " ms" << oendl; 433 odebug << "Reload App links took " << t.elapsed() << " ms" << oendl;
434 reloadDocLnks(); 434 reloadDocLnks();
435// odebug << "Reload links took " << t.elapsed() << " ms " << oendl; 435// odebug << "Reload links took " << t.elapsed() << " ms " << oendl;
436 odebug << "Reload All links took " << t.elapsed() << " ms" << oendl; 436 odebug << "Reload All links took " << t.elapsed() << " ms" << oendl;
437// ### Optimization opportunity 437// ### Optimization opportunity
438 // Could be a bit more intelligent and somehow work out which 438 // Could be a bit more intelligent and somehow work out which
439 // mtab entry has changed and then only scan that and add and remove 439 // mtab entry has changed and then only scan that and add and remove
440 // links appropriately. 440 // links appropriately.
441// rescan(); 441// rescan();
442} 442}
443 443
444void DocumentList::sendAllDocLinks() 444void DocumentList::sendAllDocLinks()
445{ 445{
446 if ( d->tid != 0 ) { 446 if ( d->tid != 0 ) {
447 // We are in the middle of scanning, set a flag so 447 // We are in the middle of scanning, set a flag so
448 // we do this when we finish our scanning 448 // we do this when we finish our scanning
449 d->needToSendAllDocLinks = true; 449 d->needToSendAllDocLinks = true;
450 return; 450 return;
451 } 451 }
452 452
453 QString contents; 453 QString contents;
454 Categories cats; 454 Categories cats;
455 for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) { 455 for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) {
456 DocLnk *doc = it.current(); 456 DocLnk *doc = it.current();
457 QFileInfo fi( doc->file() ); 457 QFileInfo fi( doc->file() );
458 if ( !fi.exists() ) 458 if ( !fi.exists() )
459 continue; 459 continue;
460 460
461 bool fake = !doc->linkFileKnown(); 461 bool fake = !doc->linkFileKnown();
462 if ( !fake ) { 462 if ( !fake ) {
463 QFile f( doc->linkFile() ); 463 QFile f( doc->linkFile() );
464 if ( f.open( IO_ReadOnly ) ) { 464 if ( f.open( IO_ReadOnly ) ) {
465 QTextStream ts( &f ); 465 QTextStream ts( &f );
466 ts.setEncoding( QTextStream::UnicodeUTF8 ); 466 ts.setEncoding( QTextStream::UnicodeUTF8 );
467 QString docLnk = ts.read(); 467 QString docLnk = ts.read();
468 // Strip out the (stale) LinkFile entry 468 // Strip out the (stale) LinkFile entry
469 int start = docLnk.find( "\nLinkFile = " ) + 1; 469 int start = docLnk.find( "\nLinkFile = " ) + 1;
470 if ( start > 0 ) { 470 if ( start > 0 ) {
471 int end = docLnk.find( "\n", start + 1 ) + 1; 471 int end = docLnk.find( "\n", start + 1 ) + 1;
472 contents += docLnk.left(start); 472 contents += docLnk.left(start);
473 contents += docLnk.mid(end); 473 contents += docLnk.mid(end);
474 } else { 474 } else {
475 contents += docLnk; 475 contents += docLnk;
476 } 476 }
477 contents += "LinkFile = " + doc->linkFile() + "\n"; 477 contents += "LinkFile = " + doc->linkFile() + "\n";
478 478
479 f.close(); 479 f.close();
480 } else 480 } else
481 fake = TRUE; 481 fake = TRUE;
482 } 482 }
483 if (fake) { 483 if (fake) {
484 contents += "[Desktop Entry]\n"; // No tr 484 contents += "[Desktop Entry]\n"; // No tr
485 contents += "Categories = " + // No tr 485 contents += "Categories = " + // No tr
486 cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr 486 cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr
487 contents += "Name = "+doc->name()+"\n"; // No tr 487 contents += "Name = "+doc->name()+"\n"; // No tr
488 contents += "Type = "+doc->type()+"\n"; // No tr 488 contents += "Type = "+doc->type()+"\n"; // No tr
489 } 489 }
490 contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) 490 contents += "File = "+doc->file()+"\n"; // No tr // (resolves path)
491 contents += QString("Size = %1\n").arg( fi.size() ); // No tr 491 contents += QString("Size = %1\n").arg( fi.size() ); // No tr
492 } 492 }
493 493
494 //odebug << "sending length " << contents.length() << "" << oendl; 494 //odebug << "sending length " << contents.length() << "" << oendl;
495#ifndef QT_NO_COP 495#ifndef QT_NO_COP
496 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); 496 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
497 e << contents; 497 e << contents;
498#endif 498#endif
499 //odebug << "================ \n\n" << contents << "\n\n===============" << oendl; 499 //odebug << "================ \n\n" << contents << "\n\n===============" << oendl;
500 500
501 d->needToSendAllDocLinks = false; 501 d->needToSendAllDocLinks = false;
502} 502}
503 503
504 504
505 505
506 506
507 507
508 508
509 509
510 510
511 511
512 512
513 513
514 514
515 515
516 516
517 517
518 518
519 519
520 520
521 521
522 522
523 523
524 524
525 525
526 526
527DocumentListPrivate::DocumentListPrivate( ServerInterface *gui ) 527DocumentListPrivate::DocumentListPrivate( ServerInterface *gui )
528{ 528{
529 storage = new StorageInfo( this ); 529 storage = new StorageInfo( this );
530 serverGui = gui; 530 serverGui = gui;
531 if ( serverGui ) { 531 if ( serverGui ) {
532 sendAppLnks = serverGui->requiresApplications(); 532 sendAppLnks = serverGui->requiresApplications();
533 sendDocLnks = serverGui->requiresDocuments(); 533 sendDocLnks = serverGui->requiresDocuments();
534 } else { 534 } else {
535 sendAppLnks = false; 535 sendAppLnks = false;
536 sendDocLnks = false; 536 sendDocLnks = false;
537 } 537 }
538 for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) { 538 for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) {
539 listDirs[i] = 0; 539 listDirs[i] = 0;
540 lists[i] = 0; 540 lists[i] = 0;
541 listPositions[i] = 0; 541 listPositions[i] = 0;
542 } 542 }
543 initialize(); 543 initialize();
544 tid = 0; 544 tid = 0;
545} 545}
546 546
547void DocumentListPrivate::appendDocpath(FileSystem*fs) 547void DocumentListPrivate::appendDocpath(FileSystem*fs)
548{ 548{
549 Config c( "qpe" );
550 c.setGroup( "Startup" );
549 QDir defPath(fs->path()+"/Documents"); 551 QDir defPath(fs->path()+"/Documents");
550 QFileInfo f(fs->path()+"/.opiestorage.cf"); 552 QFileInfo f(fs->path()+"/.opiestorage.cf");
551 if (!f.exists()) { 553 if ( c.readNumEntry( "FirstUse", 42 ) == 0 && !f.exists()) {
552 Mediadlg dlg(fs); 554 Mediadlg dlg(fs);
553 if (QDialog::Accepted != QPEApplication::execDialog( &dlg )) { 555 if (QDialog::Accepted != QPEApplication::execDialog( &dlg )) {
554 return; 556 return;
555 } 557 }
556 } 558 }
557 Config conf(f.filePath(), Config::File ); 559 Config conf(f.filePath(), Config::File );
558 conf.setGroup("main"); 560 conf.setGroup("main");
559 if (!conf.readBoolEntry("check",false)) { 561 if (!conf.readBoolEntry("check",false)) {
560 return; 562 return;
561 } 563 }
562 conf.setGroup("subdirs"); 564 conf.setGroup("subdirs");
563 bool read_all = conf.readBoolEntry("wholemedia",true); 565 bool read_all = conf.readBoolEntry("wholemedia",true);
564 if (read_all) { 566 if (read_all) {
565 docPaths+=fs->path(); 567 docPaths+=fs->path();
566 return; 568 return;
567 } 569 }
568 QStringList subDirs = conf.readListEntry("subdirs",':'); 570 QStringList subDirs = conf.readListEntry("subdirs",':');
569 if (subDirs.isEmpty()) { 571 if (subDirs.isEmpty()) {
570 if (defPath.exists()) { 572 if (defPath.exists()) {
571 docPaths+=defPath.path(); 573 docPaths+=defPath.path();
572 } 574 }
573 return; 575 return;
574 } 576 }
575 for (unsigned c = 0; c < subDirs.count();++c) { 577 for (unsigned c = 0; c < subDirs.count();++c) {
576 QDir docDir(QString(fs->path()+"/"+subDirs[c])); 578 QDir docDir(QString(fs->path()+"/"+subDirs[c]));
577 if (docDir.exists()) { 579 if (docDir.exists()) {
578 docPaths+=docDir.path(); 580 docPaths+=docDir.path();
579 } 581 }
580 } 582 }
581} 583}
582 584
583void DocumentListPrivate::initialize() 585void DocumentListPrivate::initialize()
584{ 586{
585 // Reset 587 // Reset
586 dls.clear(); 588 dls.clear();
587 docPaths.clear(); 589 docPaths.clear();
588 reference.clear(); 590 reference.clear();
589 591
590 QDir docDir( QPEApplication::documentDir() ); 592 QDir docDir( QPEApplication::documentDir() );
591 if ( docDir.exists() ) 593 if ( docDir.exists() )
592 docPaths += QPEApplication::documentDir(); 594 docPaths += QPEApplication::documentDir();
593 int i = 1; 595 int i = 1;
594 const QList<FileSystem> &fs = storage->fileSystems(); 596 const QList<FileSystem> &fs = storage->fileSystems();
595 QListIterator<FileSystem> it( fs ); 597 QListIterator<FileSystem> it( fs );
596 for ( ; it.current(); ++it ) { 598 for ( ; it.current(); ++it ) {
597 if ( (*it)->isRemovable() ) { 599 if ( (*it)->isRemovable() ) {
598 appendDocpath((*it)); 600 appendDocpath((*it));
599 ++i; 601 ++i;
600 } 602 }
601 } 603 }
602 604
603 for ( int i = 0; i < MAX_SEARCH_DEPTH; ++i ) { 605 for ( int i = 0; i < MAX_SEARCH_DEPTH; ++i ) {
604 if ( listDirs[i] ) { 606 if ( listDirs[i] ) {
605 delete listDirs[i]; 607 delete listDirs[i];
606 listDirs[i] = 0; 608 listDirs[i] = 0;
607 } 609 }
608 lists[i] = 0; 610 lists[i] = 0;
609 listPositions[i] = 0; 611 listPositions[i] = 0;
610 } 612 }
611 613
612 docPathsSearched = 0; 614 docPathsSearched = 0;
613 searchDepth = -1; 615 searchDepth = -1;
614 state = Find; 616 state = Find;
615 dit = 0; 617 dit = 0;
616} 618}
617 619
618 620
619DocumentListPrivate::~DocumentListPrivate() 621DocumentListPrivate::~DocumentListPrivate()
620{ 622{
621 for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) 623 for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ )
622 if ( listDirs[i] ) 624 if ( listDirs[i] )
623 delete listDirs[i]; 625 delete listDirs[i];
624 delete dit; 626 delete dit;
625} 627}
626 628
627 629
628void DocumentListPrivate::estimatedPercentScanned() 630void DocumentListPrivate::estimatedPercentScanned()
629{ 631{
630 double overallProgress = 0.0; 632 double overallProgress = 0.0;
631 double levelWeight = 75.0; 633 double levelWeight = 75.0;
632 634
633 int topCount = docPaths.count(); 635 int topCount = docPaths.count();
634 if ( topCount > 1 ) { 636 if ( topCount > 1 ) {
635 levelWeight = levelWeight / topCount; 637 levelWeight = levelWeight / topCount;
636 overallProgress += (docPathsSearched - 1) * levelWeight; 638 overallProgress += (docPathsSearched - 1) * levelWeight;
637 } 639 }
638 640
639 for ( int d = 0; d <= searchDepth; d++ ) { 641 for ( int d = 0; d <= searchDepth; d++ ) {
640 if ( listDirs[d] ) { 642 if ( listDirs[d] ) {
641 int items = lists[d]->count(); 643 int items = lists[d]->count();
642 if ( items > 1 ) { 644 if ( items > 1 ) {
643 levelWeight = levelWeight / items; 645 levelWeight = levelWeight / items;
644 // Take in to account "." and ".." 646 // Take in to account "." and ".."
645 overallProgress += (listPositions[d] - 3) * levelWeight; 647 overallProgress += (listPositions[d] - 3) * levelWeight;
646 } 648 }
647 } else { 649 } else {
648 break; 650 break;
649 } 651 }
650 } 652 }
651 653
652 // odebug << "overallProgress: " << overallProgress << "" << oendl; 654 // odebug << "overallProgress: " << overallProgress << "" << oendl;
653 655
654 if ( serverGui ) 656 if ( serverGui )
655 serverGui->documentScanningProgress( (int)overallProgress ); 657 serverGui->documentScanningProgress( (int)overallProgress );
656} 658}
657 659
658 660
659const QString DocumentListPrivate::nextFile() 661const QString DocumentListPrivate::nextFile()
660{ 662{
661 while ( TRUE ) { 663 while ( TRUE ) {
662 while ( searchDepth < 0 ) { 664 while ( searchDepth < 0 ) {
663 // go to next base path 665 // go to next base path
664 if ( docPathsSearched >= docPaths.count() ) { 666 if ( docPathsSearched >= docPaths.count() ) {
665 // end of base paths 667 // end of base paths
666 return QString::null; 668 return QString::null;
667 } else { 669 } else {
668 QDir dir( docPaths[docPathsSearched] ); 670 QDir dir( docPaths[docPathsSearched] );
669 // odebug << "now using base path: " << docPaths[docPathsSearched] << "" << oendl; 671 // odebug << "now using base path: " << docPaths[docPathsSearched] << "" << oendl;
670 docPathsSearched++; 672 docPathsSearched++;
671 if ( !dir.exists( ".Qtopia-ignore" ) ) { 673 if ( !dir.exists( ".Qtopia-ignore" ) ) {
672 listDirs[0] = new QDir( dir ); 674 listDirs[0] = new QDir( dir );
673 lists[0] = listDirs[0]->entryInfoList(); 675 lists[0] = listDirs[0]->entryInfoList();
674 listPositions[0] = 0; 676 listPositions[0] = 0;
675 searchDepth = 0; 677 searchDepth = 0;
676 } 678 }
677 } 679 }
678 } 680 }
679 681
680 const QFileInfoList *fil = lists[searchDepth]; 682 const QFileInfoList *fil = lists[searchDepth];
681 if (!fil) { 683 if (!fil) {
682 return QString::null; 684 return QString::null;
683 } 685 }
684 QFileInfoList *fl = (QFileInfoList *)fil; 686 QFileInfoList *fl = (QFileInfoList *)fil;
685 unsigned int pos = listPositions[searchDepth]; 687 unsigned int pos = listPositions[searchDepth];
686 688
687 if ( pos >= fl->count() ) { 689 if ( pos >= fl->count() ) {
688 // go up a depth 690 // go up a depth
689 delete listDirs[searchDepth]; 691 delete listDirs[searchDepth];
690 listDirs[searchDepth] = 0; 692 listDirs[searchDepth] = 0;
691 lists[searchDepth] = 0; 693 lists[searchDepth] = 0;
692 listPositions[searchDepth] = 0; 694 listPositions[searchDepth] = 0;
693 searchDepth--; 695 searchDepth--;
694 } else { 696 } else {
695 const QFileInfo *fi = fl->at(pos); 697 const QFileInfo *fi = fl->at(pos);
696 listPositions[searchDepth]++; 698 listPositions[searchDepth]++;
697 QString bn = fi->fileName(); 699 QString bn = fi->fileName();
698 if ( bn[0] != '.' ) { 700 if ( bn[0] != '.' ) {
699 if ( fi->isDir() ) { 701 if ( fi->isDir() ) {
700 if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) { 702 if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) {
701 // go down a depth 703 // go down a depth
702 QDir dir( fi->filePath() ); 704 QDir dir( fi->filePath() );
703 // odebug << "now going in to path: " << bn << "" << oendl; 705 // odebug << "now going in to path: " << bn << "" << oendl;
704 if ( !dir.exists( ".Qtopia-ignore" ) ) { 706 if ( !dir.exists( ".Qtopia-ignore" ) ) {
705 if ( searchDepth < MAX_SEARCH_DEPTH - 1) { 707 if ( searchDepth < MAX_SEARCH_DEPTH - 1) {
706 searchDepth++; 708 searchDepth++;
707 listDirs[searchDepth] = new QDir( dir ); 709 listDirs[searchDepth] = new QDir( dir );
708 lists[searchDepth] = listDirs[searchDepth]->entryInfoList(); 710 lists[searchDepth] = listDirs[searchDepth]->entryInfoList();
709 listPositions[searchDepth] = 0; 711 listPositions[searchDepth] = 0;
710 } 712 }
711 } 713 }
712 } 714 }
713 } else { 715 } else {
714 estimatedPercentScanned(); 716 estimatedPercentScanned();
715 return fl->at(pos)->filePath(); 717 return fl->at(pos)->filePath();
716 } 718 }
717 } 719 }
718 } 720 }
719 } 721 }
720 722
721 return QString::null; 723 return QString::null;
722} 724}
723 725
724 726
725bool DocumentListPrivate::store( DocLnk* dl ) 727bool DocumentListPrivate::store( DocLnk* dl )
726{ 728{
727 // if ( dl->fileKnown() && !dl->file().isEmpty() ) { 729 // if ( dl->fileKnown() && !dl->file().isEmpty() ) {
728 if ( dl && dl->fileKnown() ) { 730 if ( dl && dl->fileKnown() ) {
729 dls.add( dl ); // store 731 dls.add( dl ); // store
730 return TRUE; 732 return TRUE;
731 } 733 }
732 734
733 // don't store - delete 735 // don't store - delete
734 delete dl; 736 delete dl;
735 return FALSE; 737 return FALSE;
736} 738}
737 739
738 740
739#define MAGIC_NUMBER ((void*)2) 741#define MAGIC_NUMBER ((void*)2)
740 742
741const DocLnk *DocumentListPrivate::iterate() 743const DocLnk *DocumentListPrivate::iterate()
742{ 744{
743 if ( state == Find ) { 745 if ( state == Find ) {
744 //odebug << "state Find" << oendl; 746 //odebug << "state Find" << oendl;
745 QString file = nextFile(); 747 QString file = nextFile();
746 while ( !file.isNull() ) { 748 while ( !file.isNull() ) {
747 if ( file.right(8) == ".desktop" ) { // No tr 749 if ( file.right(8) == ".desktop" ) { // No tr
748 DocLnk* dl = new DocLnk( file ); 750 DocLnk* dl = new DocLnk( file );
749 if ( store(dl) ) 751 if ( store(dl) )
750 return dl; 752 return dl;
751 } else { 753 } else {
752 reference.insert( file, MAGIC_NUMBER ); 754 reference.insert( file, MAGIC_NUMBER );
753 } 755 }
754 file = nextFile(); 756 file = nextFile();
755 } 757 }
756 state = RemoveKnownFiles; 758 state = RemoveKnownFiles;
757 759
758 if ( serverGui ) 760 if ( serverGui )
759 serverGui->documentScanningProgress( 75 ); 761 serverGui->documentScanningProgress( 75 );
760 } 762 }
761 763
762 static int iterationI; 764 static int iterationI;
763 static int iterationCount; 765 static int iterationCount;
764 766
765 if ( state == RemoveKnownFiles ) { 767 if ( state == RemoveKnownFiles ) {
766 //odebug << "state RemoveKnownFiles" << oendl; 768 //odebug << "state RemoveKnownFiles" << oendl;
767 const QList<DocLnk> &list = dls.children(); 769 const QList<DocLnk> &list = dls.children();
768 for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) { 770 for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) {
769 reference.remove( (*it)->file() ); 771 reference.remove( (*it)->file() );
770 // ### does this need to be deleted? 772 // ### does this need to be deleted?
771 } 773 }
772 dit = new QDictIterator<void>(reference); 774 dit = new QDictIterator<void>(reference);
773 state = MakeUnknownFiles; 775 state = MakeUnknownFiles;
774 776
775 iterationI = 0; 777 iterationI = 0;
776 iterationCount = dit->count(); 778 iterationCount = dit->count();
777 } 779 }
778 780
779 if ( state == MakeUnknownFiles ) { 781 if ( state == MakeUnknownFiles ) {
780 //odebug << "state MakeUnknownFiles" << oendl; 782 //odebug << "state MakeUnknownFiles" << oendl;
781 for (void* c; (c=dit->current()); ++(*dit) ) { 783 for (void* c; (c=dit->current()); ++(*dit) ) {
782 if ( c == MAGIC_NUMBER ) { 784 if ( c == MAGIC_NUMBER ) {
783 DocLnk* dl = new DocLnk; 785 DocLnk* dl = new DocLnk;
784 QFileInfo fi( dit->currentKey() ); 786 QFileInfo fi( dit->currentKey() );
785 dl->setFile( fi.filePath() ); 787 dl->setFile( fi.filePath() );
786 dl->setName( fi.baseName() ); 788 dl->setName( fi.baseName() );
787 if ( store(dl) ) { 789 if ( store(dl) ) {
788 ++*dit; 790 ++*dit;
789 iterationI++; 791 iterationI++;
790 if ( serverGui ) 792 if ( serverGui )
791 serverGui->documentScanningProgress( 75 + (25*iterationI)/iterationCount ); 793 serverGui->documentScanningProgress( 75 + (25*iterationI)/iterationCount );
792 return dl; 794 return dl;
793 } 795 }
794 } 796 }
795 iterationI++; 797 iterationI++;
796 } 798 }
797 799
798 delete dit; 800 delete dit;
799 dit = 0; 801 dit = 0;
800 state = Done; 802 state = Done;
801 } 803 }
802 804
803 //odebug << "state Done" << oendl; 805 //odebug << "state Done" << oendl;
804 return NULL; 806 return NULL;
805} 807}
806 808
807 809
808#include "documentlist.moc" 810#include "documentlist.moc"
809 811
810 812
811 813