digiKam
|
Public Types | |
typedef const QList< qlonglong > | itemIds |
Signals | |
void | signalAddNewTagFromABCMenu (const QString &) |
void | signalAssignColorLabel (int) |
void | signalAssignPickLabel (int) |
void | signalAssignRating (int) |
Public Member Functions | |
void | addAction (const QString &name, bool addDisabled=false) |
void | addAction (QAction *action, bool addDisabled=false) |
void | addAction (QAction *action, QObject *recv, const char *slot, bool addDisabled=false) |
void | addAssignTagsMenu (itemIds &ids) |
void | addGroupActions (itemIds &ids) |
void | addGroupMenu (itemIds &ids) |
void | addLabelsAction () |
void | addRemoveTagsMenu (itemIds &ids) |
void | addRotateMenu (itemIds &ids) |
void | addSeparator () |
void | addServicesMenu (const QList< QUrl > &selectedItems) |
void | addSubMenu (QMenu *subMenu) |
QAction * | exec (const QPoint &pos, QAction *at=nullptr) |
ImportContextMenuHelper (QMenu *const parent, KActionCollection *const actionCollection=nullptr) | |
void | setImportFilterModel (ImportFilterModel *model) |
~ImportContextMenuHelper () override | |
typedef const QList<qlonglong> Digikam::ImportContextMenuHelper::itemIds |
|
explicit |
Constructs the helper class.
parent | the menu the helper class is linked to |
actionCollection | the actionCollection that should be used. If not set, the standard action from DigikamApp is used |
References Digikam::ImportUI::instance().
|
override |
void Digikam::ImportContextMenuHelper::addAction | ( | const QString & | name, |
bool | addDisabled = false |
||
) |
Add an action from the actionCollection.
This method adds actions from the actionCollection. The actionCollection can be set in the constructor of the ImportContextMenuHelper class.
name | the name of the action in the actionCollection |
addDisabled | if set, disabled actions are added to the menu |
Referenced by addAction(), addServicesMenu(), Digikam::ImportPreviewView::showContextMenu(), Digikam::ImportIconView::showContextMenu(), and Digikam::ImportIconView::showContextMenuOnInfo().
void Digikam::ImportContextMenuHelper::addAction | ( | QAction * | action, |
bool | addDisabled = false |
||
) |
Add a temporary action.
Sometimes it is necessary to define actions that only exist in the current context menu content. Use this method to add such an action.
action | the action to add |
addDisabled | if set, disabled actions are added to the menu |
void Digikam::ImportContextMenuHelper::addAction | ( | QAction * | action, |
QObject * | recv, | ||
const char * | slot, | ||
bool | addDisabled = false |
||
) |
Add a temporary action and assign it to a custom slot.
Use this method if you want to add a temporary action and immediately connect it to the receiving slot.
action | the action to add |
recv | the receiver of the triggered action |
slot | the slot to connect the triggered action to |
addDisabled | if set, disabled actions are added to the menu |
References addAction().
void Digikam::ImportContextMenuHelper::addAssignTagsMenu | ( | itemIds & | ids | ) |
Add actions to add, remove or edit a tag. The tag modification helper is used to execute the action. You must set the parent tag to use on modification helper. Add "Assign Tags" menu.
This menu will provide a list of all tags available so that they can be assigned to the current selected items.
To make this menu work, you need to run exec() from this class, otherwise the signals are not emitted and you will not be able to react on triggered actions from this menu. Make sure to connect the signals to the appropriate slots in the context menu handling method.
ids | the selected items |
void Digikam::ImportContextMenuHelper::addGroupActions | ( | itemIds & | ids | ) |
void Digikam::ImportContextMenuHelper::addGroupMenu | ( | itemIds & | ids | ) |
Add a "Group" menu. This menu will provide actions open, close, add to, remove from, or split a group.
addGroupActions will add the actions as a flat list, not in a submenu. Note: Call setItemFilterModel before to have Open/Close group actions.
void Digikam::ImportContextMenuHelper::addLabelsAction | ( | ) |
Add "Pick/Color/Rating Labels" action.
This action will provide methods to assign pick/color/rating labels to the currently selected items.
To make this menu work, you need to run exec() from this class, otherwise the signals are not emitted and you will not be able to react on triggered actions from this menu. Make sure to connect the signals to the appropriate slots in the context menu handling method.
References addSubMenu(), signalAssignColorLabel(), signalAssignPickLabel(), and signalAssignRating().
Referenced by Digikam::ImportPreviewView::showContextMenu(), and Digikam::ImportIconView::showContextMenuOnInfo().
void Digikam::ImportContextMenuHelper::addRemoveTagsMenu | ( | itemIds & | ids | ) |
Add "Remove Tags" menu.
This menu will provide a list of all tags assigned to the current items. Actions triggered in here will remove the selected tag from the items.
To make this menu work, you need to run exec() from this class, otherwise the signals are not emitted and you will not be able to react on triggered actions from this menu. Make sure to connect the signals to the appropriate slots in the context menu handling method.
ids | the selected items |
void Digikam::ImportContextMenuHelper::addRotateMenu | ( | itemIds & | ids | ) |
Add a menu to rotate item.
ids | the selected items |
Referenced by Digikam::ImportPreviewView::showContextMenu().
void Digikam::ImportContextMenuHelper::addSeparator | ( | ) |
Add a separator to the context menu
Referenced by Digikam::ImportPreviewView::showContextMenu(), Digikam::ImportIconView::showContextMenu(), and Digikam::ImportIconView::showContextMenuOnInfo().
void Digikam::ImportContextMenuHelper::addServicesMenu | ( | const QList< QUrl > & | selectedItems | ) |
Add the services menu to the menu.
The services menu is used to open the selected items in a different application. It will query the item for registered services and provide them in a submenu. The menu will be titled "Open With...".
selectedItems | the list of selected items |
References addAction(), Digikam::ImportUI::cameraUseUMSDriver(), and Digikam::ImportUI::instance().
Referenced by Digikam::ImportPreviewView::showContextMenu(), and Digikam::ImportIconView::showContextMenuOnInfo().
void Digikam::ImportContextMenuHelper::addSubMenu | ( | QMenu * | subMenu | ) |
Add a submenu to the parent context menu.
subMenu | the submenu to be added |
Referenced by addLabelsAction().
QAction * Digikam::ImportContextMenuHelper::exec | ( | const QPoint & | pos, |
QAction * | at = nullptr |
||
) |
Execute the registered parent menu and evaluate the triggered actions.
Always use this method instead the one from the parent menu. It will ensure that the signals are emitted and special cases are handled.
pos | position of the triggered action in the registered menu |
at | the action that should be at the position pos |
Referenced by Digikam::ImportPreviewView::showContextMenu(), Digikam::ImportIconView::showContextMenu(), and Digikam::ImportIconView::showContextMenuOnInfo().
void Digikam::ImportContextMenuHelper::setImportFilterModel | ( | ImportFilterModel * | model | ) |
Set a filter model. Some of the group actions will operate directly on the model.
|
signal |
|
signal |
Referenced by addLabelsAction().
|
signal |
Referenced by addLabelsAction().
|
signal |
Referenced by addLabelsAction().