Exemple #1
0
bool KstEventMonitorI::newObject() {
  QString tag_name = _tagName->text();
  tag_name.replace("<New_Event>", _w->lineEditEquation->text());

  // verify that the event name is unique
  if (KstData::self()->dataTagNameNotUnique(tag_name)) {
    _tagName->setFocus();
    return false;
  }

  EventMonitorEntryPtr event = new EventMonitorEntry(tag_name);
  fillEvent(event);

  if (!event->isValid()) {
    event = 0L;

    KMessageBox::sorry(this, i18n("There is a syntax error in the equation you entered."));
    return false;
  }

  KST::dataObjectList.lock().writeLock();
  KST::dataObjectList.append(event.data());
  KST::dataObjectList.lock().unlock();

  event = 0L; // drop the reference before we update
  emit modified();
  return true;
}
Exemple #2
0
ObjectPtr EventMonitorDialog::createNewDataObject() const {
  Q_ASSERT(_document && _document->objectStore());
  EventMonitorEntryPtr eventMonitor = _document->objectStore()->createObject<EventMonitorEntry>(ObjectTag::fromString(tagString()));

  eventMonitor->setScriptCode(_eventMonitorTab->script());
  eventMonitor->setEvent(_eventMonitorTab->event());
  eventMonitor->setDescription(_eventMonitorTab->description());
  eventMonitor->setLevel(_eventMonitorTab->logLevel());
  eventMonitor->setLogKstDebug(_eventMonitorTab->logKstDebug());
  eventMonitor->setLogEMail(_eventMonitorTab->logEMail());
  eventMonitor->setLogELOG(_eventMonitorTab->logELOG());
  eventMonitor->setEMailRecipients(_eventMonitorTab->emailRecipients());

  eventMonitor->reparse();

  eventMonitor->writeLock();
  eventMonitor->update(0);
  eventMonitor->unlock();

  return ObjectPtr(eventMonitor.data());
}