Code review comment for lp://qastaging/~osomon/unity-2d/launcher-items-keyboard-shortcuts

Revision history for this message
Ugo Riboni (uriboni) wrote :

134 + if (value.size() == 1) {
135 + QChar c = value.at(0);
136 + if (c.isLetter()) {
137 + Qt::Key key = (Qt::Key) (Qt::Key_A + (c.toLower().toAscii() - 'a'));
138 + entry->setShortcutKey(key);
139 + }
140 + }

I am a fan of the principle "be strict in what you emit and relaxed in what you accept", and in this case if the string length is larger than 1 character, why don't you just pick the first character and emit a warning.
Or if you prefer just emit a warning and set no shortcut. But don't just silently do nothing.

review: Needs Fixing

« Back to merge proposal