mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-12 17:16:43 -04:00
Improve handling of remote sync saving
* Fixes sporadic failures on gui tests on Windows * Corrects inability to write to temporary config file while running tests * Corrects errors when using MockRemoteProcess due to missing functions
This commit is contained in:
parent
33a3796074
commit
8779721f92
@ -624,11 +624,13 @@ void Config::createTempFileInstance()
|
|||||||
if (m_instance) {
|
if (m_instance) {
|
||||||
delete m_instance;
|
delete m_instance;
|
||||||
}
|
}
|
||||||
auto* tmpFile = new QTemporaryFile();
|
auto tmpFileName = QString("%1/%2_settings.XXXXXX").arg(QDir::tempPath(), QCoreApplication::applicationName());
|
||||||
bool openResult = tmpFile->open();
|
auto tmpFile = new QTemporaryFile(tmpFileName);
|
||||||
Q_ASSERT(openResult);
|
if (!tmpFile->open()) {
|
||||||
Q_UNUSED(openResult);
|
Q_ASSERT_X(false, __func__, "Failed to create temporary config settings file");
|
||||||
m_instance = new Config(tmpFile->fileName(), "", qApp);
|
}
|
||||||
|
tmpFile->close();
|
||||||
|
m_instance = new Config(tmpFileName, "", qApp);
|
||||||
tmpFile->setParent(m_instance);
|
tmpFile->setParent(m_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1426,7 +1426,7 @@ bool DatabaseWidget::syncWithDatabase(const QSharedPointer<Database>& otherDb, Q
|
|||||||
|
|
||||||
if (!changeList.isEmpty()) {
|
if (!changeList.isEmpty()) {
|
||||||
// Save synced databases
|
// Save synced databases
|
||||||
if (!m_db->save(Database::Atomic, {}, &error)) {
|
if (!save()) {
|
||||||
error = tr("Error while saving database %1: %2").arg(m_db->filePath(), error);
|
error = tr("Error while saving database %1: %2").arg(m_db->filePath(), error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ void MockRemoteProcess::start(const QString&)
|
|||||||
|
|
||||||
qint64 MockRemoteProcess::write(const QString& data)
|
qint64 MockRemoteProcess::write(const QString& data)
|
||||||
{
|
{
|
||||||
|
m_data.append(data.toUtf8());
|
||||||
return data.length();
|
return data.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,3 +55,13 @@ int MockRemoteProcess::exitCode() const
|
|||||||
{
|
{
|
||||||
return 0; // always return success
|
return 0; // always return success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString MockRemoteProcess::readOutput()
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
QString MockRemoteProcess::readError()
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
@ -32,6 +32,8 @@ public:
|
|||||||
void closeWriteChannel() override;
|
void closeWriteChannel() override;
|
||||||
bool waitForFinished(int msecs) override;
|
bool waitForFinished(int msecs) override;
|
||||||
[[nodiscard]] int exitCode() const override;
|
[[nodiscard]] int exitCode() const override;
|
||||||
|
virtual QString readOutput() override;
|
||||||
|
virtual QString readError() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QByteArray m_data;
|
QByteArray m_data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user