-rw-r--r-- | core/launcher/launcher.cpp | 158 |
1 files changed, 61 insertions, 97 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 0205622..8b2907a 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -13,26 +13,24 @@ | |||
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> | ||
26 | #include <opie/ofileselector.h> | ||
27 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
29 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
30 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
31 | #include <qpe/global.h> | 29 | #include <qpe/global.h> |
32 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/mimetype.h> | 31 | #include <qpe/mimetype.h> |
34 | #include <qpe/storage.h> | 32 | #include <qpe/storage.h> |
35 | #include <qpe/palmtoprecord.h> | 33 | #include <qpe/palmtoprecord.h> |
36 | 34 | ||
37 | #include <qpe/version.h> | 35 | #include <qpe/version.h> |
38 | 36 | ||
@@ -156,59 +154,59 @@ void CategoryTabWidget::nextTab() | |||
156 | 154 | ||
157 | 155 | ||
158 | void CategoryTabWidget::showTab(const QString& id) | 156 | void CategoryTabWidget::showTab(const QString& id) |
159 | { | 157 | { |
160 | if ( categoryBar ) { | 158 | if ( categoryBar ) { |
161 | int idx = ids.findIndex( id ); | 159 | int idx = ids.findIndex( id ); |
162 | categoryBar->setCurrentTab( idx ); | 160 | categoryBar->setCurrentTab( idx ); |
163 | } | 161 | } |
164 | } | 162 | } |
165 | 163 | ||
166 | void CategoryTabWidget::addItem( const QString& linkfile ) | 164 | void CategoryTabWidget::addItem( const QString& linkfile ) |
167 | { | 165 | { |
168 | // int i=0; | 166 | int i=0; |
169 | // AppLnk *app = new AppLnk(linkfile); | 167 | AppLnk *app = new AppLnk(linkfile); |
170 | // if ( !app->isValid() ) { | 168 | if ( !app->isValid() ) { |
171 | // delete app; | 169 | delete app; |
172 | // app=0; | 170 | app=0; |
173 | // } | 171 | } |
174 | // if ( !app || !app->file().isEmpty() ) { | 172 | if ( !app || !app->file().isEmpty() ) { |
175 | // A document | 173 | // A document |
176 | // delete app; | 174 | delete app; |
177 | // app = new DocLnk(linkfile); | 175 | app = new DocLnk(linkfile); |
178 | // if ( app->fileKnown() ) { | 176 | if ( app->fileKnown() ) { |
179 | // ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); | 177 | ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); |
180 | // } else { | 178 | } else { |
181 | // ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); | 179 | ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); |
182 | // delete app; | 180 | delete app; |
183 | // } | 181 | } |
184 | // return; | 182 | return; |
185 | // } | 183 | } |
186 | // An application | 184 | // An application |
187 | // for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { | 185 | for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { |
188 | // if ( !(*it).isEmpty() ) { | 186 | if ( !(*it).isEmpty() ) { |
189 | // QRegExp tf(*it,FALSE,TRUE); | 187 | QRegExp tf(*it,FALSE,TRUE); |
190 | // if ( tf.match(app->type()) >= 0 ) { | 188 | if ( tf.match(app->type()) >= 0 ) { |
191 | // ((LauncherView*)stack->widget(i))->addItem(app); | 189 | ((LauncherView*)stack->widget(i))->addItem(app); |
192 | // return; | 190 | return; |
193 | // } | 191 | } |
194 | // i++; | 192 | i++; |
195 | // } | 193 | } |
196 | // } | 194 | } |
197 | 195 | ||
198 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); | 196 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); |
199 | } | 197 | } |
200 | 198 | ||
201 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | 199 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, |
202 | AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/) | 200 | AppLnkSet* docFolder, const QList<FileSystem> &fs) |
203 | { | 201 | { |
204 | QString current; | 202 | QString current; |
205 | if ( categoryBar ) { | 203 | if ( categoryBar ) { |
206 | int c = categoryBar->currentTab(); | 204 | int c = categoryBar->currentTab(); |
207 | if ( c >= 0 ) current = ids[c]; | 205 | if ( c >= 0 ) current = ids[c]; |
208 | } | 206 | } |
209 | 207 | ||
210 | delete categoryBar; | 208 | delete categoryBar; |
211 | categoryBar = new CategoryTabBar( this ); | 209 | categoryBar = new CategoryTabBar( this ); |
212 | QPalette pal = categoryBar->palette(); | 210 | QPalette pal = categoryBar->palette(); |
213 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 211 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
214 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 212 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
@@ -244,70 +242,49 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | |||
244 | } | 242 | } |
245 | } | 243 | } |
246 | ++it; | 244 | ++it; |
247 | } | 245 | } |
248 | rootFolder->detachChildren(); | 246 | rootFolder->detachChildren(); |
249 | for (int i=0; i<tabs; i++) | 247 | for (int i=0; i<tabs; i++) |
250 | ((LauncherView*)stack->widget(i))->sort(); | 248 | ((LauncherView*)stack->widget(i))->sort(); |
251 | 249 | ||
252 | // all documents | 250 | // all documents |
253 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 251 | QImage img( Resource::loadImage( "DocsIcon" ) ); |
254 | QPixmap pm; | 252 | QPixmap pm; |
255 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 253 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
256 | 254 | docview = newView( "Documents", // No tr | |
257 | //ljpotter | 255 | pm, tr("Documents")); |
258 | CategoryTab *catTab ; | 256 | docview->populate( docFolder, QString::null ); |
259 | catTab = new CategoryTab( pm, "Documents" ); | 257 | docFolder->detachChildren(); |
260 | 258 | docview->setFileSystems(fs); | |
261 | categoryBar->addTab( catTab ); | 259 | docview->setToolsEnabled(TRUE); |
262 | 260 | setTabAppearance( "Documents", cfg ); // No tr | |
263 | fileSel = new DocumentTab( stack, 4, 0, "/",""); | ||
264 | stack->addWidget( fileSel, tabs++ ); | ||
265 | |||
266 | // fileSel->hide(); | ||
267 | |||
268 | connect( fileSel, SIGNAL( fileSelected( const DocLnk & )), | ||
269 | this, SLOT(clickie(const DocLnk&)) ); | ||
270 | |||
271 | // connect( fileSel, SIGNAL( fileSelected( const QString & )), | ||
272 | // this, SLOT(clickie(const QString&)) ); | ||
273 | 261 | ||
274 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); | 262 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); |
275 | 263 | ||
276 | ((LauncherView*)stack->widget(0))->setFocus(); | 264 | ((LauncherView*)stack->widget(0))->setFocus(); |
277 | 265 | ||
278 | cfg. setGroup ( "GUI" ); | 266 | cfg. setGroup ( "GUI" ); |
279 | setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null )); | 267 | setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null )); |
280 | 268 | ||
281 | if ( !current.isNull() ) { | 269 | if ( !current.isNull() ) { |
282 | showTab(current); | 270 | showTab(current); |
283 | } | 271 | } |
284 | 272 | ||
285 | categoryBar->show(); | 273 | categoryBar->show(); |
286 | stack->show(); | 274 | stack->show(); |
287 | 275 | ||
288 | |||
289 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); | 276 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); |
290 | } | 277 | } |
291 | 278 | ||
292 | void CategoryTabWidget::clickie(const DocLnk &lnk) { | ||
293 | lnk.execute(); | ||
294 | // fileSel->reparse(); | ||
295 | } | ||
296 | |||
297 | void CategoryTabWidget::clickie(const QString &appStr) { | ||
298 | // DocLnk lnk(appStr); | ||
299 | // lnk.execute(); | ||
300 | } | ||
301 | |||
302 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) | 279 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) |
303 | { | 280 | { |
304 | QString grp( "Tab %1" ); // No tr | 281 | QString grp( "Tab %1" ); // No tr |
305 | cfg.setGroup( grp.arg(id) ); | 282 | cfg.setGroup( grp.arg(id) ); |
306 | LauncherView *v = view( id ); | 283 | LauncherView *v = view( id ); |
307 | int idx = ids.findIndex( id ); | 284 | int idx = ids.findIndex( id ); |
308 | CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx ); | 285 | CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx ); |
309 | 286 | ||
310 | // View | 287 | // View |
311 | QString view = cfg.readEntry( "View", "Icon" ); | 288 | QString view = cfg.readEntry( "View", "Icon" ); |
312 | if ( view == "List" ) // No tr | 289 | if ( view == "List" ) // No tr |
313 | v->setViewMode( LauncherView::List ); | 290 | v->setViewMode( LauncherView::List ); |
@@ -332,90 +309,94 @@ void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) | |||
332 | QString tabCol = cfg.readEntry( "TabColor" ); | 309 | QString tabCol = cfg.readEntry( "TabColor" ); |
333 | if ( tabCol.isEmpty() ) | 310 | if ( tabCol.isEmpty() ) |
334 | tab->bgColor = QColor(); | 311 | tab->bgColor = QColor(); |
335 | else | 312 | else |
336 | tab->bgColor = QColor(tabCol); | 313 | tab->bgColor = QColor(tabCol); |
337 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); | 314 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); |
338 | if ( tabTextCol.isEmpty() ) | 315 | if ( tabTextCol.isEmpty() ) |
339 | tab->fgColor = QColor(); | 316 | tab->fgColor = QColor(); |
340 | else | 317 | else |
341 | tab->fgColor = QColor(tabTextCol); | 318 | tab->fgColor = QColor(tabTextCol); |
342 | } | 319 | } |
343 | 320 | ||
344 | //void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/) | 321 | void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs) |
345 | //{ | 322 | { |
346 | // docFolder->detachChildren(); | 323 | docview->populate( docFolder, QString::null ); |
347 | //} | 324 | docFolder->detachChildren(); |
325 | docview->setFileSystems(fs); | ||
326 | docview->updateTools(); | ||
327 | } | ||
348 | 328 | ||
349 | void CategoryTabWidget::tabProperties() | 329 | void CategoryTabWidget::tabProperties() |
350 | { | 330 | { |
351 | LauncherView *view = (LauncherView*)stack->widget( categoryBar->currentTab() ); | 331 | LauncherView *view = (LauncherView*)stack->widget( categoryBar->currentTab() ); |
352 | QPopupMenu *m = new QPopupMenu( this ); | 332 | QPopupMenu *m = new QPopupMenu( this ); |
353 | m->insertItem( tr("Icon View"), LauncherView::Icon ); | 333 | m->insertItem( tr("Icon View"), LauncherView::Icon ); |
354 | m->insertItem( tr("List View"), LauncherView::List ); | 334 | m->insertItem( tr("List View"), LauncherView::List ); |
355 | m->setItemChecked( (int)view->viewMode(), TRUE ); | 335 | m->setItemChecked( (int)view->viewMode(), TRUE ); |
356 | int rv = m->exec( QCursor::pos() ); | 336 | int rv = m->exec( QCursor::pos() ); |
357 | if ( rv >= 0 && rv != view->viewMode() ) { | 337 | if ( rv >= 0 && rv != view->viewMode() ) { |
358 | view->setViewMode( (LauncherView::ViewMode)rv ); | 338 | view->setViewMode( (LauncherView::ViewMode)rv ); |
359 | } | 339 | } |
360 | 340 | ||
361 | delete m; | 341 | delete m; |
362 | } | 342 | } |
363 | 343 | ||
364 | QString CategoryTabWidget::getAllDocLinkInfo() const | 344 | QString CategoryTabWidget::getAllDocLinkInfo() const |
365 | { | 345 | { |
366 | return ""; | 346 | return docview->getAllDocLinkInfo(); |
367 | } | 347 | } |
368 | 348 | ||
369 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) | 349 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) |
370 | { | 350 | { |
371 | LauncherView* view = new LauncherView( stack ); | 351 | LauncherView* view = new LauncherView( stack ); |
372 | connect( view, SIGNAL(clicked(const AppLnk*)), | 352 | connect( view, SIGNAL(clicked(const AppLnk*)), |
373 | this, SIGNAL(clicked(const AppLnk*))); | 353 | this, SIGNAL(clicked(const AppLnk*))); |
374 | connect( view, SIGNAL(rightPressed(AppLnk*)), | 354 | connect( view, SIGNAL(rightPressed(AppLnk*)), |
375 | this, SIGNAL(rightPressed(AppLnk*))); | 355 | this, SIGNAL(rightPressed(AppLnk*))); |
376 | ids.append(id); | 356 | ids.append(id); |
377 | categoryBar->addTab( new CategoryTab( pm, label ) ); | 357 | categoryBar->addTab( new CategoryTab( pm, label ) ); |
378 | stack->addWidget( view, tabs++ ); | 358 | stack->addWidget( view, tabs++ ); |
379 | return view; | 359 | return view; |
380 | } | 360 | } |
381 | 361 | ||
382 | void CategoryTabWidget::updateLink(const QString& linkfile) | 362 | void CategoryTabWidget::updateLink(const QString& linkfile) |
383 | { | 363 | { |
384 | // LauncherView* view; | 364 | int i=0; |
385 | qApp->processEvents(); | 365 | LauncherView* view; |
386 | // while ((view = (LauncherView*)stack->widget(i++))) { | 366 | //qApp->processEvents(); |
387 | // if ( view->removeLink(linkfile) ) | 367 | while ((view = (LauncherView*)stack->widget(i++))) { |
388 | // break; | 368 | if ( view->removeLink(linkfile) ) |
389 | // } | 369 | break; |
390 | // addItem(linkfile); | 370 | } |
391 | fileSel->reparse(); | 371 | addItem(linkfile); |
372 | docview->updateTools(); | ||
392 | } | 373 | } |
393 | 374 | ||
394 | void CategoryTabWidget::paletteChange( const QPalette &p ) | 375 | void CategoryTabWidget::paletteChange( const QPalette &p ) |
395 | { | 376 | { |
396 | QVBox::paletteChange( p ); | 377 | QVBox::paletteChange( p ); |
397 | QPalette pal = palette(); | 378 | QPalette pal = palette(); |
398 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 379 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
399 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 380 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
400 | categoryBar->setPalette( pal ); | 381 | categoryBar->setPalette( pal ); |
401 | categoryBar->update(); | 382 | categoryBar->update(); |
402 | } | 383 | } |
403 | 384 | ||
404 | void CategoryTabWidget::setBusy(bool on) | 385 | void CategoryTabWidget::setBusy(bool on) |
405 | { | 386 | { |
406 | if ( on ) | 387 | if ( on ) |
407 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); | 388 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); |
408 | else | 389 | else |
409 | for (int i=0; i<tabs-1; i++) | 390 | for (int i=0; i<tabs; i++) |
410 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); | 391 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); |
411 | } | 392 | } |
412 | 393 | ||
413 | LauncherView *CategoryTabWidget::view( const QString &id ) | 394 | LauncherView *CategoryTabWidget::view( const QString &id ) |
414 | { | 395 | { |
415 | int idx = ids.findIndex( id ); | 396 | int idx = ids.findIndex( id ); |
416 | return (LauncherView *)stack->widget(idx); | 397 | return (LauncherView *)stack->widget(idx); |
417 | } | 398 | } |
418 | 399 | ||
419 | void CategoryTabWidget::setBusyIndicatorType ( const QString &type ) | 400 | void CategoryTabWidget::setBusyIndicatorType ( const QString &type ) |
420 | { | 401 | { |
421 | for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it ) | 402 | for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it ) |
@@ -658,25 +639,24 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) | |||
658 | m_timeStamp = QString::number( stamp ); | 639 | m_timeStamp = QString::number( stamp ); |
659 | 640 | ||
660 | tabs = new CategoryTabWidget( this ); | 641 | tabs = new CategoryTabWidget( this ); |
661 | setCentralWidget( tabs ); | 642 | setCentralWidget( tabs ); |
662 | 643 | ||
663 | connect( tabs, SIGNAL(selected(const QString&)), | 644 | connect( tabs, SIGNAL(selected(const QString&)), |
664 | this, SLOT(viewSelected(const QString&)) ); | 645 | this, SLOT(viewSelected(const QString&)) ); |
665 | connect( tabs, SIGNAL(clicked(const AppLnk*)), | 646 | connect( tabs, SIGNAL(clicked(const AppLnk*)), |
666 | this, SLOT(select(const AppLnk*))); | 647 | this, SLOT(select(const AppLnk*))); |
667 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 648 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
668 | this, SLOT(properties(AppLnk*))); | 649 | this, SLOT(properties(AppLnk*))); |
669 | 650 | ||
670 | |||
671 | #if !defined(QT_NO_COP) | 651 | #if !defined(QT_NO_COP) |
672 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 652 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
673 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 653 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
674 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); | 654 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); |
675 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); | 655 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); |
676 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 656 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
677 | this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); | 657 | this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); |
678 | #endif | 658 | #endif |
679 | 659 | ||
680 | storage = new StorageInfo( this ); | 660 | storage = new StorageInfo( this ); |
681 | connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) ); | 661 | connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) ); |
682 | 662 | ||
@@ -743,78 +723,77 @@ void Launcher::updateMimeTypes(AppLnkSet* folder) | |||
743 | * Reason: scanning huge mediums, microdirvers for examples | 723 | * Reason: scanning huge mediums, microdirvers for examples |
744 | * consomes time. To avoid that we invented the MediumMountCheck | 724 | * consomes time. To avoid that we invented the MediumMountCheck |
745 | * | 725 | * |
746 | * a) the user globally disabled medium checking. We can ignore | 726 | * a) the user globally disabled medium checking. We can ignore |
747 | * all removable medium | 727 | * all removable medium |
748 | * b) the user enabled medium checking globally and we need to use this mimefilter | 728 | * b) the user enabled medium checking globally and we need to use this mimefilter |
749 | * c) the user enabled medium checking on a per medium bases | 729 | * c) the user enabled medium checking on a per medium bases |
750 | * c1) we already checked and its not ask again turns | 730 | * c1) we already checked and its not ask again turns |
751 | * c2) we need to ask and then apply the mimefilter | 731 | * c2) we need to ask and then apply the mimefilter |
752 | */ | 732 | */ |
753 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | 733 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: |
754 | { | 734 | { |
735 | |||
755 | OWait *owait = new OWait(); | 736 | OWait *owait = new OWait(); |
756 | Global::statusMessage( tr( "Finding documents" ) ); | 737 | Global::statusMessage( tr( "Finding documents" ) ); |
757 | 738 | ||
758 | owait->show(); | 739 | owait->show(); |
759 | qApp->processEvents(); | 740 | qApp->processEvents(); |
760 | if(docsFolder) delete docsFolder; | 741 | |
742 | delete docsFolder; | ||
761 | docsFolder = new DocLnkSet; | 743 | docsFolder = new DocLnkSet; |
744 | |||
762 | DocLnkSet *tmp = 0; | 745 | DocLnkSet *tmp = 0; |
763 | QString home = QString(getenv("HOME")) + "/Documents"; | 746 | QString home = QString(getenv("HOME")) + "/Documents"; |
764 | tmp = new DocLnkSet( home , QString::null); | 747 | tmp = new DocLnkSet( home , QString::null); |
765 | docsFolder->appendFrom( *tmp ); | 748 | docsFolder->appendFrom( *tmp ); |
766 | delete tmp; | 749 | delete tmp; |
767 | 750 | ||
768 | // RAM documents | 751 | // RAM documents |
769 | StorageInfo storage; | 752 | StorageInfo storage; |
770 | const QList<FileSystem> &fileSystems = storage.fileSystems(); | 753 | const QList<FileSystem> &fileSystems = storage.fileSystems(); |
771 | QListIterator<FileSystem> it ( fileSystems ); | 754 | QListIterator<FileSystem> it ( fileSystems ); |
772 | 755 | ||
773 | for ( ; it.current(); ++it ) { | 756 | for ( ; it.current(); ++it ) { |
774 | if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { | 757 | if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { |
775 | tmp = new DocLnkSet( (*it)->path(), QString::null ); | 758 | tmp = new DocLnkSet( (*it)->path(), QString::null ); |
776 | docsFolder->appendFrom( *tmp ); | 759 | docsFolder->appendFrom( *tmp ); |
777 | delete tmp; | 760 | delete tmp; |
778 | } | 761 | } |
779 | } | 762 | } |
780 | 763 | ||
781 | Config mediumCfg( "medium"); | 764 | Config mediumCfg( "medium"); |
782 | mediumCfg.setGroup("main"); | 765 | mediumCfg.setGroup("main"); |
783 | // a) -zecke we don't want to check | 766 | // a) -zecke we don't want to check |
784 | if(!mediumCfg.readBoolEntry("use", true ) ) { | 767 | if(!mediumCfg.readBoolEntry("use", true ) ) |
785 | owait->hide(); | ||
786 | delete owait; | ||
787 | return; | 768 | return; |
788 | } | 769 | |
789 | // find out wich filesystems are new in this round | 770 | // find out wich filesystems are new in this round |
790 | // We will do this by having a timestamp inside each mountpoint | 771 | // We will do this by having a timestamp inside each mountpoint |
791 | // if the current timestamp doesn't match this is a new file system and | 772 | // if the current timestamp doesn't match this is a new file system and |
792 | // come up with our MediumMountGui :) let the hacking begin | 773 | // come up with our MediumMountGui :) let the hacking begin |
793 | int stamp = uidgen.generate(); | 774 | int stamp = uidgen.generate(); |
794 | 775 | ||
795 | QString newStamp = QString::number( stamp ); // generates newtime Stamp | 776 | QString newStamp = QString::number( stamp ); // generates newtime Stamp |
796 | 777 | ||
797 | // b) | 778 | // b) |
798 | if( mediumCfg.readBoolEntry("global", true ) ){ | 779 | if( mediumCfg.readBoolEntry("global", true ) ){ |
799 | QString mime = configToMime(&mediumCfg).join(";"); | 780 | QString mime = configToMime(&mediumCfg).join(";"); |
800 | for( it.toFirst(); it.current(); ++it ){ | 781 | for( it.toFirst(); it.current(); ++it ){ |
801 | if( (*it)->isRemovable() ){ | 782 | if( (*it)->isRemovable() ){ |
802 | tmp = new DocLnkSet( (*it)->path(), mime ); | 783 | tmp = new DocLnkSet( (*it)->path(), mime ); |
803 | docsFolder->appendFrom( *tmp ); | 784 | docsFolder->appendFrom( *tmp ); |
804 | delete tmp; | 785 | delete tmp; |
805 | } | 786 | } |
806 | } // done | 787 | } // done |
807 | owait->hide(); | ||
808 | delete owait; | ||
809 | return; // save the else | 788 | return; // save the else |
810 | } | 789 | } |
811 | // c) zecke | 790 | // c) zecke |
812 | for ( it.toFirst(); it.current(); ++it ) { | 791 | for ( it.toFirst(); it.current(); ++it ) { |
813 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it | 792 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it |
814 | Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); | 793 | Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); |
815 | cfg.setGroup("main"); | 794 | cfg.setGroup("main"); |
816 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); | 795 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); |
817 | /** This medium is uptodate | 796 | /** This medium is uptodate |
818 | */ | 797 | */ |
819 | if( stamp == m_timeStamp ){ // ok we know this card | 798 | if( stamp == m_timeStamp ){ // ok we know this card |
820 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp | 799 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp |
@@ -860,36 +839,37 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
860 | } | 839 | } |
861 | } | 840 | } |
862 | } | 841 | } |
863 | } | 842 | } |
864 | m_timeStamp = newStamp; | 843 | m_timeStamp = newStamp; |
865 | owait->hide(); | 844 | owait->hide(); |
866 | delete owait; | 845 | delete owait; |
867 | } | 846 | } |
868 | 847 | ||
869 | void Launcher::updateTabs() | 848 | void Launcher::updateTabs() |
870 | { | 849 | { |
871 | MimeType::updateApplications(); // ### reads all applnks twice | 850 | MimeType::updateApplications(); // ### reads all applnks twice |
851 | |||
872 | delete rootFolder; | 852 | delete rootFolder; |
873 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); | 853 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); |
874 | 854 | ||
875 | loadDocs(); | 855 | loadDocs(); |
876 | 856 | ||
877 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); | 857 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); |
878 | } | 858 | } |
879 | 859 | ||
880 | void Launcher::updateDocs() | 860 | void Launcher::updateDocs() |
881 | { | 861 | { |
882 | loadDocs(); | 862 | loadDocs(); |
883 | // tabs->updateDocs(docsFolder,storage->fileSystems()); | 863 | tabs->updateDocs(docsFolder,storage->fileSystems()); |
884 | } | 864 | } |
885 | 865 | ||
886 | void Launcher::viewSelected(const QString& s) | 866 | void Launcher::viewSelected(const QString& s) |
887 | { | 867 | { |
888 | setCaption( s + tr(" - Launcher") ); | 868 | setCaption( s + tr(" - Launcher") ); |
889 | } | 869 | } |
890 | 870 | ||
891 | void Launcher::nextView() | 871 | void Launcher::nextView() |
892 | { | 872 | { |
893 | tabs->nextTab(); | 873 | tabs->nextTab(); |
894 | } | 874 | } |
895 | 875 | ||
@@ -1328,28 +1308,12 @@ bool Launcher::mkdir(const QString &localPath) | |||
1328 | 1308 | ||
1329 | void Launcher::preloadApps() | 1309 | void Launcher::preloadApps() |
1330 | { | 1310 | { |
1331 | Config cfg("Launcher"); | 1311 | Config cfg("Launcher"); |
1332 | cfg.setGroup("Preload"); | 1312 | cfg.setGroup("Preload"); |
1333 | QStringList apps = cfg.readListEntry("Apps",','); | 1313 | QStringList apps = cfg.readListEntry("Apps",','); |
1334 | for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { | 1314 | for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { |
1335 | #ifndef QT_NO_COP | 1315 | #ifndef QT_NO_COP |
1336 | QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); | 1316 | QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); |
1337 | #endif | 1317 | #endif |
1338 | } | 1318 | } |
1339 | } | 1319 | } |
1340 | |||
1341 | DocumentTab::DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName) | ||
1342 | : OFileSelector(parent,mode,selector,dirName,fileName) | ||
1343 | { | ||
1344 | setYesCancelVisible(false); | ||
1345 | setToolbarVisible(false); | ||
1346 | setPermissionBarVisible(false); | ||
1347 | setLineEditVisible(false) ; | ||
1348 | //setChooserVisible( bool chooser ); | ||
1349 | |||
1350 | } | ||
1351 | |||
1352 | DocumentTab::~DocumentTab() { | ||
1353 | |||
1354 | } | ||
1355 | |||