author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kdecore/kconfigbase.h | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'microkde/kdecore/kconfigbase.h') (more/less context) (show whitespace changes)
-rw-r--r-- | microkde/kdecore/kconfigbase.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/microkde/kdecore/kconfigbase.h b/microkde/kdecore/kconfigbase.h index 7e56d11..1ef6a04 100644 --- a/microkde/kdecore/kconfigbase.h +++ b/microkde/kdecore/kconfigbase.h @@ -1,102 +1,104 @@ /* 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> Copyright (c) 2001 Waldo Bastian <bastian@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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // $Id$ #ifndef _KCONFIGBASE_H #define _KCONFIGBASE_H #include "kconfig.h" +//Added by qt3to4: +#include <Q3CString> /** * Helper class to facilitate working with @ref KConfig / @ref KSimpleConfig * groups. * * Careful programmers always set the group of a * @ref KConfig @ref KSimpleConfig object to the group they want to read from * and set it back to the old one of afterwards. This is usually * written as: * <pre> * * QString oldgroup config->group(); * config->setGroup( "TheGroupThatIWant" ); * ... * config->writeEntry( "Blah", "Blubb" ); * * config->setGroup( oldgroup ); * </pre> * * In order to facilitate this task, you can use * KConfigGroupSaver. Simply construct such an object ON THE STACK * when you want to switch to a new group. Then, when the object goes * out of scope, the group will automatically be restored. If you * want to use several different groups within a function or method, * you can still use KConfigGroupSaver: Simply enclose all work with * one group (including the creation of the KConfigGroupSaver object) * in one block. * * @author Matthias Kalle Dalheimer <kalle@kde.org> * @version $Id$ * @see KConfigBase, KConfig, KSimpleConfig * @short Helper class for easier use of KConfig/KSimpleConfig groups */ //US I converted the class in a way that it can be used with KConfig objects of microkde class KConfigGroupSaver { public: /** * Constructor. You pass a pointer to the KConfigBase-derived * object you want to work with and a string indicating the _new_ * group. * * @param config The KConfigBase-derived object this * KConfigGroupSaver works on. * @param group The new group that the config object should switch to. */ KConfigGroupSaver( KConfig* config, QString group ) /* KDE 4 : make the second parameter const QString & */ : _config(config), _oldgroup(config->group()) { _config->setGroup( group ); } KConfigGroupSaver( KConfig* config, const char *group ) : _config(config), _oldgroup(config->group()) { _config->setGroup( group ); } - KConfigGroupSaver( KConfig* config, const QCString &group ) + KConfigGroupSaver( KConfig* config, const Q3CString &group ) : _config(config), _oldgroup(config->group()) { _config->setGroup( group ); } ~KConfigGroupSaver() { _config->setGroup( _oldgroup ); } KConfig* config() { return _config; }; private: KConfig* _config; QString _oldgroup; KConfigGroupSaver(const KConfigGroupSaver&); KConfigGroupSaver& operator=(const KConfigGroupSaver&); }; #endif |