┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kitemviews/kstandarditemlistwidget.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp
index acd426cf2..e584c0678 100644
--- a/src/kitemviews/kstandarditemlistwidget.cpp
+++ b/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;
}