static void quitHandler(int UNUSED(sig)) { #if DEBUG printf("CLOSE %d %s(%d)\n", srvSettings.commPipe[WRITE], __FILE__, __LINE__); #endif triggerCommand(QUIT_TRIGGER); }
bool ActionCollection::deSerialize(const QDomElement& actionCollectionElem) { if (actionCollectionElem.isNull()) return false; qDeleteAll(listInterfaceCommands); listInterfaceCommands.clear(); QDomElement listsElement = actionCollectionElem.firstChildElement("lists"); if (listsElement.isNull()) { QHash<CommandListElements::Element, VoiceInterfaceCommand*> baseConfig = ScenarioManager::getInstance()-> getListBaseConfiguration(); QHashIterator<CommandListElements::Element, VoiceInterfaceCommand*> i(baseConfig); while (i.hasNext()) { i.next(); // i.value() is not a valid command listInterfaceCommands.insertMulti(i.key(), new VoiceInterfaceCommand(*(i.value()))); } } else { QDomElement commandElem = listsElement.firstChildElement(); while (!commandElem.isNull()) { VoiceInterfaceCommand *com = VoiceInterfaceCommand::createInstance(commandElem); int elementId = commandElem.attribute("element").toInt(); commandElem = commandElem.nextSiblingElement("voiceInterfaceCommand"); if (!com) continue; listInterfaceCommands.insert((CommandListElements::Element) elementId, com); } } QDomElement autorunElem = actionCollectionElem.firstChildElement("autorun"); m_autorunActive = autorunElem.attribute("active") == "1"; m_autorunCommand = autorunElem.firstChildElement("trigger").text(); m_autorunType = autorunElem.firstChildElement("category").text(); //clean member qDeleteAll(m_actions); m_actions.clear(); QDomElement pluginElem = actionCollectionElem.firstChildElement("plugin"); while (!pluginElem.isNull()) { Action *a = Action::createAction(parentScenario, pluginElem, this); if (!a) { kDebug() << "Could not load action"; } else { //m_actions << a; appendAction(a, true /*silent*/); } pluginElem = pluginElem.nextSiblingElement("plugin"); } proxy->update(); reset(); if (m_autorunActive) { bool succ = triggerCommand(m_autorunType, m_autorunCommand, true /* silent */); kDebug() << "Executed autorun command; Success: " << succ; } return true; }
static void scanHandler(int UNUSED(sig)) { triggerCommand(SCAN_TRIGGER); }