summaryrefslogtreecommitdiff
path: root/library/applnk.cpp
authorharlekin <harlekin>2002-09-09 18:14:37 (UTC)
committer harlekin <harlekin>2002-09-09 18:14:37 (UTC)
commit3044db24e632adbcf5dbbf1874944d54cee7c8e3 (patch) (unidiff)
tree9961a3531e7fd16709002f82faa7494dd3dafed3 /library/applnk.cpp
parent2e56c4b88cfb1ebdbc0d952791af48c870f9f14b (diff)
downloadopie-3044db24e632adbcf5dbbf1874944d54cee7c8e3.zip
opie-3044db24e632adbcf5dbbf1874944d54cee7c8e3.tar.gz
opie-3044db24e632adbcf5dbbf1874944d54cee7c8e3.tar.bz2
add preloaded app control needed to runningappsbar
Diffstat (limited to 'library/applnk.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/applnk.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp
index 778ccab..9498f84 100644
--- a/library/applnk.cpp
+++ b/library/applnk.cpp
@@ -345,28 +345,28 @@ QString AppLnk::linkFile() const
345 } else 345 } else
346 that->mLinkFile = getenv( "HOME" ); 346 that->mLinkFile = getenv( "HOME" );
347 that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName); 347 that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName);
348 if ( QFile::exists(that->mLinkFile+".desktop") ) { // ok the file exists lets check if we point to the same file 348 if ( QFile::exists(that->mLinkFile+".desktop") ) { // ok the file exists lets check if we point to the same file
349 int n=1; 349 int n=1;
350 QString nn; 350 QString nn;
351 AppLnk lnk( that->mLinkFile+".desktop" ); 351 AppLnk lnk( that->mLinkFile+".desktop" );
352 if(that->file() != lnk.file() ){ 352 if(that->file() != lnk.file() ){
353 qWarning("AppLnk::linkFile exists %s", that->mLinkFile.latin1() ); 353 qWarning("AppLnk::linkFile exists %s", that->mLinkFile.latin1() );
354 while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")){ 354 while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")){
355 n++; 355 n++;
356 AppLnk lnk(nn ); // just to be sure 356 AppLnk lnk(nn ); // just to be sure
357 if(lnk.file() ==that->file() ){ 357 if(lnk.file() ==that->file() ){
358 break; 358 break;
359 } 359 }
360 } 360 }
361 that->mLinkFile = nn; 361 that->mLinkFile = nn;
362 } 362 }
363 } 363 }
364 that->mLinkFile += ".desktop"; 364 that->mLinkFile += ".desktop";
365 qWarning("AppLnk::linkFile is %s", that->mLinkFile.latin1() ); 365 qWarning("AppLnk::linkFile is %s", that->mLinkFile.latin1() );
366 storeLink(); 366 storeLink();
367 } 367 }
368 return that->mLinkFile; 368 return that->mLinkFile;
369 } 369 }
370 return mLinkFile; 370 return mLinkFile;
371} 371}
372 372
@@ -597,24 +597,47 @@ void AppLnk::setProperty(const QString& key, const QString& value)
597 Returns the property named \a key. 597 Returns the property named \a key.
598*/ 598*/
599QString AppLnk::property(const QString& key) const 599QString AppLnk::property(const QString& key) const
600{ 600{
601 QString lf = linkFile(); 601 QString lf = linkFile();
602 if ( !QFile::exists(lf) ) 602 if ( !QFile::exists(lf) )
603 return QString::null; 603 return QString::null;
604 Config cfg(lf, Config::File); 604 Config cfg(lf, Config::File);
605 return cfg.readEntry(key); 605 return cfg.readEntry(key);
606} 606}
607 607
608 608
609bool AppLnk::isPreloaded() const {
610 // Preload information is stored in the Launcher config in v1.5.
611 Config cfg("Launcher");
612 cfg.setGroup("Preload");
613 QStringList apps = cfg.readListEntry("Apps",',');
614 if (apps.contains(exec()))
615 return true;
616 return false;
617}
618
619void AppLnk::setPreloaded(bool yesNo) {
620 // Preload information is stored in the Launcher config in v1.5.
621 Config cfg("Launcher");
622 cfg.setGroup("Preload");
623 QStringList apps = cfg.readListEntry("Apps", ',');
624 if (apps.contains(exec()) && !yesNo)
625 apps.remove(exec());
626 else if (yesNo && !apps.contains(exec()))
627 apps.append(exec());
628 cfg.writeEntry("Apps", apps, ',');
629}
630
631
609/*! 632/*!
610 Deletes both the linkFile() and file() associated with this AppLnk. 633 Deletes both the linkFile() and file() associated with this AppLnk.
611*/ 634*/
612void AppLnk::removeFiles() 635void AppLnk::removeFiles()
613{ 636{
614 bool valid = isValid(); 637 bool valid = isValid();
615 if ( !valid || !linkFileKnown() || QFile::remove(linkFile()) ) { 638 if ( !valid || !linkFileKnown() || QFile::remove(linkFile()) ) {
616 if ( QFile::remove(file()) ) { 639 if ( QFile::remove(file()) ) {
617 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 640 QCopEnvelope e("QPE/System", "linkChanged(QString)");
618 if ( linkFileKnown() ) 641 if ( linkFileKnown() )
619 e << linkFile(); 642 e << linkFile();
620 else 643 else