summaryrefslogtreecommitdiff
authorzecke <zecke>2002-03-22 16:59:27 (UTC)
committer zecke <zecke>2002-03-22 16:59:27 (UTC)
commit966b7c4d3a691c59b428ffba34e6e3a0149e4698 (patch) (side-by-side diff)
tree88854ce123cd1a7c7e3bb7241d4702f24518a62c
parentf6f0cd02ceec72a971616de253d736a94a730397 (diff)
downloadopie-966b7c4d3a691c59b428ffba34e6e3a0149e4698.zip
opie-966b7c4d3a691c59b428ffba34e6e3a0149e4698.tar.gz
opie-966b7c4d3a691c59b428ffba34e6e3a0149e4698.tar.bz2
make something kewl possible
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp39
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,92 +1,97 @@
/**********************************************************************
+** 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
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
// 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>
#include <qstyle.h>
#include <qpushbutton.h>
#include <qtabbar.h>
#include <qwidgetstack.h>
#include <qlayout.h>
#include <qregexp.h>
#include <qmessagebox.h>
#include <qframe.h>
#include <qpainter.h>
#include <qlabel.h>
#include <qtextstream.h>
#include "launcherview.h"
#include "launcher.h"
#include "syncdialog.h"
#include "desktop.h"
#include <qpe/lnkproperties.h>
#include "mrulist.h"
#include "qrsync.h"
#include <stdlib.h>
#include <unistd.h>
#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;
stack = 0;
}
void CategoryTabWidget::prevTab()
{
if ( categoryBar ) {
int n = categoryBar->count();
int tab = categoryBar->currentTab();
if ( tab >= 0 )
categoryBar->setCurrentTab( (tab - 1 + n)%n );
}
}
void CategoryTabWidget::nextTab()
{
if ( categoryBar ) {
int n = categoryBar->count();
int tab = categoryBar->currentTab();
@@ -396,48 +401,49 @@ void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
p->setPen( colorGroup().foreground() );
#endif
p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
} else {
p->setPen( palette().disabled().foreground() );
p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
}
}
//---------------------------------------------------------------------------
Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl )
{
setCaption( tr("Launcher") );
syncDialog = 0;
// 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&)),
this, SLOT(viewSelected(const QString&)) );
connect( tabs, SIGNAL(clicked(const AppLnk*)),
this, SLOT(select(const AppLnk*)));
connect( tabs, SIGNAL(rightPressed(AppLnk*)),
this, SLOT(properties(AppLnk*)));
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)),
this, SLOT(systemMessage( const QCString &, const QByteArray &)) );
#endif
storage = new StorageInfo( this );
connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) );
updateTabs();
preloadApps();
@@ -471,53 +477,82 @@ void Launcher::showMaximized()
void Launcher::doMaximize()
{
QMainWindow::showMaximized();
}
void Launcher::updateMimeTypes()
{
MimeType::clear();
updateMimeTypes(rootFolder);
}
void Launcher::updateMimeTypes(AppLnkSet* folder)
{
for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) {
AppLnk *app = it.current();
if ( app->type() == "Folder" )
updateMimeTypes((AppLnkSet *)app);
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
delete rootFolder;
rootFolder = new AppLnkSet( MimeType::appsFolderName() );
loadDocs();
tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems());
}
void Launcher::updateDocs()
{
loadDocs();
tabs->updateDocs(docsFolder,storage->fileSystems());
}
void Launcher::viewSelected(const QString& s)
{
setCaption( s + tr(" - Launcher") );
}