void TaskEditor::refreshFromServer(){ ServerCommand *command =new ServerCommand(this); command->set("command","getTask"); command->set("taskID",this->store.get("id","").asCString()); this->connect(command,SIGNAL(saveComplete(Json::Value)),this,SLOT(refreshFromServerComplete(Json::Value))); this->connect(command,SIGNAL(saveComplete(Json::Value)),command,SLOT(deleteLater())); command->send(); }
void TaskEditor::save(){ this->updateStore(); if(this->store["id"].asString()==""){ this->store["command"]="addTask"; }else{ this->store["command"]="editTask"; } ServerCommand *command = new ServerCommand(this->store,0); connect(command, SIGNAL(saveComplete(Json::Value)), command, SLOT(deleteLater())); command->send(); connect(command, SIGNAL(saveComplete(Json::Value)), this, SLOT(saveCompleted(Json::Value))); qDebug()<<"saved."; }
void TaskEditor::setStore(Json::Value &s, bool getNotes){ this->store=s; //remove all notes while(this->notes.length()){ this->notes.takeFirst()->deleteLater(); } if(this->store.get("id","")!="" && getNotes){ ServerCommand *command =new ServerCommand(this); command->set("command","getTaskNotes"); command->set("taskID",this->store.get("id","").asCString()); this->connect(command,SIGNAL(saveComplete(Json::Value)),this,SLOT(getNotesResponse(Json::Value))); this->connect(command,SIGNAL(saveComplete(Json::Value)),command,SLOT(deleteLater())); command->send(); } this->updateFromStore(); }