-rw-r--r-- | microkde/kresources/factory.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp index 4843ce0..86b22b2 100644 --- a/microkde/kresources/factory.cpp +++ b/microkde/kresources/factory.cpp | |||
@@ -84,129 +84,129 @@ Factory::Factory( const QString& resourceFamily) : | |||
84 | //US new | 84 | //US new |
85 | PluginInfo* info = new PluginInfo; | 85 | PluginInfo* info = new PluginInfo; |
86 | info->library = "microkabc_file"; | 86 | info->library = "microkabc_file"; |
87 | info->nameLabel = i18n( "file" ); | 87 | info->nameLabel = i18n( "file" ); |
88 | info->descriptionLabel = i18n( "One file" ); | 88 | info->descriptionLabel = i18n( "One file" ); |
89 | mTypeMap.insert( "file", info ); | 89 | mTypeMap.insert( "file", info ); |
90 | 90 | ||
91 | info = new PluginInfo; | 91 | info = new PluginInfo; |
92 | info->library = "microkabc_dir"; | 92 | info->library = "microkabc_dir"; |
93 | info->nameLabel = i18n( "dir" ); | 93 | info->nameLabel = i18n( "dir" ); |
94 | info->descriptionLabel = i18n( "A directory with many files" ); | 94 | info->descriptionLabel = i18n( "A directory with many files" ); |
95 | mTypeMap.insert( "dir", info ); | 95 | mTypeMap.insert( "dir", info ); |
96 | 96 | ||
97 | info = new PluginInfo; | 97 | info = new PluginInfo; |
98 | info->library = "microkabc_ldap"; | 98 | info->library = "microkabc_ldap"; |
99 | info->nameLabel = i18n( "ldap" ); | 99 | info->nameLabel = i18n( "ldap" ); |
100 | info->descriptionLabel = i18n( "Connect to a directory server" ); | 100 | info->descriptionLabel = i18n( "Connect to a directory server" ); |
101 | mTypeMap.insert( "ldap", info ); | 101 | mTypeMap.insert( "ldap", info ); |
102 | 102 | ||
103 | //US add opie plugin only, if the library exists. | 103 | //US add opie plugin only, if the library exists. |
104 | /*US | 104 | /*US |
105 | QString libname = "microkabc_opie"; | 105 | QString libname = "microkabc_opie"; |
106 | QString path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); | 106 | QString path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); |
107 | if ( !path.isEmpty() ) | 107 | if ( !path.isEmpty() ) |
108 | { | 108 | { |
109 | info = new PluginInfo; | 109 | info = new PluginInfo; |
110 | info->library = libname; | 110 | info->library = libname; |
111 | info->nameLabel = i18n( "opie" ); | 111 | info->nameLabel = i18n( "opie" ); |
112 | info->descriptionLabel = i18n( "Opie PIM Addressbook." ); | 112 | info->descriptionLabel = i18n( "Opie PIM Addressbook." ); |
113 | mTypeMap.insert( "opie", info ); | 113 | mTypeMap.insert( "opie", info ); |
114 | } | 114 | } |
115 | */ | 115 | */ |
116 | //US add qtopia plugin only, if the library exists. | 116 | //US add qtopia plugin only, if the library exists. |
117 | QString libname = "microkabc_qtopia"; | 117 | QString libname = "microkabc_qtopia"; |
118 | QString path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); | 118 | QString path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); |
119 | if ( !path.isEmpty() ) | 119 | if ( !path.isEmpty() ) |
120 | { | 120 | { |
121 | info = new PluginInfo; | 121 | info = new PluginInfo; |
122 | info->library = libname; | 122 | info->library = libname; |
123 | info->nameLabel = i18n( "qtopia" ); | 123 | info->nameLabel = i18n( "qtopia" ); |
124 | info->descriptionLabel = i18n( "Qtopia PIM Addressbook." ); | 124 | info->descriptionLabel = i18n( "Qtopia PIM Addressbook." ); |
125 | mTypeMap.insert( "qtopia", info ); | 125 | mTypeMap.insert( "qtopia", info ); |
126 | } | 126 | } |
127 | 127 | ||
128 | //US add sharp plugin only, if the library exists. | 128 | //US add sharp plugin only, if the library exists. |
129 | libname = "microkabc_sharpdtm"; | 129 | libname = "microkabc_sharpdtm"; |
130 | path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); | 130 | path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); |
131 | if ( !path.isEmpty() ) | 131 | if ( !path.isEmpty() ) |
132 | { | 132 | { |
133 | info = new PluginInfo; | 133 | info = new PluginInfo; |
134 | info->library = libname; | 134 | info->library = libname; |
135 | info->nameLabel = i18n( "sharp" ); | 135 | info->nameLabel = i18n( "sharp" ); |
136 | info->descriptionLabel = i18n( "Sharp DTM Addressbook." ); | 136 | info->descriptionLabel = i18n( "Sharp DTM Addressbook." ); |
137 | mTypeMap.insert( "sharp", info ); | 137 | mTypeMap.insert( "sharp", info ); |
138 | } | 138 | } |
139 | 139 | ||
140 | 140 | ||
141 | //LR add ol plugin only, if the library exists. | 141 | //LR add ol plugin only, if the library exists. |
142 | libname = "microkabc_olaccess"; | 142 | libname = "microkabc_olaccess"; |
143 | path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); | 143 | path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); |
144 | if ( !path.isEmpty() ) | 144 | if ( !path.isEmpty() ) |
145 | { | 145 | { |
146 | info = new PluginInfo; | 146 | info = new PluginInfo; |
147 | info->library = libname; | 147 | info->library = libname; |
148 | info->nameLabel = i18n( "sharp" ); | 148 | info->nameLabel = i18n( "olaccess" ); |
149 | info->descriptionLabel = i18n( "Outlook Addressbook." ); | 149 | info->descriptionLabel = i18n( "Outlook Addressbook." ); |
150 | mTypeMap.insert( "olaccess", info ); | 150 | mTypeMap.insert( "olaccess", info ); |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | } | 154 | } |
155 | 155 | ||
156 | Factory::~Factory() | 156 | Factory::~Factory() |
157 | { | 157 | { |
158 | } | 158 | } |
159 | 159 | ||
160 | QStringList Factory::typeNames() const | 160 | QStringList Factory::typeNames() const |
161 | { | 161 | { |
162 | //US method QMap::keys() not available yet. SO collect the data manually | 162 | //US method QMap::keys() not available yet. SO collect the data manually |
163 | //US return mTypeMap.keys(); | 163 | //US return mTypeMap.keys(); |
164 | 164 | ||
165 | QStringList result; | 165 | QStringList result; |
166 | 166 | ||
167 | QMap<QString, PluginInfo*>::ConstIterator it; | 167 | QMap<QString, PluginInfo*>::ConstIterator it; |
168 | for( it = mTypeMap.begin(); it != mTypeMap.end(); ++it ) { | 168 | for( it = mTypeMap.begin(); it != mTypeMap.end(); ++it ) { |
169 | result << it.key().latin1(); | 169 | result << it.key().latin1(); |
170 | // qDebug("Factory::typeNames() : %s ", it.key().latin1()); | 170 | // qDebug("Factory::typeNames() : %s ", it.key().latin1()); |
171 | 171 | ||
172 | } | 172 | } |
173 | return result; | 173 | return result; |
174 | } | 174 | } |
175 | 175 | ||
176 | ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent ) | 176 | ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent ) |
177 | { | 177 | { |
178 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 178 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
179 | return 0; | 179 | return 0; |
180 | 180 | ||
181 | //US KService::Ptr ptr = mTypeMap[ type ]; | 181 | //US KService::Ptr ptr = mTypeMap[ type ]; |
182 | //US KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); | 182 | //US KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); |
183 | PluginInfo* pi = mTypeMap[ type ]; | 183 | PluginInfo* pi = mTypeMap[ type ]; |
184 | KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() ); | 184 | KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() ); |
185 | if ( !factory ) { | 185 | if ( !factory ) { |
186 | qDebug("KRES::Factory::configWidget(): Factory creation failed for library %s", pi->library.latin1()); | 186 | qDebug("KRES::Factory::configWidget(): Factory creation failed for library %s", pi->library.latin1()); |
187 | kdDebug() << "KRES::Factory::configWidget(): Factory creation failed" << endl; | 187 | kdDebug() << "KRES::Factory::configWidget(): Factory creation failed" << endl; |
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
190 | 190 | ||
191 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); | 191 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); |
192 | 192 | ||
193 | if ( !pluginFactory ) { | 193 | if ( !pluginFactory ) { |
194 | qDebug("KRES::Factory::configWidget(): no plugin factory for library %s", pi->library.latin1()); | 194 | qDebug("KRES::Factory::configWidget(): no plugin factory for library %s", pi->library.latin1()); |
195 | kdDebug() << "KRES::Factory::configWidget(): no plugin factory." << endl; | 195 | kdDebug() << "KRES::Factory::configWidget(): no plugin factory." << endl; |
196 | return 0; | 196 | return 0; |
197 | } | 197 | } |
198 | 198 | ||
199 | ConfigWidget *wdg = pluginFactory->configWidget( parent ); | 199 | ConfigWidget *wdg = pluginFactory->configWidget( parent ); |
200 | if ( !wdg ) { | 200 | if ( !wdg ) { |
201 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; | 201 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; |
202 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); | 202 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); |
203 | return 0; | 203 | return 0; |
204 | } | 204 | } |
205 | return wdg; | 205 | return wdg; |
206 | 206 | ||
207 | } | 207 | } |
208 | 208 | ||
209 | QString Factory::typeName( const QString &type ) const | 209 | QString Factory::typeName( const QString &type ) const |
210 | { | 210 | { |
211 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 211 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
212 | return QString(); | 212 | return QString(); |