Messagelib

tablockedwarning.cpp
1/*
2 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5
6*/
7
8#include "tablockedwarning.h"
9#include <KLocalizedString>
10using namespace MessageList::Core;
11TabLockedWarning::TabLockedWarning(QWidget *parent)
12 : KMessageWidget(parent)
13{
14 setCloseButtonVisible(false);
15 setMessageType(Warning);
16 setWordWrap(true);
17 setText(QStringLiteral("%1 <a href=\"unlock\">%2</a>").arg(i18n("Current Tab is locked."), i18n("(Unlock it)")));
18 setVisible(false);
19 setPosition(KMessageWidget::Header);
20 connect(this, &TabLockedWarning::linkActivated, this, &TabLockedWarning::slotLinkActivated);
21}
22
23TabLockedWarning::~TabLockedWarning() = default;
24
25void TabLockedWarning::slotLinkActivated(const QString &contents)
26{
27 if (contents == QLatin1StringView("unlock")) {
28 Q_EMIT unlockTabRequested();
29 }
30}
31
32#include "moc_tablockedwarning.cpp"
QString i18n(const char *text, const TYPE &arg...)
The implementation independent part of the MessageList library.
Definition aggregation.h:22
Q_EMITQ_EMIT
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:12:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.