Changeset View
Changeset View
Standalone View
Standalone View
src/kkeysequencewidget.cpp
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Line(s) | 138 | QString message = i18ncp("%1 is the number of conflicts (hidden), %2 is the key sequence of the shortcut that is problematic", | |||
---|---|---|---|---|---|
139 | "The shortcut '%2' conflicts with the following key combination:\n", | 139 | "The shortcut '%2' conflicts with the following key combination:\n", | ||
140 | "The shortcut '%2' conflicts with the following key combinations:\n", | 140 | "The shortcut '%2' conflicts with the following key combinations:\n", | ||
141 | hashSize, sequence.toString()); | 141 | hashSize, sequence.toString()); | ||
142 | message += clashingKeys; | 142 | message += clashingKeys; | ||
143 | 143 | | |||
144 | QString title = i18ncp("%1 is the number of shortcuts with which there is a conflict", | 144 | QString title = i18ncp("%1 is the number of shortcuts with which there is a conflict", | ||
145 | "Conflict with Registered Global Shortcut", "Conflict with Registered Global Shortcuts", hashSize); | 145 | "Conflict with Registered Global Shortcut", "Conflict with Registered Global Shortcuts", hashSize); | ||
146 | 146 | | |||
147 | return KMessageBox::warningContinueCancel(parent, message, title, KGuiItem(i18n("Reassign"))) | 147 | return KMessageBox::warningContinueCancel(parent, message, title, KGuiItem(i18nc("@action:button", "Reassign"))) | ||
148 | == KMessageBox::Continue; | 148 | == KMessageBox::Continue; | ||
149 | } | 149 | } | ||
150 | #endif | 150 | #endif | ||
151 | 151 | | |||
152 | //private slot | 152 | //private slot | ||
153 | void doneRecording(bool validate = true); | 153 | void doneRecording(bool validate = true); | ||
154 | 154 | | |||
155 | //members | 155 | //members | ||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 224 | QString message = i18ncp("%1 is the number of ambigious shortcut clashes (hidden)", | |||
227 | "%3", | 227 | "%3", | ||
228 | "The \"%2\" shortcut is ambiguous with the following shortcuts.\n" | 228 | "The \"%2\" shortcut is ambiguous with the following shortcuts.\n" | ||
229 | "Do you want to assign an empty shortcut to these actions?\n" | 229 | "Do you want to assign an empty shortcut to these actions?\n" | ||
230 | "%3", | 230 | "%3", | ||
231 | listSize, | 231 | listSize, | ||
232 | seq.toString(QKeySequence::NativeText), | 232 | seq.toString(QKeySequence::NativeText), | ||
233 | conflictingShortcuts); | 233 | conflictingShortcuts); | ||
234 | 234 | | |||
235 | if (KMessageBox::warningContinueCancel(q, message, title, KGuiItem(i18n("Reassign"))) != KMessageBox::Continue) { | 235 | if (KMessageBox::warningContinueCancel(q, message, title, KGuiItem(i18nc("@action:button", "Reassign"))) != KMessageBox::Continue) { | ||
236 | return false; | 236 | return false; | ||
237 | } | 237 | } | ||
238 | 238 | | |||
239 | return true; | 239 | return true; | ||
240 | } | 240 | } | ||
241 | 241 | | |||
242 | void KKeySequenceWidgetPrivate::wontStealShortcut(QAction *item, const QKeySequence &seq) | 242 | void KKeySequenceWidgetPrivate::wontStealShortcut(QAction *item, const QKeySequence &seq) | ||
243 | { | 243 | { | ||
244 | QString title(i18n("Shortcut conflict")); | 244 | QString title(i18nc("@title:window", "Shortcut conflict")); | ||
245 | QString msg(i18n("<qt>The '%1' key combination is already used by the <b>%2</b> action.<br>" | 245 | QString msg(i18n("<qt>The '%1' key combination is already used by the <b>%2</b> action.<br>" | ||
246 | "Please select a different one.</qt>", seq.toString(QKeySequence::NativeText), | 246 | "Please select a different one.</qt>", seq.toString(QKeySequence::NativeText), | ||
247 | KLocalizedString::removeAcceleratorMarker(item->text()))); | 247 | KLocalizedString::removeAcceleratorMarker(item->text()))); | ||
248 | KMessageBox::sorry(q, msg, title); | 248 | KMessageBox::sorry(q, msg, title); | ||
249 | } | 249 | } | ||
250 | 250 | | |||
251 | KKeySequenceWidget::KKeySequenceWidget(QWidget *parent) | 251 | KKeySequenceWidget::KKeySequenceWidget(QWidget *parent) | ||
252 | : QWidget(parent), | 252 | : QWidget(parent), | ||
Show All 14 Lines | |||||
267 | void KKeySequenceWidgetPrivate::init() | 267 | void KKeySequenceWidgetPrivate::init() | ||
268 | { | 268 | { | ||
269 | layout = new QHBoxLayout(q); | 269 | layout = new QHBoxLayout(q); | ||
270 | layout->setContentsMargins(0, 0, 0, 0); | 270 | layout->setContentsMargins(0, 0, 0, 0); | ||
271 | 271 | | |||
272 | keyButton = new KKeySequenceButton(this, q); | 272 | keyButton = new KKeySequenceButton(this, q); | ||
273 | keyButton->setFocusPolicy(Qt::StrongFocus); | 273 | keyButton->setFocusPolicy(Qt::StrongFocus); | ||
274 | keyButton->setIcon(QIcon::fromTheme(QStringLiteral("configure"))); | 274 | keyButton->setIcon(QIcon::fromTheme(QStringLiteral("configure"))); | ||
275 | keyButton->setToolTip(i18n("Click on the button, then enter the shortcut like you would in the program.\nExample for Ctrl+A: hold the Ctrl key and press A.")); | 275 | keyButton->setToolTip(i18nc("@info:tooltip", "Click on the button, then enter the shortcut like you would in the program.\nExample for Ctrl+A: hold the Ctrl key and press A.")); | ||
276 | layout->addWidget(keyButton); | 276 | layout->addWidget(keyButton); | ||
277 | 277 | | |||
278 | clearButton = new QToolButton(q); | 278 | clearButton = new QToolButton(q); | ||
279 | layout->addWidget(clearButton); | 279 | layout->addWidget(clearButton); | ||
280 | 280 | | |||
281 | if (qApp->isLeftToRight()) { | 281 | if (qApp->isLeftToRight()) { | ||
282 | clearButton->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear-locationbar-rtl"))); | 282 | clearButton->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear-locationbar-rtl"))); | ||
283 | } else { | 283 | } else { | ||
▲ Show 20 Lines • Show All 328 Lines • ▼ Show 20 Line(s) | 606 | { | |||
612 | if (ssc != KStandardShortcut::AccelNone && !stealStandardShortcut(ssc, keySequence)) { | 612 | if (ssc != KStandardShortcut::AccelNone && !stealStandardShortcut(ssc, keySequence)) { | ||
613 | return true; | 613 | return true; | ||
614 | } | 614 | } | ||
615 | return false; | 615 | return false; | ||
616 | } | 616 | } | ||
617 | 617 | | |||
618 | bool KKeySequenceWidgetPrivate::stealStandardShortcut(KStandardShortcut::StandardShortcut std, const QKeySequence &seq) | 618 | bool KKeySequenceWidgetPrivate::stealStandardShortcut(KStandardShortcut::StandardShortcut std, const QKeySequence &seq) | ||
619 | { | 619 | { | ||
620 | QString title = i18n("Conflict with Standard Application Shortcut"); | 620 | QString title = i18nc("@title:window", "Conflict with Standard Application Shortcut"); | ||
621 | QString message = i18n("The '%1' key combination is also used for the standard action " | 621 | QString message = i18n("The '%1' key combination is also used for the standard action " | ||
622 | "\"%2\" that some applications use.\n" | 622 | "\"%2\" that some applications use.\n" | ||
623 | "Do you really want to use it as a global shortcut as well?", | 623 | "Do you really want to use it as a global shortcut as well?", | ||
624 | seq.toString(QKeySequence::NativeText), KStandardShortcut::label(std)); | 624 | seq.toString(QKeySequence::NativeText), KStandardShortcut::label(std)); | ||
625 | 625 | | |||
626 | if (KMessageBox::warningContinueCancel(q, message, title, KGuiItem(i18n("Reassign"))) != KMessageBox::Continue) { | 626 | if (KMessageBox::warningContinueCancel(q, message, title, KGuiItem(i18nc("@action:button", "Reassign"))) != KMessageBox::Continue) { | ||
627 | return false; | 627 | return false; | ||
628 | } | 628 | } | ||
629 | return true; | 629 | return true; | ||
630 | } | 630 | } | ||
631 | 631 | | |||
632 | void KKeySequenceWidgetPrivate::updateShortcutDisplay() | 632 | void KKeySequenceWidgetPrivate::updateShortcutDisplay() | ||
633 | { | 633 | { | ||
634 | //empty string if no non-modifier was pressed | 634 | //empty string if no non-modifier was pressed | ||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | |||||
714 | { | 714 | { | ||
715 | int keyQt = e->key(); | 715 | int keyQt = e->key(); | ||
716 | if (keyQt == -1) { | 716 | if (keyQt == -1) { | ||
717 | // Qt sometimes returns garbage keycodes, I observed -1, if it doesn't know a key. | 717 | // Qt sometimes returns garbage keycodes, I observed -1, if it doesn't know a key. | ||
718 | // We cannot do anything useful with those (several keys have -1, indistinguishable) | 718 | // We cannot do anything useful with those (several keys have -1, indistinguishable) | ||
719 | // and QKeySequence.toString() will also yield a garbage string. | 719 | // and QKeySequence.toString() will also yield a garbage string. | ||
720 | KMessageBox::sorry(this, | 720 | KMessageBox::sorry(this, | ||
721 | i18n("The key you just pressed is not supported by Qt."), | 721 | i18n("The key you just pressed is not supported by Qt."), | ||
722 | i18n("Unsupported Key")); | 722 | i18nc("@title:window", "Unsupported Key")); | ||
723 | d->cancelRecording(); | 723 | d->cancelRecording(); | ||
724 | return; | 724 | return; | ||
725 | } | 725 | } | ||
726 | 726 | | |||
727 | uint newModifiers = e->modifiers() & (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier); | 727 | uint newModifiers = e->modifiers() & (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier); | ||
728 | 728 | | |||
729 | //don't have the return or space key appear as first key of the sequence when they | 729 | //don't have the return or space key appear as first key of the sequence when they | ||
730 | //were pressed to start editing - catch and them and imitate their effect | 730 | //were pressed to start editing - catch and them and imitate their effect | ||
▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines |