mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-11-21 09:31:32 -08:00
Fix all Qt 5.15 deprecation warnings (#7783)
* Deprecated qSort() -> std::sort()
* Replace QDateTime::toString(Qt::DefaultLocaleShortDate) with Clock::toString()
* Replace QDateTime::toString(Qt::SystemLocaleShortDate) with QLocale::system().toString(..., QLocale::ShortFormat)
* Use QDateTime::startOfDay() instead of QDate(QDateTime)
Note: QDateTime::startOfDay() is only available in Qt 5.14, we need to guard it
* Replace QString::SkipEmptyParts with Qt::SkipEmptyParts
Note: Its designated replacement, Qt::SplitBehavior, was only added in Qt 5.14.
* Don't call deprecated QFlags(nullptr) constructor
* QSet::{toList->values}
* Replace QList::toSet, QSet::fromList with Tools::asSet()
* QHash::insertMulti -> QMultiHash::insert
* QProcess::startDetached: non-deprecated overload
* QProcess::{pid->processId}
* QPainter::{HighQuality->}Antialiasing
* QPalette::{background->window}()
* Use Qt::{Background,Foreground}Role
* endl -> Qt::endl, flush -> Qt::flush
* Make YubiKey::s_interfaceMutex non-recursive
* OpenSSHKeyGenDialog: use non-deprecated QComboBox::sizeAdjustPolicy setting
This commit is contained in:
65 files changed
+329
-236
No files matched your search
+12
-11
@@ -18,6 +18,7 @@
|
||||
#include "DatabaseCreate.h"
|
||||
|
||||
#include "Utils.h"
|
||||
#include "core/Global.h"
|
||||
#include "keys/FileKey.h"
|
||||
|
||||
#include <QCommandLineParser>
|
||||
@@ -67,13 +68,13 @@ QSharedPointer<Database> DatabaseCreate::initializeDatabaseFromOptions(const QSh
|
||||
if (decryptionTimeValue.length() != 0) {
|
||||
decryptionTime = decryptionTimeValue.toInt();
|
||||
if (decryptionTime <= 0) {
|
||||
err << QObject::tr("Invalid decryption time %1.").arg(decryptionTimeValue) << endl;
|
||||
err << QObject::tr("Invalid decryption time %1.").arg(decryptionTimeValue) << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
if (decryptionTime < Kdf::MIN_ENCRYPTION_TIME || decryptionTime > Kdf::MAX_ENCRYPTION_TIME) {
|
||||
err << QObject::tr("Target decryption time must be between %1 and %2.")
|
||||
.arg(QString::number(Kdf::MIN_ENCRYPTION_TIME), QString::number(Kdf::MAX_ENCRYPTION_TIME))
|
||||
<< endl;
|
||||
<< Qt::endl;
|
||||
return {};
|
||||
}
|
||||
}
|
||||
@@ -83,7 +84,7 @@ QSharedPointer<Database> DatabaseCreate::initializeDatabaseFromOptions(const QSh
|
||||
if (parser->isSet(DatabaseCreate::SetPasswordOption)) {
|
||||
auto passwordKey = Utils::getConfirmedPassword();
|
||||
if (passwordKey.isNull()) {
|
||||
err << QObject::tr("Failed to set database password.") << endl;
|
||||
err << QObject::tr("Failed to set database password.") << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
key->addKey(passwordKey);
|
||||
@@ -101,7 +102,7 @@ QSharedPointer<Database> DatabaseCreate::initializeDatabaseFromOptions(const QSh
|
||||
}
|
||||
|
||||
if (!Utils::loadFileKey(keyFilePath, fileKey)) {
|
||||
err << QObject::tr("Loading the key file failed") << endl;
|
||||
err << QObject::tr("Loading the key file failed") << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ QSharedPointer<Database> DatabaseCreate::initializeDatabaseFromOptions(const QSh
|
||||
}
|
||||
|
||||
if (key->isEmpty()) {
|
||||
err << QObject::tr("No key is set. Aborting database creation.") << endl;
|
||||
err << QObject::tr("No key is set. Aborting database creation.") << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -122,15 +123,15 @@ QSharedPointer<Database> DatabaseCreate::initializeDatabaseFromOptions(const QSh
|
||||
auto kdf = db->kdf();
|
||||
Q_ASSERT(kdf);
|
||||
|
||||
out << QObject::tr("Benchmarking key derivation function for %1ms delay.").arg(decryptionTimeValue) << endl;
|
||||
out << QObject::tr("Benchmarking key derivation function for %1ms delay.").arg(decryptionTimeValue) << Qt::endl;
|
||||
int rounds = kdf->benchmark(decryptionTime);
|
||||
out << QObject::tr("Setting %1 rounds for key derivation function.").arg(QString::number(rounds)) << endl;
|
||||
out << QObject::tr("Setting %1 rounds for key derivation function.").arg(QString::number(rounds)) << Qt::endl;
|
||||
kdf->setRounds(rounds);
|
||||
|
||||
bool ok = db->changeKdf(kdf);
|
||||
|
||||
if (!ok) {
|
||||
err << QObject::tr("error while setting database key derivation settings.") << endl;
|
||||
err << QObject::tr("error while setting database key derivation settings.") << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
}
|
||||
@@ -165,7 +166,7 @@ int DatabaseCreate::execute(const QStringList& arguments)
|
||||
|
||||
const QString& databaseFilename = args.at(0);
|
||||
if (QFileInfo::exists(databaseFilename)) {
|
||||
err << QObject::tr("File %1 already exists.").arg(databaseFilename) << endl;
|
||||
err << QObject::tr("File %1 already exists.").arg(databaseFilename) << Qt::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -176,10 +177,10 @@ int DatabaseCreate::execute(const QStringList& arguments)
|
||||
|
||||
QString errorMessage;
|
||||
if (!db->saveAs(databaseFilename, Database::Atomic, {}, &errorMessage)) {
|
||||
err << QObject::tr("Failed to save the database: %1.").arg(errorMessage) << endl;
|
||||
err << QObject::tr("Failed to save the database: %1.").arg(errorMessage) << Qt::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
out << QObject::tr("Successfully created new database.") << endl;
|
||||
out << QObject::tr("Successfully created new database.") << Qt::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in new issue
Block a user