]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fixed issue that when renaming a variable number of items, that only one #-character...
authorPeter Penz <peter.penz19@gmail.com>
Thu, 10 Jan 2008 16:14:41 +0000 (16:14 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Thu, 10 Jan 2008 16:14:41 +0000 (16:14 +0000)
BUG: 155249

svn path=/trunk/KDE/kdebase/apps/; revision=759454

src/dolphinview.cpp
src/renamedialog.cpp

index ddb7185f0201409bb714b7b8886e60ddec08d1e0..44fbf4b6bd0a4464a52abc880a5caa1f7c7c56a0 100644 (file)
@@ -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 {
index adfc48676467e4fa135ae5b23cb87bc65f3fff22..fa5bf60e06278659e71ab70c24e6bc2802ecc8df 100644 (file)
@@ -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.");
         }
     }