summaryrefslogtreecommitdiff
path: root/library/applnk.cpp
Side-by-side diff
Diffstat (limited to 'library/applnk.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/applnk.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp
index 44f3f58..a56da5d 100644
--- a/library/applnk.cpp
+++ b/library/applnk.cpp
@@ -369,13 +369,16 @@ AppLnk::AppLnk( const QString &file )
mMimeTypes = config.readListEntry( "MimeType", ';' );
for (QStringList::Iterator it=mMimeTypes.begin(); it!=mMimeTypes.end(); ++it)
*it = (*it).lower();
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;
}
}
d->mCatList = config.readListEntry("Categories", ';');
@@ -517,21 +520,22 @@ QString AppLnk::type() const
Returns the file associated with the AppLnk.
\sa exec() name()
*/
QString AppLnk::file() const
{
- if ( mFile.isNull() ) {
+ if ( mExec.isEmpty ( ) && mFile.isNull() ) {
AppLnk* that = (AppLnk*)this;
QString ext = MimeType(mType).extension();
if ( !ext.isEmpty() )
ext = "." + ext;
if ( !mLinkFile.isEmpty() ) {
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);
/*
* A file with the same name or a .desktop file already exists
*/
@@ -694,12 +698,24 @@ void AppLnk::invoke(const QStringList& args) const
*/
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.
\sa name()
*/
void AppLnk::setName( const QString& docname )
@@ -832,12 +848,16 @@ void AppLnk::storeLink() const
{
Config config( mLinkFile, Config::File );
config.setGroup("Desktop Entry");
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;
while ( i < (int)f.length() && i < (int)mLinkFile.length() && f[i] == mLinkFile[i] )
i++;
while ( i && f[i] != '/' )