mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-01-03 01:25:48 -05: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:
parent
5bf5b93836
commit
88b76244cf
67 changed files with 341 additions and 240 deletions
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "Utils.h"
|
||||
#include "cli/DatabaseCreate.h"
|
||||
#include "core/Global.h"
|
||||
#include "keys/ChallengeResponseKey.h"
|
||||
#include "keys/FileKey.h"
|
||||
#include "keys/PasswordKey.h"
|
||||
|
|
@ -53,7 +54,7 @@ int DatabaseEdit::executeWithDatabase(QSharedPointer<Database> database, QShared
|
|||
err << QObject::tr("Cannot use %1 and %2 at the same time.")
|
||||
.arg(DatabaseCreate::SetPasswordOption.names().at(0))
|
||||
.arg(DatabaseEdit::UnsetPasswordOption.names().at(0))
|
||||
<< endl;
|
||||
<< Qt::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +62,7 @@ int DatabaseEdit::executeWithDatabase(QSharedPointer<Database> database, QShared
|
|||
err << QObject::tr("Cannot use %1 and %2 at the same time.")
|
||||
.arg(DatabaseCreate::SetKeyFileOption.names().at(0))
|
||||
.arg(DatabaseEdit::UnsetKeyFileOption.names().at(0))
|
||||
<< endl;
|
||||
<< Qt::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +77,7 @@ int DatabaseEdit::executeWithDatabase(QSharedPointer<Database> database, QShared
|
|||
parser->value(DatabaseCreate::SetKeyFileOption),
|
||||
parser->isSet(DatabaseEdit::UnsetKeyFileOption));
|
||||
if (newDatabaseKey.isNull()) {
|
||||
err << QObject::tr("Could not change the database key.") << endl;
|
||||
err << QObject::tr("Could not change the database key.") << Qt::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
database->setKey(newDatabaseKey);
|
||||
|
|
@ -84,17 +85,17 @@ int DatabaseEdit::executeWithDatabase(QSharedPointer<Database> database, QShared
|
|||
}
|
||||
|
||||
if (!databaseWasChanged) {
|
||||
out << QObject::tr("Database was not modified.") << endl;
|
||||
out << QObject::tr("Database was not modified.") << Qt::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
QString errorMessage;
|
||||
if (!database->save(Database::Atomic, {}, &errorMessage)) {
|
||||
err << QObject::tr("Writing the database failed: %1").arg(errorMessage) << endl;
|
||||
err << QObject::tr("Writing the database failed: %1").arg(errorMessage) << Qt::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
out << QObject::tr("Successfully edited the database.") << endl;
|
||||
out << QObject::tr("Successfully edited the database.") << Qt::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -113,19 +114,19 @@ QSharedPointer<CompositeKey> DatabaseEdit::getNewDatabaseKey(QSharedPointer<Data
|
|||
auto currentChallengeResponseKey = database->key()->getChallengeResponseKey(ChallengeResponseKey::UUID);
|
||||
|
||||
if (removePassword && currentPasswordKey.isNull()) {
|
||||
err << QObject::tr("Cannot remove password: The database does not have a password.") << endl;
|
||||
err << QObject::tr("Cannot remove password: The database does not have a password.") << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
|
||||
if (removeKeyFile && currentFileKey.isNull()) {
|
||||
err << QObject::tr("Cannot remove file key: The database does not have a file key.") << endl;
|
||||
err << QObject::tr("Cannot remove file key: The database does not have a file key.") << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
|
||||
if (updatePassword) {
|
||||
QSharedPointer<PasswordKey> newPasswordKey = Utils::getConfirmedPassword();
|
||||
if (newPasswordKey.isNull()) {
|
||||
err << QObject::tr("Failed to set database password.") << endl;
|
||||
err << QObject::tr("Failed to set database password.") << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
newDatabaseKey->addKey(newPasswordKey);
|
||||
|
|
@ -137,7 +138,7 @@ QSharedPointer<CompositeKey> DatabaseEdit::getNewDatabaseKey(QSharedPointer<Data
|
|||
QSharedPointer<FileKey> newFileKey = QSharedPointer<FileKey>::create();
|
||||
QString errorMessage;
|
||||
if (!Utils::loadFileKey(newFileKeyPath, newFileKey)) {
|
||||
err << QObject::tr("Loading the new key file failed: %1").arg(errorMessage) << endl;
|
||||
err << QObject::tr("Loading the new key file failed: %1").arg(errorMessage) << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
newDatabaseKey->addKey(newFileKey);
|
||||
|
|
@ -150,13 +151,13 @@ QSharedPointer<CompositeKey> DatabaseEdit::getNewDatabaseKey(QSharedPointer<Data
|
|||
// silently removed from the database.
|
||||
for (const QSharedPointer<Key>& key : database->key()->keys()) {
|
||||
if (key->uuid() != PasswordKey::UUID && key->uuid() != FileKey::UUID) {
|
||||
err << QObject::tr("Found unexpected Key type %1").arg(key->uuid().toString()) << endl;
|
||||
err << QObject::tr("Found unexpected Key type %1").arg(key->uuid().toString()) << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
}
|
||||
for (const QSharedPointer<ChallengeResponseKey>& key : database->key()->challengeResponseKeys()) {
|
||||
if (key->uuid() != ChallengeResponseKey::UUID) {
|
||||
err << QObject::tr("Found unexpected Key type %1").arg(key->uuid().toString()) << endl;
|
||||
err << QObject::tr("Found unexpected Key type %1").arg(key->uuid().toString()) << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
|
@ -166,7 +167,7 @@ QSharedPointer<CompositeKey> DatabaseEdit::getNewDatabaseKey(QSharedPointer<Data
|
|||
}
|
||||
|
||||
if (newDatabaseKey->keys().isEmpty() && newDatabaseKey->challengeResponseKeys().isEmpty()) {
|
||||
err << QObject::tr("Cannot remove all the keys from a database.") << endl;
|
||||
err << QObject::tr("Cannot remove all the keys from a database.") << Qt::endl;
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue