[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kde-baseapps] dolphin/src/kitemviews: Renaming: Don't select unknown extensions
From: Peter Penz <peter.penz19 () gmail ! com>
Date: 2012-06-16 20:53:47
Message-ID: 20120616205347.B4DB4A60A9 () git ! kde ! org
[Download RAW message or body]
Git commit 6207525f03e9a66f714ca1fe716e8d8772d04927 by Peter Penz.
Committed on 16/06/2012 at 22:51.
Pushed by ppenz into branch 'master'.
Renaming: Don't select unknown extensions
If a file with an unknown extension gets renamed, it is assumed
that the letters after the last point represent the extension and
won't be selected.
BUG: 301893
FIXED-IN: 4.9.0
M +8 -1 dolphin/src/kitemviews/kstandarditemlistwidget.cpp
http://commits.kde.org/kde-baseapps/6207525f03e9a66f714ca1fe716e8d8772d04927
diff --git a/dolphin/src/kitemviews/kstandarditemlistwidget.cpp \
b/dolphin/src/kitemviews/kstandarditemlistwidget.cpp index acd426c..e584c06 100644
--- a/dolphin/src/kitemviews/kstandarditemlistwidget.cpp
+++ b/dolphin/src/kitemviews/kstandarditemlistwidget.cpp
@@ -606,10 +606,17 @@ void KStandardItemListWidget::editedRoleChanged(const \
QByteArray& current, const \
m_roleEditor->document()->setDefaultTextOption(textOption);
// Select the text without MIME-type extension
+ // TODO: This is file-item-specific and should be moved
+ // into KFileItemListWidget.
int selectionLength = text.length();
const QString extension = KMimeType::extractKnownExtension(text);
- if (!extension.isEmpty()) {
+ if (extension.isEmpty()) {
+ // For an unknown extension just exclude the extension after
+ // the last point. This does not work for multiple extensions like
+ // *.tar.gz but usually this is anyhow a known extension.
+ selectionLength = text.lastIndexOf(QLatin1Char('.'));
+ } else {
selectionLength -= extension.length() + 1;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic