-rw-r--r-- | library/applnk.cpp | 29 | ||||
-rw-r--r-- | library/applnk.h | 5 |
2 files changed, 31 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 } else that->mLinkFile = getenv( "HOME" ); that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName); if ( QFile::exists(that->mLinkFile+".desktop") ) { // ok the file exists lets check if we point to the same file int n=1; QString nn; AppLnk lnk( that->mLinkFile+".desktop" ); if(that->file() != lnk.file() ){ qWarning("AppLnk::linkFile exists %s", that->mLinkFile.latin1() ); while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")){ n++; AppLnk lnk(nn ); // just to be sure - if(lnk.file() ==that->file() ){ + if(lnk.file() ==that->file() ){ break; - } - } + } + } that->mLinkFile = nn; } } that->mLinkFile += ".desktop"; qWarning("AppLnk::linkFile is %s", that->mLinkFile.latin1() ); storeLink(); } return that->mLinkFile; } return mLinkFile; } @@ -597,24 +597,47 @@ void AppLnk::setProperty(const QString& key, const QString& value) Returns the property named \a key. */ QString AppLnk::property(const QString& key) const { QString lf = linkFile(); if ( !QFile::exists(lf) ) return QString::null; Config cfg(lf, Config::File); return cfg.readEntry(key); } +bool AppLnk::isPreloaded() const { + // Preload information is stored in the Launcher config in v1.5. + Config cfg("Launcher"); + cfg.setGroup("Preload"); + QStringList apps = cfg.readListEntry("Apps",','); + if (apps.contains(exec())) + return true; + return false; +} + +void AppLnk::setPreloaded(bool yesNo) { + // Preload information is stored in the Launcher config in v1.5. + Config cfg("Launcher"); + cfg.setGroup("Preload"); + QStringList apps = cfg.readListEntry("Apps", ','); + if (apps.contains(exec()) && !yesNo) + apps.remove(exec()); + else if (yesNo && !apps.contains(exec())) + apps.append(exec()); + cfg.writeEntry("Apps", apps, ','); +} + + /*! Deletes both the linkFile() and file() associated with this AppLnk. */ void AppLnk::removeFiles() { bool valid = isValid(); if ( !valid || !linkFileKnown() || QFile::remove(linkFile()) ) { if ( QFile::remove(file()) ) { QCopEnvelope e("QPE/System", "linkChanged(QString)"); if ( linkFileKnown() ) e << linkFile(); else diff --git a/library/applnk.h b/library/applnk.h index 18e20b6..9b5523e 100644 --- a/library/applnk.h +++ b/library/applnk.h @@ -69,24 +69,29 @@ public: void setExec( const QString& exec ); void setFile( const QString& filename ); void setLinkFile( const QString& filename ); void setComment( const QString& comment ); void setType( const QString& mimetype ); void setIcon( const QString& iconname ); void setCategories( const QArray<int> &v ); bool writeLink() const; void setProperty(const QString& key, const QString& value); QString property(const QString& key) const; +//#ifdef QTOPIA_INTERNAL_PRELOADACCESS + bool isPreloaded() const; + void setPreloaded(bool yesNo); +//#endif + protected: QString mName; QPixmap mPixmap; QPixmap mBigPixmap; QString mExec; QString mType; QString mRotation; QString mComment; QString mFile; QString mLinkFile; QString mIconFile; QStringList mMimeTypes; |