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') 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; diff --git a/library/applnk.h b/library/applnk.h index 71b62ef..b92ddba 100644 --- a/library/applnk.h +++ b/library/applnk.h @@ -73,6 +73,7 @@ public: void setLinkFile( const QString& filename ); void setComment( const QString& comment ); void setType( const QString& mimetype ); + inline void setRotation ( const QString &rotation ) { mRotation = rot; } // inline for BC void setIcon( const QString& iconname ); void setCategories( const QArray &v ); bool writeLink() const; diff --git a/library/lnkproperties.cpp b/library/lnkproperties.cpp index 983c677..0b30a9a 100644 --- a/library/lnkproperties.cpp +++ b/library/lnkproperties.cpp @@ -26,6 +26,7 @@ #include "lnkpropertiesbase_p.h" #include "ir.h" +#include #include #include #include @@ -50,6 +51,7 @@ #include #include #include +#include #include @@ -85,7 +87,9 @@ LnkProperties::LnkProperties( AppLnk* l, QWidget* parent ) d->docname->setReadOnly( FALSE ); d->preload->hide(); - d->spacer->hide(); + d->rotate->hide(); + d->rotateButtons->hide(); + d->labelspacer->hide(); // ### THIS MUST GO, FIX WIERD BUG in QLAYOUT d->categoryEdit->kludge(); @@ -110,6 +114,13 @@ LnkProperties::LnkProperties( AppLnk* l, QWidget* parent ) if ( l->property("CanFastload") == "0" ) d->preload->hide(); + if ( !l->property("Rotation"). isEmpty ()) { + d->rotate->setChecked ( true ); + d->rotateButtons->setButton(((QPEApplication::defaultRotation()+l->rotation().toInt())%360)/90); + } + else { + d->rotateButtons->setEnabled(false); + } Config cfg("Launcher"); cfg.setGroup("Preload"); @@ -275,12 +286,28 @@ void LnkProperties::done(int ok) changed = TRUE; } } + if ( !d->rotate->isHidden()) { + QString newrot; + + if (d->rotate->isChecked()) { + int rot=0; + for(; rot<4; rot++) { + if (d->rotateButtons->find(rot)->isOn()) + break; + } + newrot = QString::number((QPEApplication::defaultRotation()+rot*90)%360); + } + if (newrot !=lnk->rotation()) { + lnk->setRotation(newrot); + changed = TRUE; + } + } if ( d->preload->isHidden() && d->locationCombo->currentItem() != currentLocation ) { moveLnk(); } else if ( changed ) { lnk->writeLink(); } - + if ( !d->preload->isHidden() ) { Config cfg("Launcher"); cfg.setGroup("Preload"); diff --git a/library/lnkpropertiesbase_p.ui b/library/lnkpropertiesbase_p.ui index e7139e7..c2271f1 100644 --- a/library/lnkpropertiesbase_p.ui +++ b/library/lnkpropertiesbase_p.ui @@ -11,8 +11,8 @@ 0 0 - 289 - 449 + 267 + 450 @@ -31,6 +31,10 @@ caption Details + + icon + image0 + layoutMargin @@ -79,7 +83,7 @@ spacing 3 - + CategoryWidget name @@ -94,53 +98,46 @@ - QLabel + QCheckBox name - spacer - - - sizePolicy - - 1 - 7 - + rotate text - + Use custom rotation - - - QLabel - - name - commentLabel + + layoutMargin - - text - Comment: + + layoutSpacing + + + whatsThis + Preload this application so that it is available instantly. - - QLabel + + QLineEdit name - typeLabel + docname - focusPolicy - NoFocus + sizePolicy + + 7 + 0 + text - Type: - - - layoutMargin + - layoutSpacing + whatsThis + The name of this document. @@ -161,41 +158,36 @@ The media the document resides on. - - QLineEdit + + QLabel name - docname + typeLabel - sizePolicy - - 7 - 0 - + focusPolicy + NoFocus text - + Type: - whatsThis - The name of this document. + layoutMargin + + + layoutSpacing - + QLabel name - TextLabel1 - - - frameShadow - MShadow + type text - Name: + @@ -226,15 +218,19 @@ layoutSpacing - + QLabel name - type + TextLabel1 + + + frameShadow + MShadow text - + Name: @@ -248,6 +244,233 @@ + + QButtonGroup + + name + rotateButtons + + + frameShape + NoFrame + + + title + + + + exclusive + true + + + layoutMargin + + + layoutSpacing + + + + margin + 0 + + + spacing + 3 + + + + name + s1 + + + orientation + Horizontal + + + sizeType + Fixed + + + sizeHint + + 20 + 28 + + + + + QToolButton + + name + ToolButton1 + + + text + + + + pixmap + image0 + + + toggleButton + true + + + on + false + + + usesBigPixmap + true + + + toggleButton + true + + + on + false + + + buttonGroupId + 0 + + + + QToolButton + + name + ToolButton2 + + + text + + + + pixmap + image1 + + + toggleButton + true + + + usesBigPixmap + true + + + toggleButton + true + + + buttonGroupId + 1 + + + + QToolButton + + name + ToolButton3 + + + text + + + + pixmap + image2 + + + toggleButton + true + + + usesBigPixmap + true + + + toggleButton + true + + + buttonGroupId + 2 + + + + QToolButton + + name + ToolButton4 + + + text + + + + pixmap + image3 + + + toggleButton + true + + + usesBigPixmap + true + + + toggleButton + true + + + buttonGroupId + 3 + + + + + name + s4 + + + orientation + Horizontal + + + sizeType + MinimumExpanding + + + sizeHint + + 20 + 20 + + + + + + + QLabel + + name + labelspacer + + + sizePolicy + + 1 + 7 + + + + text + + + QCheckBox @@ -269,6 +492,17 @@ Preload this application so that it is available instantly. + + QLabel + + name + commentLabel + + + text + Comment: + + @@ -403,15 +637,39 @@ 7 7 - image0 + image4 image0 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523236520022230543251d2e253d856405bffcbc54105b19c856360003b014013032d4282b2b13366708a951067908240fa6a00a95612cb01a6528d04362e92158e0a40213830510c4546598dd103570b72098482ea3ae1ac2eec1ef2f6565d4f051c6123e3035f8c1a81a2aa8a9b5e60200f6abd263 + + + image1 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523236520022230543251d2e253d856405bffcbc54105b19c856360003b01416a0ac8c6053a2061960aa019b806c0ca61a65a81a7c764125e9a486b07b40d2cacaf8fd0555a4875f0d0620cf1c22dc33d8c2197fda504605e4ab41b5129f7b3001b630c46317f16a88cb17c814add5d02ecdd75a730100b509d263 + + + image2 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523236520022230543251d2e253d856405bffcbc54105b19c856360003b0140130aa863a6a9495f5f49441002c02664030840d53a3ac0c53a40c67c25950bb60d27a70857a08268a7b20164059082695d510e31e62fc85193e7aa8e1832568a1eaf1c6c5e053a34c500d0a18b66a6aadb9001be4d263 + + + image3 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523236520022230543251d2e253d856405bffcbc54105b19c856360003b014125006013d5480a64659198b22543510697445e86a9029daaad183ba87809bb1788c7435d8019a392872cad8d5a002b2d510e777648ad66a08a70d62d2185169152b1819699ec870c634869cf48c1e7cc4aba9b5e602005d86d263 + + + image4 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 + + + rotate + toggled(bool) + rotateButtons + setEnabled(bool) + + docname preload -- cgit v0.9.0.2