1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2000 Wilco Greven <greven@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef KURLREQUESTERDIALOG_H |
9 | #define KURLREQUESTERDIALOG_H |
10 | |
11 | #include "kiowidgets_export.h" |
12 | #include <QDialog> |
13 | #include <QUrl> |
14 | |
15 | #include <memory> |
16 | |
17 | class KUrlRequester; |
18 | class QFileDialog; |
19 | class KUrlRequesterDialogPrivate; |
20 | |
21 | /*! |
22 | * \class KUrlRequesterDialog |
23 | * \inmodule KIOWidgets |
24 | * |
25 | * \brief Simple dialog to enter a filename/url. |
26 | * |
27 | * Dialog in which a user can enter a filename or url. It is a dialog |
28 | * encapsulating KUrlRequester. |
29 | */ |
30 | class KIOWIDGETS_EXPORT KUrlRequesterDialog : public QDialog |
31 | { |
32 | Q_OBJECT |
33 | |
34 | public: |
35 | /*! |
36 | * Constructs a KUrlRequesterDialog. |
37 | * |
38 | * \a url The url of the directory to start in. Use QString() |
39 | * to start in the current working directory, or the last |
40 | * directory where a file has been selected. |
41 | * |
42 | * \a parent The parent object of this widget. |
43 | */ |
44 | explicit KUrlRequesterDialog(const QUrl &url, QWidget *parent = nullptr); |
45 | |
46 | /*! |
47 | * Constructs a KUrlRequesterDialog. |
48 | * |
49 | * \a url The url of the directory to start in. Use QString() |
50 | * to start in the current working directory, or the last |
51 | * directory where a file has been selected. |
52 | * |
53 | * \a text Text of the label |
54 | * |
55 | * \a parent The parent object of this widget. |
56 | */ |
57 | KUrlRequesterDialog(const QUrl &url, const QString &text, QWidget *parent); |
58 | |
59 | ~KUrlRequesterDialog() override; |
60 | |
61 | /*! |
62 | * Returns the fully qualified filename. |
63 | */ |
64 | QUrl selectedUrl() const; |
65 | |
66 | /*! |
67 | * Creates a modal dialog, executes it and returns the selected URL. |
68 | * |
69 | * \a url This specifies the initial path of the input line. |
70 | * |
71 | * \a parent The widget the dialog will be centered on initially. |
72 | * |
73 | * \a title The title to use for the dialog. |
74 | */ |
75 | static QUrl getUrl(const QUrl &url = QUrl(), QWidget *parent = nullptr, const QString &title = QString()); |
76 | |
77 | /*! |
78 | * Returns a pointer to the KUrlRequester. |
79 | */ |
80 | KUrlRequester *urlRequester(); |
81 | |
82 | private: |
83 | friend class KUrlRequesterDialogPrivate; |
84 | std::unique_ptr<KUrlRequesterDialogPrivate> const d; |
85 | |
86 | Q_DISABLE_COPY(KUrlRequesterDialog) |
87 | }; |
88 | |
89 | #endif // KURLREQUESTERDIALOG_H |
90 | |