Marble

AddLinkDialog.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2015 Mikhail Ivchenko <ematirov@gmail.com>
4//
5
6// self
7#include "AddLinkDialog.h"
8#include "ui_AddLinkDialog.h"
9
10// Qt
11#include <QDebug>
12#include <QMessageBox>
13#include <QPushButton>
14
15namespace Marble
16{
17
18class Q_DECL_HIDDEN AddLinkDialog::Private : public Ui::UiAddLinkDialog
19{
20public:
21 Private();
22 ~Private();
23};
24
25AddLinkDialog::Private::Private()
26 : Ui::UiAddLinkDialog()
27{
28 // nothing to do
29}
30
31AddLinkDialog::Private::~Private() = default;
32
34 : QDialog(parent)
35 , d(new Private())
36{
37 d->setupUi(this);
38
39 d->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
40 connect(d->buttonBox->button(QDialogButtonBox::Ok), &QAbstractButton::pressed, this, &AddLinkDialog::checkFields);
42}
43
45{
46 delete d;
47}
48
49QString AddLinkDialog::name() const
50{
51 return d->m_name->text();
52}
53
55{
56 return d->m_url->text();
57}
58
59void AddLinkDialog::checkFields()
60{
61 if (d->m_url->text().isEmpty()) {
62 QMessageBox::warning(this, tr("No URL specified"), tr("Please specify a URL for this link."));
63 } else if (d->m_name->text().isEmpty()) {
64 QMessageBox::warning(this, tr("No name specified"), tr("Please specify a name for this link."));
65 } else {
66 accept();
67 }
68}
69
70}
71
72#include "moc_AddLinkDialog.cpp"
~AddLinkDialog() override=default
QString url() const
AddLinkDialog(QWidget *parent=nullptr, const QString &oname=i18n("object"))
Binds a QML item to a specific geodetic location in screen coordinates.
virtual void accept()
void finished(int result)
StandardButton warning(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons, StandardButton defaultButton)
void deleteLater()
QString tr(const char *sourceText, const char *disambiguation, int n)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
void setupUi(QWidget *widget)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.