author | llornkcor <llornkcor> | 2003-07-14 21:27:38 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-07-14 21:27:38 (UTC) |
commit | 115e09bdeb2ee3c7c0b9344f95179e1d10e86e48 (patch) (unidiff) | |
tree | e51a341aab0e6a3a1c932beabd73d52ceb4d37dd | |
parent | ab28f35bc3c9c184862ac19462322eed2be0f541 (diff) | |
download | opie-115e09bdeb2ee3c7c0b9344f95179e1d10e86e48.zip opie-115e09bdeb2ee3c7c0b9344f95179e1d10e86e48.tar.gz opie-115e09bdeb2ee3c7c0b9344f95179e1d10e86e48.tar.bz2 |
another fix
-rw-r--r-- | core/launcher/launcher.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 5f050aa..0205622 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -1,452 +1,452 @@ | |||
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 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | 21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT |
22 | // have this class. | 22 | // have this class. |
23 | #define QTOPIA_INTERNAL_FSLP | 23 | #define QTOPIA_INTERNAL_FSLP |
24 | 24 | ||
25 | //#include <opie/ofiledialog.h> | 25 | //#include <opie/ofiledialog.h> |
26 | #include <opie/ofileselector.h> | 26 | #include <opie/ofileselector.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include <qpe/applnk.h> | 29 | #include <qpe/applnk.h> |
30 | #include <qpe/config.h> | 30 | #include <qpe/config.h> |
31 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
34 | #include <qpe/storage.h> | 34 | #include <qpe/storage.h> |
35 | #include <qpe/palmtoprecord.h> | 35 | #include <qpe/palmtoprecord.h> |
36 | 36 | ||
37 | #include <qpe/version.h> | 37 | #include <qpe/version.h> |
38 | 38 | ||
39 | #include <qdir.h> | 39 | #include <qdir.h> |
40 | #ifdef QWS | 40 | #ifdef QWS |
41 | #include <qwindowsystem_qws.h> | 41 | #include <qwindowsystem_qws.h> |
42 | #endif | 42 | #endif |
43 | #include <qtimer.h> | 43 | #include <qtimer.h> |
44 | #include <qcombobox.h> | 44 | #include <qcombobox.h> |
45 | #include <qvbox.h> | 45 | #include <qvbox.h> |
46 | #include <qlayout.h> | 46 | #include <qlayout.h> |
47 | #include <qstyle.h> | 47 | #include <qstyle.h> |
48 | #include <qpushbutton.h> | 48 | #include <qpushbutton.h> |
49 | #include <qtabbar.h> | 49 | #include <qtabbar.h> |
50 | #include <qwidgetstack.h> | 50 | #include <qwidgetstack.h> |
51 | #include <qlayout.h> | 51 | #include <qlayout.h> |
52 | #include <qregexp.h> | 52 | #include <qregexp.h> |
53 | #include <qmessagebox.h> | 53 | #include <qmessagebox.h> |
54 | #include <qframe.h> | 54 | #include <qframe.h> |
55 | #include <qpainter.h> | 55 | #include <qpainter.h> |
56 | #include <qlabel.h> | 56 | #include <qlabel.h> |
57 | #include <qtextstream.h> | 57 | #include <qtextstream.h> |
58 | #include <qpopupmenu.h> | 58 | #include <qpopupmenu.h> |
59 | 59 | ||
60 | #include <opie/owait.h> | 60 | #include <opie/owait.h> |
61 | 61 | ||
62 | 62 | ||
63 | #include "launcherview.h" | 63 | #include "launcherview.h" |
64 | #include "launcher.h" | 64 | #include "launcher.h" |
65 | #include "syncdialog.h" | 65 | #include "syncdialog.h" |
66 | #include "desktop.h" | 66 | #include "desktop.h" |
67 | #include <qpe/lnkproperties.h> | 67 | #include <qpe/lnkproperties.h> |
68 | //#include "mrulist.h" | 68 | //#include "mrulist.h" |
69 | #include "qrsync.h" | 69 | #include "qrsync.h" |
70 | #include <stdlib.h> | 70 | #include <stdlib.h> |
71 | #include <unistd.h> | 71 | #include <unistd.h> |
72 | 72 | ||
73 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 73 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
74 | #include <stdio.h> | 74 | #include <stdio.h> |
75 | #include <sys/vfs.h> | 75 | #include <sys/vfs.h> |
76 | #include <mntent.h> | 76 | #include <mntent.h> |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | #include <qpe/storage.h> | 79 | #include <qpe/storage.h> |
80 | #include "mediummountgui.h" | 80 | #include "mediummountgui.h" |
81 | 81 | ||
82 | namespace { | 82 | namespace { |
83 | QStringList configToMime( Config *cfg ){ | 83 | QStringList configToMime( Config *cfg ){ |
84 | QStringList mimes; | 84 | QStringList mimes; |
85 | bool tmpMime = true; | 85 | bool tmpMime = true; |
86 | cfg->setGroup("mimetypes" ); | 86 | cfg->setGroup("mimetypes" ); |
87 | tmpMime = cfg->readBoolEntry("all" ,true); | 87 | tmpMime = cfg->readBoolEntry("all" ,true); |
88 | if( tmpMime ){ | 88 | if( tmpMime ){ |
89 | mimes << QString::null; | 89 | mimes << QString::null; |
90 | return mimes; | 90 | return mimes; |
91 | }else{ | 91 | }else{ |
92 | tmpMime = cfg->readBoolEntry("audio", true ); | 92 | tmpMime = cfg->readBoolEntry("audio", true ); |
93 | if(tmpMime ) | 93 | if(tmpMime ) |
94 | mimes.append("audio/*" ); | 94 | mimes.append("audio/*" ); |
95 | 95 | ||
96 | tmpMime = cfg->readBoolEntry("image", true ); | 96 | tmpMime = cfg->readBoolEntry("image", true ); |
97 | if(tmpMime ) | 97 | if(tmpMime ) |
98 | mimes.append("image/*" ); | 98 | mimes.append("image/*" ); |
99 | 99 | ||
100 | tmpMime = cfg->readBoolEntry("text", true ); | 100 | tmpMime = cfg->readBoolEntry("text", true ); |
101 | if(tmpMime ) | 101 | if(tmpMime ) |
102 | mimes.append("text/*"); | 102 | mimes.append("text/*"); |
103 | 103 | ||
104 | tmpMime = cfg->readBoolEntry("video", true ); | 104 | tmpMime = cfg->readBoolEntry("video", true ); |
105 | if(tmpMime ) | 105 | if(tmpMime ) |
106 | mimes.append("video/*" ); | 106 | mimes.append("video/*" ); |
107 | } | 107 | } |
108 | return mimes; | 108 | return mimes; |
109 | } | 109 | } |
110 | 110 | ||
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | 114 | ||
115 | //#define SHOW_ALL | 115 | //#define SHOW_ALL |
116 | 116 | ||
117 | class CategoryTab : public QTab | 117 | class CategoryTab : public QTab |
118 | { | 118 | { |
119 | public: | 119 | public: |
120 | CategoryTab( const QIconSet &icon, const QString &text=QString::null ) | 120 | CategoryTab( const QIconSet &icon, const QString &text=QString::null ) |
121 | : QTab( icon, text ) | 121 | : QTab( icon, text ) |
122 | { | 122 | { |
123 | } | 123 | } |
124 | 124 | ||
125 | QColor bgColor; | 125 | QColor bgColor; |
126 | QColor fgColor; | 126 | QColor fgColor; |
127 | }; | 127 | }; |
128 | 128 | ||
129 | //=========================================================================== | 129 | //=========================================================================== |
130 | 130 | ||
131 | CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : | 131 | CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : |
132 | QVBox( parent ) | 132 | QVBox( parent ) |
133 | { | 133 | { |
134 | categoryBar = 0; | 134 | categoryBar = 0; |
135 | stack = 0; | 135 | stack = 0; |
136 | } | 136 | } |
137 | 137 | ||
138 | void CategoryTabWidget::prevTab() | 138 | void CategoryTabWidget::prevTab() |
139 | { | 139 | { |
140 | if ( categoryBar ) { | 140 | if ( categoryBar ) { |
141 | int n = categoryBar->count(); | 141 | int n = categoryBar->count(); |
142 | int tab = categoryBar->currentTab(); | 142 | int tab = categoryBar->currentTab(); |
143 | if ( tab >= 0 ) | 143 | if ( tab >= 0 ) |
144 | categoryBar->setCurrentTab( (tab - 1 + n)%n ); | 144 | categoryBar->setCurrentTab( (tab - 1 + n)%n ); |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | void CategoryTabWidget::nextTab() | 148 | void CategoryTabWidget::nextTab() |
149 | { | 149 | { |
150 | if ( categoryBar ) { | 150 | if ( categoryBar ) { |
151 | int n = categoryBar->count(); | 151 | int n = categoryBar->count(); |
152 | int tab = categoryBar->currentTab(); | 152 | int tab = categoryBar->currentTab(); |
153 | categoryBar->setCurrentTab( (tab + 1)%n ); | 153 | categoryBar->setCurrentTab( (tab + 1)%n ); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
157 | 157 | ||
158 | void CategoryTabWidget::showTab(const QString& id) | 158 | void CategoryTabWidget::showTab(const QString& id) |
159 | { | 159 | { |
160 | if ( categoryBar ) { | 160 | if ( categoryBar ) { |
161 | int idx = ids.findIndex( id ); | 161 | int idx = ids.findIndex( id ); |
162 | categoryBar->setCurrentTab( idx ); | 162 | categoryBar->setCurrentTab( idx ); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | void CategoryTabWidget::addItem( const QString& linkfile ) | 166 | void CategoryTabWidget::addItem( const QString& linkfile ) |
167 | { | 167 | { |
168 | int i=0; | 168 | // int i=0; |
169 | AppLnk *app = new AppLnk(linkfile); | 169 | // AppLnk *app = new AppLnk(linkfile); |
170 | if ( !app->isValid() ) { | 170 | // if ( !app->isValid() ) { |
171 | delete app; | 171 | // delete app; |
172 | app=0; | 172 | // app=0; |
173 | } | 173 | // } |
174 | if ( !app || !app->file().isEmpty() ) { | 174 | // if ( !app || !app->file().isEmpty() ) { |
175 | // A document | 175 | // A document |
176 | // delete app; | 176 | // delete app; |
177 | // app = new DocLnk(linkfile); | 177 | // app = new DocLnk(linkfile); |
178 | // if ( app->fileKnown() ) { | 178 | // if ( app->fileKnown() ) { |
179 | // ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); | 179 | // ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); |
180 | // } else { | 180 | // } else { |
181 | // ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); | 181 | // ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); |
182 | // delete app; | 182 | // delete app; |
183 | // } | 183 | // } |
184 | return; | 184 | // return; |
185 | } | 185 | // } |
186 | // An application | 186 | // An application |
187 | for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { | 187 | // for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { |
188 | if ( !(*it).isEmpty() ) { | 188 | // if ( !(*it).isEmpty() ) { |
189 | QRegExp tf(*it,FALSE,TRUE); | 189 | // QRegExp tf(*it,FALSE,TRUE); |
190 | if ( tf.match(app->type()) >= 0 ) { | 190 | // if ( tf.match(app->type()) >= 0 ) { |
191 | ((LauncherView*)stack->widget(i))->addItem(app); | 191 | // ((LauncherView*)stack->widget(i))->addItem(app); |
192 | return; | 192 | // return; |
193 | } | 193 | // } |
194 | i++; | 194 | // i++; |
195 | } | 195 | // } |
196 | } | 196 | // } |
197 | 197 | ||
198 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); | 198 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); |
199 | } | 199 | } |
200 | 200 | ||
201 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | 201 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, |
202 | AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/) | 202 | AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/) |
203 | { | 203 | { |
204 | QString current; | 204 | QString current; |
205 | if ( categoryBar ) { | 205 | if ( categoryBar ) { |
206 | int c = categoryBar->currentTab(); | 206 | int c = categoryBar->currentTab(); |
207 | if ( c >= 0 ) current = ids[c]; | 207 | if ( c >= 0 ) current = ids[c]; |
208 | } | 208 | } |
209 | 209 | ||
210 | delete categoryBar; | 210 | delete categoryBar; |
211 | categoryBar = new CategoryTabBar( this ); | 211 | categoryBar = new CategoryTabBar( this ); |
212 | QPalette pal = categoryBar->palette(); | 212 | QPalette pal = categoryBar->palette(); |
213 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 213 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
214 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 214 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
215 | categoryBar->setPalette( pal ); | 215 | categoryBar->setPalette( pal ); |
216 | 216 | ||
217 | delete stack; | 217 | delete stack; |
218 | stack = new QWidgetStack(this); | 218 | stack = new QWidgetStack(this); |
219 | tabs=0; | 219 | tabs=0; |
220 | 220 | ||
221 | ids.clear(); | 221 | ids.clear(); |
222 | 222 | ||
223 | Config cfg("Launcher"); | 223 | Config cfg("Launcher"); |
224 | 224 | ||
225 | QStringList types = rootFolder->types(); | 225 | QStringList types = rootFolder->types(); |
226 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { | 226 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { |
227 | if ( !(*it).isEmpty() ) { | 227 | if ( !(*it).isEmpty() ) { |
228 | (void)newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); | 228 | (void)newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); |
229 | setTabAppearance( *it, cfg ); | 229 | setTabAppearance( *it, cfg ); |
230 | } | 230 | } |
231 | } | 231 | } |
232 | QListIterator<AppLnk> it( rootFolder->children() ); | 232 | QListIterator<AppLnk> it( rootFolder->children() ); |
233 | AppLnk* l; | 233 | AppLnk* l; |
234 | while ( (l=it.current()) ) { | 234 | while ( (l=it.current()) ) { |
235 | if ( l->type() == "Separator" ) { // No tr | 235 | if ( l->type() == "Separator" ) { // No tr |
236 | rootFolder->remove(l); | 236 | rootFolder->remove(l); |
237 | delete l; | 237 | delete l; |
238 | } else { | 238 | } else { |
239 | int i=0; | 239 | int i=0; |
240 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { | 240 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { |
241 | if ( *it == l->type() ) | 241 | if ( *it == l->type() ) |
242 | ((LauncherView*)stack->widget(i))->addItem(l,FALSE); | 242 | ((LauncherView*)stack->widget(i))->addItem(l,FALSE); |
243 | i++; | 243 | i++; |
244 | } | 244 | } |
245 | } | 245 | } |
246 | ++it; | 246 | ++it; |
247 | } | 247 | } |
248 | rootFolder->detachChildren(); | 248 | rootFolder->detachChildren(); |
249 | for (int i=0; i<tabs; i++) | 249 | for (int i=0; i<tabs; i++) |
250 | ((LauncherView*)stack->widget(i))->sort(); | 250 | ((LauncherView*)stack->widget(i))->sort(); |
251 | 251 | ||
252 | // all documents | 252 | // all documents |
253 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 253 | QImage img( Resource::loadImage( "DocsIcon" ) ); |
254 | QPixmap pm; | 254 | QPixmap pm; |
255 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 255 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
256 | 256 | ||
257 | //ljpotter | 257 | //ljpotter |
258 | CategoryTab *catTab ; | 258 | CategoryTab *catTab ; |
259 | catTab = new CategoryTab( pm, "Documents" ); | 259 | catTab = new CategoryTab( pm, "Documents" ); |
260 | 260 | ||
261 | categoryBar->addTab( catTab ); | 261 | categoryBar->addTab( catTab ); |
262 | 262 | ||
263 | fileSel = new DocumentTab( stack, 4, 0, "/",""); | 263 | fileSel = new DocumentTab( stack, 4, 0, "/",""); |
264 | stack->addWidget( fileSel, tabs++ ); | 264 | stack->addWidget( fileSel, tabs++ ); |
265 | 265 | ||
266 | // fileSel->hide(); | 266 | // fileSel->hide(); |
267 | 267 | ||
268 | connect( fileSel, SIGNAL( fileSelected( const DocLnk & )), | 268 | connect( fileSel, SIGNAL( fileSelected( const DocLnk & )), |
269 | this, SLOT(clickie(const DocLnk&)) ); | 269 | this, SLOT(clickie(const DocLnk&)) ); |
270 | 270 | ||
271 | // connect( fileSel, SIGNAL( fileSelected( const QString & )), | 271 | // connect( fileSel, SIGNAL( fileSelected( const QString & )), |
272 | // this, SLOT(clickie(const QString&)) ); | 272 | // this, SLOT(clickie(const QString&)) ); |
273 | 273 | ||
274 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); | 274 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); |
275 | 275 | ||
276 | ((LauncherView*)stack->widget(0))->setFocus(); | 276 | ((LauncherView*)stack->widget(0))->setFocus(); |
277 | 277 | ||
278 | cfg. setGroup ( "GUI" ); | 278 | cfg. setGroup ( "GUI" ); |
279 | setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null )); | 279 | setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null )); |
280 | 280 | ||
281 | if ( !current.isNull() ) { | 281 | if ( !current.isNull() ) { |
282 | showTab(current); | 282 | showTab(current); |
283 | } | 283 | } |
284 | 284 | ||
285 | categoryBar->show(); | 285 | categoryBar->show(); |
286 | stack->show(); | 286 | stack->show(); |
287 | 287 | ||
288 | 288 | ||
289 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); | 289 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); |
290 | } | 290 | } |
291 | 291 | ||
292 | void CategoryTabWidget::clickie(const DocLnk &lnk) { | 292 | void CategoryTabWidget::clickie(const DocLnk &lnk) { |
293 | lnk.execute(); | 293 | lnk.execute(); |
294 | // fileSel->reparse(); | 294 | // fileSel->reparse(); |
295 | } | 295 | } |
296 | 296 | ||
297 | void CategoryTabWidget::clickie(const QString &appStr) { | 297 | void CategoryTabWidget::clickie(const QString &appStr) { |
298 | // DocLnk lnk(appStr); | 298 | // DocLnk lnk(appStr); |
299 | // lnk.execute(); | 299 | // lnk.execute(); |
300 | } | 300 | } |
301 | 301 | ||
302 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) | 302 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) |
303 | { | 303 | { |
304 | QString grp( "Tab %1" ); // No tr | 304 | QString grp( "Tab %1" ); // No tr |
305 | cfg.setGroup( grp.arg(id) ); | 305 | cfg.setGroup( grp.arg(id) ); |
306 | LauncherView *v = view( id ); | 306 | LauncherView *v = view( id ); |
307 | int idx = ids.findIndex( id ); | 307 | int idx = ids.findIndex( id ); |
308 | CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx ); | 308 | CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx ); |
309 | 309 | ||
310 | // View | 310 | // View |
311 | QString view = cfg.readEntry( "View", "Icon" ); | 311 | QString view = cfg.readEntry( "View", "Icon" ); |
312 | if ( view == "List" ) // No tr | 312 | if ( view == "List" ) // No tr |
313 | v->setViewMode( LauncherView::List ); | 313 | v->setViewMode( LauncherView::List ); |
314 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); | 314 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); |
315 | if ( bgType == "Image" ) { // No tr | 315 | if ( bgType == "Image" ) { // No tr |
316 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); | 316 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); |
317 | v->setBackgroundType( LauncherView::Image, pm ); | 317 | v->setBackgroundType( LauncherView::Image, pm ); |
318 | } else if ( bgType == "SolidColor" ) { | 318 | } else if ( bgType == "SolidColor" ) { |
319 | QString c = cfg.readEntry( "BackgroundColor" ); | 319 | QString c = cfg.readEntry( "BackgroundColor" ); |
320 | v->setBackgroundType( LauncherView::SolidColor, c ); | 320 | v->setBackgroundType( LauncherView::SolidColor, c ); |
321 | } | 321 | } |
322 | QString textCol = cfg.readEntry( "TextColor" ); | 322 | QString textCol = cfg.readEntry( "TextColor" ); |
323 | if ( textCol.isEmpty() ) | 323 | if ( textCol.isEmpty() ) |
324 | v->setTextColor( QColor() ); | 324 | v->setTextColor( QColor() ); |
325 | else | 325 | else |
326 | v->setTextColor( QColor(textCol) ); | 326 | v->setTextColor( QColor(textCol) ); |
327 | QStringList font = cfg.readListEntry( "Font", ',' ); | 327 | QStringList font = cfg.readListEntry( "Font", ',' ); |
328 | if ( font.count() == 4 ) | 328 | if ( font.count() == 4 ) |
329 | v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); | 329 | v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); |
330 | 330 | ||
331 | // Tabs | 331 | // Tabs |
332 | QString tabCol = cfg.readEntry( "TabColor" ); | 332 | QString tabCol = cfg.readEntry( "TabColor" ); |
333 | if ( tabCol.isEmpty() ) | 333 | if ( tabCol.isEmpty() ) |
334 | tab->bgColor = QColor(); | 334 | tab->bgColor = QColor(); |
335 | else | 335 | else |
336 | tab->bgColor = QColor(tabCol); | 336 | tab->bgColor = QColor(tabCol); |
337 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); | 337 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); |
338 | if ( tabTextCol.isEmpty() ) | 338 | if ( tabTextCol.isEmpty() ) |
339 | tab->fgColor = QColor(); | 339 | tab->fgColor = QColor(); |
340 | else | 340 | else |
341 | tab->fgColor = QColor(tabTextCol); | 341 | tab->fgColor = QColor(tabTextCol); |
342 | } | 342 | } |
343 | 343 | ||
344 | //void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/) | 344 | //void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/) |
345 | //{ | 345 | //{ |
346 | // docFolder->detachChildren(); | 346 | // docFolder->detachChildren(); |
347 | //} | 347 | //} |
348 | 348 | ||
349 | void CategoryTabWidget::tabProperties() | 349 | void CategoryTabWidget::tabProperties() |
350 | { | 350 | { |
351 | LauncherView *view = (LauncherView*)stack->widget( categoryBar->currentTab() ); | 351 | LauncherView *view = (LauncherView*)stack->widget( categoryBar->currentTab() ); |
352 | QPopupMenu *m = new QPopupMenu( this ); | 352 | QPopupMenu *m = new QPopupMenu( this ); |
353 | m->insertItem( tr("Icon View"), LauncherView::Icon ); | 353 | m->insertItem( tr("Icon View"), LauncherView::Icon ); |
354 | m->insertItem( tr("List View"), LauncherView::List ); | 354 | m->insertItem( tr("List View"), LauncherView::List ); |
355 | m->setItemChecked( (int)view->viewMode(), TRUE ); | 355 | m->setItemChecked( (int)view->viewMode(), TRUE ); |
356 | int rv = m->exec( QCursor::pos() ); | 356 | int rv = m->exec( QCursor::pos() ); |
357 | if ( rv >= 0 && rv != view->viewMode() ) { | 357 | if ( rv >= 0 && rv != view->viewMode() ) { |
358 | view->setViewMode( (LauncherView::ViewMode)rv ); | 358 | view->setViewMode( (LauncherView::ViewMode)rv ); |
359 | } | 359 | } |
360 | 360 | ||
361 | delete m; | 361 | delete m; |
362 | } | 362 | } |
363 | 363 | ||
364 | QString CategoryTabWidget::getAllDocLinkInfo() const | 364 | QString CategoryTabWidget::getAllDocLinkInfo() const |
365 | { | 365 | { |
366 | return ""; | 366 | return ""; |
367 | } | 367 | } |
368 | 368 | ||
369 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) | 369 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) |
370 | { | 370 | { |
371 | LauncherView* view = new LauncherView( stack ); | 371 | LauncherView* view = new LauncherView( stack ); |
372 | connect( view, SIGNAL(clicked(const AppLnk*)), | 372 | connect( view, SIGNAL(clicked(const AppLnk*)), |
373 | this, SIGNAL(clicked(const AppLnk*))); | 373 | this, SIGNAL(clicked(const AppLnk*))); |
374 | connect( view, SIGNAL(rightPressed(AppLnk*)), | 374 | connect( view, SIGNAL(rightPressed(AppLnk*)), |
375 | this, SIGNAL(rightPressed(AppLnk*))); | 375 | this, SIGNAL(rightPressed(AppLnk*))); |
376 | ids.append(id); | 376 | ids.append(id); |
377 | categoryBar->addTab( new CategoryTab( pm, label ) ); | 377 | categoryBar->addTab( new CategoryTab( pm, label ) ); |
378 | stack->addWidget( view, tabs++ ); | 378 | stack->addWidget( view, tabs++ ); |
379 | return view; | 379 | return view; |
380 | } | 380 | } |
381 | 381 | ||
382 | void CategoryTabWidget::updateLink(const QString& linkfile) | 382 | void CategoryTabWidget::updateLink(const QString& linkfile) |
383 | { | 383 | { |
384 | // LauncherView* view; | 384 | // LauncherView* view; |
385 | qApp->processEvents(); | 385 | qApp->processEvents(); |
386 | // while ((view = (LauncherView*)stack->widget(i++))) { | 386 | // while ((view = (LauncherView*)stack->widget(i++))) { |
387 | // if ( view->removeLink(linkfile) ) | 387 | // if ( view->removeLink(linkfile) ) |
388 | // break; | 388 | // break; |
389 | // } | 389 | // } |
390 | // addItem(linkfile); | 390 | // addItem(linkfile); |
391 | fileSel->reparse(); | 391 | fileSel->reparse(); |
392 | } | 392 | } |
393 | 393 | ||
394 | void CategoryTabWidget::paletteChange( const QPalette &p ) | 394 | void CategoryTabWidget::paletteChange( const QPalette &p ) |
395 | { | 395 | { |
396 | QVBox::paletteChange( p ); | 396 | QVBox::paletteChange( p ); |
397 | QPalette pal = palette(); | 397 | QPalette pal = palette(); |
398 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 398 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
399 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 399 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
400 | categoryBar->setPalette( pal ); | 400 | categoryBar->setPalette( pal ); |
401 | categoryBar->update(); | 401 | categoryBar->update(); |
402 | } | 402 | } |
403 | 403 | ||
404 | void CategoryTabWidget::setBusy(bool on) | 404 | void CategoryTabWidget::setBusy(bool on) |
405 | { | 405 | { |
406 | if ( on ) | 406 | if ( on ) |
407 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); | 407 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); |
408 | else | 408 | else |
409 | for (int i=0; i<tabs-1; i++) | 409 | for (int i=0; i<tabs-1; i++) |
410 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); | 410 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); |
411 | } | 411 | } |
412 | 412 | ||
413 | LauncherView *CategoryTabWidget::view( const QString &id ) | 413 | LauncherView *CategoryTabWidget::view( const QString &id ) |
414 | { | 414 | { |
415 | int idx = ids.findIndex( id ); | 415 | int idx = ids.findIndex( id ); |
416 | return (LauncherView *)stack->widget(idx); | 416 | return (LauncherView *)stack->widget(idx); |
417 | } | 417 | } |
418 | 418 | ||
419 | void CategoryTabWidget::setBusyIndicatorType ( const QString &type ) | 419 | void CategoryTabWidget::setBusyIndicatorType ( const QString &type ) |
420 | { | 420 | { |
421 | for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it ) | 421 | for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it ) |
422 | view ( *it )-> setBusyIndicatorType ( type ); | 422 | view ( *it )-> setBusyIndicatorType ( type ); |
423 | } | 423 | } |
424 | 424 | ||
425 | //=========================================================================== | 425 | //=========================================================================== |
426 | 426 | ||
427 | CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name ) | 427 | CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name ) |
428 | : QTabBar( parent, name ) | 428 | : QTabBar( parent, name ) |
429 | { | 429 | { |
430 | setFocusPolicy( NoFocus ); | 430 | setFocusPolicy( NoFocus ); |
431 | connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) ); | 431 | connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) ); |
432 | } | 432 | } |
433 | 433 | ||
434 | CategoryTabBar::~CategoryTabBar() | 434 | CategoryTabBar::~CategoryTabBar() |
435 | { | 435 | { |
436 | } | 436 | } |
437 | 437 | ||
438 | void CategoryTabBar::layoutTabs() | 438 | void CategoryTabBar::layoutTabs() |
439 | { | 439 | { |
440 | if ( !count() ) | 440 | if ( !count() ) |
441 | return; | 441 | return; |
442 | 442 | ||
443 | // int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 }; | 443 | // int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 }; |
444 | int available = width()-1; | 444 | int available = width()-1; |
445 | QFontMetrics fm = fontMetrics(); | 445 | QFontMetrics fm = fontMetrics(); |
446 | int hiddenTabWidth = -7; | 446 | int hiddenTabWidth = -7; |
447 | int middleTab = currentTab(); | 447 | int middleTab = currentTab(); |
448 | int hframe, vframe, overlap; | 448 | int hframe, vframe, overlap; |
449 | style().tabbarMetrics( this, hframe, vframe, overlap ); | 449 | style().tabbarMetrics( this, hframe, vframe, overlap ); |
450 | int x = 0; | 450 | int x = 0; |
451 | QRect r; | 451 | QRect r; |
452 | QTab *t; | 452 | QTab *t; |
@@ -1089,267 +1089,267 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
1089 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " | 1089 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " |
1090 | + QString::number( (*it)->availBlocks() * k4/4 ) | 1090 | + QString::number( (*it)->availBlocks() * k4/4 ) |
1091 | + "K " + (*it)->options() + ";"; | 1091 | + "K " + (*it)->options() + ";"; |
1092 | } else if ( (*it)->disk() == "/dev/mtdblock1" || | 1092 | } else if ( (*it)->disk() == "/dev/mtdblock1" || |
1093 | (*it)->disk() == "/dev/mtdblock/1" ) { | 1093 | (*it)->disk() == "/dev/mtdblock/1" ) { |
1094 | s += (*it)->name() + "=" + homeDir + "/Documents " | 1094 | s += (*it)->name() + "=" + homeDir + "/Documents " |
1095 | + QString::number( (*it)->availBlocks() * k4/4 ) | 1095 | + QString::number( (*it)->availBlocks() * k4/4 ) |
1096 | + "K " + (*it)->options() + ";"; | 1096 | + "K " + (*it)->options() + ";"; |
1097 | } else if ( (*it)->name().contains( "Hard Disk") && | 1097 | } else if ( (*it)->name().contains( "Hard Disk") && |
1098 | homeDir.contains( (*it)->path() ) && | 1098 | homeDir.contains( (*it)->path() ) && |
1099 | (*it)->path().length() > hardDiskHomePath.length() ) { | 1099 | (*it)->path().length() > hardDiskHomePath.length() ) { |
1100 | hardDiskHomePath = (*it)->path(); | 1100 | hardDiskHomePath = (*it)->path(); |
1101 | hardDiskHome = | 1101 | hardDiskHome = |
1102 | (*it)->name() + "=" + homeDir + "/Documents " | 1102 | (*it)->name() + "=" + homeDir + "/Documents " |
1103 | + QString::number( (*it)->availBlocks() * k4/4 ) | 1103 | + QString::number( (*it)->availBlocks() * k4/4 ) |
1104 | + "K " + (*it)->options() + ";"; | 1104 | + "K " + (*it)->options() + ";"; |
1105 | } | 1105 | } |
1106 | } | 1106 | } |
1107 | if ( !hardDiskHome.isEmpty() ) | 1107 | if ( !hardDiskHome.isEmpty() ) |
1108 | s += hardDiskHome; | 1108 | s += hardDiskHome; |
1109 | 1109 | ||
1110 | #ifndef QT_NO_COP | 1110 | #ifndef QT_NO_COP |
1111 | e << s; | 1111 | e << s; |
1112 | #endif | 1112 | #endif |
1113 | } else if ( msg == "sendSyncDate(QString)" ) { | 1113 | } else if ( msg == "sendSyncDate(QString)" ) { |
1114 | QString app; | 1114 | QString app; |
1115 | stream >> app; | 1115 | stream >> app; |
1116 | Config cfg( "qpe" ); | 1116 | Config cfg( "qpe" ); |
1117 | cfg.setGroup("SyncDate"); | 1117 | cfg.setGroup("SyncDate"); |
1118 | #ifndef QT_NO_COP | 1118 | #ifndef QT_NO_COP |
1119 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); | 1119 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); |
1120 | e << app << cfg.readEntry( app ); | 1120 | e << app << cfg.readEntry( app ); |
1121 | #endif | 1121 | #endif |
1122 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), | 1122 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), |
1123 | //cfg.readEntry( app ).latin1() ); | 1123 | //cfg.readEntry( app ).latin1() ); |
1124 | } else if ( msg == "setSyncDate(QString,QString)" ) { | 1124 | } else if ( msg == "setSyncDate(QString,QString)" ) { |
1125 | QString app, date; | 1125 | QString app, date; |
1126 | stream >> app >> date; | 1126 | stream >> app >> date; |
1127 | Config cfg( "qpe" ); | 1127 | Config cfg( "qpe" ); |
1128 | cfg.setGroup("SyncDate"); | 1128 | cfg.setGroup("SyncDate"); |
1129 | cfg.writeEntry( app, date ); | 1129 | cfg.writeEntry( app, date ); |
1130 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); | 1130 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); |
1131 | } else if ( msg == "startSync(QString)" ) { | 1131 | } else if ( msg == "startSync(QString)" ) { |
1132 | QString what; | 1132 | QString what; |
1133 | stream >> what; | 1133 | stream >> what; |
1134 | delete syncDialog; syncDialog = 0; | 1134 | delete syncDialog; syncDialog = 0; |
1135 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, | 1135 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, |
1136 | WStyle_Tool | WStyle_Customize | | 1136 | WStyle_Tool | WStyle_Customize | |
1137 | Qt::WStyle_StaysOnTop ); | 1137 | Qt::WStyle_StaysOnTop ); |
1138 | syncDialog->showMaximized(); | 1138 | syncDialog->showMaximized(); |
1139 | syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); | 1139 | syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); |
1140 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), | 1140 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), |
1141 | SLOT( cancelSync() ) ); | 1141 | SLOT( cancelSync() ) ); |
1142 | } else if ( msg == "stopSync()") { | 1142 | } else if ( msg == "stopSync()") { |
1143 | delete syncDialog; syncDialog = 0; | 1143 | delete syncDialog; syncDialog = 0; |
1144 | } else if ( msg == "getAllDocLinks()" ) { | 1144 | } else if ( msg == "getAllDocLinks()" ) { |
1145 | loadDocs(); | 1145 | loadDocs(); |
1146 | 1146 | ||
1147 | // directly show updated docs in document tab | 1147 | // directly show updated docs in document tab |
1148 | updateDocs(); | 1148 | updateDocs(); |
1149 | 1149 | ||
1150 | QString contents; | 1150 | QString contents; |
1151 | 1151 | ||
1152 | // Categories cats; | 1152 | // Categories cats; |
1153 | for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { | 1153 | for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { |
1154 | DocLnk *doc = it.current(); | 1154 | DocLnk *doc = it.current(); |
1155 | QFileInfo fi( doc->file() ); | 1155 | QFileInfo fi( doc->file() ); |
1156 | if ( !fi.exists() ) | 1156 | if ( !fi.exists() ) |
1157 | continue; | 1157 | continue; |
1158 | 1158 | ||
1159 | bool fake = !doc->linkFileKnown(); | 1159 | bool fake = !doc->linkFileKnown(); |
1160 | if ( !fake ) { | 1160 | if ( !fake ) { |
1161 | QFile f( doc->linkFile() ); | 1161 | QFile f( doc->linkFile() ); |
1162 | if ( f.open( IO_ReadOnly ) ) { | 1162 | if ( f.open( IO_ReadOnly ) ) { |
1163 | QTextStream ts( &f ); | 1163 | QTextStream ts( &f ); |
1164 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | 1164 | ts.setEncoding( QTextStream::UnicodeUTF8 ); |
1165 | contents += ts.read(); | 1165 | contents += ts.read(); |
1166 | f.close(); | 1166 | f.close(); |
1167 | } else | 1167 | } else |
1168 | fake = TRUE; | 1168 | fake = TRUE; |
1169 | } | 1169 | } |
1170 | if (fake) { | 1170 | if (fake) { |
1171 | contents += "[Desktop Entry]\n"; | 1171 | contents += "[Desktop Entry]\n"; |
1172 | contents += "Categories = " + // No tr | 1172 | contents += "Categories = " + // No tr |
1173 | // cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr | 1173 | // cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr |
1174 | Qtopia::Record::idsToString( doc->categories() ) + "\n"; | 1174 | Qtopia::Record::idsToString( doc->categories() ) + "\n"; |
1175 | contents += "Name = "+doc->name()+"\n"; // No tr | 1175 | contents += "Name = "+doc->name()+"\n"; // No tr |
1176 | contents += "Type = "+doc->type()+"\n"; // No tr | 1176 | contents += "Type = "+doc->type()+"\n"; // No tr |
1177 | } | 1177 | } |
1178 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) | 1178 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) |
1179 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr | 1179 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr |
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | //qDebug( "sending length %d", contents.length() ); | 1182 | //qDebug( "sending length %d", contents.length() ); |
1183 | #ifndef QT_NO_COP | 1183 | #ifndef QT_NO_COP |
1184 | QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); | 1184 | QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); |
1185 | e << contents; | 1185 | e << contents; |
1186 | #endif | 1186 | #endif |
1187 | 1187 | ||
1188 | //qDebug( "================ \n\n%s\n\n===============", | 1188 | //qDebug( "================ \n\n%s\n\n===============", |
1189 | //contents.latin1() ); | 1189 | //contents.latin1() ); |
1190 | 1190 | ||
1191 | delete docsFolder; | 1191 | delete docsFolder; |
1192 | docsFolder = 0; | 1192 | docsFolder = 0; |
1193 | #ifdef QWS | 1193 | #ifdef QWS |
1194 | } else if ( msg == "setMouseProto(QString)" ) { | 1194 | } else if ( msg == "setMouseProto(QString)" ) { |
1195 | QString mice; | 1195 | QString mice; |
1196 | stream >> mice; | 1196 | stream >> mice; |
1197 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); | 1197 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); |
1198 | qwsServer->openMouse(); | 1198 | qwsServer->openMouse(); |
1199 | } else if ( msg == "setKeyboard(QString)" ) { | 1199 | } else if ( msg == "setKeyboard(QString)" ) { |
1200 | QString kb; | 1200 | QString kb; |
1201 | stream >> kb; | 1201 | stream >> kb; |
1202 | setenv("QWS_KEYBOARD",kb.latin1(),1); | 1202 | setenv("QWS_KEYBOARD",kb.latin1(),1); |
1203 | qwsServer->openKeyboard(); | 1203 | qwsServer->openKeyboard(); |
1204 | #endif | 1204 | #endif |
1205 | } | 1205 | } |
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | void Launcher::cancelSync() | 1208 | void Launcher::cancelSync() |
1209 | { | 1209 | { |
1210 | #ifndef QT_NO_COP | 1210 | #ifndef QT_NO_COP |
1211 | QCopEnvelope e( "QPE/Desktop", "cancelSync()" ); | 1211 | QCopEnvelope e( "QPE/Desktop", "cancelSync()" ); |
1212 | #endif | 1212 | #endif |
1213 | } | 1213 | } |
1214 | 1214 | ||
1215 | void Launcher::launcherMessage( const QCString &msg, const QByteArray &data) | 1215 | void Launcher::launcherMessage( const QCString &msg, const QByteArray &data) |
1216 | { | 1216 | { |
1217 | QDataStream stream( data, IO_ReadOnly ); | 1217 | QDataStream stream( data, IO_ReadOnly ); |
1218 | if ( msg == "setTabView(QString,int)" ) { | 1218 | if ( msg == "setTabView(QString,int)" ) { |
1219 | QString id; | 1219 | QString id; |
1220 | stream >> id; | 1220 | stream >> id; |
1221 | int mode; | 1221 | int mode; |
1222 | stream >> mode; | 1222 | stream >> mode; |
1223 | if ( tabs->view(id) ) | 1223 | if ( tabs->view(id) ) |
1224 | tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode ); | 1224 | tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode ); |
1225 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { | 1225 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { |
1226 | QString id; | 1226 | QString id; |
1227 | stream >> id; | 1227 | stream >> id; |
1228 | int mode; | 1228 | int mode; |
1229 | stream >> mode; | 1229 | stream >> mode; |
1230 | QString pixmapOrColor; | 1230 | QString pixmapOrColor; |
1231 | stream >> pixmapOrColor; | 1231 | stream >> pixmapOrColor; |
1232 | if ( tabs->view(id) ) | 1232 | if ( tabs->view(id) ) |
1233 | tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); | 1233 | tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); |
1234 | } else if ( msg == "setTextColor(QString,QString)" ) { | 1234 | } else if ( msg == "setTextColor(QString,QString)" ) { |
1235 | QString id; | 1235 | QString id; |
1236 | stream >> id; | 1236 | stream >> id; |
1237 | QString color; | 1237 | QString color; |
1238 | stream >> color; | 1238 | stream >> color; |
1239 | if ( tabs->view(id) ) | 1239 | if ( tabs->view(id) ) |
1240 | tabs->view(id)->setTextColor( QColor(color) ); | 1240 | tabs->view(id)->setTextColor( QColor(color) ); |
1241 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { | 1241 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { |
1242 | QString id; | 1242 | QString id; |
1243 | stream >> id; | 1243 | stream >> id; |
1244 | QString fam; | 1244 | QString fam; |
1245 | stream >> fam; | 1245 | stream >> fam; |
1246 | int size; | 1246 | int size; |
1247 | stream >> size; | 1247 | stream >> size; |
1248 | int weight; | 1248 | int weight; |
1249 | stream >> weight; | 1249 | stream >> weight; |
1250 | int italic; | 1250 | int italic; |
1251 | stream >> italic; | 1251 | stream >> italic; |
1252 | if ( tabs->view(id) ) | 1252 | if ( tabs->view(id) ) |
1253 | if ( !fam. isEmpty ( )) | 1253 | if ( !fam. isEmpty ( )) |
1254 | tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); | 1254 | tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); |
1255 | else | 1255 | else |
1256 | tabs->view(id)->unsetViewFont(); | 1256 | tabs->view(id)->unsetViewFont(); |
1257 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); | 1257 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); |
1258 | } | 1258 | } |
1259 | else if ( msg == "setBusyIndicatorType(QString)" ) { | 1259 | else if ( msg == "setBusyIndicatorType(QString)" ) { |
1260 | QString type; | 1260 | QString type; |
1261 | stream >> type; | 1261 | stream >> type; |
1262 | tabs->setBusyIndicatorType(type); | 1262 | tabs->setBusyIndicatorType(type); |
1263 | } | 1263 | } |
1264 | else if ( msg == "home()" ) { | 1264 | else if ( msg == "home()" ) { |
1265 | if ( isVisibleWindow( winId ( ))) | 1265 | if ( isVisibleWindow( winId ( ))) |
1266 | nextView ( ); | 1266 | nextView ( ); |
1267 | else | 1267 | else |
1268 | raise ( ); | 1268 | raise ( ); |
1269 | 1269 | ||
1270 | } | 1270 | } |
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | void Launcher::storageChanged() | 1273 | void Launcher::storageChanged() |
1274 | { | 1274 | { |
1275 | if ( in_lnk_props ) { | 1275 | if ( in_lnk_props ) { |
1276 | got_lnk_change = TRUE; | 1276 | got_lnk_change = TRUE; |
1277 | lnk_change = QString::null; | 1277 | lnk_change = QString::null; |
1278 | } else { | 1278 | } else { |
1279 | updateLink( QString::null ); | 1279 | updateLink( QString::null ); |
1280 | } | 1280 | } |
1281 | } | 1281 | } |
1282 | 1282 | ||
1283 | 1283 | ||
1284 | bool Launcher::mkdir(const QString &localPath) | 1284 | bool Launcher::mkdir(const QString &localPath) |
1285 | { | 1285 | { |
1286 | QDir fullDir(localPath); | 1286 | QDir fullDir(localPath); |
1287 | if (fullDir.exists()) | 1287 | if (fullDir.exists()) |
1288 | return true; | 1288 | return true; |
1289 | 1289 | ||
1290 | // at this point the directory doesn't exist | 1290 | // at this point the directory doesn't exist |
1291 | // go through the directory tree and start creating the direcotories | 1291 | // go through the directory tree and start creating the direcotories |
1292 | // that don't exist; if we can't create the directories, return false | 1292 | // that don't exist; if we can't create the directories, return false |
1293 | 1293 | ||
1294 | QString dirSeps = "/"; | 1294 | QString dirSeps = "/"; |
1295 | int dirIndex = localPath.find(dirSeps); | 1295 | int dirIndex = localPath.find(dirSeps); |
1296 | QString checkedPath; | 1296 | QString checkedPath; |
1297 | 1297 | ||
1298 | // didn't find any seps; weird, use the cur dir instead | 1298 | // didn't find any seps; weird, use the cur dir instead |
1299 | if (dirIndex == -1) { | 1299 | if (dirIndex == -1) { |
1300 | //qDebug("No seperators found in path %s", localPath.latin1()); | 1300 | //qDebug("No seperators found in path %s", localPath.latin1()); |
1301 | checkedPath = QDir::currentDirPath(); | 1301 | checkedPath = QDir::currentDirPath(); |
1302 | } | 1302 | } |
1303 | 1303 | ||
1304 | while (checkedPath != localPath) { | 1304 | while (checkedPath != localPath) { |
1305 | // no more seperators found, use the local path | 1305 | // no more seperators found, use the local path |
1306 | if (dirIndex == -1) | 1306 | if (dirIndex == -1) |
1307 | checkedPath = localPath; | 1307 | checkedPath = localPath; |
1308 | else { | 1308 | else { |
1309 | // the next directory to check | 1309 | // the next directory to check |
1310 | checkedPath = localPath.left(dirIndex) + "/"; | 1310 | checkedPath = localPath.left(dirIndex) + "/"; |
1311 | // advance the iterator; the next dir seperator | 1311 | // advance the iterator; the next dir seperator |
1312 | dirIndex = localPath.find(dirSeps, dirIndex+1); | 1312 | dirIndex = localPath.find(dirSeps, dirIndex+1); |
1313 | } | 1313 | } |
1314 | 1314 | ||
1315 | QDir checkDir(checkedPath); | 1315 | QDir checkDir(checkedPath); |
1316 | if (!checkDir.exists()) { | 1316 | if (!checkDir.exists()) { |
1317 | //qDebug("mkdir making dir %s", checkedPath.latin1()); | 1317 | //qDebug("mkdir making dir %s", checkedPath.latin1()); |
1318 | 1318 | ||
1319 | if (!checkDir.mkdir(checkedPath)) { | 1319 | if (!checkDir.mkdir(checkedPath)) { |
1320 | qDebug("Unable to make directory %s", checkedPath.latin1()); | 1320 | qDebug("Unable to make directory %s", checkedPath.latin1()); |
1321 | return FALSE; | 1321 | return FALSE; |
1322 | } | 1322 | } |
1323 | } | 1323 | } |
1324 | 1324 | ||
1325 | } | 1325 | } |
1326 | return TRUE; | 1326 | return TRUE; |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | void Launcher::preloadApps() | 1329 | void Launcher::preloadApps() |
1330 | { | 1330 | { |
1331 | Config cfg("Launcher"); | 1331 | Config cfg("Launcher"); |
1332 | cfg.setGroup("Preload"); | 1332 | cfg.setGroup("Preload"); |
1333 | QStringList apps = cfg.readListEntry("Apps",','); | 1333 | QStringList apps = cfg.readListEntry("Apps",','); |
1334 | for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { | 1334 | for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { |
1335 | #ifndef QT_NO_COP | 1335 | #ifndef QT_NO_COP |
1336 | QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); | 1336 | QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); |
1337 | #endif | 1337 | #endif |
1338 | } | 1338 | } |
1339 | } | 1339 | } |
1340 | 1340 | ||
1341 | DocumentTab::DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName) | 1341 | DocumentTab::DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName) |
1342 | : OFileSelector(parent,mode,selector,dirName,fileName) | 1342 | : OFileSelector(parent,mode,selector,dirName,fileName) |
1343 | { | 1343 | { |
1344 | setYesCancelVisible(false); | 1344 | setYesCancelVisible(false); |
1345 | setToolbarVisible(true); | 1345 | setToolbarVisible(false); |
1346 | setPermissionBarVisible(false); | 1346 | setPermissionBarVisible(false); |
1347 | setLineEditVisible(false) ; | 1347 | setLineEditVisible(false) ; |
1348 | //setChooserVisible( bool chooser ); | 1348 | //setChooserVisible( bool chooser ); |
1349 | 1349 | ||
1350 | } | 1350 | } |
1351 | 1351 | ||
1352 | DocumentTab::~DocumentTab() { | 1352 | DocumentTab::~DocumentTab() { |
1353 | 1353 | ||
1354 | } | 1354 | } |
1355 | 1355 | ||