void EventEditor::eventHandlerDisabled(const QString & szHandler) { QString szEventName = szHandler.split("::")[0]; QString szHandlerName = szHandler.split("::")[1]; qDebug("Handler %s of event %s : disabled", szHandlerName.toUtf8().data(), szEventName.toUtf8().data()); for(int i = 0; i < m_pTreeWidget->topLevelItemCount(); i++) { EventEditorEventTreeWidgetItem * pItem = (EventEditorEventTreeWidgetItem *)m_pTreeWidget->topLevelItem(i); if(!KviQString::equalCI(szEventName, pItem->name())) continue; for(int j = 0; j < pItem->childCount(); j++) { if(KviQString::equalCI(szHandlerName, ((EventEditorHandlerTreeWidgetItem *)pItem->child(j))->name())) { ((EventEditorHandlerTreeWidgetItem *)pItem->child(j))->setEnabled(false); return; } } } }
void EventEditor::exportAllEvents() { saveLastEditedItem(); QString out; int count = m_pTreeWidget->topLevelItemCount(); for(int i = 0; i < count; i++) { EventEditorEventTreeWidgetItem * it = (EventEditorEventTreeWidgetItem *)m_pTreeWidget->topLevelItem(i); int ccount = it->childCount(); for(int j = 0; j < ccount; j++) { EventEditorHandlerTreeWidgetItem * item = (EventEditorHandlerTreeWidgetItem *)it->child(j); QString tmp; getExportEventBuffer(tmp, item); out += tmp; out += "\n"; } } QString szName = QDir::homePath(); if(!szName.endsWith(QString(KVI_PATH_SEPARATOR))) szName += KVI_PATH_SEPARATOR; szName += "events.kvs"; QString szFile; if(!KviFileDialog::askForSaveFileName(szFile, __tr2qs_ctx("Enter a Filename - KVIrc", "editor"), szName, QString(), true, true, true, this)) return; if(!KviFileUtils::writeFile(szFile, out)) { QMessageBox::warning(this, __tr2qs_ctx("Writing to File Failed", "editor"), __tr2qs_ctx("Unable to write to the events file.", "editor"), __tr2qs_ctx("OK", "editor")); } }