Akonadi Contacts

standardcontactactionmanager.cpp
1 /*
2  This file is part of Akonadi Contact.
3 
4  Copyright (c) 2009 - 2010 Tobias Koenig <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #include "standardcontactactionmanager.h"
10 
11 #include "contacteditordialog.h"
12 #include "contactgroupeditordialog.h"
13 
14 #include <Akonadi/EntityTreeModel>
15 #include <Akonadi/MimeTypeChecker>
16 #include <KContacts/Addressee>
17 #include <KContacts/ContactGroup>
18 
19 #include <KActionCollection>
20 #include <KLocalizedString>
21 #include <KMessageBox>
22 #include <QAction>
23 
24 #include <QItemSelectionModel>
25 #include <QPointer>
26 
27 using namespace Akonadi;
28 
29 class Akonadi::StandardContactActionManagerPrivate
30 {
31 public:
32  StandardContactActionManagerPrivate(KActionCollection *actionCollection, QWidget *parentWidget, StandardContactActionManager *parent)
33  : mActionCollection(actionCollection)
34  , mParentWidget(parentWidget)
35  , mParent(parent)
36  {
37  mGenericManager = new StandardActionManager(actionCollection, parentWidget);
39 
40  mGenericManager->setMimeTypeFilter(QStringList() << KContacts::Addressee::mimeType() << KContacts::ContactGroup::mimeType());
41 
42  mGenericManager->setCapabilityFilter(QStringList() << QStringLiteral("Resource"));
43  }
44 
45  ~StandardContactActionManagerPrivate()
46  {
47  delete mGenericManager;
48  }
49 
50  void updateGenericAllActions()
51  {
52  updateGenericAction(StandardActionManager::CreateCollection);
53  updateGenericAction(StandardActionManager::CopyCollections);
54  updateGenericAction(StandardActionManager::DeleteCollections);
57  updateGenericAction(StandardActionManager::CopyItems);
58  updateGenericAction(StandardActionManager::Paste);
59  updateGenericAction(StandardActionManager::DeleteItems);
65  updateGenericAction(StandardActionManager::CopyItemToMenu);
66  updateGenericAction(StandardActionManager::MoveItemToMenu);
68  updateGenericAction(StandardActionManager::CutItems);
69  updateGenericAction(StandardActionManager::CutCollections);
70  updateGenericAction(StandardActionManager::CreateResource);
71  updateGenericAction(StandardActionManager::DeleteResources);
72  updateGenericAction(StandardActionManager::ResourceProperties);
74  updateGenericAction(StandardActionManager::ToggleWorkOffline);
77  updateGenericAction(StandardActionManager::CopyItemToDialog);
78  updateGenericAction(StandardActionManager::MoveItemToDialog);
81  updateGenericAction(StandardActionManager::MoveItemsToTrash);
89  }
90 
91  void updateGenericAction(StandardActionManager::Type type)
92  {
93  switch (type) {
95  mGenericManager->action(Akonadi::StandardActionManager::CreateCollection)->setText(i18n("Add Address Book Folder..."));
96 
98  ->setWhatsThis(i18n("Add a new address book folder to the currently selected address book folder."));
99  mGenericManager->setContextText(StandardActionManager::CreateCollection,
101  i18nc("@title:window", "New Address Book Folder"));
102 
103  mGenericManager->setContextText(StandardActionManager::CreateCollection,
105  ki18n("Could not create address book folder: %1"));
106 
107  mGenericManager->setContextText(StandardActionManager::CreateCollection,
109  i18n("Address book folder creation failed"));
110  mGenericManager->action(Akonadi::StandardActionManager::CreateCollection)
111  ->setProperty("ContentMimeTypes", QStringList() << QStringLiteral("application/x-vnd.kde.contactgroup") << QStringLiteral("text/directory"));
112 
113  break;
115  mGenericManager->setActionText(Akonadi::StandardActionManager::CopyCollections, ki18np("Copy Address Book Folder", "Copy %1 Address Book Folders"));
116  mGenericManager->action(Akonadi::StandardActionManager::CopyCollections)
117  ->setWhatsThis(i18n("Copy the selected address book folders to the clipboard."));
118  break;
120  mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteCollections,
121  ki18np("Delete Address Book Folder", "Delete %1 Address Book Folders"));
123  ->setWhatsThis(i18n("Delete the selected address book folders from the address book."));
124 
125  mGenericManager->setContextText(StandardActionManager::DeleteCollections,
127  ki18np("Do you really want to delete this address book folder and all its sub-folders?",
128  "Do you really want to delete %1 address book folders and all their sub-folders?"));
129  mGenericManager->setContextText(StandardActionManager::DeleteCollections,
131  ki18ncp("@title:window", "Delete address book folder?", "Delete address book folders?"));
132 
133  mGenericManager->setContextText(StandardActionManager::DeleteCollections,
135  ki18n("Could not delete address book folder: %1"));
136 
137  mGenericManager->setContextText(StandardActionManager::DeleteCollections,
139  i18n("Address book folder deletion failed"));
140  break;
142  mGenericManager->setActionText(Akonadi::StandardActionManager::SynchronizeCollections,
143  ki18np("Update Address Book Folder", "Update %1 Address Book Folders"));
145  ->setWhatsThis(i18n("Update the content of the selected address book folders."));
146  break;
148  mGenericManager->setActionText(Akonadi::StandardActionManager::CutCollections, ki18np("Cut Address Book Folder", "Cut %1 Address Book Folders"));
149  mGenericManager->action(Akonadi::StandardActionManager::CutCollections)
150  ->setWhatsThis(i18n("Cut the selected address book folders from the address book."));
151  break;
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."));
156  mGenericManager->setContextText(StandardActionManager::CollectionProperties,
158  ki18nc("@title:window", "Properties of Address Book Folder %1"));
159  break;
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."));
163  break;
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."));
167  mGenericManager->setContextText(StandardActionManager::DeleteItems,
169  ki18np("Do you really want to delete the selected contact?", "Do you really want to delete %1 contacts?"));
170 
171  mGenericManager->setContextText(StandardActionManager::DeleteItems,
173  ki18ncp("@title:window", "Delete Contact?", "Delete Contacts?"));
174 
175  mGenericManager->setContextText(StandardActionManager::DeleteItems, StandardActionManager::ErrorMessageText, ki18n("Could not delete contact: %1"));
176 
177  mGenericManager->setContextText(StandardActionManager::DeleteItems, StandardActionManager::ErrorMessageTitle, i18n("Contact deletion failed"));
178  break;
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."));
182  break;
184  mGenericManager->action(Akonadi::StandardActionManager::CreateResource)->setText(i18n("Add &Address Book..."));
185  mGenericManager->action(Akonadi::StandardActionManager::CreateResource)
186  ->setWhatsThis(i18n("Add a new address book<p>"
187  "You will be presented with a dialog where you can select "
188  "the type of the address book that shall be added.</p>"));
189  mGenericManager->setContextText(StandardActionManager::CreateResource,
191  i18nc("@title:window", "Add Address Book"));
192 
193  mGenericManager->setContextText(StandardActionManager::CreateResource,
195  ki18n("Could not create address book: %1"));
196 
197  mGenericManager->setContextText(StandardActionManager::CreateResource,
199  i18n("Address book creation failed"));
200  break;
202 
203  mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteResources, ki18np("&Delete Address Book", "&Delete %1 Address Books"));
204  mGenericManager->action(Akonadi::StandardActionManager::DeleteResources)
205  ->setWhatsThis(i18n("Delete the selected address books<p>"
206  "The currently selected address books will be deleted, "
207  "along with all the contacts and contact groups they contain.</p>"));
208  mGenericManager->setContextText(StandardActionManager::DeleteResources,
210  ki18np("Do you really want to delete this address book?", "Do you really want to delete %1 address books?"));
211 
212  mGenericManager->setContextText(StandardActionManager::DeleteResources,
214  ki18ncp("@title:window", "Delete Address Book?", "Delete Address Books?"));
215 
216  break;
218 
219  mGenericManager->action(Akonadi::StandardActionManager::ResourceProperties)->setText(i18n("Address Book Properties..."));
221  ->setWhatsThis(i18n("Open a dialog to edit properties of the selected address book."));
222  break;
224  mGenericManager->setActionText(Akonadi::StandardActionManager::SynchronizeResources, ki18np("Update Address Book", "Update %1 Address Books"));
225 
227  ->setWhatsThis(i18n("Updates the content of all folders of the selected address books."));
228 
229  break;
231  mGenericManager->setContextText(StandardActionManager::Paste, StandardActionManager::ErrorMessageText, ki18n("Could not paste contact: %1"));
232 
233  mGenericManager->setContextText(StandardActionManager::Paste, StandardActionManager::ErrorMessageTitle, i18n("Paste failed"));
234  break;
235  default:
236  break;
237  }
238  }
239 
240  static bool hasWritableCollection(const QModelIndex &index, const QString &mimeType)
241  {
243  if (collection.isValid()) {
244  if (collection.contentMimeTypes().contains(mimeType) && (collection.rights() & Akonadi::Collection::CanCreateItem)) {
245  return true;
246  }
247  }
248 
249  const QAbstractItemModel *model = index.model();
250  if (!model) {
251  return false;
252  }
253 
254  for (int row = 0; row < model->rowCount(index); ++row) {
255  if (hasWritableCollection(model->index(row, 0, index), mimeType)) {
256  return true;
257  }
258  }
259 
260  return false;
261  }
262 
263  bool hasWritableCollection(const QString &mimeType) const
264  {
265  if (!mCollectionSelectionModel) {
266  return false;
267  }
268 
269  const QAbstractItemModel *collectionModel = mCollectionSelectionModel->model();
270  for (int row = 0; row < collectionModel->rowCount(); ++row) {
271  if (hasWritableCollection(collectionModel->index(row, 0, QModelIndex()), mimeType)) {
272  return true;
273  }
274  }
275 
276  return false;
277  }
278 
279  void updateActions()
280  {
281  int itemCount = 0;
282  if (mItemSelectionModel) {
283  itemCount = mItemSelectionModel->selectedRows().count();
284  if (itemCount == 1) {
285  const QModelIndex index = mItemSelectionModel->selectedRows().first();
286  if (index.isValid()) {
288  if (mimeType == KContacts::Addressee::mimeType()) {
289  if (mGenericManager->action(Akonadi::StandardActionManager::CopyItems)) {
290  mGenericManager->setActionText(Akonadi::StandardActionManager::CopyItems, ki18np("Copy Contact", "Copy %1 Contacts"));
291  }
292  QAction *act = mGenericManager->action(Akonadi::StandardActionManager::CopyItemToMenu);
293  if (act) {
294  act->setText(i18n("Copy Contact To"));
295  }
296  act = mGenericManager->action(Akonadi::StandardActionManager::CopyItemToDialog);
297  if (act) {
298  act->setText(i18n("Copy Contact To"));
299  }
300  if (mGenericManager->action(Akonadi::StandardActionManager::DeleteItems)) {
301  mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteItems, ki18np("Delete Contact", "Delete %1 Contacts"));
302  }
303  if (mGenericManager->action(Akonadi::StandardActionManager::CutItems)) {
304  mGenericManager->setActionText(Akonadi::StandardActionManager::CutItems, ki18np("Cut Contact", "Cut %1 Contacts"));
305  }
306  act = mGenericManager->action(Akonadi::StandardActionManager::MoveItemToMenu);
307  if (act) {
308  act->setText(i18n("Move Contact To"));
309  }
310  act = mGenericManager->action(Akonadi::StandardActionManager::MoveItemToDialog);
311  if (act) {
312  act->setText(i18n("Move Contact To"));
313  }
314  act = mActions.value(StandardContactActionManager::EditItem);
315  if (act) {
316  act->setText(i18n("Edit Contact..."));
317  }
318  } else if (mimeType == KContacts::ContactGroup::mimeType()) {
319  if (mGenericManager->action(Akonadi::StandardActionManager::CopyItems)) {
320  mGenericManager->setActionText(Akonadi::StandardActionManager::CopyItems, ki18np("Copy Group", "Copy %1 Groups"));
321  }
322  QAction *act = mGenericManager->action(Akonadi::StandardActionManager::CopyItemToMenu);
323  if (act) {
324  act->setText(i18n("Copy Group To"));
325  }
326  act = mGenericManager->action(Akonadi::StandardActionManager::CopyItemToDialog);
327  if (act) {
328  act->setText(i18n("Copy Group To"));
329  }
330  if (mGenericManager->action(Akonadi::StandardActionManager::DeleteItems)) {
331  mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteItems, ki18np("Delete Group", "Delete %1 Groups"));
332  }
333  if (mGenericManager->action(Akonadi::StandardActionManager::CutItems)) {
334  mGenericManager->setActionText(Akonadi::StandardActionManager::CutItems, ki18np("Cut Group", "Cut %1 Groups"));
335  }
336  act = mGenericManager->action(Akonadi::StandardActionManager::MoveItemToMenu);
337  if (act) {
338  act->setText(i18n("Move Group To"));
339  }
340  act = mGenericManager->action(Akonadi::StandardActionManager::MoveItemToDialog);
341  if (act) {
342  act->setText(i18n("Move Group To"));
343  }
344  act = mActions.value(StandardContactActionManager::EditItem);
345  if (act) {
346  act->setText(i18n("Edit Group..."));
347  }
348  }
349  }
350  }
351  }
352 
353  if (mActions.contains(StandardContactActionManager::CreateContact)) {
354  mActions[StandardContactActionManager::CreateContact]->setEnabled(hasWritableCollection(KContacts::Addressee::mimeType()));
355  }
356  if (mActions.contains(StandardContactActionManager::CreateContactGroup)) {
357  mActions[StandardContactActionManager::CreateContactGroup]->setEnabled(hasWritableCollection(KContacts::ContactGroup::mimeType()));
358  }
359 
360  if (mActions.contains(StandardContactActionManager::EditItem)) {
361  bool canEditItem = true;
362 
363  // only one selected item can be edited
364  canEditItem = canEditItem && (itemCount == 1);
365 
366  // check whether parent collection allows changing the item
367  const QModelIndexList rows = mItemSelectionModel->selectedRows();
368  if (rows.count() == 1) {
369  const QModelIndex index = rows.first();
370  const auto parentCollection = index.data(EntityTreeModel::ParentCollectionRole).value<Collection>();
371  if (parentCollection.isValid()) {
372  canEditItem = canEditItem && (parentCollection.rights() & Collection::CanChangeItem);
373  }
374  }
375 
376  mActions.value(StandardContactActionManager::EditItem)->setEnabled(canEditItem);
377  }
378 
379  Q_EMIT mParent->actionStateUpdated();
380  }
381 
382  Collection selectedCollection() const
383  {
384  if (!mCollectionSelectionModel) {
385  return {};
386  }
387 
388  if (mCollectionSelectionModel->selectedIndexes().isEmpty()) {
389  return {};
390  }
391 
392  const QModelIndex index = mCollectionSelectionModel->selectedIndexes().first();
393  if (!index.isValid()) {
394  return {};
395  }
396 
398  }
399 
400  void slotCreateContact()
401  {
402  if (mInterceptedActions.contains(StandardContactActionManager::CreateContact)) {
403  return;
404  }
405 
407  dlg->setDefaultAddressBook(selectedCollection());
408  dlg->exec();
409  delete dlg;
410  }
411 
412  void slotCreateContactGroup()
413  {
414  if (mInterceptedActions.contains(StandardContactActionManager::CreateContactGroup)) {
415  return;
416  }
417 
419  dlg->setDefaultAddressBook(selectedCollection());
420  dlg->exec();
421  delete dlg;
422  }
423 
424  void slotEditItem()
425  {
426  if (mInterceptedActions.contains(StandardContactActionManager::EditItem)) {
427  return;
428  }
429 
430  if (!mItemSelectionModel) {
431  return;
432  }
433 
434  if (mItemSelectionModel->selectedIndexes().isEmpty()) {
435  return;
436  }
437 
438  const QModelIndex index = mItemSelectionModel->selectedIndexes().first();
439  if (!index.isValid()) {
440  return;
441  }
442 
443  const Item item = index.data(EntityTreeModel::ItemRole).value<Item>();
444  if (!item.isValid()) {
445  return;
446  }
447 
450  QObject::connect(dlg.data(), &ContactEditorDialog::error, mParent, [this](const QString &error) {
451  slotContactEditorError(error);
452  });
453  dlg->setContact(item);
454  dlg->exec();
455  delete dlg;
458  dlg->setContactGroup(item);
459  dlg->exec();
460  delete dlg;
461  }
462  }
463 
464  void slotContactEditorError(const QString &error)
465  {
466  KMessageBox::error(mParentWidget, i18n("Contact cannot be stored: %1", error), i18n("Failed to store contact"));
467  }
468 
469  KActionCollection *const mActionCollection;
470  QWidget *const mParentWidget;
471  StandardActionManager *mGenericManager = nullptr;
472  QItemSelectionModel *mCollectionSelectionModel = nullptr;
473  QItemSelectionModel *mItemSelectionModel = nullptr;
475  QSet<StandardContactActionManager::Type> mInterceptedActions;
476  StandardContactActionManager *const mParent;
477 };
478 
480  : QObject(parent)
481  , d(new StandardContactActionManagerPrivate(actionCollection, parent, this))
482 {
483 }
484 
486 
488 {
489  d->mCollectionSelectionModel = selectionModel;
490  d->mGenericManager->setCollectionSelectionModel(selectionModel);
491 
492  connect(selectionModel->model(), &QAbstractItemModel::rowsInserted, this, [this]() {
493  d->updateActions();
494  });
495  connect(selectionModel->model(), &QAbstractItemModel::rowsRemoved, this, [this]() {
496  d->updateActions();
497  });
498  connect(selectionModel, &QItemSelectionModel::selectionChanged, this, [this]() {
499  d->updateActions();
500  });
501 
502  d->updateActions();
503 }
504 
506 {
507  d->mItemSelectionModel = selectionModel;
508  d->mGenericManager->setItemSelectionModel(selectionModel);
509 
510  connect(selectionModel, &QItemSelectionModel::selectionChanged, this, [this]() {
511  d->updateActions();
512  });
513 
514  d->updateActions();
515 }
516 
518 {
519  QAction *action = d->mActions.value(type);
520  if (action) {
521  return action;
522  }
523 
524  switch (type) {
525  case CreateContact:
526  action = new QAction(d->mParentWidget);
527  action->setIcon(QIcon::fromTheme(QStringLiteral("contact-new")));
528  action->setText(i18n("New &Contact..."));
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>"));
531  d->mActions.insert(CreateContact, action);
532  d->mActionCollection->addAction(QStringLiteral("akonadi_contact_create"), action);
533  d->mActionCollection->setDefaultShortcut(action, QKeySequence(Qt::CTRL | Qt::Key_N));
534  connect(action, &QAction::triggered, this, [this]() {
535  d->slotCreateContact();
536  });
537  break;
538  case CreateContactGroup:
539  action = new QAction(d->mParentWidget);
540  action->setIcon(QIcon::fromTheme(QStringLiteral("user-group-new")));
541  action->setText(i18n("New &Group..."));
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>"));
543  d->mActions.insert(CreateContactGroup, action);
544  d->mActionCollection->addAction(QStringLiteral("akonadi_contact_group_create"), action);
545  d->mActionCollection->setDefaultShortcut(action, QKeySequence(Qt::CTRL | Qt::Key_G));
546  connect(action, &QAction::triggered, this, [this]() {
547  d->slotCreateContactGroup();
548  });
549  break;
550  case EditItem:
551  action = new QAction(d->mParentWidget);
552  action->setIcon(QIcon::fromTheme(QStringLiteral("document-edit")));
553  action->setText(i18n("Edit Contact..."));
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 "
556  "phone numbers.</p>"));
557  action->setEnabled(false);
558  d->mActions.insert(EditItem, action);
559  d->mActionCollection->addAction(QStringLiteral("akonadi_contact_item_edit"), action);
560 
561  connect(action, &QAction::triggered, this, [this]() {
562  d->slotEditItem();
563  });
564  break;
565  default:
566  Q_ASSERT(false); // should never happen
567  break;
568  }
569 
570  return action;
571 }
572 
574 {
575  QAction *act = d->mGenericManager->action(type);
576  if (!act) {
577  act = d->mGenericManager->createAction(type);
578  }
579  d->updateGenericAction(type);
580  return act;
581 }
582 
584 {
588 
589  d->mGenericManager->createAllActions();
590  d->updateGenericAllActions();
591 
592  d->updateActions();
593 }
594 
596 {
597  if (d->mActions.contains(type)) {
598  return d->mActions.value(type);
599  }
600 
601  return nullptr;
602 }
603 
605 {
606  return d->mGenericManager->action(type);
607 }
608 
610 {
611  d->mGenericManager->setActionText(type, text);
612 }
613 
615 {
616  if (intercept) {
617  d->mInterceptedActions.insert(type);
618  } else {
619  d->mInterceptedActions.remove(type);
620  }
621 }
622 
624 {
625  d->mGenericManager->interceptAction(type, intercept);
626 }
627 
629 {
630  return d->mGenericManager->selectedCollections();
631 }
632 
634 {
635  return d->mGenericManager->selectedItems();
636 }
637 
639 {
640  d->mGenericManager->setCollectionPropertiesPageNames(names);
641 }
642 
643 #include "moc_standardcontactactionmanager.cpp"
bool isValid() const
void createAllActions()
Convenience method to create all standard actions.
void setItemSelectionModel(QItemSelectionModel *selectionModel)
Sets the item selection model based on which the item related actions should operate.
@ EditItem
Edits the selected contact resp. contact group.
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
@ CreateContactGroup
Creates a new contact group.
virtual int rowCount(const QModelIndex &parent) const const=0
KLocalizedString KI18N_EXPORT ki18nc(const char *context, const char *text)
const QAbstractItemModel * model() const const
void error(const QString &errMsg)
This signal is emitted whenever a contact is not updated or stored.
T value() const const
QIcon fromTheme(const QString &name)
KCALUTILS_EXPORT QString mimeType()
StandardContactActionManager(KActionCollection *actionCollection, QWidget *parent=nullptr)
Creates a new standard contact action manager.
QAction * action(Type type) const
Returns the action of the given type, 0 if it has not been created (yet).
void setActionText(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...
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
@ CreateMode
Creates a new contact.
Akonadi::Item::List selectedItems() const
Returns the list of items that are currently selected.
QVariant data(int role) const const
void setIcon(const QIcon &icon)
@ CreateMode
Creates a new contact group.
QString i18n(const char *text, const TYPE &arg...)
KLocalizedString KI18N_EXPORT ki18ncp(const char *context, const char *singular, const char *plural)
void setCollectionSelectionModel(QItemSelectionModel *selectionModel)
Sets the collection selection model based on which the collection related actions should operate.
Akonadi::Collection::List selectedCollections() const
Returns the list of collections that are currently selected.
void setEnabled(bool enabled)
void setText(const QString &text)
KLocalizedString KI18N_EXPORT ki18n(const char *text)
static QString mimeType()
A dialog for creating or editing a contact group in Akonadi.
bool isValid() const const
void setWhatsThis(const QString &what)
void interceptAction(Type type, bool intercept=true)
Sets whether the default implementation for the given action type shall be executed when the action i...
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
@ EditMode
Edits an existing contact group.
A dialog for creating or editing a contact in Akonadi.
@ EditMode
Edits an existing contact.
void triggered(bool checked)
void setCollectionPropertiesPageNames(const QStringList &names)
void rowsInserted(const QModelIndex &parent, int first, int last)
void setEnabled(bool)
void rowsRemoved(const QModelIndex &parent, int first, int last)
Manages contact specific actions for collection and item views.
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
KLocalizedString KI18N_EXPORT ki18np(const char *singular, const char *plural)
QString i18nc(const char *context, const char *text, const TYPE &arg...)
bool isWantedItem(const Item &item) const
void actionStateUpdated()
This signal is emitted whenever the action state has been updated.
T * data() const const
const QAbstractItemModel * model() const const
QAction * createAction(Type type)
Creates the action of the given type and adds it to the action collection specified in the constructo...
static QString mimeType()
QString toString() const const
~StandardContactActionManager() override
Destroys the standard contact action manager.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Apr 1 2023 04:09:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.