File indexing completed on 2024-12-15 04:54:36

0001 /*
0002   SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: LGPL-2.0-or-later
0005 
0006 */
0007 
0008 #include "tablockedwarning.h"
0009 #include <KLocalizedString>
0010 using namespace MessageList::Core;
0011 TabLockedWarning::TabLockedWarning(QWidget *parent)
0012     : KMessageWidget(parent)
0013 {
0014     setCloseButtonVisible(false);
0015     setMessageType(Warning);
0016     setWordWrap(true);
0017     setText(QStringLiteral("%1 <a href=\"unlock\">%2</a>").arg(i18n("Current Tab is locked."), i18n("(Unlock it)")));
0018     setVisible(false);
0019     setPosition(KMessageWidget::Header);
0020     connect(this, &TabLockedWarning::linkActivated, this, &TabLockedWarning::slotLinkActivated);
0021 }
0022 
0023 TabLockedWarning::~TabLockedWarning() = default;
0024 
0025 void TabLockedWarning::slotLinkActivated(const QString &contents)
0026 {
0027     if (contents == QLatin1StringView("unlock")) {
0028         Q_EMIT unlockTabRequested();
0029     }
0030 }
0031 
0032 #include "moc_tablockedwarning.cpp"