void ListReplicatorCarts::refreshTimeoutData() { QString sql; RDSqlQuery *q; RDListViewItem *item; sql=QString("select ")+ "ID,"+ "ITEM_DATETIME "+ "from REPL_CART_STATE where "+ "REPLICATOR_NAME=\""+RDEscapeString(list_replicator_name)+"\""; q=new RDSqlQuery(sql); while(q->next()) { item=(RDListViewItem *)list_view->firstChild(); while(item!=NULL) { if(item->id()==q->value(0).toInt()) { item->setText(3,q->value(1). toDateTime().toString("hh:mm:ss dd/MM/yyyy")); break; } item=(RDListViewItem *)item->nextSibling(); } } delete q; list_refresh_timer->start(5000,true); }
void ListNodes::editData() { RDListViewItem *item; if((item=(RDListViewItem *)list_list_view->selectedItem())==NULL) { return; } int id=item->id(); EditNode *node=new EditNode(&id,list_matrix,this); if(node->exec()==0) { RefreshItem(item); } delete node; }
void ListNodes::deleteData() { QString sql; RDSqlQuery *q; RDListViewItem *item; if((item=(RDListViewItem *)list_list_view->selectedItem())==NULL) { return; } if(QMessageBox::question(this,tr("Delete Node"), tr("Are your sure you want to delete this node?"), QMessageBox::Yes,QMessageBox::No)== QMessageBox::No) { return; } sql=QString().sprintf("delete from SWITCHER_NODES where ID=%d",item->id()); q=new RDSqlQuery(sql); delete q; delete item; }