summaryrefslogtreecommitdiffabout
path: root/microkde
Unidiff
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/factory.cpp10
-rw-r--r--microkde/kresources/resource.cpp3
2 files changed, 7 insertions, 6 deletions
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp
index 56b0ef3..827ec38 100644
--- a/microkde/kresources/factory.cpp
+++ b/microkde/kresources/factory.cpp
@@ -31,25 +31,25 @@
31#include <qfile.h> 31#include <qfile.h>
32 32
33#include "resource.h" 33#include "resource.h"
34#include "factory.h" 34#include "factory.h"
35 35
36using namespace KRES; 36using namespace KRES;
37 37
38QDict<Factory> *Factory::mSelves = 0; 38QDict<Factory> *Factory::mSelves = 0;
39static KStaticDeleter< QDict<Factory> > staticDeleter; 39static KStaticDeleter< QDict<Factory> > staticDeleter;
40 40
41Factory *Factory::self( const QString& resourceFamily ) 41Factory *Factory::self( const QString& resourceFamily )
42{ 42{
43 kdDebug(5650) << "Factory::self()" << endl; 43
44 44
45 Factory *factory = 0; 45 Factory *factory = 0;
46 if ( !mSelves ) 46 if ( !mSelves )
47 { 47 {
48 mSelves = staticDeleter.setObject( new QDict<Factory> ); 48 mSelves = staticDeleter.setObject( new QDict<Factory> );
49 } 49 }
50 50
51 factory = mSelves->find( resourceFamily ); 51 factory = mSelves->find( resourceFamily );
52 52
53 if ( !factory ) { 53 if ( !factory ) {
54 factory = new Factory( resourceFamily ); 54 factory = new Factory( resourceFamily );
55 mSelves->insert( resourceFamily, factory ); 55 mSelves->insert( resourceFamily, factory );
@@ -70,37 +70,37 @@ Factory::Factory( const QString& resourceFamily ) :
70 KTrader::OfferList::ConstIterator it; 70 KTrader::OfferList::ConstIterator it;
71 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 71 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
72 QVariant type = (*it)->property( "X-KDE-ResourceType" ); 72 QVariant type = (*it)->property( "X-KDE-ResourceType" );
73 if ( !type.toString().isEmpty() ) 73 if ( !type.toString().isEmpty() )
74 mTypeMap.insert( type.toString(), *it ); 74 mTypeMap.insert( type.toString(), *it );
75 } 75 }
76*/ 76*/
77 77
78//US new 78//US new
79 PluginInfo* info = new PluginInfo; 79 PluginInfo* info = new PluginInfo;
80 info->library = "microkabc_file"; 80 info->library = "microkabc_file";
81 info->nameLabel = i18n( "file" ); 81 info->nameLabel = i18n( "file" );
82 info->descriptionLabel = i18n( "No description available." ); 82 info->descriptionLabel = i18n( "Choose one file" );
83 mTypeMap.insert( "file", info ); 83 mTypeMap.insert( "file", info );
84 84
85 info = new PluginInfo; 85 info = new PluginInfo;
86 info->library = "microkabc_dir"; 86 info->library = "microkabc_dir";
87 info->nameLabel = i18n( "dir" ); 87 info->nameLabel = i18n( "dir" );
88 info->descriptionLabel = i18n( "No description available." ); 88 info->descriptionLabel = i18n( "Choose a directory with may files" );
89 mTypeMap.insert( "dir", info ); 89 mTypeMap.insert( "dir", info );
90 90
91 info = new PluginInfo; 91 info = new PluginInfo;
92 info->library = "microkabc_ldap"; 92 info->library = "microkabc_ldap";
93 info->nameLabel = i18n( "ldap" ); 93 info->nameLabel = i18n( "ldap" );
94 info->descriptionLabel = i18n( "No description available." ); 94 info->descriptionLabel = i18n( "No description available" );
95 mTypeMap.insert( "ldap", info ); 95 mTypeMap.insert( "ldap", info );
96 96
97 //US add opie plugin only, if the library exists 97 //US add opie plugin only, if the library exists
98 QString libname = "microkabc_opie"; 98 QString libname = "microkabc_opie";
99 QString path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); 99 QString path = KLibLoader::findLibrary( QFile::encodeName( libname ) );
100 if ( !path.isEmpty() ) 100 if ( !path.isEmpty() )
101 { 101 {
102 info = new PluginInfo; 102 info = new PluginInfo;
103 info->library = libname; 103 info->library = libname;
104 info->nameLabel = i18n( "opie" ); 104 info->nameLabel = i18n( "opie" );
105 info->descriptionLabel = i18n( "Opie PIM Addressbook." ); 105 info->descriptionLabel = i18n( "Opie PIM Addressbook." );
106 mTypeMap.insert( "opie", info ); 106 mTypeMap.insert( "opie", info );
@@ -191,25 +191,25 @@ QString Factory::typeDescription( const QString &type ) const
191{ 191{
192 if ( type.isEmpty() || !mTypeMap.contains( type ) ) 192 if ( type.isEmpty() || !mTypeMap.contains( type ) )
193 return QString(); 193 return QString();
194 194
195//US KService::Ptr ptr = mTypeMap[ type ]; 195//US KService::Ptr ptr = mTypeMap[ type ];
196//US return ptr->comment(); 196//US return ptr->comment();
197 PluginInfo* pi = mTypeMap[ type ]; 197 PluginInfo* pi = mTypeMap[ type ];
198 return pi->descriptionLabel; 198 return pi->descriptionLabel;
199} 199}
200 200
201Resource *Factory::resource( const QString& type, const KConfig *config ) 201Resource *Factory::resource( const QString& type, const KConfig *config )
202{ 202{
203 kdDebug() << "Factory::resource( " << type << ", config)" << endl; 203
204 204
205 if ( type.isEmpty() || !mTypeMap.contains( type ) ) 205 if ( type.isEmpty() || !mTypeMap.contains( type ) )
206 return 0; 206 return 0;
207 207
208/*US load the lib not dynamicly. !! 208/*US load the lib not dynamicly. !!
209 KService::Ptr ptr = mTypeMap[ type ]; 209 KService::Ptr ptr = mTypeMap[ type ];
210 KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); 210 KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() );
211 if ( !factory ) { 211 if ( !factory ) {
212 kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; 212 kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl;
213 return 0; 213 return 0;
214 } 214 }
215*/ 215*/
diff --git a/microkde/kresources/resource.cpp b/microkde/kresources/resource.cpp
index 169eaa4..7827a67 100644
--- a/microkde/kresources/resource.cpp
+++ b/microkde/kresources/resource.cpp
@@ -66,25 +66,25 @@ Resource::Resource( const KConfig* config )
66 d->mIdentifier = KApplication::randomString( 10 ); 66 d->mIdentifier = KApplication::randomString( 10 );
67 } 67 }
68} 68}
69 69
70Resource::~Resource() 70Resource::~Resource()
71{ 71{
72 delete d; 72 delete d;
73 d = 0; 73 d = 0;
74} 74}
75 75
76void Resource::writeConfig( KConfig* config ) 76void Resource::writeConfig( KConfig* config )
77{ 77{
78 kdDebug(5650) << "Resource::writeConfig()" << endl; 78
79 79
80 config->writeEntry( "ResourceType", d->mType ); 80 config->writeEntry( "ResourceType", d->mType );
81 config->writeEntry( "ResourceName", d->mName ); 81 config->writeEntry( "ResourceName", d->mName );
82 config->writeEntry( "ResourceIsReadOnly", d->mReadOnly ); 82 config->writeEntry( "ResourceIsReadOnly", d->mReadOnly );
83 config->writeEntry( "ResourceIsActive", d->mActive ); 83 config->writeEntry( "ResourceIsActive", d->mActive );
84 config->writeEntry( "ResourceIdentifier", d->mIdentifier ); 84 config->writeEntry( "ResourceIdentifier", d->mIdentifier );
85} 85}
86 86
87bool Resource::open() 87bool Resource::open()
88{ 88{
89 d->mIsOpen = true; 89 d->mIsOpen = true;
90#ifdef QT_THREAD_SUPPORT 90#ifdef QT_THREAD_SUPPORT
@@ -165,21 +165,22 @@ QString Resource::resourceName() const
165void Resource::setActive( bool value ) 165void Resource::setActive( bool value )
166{ 166{
167 d->mActive = value; 167 d->mActive = value;
168} 168}
169 169
170bool Resource::isActive() const 170bool Resource::isActive() const
171{ 171{
172 return d->mActive; 172 return d->mActive;
173} 173}
174 174
175void Resource::dump() const 175void Resource::dump() const
176{ 176{
177 qDebug("Resource::dump() ");
177 kdDebug(5650) << "Resource:" << endl; 178 kdDebug(5650) << "Resource:" << endl;
178 kdDebug(5650) << " Name: " << d->mName << endl; 179 kdDebug(5650) << " Name: " << d->mName << endl;
179 kdDebug(5650) << " Identifier: " << d->mIdentifier << endl; 180 kdDebug(5650) << " Identifier: " << d->mIdentifier << endl;
180 kdDebug(5650) << " Type: " << d->mType << endl; 181 kdDebug(5650) << " Type: " << d->mType << endl;
181 kdDebug(5650) << " OpenCount: " << d->mOpenCount << endl; 182 kdDebug(5650) << " OpenCount: " << d->mOpenCount << endl;
182 kdDebug(5650) << " ReadOnly: " << ( d->mReadOnly ? "yes" : "no" ) << endl; 183 kdDebug(5650) << " ReadOnly: " << ( d->mReadOnly ? "yes" : "no" ) << endl;
183 kdDebug(5650) << " Active: " << ( d->mActive ? "yes" : "no" ) << endl; 184 kdDebug(5650) << " Active: " << ( d->mActive ? "yes" : "no" ) << endl;
184 kdDebug(5650) << " IsOpen: " << ( d->mIsOpen ? "yes" : "no" ) << endl; 185 kdDebug(5650) << " IsOpen: " << ( d->mIsOpen ? "yes" : "no" ) << endl;
185} 186}