Messagelib

messagecomposersettings.cpp
1 /*
2  This file is part of KMail.
3 
4  SPDX-FileCopyrightText: 2005 David Faure <[email protected]>
5 
6  SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
7 */
8 
9 #include "messagecomposersettings.h"
10 #include <QTimer>
11 
12 using namespace MessageComposer;
13 
14 MessageComposerSettings *MessageComposerSettings::mSelf = nullptr;
15 
16 MessageComposerSettings *MessageComposerSettings::self()
17 {
18  if (!mSelf) {
19  mSelf = new MessageComposerSettings();
20  mSelf->load();
21  }
22 
23  return mSelf;
24 }
25 
26 MessageComposerSettings::MessageComposerSettings()
27 {
28  mConfigSyncTimer = new QTimer(this);
29  mConfigSyncTimer->setSingleShot(true);
30  connect(mConfigSyncTimer, &QTimer::timeout, this, &MessageComposerSettings::slotSyncNow);
31 }
32 
34 {
35  if (!mConfigSyncTimer->isActive()) {
36  mConfigSyncTimer->start(0);
37  }
38 }
39 
40 void MessageComposerSettings::slotSyncNow()
41 {
42  config()->sync();
43 }
44 
45 MessageComposerSettings::~MessageComposerSettings() = default;
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
bool isActive() const const
void setSingleShot(bool singleShot)
The MessageComposerSettings class.
void start(int msec)
void timeout()
void requestSync()
Call this slot instead of directly KConfig::sync() to minimize the overall config writes.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Mar 26 2023 04:08:11 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.