2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2012-11-21 14:45:13 +00:00
|
|
|
#include "newaddresstab.h"
|
2018-11-12 20:20:34 +00:00
|
|
|
#include "adddialog.h"
|
2012-11-21 14:45:13 +00:00
|
|
|
|
|
|
|
#include <QtWidgets>
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
//! [0]
|
|
|
|
NewAddressTab::NewAddressTab(QWidget *parent)
|
2018-11-12 20:20:34 +00:00
|
|
|
: QWidget(parent)
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2018-11-12 20:20:34 +00:00
|
|
|
auto descriptionLabel = new QLabel(tr("There are currently no contacts in your address book. "
|
|
|
|
"\nClick Add to add new contacts."));
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2018-11-12 20:20:34 +00:00
|
|
|
auto addButton = new QPushButton(tr("Add"));
|
2013-03-14 23:42:15 +00:00
|
|
|
|
2015-07-31 11:53:29 +00:00
|
|
|
connect(addButton, &QAbstractButton::clicked, this, &NewAddressTab::addEntry);
|
2013-03-14 23:42:15 +00:00
|
|
|
|
2018-11-12 20:20:34 +00:00
|
|
|
auto mainLayout = new QVBoxLayout;
|
2011-04-27 10:05:43 +00:00
|
|
|
mainLayout->addWidget(descriptionLabel);
|
|
|
|
mainLayout->addWidget(addButton, 0, Qt::AlignCenter);
|
2013-03-14 23:42:15 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
setLayout(mainLayout);
|
|
|
|
}
|
|
|
|
//! [0]
|
|
|
|
|
|
|
|
//! [1]
|
|
|
|
void NewAddressTab::addEntry()
|
|
|
|
{
|
|
|
|
AddDialog aDialog;
|
2013-03-14 23:42:15 +00:00
|
|
|
|
2018-11-12 20:20:34 +00:00
|
|
|
if (aDialog.exec())
|
|
|
|
emit sendDetails(aDialog.name(), aDialog.address());
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
//! [1]
|