1/*
2 Copyright (c) 1998, 2008, 2009 David Faure <faure@kde.org>
3
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2 of the License or ( at
7 your option ) version 3 or, at the discretion of KDE e.V. ( which shall
8 act as a proxy as in section 14 of the GPLv3 ), any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KNAMEANDURLINPUTDIALOG_H
22#define KNAMEANDURLINPUTDIALOG_H
23
24#include <kfile_export.h>
25#include <kdialog.h>
26class KLineEdit;
27class KUrlRequester;
28class KNameAndUrlInputDialogPrivate;
29
30/**
31 * Dialog to ask for a name (e.g. filename) and a URL
32 * Basically a merge of KLineEditDlg and KUrlRequesterDlg ;)
33 * @since 4.5
34 * @author David Faure <faure@kde.org>
35 */
36class KFILE_EXPORT KNameAndUrlInputDialog : public KDialog
37{
38 Q_OBJECT
39public:
40 /**
41 * @param nameLabel label for the name field
42 * @param urlLabel label for the URL requester
43 * @param startDir start directory for the URL requester (optional)
44 * @param parent parent widget
45 */
46 KNameAndUrlInputDialog(const QString& nameLabel, const QString& urlLabel, const KUrl& startDir, QWidget *parent);
47
48 /**
49 * Destructor.
50 */
51 virtual ~KNameAndUrlInputDialog();
52
53 /**
54 * Pre-fill the name lineedit.
55 */
56 void setSuggestedName(const QString& name);
57 /**
58 * Pre-fill the URL requester.
59 */
60 void setSuggestedUrl(const KUrl& url);
61
62 /**
63 * @return the name the user entered
64 * Empty if the dialog was cancelled.
65 */
66 QString name() const;
67 /**
68 * @return the URL the user entered
69 * Empty if the dialog was cancelled.
70 */
71 KUrl url() const;
72
73private:
74 Q_PRIVATE_SLOT(d, void _k_slotNameTextChanged(const QString&))
75 Q_PRIVATE_SLOT(d, void _k_slotURLTextChanged(const QString&))
76
77 KNameAndUrlInputDialogPrivate* const d;
78};
79
80#endif
81