mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-01-04 10:05:33 -05:00
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:
parent
a876b3b72f
commit
6b746913e4
12 changed files with 33 additions and 57 deletions
|
|
@ -68,8 +68,8 @@ int Merge::executeWithDatabase(QSharedPointer<Database> database, QSharedPointer
|
|||
|
||||
const QStringList args = parser->positionalArguments();
|
||||
|
||||
QString toDatabasePath = args.at(0);
|
||||
QString fromDatabasePath = args.at(1);
|
||||
auto& toDatabasePath = args.at(0);
|
||||
auto& fromDatabasePath = args.at(1);
|
||||
|
||||
QSharedPointer<Database> db2;
|
||||
if (!parser->isSet(Merge::SameCredentialsOption)) {
|
||||
|
|
@ -94,13 +94,13 @@ int Merge::executeWithDatabase(QSharedPointer<Database> database, QSharedPointer
|
|||
Merger merger(db2.data(), database.data());
|
||||
QStringList changeList = merger.merge();
|
||||
|
||||
for (QString mergeChange : changeList) {
|
||||
for (auto& mergeChange : changeList) {
|
||||
outputTextStream << "\t" << mergeChange << endl;
|
||||
}
|
||||
|
||||
if (!changeList.isEmpty() && !parser->isSet(Merge::DryRunOption)) {
|
||||
QString errorMessage;
|
||||
if (!database->save(toDatabasePath, &errorMessage, true, false)) {
|
||||
if (!database->save(&errorMessage, true, false)) {
|
||||
errorTextStream << QObject::tr("Unable to save database to file : %1").arg(errorMessage) << endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue