KIO
#include <kfileitemactions.h>
Public Slots | |
void | runPreferredApplications (const KFileItemList &fileOpenList, const QString &traderConstraint) |
Signals | |
void | openWithDialogAboutToBeShown () |
Public Member Functions | |
KFileItemActions (QObject *parent=0) | |
~KFileItemActions () | |
void | addOpenWithActionsTo (QMenu *menu, const QString &traderConstraint=QString()) |
int | addServiceActionsTo (QMenu *menu) |
KAction * | preferredOpenWithAction (const QString &traderConstraint) |
void | setItemListProperties (const KFileItemListProperties &itemList) |
void | setParentWidget (QWidget *widget) |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Static Public Member Functions | |
static KService::List | associatedApplications (const QStringList &mimeTypeList, const QString &traderConstraint) |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Additional Inherited Members | |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
Detailed Description
This class creates and handles the actions for a url (or urls) in a popupmenu.
This includes:
- "open with <application>" actions, but also
- builtin services like mount/unmount for old-style device desktop files
- user-defined actions for a .desktop file, defined in the file itself (see the desktop entry standard)
- servicemenus actions, defined in .desktop files and selected based on the mimetype of the url
- Since
- 4.3
Definition at line 44 of file kfileitemactions.h.
Constructor & Destructor Documentation
KFileItemActions::KFileItemActions | ( | QObject * | parent = 0 | ) |
Creates a KFileItemActions instance.
Note that this instance must stay alive for at least as long as the popupmenu; it has the slots for the actions created by addOpenWithActionsTo/addServiceActionsTo.
Definition at line 179 of file kfileitemactions.cpp.
KFileItemActions::~KFileItemActions | ( | ) |
Destructor.
Definition at line 185 of file kfileitemactions.cpp.
Member Function Documentation
void KFileItemActions::addOpenWithActionsTo | ( | QMenu * | menu, |
const QString & | traderConstraint = QString() |
||
) |
Generate the "Open With <Application>" actions, and adds them to the menu
.
All actions are created as children of the menu.
- Parameters
-
menu the QMenu where to add actions traderConstraint this constraint allows to exclude the current application from the "open with" list. Example: "DesktopEntryName != 'kfmclient'". (Default value added in kdelibs-4.5, pass QString() explicitely for earlier versions).
Definition at line 497 of file kfileitemactions.cpp.
int KFileItemActions::addServiceActionsTo | ( | QMenu * | menu | ) |
Generate the user-defined actions and submenus, and adds them to the menu
.
User-defined actions include:
- builtin services like mount/unmount for old-style device desktop files
- user-defined actions for a .desktop file, defined in the file itself (see the desktop entry standard)
- servicemenus actions, defined in .desktop files and selected based on the mimetype of the url
When KFileItemListProperties::supportsWriting() is false, actions that modify the files are not shown. This is controlled by Require=Write in the servicemenu desktop files.
All actions are created as children of the menu.
- Returns
- the number of actions added
Definition at line 204 of file kfileitemactions.cpp.
|
static |
Helper method used internally, can also be used for similar GUIs that show the list of associated applications.
Used in KParts::BrowserOpenOrSaveQuestion for example.
This is basically a KMimeTypeTrader::query, but it supports multiple mimetypes, and also cleans up "apparent" duplicates, such as the kde3 and kde4 applications with the same name.
The list is sorted according to the user preferences for the given mimetype(s). In case multiple mimetypes appear in the url list, the logic is: applications that on average appear earlier on the associated applications list for the given mimetypes also appear earlier on the final applications list.
Note that for a single mimetype there is no need to use this, you should use KMimeTypeTrader instead, e.g. query() or preferredService().
Returns the applications associated with all the given mimetypes.
- Parameters
-
mimeTypeList the mimetypes traderConstraint this optional constraint allows to exclude the current application from the "open with" list. Example: "DesktopEntryName != 'kfmclient'".
- Returns
- the sorted list of services.
- Since
- 4.4
Definition at line 431 of file kfileitemactions.cpp.
|
signal |
Emitted before the "Open With" dialog is shown This is used e.g in folderview to close the folder peek popups on invoking the "Open With" menu action.
- Since
- 4.8.2
Returns an action for the preferred application only.
- Parameters
-
traderConstraint this constraint allows to exclude the current application from the "open with" list. Example: "DesktopEntryName != 'kfmclient'".
- Returns
- the action - or 0 if no application was found.
Definition at line 712 of file kfileitemactions.cpp.
|
slot |
Slot used to execute a list of files in their respective preferred application.
- Parameters
-
fileOpenList the list of KFileItems to open. traderConstraint this optional constraint allows to exclude the current application
- Since
- 4.5
Definition at line 633 of file kfileitemactions.cpp.
void KFileItemActions::setItemListProperties | ( | const KFileItemListProperties & | itemList | ) |
Sets all the data for the next instance of the popupmenu.
- See also
- KFileItemListProperties
Definition at line 190 of file kfileitemactions.cpp.
void KFileItemActions::setParentWidget | ( | QWidget * | widget | ) |
Set the parent widget for any dialogs being shown.
This should normally be your mainwindow, not a popup menu, so that it still exists even after the popup is closed (e.g. error message from KRun) and so that QAction::setStatusTip can find a statusbar, too.
Definition at line 721 of file kfileitemactions.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:54 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.