mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-13 00:36:00 -04:00
Implement review feedback
This commit is contained in:
parent
bea31f9bcc
commit
0ca7fd369a
14 changed files with 59 additions and 65 deletions
|
@ -76,7 +76,7 @@ int Remove::removeEntry(Database* database, const QString& databasePath, const Q
|
|||
QTextStream out(Utils::STDOUT, QIODevice::WriteOnly);
|
||||
QTextStream err(Utils::STDERR, QIODevice::WriteOnly);
|
||||
|
||||
Entry* entry = database->rootGroup()->findEntryByPath(entryPath);
|
||||
QPointer<Entry> entry = database->rootGroup()->findEntryByPath(entryPath);
|
||||
if (!entry) {
|
||||
err << QObject::tr("Entry %1 not found.").arg(entryPath) << endl;
|
||||
return EXIT_FAILURE;
|
||||
|
@ -84,7 +84,8 @@ int Remove::removeEntry(Database* database, const QString& databasePath, const Q
|
|||
|
||||
QString entryTitle = entry->title();
|
||||
bool recycled = true;
|
||||
if (Tools::hasChild(database->metadata()->recycleBin(), entry) || !database->metadata()->recycleBinEnabled()) {
|
||||
auto* recycleBin = database->metadata()->recycleBin();
|
||||
if (!database->metadata()->recycleBinEnabled() || (recycleBin && recycleBin->findEntryByUuid(entry->uuid()))) {
|
||||
delete entry;
|
||||
recycled = false;
|
||||
} else {
|
||||
|
|
|
@ -72,6 +72,8 @@ void setStdinEcho(bool enable = true)
|
|||
#endif
|
||||
}
|
||||
|
||||
namespace Test
|
||||
{
|
||||
QStringList nextPasswords = {};
|
||||
|
||||
/**
|
||||
|
@ -85,6 +87,7 @@ void setNextPassword(const QString& password)
|
|||
{
|
||||
nextPasswords.append(password);
|
||||
}
|
||||
} // namespace Test
|
||||
|
||||
/**
|
||||
* Read a user password from STDIN or return a password previously
|
||||
|
@ -97,8 +100,8 @@ QString getPassword()
|
|||
QTextStream out(STDOUT, QIODevice::WriteOnly);
|
||||
|
||||
// return preset password if one is set
|
||||
if (!nextPasswords.isEmpty()) {
|
||||
auto password = nextPasswords.takeFirst();
|
||||
if (!Test::nextPasswords.isEmpty()) {
|
||||
auto password = Test::nextPasswords.takeFirst();
|
||||
// simulate user entering newline
|
||||
out << endl;
|
||||
return password;
|
||||
|
|
|
@ -29,8 +29,12 @@ extern FILE* STDIN;
|
|||
|
||||
void setStdinEcho(bool enable);
|
||||
QString getPassword();
|
||||
void setNextPassword(const QString& password);
|
||||
int clipText(const QString& text);
|
||||
|
||||
namespace Test
|
||||
{
|
||||
void setNextPassword(const QString& password);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // KEEPASSXC_UTILS_H
|
||||
|
|
|
@ -40,7 +40,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
QCoreApplication app(argc, argv);
|
||||
QCoreApplication::setApplicationVersion(KEEPASSX_VERSION);
|
||||
QCoreApplication::setApplicationVersion(KEEPASSXC_VERSION);
|
||||
|
||||
#ifdef QT_NO_DEBUG
|
||||
Bootstrap::bootstrapApplication();
|
||||
|
@ -72,7 +72,7 @@ int main(int argc, char** argv)
|
|||
if (parser.positionalArguments().empty()) {
|
||||
if (parser.isSet("version")) {
|
||||
// Switch to parser.showVersion() when available (QT 5.4).
|
||||
out << KEEPASSX_VERSION << endl;
|
||||
out << KEEPASSXC_VERSION << endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
parser.showHelp();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue