mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-12-05 08:12:35 -08:00
- Append the script's stderr (fallback stdout, capped at 500 chars) to download/upload error messages so the actual failure reason is visible (e.g. 'NAS share not connected: /Volumes/...'). - Sync error messages now stay visible until closed instead of auto-hiding, so the detail can actually be read. - Do not attempt an upload after a failed download (previously an upload with an empty temp path was attempted, masking the real download error). - Tests: MockRemoteProcess gains configurable exit code/error output; new TestGui::testRemoteSyncErrorDetail. --------- Co-authored-by: moritzthecat <[email protected]> Co-authored-by: droidmonkey <[email protected]>
72 lines
1.6 KiB
C++
72 lines
1.6 KiB
C++
/*
|
|
* Copyright (C) 2023 KeePassXC Team <[email protected]>
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 2 or (at your option)
|
|
* version 3 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <QFile>
|
|
|
|
#include "MockRemoteProcess.h"
|
|
|
|
MockRemoteProcess::MockRemoteProcess(QObject* parent, QString dbPath, int exitCode, QString errorOutput)
|
|
: RemoteProcess(parent)
|
|
, m_dbPath(std::move(dbPath))
|
|
, m_exitCode(exitCode)
|
|
, m_errorOutput(std::move(errorOutput))
|
|
{
|
|
}
|
|
|
|
void MockRemoteProcess::start(const QString&)
|
|
{
|
|
if (m_exitCode == 0) {
|
|
QFile::copy(m_dbPath, m_tempFileLocation);
|
|
}
|
|
}
|
|
|
|
qint64 MockRemoteProcess::write(const QString& data)
|
|
{
|
|
m_data.append(data.toUtf8());
|
|
return data.length();
|
|
}
|
|
|
|
bool MockRemoteProcess::waitForBytesWritten()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
void MockRemoteProcess::closeWriteChannel()
|
|
{
|
|
// nothing to do
|
|
}
|
|
|
|
bool MockRemoteProcess::waitForFinished(int)
|
|
{
|
|
return true; // no need to wait
|
|
}
|
|
|
|
int MockRemoteProcess::exitCode() const
|
|
{
|
|
return m_exitCode;
|
|
}
|
|
|
|
QString MockRemoteProcess::readOutput()
|
|
{
|
|
return {};
|
|
}
|
|
|
|
QString MockRemoteProcess::readError()
|
|
{
|
|
return m_errorOutput;
|
|
}
|