File indexing completed on 2025-03-09 04:54:38
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 "globalsettings_messageviewer.h" 0012 0013 class QTimer; 0014 0015 namespace MessageViewer 0016 { 0017 /** 0018 * @brief The MessageViewerSettings class 0019 */ 0020 class MESSAGEVIEWER_EXPORT MessageViewerSettings : public MessageViewer::MessageViewerSettingsBase 0021 { 0022 Q_OBJECT 0023 public: 0024 static MessageViewerSettings *self(); 0025 0026 /** Call this slot instead of directly KConfig::sync() to 0027 minimize the overall config writes. Calling this slot will 0028 schedule a sync of the application config file using a timer, so 0029 that many consecutive calls can be condensed into a single 0030 sync, which is more efficient. */ 0031 void requestSync(); 0032 0033 private Q_SLOTS: 0034 MESSAGEVIEWER_NO_EXPORT void slotSyncNow(); 0035 0036 private: 0037 MESSAGEVIEWER_NO_EXPORT MessageViewerSettings(); 0038 ~MessageViewerSettings() override; 0039 static MessageViewerSettings *mSelf; 0040 0041 QTimer *mConfigSyncTimer = nullptr; 0042 }; 0043 }