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 knameandurlinputdialog.h <KNameAndUrlInputDialog> |
21 | * |
22 | * Dialog to ask for a name (e.g.\ filename) and a URL |
23 | * Basically a merge of KLineEditDlg and KUrlRequesterDlg ;) |
24 | * @author David Faure <faure@kde.org> |
25 | */ |
26 | class KIOFILEWIDGETS_EXPORT KNameAndUrlInputDialog : public QDialog |
27 | { |
28 | Q_OBJECT |
29 | public: |
30 | /** |
31 | * @param nameLabel label for the name field |
32 | * @param urlLabel label for the URL requester |
33 | * @param startDir start directory for the URL requester (optional) |
34 | * @param parent parent widget |
35 | */ |
36 | KNameAndUrlInputDialog(const QString &nameLabel, const QString &urlLabel, const QUrl &startDir, QWidget *parent); |
37 | |
38 | /** |
39 | * Destructor. |
40 | */ |
41 | ~KNameAndUrlInputDialog() override; |
42 | |
43 | /** |
44 | * Pre-fill the name lineedit. |
45 | */ |
46 | void setSuggestedName(const QString &name); |
47 | /** |
48 | * Pre-fill the URL requester. |
49 | */ |
50 | void setSuggestedUrl(const QUrl &url); |
51 | |
52 | /** |
53 | * @return the name the user entered |
54 | */ |
55 | QString name() const; |
56 | /** |
57 | * @return the URL the user entered |
58 | */ |
59 | QUrl url() const; |
60 | /** |
61 | * @return the URL the user entered, as plain text. |
62 | * This is only useful for creating relative symlinks. |
63 | * @since 5.25 |
64 | */ |
65 | QString urlText() const; |
66 | |
67 | private: |
68 | std::unique_ptr<KNameAndUrlInputDialogPrivate> const d; |
69 | }; |
70 | |
71 | #endif |
72 | |