File indexing completed on 2024-12-22 04:28:07
0001 /* 0002 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "textautocorrectionsettings.h" 0008 #include <QTimer> 0009 0010 using namespace TextAutoCorrectionCore; 0011 0012 TextAutoCorrectionSettings *TextAutoCorrectionSettings::mSelf = nullptr; 0013 0014 TextAutoCorrectionSettings *TextAutoCorrectionSettings::self() 0015 { 0016 if (!mSelf) { 0017 mSelf = new TextAutoCorrectionSettings(); 0018 mSelf->load(); 0019 } 0020 0021 return mSelf; 0022 } 0023 0024 TextAutoCorrectionSettings::TextAutoCorrectionSettings() 0025 { 0026 mConfigSyncTimer = new QTimer(this); 0027 mConfigSyncTimer->setSingleShot(true); 0028 connect(mConfigSyncTimer, &QTimer::timeout, this, &TextAutoCorrectionSettings::slotSyncNow); 0029 } 0030 0031 TextAutoCorrectionSettings::~TextAutoCorrectionSettings() = default; 0032 0033 void TextAutoCorrectionSettings::requestSync() 0034 { 0035 if (!mConfigSyncTimer->isActive()) { 0036 mConfigSyncTimer->start(0); 0037 } 0038 } 0039 0040 void TextAutoCorrectionSettings::slotSyncNow() 0041 { 0042 config()->sync(); 0043 } 0044 0045 #include "moc_textautocorrectionsettings.cpp"