Commit 32dff5c1 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

[sendfile] Show error from send operation to the user

If the sending fails for whatever reason we say it has failed, but don't show any details, leaving the user wondering what's wrong

Not that dumping a technical error message to the user is great UX, but not showing it is worse IMO

This way the user can at least paste it into Google and maybe get something helpful or show a screenshot in a bug report
parent e37c7b32
Pipeline #113993 passed with stage
in 55 seconds
......@@ -65,6 +65,7 @@ void ConnectingPage::createSessionFinished(BluezQt::PendingCall *call)
{
if (call->error()) {
qCWarning(BLUEDEVIL_SENDFILE_LOG) << "Error creating session" << call->errorText();
m_wizard->setErrorMessage(call->errorText());
m_wizard->next();
return;
}
......
......@@ -38,8 +38,8 @@ void FailPage::initializePage()
BluezQt::DevicePtr device = m_wizard->device();
if (device->name().isEmpty()) {
failLbl->setText(i18nc("This string is shown when the wizard fail", "The connection to the device has failed"));
failLbl->setText(i18nc("This string is shown when the wizard fail", "The connection to the device has failed: %1", m_wizard->errorMessage()));
} else {
failLbl->setText(i18n("The connection to %1 has failed", device->name()));
failLbl->setText(i18n("The connection to %1 has failed: %2", device->name(), m_wizard->errorMessage()));
}
}
......@@ -163,3 +163,13 @@ void SendFileWizard::initJobResult(BluezQt::InitManagerJob *job)
// Only show wizard after init is completed
show();
}
QString SendFileWizard::errorMessage() const
{
return m_errorMessage;
}
void SendFileWizard::setErrorMessage(const QString &message)
{
m_errorMessage = message;
}
......@@ -40,6 +40,9 @@ public:
BluezQt::DevicePtr device() const;
void setDevice(BluezQt::DevicePtr device);
QString errorMessage() const;
void setErrorMessage(const QString &message);
void startTransfer(const QDBusObjectPath &session);
private Q_SLOTS:
......@@ -48,6 +51,7 @@ private Q_SLOTS:
private:
const QString m_deviceUrl;
QStringList m_files;
QString m_errorMessage;
BluezQt::Manager *m_manager = nullptr;
BluezQt::DevicePtr m_device;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment