diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/diffeditor/diffeditordocument.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/diffeditor/diffeditordocument.cpp b/src/plugins/diffeditor/diffeditordocument.cpp index 470652aa2c..eb52c03a1c 100644 --- a/src/plugins/diffeditor/diffeditordocument.cpp +++ b/src/plugins/diffeditor/diffeditordocument.cpp @@ -129,6 +129,7 @@ bool DiffEditorDocument::open(QString *errorString, const QString &fileName) QString DiffEditorDocument::suggestedFileName() const { + enum { maxSubjectLength = 50 }; QString result = QStringLiteral("0001"); const QString description = m_controller->description(); if (!description.isEmpty()) { @@ -144,6 +145,10 @@ QString DiffEditorDocument::suggestedFileName() const subject[i] = space; } subject = subject.simplified(); + if (subject.size() > maxSubjectLength) { + const int lastSpace = subject.lastIndexOf(space, maxSubjectLength); + subject.truncate(lastSpace > 0 ? lastSpace : maxSubjectLength); + } subject.replace(space, dash); result += dash; result += subject; |