summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-06-11 21:51:34 (UTC)
committer harlekin <harlekin>2002-06-11 21:51:34 (UTC)
commit7ab79b2a607a0790d9ef040c76ae2687d9c5a3f8 (patch) (side-by-side diff)
treecd2782f9be46e59cb49867bb9221e4e6d7b27d01
parent53cbd5404cea16ec1ddbd2e264fcc42acfb453c8 (diff)
downloadopie-7ab79b2a607a0790d9ef040c76ae2687d9c5a3f8.zip
opie-7ab79b2a607a0790d9ef040c76ae2687d9c5a3f8.tar.gz
opie-7ab79b2a607a0790d9ef040c76ae2687d9c5a3f8.tar.bz2
attempt to fix remove from autostart
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp289
-rw-r--r--core/pim/today/changelog1
-rw-r--r--core/pim/today/today.cpp6
3 files changed, 148 insertions, 148 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index a0f04f1..59b38e3 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -513,116 +513,116 @@ 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);
}
}
}
-/** This is a HACK....
+/** 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
+ *
+ * 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;
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 ){
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 ) {
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;
@@ -697,249 +697,248 @@ void Launcher::properties( AppLnk *appLnk )
connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
prop.showMaximized();
prop.exec();
in_lnk_props = FALSE;
if ( got_lnk_change ) {
updateLink(lnk_change);
}
}
}
void Launcher::updateLink(const QString& link)
{
if (link.isNull())
updateTabs();
else if (link.isEmpty())
updateDocs();
else
tabs->updateLink(link);
}
void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
{
QDataStream stream( data, IO_ReadOnly );
if ( msg == "closing(QString)" ){
- QString app;
- stream >> app;
- qWarning("app closed %s", app.latin1() );
- MRUList::removeTask( app );
+ QString app;
+ stream >> app;
+ qWarning("app closed %s", app.latin1() );
+ MRUList::removeTask( app );
}else if ( msg == "linkChanged(QString)" ) {
- QString link;
- stream >> link;
- if ( in_lnk_props ) {
- got_lnk_change = TRUE;
- lnk_change = link;
- } else {
- updateLink(link);
- }
+ QString link;
+ stream >> link;
+ if ( in_lnk_props ) {
+ got_lnk_change = TRUE;
+ lnk_change = link;
+ } else {
+ updateLink(link);
+ }
} else if ( msg == "busy()" ) {
- emit busy();
+ emit busy();
} else if ( msg == "notBusy(QString)" ) {
- QString app;
- stream >> app;
- tabs->setBusy(FALSE);
- emit notBusy(app);
+ QString app;
+ stream >> app;
+ tabs->setBusy(FALSE);
+ emit notBusy(app);
} else if ( msg == "mkdir(QString)" ) {
- QString dir;
- stream >> dir;
- if ( !dir.isEmpty() )
- mkdir( dir );
+ QString dir;
+ stream >> dir;
+ if ( !dir.isEmpty() )
+ mkdir( dir );
} else if ( msg == "rdiffGenSig(QString,QString)" ) {
- QString baseFile, sigFile;
- stream >> baseFile >> sigFile;
- QRsync::generateSignature( baseFile, sigFile );
+ QString baseFile, sigFile;
+ stream >> baseFile >> sigFile;
+ QRsync::generateSignature( baseFile, sigFile );
} else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
- QString baseFile, sigFile, deltaFile;
- stream >> baseFile >> sigFile >> deltaFile;
- QRsync::generateDiff( baseFile, sigFile, deltaFile );
+ QString baseFile, sigFile, deltaFile;
+ stream >> baseFile >> sigFile >> deltaFile;
+ QRsync::generateDiff( baseFile, sigFile, deltaFile );
} else if ( msg == "rdiffApplyPatch(QString,QString)" ) {
- QString baseFile, deltaFile;
- stream >> baseFile >> deltaFile;
- if ( !QFile::exists( baseFile ) ) {
- QFile f( baseFile );
- f.open( IO_WriteOnly );
- f.close();
- }
- QRsync::applyDiff( baseFile, deltaFile );
- QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
- e << baseFile;
+ QString baseFile, deltaFile;
+ stream >> baseFile >> deltaFile;
+ if ( !QFile::exists( baseFile ) ) {
+ QFile f( baseFile );
+ f.open( IO_WriteOnly );
+ f.close();
+ }
+ QRsync::applyDiff( baseFile, deltaFile );
+ QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
+ e << baseFile;
} else if ( msg == "rdiffCleanup()" ) {
- mkdir( "/tmp/rdiff" );
- QDir dir;
- dir.setPath( "/tmp/rdiff" );
- QStringList entries = dir.entryList();
- for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
- dir.remove( *it );
+ mkdir( "/tmp/rdiff" );
+ QDir dir;
+ dir.setPath( "/tmp/rdiff" );
+ QStringList entries = dir.entryList();
+ for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
+ dir.remove( *it );
} else if ( msg == "sendHandshakeInfo()" ) {
- QString home = getenv( "HOME" );
- QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
- e << home;
- int locked = (int) Desktop::screenLocked();
- e << locked;
- // register an app for autostart
- // if clear is send the list is cleared.
+ QString home = getenv( "HOME" );
+ QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
+ e << home;
+ int locked = (int) Desktop::screenLocked();
+ e << locked;
+ // register an app for autostart
+ // if clear is send the list is cleared.
} else if ( msg == "autoStart(QString)" ) {
QString appName;
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()" ) {
+ } 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() )
- 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") &&
- 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;
+ QListIterator<FileSystem> it ( fs );
+ QString s;
+ QString homeDir = getenv("HOME");
+ QString hardDiskHome;
+ for ( ; it.current(); ++it ) {
+ if ( (*it)->isRemovable() )
+ 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") &&
+ 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;
+ 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() );
+ 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());
+ 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;
+ 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() );
- if ( !fi.exists() )
- continue;
-
- bool fake = !doc->linkFileKnown();
- if ( !fake ) {
- QFile f( doc->linkFile() );
- if ( f.open( IO_ReadOnly ) ) {
- QTextStream ts( &f );
- ts.setEncoding( QTextStream::UnicodeUTF8 );
- contents += ts.read();
- f.close();
- } else
- fake = TRUE;
- }
- if (fake) {
- contents += "[Desktop Entry]\n";
- contents += "Categories = " + Qtopia::Record::idsToString( doc->categories() ) + "\n";
- contents += "File = "+doc->file()+"\n";
- contents += "Name = "+doc->name()+"\n";
- contents += "Type = "+doc->type()+"\n";
- }
- contents += QString("Size = %1\n").arg( fi.size() );
- }
+ loadDocs();
+
+ QString contents;
+
+ for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) {
+ DocLnk *doc = it.current();
+ QFileInfo fi( doc->file() );
+ if ( !fi.exists() )
+ continue;
+
+ bool fake = !doc->linkFileKnown();
+ if ( !fake ) {
+ QFile f( doc->linkFile() );
+ if ( f.open( IO_ReadOnly ) ) {
+ QTextStream ts( &f );
+ ts.setEncoding( QTextStream::UnicodeUTF8 );
+ contents += ts.read();
+ f.close();
+ } else
+ fake = TRUE;
+ }
+ if (fake) {
+ contents += "[Desktop Entry]\n";
+ contents += "Categories = " + Qtopia::Record::idsToString( doc->categories() ) + "\n";
+ contents += "File = "+doc->file()+"\n";
+ contents += "Name = "+doc->name()+"\n";
+ contents += "Type = "+doc->type()+"\n";
+ }
+ contents += QString("Size = %1\n").arg( fi.size() );
+ }
- //qDebug( "sending length %d", contents.length() );
- QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
- e << contents;
+ //qDebug( "sending length %d", contents.length() );
+ QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
+ e << contents;
- qDebug( "================ \n\n%s\n\n===============",
- contents.latin1() );
+ qDebug( "================ \n\n%s\n\n===============",
+ contents.latin1() );
- delete docsFolder;
- docsFolder = 0;
+ delete docsFolder;
+ docsFolder = 0;
}
}
void Launcher::cancelSync()
{
QCopEnvelope e( "QPE/Desktop", "cancelSync()" );
}
void Launcher::storageChanged()
{
if ( in_lnk_props ) {
got_lnk_change = TRUE;
lnk_change = "";
} else {
updateDocs();
}
}
bool Launcher::mkdir(const QString &localPath)
{
QDir fullDir(localPath);
if (fullDir.exists())
return true;
diff --git a/core/pim/today/changelog b/core/pim/today/changelog
index 93bbcac..73de50d 100644
--- a/core/pim/today/changelog
+++ b/core/pim/today/changelog
@@ -1,26 +1,27 @@
0.3.4
+* "fill our business card now a clickable label"
* Several bugfixes regarding todo section.
0.3.3
* Changed the logo so it better scales to bigger display and also
made the "Today" string translatable.
* some am/pm fixes
* clickable labels now in libopie
0.3.2
* Autostart is now more configurable. You can decide how long
the ipaq has to has been suspended, before autostart is triggered.(Opie
only)
* am/pm time optinal (autodetect)
0.3.1
* fixed the wrong color of the buttons
* better translation (thanks carsten and others)
* fixes memory leaks
* bugfixes in calendar part, now location and note are working again.
0.3.0
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 06cfa01..9e9d31f 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -114,55 +114,55 @@ void Today::setOwnerField() {
} else {
OwnerField->setText( "<b>" + tr ("Please fill out the business card")+" </b>");
}
}
/*
* Set the owner field with a given QString, for example per qcop.
*/
void Today::setOwnerField(QString &message) {
if (!message.isEmpty()) {
OwnerField->setText("<b>" + message + "</b>");
}
}
/*
* Autostart, uses the new (opie only) autostart method in the launcher code.
* If registered against that today ist started on each resume.
*/
void Today::autoStart() {
Config cfg("today");
cfg.setGroup("Autostart");
int AUTOSTART = cfg.readNumEntry("autostart",1);
// qDebug(QString("%1").arg(AUTOSTART));
if (AUTOSTART) {
- QCopEnvelope e("QPE/System", "autoStart(QString, QString, QString)");
+ QCopEnvelope e("QPE/System", "autoStart(QString,QString,QString)");
e << QString("add");
e << QString("today");
e << AUTOSTART_TIMER;
} else {
qDebug("Nun in else bei autostart");
- QCopEnvelope e("QPE/System", "autoStart(QString, QString)");
+ QCopEnvelope e("QPE/System", "autoStart(QString,QString)");
e << QString("remove");
e << QString("today");
}
}
/*
* Repaint method. Reread all fields.
*/
void Today::draw() {
init();
getDates();
getMail();
// if the todolist.xml file was not modified in between, do not parse it.
if (checkIfModified() || NEW_START==1) {
if (todo) delete todo;
todo = new ToDoDB;
getTodo();
}
// how often refresh
QTimer::singleShot( 20*1000, this, SLOT(draw() ) );
}
@@ -400,56 +400,56 @@ void Today::getTodo() {
// not the overdues, we allready got them, and not if we are
// over the maxlines
if (!(*it).isOverdue() && ( ammount < MAX_LINES_TASK) ) {
tmpout += "<b>-</b>" + ((*it).description()).mid(0, MAX_CHAR_CLIP) + "<br>";
ammount++;
}
}
}
if (count > 0) {
if( count == 1 ) {
output = tr("There is <b> 1</b> active task: <br>" );
} else {
output = tr("There are <b> %1</b> active tasks: <br>").arg(count);
}
output += tmpout;
} else {
output = tr("No active tasks");
}
TodoField->setText(tr(output));
}
-
/*
* launch addressbook (personal card)
*/
void Today::editCard() {
QCopEnvelope w("QPE/System", "execute(QString)");
w << QString("addressbook");
+ // while( !QCopChannel::isRegistered("QPE/Addressbook"))
QCopEnvelope v("QPE/Addressbook", "editPersonalAndClose()");
}
/*
* launches datebook
*/
void Today::startDatebook() {
QCopEnvelope e("QPE/System", "execute(QString)");
e << QString("datebook");
}
/*
* starts the edit dialog as known from datebook
*/
extern QPEApplication *todayApp;
void Today::editEvent(const Event &e) {
startDatebook();
while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents();
QCopEnvelope env("QPE/Datebook", "editEvent(int)");
env << e.uid();