Pimcommon

broadcaststatus.cpp
1/*
2 broadcaststatus.cpp
3
4 This file is part of libkdepim.
5
6 Author: Don Sanders <sanders@kde.org>
7
8 SPDX-FileCopyrightText: 2000 Don Sanders <sanders@kde.org>
9
10 SPDX-License-Identifier: GPL-2.0-or-later
11*/
12
13#include "broadcaststatus.h"
14#include <QCoreApplication>
15
16static PimCommon::BroadcastStatus *instance_;
17
18static void deleteGlobalStaticBroadcastStatus()
19{
20 delete instance_;
21 instance_ = nullptr;
22}
23
24namespace PimCommon
25{
26BroadcastStatus *BroadcastStatus::instance()
27{
28 if (!instance_) {
29 instance_ = new BroadcastStatus();
30 qAddPostRoutine(deleteGlobalStaticBroadcastStatus);
31 }
32 return instance_;
33}
34
35class BroadcastStatusPrivate
36{
37public:
38 BroadcastStatusPrivate() = default;
39
40 QString mStatusMsg;
41 bool mTransientActive = false;
42};
43
44BroadcastStatus::BroadcastStatus()
45 : d(new PimCommon::BroadcastStatusPrivate)
46{
47}
48
49BroadcastStatus::~BroadcastStatus()
50{
51 instance_ = nullptr;
52}
53
54void BroadcastStatus::setStatusMsg(const QString &message)
55{
56 d->mStatusMsg = message;
57 if (!d->mTransientActive) {
58 Q_EMIT statusMsg(message);
59 }
60}
61
62void BroadcastStatus::setTransientStatusMsg(const QString &msg)
63{
64 d->mTransientActive = true;
65 Q_EMIT statusMsg(msg);
66}
67
68void BroadcastStatus::reset()
69{
70 d->mTransientActive = false;
71 // restore
72 Q_EMIT statusMsg(d->mStatusMsg);
73}
74}
75
76#include "moc_broadcaststatus.cpp"
folderdialogacltab.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:02:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.