AppLnk Class Reference
The AppLnk class represents an application available on the system. More...
#include <applnk.h>
Inheritance diagram for AppLnk:


Public Member Functions | |
| AppLnk () | |
| AppLnk (const QString &file) | |
| AppLnk (const AppLnk ©) | |
| virtual | ~AppLnk () |
| bool | isValid () const |
| QString | name () const |
| const QPixmap & | pixmap () const |
| const QPixmap & | bigPixmap () const |
| QString | icon () const |
| virtual QString | exec () const |
| QString | type () const |
| QString | rotation () const |
| QString | comment () const |
| QString | file () const |
| QString | linkFile () const |
| QStringList | mimeTypes () const |
| QStringList | mimeTypeIcons () const |
| const QArray< int > & | categories () const |
| int | id () const |
| bool | fileKnown () const |
| bool | linkFileKnown () const |
| void | execute () const |
| void | execute (const QStringList &args) const |
| void | removeFiles () |
| void | removeLinkFile () |
| 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) |
| void | setRotation (const QString &rot) |
| 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 |
| AppLnk & | operator= (const AppLnk &other) |
Static Public Member Functions | |
| void | setSmallIconSize (int) |
| void | setBigIconSize (int) |
| int | smallIconSize () |
| int | bigIconSize () |
Protected Member Functions | |
| virtual void | invoke (const QStringList &args) const |
| bool | ensureLinkExists () const |
| void | storeLink () const |
Protected Attributes | |
| QString | mName |
| QPixmap | mPixmap |
| QPixmap | mBigPixmap |
| QString | mExec |
| QString | mType |
| QString | mRotation |
| QString | mComment |
| QString | mFile |
| QString | mLinkFile |
| QString | mIconFile |
| QStringList | mMimeTypes |
| QStringList | mMimeTypeIcons |
| int | mId |
| AppLnkPrivate * | d |
Static Protected Attributes | |
| int | lastId = 5000 |
Friends | |
| class | AppLnkSet |
Detailed Description
The AppLnk class represents an application available on the system.Every Qtopia application app has a corresponding app.desktop file. When one of these files is read its data is stored as an AppLnk object.
The AppLnk class introduces some Qtopia-specific concepts, and provides a variety of functions, as described in the following sections.
Types Types
Every AppLnk object has a type. For applications, games and settings the type is Application; for documents the type is the document's MIME type.
files-and-links Files and Links
When you create an AppLnk (or more likely, a DocLnk), you don't deal directly with filenames in the filesystem. Instead you do this:
DocLnk d; d.setType("text/plain"); d.setName("My Nicely Named Document / Whatever"); // Yes, "/" is legal.
This invents a filename, and creates the file on disk (an empty reservation file) to prevent the name being used by another application.
In some circumstances, you don't want to create the file if it doesn't already exist (e.g. in the Document tab, some of the DocLnk objects represented by icons are DocLnk's created just for that view - they don't have corresponding .desktop files. To avoid littering empty reservation files around, we check in a few places to see whether the file really needs to exist).
Functionality
AppLnk objects are created by calling the constructor with the name of a .desktop file. The object can be checked for validity using isValid().
The following functions are used to set or retrieve information about the application: Get Function Set Function Short Description name() setName() application's name pixmap() none application's icon bigPixmap() none application's large icon none setIcon() sets the icon's filename type() setType() see Types above rotation() none 0, 90, 180 or 270 degrees comment() setComment() text for the Details dialog exec() setExec() executable's filename file() none document's filename linkFile() setLinkFile() .desktop filename mimeTypes() none the mime types the application can view or edit categories() setCategories() {see the function descriptions} fileKnown() none see Files and Links above linkFileKnown() none see Files and Links above property() setProperty() any AppLnk property can be retrieved or set (if writeable) using these
To save an AppLnk to disk use writeLink(). To execute the application that the AppLnk object refers to, use execute().
AppLnk's can be deleted from disk using removeLinkFile(). To remove both the link and the application's executable use removeFiles().
Icon sizes can be globally changed (but only for AppLnk objects created after the calls) with setSmallIconSize() and setBigIconSize().
Definition at line 32 of file applnk.h.
Constructor & Destructor Documentation
|
|
Creates an invalid AppLnk.
Definition at line 357 of file applnk.cpp. |
|
|
Loads file (e.g. app.desktop) as an AppLnk.
Definition at line 368 of file applnk.cpp. References Categories::addCategory(), QValueList::begin(), QValueList::end(), QString::findRev(), Categories::id(), id(), QString::isNull(), Config::isValid(), QString::left(), Categories::load(), Config::readEntry(), Config::readListEntry(), and Config::setGroup(). |
|
|
Copies copy. Definition at line 631 of file applnk.cpp. References d, mBigPixmap, mComment, mExec, mFile, mIconFile, mLinkFile, mMimeTypeIcons, mMimeTypes, mName, mPixmap, mRotation, and mType. |
|
|
Destroys the AppLnk. Note that if the AppLnk is currently a member of an AppLnkSet, this will produce a run-time warning.
Definition at line 658 of file applnk.cpp. |
Member Function Documentation
|
|
Returns TRUE if this AppLnk is valid; otherwise returns FALSE. Definition at line 40 of file applnk.h. References QString::isNull(). Referenced by removeFiles(), and removeLinkFile(). |
|
|
Sets the size used for small icons to small pixels. Only affects AppLnk objects created after the call.
Definition at line 229 of file applnk.cpp. Referenced by QPEApplication::QPEApplication(). |
|
|
Sets the size used for large icons to big pixels. Only affects AppLnk objects created after the call.
Definition at line 251 of file applnk.cpp. Referenced by QPEApplication::QPEApplication(). |
|
|
Returns the size used for small icons.
Definition at line 239 of file applnk.cpp. |
|
|
Returns the size used for large icons.
Definition at line 261 of file applnk.cpp. |
|
|
Returns the Name property. This is the user-visible name for the document or application, not the filename. See Files and Links.
|
|
|
Returns a small pixmap associated with the application.
Definition at line 496 of file applnk.cpp. Referenced by bigPixmap(). |
|
|
Returns a large pixmap associated with the application.
Definition at line 509 of file applnk.cpp. References pixmap(). |
|
|
Returns the Icon property.
|
|
|
Returns the Exec property. This is the name of the executable program associated with the AppLnk.
Reimplemented in DocLnk. Definition at line 51 of file applnk.h. Referenced by DocLnk::exec(), AppLnkSet::findExec(), and invoke(). |
|
|
Returns the type of the AppLnk. For applications, games and settings the type is Definition at line 522 of file applnk.cpp. References file(), MimeType::id(), QString::isNull(), and mType. Referenced by DocLnkSet::DocLnkSet(), DocLnk::exec(), DocLnk::invoke(), linkFile(), MimeType::MimeType(), and Ir::send(). |
|
|
Returns the Rotation property. The value is 0, 90, 180 or 270 degrees. |
|
|
Returns the Comment property.
|
|
|
Returns the file associated with the AppLnk.
Definition at line 541 of file applnk.cpp. References QString::contains(), QFile::exists(), QString::isEmpty(), QString::isNull(), QString::latin1(), QString::left(), QString::length(), mFile, mLinkFile, mName, QFile::open(), and QString::right(). Referenced by FileManager::copyFile(), FileManager::exists(), DocLnk::invoke(), linkFile(), FileManager::loadFile(), FileManager::openFile(), removeFiles(), FileManager::saveFile(), Ir::send(), and type(). |
|
|
Returns the desktop file corresponding to this AppLnk.
Definition at line 586 of file applnk.cpp. References QString::contains(), FileSystem::disk(), QFile::exists(), file(), StorageInfo::fileSystemOf(), QString::isNull(), FileSystem::isRemovable(), mFile, mLinkFile, mName, FileSystem::path(), and type(). Referenced by ensureLinkExists(), DocLnk::invoke(), property(), removeFiles(), removeLinkFile(), setProperty(), and writeLink(). |
|
|
Returns the MimeTypes property. This is the list of MIME types that the application can view or edit. |
|
|
Returns the MimeTypeIcons property of the AppLnk. |
|
|
Returns the Categories property. See the CategoryWidget for more details.
Definition at line 314 of file applnk.cpp. |
|
|
Returns the id of the AppLnk. If the AppLnk is not in an AppLnkSet, this value is 0, otherwise it is a value that is unique for the duration of the current process.
Definition at line 60 of file applnk.h. Referenced by AppLnk(), and AppLnkSet::find(). |
|
|
If the with the AppLnk associated file is not equal to QString::null Definition at line 62 of file applnk.h. References QString::isNull(). |
|
|
The filename of the AppLnk Definition at line 63 of file applnk.h. References QString::isNull(). Referenced by DocLnk::invoke(), removeFiles(), and removeLinkFile(). |
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Executes the application associated with this AppLnk.
Definition at line 672 of file applnk.cpp. Referenced by DocLnk::invoke(). |
|
|
Executes the application associated with this AppLnk, with args as arguments.
Definition at line 683 of file applnk.cpp. References QByteArray::data(), invoke(), QString::isEmpty(), and QString::toInt(). |
|
|
Deletes both the linkFile() and the file() associated with this AppLnk.
Definition at line 950 of file applnk.cpp. References file(), isValid(), linkFile(), linkFileKnown(), QFile::remove(), and writeLink(). |
|
|
Deletes the linkFile(), leaving any file() untouched.
Definition at line 974 of file applnk.cpp. References isValid(), linkFile(), linkFileKnown(), and QFile::remove(). |
|
|
Sets the Name property to docname.
Definition at line 738 of file applnk.cpp. Referenced by DocLnkSet::DocLnkSet(). |
|
|
Sets the Exec property to exec.
Definition at line 716 of file applnk.cpp. |
|
|
Sets the File property to filename.
Definition at line 748 of file applnk.cpp. Referenced by DocLnkSet::DocLnkSet(). |
|
|
Sets the LinkFile property to filename.
Definition at line 758 of file applnk.cpp. |
|
|
Sets the Comment property to comment. This text is displayed in the 'Details Dialog', for example if the user uses the 'press-and-hold' gesture.
Definition at line 771 of file applnk.cpp. |
|
|
Sets the Type property to type.
For applications, games and settings the type should be
Definition at line 785 of file applnk.cpp. |
|
|
The default rotation of the associated application. This function is included inline for binary compatible issues |
|
|
Sets the Icon property to iconname. This is the filename from which the pixmap() and bigPixmap() are obtained.
Definition at line 804 of file applnk.cpp. References Resource::loadImage(), and QImage::smoothScale(). |
|
|
Sets the Categories property to c. See the CategoryWidget for more details.
Definition at line 819 of file applnk.cpp. |
|
|
Commits the AppLnk to disk. Returns TRUE if the operation succeeded; otherwise returns FALSE. In addition, the "linkChanged(QString)" message is sent to the "QPE/System" QCop channel. Definition at line 851 of file applnk.cpp. References ensureLinkExists(), and linkFile(). Referenced by FileManager::copyFile(), removeFiles(), and FileManager::saveFile(). |
|
||||||||||||
|
Sets the property named key to value.
Definition at line 900 of file applnk.cpp. References ensureLinkExists(), linkFile(), and Config::writeEntry(). |
|
|
Returns the property named key.
Definition at line 913 of file applnk.cpp. References QFile::exists(), linkFile(), and Config::readEntry(). |
|
|
Invokes the application associated with this AppLnk, with args as arguments. Rotation is not taken into account by this function, so you should not call it directly.
Reimplemented in DocLnk. Definition at line 706 of file applnk.cpp. References exec(), and Global::execute(). Referenced by execute(). |
|
|
Attempts to ensure that the link file for this AppLnk exists, including creating any required directories. Returns TRUE if successful; otherwise returns FALSE. You should not need to use this function. Definition at line 838 of file applnk.cpp. References linkFile(). Referenced by setProperty(), and writeLink(). |
The documentation for this class was generated from the following files:
