File indexing completed on 2025-04-27 03:42:40
0001 /* 0002 SPDX-FileCopyrightText: 1998, 2008, 2009 David Faure <faure@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef KNAMEANDURLINPUTDIALOG_H 0008 #define KNAMEANDURLINPUTDIALOG_H 0009 0010 #include "kiofilewidgets_export.h" 0011 #include <QDialog> 0012 0013 #include <memory> 0014 0015 class KUrlRequester; 0016 class KNameAndUrlInputDialogPrivate; 0017 class QUrl; 0018 0019 /** 0020 * @class KNameAndUrlInputDialog knameandurlinputdialog.h <KNameAndUrlInputDialog> 0021 * 0022 * Dialog to ask for a name (e.g.\ filename) and a URL 0023 * Basically a merge of KLineEditDlg and KUrlRequesterDlg ;) 0024 * @author David Faure <faure@kde.org> 0025 */ 0026 class KIOFILEWIDGETS_EXPORT KNameAndUrlInputDialog : public QDialog 0027 { 0028 Q_OBJECT 0029 public: 0030 /** 0031 * @param nameLabel label for the name field 0032 * @param urlLabel label for the URL requester 0033 * @param startDir start directory for the URL requester (optional) 0034 * @param parent parent widget 0035 */ 0036 KNameAndUrlInputDialog(const QString &nameLabel, const QString &urlLabel, const QUrl &startDir, QWidget *parent); 0037 0038 /** 0039 * Destructor. 0040 */ 0041 ~KNameAndUrlInputDialog() override; 0042 0043 /** 0044 * Pre-fill the name lineedit. 0045 */ 0046 void setSuggestedName(const QString &name); 0047 /** 0048 * Pre-fill the URL requester. 0049 */ 0050 void setSuggestedUrl(const QUrl &url); 0051 0052 /** 0053 * @return the name the user entered 0054 */ 0055 QString name() const; 0056 /** 0057 * @return the URL the user entered 0058 */ 0059 QUrl url() const; 0060 /** 0061 * @return the URL the user entered, as plain text. 0062 * This is only useful for creating relative symlinks. 0063 * @since 5.25 0064 */ 0065 QString urlText() const; 0066 0067 private: 0068 std::unique_ptr<KNameAndUrlInputDialogPrivate> const d; 0069 }; 0070 0071 #endif