diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts index f974db170..d3c4bef77 100644 --- a/share/translations/keepassxc_en.ts +++ b/share/translations/keepassxc_en.ts @@ -4920,6 +4920,14 @@ The command has to exit. In case of `sftp` as last commend `exit` has to be sent Remote Database (.kdbx) + + Timeout: + + + + seconds + + KMessageWidget diff --git a/src/gui/remote/RemoteProcess.cpp b/src/gui/remote/RemoteProcess.cpp index 6b2f60717..5dd8ede78 100644 --- a/src/gui/remote/RemoteProcess.cpp +++ b/src/gui/remote/RemoteProcess.cpp @@ -17,7 +17,6 @@ #include "RemoteProcess.h" -#include #include RemoteProcess::RemoteProcess(QObject* parent) diff --git a/src/gui/wizard/ImportWizardPageReview.cpp b/src/gui/wizard/ImportWizardPageReview.cpp index 3c894e261..fb31bc74b 100644 --- a/src/gui/wizard/ImportWizardPageReview.cpp +++ b/src/gui/wizard/ImportWizardPageReview.cpp @@ -92,6 +92,7 @@ void ImportWizardPageReview::initializePage() case ImportWizard::IMPORT_REMOTE: m_db = importRemote(field("DownloadCommand").toString(), field("DownloadInput").toString(), + field("DownloadTimeoutSec").toInt(), field("ImportPassword").toString(), field("ImportKeyFile").toString()); break; @@ -243,17 +244,20 @@ bool ImportWizardPageReview::isCsvImport() const QSharedPointer ImportWizardPageReview::importRemote(const QString& downloadCommand, const QString& downloadInput, + int downloadTimeoutSec, const QString& password, const QString& keyfile) { auto* params = new RemoteParams(); params->downloadCommand = downloadCommand; params->downloadInput = downloadInput; + params->downloadTimeoutMsec = downloadTimeoutSec * 1000; auto result = m_remoteHandler->download(params); if (!result.success) { m_ui->messageWidget->showMessage(result.errorMessage, KMessageWidget::Error, -1); + return {}; } auto key = QSharedPointer::create(); diff --git a/src/gui/wizard/ImportWizardPageReview.h b/src/gui/wizard/ImportWizardPageReview.h index 17f85a1a5..d1c010fbb 100644 --- a/src/gui/wizard/ImportWizardPageReview.h +++ b/src/gui/wizard/ImportWizardPageReview.h @@ -58,6 +58,7 @@ private: QSharedPointer importProtonPass(const QString& filename); QSharedPointer importRemote(const QString& downloadCommand, const QString& downloadInput, + int downloadTimeSec, const QString& password, const QString& keyfile); diff --git a/src/gui/wizard/ImportWizardPageSelect.cpp b/src/gui/wizard/ImportWizardPageSelect.cpp index ba5f28521..f008c24dd 100644 --- a/src/gui/wizard/ImportWizardPageSelect.cpp +++ b/src/gui/wizard/ImportWizardPageSelect.cpp @@ -76,6 +76,7 @@ ImportWizardPageSelect::ImportWizardPageSelect(QWidget* parent) registerField("ImportKeyFile", m_ui->keyFileEdit); registerField("DownloadCommand", m_ui->downloadCommand); registerField("DownloadInput", m_ui->downloadCommandInput, "plainText", "textChanged"); + registerField("DownloadTimeoutSec", m_ui->downloadTimeoutSec); } ImportWizardPageSelect::~ImportWizardPageSelect() @@ -274,6 +275,8 @@ void ImportWizardPageSelect::setDownloadCommand(bool downloadCommandEnabled) m_ui->downloadCommandInputLabel->setVisible(downloadCommandEnabled); m_ui->downloadCommandInput->setVisible(downloadCommandEnabled); m_ui->downloadCommandHelpButton->setVisible(downloadCommandEnabled); + m_ui->downloadTimeoutLabel->setVisible(downloadCommandEnabled); + m_ui->downloadTimeoutSec->setVisible(downloadCommandEnabled); m_ui->temporaryDatabaseRadio->setVisible(downloadCommandEnabled); diff --git a/src/gui/wizard/ImportWizardPageSelect.ui b/src/gui/wizard/ImportWizardPageSelect.ui index ca37fec71..ce871ef76 100644 --- a/src/gui/wizard/ImportWizardPageSelect.ui +++ b/src/gui/wizard/ImportWizardPageSelect.ui @@ -94,14 +94,14 @@ QLayout::SetMinimumSize - + Import File: - + @@ -115,24 +115,24 @@ - + Password: - + - + Key File: - + @@ -146,7 +146,7 @@ - + Qt::Vertical @@ -162,7 +162,7 @@ - + Import Into: @@ -172,7 +172,7 @@ - + @@ -297,6 +297,29 @@ The command has to exit. In case of `sftp` as last commend `exit` has to be sent + + + + Timeout: + + + + + + + seconds + + + 1 + + + 300 + + + 10 + + +