diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts
index 6bb5ae88d..36de355aa 100644
--- a/share/translations/keepassxc_en.ts
+++ b/share/translations/keepassxc_en.ts
@@ -2372,6 +2372,14 @@ The command has to exit. In case of `sftp` as last command `exit` has to be sent
+
+ Timeout:
+
+
+
+ seconds
+
+
DatabaseTabWidget
diff --git a/src/gui/remote/DatabaseSettingsWidgetRemote.cpp b/src/gui/remote/DatabaseSettingsWidgetRemote.cpp
index e6ed0a486..f66edba7e 100644
--- a/src/gui/remote/DatabaseSettingsWidgetRemote.cpp
+++ b/src/gui/remote/DatabaseSettingsWidgetRemote.cpp
@@ -46,8 +46,10 @@ DatabaseSettingsWidgetRemote::DatabaseSettingsWidgetRemote(QWidget* parent)
connect(m_ui->nameLineEdit, &QLineEdit::textChanged, setModified);
connect(m_ui->downloadCommand, &QLineEdit::textChanged, setModified);
connect(m_ui->inputForDownload, &QPlainTextEdit::textChanged, setModified);
+ connect(m_ui->downloadTimeoutSec, QOverload::of(&QSpinBox::valueChanged), setModified);
connect(m_ui->uploadCommand, &QLineEdit::textChanged, setModified);
connect(m_ui->inputForUpload, &QPlainTextEdit::textChanged, setModified);
+ connect(m_ui->uploadTimeoutSec, QOverload::of(&QSpinBox::valueChanged), setModified);
}
DatabaseSettingsWidgetRemote::~DatabaseSettingsWidgetRemote() = default;
@@ -100,8 +102,10 @@ void DatabaseSettingsWidgetRemote::saveCurrentSettings()
params->name = m_ui->nameLineEdit->text();
params->downloadCommand = m_ui->downloadCommand->text();
params->downloadInput = m_ui->inputForDownload->toPlainText();
+ params->downloadTimeoutMsec = m_ui->downloadTimeoutSec->value() * 1000;
params->uploadCommand = m_ui->uploadCommand->text();
params->uploadInput = m_ui->inputForUpload->toPlainText();
+ params->uploadTimeoutMsec = m_ui->uploadTimeoutSec->value() * 1000;
m_remoteSettings->addRemoteParams(params);
updateSettingsList();
@@ -145,8 +149,10 @@ void DatabaseSettingsWidgetRemote::editCurrentSettings()
m_ui->nameLineEdit->setText(params->name);
m_ui->downloadCommand->setText(params->downloadCommand);
m_ui->inputForDownload->setPlainText(params->downloadInput);
+ m_ui->downloadTimeoutSec->setValue(params->downloadTimeoutMsec / 1000);
m_ui->uploadCommand->setText(params->uploadCommand);
m_ui->inputForUpload->setPlainText(params->uploadInput);
+ m_ui->uploadTimeoutSec->setValue(params->uploadTimeoutMsec / 1000);
m_modified = false;
}
@@ -165,8 +171,10 @@ void DatabaseSettingsWidgetRemote::clearFields()
m_ui->nameLineEdit->setText("");
m_ui->downloadCommand->setText("");
m_ui->inputForDownload->setPlainText("");
+ m_ui->downloadTimeoutSec->setValue(10);
m_ui->uploadCommand->setText("");
m_ui->inputForUpload->setPlainText("");
+ m_ui->uploadTimeoutSec->setValue(10);
m_modified = false;
}
@@ -176,6 +184,7 @@ void DatabaseSettingsWidgetRemote::testDownload()
params->name = m_ui->nameLineEdit->text();
params->downloadCommand = m_ui->downloadCommand->text();
params->downloadInput = m_ui->inputForDownload->toPlainText();
+ params->downloadTimeoutMsec = m_ui->downloadTimeoutSec->value() * 1000;
QScopedPointer remoteHandler(new RemoteHandler(this));
if (params->downloadCommand.isEmpty()) {
@@ -197,4 +206,4 @@ void DatabaseSettingsWidgetRemote::testDownload()
}
m_ui->messageWidget->showMessage(tr("Download successful."), MessageWidget::Positive);
-}
\ No newline at end of file
+}
diff --git a/src/gui/remote/DatabaseSettingsWidgetRemote.ui b/src/gui/remote/DatabaseSettingsWidgetRemote.ui
index a5e7126ea..1ab5d8b8f 100644
--- a/src/gui/remote/DatabaseSettingsWidgetRemote.ui
+++ b/src/gui/remote/DatabaseSettingsWidgetRemote.ui
@@ -132,6 +132,16 @@
Download
+ -
+
+
+ Input:
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+
-
@@ -139,6 +149,22 @@
+ -
+
+
+ Download input field
+
+
+ e.g.:
+get DatabaseOnRemote.kdbx {TEMP_DATABASE}
+exit
+---
+{TEMP_DATABASE} is used as placeholder to store the database in a temporary location
+The command has to exit. In case of `sftp` as last command `exit` has to be sent
+
+
+
+
-
-
@@ -160,29 +186,26 @@
- -
-
+
-
+
- Input:
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+ Timeout:
- -
-
-
- Download input field
+
-
+
+
+ seconds
-
- e.g.:
-get DatabaseOnRemote.kdbx {TEMP_DATABASE}
-exit
----
-{TEMP_DATABASE} is used as placeholder to store the database in a temporary location
-The command has to exit. In case of `sftp` as last command `exit` has to be sent
-
+
+ 1
+
+
+ 300
+
+
+ 10
@@ -193,33 +216,6 @@ The command has to exit. In case of `sftp` as last command `exit` has to be sent
Upload
- -
-
-
- Input:
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
-
- -
-
-
- Command:
-
-
-
- -
-
-
- Upload command field
-
-
- e.g.: "sftp user@hostname" or "scp {TEMP_DATABASE} user@hostname:DatabaseOnRemote.kdbx"
-
-
-
-
@@ -236,6 +232,56 @@ The command has to exit. In case of `sftp` as last command `exit` has to be sent
+ -
+
+
+ Input:
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+
+ -
+
+
+ Upload command field
+
+
+ e.g.: "sftp user@hostname" or "scp {TEMP_DATABASE} user@hostname:DatabaseOnRemote.kdbx"
+
+
+
+ -
+
+
+ Command:
+
+
+
+ -
+
+
+ Timeout:
+
+
+
+ -
+
+
+ seconds
+
+
+ 1
+
+
+ 300
+
+
+ 10
+
+
+
diff --git a/src/gui/remote/RemoteHandler.cpp b/src/gui/remote/RemoteHandler.cpp
index 66f2d2d25..c3bb857dd 100644
--- a/src/gui/remote/RemoteHandler.cpp
+++ b/src/gui/remote/RemoteHandler.cpp
@@ -67,7 +67,7 @@ RemoteHandler::RemoteResult RemoteHandler::download(const RemoteParams* params)
remoteProcess->closeWriteChannel();
}
- bool finished = remoteProcess->waitForFinished(10000);
+ bool finished = remoteProcess->waitForFinished(params->downloadTimeoutMsec);
int statusCode = remoteProcess->exitCode();
// TODO: For future use
@@ -118,7 +118,7 @@ RemoteHandler::RemoteResult RemoteHandler::upload(const QString& filePath, const
remoteProcess->closeWriteChannel();
}
- bool finished = remoteProcess->waitForFinished(10000);
+ bool finished = remoteProcess->waitForFinished(params->uploadTimeoutMsec);
int statusCode = remoteProcess->exitCode();
// TODO: For future use
diff --git a/src/gui/remote/RemoteSettings.cpp b/src/gui/remote/RemoteSettings.cpp
index cc7437de5..f5af3b1e1 100644
--- a/src/gui/remote/RemoteSettings.cpp
+++ b/src/gui/remote/RemoteSettings.cpp
@@ -89,8 +89,10 @@ QString RemoteSettings::toConfig() const
object["name"] = params->name;
object["downloadCommand"] = params->downloadCommand;
object["downloadCommandInput"] = params->downloadInput;
+ object["downloadTimeoutMsec"] = params->downloadTimeoutMsec;
object["uploadCommand"] = params->uploadCommand;
object["uploadCommandInput"] = params->uploadInput;
+ object["uploadTimeoutMsec"] = params->uploadTimeoutMsec;
config << object;
}
QJsonDocument doc(config);
@@ -108,8 +110,10 @@ void RemoteSettings::fromConfig(const QString& data)
params->name = itemMap["name"].toString();
params->downloadCommand = itemMap["downloadCommand"].toString();
params->downloadInput = itemMap["downloadCommandInput"].toString();
+ params->downloadTimeoutMsec = itemMap.value("downloadTimeoutMsec", 10000).toInt();
params->uploadCommand = itemMap["uploadCommand"].toString();
params->uploadInput = itemMap["uploadCommandInput"].toString();
+ params->uploadTimeoutMsec = itemMap.value("uploadTimeoutMsec", 10000).toInt();
m_remoteParams.insert(params->name, params);
}
diff --git a/src/gui/remote/RemoteSettings.h b/src/gui/remote/RemoteSettings.h
index 4ddd6e341..4b414494c 100644
--- a/src/gui/remote/RemoteSettings.h
+++ b/src/gui/remote/RemoteSettings.h
@@ -28,8 +28,10 @@ struct RemoteParams
QString name;
QString downloadCommand;
QString downloadInput;
+ int downloadTimeoutMsec;
QString uploadCommand;
QString uploadInput;
+ int uploadTimeoutMsec;
};
Q_DECLARE_METATYPE(RemoteParams)