Marble

AddLinkDialog.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2015 Mikhail Ivchenko <[email protected]>
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 
15 namespace Marble {
16 
17 class Q_DECL_HIDDEN AddLinkDialog::Private : public Ui::UiAddLinkDialog
18 {
19 public:
20  Private();
21  ~Private();
22 };
23 
24 AddLinkDialog::Private::Private() :
25  Ui::UiAddLinkDialog()
26 {
27  // nothing to do
28 }
29 
30 AddLinkDialog::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 
50 QString AddLinkDialog::name() const
51 {
52  return d->m_name->text();
53 }
54 
56 {
57  return d->m_url->text();
58 }
59 
60 void 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"
void finished()
QMessageBox::StandardButton warning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
~AddLinkDialog() override=default
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void deleteLater()
Binds a QML item to a specific geodetic location in screen coordinates.
AddLinkDialog(QWidget *parent=nullptr, const QString &oname=i18n("object"))
QString url() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:12:25 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.