| 1 | /* |
| 2 | SPDX-FileCopyrightText: 1998, 2008, 2009 David Faure <faure@kde.org> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 5 | */ |
| 6 | |
| 7 | #ifndef KNAMEANDURLINPUTDIALOG_H |
| 8 | #define KNAMEANDURLINPUTDIALOG_H |
| 9 | |
| 10 | #include "kiofilewidgets_export.h" |
| 11 | #include <QDialog> |
| 12 | |
| 13 | #include <memory> |
| 14 | |
| 15 | class KUrlRequester; |
| 16 | class KNameAndUrlInputDialogPrivate; |
| 17 | class QUrl; |
| 18 | |
| 19 | /*! |
| 20 | * \class KNameAndUrlInputDialog |
| 21 | * \inmodule KIOFileWidgets |
| 22 | * |
| 23 | * \brief Dialog to ask for a name (e.g.\ filename) and a URL. |
| 24 | * |
| 25 | * Basically a merge of KLineEditDlg and KUrlRequesterDlg ;) |
| 26 | */ |
| 27 | class KIOFILEWIDGETS_EXPORT KNameAndUrlInputDialog : public QDialog |
| 28 | { |
| 29 | Q_OBJECT |
| 30 | public: |
| 31 | /*! |
| 32 | * \a nameLabel label for the name field |
| 33 | * |
| 34 | * \a urlLabel label for the URL requester |
| 35 | * |
| 36 | * \a startDir start directory for the URL requester (optional) |
| 37 | * |
| 38 | * \a parent parent widget |
| 39 | */ |
| 40 | KNameAndUrlInputDialog(const QString &nameLabel, const QString &urlLabel, const QUrl &startDir, QWidget *parent); |
| 41 | |
| 42 | ~KNameAndUrlInputDialog() override; |
| 43 | |
| 44 | /*! |
| 45 | * Pre-fill the name lineedit. |
| 46 | */ |
| 47 | void setSuggestedName(const QString &name); |
| 48 | /*! |
| 49 | * Pre-fill the URL requester. |
| 50 | */ |
| 51 | void setSuggestedUrl(const QUrl &url); |
| 52 | |
| 53 | /*! |
| 54 | * Returns the name the user entered |
| 55 | */ |
| 56 | QString name() const; |
| 57 | /*! |
| 58 | * Returns the URL the user entered |
| 59 | */ |
| 60 | QUrl url() const; |
| 61 | /*! |
| 62 | * Returns the URL the user entered, as plain text. |
| 63 | * This is only useful for creating relative symlinks. |
| 64 | * \since 5.25 |
| 65 | */ |
| 66 | QString urlText() const; |
| 67 | |
| 68 | private: |
| 69 | std::unique_ptr<KNameAndUrlInputDialogPrivate> const d; |
| 70 | }; |
| 71 | |
| 72 | #endif |
| 73 | |