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 #pragma once
10 
11 #include "globalsettings_messageviewer.h"
12 
13 class QTimer;
14 
15 namespace MessageViewer
16 {
17 /**
18  * @brief The MessageViewerSettings class
19  */
20 class MESSAGEVIEWER_EXPORT MessageViewerSettings : public MessageViewer::MessageViewerSettingsBase
21 {
22     Q_OBJECT
23 public:
24     static MessageViewerSettings *self();
25 
26     /** Call this slot instead of directly KConfig::sync() to
27         minimize the overall config writes. Calling this slot will
28         schedule a sync of the application config file using a timer, so
29         that many consecutive calls can be condensed into a single
30         sync, which is more efficient. */
31     void requestSync();
32 
33 private Q_SLOTS:
34     void slotSyncNow();
35 
36 private:
37     MessageViewerSettings();
38     ~MessageViewerSettings() override;
39     static MessageViewerSettings *mSelf;
40 
41     QTimer *mConfigSyncTimer = nullptr;
42 };
43 }
44 
45