kitchensync

pluckerconfig.cpp

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2004 Holger Hans Peter Freyther <freyther@kde.org>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include "pluckerconfig.h"
00022 
00023 
00024 #include <kconfig.h>
00025 #include <kstandarddirs.h>
00026 #include <kdebug.h>
00027 
00028 static KStaticDeleter<KSPlucker::PluckerConfig> s_deleter;
00029 
00030 namespace KSPlucker {
00031 
00032 static PluckerConfig *s_config;
00033 
00034 PluckerConfig::PluckerConfig()
00035 {}
00036 
00037 PluckerConfig::~PluckerConfig()
00038 {}
00039 
00040 PluckerConfig* PluckerConfig::self()
00041 {
00042   if ( !s_config )
00043     s_deleter.setObject(s_config, new PluckerConfig() );
00044 
00045   return s_config;
00046 }
00047 
00048 QStringList PluckerConfig::pluckerFiles()const
00049 {
00050   return m_paths;
00051 }
00052 
00053 QString     PluckerConfig::javaPath()const
00054 {
00055   return m_javaPath;
00056 }
00057 
00058 QString     PluckerConfig::pluckerPath()const
00059 {
00060   return m_pluckerPath;
00061 }
00062 
00063 QStringList PluckerConfig::konnectorIds()const
00064 {
00065   return m_konnectors;
00066 }
00067 
00068 void PluckerConfig::setPluckerFiles( const QStringList& path )
00069 {
00070   m_paths = path;
00071 }
00072 
00073 void PluckerConfig::setJavaPath( const QString& java)
00074 {
00075   m_javaPath = java;
00076 }
00077 
00078 void PluckerConfig::setPluckerPath( const QString& pl)
00079 {
00080   m_pluckerPath = pl;
00081 }
00082 
00083 void PluckerConfig::setKonnectorIds( const QStringList& lst )
00084 {
00085   m_konnectors = lst;
00086 }
00087 
00088 void PluckerConfig::load(const QString& profileUid)
00089 {
00090   KConfig config( locateLocal( "appdata", "plucker_config" ) );
00091   config.setGroup( profileUid );
00092 
00093   m_paths        = config.readPathListEntry( "PluckerFiles" );
00094   m_pluckerPath  = config.readPathEntry( "PluckerPath" );
00095   m_javaPath     = config.readPathEntry( "JavaPath" );
00096   m_konnectors   = config.readListEntry( "KonnectorIds" );
00097 
00098   kdDebug() << "Konnectors " << m_konnectors << " " << config.readEntry( "KonnectorsIds" ) << endl;
00099 }
00100 
00101 void PluckerConfig::save(const QString& profileUid)
00102 {
00103   KConfig config( locateLocal( "appdata", "plucker_config" ) );
00104   config.setGroup( profileUid );
00105 
00106   config.writePathEntry( "PluckerFiles", m_paths );
00107   config.writePathEntry( "PluckerPath",  m_pluckerPath );
00108   config.writePathEntry( "JavaPath",     m_javaPath );
00109   config.writeEntry( "KonnectorIds",     m_konnectors );
00110 }
00111 
00112 
00113 }
KDE Home | KDE Accessibility Home | Description of Access Keys