Akonadi Contacts

recipientspickerwidget.cpp
1/*
2 SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "recipientspickerwidget.h"
8#include "contactstreemodel.h"
9#include "emailaddressselectionmodel.h"
10#include "emailaddressselectionwidget.h"
11#include "recipientseditormanager.h"
12#include <QAbstractItemView>
13#include <QHBoxLayout>
14#include <QTreeView>
15
16using namespace Akonadi;
17RecipientsPickerWidget::RecipientsPickerWidget(bool onlyShowEmailWithAddress, QAbstractItemModel *model, QWidget *parent)
18 : QWidget(parent)
19{
20 auto layout = new QHBoxLayout(this);
21 layout->setContentsMargins({});
22
23 mView =
24 new Akonadi::EmailAddressSelectionWidget(onlyShowEmailWithAddress, model ? model : Akonadi::RecipientsEditorManager::self()->model()->model(), this);
25 layout->addWidget(mView);
27 mView->view()->setAlternatingRowColors(true);
28 mView->view()->setSortingEnabled(true);
29 mView->view()->sortByColumn(0, Qt::AscendingOrder);
30}
31
32RecipientsPickerWidget::~RecipientsPickerWidget() = default;
33
34QTreeView *RecipientsPickerWidget::view() const
35{
36 return mView->view();
37}
38
39Akonadi::EmailAddressSelectionWidget *RecipientsPickerWidget::emailAddressSelectionWidget() const
40{
41 return mView;
42}
43
44#include "moc_recipientspickerwidget.cpp"
A widget to select email addresses from Akonadi.
QTreeView * view() const
Returns the tree view that is used to list the items.
A widget for editing the display name of a contact.
void setSelectionMode(QAbstractItemView::SelectionMode mode)
AscendingOrder
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:20 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.