Cleanup database save functions

* Make a clear distinction between saving to the existing file path and saving to a new file path
* Use proper save function calls in CLI
This commit is contained in:
Jonathan White 2019-10-20 18:38:52 -04:00
parent a876b3b72f
commit 6b746913e4
12 changed files with 33 additions and 57 deletions

View file

@ -44,7 +44,6 @@ int Move::executeWithDatabase(QSharedPointer<Database> database, QSharedPointer<
TextStream errorTextStream(Utils::STDERR, QIODevice::WriteOnly);
const QStringList args = parser->positionalArguments();
const QString& databasePath = args.at(0);
const QString& entryPath = args.at(1);
const QString& destinationPath = args.at(2);
@ -70,7 +69,7 @@ int Move::executeWithDatabase(QSharedPointer<Database> database, QSharedPointer<
entry->endUpdate();
QString errorMessage;
if (!database->save(databasePath, &errorMessage, true, false)) {
if (!database->save(&errorMessage, true, false)) {
errorTextStream << QObject::tr("Writing the database failed %1.").arg(errorMessage) << endl;
return EXIT_FAILURE;
}