void ShortcutDialog::accept() { for(int i = 0;; ++i) { KKeySequence seq = shortcut().seq(i); if(seq.isNull()) break; if(seq.key(0) == Key_Escape) { reject(); return; } if(seq.key(0) == Key_Space) { // clear setShortcut(KShortcut()); KShortcutDialog::accept(); return; } if(seq.key(0).modFlags() == 0) { // no shortcuts without modifiers KShortcut cut = shortcut(); cut.setSeq(i, KKeySequence()); setShortcut(cut); return; } } KShortcutDialog::accept(); }
bool KKeyChooser::promptForReassign(const KKeySequence &cut, const QString &sAction, ActionType type, QWidget *parent) { if(cut.isNull()) return true; QString sTitle; QString s; if(type == Standard) { sTitle = i18n("Conflict with Standard Application Shortcut"); s = i18n( "The '%1' key combination has already been allocated " "to the standard action \"%2\".\n" "Do you want to reassign it from that action to the current one?"); } else if(type == Global) { sTitle = i18n("Conflict with Global Shortcut"); s = i18n( "The '%1' key combination has already been allocated " "to the global action \"%2\".\n" "Do you want to reassign it from that action to the current one?"); } else { sTitle = i18n("Key Conflict"); s = i18n( "The '%1' key combination has already been allocated " "to the \"%2\" action.\n" "Do you want to reassign it from that action to the current one?"); } s = s.arg(cut.toString()).arg(sAction.stripWhiteSpace()); return KMessageBox::warningContinueCancel(parent, s, sTitle, i18n("Reassign")) == KMessageBox::Continue; }
StdAccel findStdAccel(const KKeySequence &seq) { if(!seq.isNull()) { for(uint i = 0; g_infoStdAccel[i].psName != 0; i++) { StdAccel id = g_infoStdAccel[i].id; if(id != AccelNone) { if(!g_infoStdAccel[i].bInitialized) initialize(id); if(g_infoStdAccel[i].cut.contains(seq)) return id; } } } return AccelNone; }