summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/managerimpl.cpp
authorzautrix <zautrix>2004-10-20 21:49:51 (UTC)
committer zautrix <zautrix>2004-10-20 21:49:51 (UTC)
commitbb235c5a639b914574e1e247d2de6e479517585f (patch) (unidiff)
tree0f074ec87d93b6f5fb81b6893f0174cabc52c1df /microkde/kresources/managerimpl.cpp
parent8e00329a4a5f0b66d26d20f067ab6aefca17f17a (diff)
downloadkdepimpi-bb235c5a639b914574e1e247d2de6e479517585f.zip
kdepimpi-bb235c5a639b914574e1e247d2de6e479517585f.tar.gz
kdepimpi-bb235c5a639b914574e1e247d2de6e479517585f.tar.bz2
qtopia resource fixes
Diffstat (limited to 'microkde/kresources/managerimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kresources/managerimpl.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp
index 81bbbec..5bd9eb7 100644
--- a/microkde/kresources/managerimpl.cpp
+++ b/microkde/kresources/managerimpl.cpp
@@ -13,82 +13,89 @@
13 This library is distributed in the hope that it will be useful, 13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details. 16 Library General Public License for more details.
17 17
18 You should have received a copy of the GNU Library General Public License 18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to 19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. 21 Boston, MA 02111-1307, USA.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32 32
33#include <kapplication.h> 33#include <kapplication.h>
34#include <kdebug.h> 34#include <kdebug.h>
35#include <kconfig.h> 35#include <kconfig.h>
36#include <kstandarddirs.h> 36#include <kstandarddirs.h>
37#include <qfile.h>
37 38
38#include "resource.h" 39#include "resource.h"
39#include "factory.h" 40#include "factory.h"
40#include "managerimpl.h" 41#include "managerimpl.h"
41 42
42using namespace KRES; 43using namespace KRES;
43 44
44ManagerImpl::ManagerImpl( const QString &family ) 45ManagerImpl::ManagerImpl( const QString &family )
45 : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), 46 : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ),
46 mFactory( 0 ) 47 mFactory( 0 )
47 48
48{ 49{
49 kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; 50 kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl;
50 51
51 52
52} 53}
53 54
54ManagerImpl::~ManagerImpl() 55ManagerImpl::~ManagerImpl()
55{ 56{
56 kdDebug(5650) << "ManagerImpl::~ManagerImpl()" << endl; 57 kdDebug(5650) << "ManagerImpl::~ManagerImpl()" << endl;
57 58
58 Resource::List::ConstIterator it; 59 Resource::List::ConstIterator it;
59 for ( it = mResources.begin(); it != mResources.end(); ++it ) { 60 for ( it = mResources.begin(); it != mResources.end(); ++it ) {
60 delete *it; 61 delete *it;
61 } 62 }
62 63
63 delete mStdConfig; 64 delete mStdConfig;
64} 65}
65 66
66void ManagerImpl::createStandardConfig() 67void ManagerImpl::createStandardConfig()
67{ 68{
68 if ( !mStdConfig ) { 69 if ( !mStdConfig ) {
69 QString file = locateLocal( "data", KGlobal::getAppName() 70 QString file = locateLocal( "data", KGlobal::getAppName()
70 + "/kresources/" + mFamily + "rc" ); 71 + "/kresources/" + mFamily + "rc" );
72 if ( mFamily == "tmpcontact" ) {
73 if (QFile::exists ( file ) ){
74 QFile::remove ( file );
75 qDebug("removed tmp rc file: %s ", file.latin1());
76 }
77 }
71 mStdConfig = new KConfig( file ); 78 mStdConfig = new KConfig( file );
72 } 79 }
73 80
74 mConfig = mStdConfig; 81 mConfig = mStdConfig;
75} 82}
76 83
77void ManagerImpl::readConfig( KConfig *cfg ) 84void ManagerImpl::readConfig( KConfig *cfg )
78{ 85{
79 kdDebug(5650) << "ManagerImpl::readConfig()" << endl; 86 kdDebug(5650) << "ManagerImpl::readConfig()" << endl;
80 87
81 delete mFactory; 88 delete mFactory;
82 mFactory = Factory::self( mFamily ); 89 mFactory = Factory::self( mFamily );
83 90
84 if ( !cfg ) { 91 if ( !cfg ) {
85 createStandardConfig(); 92 createStandardConfig();
86 } else { 93 } else {
87 mConfig = cfg; 94 mConfig = cfg;
88 } 95 }
89 96
90 mStandard = 0; 97 mStandard = 0;
91 98
92 mConfig->setGroup( "General" ); 99 mConfig->setGroup( "General" );
93 100
94 QStringList keys = mConfig->readListEntry( "ResourceKeys" ); 101 QStringList keys = mConfig->readListEntry( "ResourceKeys" );