Akonadi Contacts

recipientspickerwidget.cpp
1 /*
2  SPDX-FileCopyrightText: 2017-2021 Laurent Montel <[email protected]>
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 
16 using namespace Akonadi;
17 RecipientsPickerWidget::RecipientsPickerWidget(bool onlyShowEmailWithAddress, QAbstractItemModel *model, QWidget *parent)
18  : QWidget(parent)
19 {
20  auto layout = new QHBoxLayout(this);
21  layout->setContentsMargins(0, 0, 0, 0);
22 
23  mView =
24  new Akonadi::EmailAddressSelectionWidget(onlyShowEmailWithAddress, model ? model : Akonadi::RecipientsEditorManager::self()->model()->model(), this);
25  layout->addWidget(mView);
26  mView->view()->setSelectionMode(QAbstractItemView::ExtendedSelection);
27  mView->view()->setAlternatingRowColors(true);
28  mView->view()->setSortingEnabled(true);
29  mView->view()->sortByColumn(0, Qt::AscendingOrder);
30 }
31 
32 RecipientsPickerWidget::~RecipientsPickerWidget()
33 {
34 }
35 
36 QTreeView *RecipientsPickerWidget::view() const
37 {
38  return mView->view();
39 }
40 
41 Akonadi::EmailAddressSelectionWidget *RecipientsPickerWidget::emailAddressSelectionWidget() const
42 {
43  return mView;
44 }
QLayout * layout() const const
void setContentsMargins(int left, int top, int right, int bottom)
A widget to select email addresses from Akonadi.
void addWidget(QWidget *w)
AscendingOrder
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Jun 22 2021 23:08:52 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.