mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-11-27 12:27:04 -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:
1 parent
5bf5b93836
commit
88b76244cf
67 files changed
+341
-240
No files matched your search
+17
-16
@@ -20,6 +20,7 @@
|
||||
#include "core/Database.h"
|
||||
#include "core/Entry.h"
|
||||
#include "core/EntryAttributes.h"
|
||||
#include "core/Global.h"
|
||||
#include "keys/FileKey.h"
|
||||
#ifdef WITH_XC_YUBIKEY
|
||||
#include "keys/ChallengeResponseKey.h"
|
||||
@@ -111,22 +112,22 @@ namespace Utils
|
||||
|
||||
QFileInfo dbFileInfo(databaseFilename);
|
||||
if (dbFileInfo.canonicalFilePath().isEmpty()) {
|
||||
err << QObject::tr("Failed to open database file %1: not found").arg(databaseFilename) << endl;
|
||||
err << QObject::tr("Failed to open database file %1: not found").arg(databaseFilename) << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!dbFileInfo.isFile()) {
|
||||
err << QObject::tr("Failed to open database file %1: not a plain file").arg(databaseFilename) << endl;
|
||||
err << QObject::tr("Failed to open database file %1: not a plain file").arg(databaseFilename) << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!dbFileInfo.isReadable()) {
|
||||
err << QObject::tr("Failed to open database file %1: not readable").arg(databaseFilename) << endl;
|
||||
err << QObject::tr("Failed to open database file %1: not readable").arg(databaseFilename) << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
|
||||
if (isPasswordProtected) {
|
||||
err << QObject::tr("Enter password to unlock %1: ").arg(databaseFilename) << flush;
|
||||
err << QObject::tr("Enter password to unlock %1: ").arg(databaseFilename) << Qt::flush;
|
||||
QString line = Utils::getPassword(quiet);
|
||||
auto passwordKey = QSharedPointer<PasswordKey>::create();
|
||||
passwordKey->setPassword(line);
|
||||
@@ -138,7 +139,7 @@ namespace Utils
|
||||
QString errorMessage;
|
||||
// LCOV_EXCL_START
|
||||
if (!fileKey->load(keyFilename, &errorMessage)) {
|
||||
err << QObject::tr("Failed to load key file %1: %2").arg(keyFilename, errorMessage) << endl;
|
||||
err << QObject::tr("Failed to load key file %1: %2").arg(keyFilename, errorMessage) << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -146,7 +147,7 @@ namespace Utils
|
||||
err << QObject::tr("WARNING: You are using an old key file format which KeePassXC may\n"
|
||||
"stop supporting in the future.\n\n"
|
||||
"Please consider generating a new key file.")
|
||||
<< endl;
|
||||
<< Qt::endl;
|
||||
}
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
@@ -163,20 +164,20 @@ namespace Utils
|
||||
slot = parts[0].toInt(&ok);
|
||||
|
||||
if (!ok || (slot != 1 && slot != 2)) {
|
||||
err << QObject::tr("Invalid YubiKey slot %1").arg(parts[0]) << endl;
|
||||
err << QObject::tr("Invalid YubiKey slot %1").arg(parts[0]) << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
|
||||
if (parts.size() > 1) {
|
||||
serial = parts[1].toUInt(&ok, 10);
|
||||
if (!ok) {
|
||||
err << QObject::tr("Invalid YubiKey serial %1").arg(parts[1]) << endl;
|
||||
err << QObject::tr("Invalid YubiKey serial %1").arg(parts[1]) << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
QObject::connect(YubiKey::instance(), &YubiKey::userInteractionRequest, [&] {
|
||||
err << QObject::tr("Please present or touch your YubiKey to continue.") << "\n\n" << flush;
|
||||
err << QObject::tr("Please present or touch your YubiKey to continue.") << "\n\n" << Qt::flush;
|
||||
});
|
||||
|
||||
auto key = QSharedPointer<ChallengeResponseKey>(new ChallengeResponseKey({serial, slot}));
|
||||
@@ -193,7 +194,7 @@ namespace Utils
|
||||
if (db->open(databaseFilename, compositeKey, &error)) {
|
||||
return db;
|
||||
} else {
|
||||
err << error << endl;
|
||||
err << error << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
}
|
||||
@@ -218,7 +219,7 @@ namespace Utils
|
||||
setStdinEcho(false);
|
||||
QString line = in.readLine();
|
||||
setStdinEcho(true);
|
||||
out << endl;
|
||||
out << Qt::endl;
|
||||
|
||||
return line;
|
||||
#endif // __AFL_COMPILER
|
||||
@@ -248,7 +249,7 @@ namespace Utils
|
||||
if (ans.toLower().startsWith("y")) {
|
||||
passwordKey = QSharedPointer<PasswordKey>::create("");
|
||||
}
|
||||
err << endl;
|
||||
err << Qt::endl;
|
||||
} else {
|
||||
err << QObject::tr("Repeat password: ");
|
||||
err.flush();
|
||||
@@ -257,7 +258,7 @@ namespace Utils
|
||||
if (password == repeat) {
|
||||
passwordKey = QSharedPointer<PasswordKey>::create(password);
|
||||
} else {
|
||||
err << QObject::tr("Error: Passwords do not match.") << endl;
|
||||
err << QObject::tr("Error: Passwords do not match.") << Qt::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +304,7 @@ namespace Utils
|
||||
QScopedPointer<QProcess> clipProcess(new QProcess(nullptr));
|
||||
|
||||
// Skip empty parts, otherwise the program may clip the empty string
|
||||
QStringList progArgs = prog.second.split(" ", QString::SkipEmptyParts);
|
||||
QStringList progArgs = prog.second.split(" ", Qt::SkipEmptyParts);
|
||||
|
||||
clipProcess->start(prog.first, progArgs);
|
||||
clipProcess->waitForStarted();
|
||||
@@ -427,13 +428,13 @@ namespace Utils
|
||||
fileKey->create(path, &error);
|
||||
|
||||
if (!error.isEmpty()) {
|
||||
err << QObject::tr("Creating KeyFile %1 failed: %2").arg(path, error) << endl;
|
||||
err << QObject::tr("Creating KeyFile %1 failed: %2").arg(path, error) << Qt::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fileKey->load(path, &error)) {
|
||||
err << QObject::tr("Loading KeyFile %1 failed: %2").arg(path, error) << endl;
|
||||
err << QObject::tr("Loading KeyFile %1 failed: %2").arg(path, error) << Qt::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user