summaryrefslogtreecommitdiffstats
path: root/tdecore/tdesimpleconfig.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2025-07-11 14:14:04 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2025-07-12 17:55:25 +0900
commit1e1cb981d39c663091ce0089f3ed66b5db2238da (patch)
tree7ecbebcd7bcb70770dc4613424acbe17b034b01f /tdecore/tdesimpleconfig.cpp
parent2e76346c68e5c1db6b6058014c024bb70fec5e34 (diff)
downloadtdelibs-1e1cb981d39c663091ce0089f3ed66b5db2238da.tar.gz
tdelibs-1e1cb981d39c663091ce0089f3ed66b5db2238da.zip
Rename ksimpleconfig.{h,cpp} to tdesimpleconfig.{h.cpp}.
Add temporary ksimpleconfig.h to keep things building. This is a change of API/ABI. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'tdecore/tdesimpleconfig.cpp')
-rw-r--r--tdecore/tdesimpleconfig.cpp81
1 files changed, 81 insertions, 0 deletions
diff --git a/tdecore/tdesimpleconfig.cpp b/tdecore/tdesimpleconfig.cpp
new file mode 100644
index 000000000..15638dd65
--- /dev/null
+++ b/tdecore/tdesimpleconfig.cpp
@@ -0,0 +1,81 @@
+/* This file is part of the KDE libraries
+ Copyright (c) 1999 Preston Brown <pbrown@kde.org>
+ Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+// $Id$
+
+#include <config.h>
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <tqfileinfo.h>
+#include <tqdir.h>
+
+#include "tdeglobal.h"
+#include "tdestandarddirs.h"
+#include "tdeconfigbackend.h"
+
+#include "tdesimpleconfig.h"
+
+TDESimpleConfig::TDESimpleConfig(const TQString &fileName, bool bReadOnly)
+ : TDEConfig(TQString::fromLatin1(""), bReadOnly, false)
+{
+ // the difference between TDEConfig and TDESimpleConfig is just that
+ // for TDESimpleConfig an absolute filename is guaranteed
+ if (!fileName.isNull() && TQDir::isRelativePath(fileName)) {
+ backEnd->changeFileName( TDEGlobal::dirs()->
+ saveLocation("config", TQString::null, !bReadOnly)+fileName, "config", false);
+ } else {
+ backEnd->changeFileName(fileName, "config", false);
+ }
+ setReadOnly( bReadOnly );
+ reparseConfiguration();
+}
+
+TDESimpleConfig::TDESimpleConfig(TDEConfigBackEnd *backEnd, bool bReadOnly)
+ : TDEConfig(backEnd, bReadOnly)
+{}
+
+TDESimpleConfig::~TDESimpleConfig()
+{
+ // we need to call the TDESimpleConfig version of sync. Relying on the
+ // regular TDEConfig sync is bad, because the TDESimpleConfig sync has
+ // different behavior. Syncing here will insure that the sync() call
+ // in the TDEConfig destructor doesn't actually do anything.
+ sync();
+}
+
+void TDESimpleConfig::sync()
+{
+ if (isReadOnly())
+ return;
+ backEnd->sync(false);
+
+ if (isDirty())
+ rollback();
+}
+
+void TDESimpleConfig::virtual_hook( int id, void* data )
+{ TDEConfig::virtual_hook( id, data ); }
+
+#include "tdesimpleconfig.moc"