File indexing completed on 2024-04-28 15:26:46

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  * @since 4.5
0025  * @author David Faure <faure@kde.org>
0026  */
0027 class KIOFILEWIDGETS_EXPORT KNameAndUrlInputDialog : public QDialog
0028 {
0029     Q_OBJECT
0030 public:
0031     /**
0032      * @param nameLabel label for the name field
0033      * @param urlLabel label for the URL requester
0034      * @param startDir start directory for the URL requester (optional)
0035      * @param parent parent widget
0036      */
0037     KNameAndUrlInputDialog(const QString &nameLabel, const QString &urlLabel, const QUrl &startDir, QWidget *parent);
0038 
0039     /**
0040      * Destructor.
0041      */
0042     ~KNameAndUrlInputDialog() override;
0043 
0044     /**
0045      * Pre-fill the name lineedit.
0046      */
0047     void setSuggestedName(const QString &name);
0048     /**
0049      * Pre-fill the URL requester.
0050      */
0051     void setSuggestedUrl(const QUrl &url);
0052 
0053     /**
0054      * @return the name the user entered
0055      */
0056     QString name() const;
0057     /**
0058      * @return the URL the user entered
0059      */
0060     QUrl url() const;
0061     /**
0062      * @return the URL the user entered, as plain text.
0063      * This is only useful for creating relative symlinks.
0064      * @since 5.25
0065      */
0066     QString urlText() const;
0067 
0068 private:
0069     std::unique_ptr<KNameAndUrlInputDialogPrivate> const d;
0070 };
0071 
0072 #endif