-rw-r--r-- | library/applnk.cpp | 24 | ||||
-rw-r--r-- | library/applnk.h | 1 | ||||
-rw-r--r-- | library/lnkproperties.cpp | 29 | ||||
-rw-r--r-- | library/lnkpropertiesbase_p.ui | 354 |
4 files changed, 357 insertions, 51 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] != '/' ) diff --git a/library/applnk.h b/library/applnk.h index 71b62ef..b92ddba 100644 --- a/library/applnk.h +++ b/library/applnk.h @@ -70,12 +70,13 @@ public: void setName( const QString& docname ); 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 ); + inline void setRotation ( const QString &rotation ) { mRotation = rot; } // inline for BC 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; diff --git a/library/lnkproperties.cpp b/library/lnkproperties.cpp index 983c677..0b30a9a 100644 --- a/library/lnkproperties.cpp +++ b/library/lnkproperties.cpp @@ -23,12 +23,13 @@ #define QTOPIA_INTERNAL_FSLP #include "lnkproperties.h" #include "lnkproperties.h" #include "lnkpropertiesbase_p.h" #include "ir.h" +#include <qpe/qpeapplication.h> #include <qpe/applnk.h> #include <qpe/global.h> #include <qpe/categorywidget.h> #ifdef QWS #include <qpe/qcopenvelope_qws.h> #endif @@ -47,12 +48,13 @@ #include <qfile.h> #include <qfileinfo.h> #include <qmessagebox.h> #include <qsize.h> #include <qcombobox.h> #include <qregexp.h> +#include <qbuttongroup.h> #include <stdlib.h> LnkProperties::LnkProperties( AppLnk* l, QWidget* parent ) : QDialog( parent, 0, TRUE ), lnk(l), fileSize( 0 ) { @@ -82,13 +84,15 @@ LnkProperties::LnkProperties( AppLnk* l, QWidget* parent ) if ( lnk->type().contains('/') ) { // A document? (#### better predicate needed) connect(d->unlink,SIGNAL(clicked()),this,SLOT(unlinkLnk())); connect(d->duplicate,SIGNAL(clicked()),this,SLOT(duplicateLnk())); 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(); d->categoryEdit->setCategories( lnk->categories(), "Document View", @@ -107,12 +111,19 @@ LnkProperties::LnkProperties( AppLnk* l, QWidget* parent ) d->categoryEdit->hide(); d->docname->setReadOnly( TRUE ); 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"); QStringList apps = cfg.readListEntry("Apps",','); d->preload->setChecked( apps.contains(l->exec()) ); if ( Global::isBuiltinCommand(lnk->exec()) ) @@ -272,12 +283,28 @@ void LnkProperties::done(int ok) QArray<int> tmp = d->categoryEdit->newCategories(); if ( lnk->categories() != tmp ) { lnk->setCategories( tmp ); 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(); } 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 @@ -8,14 +8,14 @@ </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>289</width> - <height>449</height> + <width>267</width> + <height>450</height> </rect> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>5</hsizetype> @@ -28,12 +28,16 @@ </font> </property> <property stdset="1"> <name>caption</name> <string>Details</string> </property> + <property stdset="1"> + <name>icon</name> + <pixmap>image0</pixmap> + </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> @@ -76,13 +80,13 @@ <number>3</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> - <widget row="6" column="0" rowspan="1" colspan="2" > + <widget row="8" column="0" rowspan="1" colspan="2" > <class>CategoryWidget</class> <property stdset="1"> <name>name</name> <cstring>categoryEdit</cstring> </property> <property stdset="1"> @@ -91,38 +95,70 @@ <hsizetype>1</hsizetype> <vsizetype>7</vsizetype> </sizepolicy> </property> </widget> <widget row="5" column="0" rowspan="1" colspan="2" > - <class>QLabel</class> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>rotate</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Use custom rotation</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <property> + <name>layoutSpacing</name> + </property> + <property> + <name>whatsThis</name> + <string>Preload this application so that it is available instantly.</string> + </property> + </widget> + <widget row="0" column="1" > + <class>QLineEdit</class> <property stdset="1"> <name>name</name> - <cstring>spacer</cstring> + <cstring>docname</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>7</vsizetype> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>text</name> <string></string> </property> + <property> + <name>whatsThis</name> + <string>The name of this document.</string> + </property> </widget> - <widget row="3" column="0" > - <class>QLabel</class> + <widget row="1" column="1" > + <class>QComboBox</class> <property stdset="1"> <name>name</name> - <cstring>commentLabel</cstring> + <cstring>locationCombo</cstring> </property> <property stdset="1"> - <name>text</name> - <string>Comment:</string> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property> + <name>whatsThis</name> + <string>The media the document resides on.</string> </property> </widget> <widget row="2" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> @@ -140,50 +176,49 @@ <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> </widget> - <widget row="1" column="1" > - <class>QComboBox</class> + <widget row="2" column="1" > + <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>locationCombo</cstring> + <cstring>type</cstring> </property> <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> - </sizepolicy> - </property> - <property> - <name>whatsThis</name> - <string>The media the document resides on.</string> + <name>text</name> + <string></string> </property> </widget> - <widget row="0" column="1" > - <class>QLineEdit</class> + <widget row="1" column="0" > + <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>docname</cstring> + <cstring>locationLabel</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> </sizepolicy> </property> <property stdset="1"> - <name>text</name> + <name>caption</name> <string></string> </property> + <property stdset="1"> + <name>text</name> + <string>Location:</string> + </property> <property> - <name>whatsThis</name> - <string>The name of this document.</string> + <name>layoutMargin</name> + </property> + <property> + <name>layoutSpacing</name> </property> </widget> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> @@ -195,56 +230,244 @@ </property> <property stdset="1"> <name>text</name> <string>Name:</string> </property> </widget> - <widget row="1" column="0" > + <widget row="3" column="1" > <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>locationLabel</cstring> + <cstring>comment</cstring> </property> <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>1</vsizetype> - </sizepolicy> + <name>text</name> + <string></string> </property> + </widget> + <widget row="6" column="0" rowspan="1" colspan="2" > + <class>QButtonGroup</class> <property stdset="1"> - <name>caption</name> + <name>name</name> + <cstring>rotateButtons</cstring> + </property> + <property stdset="1"> + <name>frameShape</name> + <enum>NoFrame</enum> + </property> + <property stdset="1"> + <name>title</name> <string></string> </property> <property stdset="1"> - <name>text</name> - <string>Location:</string> + <name>exclusive</name> + <bool>true</bool> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>3</number> + </property> + <spacer> + <property> + <name>name</name> + <cstring>s1</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Horizontal</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Fixed</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>28</height> + </size> + </property> + </spacer> + <widget> + <class>QToolButton</class> + <property stdset="1"> + <name>name</name> + <cstring>ToolButton1</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string></string> + </property> + <property stdset="1"> + <name>pixmap</name> + <pixmap>image0</pixmap> + </property> + <property stdset="1"> + <name>toggleButton</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>on</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>usesBigPixmap</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>toggleButton</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>on</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>buttonGroupId</name> + <number>0</number> + </property> </widget> - <widget row="2" column="1" > - <class>QLabel</class> + <widget> + <class>QToolButton</class> <property stdset="1"> <name>name</name> - <cstring>type</cstring> + <cstring>ToolButton2</cstring> </property> <property stdset="1"> <name>text</name> <string></string> </property> + <property stdset="1"> + <name>pixmap</name> + <pixmap>image1</pixmap> + </property> + <property stdset="1"> + <name>toggleButton</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>usesBigPixmap</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>toggleButton</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>buttonGroupId</name> + <number>1</number> + </property> </widget> - <widget row="3" column="1" > + <widget> + <class>QToolButton</class> + <property stdset="1"> + <name>name</name> + <cstring>ToolButton3</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string></string> + </property> + <property stdset="1"> + <name>pixmap</name> + <pixmap>image2</pixmap> + </property> + <property stdset="1"> + <name>toggleButton</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>usesBigPixmap</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>toggleButton</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>buttonGroupId</name> + <number>2</number> + </property> + </widget> + <widget> + <class>QToolButton</class> + <property stdset="1"> + <name>name</name> + <cstring>ToolButton4</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string></string> + </property> + <property stdset="1"> + <name>pixmap</name> + <pixmap>image3</pixmap> + </property> + <property stdset="1"> + <name>toggleButton</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>usesBigPixmap</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>toggleButton</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>buttonGroupId</name> + <number>3</number> + </property> + </widget> + <spacer> + <property> + <name>name</name> + <cstring>s4</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Horizontal</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>MinimumExpanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget row="7" column="0" rowspan="1" colspan="2" > <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>comment</cstring> + <cstring>labelspacer</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>7</vsizetype> + </sizepolicy> </property> <property stdset="1"> <name>text</name> <string></string> </property> </widget> @@ -266,12 +489,23 @@ </property> <property> <name>whatsThis</name> <string>Preload this application so that it is available instantly.</string> </property> </widget> + <widget row="3" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>commentLabel</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Comment:</string> + </property> + </widget> </grid> </widget> <widget> <class>Line</class> <property stdset="1"> <name>name</name> @@ -400,21 +634,45 @@ </sizehint> <container>0</container> <sizepolicy> <hordata>7</hordata> <verdata>7</verdata> </sizepolicy> - <pixmap>image0</pixmap> + <pixmap>image4</pixmap> </customwidget> </customwidgets> <images> <image> <name>image0</name> + <data format="XPM.GZ" length="1226">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523236520022230543251d2e253d856405bffcbc54105b19c856360003b014013032d4282b2b13366708a951067908240fa6a00a95612cb01a6528d04362e92158e0a40213830510c4546598dd103570b72098482ea3ae1ac2eec1ef2f6565d4f051c6123e3035f8c1a81a2aa8a9b5e60200f6abd263</data> + </image> + <image> + <name>image1</name> + <data format="XPM.GZ" length="1226">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523236520022230543251d2e253d856405bffcbc54105b19c856360003b01416a0ac8c6053a2061960aa019b806c0ca61a65a81a7c764125e9a486b07b40d2cacaf8fd0555a4875f0d0620cf1c22dc33d8c2197fda504605e4ab41b5129f7b3001b630c46317f16a88cb17c814add5d02ecdd75a730100b509d263</data> + </image> + <image> + <name>image2</name> + <data format="XPM.GZ" length="1226">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523236520022230543251d2e253d856405bffcbc54105b19c856360003b0140130aa863a6a9495f5f49441002c02664030840d53a3ac0c53a40c67c25950bb60d27a70857a08268a7b20164059082695d510e31e62fc85193e7aa8e1832568a1eaf1c6c5e053a34c500d0a18b66a6aadb9001be4d263</data> + </image> + <image> + <name>image3</name> + <data format="XPM.GZ" length="1226">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523236520022230543251d2e253d856405bffcbc54105b19c856360003b014125006013d5480a64659198b22543510697445e86a9029daaad183ba87809bb1788c7435d8019a392872cad8d5a002b2d510e777648ad66a08a70d62d2185169152b1819699ec870c634869cf48c1e7cc4aba9b5e602005d86d263</data> + </image> + <image> + <name>image4</name> <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> </image> </images> +<connections> + <connection> + <sender>rotate</sender> + <signal>toggled(bool)</signal> + <receiver>rotateButtons</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> <tabstops> <tabstop>docname</tabstop> <tabstop>preload</tabstop> <tabstop>locationCombo</tabstop> <tabstop>unlink</tabstop> <tabstop>duplicate</tabstop> |