diff options
| author | Peter Penz <[email protected]> | 2012-06-16 22:51:39 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-06-16 22:53:32 +0200 |
| commit | 53b01d5aff7617f48cfbbfc34f8ff6f0a6a2f052 (patch) | |
| tree | d0565cc85f6f4401c1f2949b94313e217cf4d8ba | |
| parent | 741f42f014f673142e0698b9c6666b5ae5094b37 (diff) | |
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
| -rw-r--r-- | src/kitemviews/kstandarditemlistwidget.cpp | 9 |
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; } |
