Bug 274299 - JJ: explanation on failed snippet name validation required
Summary: JJ: explanation on failed snippet name validation required
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: snippet (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR normal (vote)
Target Milestone: 1.3.0
Assignee: kdevelop-bugs-null
Keywords: junior-jobs
Depends on:
Reported: 2011-05-27 20:21 UTC by Wolfgang Bangerth
Modified: 2013-06-16 15:26 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:

Patch for bug 274299 (720 bytes, patch)
2011-10-01 12:25 UTC, Sudeep Duggal

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Bangerth 2011-05-27 20:21:49 UTC
Version:           4.2.1 (using KDE 4.6.0) 
OS:                Linux

Snippet names can, for good reasons, not have spaces or other characters in it. That said, if you don't know that, you enter a name with a space, say "loop over all cells" into the field for the name and what happens is that the "OK" button get grayed out and becomes inactive. That's confusing because there is no indication *why* I can't hit OK.

A better solution would be to either
- allow the user to hit OK but then give an error message that says what the
  problem is, or
- as the user types the name of the snippet and enters a disallowed character,
  have some text in red pop up and say that you can't do that; that shouldn't
  be too hard since apparently there is a function that monitors the text
  anyway and disables the "OK" button as soon as I enter a wrong character.


Reproducible: Always
Comment 1 Milian Wolff 2011-05-28 23:36:53 UTC
Comment 2 Nicolás Alvarez 2011-07-13 00:01:04 UTC
Please add the 'junior-jobs' keyword to JJs, in addition to (or instead of) editing the subject.
Comment 3 Sudeep Duggal 2011-10-01 12:25:02 UTC
Created attachment 64121 [details]
Patch for bug 274299

Hello, This is my first submission to any FOSS project. Please let me know if it meets the standards. Thank You!
Comment 4 Milian Wolff 2011-10-12 13:55:58 UTC
Sorry for the delay Sudeep.

I'd like to prevent using yet another dialog here to show that error message. Could you try to use KMessageWidget instead? See:


Also please use git.reviewboard.kde.org to upload the patch for review.

Comment 5 Ghislain MARY 2012-02-09 16:53:09 UTC
Hi, I just submitted a patch using a KMessageWidget for review: https://git.reviewboard.kde.org/r/103904/
Comment 6 Milian Wolff 2012-02-10 17:55:25 UTC
Git commit a414f42a9d1f2b08fcd08d8c39a7759657eeb684 by Milian Wolff, on behalf of Ghislain MARY.
Committed on 09/02/2012 at 17:40.
Pushed by mwolff into branch 'master'.

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.
REVIEW: 103904

M  +7    -0    plugins/snippet/editsnippet.cpp
M  +13   -0    plugins/snippet/editsnippet.ui

Comment 7 Andreas Pakulat 2012-02-16 19:55:23 UTC
Re-Open since the commit was reverted as it broke compilation on KDE 4.6 and older which is still a supported platform for KdevPlatform.
Comment 8 Kevin Funk 2013-05-17 06:40:00 UTC
Git commit c85f3a550ce03a1068a55743f1c8a78e03b0de3c by Kevin Funk, on behalf of Ghislain Mary.
Committed on 17/05/2013 at 08:38.
Pushed by kfunk into branch 'master'.

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.

TODO: Apply to kate/part/snippets as well
REVIEW: 103904

M  +7    -0    plugins/snippet/legacy/editsnippet.cpp
M  +13   -0    plugins/snippet/legacy/editsnippet.ui

Comment 9 Kevin Funk 2013-06-16 15:26:42 UTC
Git commit 15420d6c16b81e6792074d56b7443c68774cf85a by Kevin Funk.
Committed on 17/05/2013 at 08:42.
Pushed by kfunk into branch 'master'.

Explanation on failed snippet validation

Forward port of: https://git.reviewboard.kde.org/r/103904.
REVIEW: 110481

M  +7    -0    part/snippet/editsnippet.cpp
M  +13   -0    part/snippet/editsnippet.ui