-rw-r--r-- | core/launcher/launcher.cpp | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 8fe41f7..222592b 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -1,7 +1,8 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (c) 2002 Holger zecke Freyther | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 3 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 4 | ** |
4 | ** This file is part of Qtopia Environment. | 5 | ** This file is part of Qtopia Environment. |
5 | ** | 6 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 7 | ** 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 | 8 | ** GNU General Public License version 2 as published by the Free Software |
@@ -19,22 +20,24 @@ | |||
19 | **********************************************************************/ | 20 | **********************************************************************/ |
20 | 21 | ||
21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | 22 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT |
22 | // have this class. | 23 | // have this class. |
23 | #define QTOPIA_INTERNAL_FSLP | 24 | #define QTOPIA_INTERNAL_FSLP |
24 | 25 | ||
26 | #include <opie/oconfig.h> | ||
25 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
26 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
27 | #include <qpe/applnk.h> | 29 | #include <qpe/applnk.h> |
28 | #include <qpe/config.h> | 30 | #include <qpe/config.h> |
29 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
30 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
31 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
32 | #include <qpe/storage.h> | 34 | #include <qpe/storage.h> |
33 | #include <qpe/palmtoprecord.h> | 35 | #include <qpe/palmtoprecord.h> |
34 | 36 | ||
37 | #include <qdatetime.h> | ||
35 | #include <qdir.h> | 38 | #include <qdir.h> |
36 | #include <qwindowsystem_qws.h> | 39 | #include <qwindowsystem_qws.h> |
37 | #include <qtimer.h> | 40 | #include <qtimer.h> |
38 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
39 | #include <qvbox.h> | 42 | #include <qvbox.h> |
40 | #include <qlayout.h> | 43 | #include <qlayout.h> |
@@ -63,12 +66,14 @@ | |||
63 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 66 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
64 | #include <stdio.h> | 67 | #include <stdio.h> |
65 | #include <sys/vfs.h> | 68 | #include <sys/vfs.h> |
66 | #include <mntent.h> | 69 | #include <mntent.h> |
67 | #endif | 70 | #endif |
68 | 71 | ||
72 | #include <qpe/storage.h> | ||
73 | #include "mediummountgui.h" | ||
69 | //#define SHOW_ALL | 74 | //#define SHOW_ALL |
70 | 75 | ||
71 | CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : | 76 | CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : |
72 | QVBox( parent ) | 77 | QVBox( parent ) |
73 | { | 78 | { |
74 | categoryBar = 0; | 79 | categoryBar = 0; |
@@ -414,12 +419,13 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) | |||
414 | // we have a pretty good idea how big we'll be | 419 | // we have a pretty good idea how big we'll be |
415 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); | 420 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); |
416 | 421 | ||
417 | tabs = 0; | 422 | tabs = 0; |
418 | rootFolder = 0; | 423 | rootFolder = 0; |
419 | docsFolder = 0; | 424 | docsFolder = 0; |
425 | m_timeStamp = QDateTime::currentDateTime().toString(); | ||
420 | 426 | ||
421 | tabs = new CategoryTabWidget( this ); | 427 | tabs = new CategoryTabWidget( this ); |
422 | tabs->setMaximumWidth( qApp->desktop()->width() ); | 428 | tabs->setMaximumWidth( qApp->desktop()->width() ); |
423 | setCentralWidget( tabs ); | 429 | setCentralWidget( tabs ); |
424 | 430 | ||
425 | connect( tabs, SIGNAL(selected(const QString&)), | 431 | connect( tabs, SIGNAL(selected(const QString&)), |
@@ -489,17 +495,46 @@ void Launcher::updateMimeTypes(AppLnkSet* folder) | |||
489 | else { | 495 | else { |
490 | MimeType::registerApp(*app); | 496 | MimeType::registerApp(*app); |
491 | } | 497 | } |
492 | } | 498 | } |
493 | } | 499 | } |
494 | 500 | ||
495 | void Launcher::loadDocs() | 501 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: |
496 | { | 502 | { |
497 | delete docsFolder; | 503 | delete docsFolder; |
498 | docsFolder = new DocLnkSet; | 504 | docsFolder = new DocLnkSet; |
499 | Global::findDocuments(docsFolder); | 505 | // find out wich filesystems are new in this round |
506 | // We will do this by having a timestamp inside each mountpoint | ||
507 | // if the current timestamp doesn't match this is a new file system and | ||
508 | // come up with our MediumMountGui :) let the hacking begin | ||
509 | QString newStamp = QDateTime::currentDateTime().toString(); | ||
510 | StorageInfo storage; | ||
511 | const QList<FileSystem> &fileSystems = storage.fileSystems(); | ||
512 | QListIterator<FileSystem> it ( fileSystems ); | ||
513 | for ( ; it.current(); ++it ) { | ||
514 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it | ||
515 | OConfig cfg( (*it)->path() + "/.opiestorage.cf"); | ||
516 | cfg.setGroup("main"); | ||
517 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); | ||
518 | if( stamp == m_timeStamp ){ // ok we know this card | ||
519 | cfg.writeEntry("timestamp", newStamp ); | ||
520 | // we need to scan the list now. Hopefully the cache will be there | ||
521 | }else{ // come up with the gui | ||
522 | MediumMountGui medium((*it)->path() + "/.opiestorage.cf" ); | ||
523 | if( medium.check() ){ | ||
524 | if( medium.exec() ){ //ok | ||
525 | // speicher | ||
526 | } | ||
527 | }else{ | ||
528 | // do something different see what we need to do | ||
529 | } | ||
530 | } | ||
531 | } | ||
532 | } | ||
533 | Global::findDocuments(docsFolder); // get rid of this call later | ||
534 | m_timeStamp = newStamp; | ||
500 | } | 535 | } |
501 | 536 | ||
502 | void Launcher::updateTabs() | 537 | void Launcher::updateTabs() |
503 | { | 538 | { |
504 | MimeType::updateApplications(); // ### reads all applnks twice | 539 | MimeType::updateApplications(); // ### reads all applnks twice |
505 | 540 | ||