]> cloud.milkyroute.net Git - dolphin.git/blob - src/renamedialog.h
include cleanup
[dolphin.git] / src / renamedialog.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19 #ifndef RENAMEDIALOG_H
20 #define RENAMEDIALOG_H
21
22 #include <kdialog.h>
23 #include <kurl.h>
24
25
26
27 class KLineEdit;
28
29 /**
30 * @brief Dialog for renaming a variable number of files.
31 *
32 * The renaming is not done by the dialog, the invoker
33 * must do this itself:
34 * \code
35 * RenameDialog dialog(...);
36 * if (dialog.exec() == QDialog::Accepted) {
37 * const QString& newName = dialog.newName();
38 * if (newName.isEmpty()) {
39 * // an invalid name has been chosen, use
40 * // dialog.errorString() to tell the user about this
41 * }
42 * else {
43 * // rename items corresponding to the new name
44 * }
45 * }
46 * \endcode
47 */
48 class RenameDialog : public KDialog
49 {
50 Q_OBJECT
51
52 public:
53 explicit RenameDialog(const KUrl::List& items);
54 virtual ~RenameDialog();
55
56 /**
57 * Returns the new name of the items. If more than one
58 * item should be renamed, then it is assured that the # character
59 * is part of the returned string. If the returned string is empty,
60 * then RenameDialog::errorString() should be used to show the reason
61 * of having an empty string (e. g. if the # character has
62 * been deleted by the user, although more then one item should be
63 * renamed).
64 */
65 const QString& newName() const
66 {
67 return m_newName;
68 }
69
70 /**
71 * Returns the error string, if Dialog::newName() returned an empty string.
72 */
73 const QString& errorString() const
74 {
75 return m_errorString;
76 }
77
78 protected slots:
79 virtual void slotButtonClicked(int button);
80
81 private:
82 bool m_renameOneItem;
83 KLineEdit* m_lineEdit;
84 QString m_newName;
85 QString m_errorString;
86 };
87
88 #endif