Commit 0cf461f8 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Don't use button for unlocked it (use url directly)

parent 7d76d821
...@@ -15,13 +15,18 @@ TabLockedWarning::TabLockedWarning(QWidget *parent) ...@@ -15,13 +15,18 @@ TabLockedWarning::TabLockedWarning(QWidget *parent)
setCloseButtonVisible(false); setCloseButtonVisible(false);
setMessageType(Warning); setMessageType(Warning);
setWordWrap(true); setWordWrap(true);
setText(i18n("Current Tab is locked.")); setText(QStringLiteral("%1 <a href=\"unlock\">%2</a>").arg(i18n("Current Tab is locked."), i18n("(Unlock it)")));
setVisible(false); setVisible(false);
auto unlockAction = new QAction(i18n("Unlock"), this); connect(this, &TabLockedWarning::linkActivated, this, &TabLockedWarning::slotLinkActivated);
connect(unlockAction, &QAction::triggered, this, &TabLockedWarning::unlockTabRequested);
addAction(unlockAction);
} }
TabLockedWarning::~TabLockedWarning() TabLockedWarning::~TabLockedWarning()
{ {
} }
void TabLockedWarning::slotLinkActivated(const QString &contents)
{
if (contents == QLatin1String("unlock")) {
Q_EMIT unlockTabRequested();
}
}
...@@ -22,6 +22,9 @@ public: ...@@ -22,6 +22,9 @@ public:
~TabLockedWarning() override; ~TabLockedWarning() override;
Q_SIGNALS: Q_SIGNALS:
void unlockTabRequested(); void unlockTabRequested();
private:
void slotLinkActivated(const QString &contents);
}; };
} }
} }
......
Markdown is supported
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