┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-01-10 16:14:41 +0000
committerPeter Penz <[email protected]>2008-01-10 16:14:41 +0000
commitf2bf4eafc0aad961e37755f6b116ba7fb5593691 (patch)
treeaa482e35930ca8759d8914aac82a5af7c9cd080d /src
parente113e90fd6d328f054418bbabb59899125097e42 (diff)
Fixed issue that when renaming a variable number of items, that only one #-character as index is allowed.
BUG: 155249 svn path=/trunk/KDE/kdebase/apps/; revision=759454
Diffstat (limited to 'src')
-rw-r--r--src/dolphinview.cpp14
-rw-r--r--src/renamedialog.cpp4
2 files changed, 6 insertions, 12 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index ddb7185f0..44fbf4b6b 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -1053,19 +1053,14 @@ void DolphinView::renameSelectedItems()
Q_ASSERT(newName.contains('#'));
// iterate through all selected items and rename them...
- const int replaceIndex = newName.indexOf('#');
- Q_ASSERT(replaceIndex >= 0);
int index = 1;
-
- KFileItemList::const_iterator it = items.begin();
- const KFileItemList::const_iterator end = items.end();
- while (it != end) {
- const KUrl& oldUrl = (*it).url();
+ foreach (KFileItem item, items) {
+ const KUrl& oldUrl = item.url();
QString number;
number.setNum(index++);
- QString name(newName);
- name.replace(replaceIndex, 1, number);
+ QString name = newName;
+ name.replace('#', number);
if (oldUrl.fileName() != name) {
KUrl newUrl = oldUrl;
@@ -1073,7 +1068,6 @@ void DolphinView::renameSelectedItems()
KonqOperations::rename(this, oldUrl, newUrl);
emit doingOperation(KonqFileUndoManager::RENAME);
}
- ++it;
}
}
} else {
diff --git a/src/renamedialog.cpp b/src/renamedialog.cpp
index adfc48676..fa5bf60e0 100644
--- a/src/renamedialog.cpp
+++ b/src/renamedialog.cpp
@@ -116,9 +116,9 @@ void RenameDialog::slotButtonClicked(int button)
if (m_newName.isEmpty()) {
m_errorString = i18nc("@info:status",
"The new name is empty. A name with at least one character must be entered.");
- } else if (!m_renameOneItem && m_newName.count('#') != 1) {
+ } else if (!m_renameOneItem && (m_newName.count('#') == 0)) {
m_newName.truncate(0);
- m_errorString = i18nc("@info:status", "The name must contain exactly one # character.");
+ m_errorString = i18nc("@info:status", "The name must contain at least one # character.");
}
}