Пример #1
0
void MainWidget::addData()
{
  QString logname;
  QString svcname;
  RDSqlQuery *q;
  QString sql;
  std::vector<QString> newlogs;
  RDAddLog *log;

  if(rda->user()->createLog()) {
    log=new RDAddLog(&logname,&svcname,NULL,tr("Add Log"),this);
    if(log->exec()!=0) {
      delete log;
      return;
    }
    delete log;
    sql=QString("insert into LOGS set ")+
      "NAME=\""+RDEscapeString(logname)+"\","+
      "TYPE=0,"+
      "DESCRIPTION=\""+RDEscapeString(logname)+" log\","+
#ifdef WIN32
      "ORIGIN_USER=\""+RDEscapeString(RD_USER_LOGIN_NAME)+"\","+
#else
      "ORIGIN_USER=\""+RDEscapeString(rda->ripc()->user())+"\","+
#endif  // WIN32
      "ORIGIN_DATETIME=now(),"+
      "LINK_DATETIME=now(),"+
      "SERVICE=\""+RDEscapeString(svcname)+"\"";
    q=new RDSqlQuery(sql);
    if(!q->isActive()) {
      QMessageBox::warning(this,tr("Log Exists"),tr("Log Already Exists!"));
      delete q;
      return;
    }
    delete q;
    RDCreateLogTable(RDLog::tableName(logname));
    EditLog *editlog=new EditLog(logname,&log_filter,&log_group,&log_schedcode,
				 &log_clipboard,&newlogs,this);
    editlog->exec();
    delete editlog;
    ListListViewItem *item=new ListListViewItem(log_log_list);
    item->setText(1,logname);
    RefreshItem(item);
    log_log_list->setSelected(item,true);
    log_log_list->ensureItemVisible((Q3ListViewItem *)item);
    for(unsigned i=0;i<newlogs.size();i++) {
      item=new ListListViewItem(log_log_list);
      item->setText(1,newlogs[i]);
      RefreshItem(item);
    }
  }
}
Пример #2
0
void ListLogs::saveAsButtonData()
{
  QString logname;
  QString svcname=*list_svcname;
  RDAddLog *log;

  log=new RDAddLog(&logname,&svcname,rda->station(),tr("Rename Log"),this);
  if(log->exec()<0) {
    delete log;
    return;
  }
  delete log;
  *list_logname=logname;
  *list_svcname=svcname;
  done(3);
}
Пример #3
0
void ListLogs::saveAsButtonData()
{
  QString logname;
  QString svcname=*list_svcname;
  RDAddLog *log;
  if (rdstation_conf->broadcastSecurity() == RDStation::UserSec) {
    log=new RDAddLog(&logname,&svcname,rdstation_conf,
                     tr("Rename Log"),this,"log", rduser);
  } else { // RDStation::HostSec
    log=new RDAddLog(&logname,&svcname,rdstation_conf,
                     tr("Rename Log"),this,"log");
  }

  if(log->exec()<0) {
    delete log;
    return;
  }
  delete log;
  *list_logname=logname;
  *list_svcname=svcname;
  done(3);
}