Pimcommon

whatsnewmessagewidget.cpp
1/*
2 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "whatsnewmessagewidget.h"
8
9#include "whatsnewdialog.h"
10#include <KLocalizedString>
11#include <QCoreApplication>
12
13using namespace Qt::Literals::StringLiterals;
14using namespace PimCommon;
15WhatsNewMessageWidget::WhatsNewMessageWidget(QWidget *parent)
16 : KMessageWidget(parent)
17{
18 setVisible(false);
19 setCloseButtonVisible(true);
20 setMessageType(Information);
21 setText(i18n("What's new in %2. %1", QStringLiteral("<a href=\"show_whats_new\">%1</a>").arg(i18n("(Show News)")), QCoreApplication::applicationName()));
22 setPosition(KMessageWidget::Header);
23 connect(this, &KMessageWidget::linkActivated, this, &WhatsNewMessageWidget::slotLinkActivated);
24}
25
26WhatsNewMessageWidget::~WhatsNewMessageWidget() = default;
27
28void WhatsNewMessageWidget::slotLinkActivated(const QString &contents)
29{
30 if (contents == "show_whats_new"_L1) {
31 WhatsNewDialog dlg(mWhatsNewInfos, this);
32 dlg.updateInformations();
33 dlg.exec();
34 }
35}
36
37void WhatsNewMessageWidget::setWhatsNewInfos(const QList<PimCommon::WhatsNewInfo> &infos)
38{
39 mWhatsNewInfos = infos;
40}
41
42#include "moc_whatsnewmessagewidget.cpp"
void linkActivated(const QString &contents)
QString i18n(const char *text, const TYPE &arg...)
folderdialogacltab.h
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 Mon Nov 4 2024 16:39:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.