akonadi/contact
22 #include "categorieseditwidget.h"
24 #include <akonadi/item.h>
25 #include <akonadi/tag.h>
26 #include <akonadi/tagwidget.h>
27 #include <kabc/addressee.h>
30 #include <QHBoxLayout>
32 CategoriesEditWidget::CategoriesEditWidget(
QWidget *parent)
39 mTagWidget =
new Akonadi::TagWidget(
this);
43 CategoriesEditWidget::~CategoriesEditWidget()
47 void CategoriesEditWidget::setReadOnly(
bool readOnly)
49 mTagWidget->setEnabled(!readOnly);
52 void CategoriesEditWidget::loadContact(
const KABC::Addressee &contact)
54 Akonadi::Tag::List tags;
56 const QStringList categories = contact.categories();
57 foreach (
const QString &category, categories) {
58 tags.
append(Akonadi::Tag::fromUrl(category));
61 mTagWidget->setSelection(tags);
64 void CategoriesEditWidget::storeContact(KABC::Addressee &contact)
const
68 const Akonadi::Tag::List tags = mTagWidget->selection();
69 foreach (
const Akonadi::Tag &tag, tags) {
70 categories.
append(tag.url().url());
73 contact.setCategories(categories);
void append(const T &value)
void setMargin(int margin)
void setSpacing(int spacing)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:19 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.