File indexing completed on 2025-01-05 04:53:58

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-only
0007 */
0008 
0009 #include "settings/kmailsettings.h"
0010 #include <QTimer>
0011 
0012 KMailSettings *KMailSettings::mSelf = nullptr;
0013 
0014 KMailSettings *KMailSettings::self()
0015 {
0016     if (!mSelf) {
0017         mSelf = new KMailSettings();
0018         mSelf->load();
0019     }
0020 
0021     return mSelf;
0022 }
0023 
0024 KMailSettings::KMailSettings()
0025     : mConfigSyncTimer(new QTimer(this))
0026 {
0027     mConfigSyncTimer->setSingleShot(true);
0028     connect(mConfigSyncTimer, &QTimer::timeout, this, &KMailSettings::slotSyncNow);
0029 }
0030 
0031 void KMailSettings::requestSync()
0032 {
0033     if (!mConfigSyncTimer->isActive()) {
0034         mConfigSyncTimer->start(0);
0035     }
0036 }
0037 
0038 void KMailSettings::slotSyncNow()
0039 {
0040     config()->sync();
0041 }
0042 
0043 KMailSettings::~KMailSettings() = default;
0044 
0045 #include "moc_kmailsettings.cpp"