File indexing completed on 2024-12-15 04:51:47

0001 /*******************************************************************
0002  KNotes -- Notes for the KDE project
0003 
0004  SPDX-FileCopyrightText: 2003 Daniel Martin <daniel.martin@pirack.com>
0005  SPDX-FileCopyrightText: 2004 Michael Brade <brade@kde.org>
0006 
0007  SPDX-License-Identifier: GPL-2.0-or-later
0008 *******************************************************************/
0009 
0010 #pragma once
0011 
0012 #include <QDialog>
0013 class KHistoryComboBox;
0014 class QTreeView;
0015 class QModelIndex;
0016 class QPushButton;
0017 
0018 /**
0019  * A dialog that allows to select network service or request a hostname or IP address.
0020  */
0021 namespace NoteShared
0022 {
0023 class NoteHostDialog : public QDialog
0024 {
0025     Q_OBJECT
0026 public:
0027     explicit NoteHostDialog(const QString &caption, QWidget *parent = nullptr);
0028     ~NoteHostDialog() override;
0029 
0030     [[nodiscard]] QString host() const;
0031     /**
0032      * Returns 0 if port was not specified
0033      */
0034     [[nodiscard]] quint16 port() const;
0035 
0036 private:
0037     void slotTextChanged(const QString &);
0038     void serviceSelected(const QModelIndex &);
0039 
0040     void slotServiceDoubleClicked(const QModelIndex &idx);
0041     void readConfig();
0042     KHistoryComboBox *const m_hostCombo;
0043     QTreeView *const m_servicesView;
0044     QPushButton *mOkButton = nullptr;
0045 };
0046 }