summaryrefslogtreecommitdiff
authorleseb <leseb>2002-08-30 19:03:23 (UTC)
committer leseb <leseb>2002-08-30 19:03:23 (UTC)
commit2922e5f8c94cf459c75c631a2ec0a4aedc570e67 (patch) (side-by-side diff)
tree85a9e48607a4d1a1a2a3464b135ade74a2619e92
parentf082457be1262b6f96ee4ebfab570f5c8200a11f (diff)
downloadopie-2922e5f8c94cf459c75c631a2ec0a4aedc570e67.zip
opie-2922e5f8c94cf459c75c631a2ec0a4aedc570e67.tar.gz
opie-2922e5f8c94cf459c75c631a2ec0a4aedc570e67.tar.bz2
View docs in RAM
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 02124d2..effcd24 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -511,127 +511,137 @@ void Launcher::showMaximized()
else
QTimer::singleShot( 20, this, SLOT(doMaximize()) );
}
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);
}
}
}
/** This is a HACK....
* Reason: scanning huge mediums, microdirvers for examples
* consomes time. To avoid that we invented the MediumMountCheck
*
* a) the user globally disabled medium checking. We can ignore
* all removable medium
* b) the user enabled medium checking globally and we need to use this mimefilter
* c) the user enabled medium checking on a per medium bases
* c1) we already checked and its not ask again turns
* c2) we need to ask and then apply the mimefilter
*/
void Launcher::loadDocs() // ok here comes a hack belonging to Global::
{
delete docsFolder;
docsFolder = new DocLnkSet;
DocLnkSet *tmp = 0;
QString home = QString(getenv("HOME")) + "/Documents";
tmp = new DocLnkSet( home , QString::null);
docsFolder->appendFrom( *tmp );
delete tmp;
+ // RAM documents
+ StorageInfo storage;
+ const QList<FileSystem> &fileSystems = storage.fileSystems();
+ QListIterator<FileSystem> it ( fileSystems );
+
+ for ( ; it.current(); ++it ) {
+ if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) {
+ tmp = new DocLnkSet( (*it)->path(), QString::null );
+ docsFolder->appendFrom( *tmp );
+ delete tmp;
+ }
+ }
+
Config mediumCfg( "medium");
mediumCfg.setGroup("main");
// a) -zecke we don't want to check
if(!mediumCfg.readBoolEntry("use", true ) )
return;
// 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
int stamp = uidgen.generate();
QString newStamp = QString::number( stamp ); // generates newtime Stamp
- StorageInfo storage;
- const QList<FileSystem> &fileSystems = storage.fileSystems();
- QListIterator<FileSystem> it ( fileSystems );
// b)
if( mediumCfg.readBoolEntry("global", true ) ){
QString mime = configToMime(&mediumCfg).join(";");
- for( ; it.current(); ++it ){
+ for( it.toFirst(); it.current(); ++it ){
if( (*it)->isRemovable() ){
tmp = new DocLnkSet( (*it)->path(), mime );
docsFolder->appendFrom( *tmp );
delete tmp;
}
} // done
return; // save the else
}
// c) zecke
- for ( ; it.current(); ++it ) {
+ for ( it.toFirst(); it.current(); ++it ) {
if ( (*it)->isRemovable() ) { // let's find out if we should search on it
Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File);
cfg.setGroup("main");
QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() );
/** This medium is uptodate
*/
if( stamp == m_timeStamp ){ // ok we know this card
cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp
// we need to scan the list now. Hopefully the cache will be there
// read the mimetypes from the config and search for documents
QStringList mimetypes = configToMime( &cfg);
tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") );
docsFolder->appendFrom( *tmp );
delete tmp;
}else{ // come up with the gui cause this a new card
MediumMountGui medium(&cfg, (*it)->path() );
if( medium.check() ){ // we did not ask before or ask again is off
/** c2) */
if( medium.exec() ){ // he clicked yes so search it
// speicher
//cfg.read(); // cause of a race we need to reread - fixed
cfg.setGroup("main");
cfg.writeEntry("timestamp", newStamp );
cfg.write();
tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) );
docsFolder->appendFrom( *tmp );
delete tmp;
}// no else
/** c1) */
}else{ // we checked
// do something different see what we need to do
// let's see if we should check the device
cfg.setGroup("main" );
bool check = cfg.readBoolEntry("autocheck", true );
if( check ){ // find the documents
tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") );
docsFolder->appendFrom( *tmp );
delete tmp;
}
}
}
}
}
m_timeStamp = newStamp;
}
void Launcher::updateTabs()
@@ -782,106 +792,106 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
stream >> appName;
Config cfg( "autostart" );
cfg.setGroup( "AutoStart" );
if ( appName.compare("clear") == 0){
cfg.writeEntry("Apps", "");
}
} else if ( msg == "autoStart(QString,QString)" ) {
QString modifier, appName;
stream >> modifier >> appName;
Config cfg( "autostart" );
cfg.setGroup( "AutoStart" );
if ( modifier.compare("add") == 0 ){
// only add if appname is entered
if (!appName.isEmpty()) {
cfg.writeEntry("Apps", appName);
}
} else if (modifier.compare("remove") == 0 ) {
// need to change for multiple entries
// actually remove is right now simular to clear, but in future there
// should be multiple apps in autostart possible.
QString checkName;
checkName = cfg.readEntry("Apps", "");
if (checkName == appName) {
cfg.writeEntry("Apps", "");
}
}
// case the autostart feature should be delayed
} else if ( msg == "autoStart(QString,QString,QString)") {
QString modifier, appName, delay;
stream >> modifier >> appName >> delay;
Config cfg( "autostart" );
cfg.setGroup( "AutoStart" );
if ( modifier.compare("add") == 0 ){
// only add it appname is entered
if (!appName.isEmpty()) {
cfg.writeEntry("Apps", appName);
cfg.writeEntry("Delay", delay);
}
} else {
}
} else if ( msg == "sendCardInfo()" ) {
QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" );
const QList<FileSystem> &fs = storage->fileSystems();
QListIterator<FileSystem> it ( fs );
QString s;
QString homeDir = getenv("HOME");
QString hardDiskHome;
for ( ; it.current(); ++it ) {
- if ( (*it)->isRemovable() )
+ if ( (*it)->isRemovable() || (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" )
s += (*it)->name() + "=" + (*it)->path() + "/Documents "
+ QString::number( (*it)->availBlocks() * (*it)->blockSize() )
+ " " + (*it)->options() + ";";
else if ( (*it)->disk() == "/dev/mtdblock1" ||
(*it)->disk() == "/dev/mtdblock/1" )
s += (*it)->name() + "=" + homeDir + "/Documents "
+ QString::number( (*it)->availBlocks() * (*it)->blockSize() )
+ " " + (*it)->options() + ";";
- else if ( (*it)->name().contains( "Hard Disk") &&
+ else if ( (*it)->name().contains( tr("Hard Disk") ) &&
homeDir.contains( (*it)->path() ) &&
(*it)->path().length() > hardDiskHome.length() )
hardDiskHome =
(*it)->name() + "=" + homeDir + "/Documents "
+ QString::number( (*it)->availBlocks() * (*it)->blockSize() )
+ " " + (*it)->options() + ";";
}
if ( !hardDiskHome.isEmpty() )
s += hardDiskHome;
e << s;
} else if ( msg == "sendSyncDate(QString)" ) {
QString app;
stream >> app;
Config cfg( "qpe" );
cfg.setGroup("SyncDate");
QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" );
e << app << cfg.readEntry( app );
//qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(),
//cfg.readEntry( app ).latin1() );
} else if ( msg == "setSyncDate(QString,QString)" ) {
QString app, date;
stream >> app >> date;
Config cfg( "qpe" );
cfg.setGroup("SyncDate");
cfg.writeEntry( app, date );
//qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1());
} else if ( msg == "startSync(QString)" ) {
QString what;
stream >> what;
delete syncDialog; syncDialog = 0;
syncDialog = new SyncDialog( this, "syncProgress", FALSE,
WStyle_Tool | WStyle_Customize |
Qt::WStyle_StaysOnTop );
syncDialog->showMaximized();
syncDialog->whatLabel->setText( "<b>" + what + "</b>" );
connect( syncDialog->buttonCancel, SIGNAL( clicked() ),
SLOT( cancelSync() ) );
} else if ( msg == "stopSync()") {
delete syncDialog; syncDialog = 0;
} else if ( msg == "getAllDocLinks()" ) {
loadDocs();
QString contents;
for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) {
DocLnk *doc = it.current();
QFileInfo fi( doc->file() );