sendItem(...) & deleteItem(...) use the more generic send...Request(...) functions. (No merging of UUID of sent item into model and no deletion of local item yet.)
This commit is contained in:
@ -159,7 +159,7 @@ void GenericCore::saveItems() {
|
||||
}
|
||||
|
||||
void GenericCore::onSendItemTriggered(const QByteArray& jsonData) {
|
||||
m_serverCommunicator->postItems(jsonData);
|
||||
m_serverCommunicator->sendItem(jsonData);
|
||||
}
|
||||
|
||||
void GenericCore::onItemsFetched(const QByteArray jsonData) {
|
||||
@ -173,20 +173,20 @@ void GenericCore::onItemsFetchFailure(const QString errorString) {
|
||||
emit displayStatusMessage(QString("Error: %1").arg(errorString));
|
||||
}
|
||||
|
||||
void GenericCore::onPostRequestSuccessful(const QByteArray responseData) {
|
||||
void GenericCore::onSendItemSuccessful(const QByteArray responseData) {
|
||||
const QString message = m_mainModel->updateItemsFromJson(responseData);
|
||||
emit displayStatusMessage(message);
|
||||
}
|
||||
|
||||
void GenericCore::onPostRequestFailure(const QString errorString) {
|
||||
void GenericCore::onSendItemFailure(const QString errorString) {
|
||||
emit displayStatusMessage(QString("Error: %1").arg(errorString));
|
||||
}
|
||||
|
||||
void GenericCore::onDeleteRequestSuccessful(const QByteArray responseData) {
|
||||
void GenericCore::onDeleteItemSuccessful(const QByteArray responseData) {
|
||||
qWarning() << "TODO: Process success response!!!";
|
||||
}
|
||||
|
||||
void GenericCore::onDeleteRequestFailure(const QString errorString) {
|
||||
void GenericCore::onDeleteItemFailure(const QString errorString) {
|
||||
qWarning() << "TODO: Process error response!!!";
|
||||
}
|
||||
|
||||
@ -252,7 +252,8 @@ void GenericCore::setupServerCommunication() {
|
||||
/// request connections
|
||||
connect(this, &GenericCore::fetchItemsFromServer, m_serverCommunicator.get(),
|
||||
&ServerCommunicator::fetchItems);
|
||||
connect(this, &GenericCore::postItemToServer, this, &GenericCore::onSendItemTriggered);
|
||||
connect(this, &GenericCore::sendItemToServer, m_serverCommunicator.get(),
|
||||
&ServerCommunicator::sendItem);
|
||||
connect(this, &GenericCore::deleteItemFromServer, m_serverCommunicator.get(),
|
||||
&ServerCommunicator::deleteItem);
|
||||
|
||||
@ -261,14 +262,14 @@ void GenericCore::setupServerCommunication() {
|
||||
&GenericCore::onItemsFetched);
|
||||
connect(m_serverCommunicator.get(), &ServerCommunicator::itemsFetchFailure, this,
|
||||
&GenericCore::onItemsFetchFailure);
|
||||
connect(m_serverCommunicator.get(), &ServerCommunicator::postRequestSuccessful, this,
|
||||
&GenericCore::onPostRequestSuccessful);
|
||||
connect(m_serverCommunicator.get(), &ServerCommunicator::postRequestFailure, this,
|
||||
&GenericCore::onPostRequestFailure);
|
||||
connect(m_serverCommunicator.get(), &ServerCommunicator::deleteRequestSuccessful, this,
|
||||
&GenericCore::onDeleteRequestSuccessful);
|
||||
connect(m_serverCommunicator.get(), &ServerCommunicator::deleteRequestFailure, this,
|
||||
&GenericCore::onDeleteRequestFailure);
|
||||
connect(m_serverCommunicator.get(), &ServerCommunicator::sendItemSuccessful, this,
|
||||
&GenericCore::onSendItemSuccessful);
|
||||
connect(m_serverCommunicator.get(), &ServerCommunicator::sendItemFailure, this,
|
||||
&GenericCore::onSendItemFailure);
|
||||
connect(m_serverCommunicator.get(), &ServerCommunicator::deleteItemSuccessful, this,
|
||||
&GenericCore::onDeleteItemSuccessful);
|
||||
connect(m_serverCommunicator.get(), &ServerCommunicator::deleteItemFailure, this,
|
||||
&GenericCore::onDeleteItemFailure);
|
||||
|
||||
applyServerConfiguration();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user