Messagelib

messageviewersettings.cpp
1/*
2 This file is part of KMail.
3
4 SPDX-FileCopyrightText: 2005 David Faure <faure@kde.org>
5
6 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
7*/
8
9#include "messageviewersettings.h"
10#include <QTimer>
11
12using namespace MessageViewer;
13
14MessageViewerSettings *MessageViewerSettings::mSelf = nullptr;
15
16MessageViewerSettings *MessageViewerSettings::self()
17{
18 if (!mSelf) {
19 mSelf = new MessageViewerSettings();
20 mSelf->load();
21 }
22
23 return mSelf;
24}
25
26MessageViewerSettings::MessageViewerSettings()
27{
28 mConfigSyncTimer = new QTimer(this);
29 mConfigSyncTimer->setSingleShot(true);
30 connect(mConfigSyncTimer, &QTimer::timeout, this, &MessageViewerSettings::slotSyncNow);
31}
32
34{
35 if (!mConfigSyncTimer->isActive()) {
36 mConfigSyncTimer->start(0);
37 }
38}
39
40void MessageViewerSettings::slotSyncNow()
41{
42 config()->sync();
43}
44
45MessageViewerSettings::~MessageViewerSettings() = default;
46
47#include "moc_messageviewersettings.cpp"
The MessageViewerSettings class.
void requestSync()
Call this slot instead of directly KConfig::sync() to minimize the overall config writes.
bool isActive() const const
void setSingleShot(bool singleShot)
void start(int msec)
void timeout()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:37:31 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.