File indexing completed on 2024-04-21 14:55:07
0001 /* This file is part of the KDE project 0002 Copyright (C) 2007 Matthias Kretz <kretz@kde.org> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License version 2 as published by the Free Software Foundation. 0007 0008 This library is distributed in the hope that it will be useful, 0009 but WITHOUT ANY WARRANTY; without even the implied warranty of 0010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0011 Library General Public License for more details. 0012 0013 You should have received a copy of the GNU Library General Public License 0014 along with this library; see the file COPYING.LIB. If not, write to 0015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0016 Boston, MA 02110-1301, USA. 0017 0018 */ 0019 0020 #include <QCoreApplication> 0021 #include <QtGlobal> 0022 #include <kcomponentdata.h> 0023 #include <ksharedconfig.h> 0024 #include <kconfiggroup.h> 0025 0026 int main(int argc, char **argv) 0027 { 0028 QCoreApplication app(argc, argv); 0029 0030 { 0031 KComponentData componentData("globalcleanuptest"); 0032 // letting componentData go out of scope here simulates the behaviour of KCmdLineArgs 0033 } 0034 KSharedConfigPtr cfg = KSharedConfig::openConfig(); 0035 KConfigGroup group = cfg->group("test"); 0036 group.writeEntry("test", 1); 0037 0038 KComponentData componentData2("globalcleanuptest2"); 0039 cfg = componentData2.config(); 0040 group = cfg->group("test"); 0041 group.writeEntry("test", 1); 0042 0043 qrand(); // make sure the global static that kills us is accessed 0044 }