-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 @@ /********************************************************************** +** Copyright (c) 2002 Holger zecke Freyther ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software @@ -19,22 +20,24 @@ **********************************************************************/ // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT // have this class. #define QTOPIA_INTERNAL_FSLP +#include <opie/oconfig.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/resource.h> #include <qpe/applnk.h> #include <qpe/config.h> #include <qpe/global.h> #include <qpe/qpeapplication.h> #include <qpe/mimetype.h> #include <qpe/storage.h> #include <qpe/palmtoprecord.h> +#include <qdatetime.h> #include <qdir.h> #include <qwindowsystem_qws.h> #include <qtimer.h> #include <qcombobox.h> #include <qvbox.h> #include <qlayout.h> @@ -63,12 +66,14 @@ #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) #include <stdio.h> #include <sys/vfs.h> #include <mntent.h> #endif +#include <qpe/storage.h> +#include "mediummountgui.h" //#define SHOW_ALL CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : QVBox( parent ) { categoryBar = 0; @@ -414,12 +419,13 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) // we have a pretty good idea how big we'll be setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); tabs = 0; rootFolder = 0; docsFolder = 0; + m_timeStamp = QDateTime::currentDateTime().toString(); tabs = new CategoryTabWidget( this ); tabs->setMaximumWidth( qApp->desktop()->width() ); setCentralWidget( tabs ); connect( tabs, SIGNAL(selected(const QString&)), @@ -489,17 +495,46 @@ void Launcher::updateMimeTypes(AppLnkSet* folder) else { MimeType::registerApp(*app); } } } -void Launcher::loadDocs() +void Launcher::loadDocs() // ok here comes a hack belonging to Global:: { delete docsFolder; docsFolder = new DocLnkSet; - Global::findDocuments(docsFolder); + // find out wich filesystems are new in this round + // We will do this by having a timestamp inside each mountpoint + // if the current timestamp doesn't match this is a new file system and + // come up with our MediumMountGui :) let the hacking begin + QString newStamp = QDateTime::currentDateTime().toString(); + StorageInfo storage; + const QList<FileSystem> &fileSystems = storage.fileSystems(); + QListIterator<FileSystem> it ( fileSystems ); + for ( ; it.current(); ++it ) { + if ( (*it)->isRemovable() ) { // let's find out if we should search on it + OConfig cfg( (*it)->path() + "/.opiestorage.cf"); + cfg.setGroup("main"); + QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); + if( stamp == m_timeStamp ){ // ok we know this card + cfg.writeEntry("timestamp", newStamp ); + // we need to scan the list now. Hopefully the cache will be there + }else{ // come up with the gui + MediumMountGui medium((*it)->path() + "/.opiestorage.cf" ); + if( medium.check() ){ + if( medium.exec() ){ //ok + // speicher + } + }else{ + // do something different see what we need to do + } + } + } + } + Global::findDocuments(docsFolder); // get rid of this call later + m_timeStamp = newStamp; } void Launcher::updateTabs() { MimeType::updateApplications(); // ### reads all applnks twice |