bool Verb::ReadFromRegistry(const wxRegKey & base, const wxString & verbName) { // Store descriptive verb name m_name = verbName; if (!base.HasSubKey(verbName)) return false; wxRegKey verbKey(base, verbName); // Read command key const wxString commandKeyName(wxT("command")); if (!verbKey.HasSubKey(commandKeyName)) return false; wxRegKey commandKey(base, commandKeyName); if (commandKey.HasValue(NULL)) commandKey.QueryValue(NULL, m_command); // Attempt to read ddeexec key m_ddeCommand.Clear(); m_ddeTopic.Clear(); m_ddeApplication.Clear(); const wxString ddeCommandKeyName(wxT("ddeexec")); m_usesDde = verbKey.HasSubKey(ddeCommandKeyName); if (m_usesDde) { wxRegKey ddeCommandKey(verbKey, ddeCommandKeyName);; if (ddeCommandKey.HasValue(NULL)) ddeCommandKey.QueryValue(NULL, m_ddeCommand); const wxString ddeTopicName(wxT("Topic")); if (ddeCommandKey.HasSubKey(ddeTopicName)) { wxRegKey ddeTopicKey(ddeCommandKey, ddeTopicName); if (ddeTopicKey.HasValue(NULL)) ddeTopicKey.QueryValue(NULL, m_ddeTopic); } const wxString ddeApplicationName(wxT("Application")); if (ddeCommandKey.HasSubKey(ddeApplicationName)) { wxRegKey ddeApplicationKey(ddeCommandKey, ddeApplicationName); if (ddeApplicationKey.HasValue(NULL)) ddeApplicationKey.QueryValue(NULL, m_ddeApplication); } } return true; }
NS_IMETHODIMP nsControllerCommandTable::UnregisterCommand(const char * aCommandName, nsIControllerCommand *aCommand) { NS_ENSURE_TRUE(mMutable, NS_ERROR_FAILURE); nsDependentCString commandKey(aCommandName); if (!mCommandsTable.Get(commandKey, nullptr)) { return NS_ERROR_FAILURE; } mCommandsTable.Remove(commandKey); return NS_OK; }
// Handle key presses. void QsciScintillaBase::keyPressEvent(QKeyEvent *e) { int modifiers = 0; if (e->modifiers() & Qt::ShiftModifier) modifiers |= SCMOD_SHIFT; if (e->modifiers() & Qt::ControlModifier) modifiers |= SCMOD_CTRL; if (e->modifiers() & Qt::AltModifier) modifiers |= SCMOD_ALT; if (e->modifiers() & Qt::MetaModifier) modifiers |= SCMOD_META; int key = commandKey(e->key(), modifiers); if (key) { bool consumed = false; sci->KeyDownWithModifiers(key, modifiers, &consumed); if (consumed) { e->accept(); return; } } QString text = e->text(); if (!text.isEmpty() && text[0].isPrint()) { ScintillaBytes bytes = textAsBytes(text); sci->AddCharUTF(bytes.data(), bytes.length()); e->accept(); } else { QAbstractScrollArea::keyPressEvent(e); } }