Commit a414f42a authored by Ghislain MARY's avatar Ghislain MARY Committed by Milian Wolff
Browse files

show explanation on failed snippet name validation

Show a warning message in a KMessageWidget if a space character is
entered in the snippet name line edit.

BUG: 274299
REVIEW: 103904
parent 351f28b1
......@@ -25,6 +25,7 @@
#include <KTextEditor/View>
#include <KToolInvocation>
#include <KMessageBox>
#include <KMessageWidget>
#include "snippetstore.h"
#include "snippet.h"
......@@ -144,9 +145,15 @@ void EditSnippet::validate()
for ( int i = 0; i < name.length(); ++i ) {
if ( ) {
valid = false;
m_ui->messageWidget->setText(i18n("Snippet name must not contain spaces"));
if (valid) {
// hide message widget if snippet does not include spaces
......@@ -17,6 +17,19 @@
<layout class="QVBoxLayout" name="verticalLayout">
<widget class="KMessageWidget" name="messageWidget">
<property name="visible">
<property name="closeButtonVisible">
<property name="messageType">
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment