]> cloud.milkyroute.net Git - dolphin.git/blob - src/views/renamedialog.h
Use capitalized KDE includes
[dolphin.git] / src / views / renamedialog.h
1 /***************************************************************************
2 * Copyright (C) 2006-2010 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
20 #ifndef RENAMEDIALOG_H
21 #define RENAMEDIALOG_H
22
23 #include "libdolphin_export.h"
24
25 #include <KDialog>
26 #include <KFileItem>
27
28 class KLineEdit;
29
30 #include <QString>
31
32 /**
33 * @brief Dialog for renaming a variable number of files.
34 */
35 class LIBDOLPHINPRIVATE_EXPORT RenameDialog : public KDialog
36 {
37 Q_OBJECT
38
39 public:
40 explicit RenameDialog(QWidget* parent, const KFileItemList& items);
41 virtual ~RenameDialog();
42
43 protected slots:
44 virtual void slotButtonClicked(int button);
45
46 private slots:
47 void slotTextChanged(const QString& newName);
48
49 private:
50 void renameItems();
51
52
53 /**
54 * @return Returns the string \p name, where the characters represented by
55 * \p indexPlaceHolder get replaced by the index \p index.
56 * E. g. Calling indexedName("Test #.jpg", 12, '#') returns "Test 12.jpg".
57 * A connected sequence of placeholders results in leading zeros:
58 * indexedName("Test ####.jpg", 12, '#') returns "Test 0012.jpg".
59 */
60 static QString indexedName(const QString& name, int index, const QChar& indexPlaceHolder);
61
62 private:
63 bool m_renameOneItem;
64 QString m_newName;
65 KLineEdit* m_lineEdit;
66 KFileItemList m_items;
67 };
68
69 #endif