File indexing completed on 2024-06-23 05:18:37

0001 /*
0002     This file is part of KMail.
0003 
0004     SPDX-FileCopyrightText: 2005 David Faure <faure@kde.org>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0007 */
0008 
0009 #pragma once
0010 
0011 #include "messagecomposer_export.h"
0012 #include "messagecomposersettings_base.h"
0013 
0014 class QTimer;
0015 
0016 namespace MessageComposer
0017 {
0018 /**
0019  * @brief The MessageComposerSettings class
0020  */
0021 class MESSAGECOMPOSER_EXPORT MessageComposerSettings : public MessageComposer::MessageComposerSettingsBase
0022 {
0023     Q_OBJECT
0024 public:
0025     static MessageComposerSettings *self();
0026 
0027     /** Call this slot instead of directly @ref KConfig::sync() to
0028       minimize the overall config writes. Calling this slot will
0029       schedule a sync of the application config file using a timer, so
0030       that many consecutive calls can be condensed into a single
0031       sync, which is more efficient. */
0032     void requestSync();
0033 
0034 private Q_SLOTS:
0035     void slotSyncNow();
0036 
0037 private:
0038     MessageComposerSettings();
0039     ~MessageComposerSettings() override;
0040     static MessageComposerSettings *mSelf;
0041 
0042     QTimer *mConfigSyncTimer = nullptr;
0043 };
0044 }