File indexing completed on 2024-05-12 16:27:40

0001 /*
0002    SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "whatsnewmessagewidget.h"
0008 #include "whatsnewdialog.h"
0009 #include <KLocalizedString>
0010 
0011 WhatsNewMessageWidget::WhatsNewMessageWidget(QWidget *parent)
0012     : KMessageWidget(parent)
0013 {
0014     setVisible(false);
0015     setCloseButtonVisible(true);
0016     setMessageType(Information);
0017     setText(i18n("What's new in Ruqola. %1", QStringLiteral("<a href=\"show_whats_new\">%1</a>").arg(i18n("(Show News in Ruqola)"))));
0018 #if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
0019     setPosition(KMessageWidget::Header);
0020 #endif
0021     connect(this, &KMessageWidget::linkActivated, this, &WhatsNewMessageWidget::slotLinkActivated);
0022 }
0023 
0024 WhatsNewMessageWidget::~WhatsNewMessageWidget() = default;
0025 
0026 void WhatsNewMessageWidget::slotLinkActivated(const QString &contents)
0027 {
0028     if (contents == QLatin1String("show_whats_new")) {
0029         WhatsNewDialog dlg(this);
0030         dlg.updateInformations();
0031         dlg.exec();
0032     }
0033 }
0034 
0035 #include "moc_whatsnewmessagewidget.cpp"