digiKam
Digikam::ImportContextMenuHelper Class Reference
+ Inheritance diagram for Digikam::ImportContextMenuHelper:

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
 

Member Typedef Documentation

◆ itemIds

Constructor & Destructor Documentation

◆ ImportContextMenuHelper()

Digikam::ImportContextMenuHelper::ImportContextMenuHelper ( QMenu *const  parent,
KActionCollection *const  actionCollection = nullptr 
)
explicit

Constructs the helper class.

Parameters
parentthe menu the helper class is linked to
actionCollectionthe actionCollection that should be used. If not set, the standard action from DigikamApp is used

References Digikam::ImportUI::instance().

◆ ~ImportContextMenuHelper()

Digikam::ImportContextMenuHelper::~ImportContextMenuHelper ( )
override

Member Function Documentation

◆ addAction() [1/3]

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.

Parameters
namethe name of the action in the actionCollection
addDisabledif set, disabled actions are added to the menu

Referenced by addAction(), addServicesMenu(), Digikam::ImportPreviewView::showContextMenu(), Digikam::ImportIconView::showContextMenu(), and Digikam::ImportIconView::showContextMenuOnInfo().

◆ addAction() [2/3]

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.

Parameters
actionthe action to add
addDisabledif set, disabled actions are added to the menu

◆ addAction() [3/3]

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.

Parameters
actionthe action to add
recvthe receiver of the triggered action
slotthe slot to connect the triggered action to
addDisabledif set, disabled actions are added to the menu

References addAction().

◆ addAssignTagsMenu()

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.

Parameters
idsthe selected items
See also
exec()
signalAssignTag()

◆ addGroupActions()

void Digikam::ImportContextMenuHelper::addGroupActions ( itemIds ids)

◆ addGroupMenu()

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.

◆ addLabelsAction()

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.

See also
exec()
signalAssignPickLabel()
signalAssignColorLabel()
signalAssignRating()

References addSubMenu(), signalAssignColorLabel(), signalAssignPickLabel(), and signalAssignRating().

Referenced by Digikam::ImportPreviewView::showContextMenu(), and Digikam::ImportIconView::showContextMenuOnInfo().

◆ addRemoveTagsMenu()

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.

Parameters
idsthe selected items
See also
exec()
signalRemoveTag()

◆ addRotateMenu()

void Digikam::ImportContextMenuHelper::addRotateMenu ( itemIds ids)

Add a menu to rotate item.

Parameters
idsthe selected items

Referenced by Digikam::ImportPreviewView::showContextMenu().

◆ addSeparator()

void Digikam::ImportContextMenuHelper::addSeparator ( )

◆ addServicesMenu()

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...".

Parameters
selectedItemsthe list of selected items

References addAction(), Digikam::ImportUI::cameraUseUMSDriver(), and Digikam::ImportUI::instance().

Referenced by Digikam::ImportPreviewView::showContextMenu(), and Digikam::ImportIconView::showContextMenuOnInfo().

◆ addSubMenu()

void Digikam::ImportContextMenuHelper::addSubMenu ( QMenu *  subMenu)

Add a submenu to the parent context menu.

Parameters
subMenuthe submenu to be added

Referenced by addLabelsAction().

◆ exec()

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.

Parameters
posposition of the triggered action in the registered menu
atthe action that should be at the position pos
Returns
the triggered action

Referenced by Digikam::ImportPreviewView::showContextMenu(), Digikam::ImportIconView::showContextMenu(), and Digikam::ImportIconView::showContextMenuOnInfo().

◆ setImportFilterModel()

void Digikam::ImportContextMenuHelper::setImportFilterModel ( ImportFilterModel model)

Set a filter model. Some of the group actions will operate directly on the model.

◆ signalAddNewTagFromABCMenu

void Digikam::ImportContextMenuHelper::signalAddNewTagFromABCMenu ( const QString &  )
signal

◆ signalAssignColorLabel

void Digikam::ImportContextMenuHelper::signalAssignColorLabel ( int  )
signal

Referenced by addLabelsAction().

◆ signalAssignPickLabel

void Digikam::ImportContextMenuHelper::signalAssignPickLabel ( int  )
signal

Referenced by addLabelsAction().

◆ signalAssignRating

void Digikam::ImportContextMenuHelper::signalAssignRating ( int  )
signal

Referenced by addLabelsAction().


The documentation for this class was generated from the following files: