From a1ebad08d462e682554d39a9beabce125a374452 Mon Sep 17 00:00:00 2001 From: sandman Date: Sun, 06 Oct 2002 03:26:59 +0000 Subject: - support "Rotation" setting in .desktop applnk file - changed properties dialog to make Rotation editable - fixed a long-standing QPE bug: launcher expects AppLnk::file() to return QString::null for *all real* applnks (as opposed to doclnks) -- but AppLnk itself initializes this field to the name of the dir, where the applnk is stored. This is why qcop "QPE/System" "linkChanged(QString)" xyz.desktop cleared a whole launcher tab I hope I didn't break anything with this change ;) --- (limited to 'library/applnk.cpp') diff --git a/library/applnk.cpp b/library/applnk.cpp index 44f3f58..a56da5d 100644 --- a/library/applnk.cpp +++ b/library/applnk.cpp @@ -372,7 +372,10 @@ AppLnk::AppLnk( const QString &file ) mMimeTypeIcons = config.readListEntry( "MimeTypeIcons", ';' ); mLinkFile = file; mFile = config.readEntry("File", QString::null); - if ( mFile[0] != '/' ) { + if ( !mExec. isEmpty ( )) { + mFile = QString::null; + } + else if ( mFile[0] != '/' ) { int slash = file.findRev('/'); if ( slash >= 0 ) { mFile = file.left(slash) + '/' + mFile; @@ -520,7 +523,7 @@ QString AppLnk::type() const */ QString AppLnk::file() const { - if ( mFile.isNull() ) { + if ( mExec.isEmpty ( ) && mFile.isNull() ) { AppLnk* that = (AppLnk*)this; QString ext = MimeType(mType).extension(); if ( !ext.isEmpty() ) @@ -529,6 +532,7 @@ QString AppLnk::file() const that->mFile = mLinkFile.right(8)==".desktop" // 8 = strlen(".desktop") ? mLinkFile.left(mLinkFile.length()-8) : mLinkFile; + qDebug("mFile now == %s", mFile.latin1()); } else if ( mType.contains('/') ) { that->mFile = QString(getenv("HOME"))+"/Documents/"+mType+"/"+safeFileName(that->mName); @@ -697,6 +701,18 @@ void AppLnk::setExec( const QString& exec ) mExec = exec; } +#if 0 // this was inlined for better BC +/*! + Sets the Rotation property to \a rot. + + \sa rotation() +*/ +void AppLnk::setRotation ( const QString &rot ) +{ + mRotation = rot; +} +#endif + /*! Sets the Name property to \a docname. @@ -835,6 +851,10 @@ void AppLnk::storeLink() const config.writeEntry("Name",mName); if ( !mIconFile.isNull() ) config.writeEntry("Icon",mIconFile); config.writeEntry("Type",type()); + if(!rotation().isEmpty()) + config.writeEntry("Rotation",rotation()); + else + config.removeEntry("Rotation"); if ( !mComment.isNull() ) config.writeEntry("Comment",mComment); QString f = file(); int i = 0; -- cgit v0.9.0.2