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 <entitytreemodel.h>
15 #include <kcontacts/addressee.h>
16 #include <kcontacts/contactgroup.h>
17 #include <mimetypechecker.h>
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 Q_DECL_HIDDEN StandardContactActionManager::Private
30 {
31 public:
32  Private(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  ~Private()
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",
112  QStringList() << QStringLiteral("application/x-vnd.kde.contactgroup") << QStringLiteral("text/directory")
113  << QStringLiteral("application/x-vnd.kde.contactgroup"));
114 
115  break;
117  mGenericManager->setActionText(Akonadi::StandardActionManager::CopyCollections, ki18np("Copy Address Book Folder", "Copy %1 Address Book Folders"));
118  mGenericManager->action(Akonadi::StandardActionManager::CopyCollections)
119  ->setWhatsThis(i18n("Copy the selected address book folders to the clipboard."));
120  break;
122  mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteCollections,
123  ki18np("Delete Address Book Folder", "Delete %1 Address Book Folders"));
125  ->setWhatsThis(i18n("Delete the selected address book folders from the address book."));
126 
127  mGenericManager->setContextText(StandardActionManager::DeleteCollections,
129  ki18np("Do you really want to delete this address book folder and all its sub-folders?",
130  "Do you really want to delete %1 address book folders and all their sub-folders?"));
131  mGenericManager->setContextText(StandardActionManager::DeleteCollections,
133  ki18ncp("@title:window", "Delete address book folder?", "Delete address book folders?"));
134 
135  mGenericManager->setContextText(StandardActionManager::DeleteCollections,
137  ki18n("Could not delete address book folder: %1"));
138 
139  mGenericManager->setContextText(StandardActionManager::DeleteCollections,
141  i18n("Address book folder deletion failed"));
142  break;
144  mGenericManager->setActionText(Akonadi::StandardActionManager::SynchronizeCollections,
145  ki18np("Update Address Book Folder", "Update %1 Address Book Folders"));
147  ->setWhatsThis(i18n("Update the content of the selected address book folders."));
148  break;
150  mGenericManager->setActionText(Akonadi::StandardActionManager::CutCollections, ki18np("Cut Address Book Folder", "Cut %1 Address Book Folders"));
151  mGenericManager->action(Akonadi::StandardActionManager::CutCollections)
152  ->setWhatsThis(i18n("Cut the selected address book folders from the address book."));
153  break;
155  mGenericManager->action(Akonadi::StandardActionManager::CollectionProperties)->setText(i18n("Folder Properties..."));
157  ->setWhatsThis(i18n("Open a dialog to edit the properties of the selected address book folder."));
158  mGenericManager->setContextText(StandardActionManager::CollectionProperties,
160  ki18nc("@title:window", "Properties of Address Book Folder %1"));
161  break;
163  mGenericManager->setActionText(Akonadi::StandardActionManager::CopyItems, ki18np("Copy Contact", "Copy %1 Contacts"));
164  mGenericManager->action(Akonadi::StandardActionManager::CopyItems)->setWhatsThis(i18n("Copy the selected contacts to the clipboard."));
165  break;
167  mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteItems, ki18np("Delete Contact", "Delete %1 Contacts"));
168  mGenericManager->action(Akonadi::StandardActionManager::DeleteItems)->setWhatsThis(i18n("Delete the selected contacts from the address book."));
169  mGenericManager->setContextText(StandardActionManager::DeleteItems,
171  ki18np("Do you really want to delete the selected contact?", "Do you really want to delete %1 contacts?"));
172 
173  mGenericManager->setContextText(StandardActionManager::DeleteItems,
175  ki18ncp("@title:window", "Delete Contact?", "Delete Contacts?"));
176 
177  mGenericManager->setContextText(StandardActionManager::DeleteItems, StandardActionManager::ErrorMessageText, ki18n("Could not delete contact: %1"));
178 
179  mGenericManager->setContextText(StandardActionManager::DeleteItems, StandardActionManager::ErrorMessageTitle, i18n("Contact deletion failed"));
180  break;
182  mGenericManager->setActionText(Akonadi::StandardActionManager::CutItems, ki18np("Cut Contact", "Cut %1 Contacts"));
183  mGenericManager->action(Akonadi::StandardActionManager::CutItems)->setWhatsThis(i18n("Cut the selected contacts from the address book."));
184  break;
186  mGenericManager->action(Akonadi::StandardActionManager::CreateResource)->setText(i18n("Add &Address Book..."));
187  mGenericManager->action(Akonadi::StandardActionManager::CreateResource)
188  ->setWhatsThis(i18n("Add a new address book<p>"
189  "You will be presented with a dialog where you can select "
190  "the type of the address book that shall be added.</p>"));
191  mGenericManager->setContextText(StandardActionManager::CreateResource,
193  i18nc("@title:window", "Add Address Book"));
194 
195  mGenericManager->setContextText(StandardActionManager::CreateResource,
197  ki18n("Could not create address book: %1"));
198 
199  mGenericManager->setContextText(StandardActionManager::CreateResource,
201  i18n("Address book creation failed"));
202  break;
204 
205  mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteResources, ki18np("&Delete Address Book", "&Delete %1 Address Books"));
206  mGenericManager->action(Akonadi::StandardActionManager::DeleteResources)
207  ->setWhatsThis(i18n("Delete the selected address books<p>"
208  "The currently selected address books will be deleted, "
209  "along with all the contacts and contact groups they contain.</p>"));
210  mGenericManager->setContextText(StandardActionManager::DeleteResources,
212  ki18np("Do you really want to delete this address book?", "Do you really want to delete %1 address books?"));
213 
214  mGenericManager->setContextText(StandardActionManager::DeleteResources,
216  ki18ncp("@title:window", "Delete Address Book?", "Delete Address Books?"));
217 
218  break;
220 
221  mGenericManager->action(Akonadi::StandardActionManager::ResourceProperties)->setText(i18n("Address Book Properties..."));
223  ->setWhatsThis(i18n("Open a dialog to edit properties of the selected address book."));
224  break;
226  mGenericManager->setActionText(Akonadi::StandardActionManager::SynchronizeResources, ki18np("Update Address Book", "Update %1 Address Books"));
227 
229  ->setWhatsThis(i18n("Updates the content of all folders of the selected address books."));
230 
231  break;
233  mGenericManager->setContextText(StandardActionManager::Paste, StandardActionManager::ErrorMessageText, ki18n("Could not paste contact: %1"));
234 
235  mGenericManager->setContextText(StandardActionManager::Paste, StandardActionManager::ErrorMessageTitle, i18n("Paste failed"));
236  break;
237  default:
238  break;
239  }
240  }
241 
242  static bool hasWritableCollection(const QModelIndex &index, const QString &mimeType)
243  {
245  if (collection.isValid()) {
246  if (collection.contentMimeTypes().contains(mimeType) && (collection.rights() & Akonadi::Collection::CanCreateItem)) {
247  return true;
248  }
249  }
250 
251  const QAbstractItemModel *model = index.model();
252  if (!model) {
253  return false;
254  }
255 
256  for (int row = 0; row < model->rowCount(index); ++row) {
257  if (hasWritableCollection(model->index(row, 0, index), mimeType)) {
258  return true;
259  }
260  }
261 
262  return false;
263  }
264 
265  bool hasWritableCollection(const QString &mimeType) const
266  {
267  if (!mCollectionSelectionModel) {
268  return false;
269  }
270 
271  const QAbstractItemModel *collectionModel = mCollectionSelectionModel->model();
272  for (int row = 0; row < collectionModel->rowCount(); ++row) {
273  if (hasWritableCollection(collectionModel->index(row, 0, QModelIndex()), mimeType)) {
274  return true;
275  }
276  }
277 
278  return false;
279  }
280 
281  void updateActions()
282  {
283  int itemCount = 0;
284  if (mItemSelectionModel) {
285  itemCount = mItemSelectionModel->selectedRows().count();
286  if (itemCount == 1) {
287  const QModelIndex index = mItemSelectionModel->selectedRows().first();
288  if (index.isValid()) {
289  const QString mimeType = index.data(EntityTreeModel::MimeTypeRole).toString();
290  if (mimeType == KContacts::Addressee::mimeType()) {
291  if (mGenericManager->action(Akonadi::StandardActionManager::CopyItems)) {
292  mGenericManager->setActionText(Akonadi::StandardActionManager::CopyItems, ki18np("Copy Contact", "Copy %1 Contacts"));
293  }
294  QAction *act = mGenericManager->action(Akonadi::StandardActionManager::CopyItemToMenu);
295  if (act) {
296  act->setText(i18n("Copy Contact To"));
297  }
298  act = mGenericManager->action(Akonadi::StandardActionManager::CopyItemToDialog);
299  if (act) {
300  act->setText(i18n("Copy Contact To"));
301  }
302  if (mGenericManager->action(Akonadi::StandardActionManager::DeleteItems)) {
303  mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteItems, ki18np("Delete Contact", "Delete %1 Contacts"));
304  }
305  if (mGenericManager->action(Akonadi::StandardActionManager::CutItems)) {
306  mGenericManager->setActionText(Akonadi::StandardActionManager::CutItems, ki18np("Cut Contact", "Cut %1 Contacts"));
307  }
308  act = mGenericManager->action(Akonadi::StandardActionManager::MoveItemToMenu);
309  if (act) {
310  act->setText(i18n("Move Contact To"));
311  }
312  act = mGenericManager->action(Akonadi::StandardActionManager::MoveItemToDialog);
313  if (act) {
314  act->setText(i18n("Move Contact To"));
315  }
316  act = mActions.value(StandardContactActionManager::EditItem);
317  if (act) {
318  act->setText(i18n("Edit Contact..."));
319  }
320  } else if (mimeType == KContacts::ContactGroup::mimeType()) {
321  if (mGenericManager->action(Akonadi::StandardActionManager::CopyItems)) {
322  mGenericManager->setActionText(Akonadi::StandardActionManager::CopyItems, ki18np("Copy Group", "Copy %1 Groups"));
323  }
324  QAction *act = mGenericManager->action(Akonadi::StandardActionManager::CopyItemToMenu);
325  if (act) {
326  act->setText(i18n("Copy Group To"));
327  }
328  act = mGenericManager->action(Akonadi::StandardActionManager::CopyItemToDialog);
329  if (act) {
330  act->setText(i18n("Copy Group To"));
331  }
332  if (mGenericManager->action(Akonadi::StandardActionManager::DeleteItems)) {
333  mGenericManager->setActionText(Akonadi::StandardActionManager::DeleteItems, ki18np("Delete Group", "Delete %1 Groups"));
334  }
335  if (mGenericManager->action(Akonadi::StandardActionManager::CutItems)) {
336  mGenericManager->setActionText(Akonadi::StandardActionManager::CutItems, ki18np("Cut Group", "Cut %1 Groups"));
337  }
338  act = mGenericManager->action(Akonadi::StandardActionManager::MoveItemToMenu);
339  if (act) {
340  act->setText(i18n("Move Group To"));
341  }
342  act = mGenericManager->action(Akonadi::StandardActionManager::MoveItemToDialog);
343  if (act) {
344  act->setText(i18n("Move Group To"));
345  }
346  act = mActions.value(StandardContactActionManager::EditItem);
347  if (act) {
348  act->setText(i18n("Edit Group..."));
349  }
350  }
351  }
352  }
353  }
354 
355  if (mActions.contains(StandardContactActionManager::CreateContact)) {
356  mActions[StandardContactActionManager::CreateContact]->setEnabled(hasWritableCollection(KContacts::Addressee::mimeType()));
357  }
358  if (mActions.contains(StandardContactActionManager::CreateContactGroup)) {
359  mActions[StandardContactActionManager::CreateContactGroup]->setEnabled(hasWritableCollection(KContacts::ContactGroup::mimeType()));
360  }
361 
362  if (mActions.contains(StandardContactActionManager::EditItem)) {
363  bool canEditItem = true;
364 
365  // only one selected item can be edited
366  canEditItem = canEditItem && (itemCount == 1);
367 
368  // check whether parent collection allows changing the item
369  const QModelIndexList rows = mItemSelectionModel->selectedRows();
370  if (rows.count() == 1) {
371  const QModelIndex index = rows.first();
372  const auto parentCollection = index.data(EntityTreeModel::ParentCollectionRole).value<Collection>();
373  if (parentCollection.isValid()) {
374  canEditItem = canEditItem && (parentCollection.rights() & Collection::CanChangeItem);
375  }
376  }
377 
378  mActions.value(StandardContactActionManager::EditItem)->setEnabled(canEditItem);
379  }
380 
381  Q_EMIT mParent->actionStateUpdated();
382  }
383 
384  Collection selectedCollection() const
385  {
386  if (!mCollectionSelectionModel) {
387  return Collection();
388  }
389 
390  if (mCollectionSelectionModel->selectedIndexes().isEmpty()) {
391  return Collection();
392  }
393 
394  const QModelIndex index = mCollectionSelectionModel->selectedIndexes().first();
395  if (!index.isValid()) {
396  return Collection();
397  }
398 
400  }
401 
402  void slotCreateContact()
403  {
404  if (mInterceptedActions.contains(StandardContactActionManager::CreateContact)) {
405  return;
406  }
407 
409  dlg->setDefaultAddressBook(selectedCollection());
410  dlg->exec();
411  delete dlg;
412  }
413 
414  void slotCreateContactGroup()
415  {
416  if (mInterceptedActions.contains(StandardContactActionManager::CreateContactGroup)) {
417  return;
418  }
419 
421  dlg->setDefaultAddressBook(selectedCollection());
422  dlg->exec();
423  delete dlg;
424  }
425 
426  void slotEditItem()
427  {
428  if (mInterceptedActions.contains(StandardContactActionManager::EditItem)) {
429  return;
430  }
431 
432  if (!mItemSelectionModel) {
433  return;
434  }
435 
436  if (mItemSelectionModel->selectedIndexes().isEmpty()) {
437  return;
438  }
439 
440  const QModelIndex index = mItemSelectionModel->selectedIndexes().first();
441  if (!index.isValid()) {
442  return;
443  }
444 
445  const Item item = index.data(EntityTreeModel::ItemRole).value<Item>();
446  if (!item.isValid()) {
447  return;
448  }
449 
452  connect(dlg.data(), &ContactEditorDialog::error, mParent, [this](const QString &error) {
453  slotContactEditorError(error);
454  });
455  dlg->setContact(item);
456  dlg->exec();
457  delete dlg;
460  dlg->setContactGroup(item);
461  dlg->exec();
462  delete dlg;
463  }
464  }
465 
466  void slotContactEditorError(const QString &error)
467  {
468  KMessageBox::error(mParentWidget, i18n("Contact cannot be stored: %1", error), i18n("Failed to store contact"));
469  }
470 
471  KActionCollection *const mActionCollection;
472  QWidget *const mParentWidget;
473  StandardActionManager *mGenericManager = nullptr;
474  QItemSelectionModel *mCollectionSelectionModel = nullptr;
475  QItemSelectionModel *mItemSelectionModel = nullptr;
477  QSet<StandardContactActionManager::Type> mInterceptedActions;
478  StandardContactActionManager *const mParent;
479 };
480 
482  : QObject(parent)
483  , d(new Private(actionCollection, parent, this))
484 {
485 }
486 
488 {
489  delete d;
490 }
491 
493 {
494  d->mCollectionSelectionModel = selectionModel;
495  d->mGenericManager->setCollectionSelectionModel(selectionModel);
496 
497  connect(selectionModel->model(), &QAbstractItemModel::rowsInserted, this, [this]() {
498  d->updateActions();
499  });
500  connect(selectionModel->model(), &QAbstractItemModel::rowsRemoved, this, [this]() {
501  d->updateActions();
502  });
503  connect(selectionModel, &QItemSelectionModel::selectionChanged, this, [this]() {
504  d->updateActions();
505  });
506 
507  d->updateActions();
508 }
509 
511 {
512  d->mItemSelectionModel = selectionModel;
513  d->mGenericManager->setItemSelectionModel(selectionModel);
514 
515  connect(selectionModel, &QItemSelectionModel::selectionChanged, this, [this]() {
516  d->updateActions();
517  });
518 
519  d->updateActions();
520 }
521 
523 {
524  QAction *action = d->mActions.value(type);
525  if (action) {
526  return action;
527  }
528 
529  switch (type) {
530  case CreateContact:
531  action = new QAction(d->mParentWidget);
532  action->setIcon(QIcon::fromTheme(QStringLiteral("contact-new")));
533  action->setText(i18n("New &Contact..."));
534  action->setWhatsThis(i18n(
535  "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>"));
536  d->mActions.insert(CreateContact, action);
537  d->mActionCollection->addAction(QStringLiteral("akonadi_contact_create"), action);
538  d->mActionCollection->setDefaultShortcut(action, QKeySequence(Qt::CTRL | Qt::Key_N));
539  connect(action, &QAction::triggered, this, [this]() {
540  d->slotCreateContact();
541  });
542  break;
543  case CreateContactGroup:
544  action = new QAction(d->mParentWidget);
545  action->setIcon(QIcon::fromTheme(QStringLiteral("user-group-new")));
546  action->setText(i18n("New &Group..."));
547  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>"));
548  d->mActions.insert(CreateContactGroup, action);
549  d->mActionCollection->addAction(QStringLiteral("akonadi_contact_group_create"), action);
550  d->mActionCollection->setDefaultShortcut(action, QKeySequence(Qt::CTRL | Qt::Key_G));
551  connect(action, &QAction::triggered, this, [this]() {
552  d->slotCreateContactGroup();
553  });
554  break;
555  case EditItem:
556  action = new QAction(d->mParentWidget);
557  action->setIcon(QIcon::fromTheme(QStringLiteral("document-edit")));
558  action->setText(i18n("Edit Contact..."));
559  action->setWhatsThis(
560  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 "
561  "phone numbers.</p>"));
562  action->setEnabled(false);
563  d->mActions.insert(EditItem, action);
564  d->mActionCollection->addAction(QStringLiteral("akonadi_contact_item_edit"), action);
565 
566  connect(action, &QAction::triggered, this, [this]() {
567  d->slotEditItem();
568  });
569  break;
570  default:
571  Q_ASSERT(false); // should never happen
572  break;
573  }
574 
575  return action;
576 }
577 
579 {
580  QAction *act = d->mGenericManager->action(type);
581  if (!act) {
582  act = d->mGenericManager->createAction(type);
583  }
584  d->updateGenericAction(type);
585  return act;
586 }
587 
589 {
593 
594  d->mGenericManager->createAllActions();
595  d->updateGenericAllActions();
596 
597  d->updateActions();
598 }
599 
601 {
602  if (d->mActions.contains(type)) {
603  return d->mActions.value(type);
604  }
605 
606  return nullptr;
607 }
608 
610 {
611  return d->mGenericManager->action(type);
612 }
613 
615 {
616  d->mGenericManager->setActionText(type, text);
617 }
618 
620 {
621  if (intercept) {
622  d->mInterceptedActions.insert(type);
623  } else {
624  d->mInterceptedActions.remove(type);
625  }
626 }
627 
629 {
630  d->mGenericManager->interceptAction(type, intercept);
631 }
632 
634 {
635  return d->mGenericManager->selectedCollections();
636 }
637 
639 {
640  return d->mGenericManager->selectedItems();
641 }
642 
644 {
645  d->mGenericManager->setCollectionPropertiesPageNames(names);
646 }
647 
648 #include "moc_standardcontactactionmanager.cpp"
void setText(const QString &text)
static QString mimeType()
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
virtual int rowCount(const QModelIndex &parent) const const =0
A dialog for creating or editing a contact in Akonadi.
void triggered(bool checked)
bool isValid() const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const =0
T * data() const const
void setCollectionSelectionModel(QItemSelectionModel *selectionModel)
Sets the collection selection model based on which the collection related actions should operate...
QAction * createAction(Type type)
Creates the action of the given type and adds it to the action collection specified in the constructo...
void setIcon(const QIcon &icon)
QAction * action(Type type) const
Returns the action of the given type, 0 if it has not been created (yet).
T value() const const
void createAllActions()
Convenience method to create all standard actions.
void setCollectionPropertiesPageNames(const QStringList &names)
void setEnabled(bool enabled)
bool isValid() const const
~StandardContactActionManager() override
Destroys the standard contact action manager.
Akonadi::Item::List selectedItems() const
Returns the list of items that are currently selected.
Edits the selected contact resp. contact group.
QString i18nc(const char *context, const char *text, const TYPE &arg...)
static QString mimeType()
void actionStateUpdated()
This signal is emitted whenever the action state has been updated.
StandardContactActionManager(KActionCollection *actionCollection, QWidget *parent=nullptr)
Creates a new standard contact action manager.
void error(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
void error(const QString &errMsg)
This signal is emitted whenever a contact is not updated or stored.
Akonadi::Collection::List selectedCollections() const
Returns the list of collections that are currently selected.
A dialog for creating or editing a contact group in Akonadi.
void rowsRemoved(const QModelIndex &parent, int first, int last)
void setWhatsThis(const QString &what)
void setItemSelectionModel(QItemSelectionModel *selectionModel)
Sets the item selection model based on which the item related actions should operate.
QString i18n(const char *text, const TYPE &arg...)
Manages contact specific actions for collection and item views.
KLocalizedString KI18N_EXPORT ki18nc(const char *context, const char *text)
const QAbstractItemModel * model() const const
QVariant data(int role) const const
bool isWantedItem(const Item &item) const
KLocalizedString KI18N_EXPORT ki18ncp(const char *context, const char *singular, const char *plural)
KLocalizedString KI18N_EXPORT ki18np(const char *singular, const char *plural)
KLocalizedString KI18N_EXPORT ki18n(const char *text)
void interceptAction(Type type, bool intercept=true)
Sets whether the default implementation for the given action type shall be executed when the action i...
QIcon fromTheme(const QString &name)
void rowsInserted(const QModelIndex &parent, int first, int last)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString toString() const const
const QAbstractItemModel * model() const const
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...
void setEnabled(bool)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jun 23 2021 23:09:25 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.