Akonadi Contacts
standardcontactactionmanager.cpp
32 StandardContactActionManagerPrivate(KActionCollection *actionCollection, QWidget *parentWidget, StandardContactActionManager *parent)
38 mParent->connect(mGenericManager, &StandardActionManager::actionStateUpdated, mParent, &StandardContactActionManager::actionStateUpdated);
40 mGenericManager->setMimeTypeFilter(QStringList() << KContacts::Addressee::mimeType() << KContacts::ContactGroup::mimeType());
95 mGenericManager->action(Akonadi::StandardActionManager::CreateCollection)->setText(i18n("Add Address Book Folder..."));
98 ->setWhatsThis(i18n("Add a new address book folder to the currently selected address book folder."));
111 ->setProperty("ContentMimeTypes", QStringList() << QStringLiteral("application/x-vnd.kde.contactgroup") << QStringLiteral("text/directory"));
115 mGenericManager->setActionText(Akonadi::StandardActionManager::CopyCollections, ki18np("Copy Address Book Folder", "Copy %1 Address Book Folders"));
148 mGenericManager->setActionText(Akonadi::StandardActionManager::CutCollections, ki18np("Cut Address Book Folder", "Cut %1 Address Book Folders"));
153 mGenericManager->action(Akonadi::StandardActionManager::CollectionProperties)->setText(i18n("Folder Properties..."));
155 ->setWhatsThis(i18n("Open a dialog to edit the properties of the selected address book folder."));
161 mGenericManager->setActionText(Akonadi::StandardActionManager::CopyItems, ki18np("Copy Contact", "Copy %1 Contacts"));
162 mGenericManager->action(Akonadi::StandardActionManager::CopyItems)->setWhatsThis(i18n("Copy the selected contacts to the clipboard."));
165 mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteItems, ki18np("Delete Contact", "Delete %1 Contacts"));
166 mGenericManager->action(Akonadi::StandardActionManager::DeleteItems)->setWhatsThis(i18n("Delete the selected contacts from the address book."));
169 ki18np("Do you really want to delete the selected contact?", "Do you really want to delete %1 contacts?"));
175 mGenericManager->setContextText(StandardActionManager::DeleteItems, StandardActionManager::ErrorMessageText, ki18n("Could not delete contact: %1"));
177 mGenericManager->setContextText(StandardActionManager::DeleteItems, StandardActionManager::ErrorMessageTitle, i18n("Contact deletion failed"));
180 mGenericManager->setActionText(Akonadi::StandardActionManager::CutItems, ki18np("Cut Contact", "Cut %1 Contacts"));
181 mGenericManager->action(Akonadi::StandardActionManager::CutItems)->setWhatsThis(i18n("Cut the selected contacts from the address book."));
184 mGenericManager->action(Akonadi::StandardActionManager::CreateResource)->setText(i18n("Add &Address Book..."));
203 mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteResources, ki18np("&Delete Address Book", "&Delete %1 Address Books"));
210 ki18np("Do you really want to delete this address book?", "Do you really want to delete %1 address books?"));
219 mGenericManager->action(Akonadi::StandardActionManager::ResourceProperties)->setText(i18n("Address Book Properties..."));
224 mGenericManager->setActionText(Akonadi::StandardActionManager::SynchronizeResources, ki18np("Update Address Book", "Update %1 Address Books"));
231 mGenericManager->setContextText(StandardActionManager::Paste, StandardActionManager::ErrorMessageText, ki18n("Could not paste contact: %1"));
233 mGenericManager->setContextText(StandardActionManager::Paste, StandardActionManager::ErrorMessageTitle, i18n("Paste failed"));
242 const auto collection = index.data(Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
244 if (collection.contentMimeTypes().contains(mimeType) && (collection.rights() & Akonadi::Collection::CanCreateItem)) {
290 mGenericManager->setActionText(Akonadi::StandardActionManager::CopyItems, ki18np("Copy Contact", "Copy %1 Contacts"));
301 mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteItems, ki18np("Delete Contact", "Delete %1 Contacts"));
304 mGenericManager->setActionText(Akonadi::StandardActionManager::CutItems, ki18np("Cut Contact", "Cut %1 Contacts"));
320 mGenericManager->setActionText(Akonadi::StandardActionManager::CopyItems, ki18np("Copy Group", "Copy %1 Groups"));
331 mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteItems, ki18np("Delete Group", "Delete %1 Groups"));
334 mGenericManager->setActionText(Akonadi::StandardActionManager::CutItems, ki18np("Cut Group", "Cut %1 Groups"));
354 mActions[StandardContactActionManager::CreateContact]->setEnabled(hasWritableCollection(KContacts::Addressee::mimeType()));
357 mActions[StandardContactActionManager::CreateContactGroup]->setEnabled(hasWritableCollection(KContacts::ContactGroup::mimeType()));
370 const auto parentCollection = index.data(EntityTreeModel::ParentCollectionRole).value<Collection>();
406 QPointer<Akonadi::ContactEditorDialog> dlg = new Akonadi::ContactEditorDialog(Akonadi::ContactEditorDialog::CreateMode, mParentWidget);
418 QPointer<Akonadi::ContactGroupEditorDialog> dlg = new Akonadi::ContactGroupEditorDialog(Akonadi::ContactGroupEditorDialog::CreateMode, mParentWidget);
449 QPointer<Akonadi::ContactEditorDialog> dlg = new Akonadi::ContactEditorDialog(Akonadi::ContactEditorDialog::EditMode, mParentWidget);
450 QObject::connect(dlg.data(), &Akonadi::ContactEditorDialog::error, mParent, [this](const QString &error) {
457 QPointer<Akonadi::ContactGroupEditorDialog> dlg = new Akonadi::ContactGroupEditorDialog(Akonadi::ContactGroupEditorDialog::EditMode, mParentWidget);
466 KMessageBox::error(mParentWidget, i18n("Contact cannot be stored: %1", error), i18nc("@title:window", "Failed to store contact"));
479StandardContactActionManager::StandardContactActionManager(KActionCollection *actionCollection, QWidget *parent)
487void StandardContactActionManager::setCollectionSelectionModel(QItemSelectionModel *selectionModel)
530 "Create a new contact<p>You will be presented with a dialog where you can add data about a person, including addresses and phone numbers.</p>"));
542 action->setWhatsThis(i18n("Create a new group<p>You will be presented with a dialog where you can add a new group of contacts.</p>"));
555 i18n("Edit the selected contact<p>You will be presented with a dialog where you can edit the data stored about a person, including addresses and "
610void StandardContactActionManager::setActionText(StandardActionManager::Type type, const KLocalizedString &text)
624void StandardContactActionManager::interceptAction(StandardActionManager::Type type, bool intercept)
CanCreateItem
CanChangeItem
A dialog for creating or editing a contact in Akonadi.
Definition contacteditordialog.h:65
void error(const QString &errMsg)
This signal is emitted whenever a contact is not updated or stored.
A dialog for creating or editing a contact group in Akonadi.
Definition contactgroupeditordialog.h:63
ParentCollectionRole
CollectionRole
MimeTypeRole
bool isWantedItem(const Item &item) const
void setActionText(Type type, const KLocalizedString &text)
void actionStateUpdated()
void setCapabilityFilter(const QStringList &capabilities)
void setMimeTypeFilter(const QStringList &mimeTypes)
CreateResource
CreateCollection
MoveToTrashRestoreItem
SynchronizeResources
RemoveFromFavoriteCollections
DeleteItems
CopyCollectionToDialog
SynchronizeCollections
MoveCollectionToDialog
CopyItemToMenu
RenameFavoriteCollection
SynchronizeFavoriteCollections
ResourceProperties
DeleteCollections
MoveToTrashRestoreCollection
ToggleWorkOffline
ManageLocalSubscriptions
CutCollections
CopyCollectionToMenu
MoveItemToMenu
AddToFavoriteCollections
SynchronizeCollectionsRecursive
MoveItemsToTrash
CopyCollections
CollectionProperties
MoveToTrashRestoreCollectionAlternative
DeleteResources
RestoreItemsFromTrash
MoveToTrashRestoreItemAlternative
RestoreCollectionsFromTrash
MoveCollectionToMenu
MoveItemToDialog
CopyItemToDialog
MoveCollectionsToTrash
void setContextText(Type type, TextContext context, const KLocalizedString &text)
QAction * action(Type type) const
MessageBoxText
ErrorMessageText
MessageBoxTitle
DialogTitle
ErrorMessageTitle
Manages contact specific actions for collection and item views.
Definition standardcontactactionmanager.h:35
@ EditItem
Edits the selected contact resp. contact group.
Definition standardcontactactionmanager.h:45
void setCollectionPropertiesPageNames(const QStringList &names)
Definition standardcontactactionmanager.cpp:639
StandardContactActionManager(KActionCollection *actionCollection, QWidget *parent=nullptr)
Creates a new standard contact action manager.
Definition standardcontactactionmanager.cpp:479
QAction * action(Type type) const
Returns the action of the given type, 0 if it has not been created (yet).
Definition standardcontactactionmanager.cpp:596
void setCollectionSelectionModel(QItemSelectionModel *selectionModel)
Sets the collection selection model based on which the collection related actions should operate.
Definition standardcontactactionmanager.cpp:487
Akonadi::Item::List selectedItems() const
Returns the list of items that are currently selected.
Definition standardcontactactionmanager.cpp:634
Akonadi::Collection::List selectedCollections() const
Returns the list of collections that are currently selected.
Definition standardcontactactionmanager.cpp:629
void actionStateUpdated()
This signal is emitted whenever the action state has been updated.
void createAllActions()
Convenience method to create all standard actions.
Definition standardcontactactionmanager.cpp:584
~StandardContactActionManager() override
Destroys the standard contact action manager.
QAction * createAction(Type type)
Creates the action of the given type and adds it to the action collection specified in the constructo...
Definition standardcontactactionmanager.cpp:517
void setItemSelectionModel(QItemSelectionModel *selectionModel)
Sets the item selection model based on which the item related actions should operate.
Definition standardcontactactionmanager.cpp:505
void interceptAction(Type type, bool intercept=true)
Sets whether the default implementation for the given action type shall be executed when the action i...
Definition standardcontactactionmanager.cpp:615
void setActionText(Akonadi::StandardActionManager::Type type, const KLocalizedString &text)
Sets the label of the action type to text, which is used during updating the action state and substit...
Definition standardcontactactionmanager.cpp:610
static QString mimeType()
static QString mimeType()
KLocalizedString KI18N_EXPORT ki18np(const char *singular, const char *plural)
KLocalizedString KI18N_EXPORT ki18n(const char *text)
QString i18nc(const char *context, const char *text, const TYPE &arg...)
KLocalizedString KI18N_EXPORT ki18ncp(const char *context, const char *singular, const char *plural)
KLocalizedString KI18N_EXPORT ki18nc(const char *context, const char *text)
QString i18n(const char *text, const TYPE &arg...)
A widget for editing the display name of a contact.
KCALUTILS_EXPORT QString mimeType()
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
virtual int rowCount(const QModelIndex &parent) const const=0
void rowsInserted(const QModelIndex &parent, int first, int last)
void rowsRemoved(const QModelIndex &parent, int first, int last)
void setEnabled(bool)
void setIcon(const QIcon &icon)
void setText(const QString &text)
void triggered(bool checked)
void setWhatsThis(const QString &what)
bool contains(const Key &key) const const
T value(const Key &key) const const
QIcon fromTheme(const QString &name)
QAbstractItemModel * model()
selectedIndexes
QModelIndexList selectedRows(int column) const const
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
QVariant data(int role) const const
bool isValid() const const
const QAbstractItemModel * model() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool setProperty(const char *name, QVariant &&value)
T * data() const const
bool contains(const QSet< T > &other) const const
Key_N
CTRL
QString toString() const const
T value() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:36:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:36:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.