diff options
| author | Peter Penz <[email protected]> | 2007-03-24 15:16:15 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-03-24 15:16:15 +0000 |
| commit | 3b4d05893b4023338d8484dc5c6812bbe0fb0ceb (patch) | |
| tree | fb2f2467e2f8fde45eafb70ff062486da4b2b16d | |
| parent | 0ac441acbe51a222d9094a5457e564a97bd60478 (diff) | |
when renaming only one item, suggest the original item name instead of "New Name"
svn path=/trunk/KDE/kdebase/apps/; revision=646100
| -rw-r--r-- | src/renamedialog.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/renamedialog.cpp b/src/renamedialog.cpp index 4055b32a6..c3fe9d722 100644 --- a/src/renamedialog.cpp +++ b/src/renamedialog.cpp @@ -51,17 +51,17 @@ RenameDialog::RenameDialog(const KUrl::List& items) : QLabel* editLabel = 0; if (m_renameOneItem) { const KUrl& url = items.first(); - editLabel = new QLabel(i18n("Rename the item '%1' to:", url.fileName()), + m_newName = url.fileName(); + editLabel = new QLabel(i18n("Rename the item '%1' to:", m_newName), page); } else { + m_newName = i18n("New name #"); editLabel = new QLabel(i18n("Rename the %1 selected items to:", itemCount), page); } m_lineEdit = new KLineEdit(page); - m_newName = m_renameOneItem ? i18n("New name") : i18n("New name #"); - QString postfix(items[0].prettyUrl().section('.',1)); if (postfix.length() > 0) { // The first item seems to have a postfix (e. g. 'jpg' or 'txt'). Now @@ -82,9 +82,16 @@ RenameDialog::RenameDialog(const KUrl::List& items) : --selectionLength; // don't select the # character } - if (postfix.length() > 0) { - m_newName.append(postfix); + const int postfixLength = postfix.length(); + if (postfixLength > 0) { + if (m_renameOneItem) { + selectionLength -= postfixLength; + } + else { + m_newName.append(postfix); + } } + m_lineEdit->setText(m_newName); m_lineEdit->setSelection(0, selectionLength); m_lineEdit->setFocus(); |
