#include </home/clem/local/src/opie/library/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 | |
| static void | setSmallIconSize (int) |
| static void | setBigIconSize (int) |
| static int | smallIconSize () |
| static 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 | |
| static int | lastId = 5000 |
Private Member Functions | |
| const QPixmap & | pixmap (int pos, int size) const |
Friends | |
| class | AppLnkSet |
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
Every AppLnk object has a \e type. For applications, games and settings the type is \c Application; for documents the type is the document's MIME type. \target files-and-links @section Files and Links When you create an AppLnk (or more likely, a \link doclnk.html DocLnk\endlink), you don't deal directly with filenames in the filesystem. Instead you do this: @code DocLnk d; d.setType("text/plain"); d.setName("My Nicely Named Document / Whatever"); // Yes, "/" is legal. \endcode At this point, the file() and linkFile() are unknown. Normally this is uninteresting, and the names become automatically known, and more importantly, becomes reserved, when you ask what they are: @code QString fn = d.file(); \endcode 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 \link doclnk.html DocLnk\endlink objects represented by icons are DocLnk's created just for that view - they don't have corresponding \c .desktop files. To avoid littering empty reservation files around, we check in a few places to see whether the file really needs to exist). @section Functionality AppLnk objects are created by calling the constructor with the name of a \e .desktop file. The object can be checked for validity using isValid(). The following functions are used to set or retrieve information about the application: \table \header \i Get Function \i Set Function \i Short Description \row \i \l name() \i \l setName() \i application's name \row \i \l pixmap() \i \e none \i application's icon \row \i \l bigPixmap() \i \e none \i application's large icon \row \i \e none \i setIcon() \i sets the icon's filename \row \i \l type() \i \l setType() \i see \link #Types Types\endlink above \row \i \l rotation() \i \e none \i 0, 90, 180 or 270 degrees \row \i \l comment() \i \l setComment() \i text for the Details dialog \row \i \l exec() \i \l setExec() \i executable's filename \row \i \l file() \i \e none \i document's filename \row \i \l linkFile() \i \l setLinkFile() \i \e .desktop filename \row \i \l mimeTypes() \i \e none \i the mime types the application can view or edit \row \i \l categories() \i \l setCategories() \i \e{see the function descriptions} \row \i \l fileKnown() \i \e none \i see \link #files-and-links Files and Links\endlink above \row \i \l linkFileKnown() \i \e none \i see \link #files-and-links Files and Links\endlink above \row \i \l property() \i \l setProperty() \i any AppLnk property can be retrieved or set (if writeable) using these \endtable 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.
|
|
Creates an invalid AppLnk.
Definition at line 354 of file applnk.cpp. |
|
|
Loads file (e.g. app.desktop) as an AppLnk.
Definition at line 365 of file applnk.cpp. References Categories::addCategory(), QValueList< T >::begin(), categoryFileName(), QValueList< T >::count(), d, QValueList< T >::end(), Config::File, QString::findRev(), i, Categories::id(), QString::isNull(), Config::isValid(), QString::left(), Categories::load(), AppLnkPrivate::mCat, AppLnkPrivate::mCatList, mComment, mExec, mFile, mIconFile, mId, mLinkFile, mMimeTypeIcons, mMimeTypes, mName, mRotation, mType, QString::null, Config::readEntry(), Config::readListEntry(), Config::setGroup(), and AppLnkPrivate::updateCatListFromArray(). |
|
|
Copies copy. Definition at line 630 of file applnk.cpp. References d, mBigPixmap, AppLnkPrivate::mCat, AppLnkPrivate::mCatList, mComment, mExec, mFile, mIconFile, mId, mLinkFile, mMimeTypeIcons, mMimeTypes, mName, mPixmap, AppLnkPrivate::mPixmaps, 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 657 of file applnk.cpp. References d, mId, and qWarning(). |
|
|
Returns the size used for large icons.
Definition at line 258 of file applnk.cpp. References bigSize. Referenced by Appearance::createAdvancedTab(), Opie::Core::OResource::loadImage(), MimeTypeData::loadPixmaps(), LauncherIconView::requestEyePix(), LauncherIconView::setBusy(), and LauncherIconView::setEyePixmap(). |
|
|
Returns a large pixmap associated with the application.
Definition at line 508 of file applnk.cpp. References AppLnkPrivate::Big, bigSize, d, AppLnkPrivate::mPixmaps, and pixmap(). Referenced by LauncherItem::animateIcon(), MimeTypeData::loadPixmaps(), and LauncherItem::resetIcon(). |
|
|
Returns the Categories property. See the CategoryWidget for more details.
Definition at line 311 of file applnk.cpp. References d, AppLnkPrivate::ensureCatArray(), and AppLnkPrivate::mCat. Referenced by LnkProperties::done(), Doc_DirLister::matchCat(), and DocumentList::sendAllDocLinks(). |
|
|
Returns the Comment property.
Definition at line 54 of file applnk.h. References mComment. Referenced by LnkProperties::beamLnk(), TabManager::editItem(), Gutenbrowser::setDocument(), DocLnkItem::toRichText(), and AppLnkItem::toRichText(). |
|
|
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 842 of file applnk.cpp. References linkFile(), and prepareDirectories(). Referenced by setProperty(), and writeLink(). |
|
|
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. References mExec. Referenced by RunningAppBar::addTask(), LnkProperties::done(), TabManager::editItem(), DocLnk::exec(), AppLnkSet::findChildren(), AppLnkSet::findExec(), MagicTextBrowser::generateQpe(), invoke(), LauncherItem::LauncherItem(), RunningAppBar::removeTask(), Launcher::select(), AppLauncher::sigStopped(), and AppLnkItem::toRichText(). |
|
|
Executes the application associated with this AppLnk, with args as arguments.
Definition at line 682 of file applnk.cpp. References QPEApplication::defaultRotation(), driver, QCString::find(), invoke(), QString::isEmpty(), QCString::left(), mRotation, and QString::toInt(). |
|
|
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 671 of file applnk.cpp. References property(), and QStringList::split(). Referenced by DocLnkItem::action(), AppLnkItem::action(), DocLnkWrapper::execute(), AppLnkWrapper::execute(), DocLnk::invoke(), FileItem::launch(), and AdvancedFm::runThis(). |
|
|
|
If the with the AppLnk associated file is not equal to QString::null Definition at line 62 of file applnk.h. References QString::isNull(), and mFile. Referenced by DocumentList::linkChanged(), LauncherIconView::removeLink(), and Doc_DirLister::systemMsg(). |
|
|
Returns the Icon property.
Definition at line 50 of file applnk.h. References mIconFile. Referenced by StartMenu::createAppEntry(), MagicTextBrowser::generateQpe(), and OpieObex::OtherHandler::handle(). |
|
|
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. References mId. Referenced by AppLnkSet::find(). |
|
|
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 707 of file applnk.cpp. References exec(), Global::execute(), QStringList::join(), and property(). Referenced by execute(). |
|
|
Returns TRUE if this AppLnk is valid; otherwise returns FALSE. Definition at line 40 of file applnk.h. References QString::isNull(), and mLinkFile. Referenced by DocLnkItem::action(), AppLnkItem::action(), StartMenu::createAppEntry(), MainWindow::documentOpen(), AdvancedFm::doDelete(), TabManager::editItem(), DocLnk::init(), AppLnkWrapper::isValid(), TableViewerWindow::openDocument(), PlayListWidget::readConfig(), removeFiles(), LauncherIconView::removeLink(), removeLinkFile(), MainWindow::saveCurrentFile(), ZSafe::setDocument(), PMainWindow::setDocument(), and ImageViewer::show(). |
|
|
Returns the desktop file corresponding to this AppLnk.
Definition at line 585 of file applnk.cpp. References FileSystem::disk(), QFile::exists(), file(), StorageInfo::fileSystemOf(), QString::isNull(), FileSystem::isRemovable(), mFile, mLinkFile, mName, QString::number(), FileSystem::path(), safeFileName(), storeLink(), and type(). Referenced by AppLnkItem::action(), Launcher::applicationRemoved(), LauncherIconView::changeItem(), LauncherIconView::compare(), Launcher::documentRemoved(), ensureLinkExists(), DocLnk::invoke(), DocumentList::linkChanged(), property(), removeFiles(), LauncherIconView::removeLink(), removeLinkFile(), NotesControl::save(), DocumentList::sendAllDocLinks(), setProperty(), Doc_DirLister::systemMsg(), DocLnkItem::toRichText(), AppLnkItem::toRichText(), and writeLink(). |
|
|
The filename of the AppLnk Definition at line 63 of file applnk.h. References QString::isNull(), and mLinkFile. Referenced by LauncherIconView::compare(), DocLnk::invoke(), DocumentList::linkChanged(), removeFiles(), LauncherIconView::removeLink(), removeLinkFile(), and DocumentList::sendAllDocLinks(). |
|
|
Returns the MimeTypeIcons property of the AppLnk. Definition at line 58 of file applnk.h. References mMimeTypeIcons. |
|
|
Returns the MimeTypes property. This is the list of MIME types that the application can view or edit. Definition at line 57 of file applnk.h. References mMimeTypes. Referenced by MimeType::registerApp(), and DocLnkItem::toRichText(). |
|
|
|
Definition at line 424 of file applnk.cpp. References d, mBigPixmap, AppLnkPrivate::mCat, AppLnkPrivate::mCatList, mComment, mExec, mFile, mIconFile, mId, mLinkFile, mMimeTypeIcons, mMimeTypes, mName, mPixmap, AppLnkPrivate::mPixmaps, mRotation, mType, and qWarning(). |
|
||||||||||||
|
protected internally to share code should I document that at all? I don't know the TT style for that Definition at line 461 of file applnk.cpp. References MimeType::bigPixmap(), bigSize, d, QString::isEmpty(), Resource::loadImage(), mIconFile, AppLnkPrivate::mPixmaps, MimeType::pixmap(), smallSize, and type(). |
|
|
Returns a small pixmap associated with the application.
Definition at line 495 of file applnk.cpp. References d, AppLnkPrivate::mPixmaps, AppLnkPrivate::Normal, and smallSize. Referenced by AddAtt::addattachment(), LauncherItem::animateIcon(), AppLnkItem::AppLnkItem(), bigPixmap(), TaskSelector::buildMenu(), DocLnkItem::DocLnkItem(), FileItem::drawThumbnail(), TabManager::editItem(), FileSelectorItem::FileSelectorItem(), Attachment::getPixmap(), ImageFileSelectorItem::ImageFileSelectorItem(), MimeTypeData::loadPixmaps(), RunningAppBar::paintEvent(), DocLnkWrapper::pixmap(), AppLnkWrapper::pixmap(), PlayListSelectionItem::PlayListSelectionItem(), TabManager::rescanFolder(), LauncherItem::resetIcon(), FileView::showFileMenu(), and AdvancedFm::showFileMenu(). |
|
|
Returns the property named key.
Definition at line 917 of file applnk.cpp. References QFile::exists(), Config::File, linkFile(), QString::null, and Config::readEntry(). Referenced by LnkProperties::done(), execute(), and invoke(). |
|
|
Deletes both the linkFile() and the file() associated with this AppLnk.
Definition at line 954 of file applnk.cpp. References file(), isValid(), linkFile(), linkFileKnown(), QFile::remove(), and writeLink(). Referenced by TextEdit::editDelete(), LnkProperties::moveLnk(), NotesControl::slotDeleteButton(), and LnkProperties::unlinkLnk(). |
|
|
Deletes the linkFile(), leaving any file() untouched.
Definition at line 978 of file applnk.cpp. References isValid(), linkFile(), linkFileKnown(), and QFile::remove(). Referenced by AdvancedFm::doDelete(). |
|
|
Returns the Rotation property. The value is 0, 90, 180 or 270 degrees. Definition at line 53 of file applnk.h. References mRotation. Referenced by LnkProperties::done(), and storeLink(). |
|
|
Sets the size used for large icons to big pixels. Only affects AppLnk objects created after the call.
Definition at line 248 of file applnk.cpp. References bigSize. Referenced by QPEApplication::QPEApplication(). |
|
|
Sets the Categories property to c. See the CategoryWidget for more details.
Definition at line 823 of file applnk.cpp. References d, AppLnkPrivate::mCat, and AppLnkPrivate::updateCatListFromArray(). Referenced by LnkProperties::done(), and VMemo::startRecording(). |
|
|
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 775 of file applnk.cpp. References mComment. Referenced by TabManager::editItem(), LibraryDialog::getEtext(), and OpenEtext::open(). |
|
|
Sets the Exec property to exec.
Definition at line 720 of file applnk.cpp. References mExec. Referenced by RunningAppBar::addTask(), TabManager::editItem(), LibraryDialog::getEtext(), and OpenEtext::open(). |
|
|
|
Sets the Icon property to iconname. This is the filename from which the pixmap() and bigPixmap() are obtained.
Definition at line 808 of file applnk.cpp. References bigSize, d, Resource::loadImage(), mIconFile, AppLnkPrivate::mPixmaps, and smallSize. Referenced by TabManager::editItem(), LibraryDialog::getEtext(), OpenEtext::open(), PlayListWidget::openFile(), PlayListWidget::readListFromFile(), PlayListWidget::readm3u(), PlayListWidget::setDocumentEx(), and PlayListWidget::writem3u(). |
|
|
Sets the LinkFile property to filename.
Definition at line 762 of file applnk.cpp. References mLinkFile. Referenced by MainWindow::saveCurrentFile(), and MainWindow::slotFileSaveAs(). |
|
|
||||||||||||
|
Sets the property named key to value.
Definition at line 904 of file applnk.cpp. References ensureLinkExists(), Config::File, linkFile(), and Config::writeEntry(). Referenced by LnkProperties::done(). |
|
|
The default rotation of the associated application. This function is included inline for binary compatible issues Definition at line 76 of file applnk.h. References mRotation. |
|
|
Sets the size used for small icons to small pixels. Only affects AppLnk objects created after the call.
Definition at line 226 of file applnk.cpp. References smallSize. Referenced by QPEApplication::QPEApplication(). |
|
|
Sets the Type property to type.
For applications, games and settings the type should be
Definition at line 789 of file applnk.cpp. References mType. Referenced by DrawPadCanvas::exportPage(), AppLnkSet::findChildren(), LibraryDialog::getEtext(), ViewAtt::install(), NotesControl::load(), TabManager::moveApplication(), TableViewerWindow::newDocument(), TextEdit::newFile(), OpenEtext::open(), TextEdit::openFile(), InstallDlgImpl::optionsSelected(), PlayListWidget::readPls(), PlayListWidget::readpodcast(), NotesControl::save(), TextEdit::saveAs(), Output::saveOutput(), InstallDlg::slotBtnOptions(), VMemo::startRecording(), and TableViewerWindow::TableViewerWindow(). |
|
|
|
For internal use only.
Definition at line 868 of file applnk.cpp. References d, f, file(), Config::File, QString::find(), i, QString::isNull(), QString::length(), AppLnkPrivate::mCatList, mComment, mIconFile, QString::mid(), mLinkFile, mName, Config::removeEntry(), rotation(), Config::setGroup(), type(), and Config::writeEntry(). Referenced by linkFile(), and writeLink(). |
|
|
Returns the type of the AppLnk. For applications, games and settings the type is Definition at line 521 of file applnk.cpp. References f, file(), MimeType::id(), QString::isNull(), and mType. Referenced by AddAtt::addattachment(), LauncherIconView::addCatsAndMimes(), Launcher::applicationAdded(), LauncherIconView::compare(), StartMenu::createAppEntry(), DocumentList::DiffAppLnks(), DocLnkSet::DocLnkSet(), DocLnk::exec(), DocLnkSet::findChildren(), Attachment::getMimeType(), OpieObex::OtherHandler::handle(), DocLnk::invoke(), LauncherItem::LauncherItem(), linkFile(), MimeType::MimeType(), TableViewerWindow::openDocument(), pixmap(), Launcher::properties(), DocumentList::reloadAppLnks(), TableViewerWindow::saveDocument(), DocLnkSearch::searchFile(), Launcher::select(), Ir::send(), DocumentList::sendAllDocLinks(), storeLink(), and DocLnkItem::toRichText(). |
|
|
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 855 of file applnk.cpp. References ensureLinkExists(), FALSE, linkFile(), storeLink(), and TRUE. Referenced by OpieObex::OtherHandler::accept(), AdvancedFm::addToDocs(), FileView::addToDocuments(), FileManager::copyFile(), LnkProperties::done(), TabManager::editItem(), LibraryDialog::getEtext(), ViewAtt::install(), TabManager::moveApplication(), OpenEtext::open(), PlayListWidget::readPls(), PlayListWidget::readpodcast(), removeFiles(), FileManager::saveFile(), Output::saveOutput(), ScreenshotControl::savePixmap(), VMemo::startRecording(), and PlayListWidget::writem3u(). |
|
|
|
|
|
Definition at line 111 of file applnk.h. Referenced by AppLnk(), bigPixmap(), categories(), operator=(), pixmap(), setCategories(), setIcon(), storeLink(), and ~AppLnk(). |
|
|
Definition at line 42 of file applnk.cpp. Referenced by AppLnkSet::add(). |
|
|
Definition at line 98 of file applnk.h. Referenced by AppLnk(), and operator=(). |
|
|
Definition at line 103 of file applnk.h. Referenced by AppLnk(), comment(), operator=(), setComment(), and storeLink(). |
|
|
Definition at line 100 of file applnk.h. Referenced by AppLnk(), exec(), file(), DocLnk::init(), operator=(), and setExec(). |
|
|
Definition at line 104 of file applnk.h. Referenced by AppLnk(), file(), fileKnown(), linkFile(), operator=(), and setFile(). |
|
|
Definition at line 106 of file applnk.h. Referenced by AppLnk(), icon(), operator=(), pixmap(), TabAppLnk::pixmapString(), setIcon(), and storeLink(). |
|
|
Definition at line 109 of file applnk.h. Referenced by AppLnkSet::add(), AppLnk(), AppLnkSet::clear(), AppLnkSet::detachChildren(), id(), operator=(), AppLnkSet::remove(), ~AppLnk(), and AppLnkSet::~AppLnkSet(). |
|
|
Definition at line 105 of file applnk.h. Referenced by AppLnk(), file(), isValid(), linkFile(), linkFileKnown(), operator=(), setLinkFile(), and storeLink(). |
|
|
Definition at line 108 of file applnk.h. Referenced by AppLnk(), mimeTypeIcons(), and operator=(). |
|
|
Definition at line 107 of file applnk.h. Referenced by AppLnk(), mimeTypes(), and operator=(). |
|
|
Definition at line 92 of file applnk.h. Referenced by AppLnk(), file(), linkFile(), name(), operator=(), setName(), and storeLink(). |
|
|
Definition at line 95 of file applnk.h. Referenced by AppLnk(), and operator=(). |
|
|
Definition at line 102 of file applnk.h. Referenced by AppLnk(), execute(), operator=(), rotation(), and setRotation(). |
|
|
Definition at line 101 of file applnk.h. Referenced by AppLnk(), file(), DocLnk::init(), operator=(), setType(), and type(). |
1.4.2