Akonadi Contacts

contactgroupviewerdialog.cpp
1 /*
2  This file is part of Akonadi Contact.
3 
4  SPDX-FileCopyrightText: 2009 Tobias Koenig <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #include "contactgroupviewerdialog.h"
10 
11 #include "contactgroupviewer.h"
12 
13 #include <KLocalizedString>
14 #include <item.h>
15 
16 #include <QDialogButtonBox>
17 #include <QPushButton>
18 #include <QVBoxLayout>
19 
20 using namespace Akonadi;
21 
22 class Q_DECL_HIDDEN ContactGroupViewerDialog::Private
23 {
24 public:
25  ContactGroupViewer *mViewer = nullptr;
26 };
27 
29  : QDialog(parent)
30  , d(new Private)
31 {
32  setWindowTitle(i18nc("@title:window", "Show Contact Group"));
33  auto mainLayout = new QVBoxLayout(this);
34 
35  auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok, this);
36  QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
37  okButton->setDefault(true);
38  okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
41 
42  mainLayout->addWidget(d->mViewer);
43  mainLayout->addWidget(buttonBox);
44 
45  resize(QSize(500, 600));
46 }
47 
49 {
50  delete d;
51 }
52 
54 {
55  return d->mViewer->contactGroup();
56 }
57 
59 {
60  return d->mViewer;
61 }
62 
64 {
65  d->mViewer->setContactGroup(group);
66 }
void resize(int w, int h)
virtual void reject()
ContactGroupViewerDialog(QWidget *parent=nullptr)
Creates a new contact group viewer dialog.
Akonadi::Item contactGroup() const
Returns the contact group that is currently displayed.
A dialog for displaying a contact group in Akonadi.
void setContactGroup(const Akonadi::Item &group)
Sets the contact group that shall be displayed in the dialog.
QString i18nc(const char *context, const char *text, const TYPE &arg...)
void setShortcut(const QKeySequence &key)
ContactGroupViewer * viewer() const
Returns the ContactGroupViewer that is used by this dialog.
virtual void accept()
void setWindowTitle(const QString &)
~ContactGroupViewerDialog() override
Destroys the contact group viewer dialog.
A viewer component for contact groups in Akonadi.
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setDefault(bool)
Key_Return
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jun 23 2021 23:09:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.