summaryrefslogtreecommitdiff
path: root/library
authormickeyl <mickeyl>2004-03-08 16:37:42 (UTC)
committer mickeyl <mickeyl>2004-03-08 16:37:42 (UTC)
commit2599910741451f86323af10585c858d217a122d5 (patch) (side-by-side diff)
treee00a51cc13f2cfd85eb79e9af7a79d69f777ad77 /library
parent82fb70f4e5d8582185da89264e1a1e3b2517f459 (diff)
downloadopie-2599910741451f86323af10585c858d217a122d5.zip
opie-2599910741451f86323af10585c858d217a122d5.tar.gz
opie-2599910741451f86323af10585c858d217a122d5.tar.bz2
support launching applications with user defined arguments
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/applnk.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp
index 9c60f1a..5f7da8e 100644
--- a/library/applnk.cpp
+++ b/library/applnk.cpp
@@ -574,227 +574,230 @@ QString AppLnk::file() const
return mFile;
}
/*!
Returns the desktop file corresponding to this AppLnk.
\sa file() exec() name()
*/
QString AppLnk::linkFile() const
{
if ( mLinkFile.isNull() ) {
AppLnk* that = (AppLnk*)this;
if ( type().contains('/') ) {
StorageInfo storage;
const FileSystem *fs = storage.fileSystemOf( that->mFile );
/* tmpfs + and ramfs are available too but not removable
* either we fix storage or add this
*/
if ( fs && ( fs->isRemovable() || fs->disk() == "/dev/mtdblock6" || fs->disk() == "tmpfs") ) {
that->mLinkFile = fs->path();
} else
that->mLinkFile = getenv( "HOME" );
that->mLinkFile += "/Documents/"+type()+"/"+safeFileName(that->mName);
/* the desktop file exists make sure we don't point to the same file */
if ( QFile::exists(that->mLinkFile+".desktop") ) {
AppLnk lnk( that->mLinkFile + ".desktop" );
/* the linked is different */
if(that->file() != lnk.file() ) {
int n = 1;
QString nn;
while (QFile::exists((nn=that->mLinkFile+"_"+QString::number(n))+".desktop")) {
n++;
/* just to be sure */
AppLnk lnk(nn );
if (lnk.file() == that->file() )
break;
}
that->mLinkFile = nn;
}
}
that->mLinkFile += ".desktop";
storeLink();
}
return that->mLinkFile;
}
return mLinkFile;
}
/*!
Copies \a copy.
*/
AppLnk::AppLnk( const AppLnk &copy )
{
mName = copy.mName;
mPixmap = copy.mPixmap;
mBigPixmap = copy.mBigPixmap;
mExec = copy.mExec;
mType = copy.mType;
mRotation = copy.mRotation;
mComment = copy.mComment;
mFile = copy.mFile;
mLinkFile = copy.mLinkFile;
mIconFile = copy.mIconFile;
mMimeTypes = copy.mMimeTypes;
mMimeTypeIcons = copy.mMimeTypeIcons;
mId = 0;
d = new AppLnkPrivate();
d->mCat = copy.d->mCat;
d->mCatList = copy.d->mCatList;
d->mPixmaps = copy.d->mPixmaps;
}
/*!
Destroys the AppLnk. Note that if the AppLnk is currently a member
of an AppLnkSet, this will produce a run-time warning.
\sa AppLnkSet::add() AppLnkSet::remove()
*/
AppLnk::~AppLnk()
{
if ( mId )
qWarning("Deleting AppLnk that is in an AppLnkSet");
if ( d )
delete d;
}
/*!
\overload
Executes the application associated with this AppLnk.
\sa exec()
*/
void AppLnk::execute() const
{
- execute(QStringList());
+ execute( QStringList::split( ' ', property( "Arguments" ) ) );
}
/*!
Executes the application associated with this AppLnk, with
\a args as arguments.
\sa exec()
*/
void AppLnk::execute(const QStringList& args) const
{
#ifdef Q_WS_QWS
if ( !mRotation.isEmpty() ) {
// ######## this will only work in the server
int rot = QPEApplication::defaultRotation();
rot = (rot+mRotation.toInt())%360;
QCString old = getenv("QWS_DISPLAY");
setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1);
invoke(args);
setenv("QWS_DISPLAY", old.data(), 1);
} else
#endif
invoke(args);
}
/*!
Invokes the application associated with this AppLnk, with
\a args as arguments. Rotation is not taken into account by
this function, so you should not call it directly.
\sa execute()
*/
void AppLnk::invoke(const QStringList& args) const
{
- Global::execute( exec(), args[0] );
+ if ( property( "Arguments" ).isEmpty() )
+ Global::execute( exec(), args[0] );
+ else
+ Global::execute( exec(), args.join( " " ) );
}
/*!
Sets the Exec property to \a exec.
\sa exec() name()
*/
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 )
{
mName = docname;
}
/*!
Sets the File property to \a filename.
\sa file() name()
*/
void AppLnk::setFile( const QString& filename )
{
mFile = filename;
}
/*!
Sets the LinkFile property to \a filename.
\sa linkFile()
*/
void AppLnk::setLinkFile( const QString& filename )
{
mLinkFile = filename;
}
/*!
Sets the Comment property to \a comment.
This text is displayed in the 'Details Dialog', for example if the
user uses the 'press-and-hold' gesture.
\sa comment()
*/
void AppLnk::setComment( const QString& comment )
{
mComment = comment;
}
/*!
Sets the Type property to \a type.
For applications, games and settings the type should be \c
Application; for documents the type should be the document's MIME
type.
\sa type()
*/
void AppLnk::setType( const QString& type )
{
mType = type;
}
/*!
\fn QString AppLnk::icon() const
Returns the Icon property.
\sa setIcon()
*/
/*!
Sets the Icon property to \a iconname. This is the filename from
which the pixmap() and bigPixmap() are obtained.
\sa icon() setSmallIconSize() setBigIconSize()
*/
void AppLnk::setIcon( const QString& iconname )