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 <QMessageBox>
12#include <QPushButton>
13#include <QDebug>
14
15namespace Marble {
16
17class Q_DECL_HIDDEN AddLinkDialog::Private : public Ui::UiAddLinkDialog
18{
19public:
20 Private();
21 ~Private();
22};
23
24AddLinkDialog::Private::Private() :
25 Ui::UiAddLinkDialog()
26{
27 // nothing to do
28}
29
30AddLinkDialog::Private::~Private()
31{
32}
33
35 QDialog( parent ),
36 d( new Private() )
37{
38 d->setupUi( this );
39
40 d->buttonBox->button( QDialogButtonBox::Ok )->setDefault( true );
41 connect( d->buttonBox->button( QDialogButtonBox::Ok ), SIGNAL(pressed()), this, SLOT(checkFields()) );
42 connect( this, SIGNAL(finished(int)), SLOT(deleteLater()) );
43}
44
46{
47 delete d;
48}
49
50QString AddLinkDialog::name() const
51{
52 return d->m_name->text();
53}
54
56{
57 return d->m_url->text();
58}
59
60void AddLinkDialog::checkFields()
61{
62 if ( d->m_url->text().isEmpty() ) {
64 tr( "No URL specified" ),
65 tr( "Please specify a URL for this link." ) );
66 } else if ( d->m_name->text().isEmpty() ) {
68 tr( "No name specified" ),
69 tr( "Please specify a name for this link." ) );
70 } else {
71 accept();
72 }
73}
74
75}
76
77#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()
StandardButton warning(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons, StandardButton defaultButton)
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 Fri Jun 21 2024 12:00:06 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.