diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,8 @@
.ycm_extra_conf.py
.ycm_extra_conf.pyc
.clang_complete
+.clangd
+.ccls-cache
kactivities.kdev4
compile_commands.json
/apidocs
diff --git a/kded/engine/backends/cryfs/cryfsbackend.cpp b/kded/engine/backends/cryfs/cryfsbackend.cpp
--- a/kded/engine/backends/cryfs/cryfsbackend.cpp
+++ b/kded/engine/backends/cryfs/cryfsbackend.cpp
@@ -193,7 +193,8 @@
// otherwise just report that we failed
Result<>::error(Error::CommandError,
- i18n("Unable to perform the operation (error code %1).", QString::number((int)exitCode)));
+ i18n("Unable to perform the operation (error code %1).", QString::number((int)exitCode)),
+ out, err);
});
diff --git a/kded/engine/commandresult.h b/kded/engine/commandresult.h
--- a/kded/engine/commandresult.h
+++ b/kded/engine/commandresult.h
@@ -35,17 +35,22 @@
DeviceError,
BackendError,
CommandError,
- DeletionError
+ DeletionError,
+ UnknownError
};
- Error(Code code, const QString &message = QString());
+ Error(Code code = UnknownError, const QString &message = {}, const QString &out = {}, const QString &err = {});
Code code() const;
QString message() const;
+ QString out() const;
+ QString err() const;
private:
Code m_code;
QString m_message;
+ QString m_out;
+ QString m_err;
};
@@ -59,10 +64,10 @@
inline
-FutureResult<> errorResult(Error::Code error, const QString &message)
+FutureResult<> errorResult(Error::Code error, const QString &message, const QString &out = {}, const QString &err = {})
{
qWarning() << message;
- return makeReadyFuture(Result<>::error(error, message));
+ return makeReadyFuture(Result<>::error(error, message, out, err));
}
diff --git a/kded/engine/commandresult.cpp b/kded/engine/commandresult.cpp
--- a/kded/engine/commandresult.cpp
+++ b/kded/engine/commandresult.cpp
@@ -22,9 +22,11 @@
namespace PlasmaVault {
-Error::Error(Code code, const QString &message)
+Error::Error(Code code, const QString &message, const QString &out, const QString &err)
: m_code(code)
, m_message(message)
+ , m_out(out)
+ , m_err(err)
{
}
@@ -38,5 +40,15 @@
return m_message;
}
+QString Error::out() const
+{
+ return m_out;
+}
+
+QString Error::err() const
+{
+ return m_err;
+}
+
} // namespace PlasmaVault
diff --git a/kded/engine/fusebackend_p.cpp b/kded/engine/fusebackend_p.cpp
--- a/kded/engine/fusebackend_p.cpp
+++ b/kded/engine/fusebackend_p.cpp
@@ -66,7 +66,8 @@
// otherwise just report that we failed
Result<>::error(Error::CommandError,
- i18n("Unable to perform the operation"));
+ i18n("Unable to perform the operation"),
+ out, err);
}
diff --git a/kded/ui/mountdialog.h b/kded/ui/mountdialog.h
--- a/kded/ui/mountdialog.h
+++ b/kded/ui/mountdialog.h
@@ -25,7 +25,10 @@
#include "ui_mountdialog.h"
+#include "engine/vault.h"
+
class KMessageWidget;
+class QAction;
namespace PlasmaVault {
class Vault;
@@ -43,6 +46,8 @@
PlasmaVault::Vault *m_vault;
Ui_MountDialog m_ui;
KMessageWidget* m_errorLabel;
+ QAction* m_detailsAction;
+ PlasmaVault::Error m_lastError;
};
#endif
diff --git a/kded/ui/mountdialog.cpp b/kded/ui/mountdialog.cpp
--- a/kded/ui/mountdialog.cpp
+++ b/kded/ui/mountdialog.cpp
@@ -18,11 +18,12 @@
* along with this program. If not, see .
*/
#include "mountdialog.h"
-#include "engine/vault.h"
#include
#include
#include
+#include
+#include
#include
@@ -37,6 +38,28 @@
m_errorLabel->setIcon(QIcon::fromTheme("dialog-error"));
m_errorLabel->setVisible(false);
+ m_detailsAction = new QAction(this);
+ m_detailsAction->setToolTip(i18n("Details..."));
+ m_detailsAction->setIcon(QIcon::fromTheme("view-list-details"));
+
+ connect(m_detailsAction, &QAction::triggered,
+ this, [this] {
+ QString message;
+ const auto out = m_lastError.out().trimmed();
+ const auto err = m_lastError.err().trimmed();
+
+ if (!out.isEmpty() && !err.isEmpty()) {
+ message = i18n("Command output:\n%1\n\nError output: %2", m_lastError.out(), m_lastError.err());
+ } else {
+ message = out + err;
+ }
+
+ auto messageBox = new QMessageBox(QMessageBox::Critical, i18n("Error details"), message, QMessageBox::Ok, this);
+ messageBox->setAttribute(Qt::WA_DeleteOnClose);
+ messageBox->show();
+
+ });
+
auto errorLabelSizePolicy = m_errorLabel->sizePolicy();
errorLabelSizePolicy.setHorizontalPolicy(QSizePolicy::Expanding);
m_errorLabel->setSizePolicy(errorLabelSizePolicy);
@@ -68,9 +91,17 @@
if (result) {
QDialog::accept();
} else {
- qDebug() << "We've got an error" << result.error().message();
- // m_ui.errorLabel->setText(i18n("Failed to open: %1").arg(result.error().message()));
- m_errorLabel->setText(i18n("Failed to open: %1", result.error().message()));
+ m_lastError = result.error();
+
+ m_errorLabel->setText(i18n("Failed to open: %1", m_lastError.message()));
m_errorLabel->setVisible(true);
+
+ if (!m_lastError.out().isEmpty() || !m_lastError.err().isEmpty()) {
+ m_errorLabel->addAction(m_detailsAction);
+
+ } else {
+ m_errorLabel->removeAction(m_detailsAction);
+
+ }
}
}