Commit efafd9dd authored by Ivan Čukić's avatar Ivan Čukić 👁
Browse files

Making the error message when opening the vault more prominent

BUG:390998
parent eadb8c06
......@@ -24,13 +24,25 @@
#include <QStyle>
#include <QStyleOption>
#include <KMessageWidget>
MountDialog::MountDialog(PlasmaVault::Vault *vault, const std::function<void()> &function)
: m_vault(vault),
m_function(function)
{
m_ui.setupUi(this);
m_ui.errorLabel->setVisible(false);
m_errorLabel = new KMessageWidget(this);
m_errorLabel->setMessageType(KMessageWidget::Error);
m_errorLabel->setCloseButtonVisible(false);
m_errorLabel->setIcon(QIcon::fromTheme("dialog-error"));
m_errorLabel->setVisible(false);
auto errorLabelSizePolicy = m_errorLabel->sizePolicy();
errorLabelSizePolicy.setHorizontalPolicy(QSizePolicy::Expanding);
m_errorLabel->setSizePolicy(errorLabelSizePolicy);
m_errorLabel->setVisible(false);
m_ui.formLayout->addRow(QString(), m_errorLabel);
m_ui.vaultName->setText(vault->name());
QStyleOption option;
......@@ -42,6 +54,7 @@ MountDialog::MountDialog(PlasmaVault::Vault *vault, const std::function<void()>
void MountDialog::accept()
{
setCursor(Qt::WaitCursor);
m_errorLabel->setVisible(false);
setEnabled(false);
m_ui.password->lineEdit()->setCursor(Qt::WaitCursor);
......@@ -59,7 +72,7 @@ void MountDialog::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_ui.errorLabel->setText(i18n("Failed to open: %1", result.error().message()));
m_ui.errorLabel->setVisible(true);
m_errorLabel->setText(i18n("Failed to open: %1", result.error().message()));
m_errorLabel->setVisible(true);
}
}
......@@ -25,6 +25,8 @@
#include "ui_mountdialog.h"
class KMessageWidget;
namespace PlasmaVault {
class Vault;
}
......@@ -41,6 +43,7 @@ private:
PlasmaVault::Vault *m_vault;
std::function<void()> m_function;
Ui_MountDialog m_ui;
KMessageWidget* m_errorLabel;
};
#endif
......@@ -14,7 +14,8 @@
<string>Plasma Vault</string>
</property>
<property name="windowIcon">
<iconset theme="plasmavault"/>
<iconset theme="plasmavault">
<normaloff>.</normaloff>.</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
......@@ -22,6 +23,22 @@
<property name="horizontalSpacing">
<number>16</number>
</property>
<item row="1" column="0">
<widget class="QLabel" name="icon">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
......@@ -86,23 +103,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="icon">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="3" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -115,16 +116,6 @@
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QLabel" name="errorLabel">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
......
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