cli: Abort editing config if nothing has changed

This commit is contained in:
Martchus 2018-09-15 18:42:14 +02:00
parent 3731933c37
commit f0a2d60906
1 changed files with 4 additions and 0 deletions

View File

@ -766,6 +766,10 @@ QByteArray Application::editConfigViaEditor() const
cerr << Phrases::Error << "New config object seems empty." << Phrases::EndFlush;
return QByteArray();
}
if (configObj == m_connection.rawConfig()) {
cerr << Phrases::Warning << "Editing aborted; config hasn't changed." << Phrases::EndFlush;
return QByteArray();
}
for (const auto &arrayName : { QStringLiteral("devices"), QStringLiteral("folders") }) {
if (!configObj.value(arrayName).isArray()) {
cerr << Phrases::Error << "Array \"" << arrayName.toLocal8Bit().data() << "\" is not present." << Phrases::EndFlush;