-rw-r--r-- | microkde/kresources/factory.cpp | 26 | ||||
-rw-r--r-- | microkde/kresources/managerimpl.cpp | 2 | ||||
-rw-r--r-- | microkde/microkde.pro | 8 |
3 files changed, 35 insertions, 1 deletions
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp index a3b7fff..5fbfa68 100644 --- a/microkde/kresources/factory.cpp +++ b/microkde/kresources/factory.cpp | |||
@@ -13,48 +13,53 @@ | |||
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 | #include <kdebug.h> | 24 | #include <kdebug.h> |
25 | #include <klocale.h> | 25 | #include <klocale.h> |
26 | #include <ksimpleconfig.h> | 26 | #include <ksimpleconfig.h> |
27 | #include <kstandarddirs.h> | 27 | #include <kstandarddirs.h> |
28 | #include <kstaticdeleter.h> | 28 | #include <kstaticdeleter.h> |
29 | //#ifndef DESKTOP_VERSION | 29 | //#ifndef DESKTOP_VERSION |
30 | #include <klibloader.h> | 30 | #include <klibloader.h> |
31 | //#endif | 31 | //#endif |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | 33 | ||
34 | #include "resource.h" | 34 | #include "resource.h" |
35 | #include "factory.h" | 35 | #include "factory.h" |
36 | 36 | ||
37 | #ifdef STATIC_RESOURCES | ||
38 | #include <file/resourcefile.h> | ||
39 | #include <dir/resourcedir.h> | ||
40 | #include <qtopia/resourceqtopia.h> | ||
41 | #endif | ||
37 | using namespace KRES; | 42 | using namespace KRES; |
38 | 43 | ||
39 | QDict<Factory> *Factory::mSelves = 0; | 44 | QDict<Factory> *Factory::mSelves = 0; |
40 | static KStaticDeleter< QDict<Factory> > staticDeleter; | 45 | static KStaticDeleter< QDict<Factory> > staticDeleter; |
41 | 46 | ||
42 | Factory *Factory::self( const QString& resourceFamily) | 47 | Factory *Factory::self( const QString& resourceFamily) |
43 | { | 48 | { |
44 | 49 | ||
45 | 50 | ||
46 | Factory *factory = 0; | 51 | Factory *factory = 0; |
47 | if ( !mSelves ) | 52 | if ( !mSelves ) |
48 | { | 53 | { |
49 | mSelves = staticDeleter.setObject( new QDict<Factory> ); | 54 | mSelves = staticDeleter.setObject( new QDict<Factory> ); |
50 | } | 55 | } |
51 | 56 | ||
52 | factory = mSelves->find( resourceFamily ); | 57 | factory = mSelves->find( resourceFamily ); |
53 | 58 | ||
54 | if ( !factory ) { | 59 | if ( !factory ) { |
55 | factory = new Factory( resourceFamily); | 60 | factory = new Factory( resourceFamily); |
56 | mSelves->insert( resourceFamily, factory ); | 61 | mSelves->insert( resourceFamily, factory ); |
57 | } | 62 | } |
58 | 63 | ||
59 | return factory; | 64 | return factory; |
60 | } | 65 | } |
@@ -198,59 +203,80 @@ QString Factory::typeName( const QString &type ) const | |||
198 | //US return ptr->name(); | 203 | //US return ptr->name(); |
199 | PluginInfo* pi = mTypeMap[ type ]; | 204 | PluginInfo* pi = mTypeMap[ type ]; |
200 | return pi->nameLabel; | 205 | return pi->nameLabel; |
201 | 206 | ||
202 | } | 207 | } |
203 | 208 | ||
204 | QString Factory::typeDescription( const QString &type ) const | 209 | QString Factory::typeDescription( const QString &type ) const |
205 | { | 210 | { |
206 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 211 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
207 | return QString(); | 212 | return QString(); |
208 | 213 | ||
209 | //US KService::Ptr ptr = mTypeMap[ type ]; | 214 | //US KService::Ptr ptr = mTypeMap[ type ]; |
210 | //US return ptr->comment(); | 215 | //US return ptr->comment(); |
211 | PluginInfo* pi = mTypeMap[ type ]; | 216 | PluginInfo* pi = mTypeMap[ type ]; |
212 | return pi->descriptionLabel; | 217 | return pi->descriptionLabel; |
213 | } | 218 | } |
214 | 219 | ||
215 | Resource *Factory::resource( const QString& type, const KConfig *config ) | 220 | Resource *Factory::resource( const QString& type, const KConfig *config ) |
216 | { | 221 | { |
217 | 222 | ||
218 | 223 | ||
219 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 224 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
220 | return 0; | 225 | return 0; |
221 | 226 | ||
227 | #ifdef STATIC_RESOURCES | ||
228 | qDebug("NEW STATIC RESOURCE %s", type.latin1()); | ||
229 | Resource *resource = 0; | ||
230 | if ( type == "file" ) { | ||
231 | resource = (Resource *) new KABC::ResourceFile( config ); | ||
232 | } else if ( type == "dir" ) { | ||
233 | resource = new KABC::ResourceDir( config ); | ||
234 | } else if ( type == "qtopia" ) { | ||
235 | resource = new KABC::ResourceQtopia( config ); | ||
236 | } | ||
237 | if ( !resource) | ||
238 | qDebug("Factory::resource:: resources are statically linked. resource type %s is not supported ",type.latin1() ); | ||
239 | else | ||
240 | resource->setType( type ); | ||
241 | return resource; | ||
242 | #else | ||
243 | |||
244 | |||
245 | |||
222 | /*US load the lib not dynamicly. !! | 246 | /*US load the lib not dynamicly. !! |
223 | KService::Ptr ptr = mTypeMap[ type ]; | 247 | KService::Ptr ptr = mTypeMap[ type ]; |
224 | KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); | 248 | KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); |
225 | if ( !factory ) { | 249 | if ( !factory ) { |
226 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; | 250 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; |
227 | return 0; | 251 | return 0; |
228 | } | 252 | } |
229 | */ | 253 | */ |
230 | PluginInfo* pi = mTypeMap[ type ]; | 254 | PluginInfo* pi = mTypeMap[ type ]; |
231 | KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() ); | 255 | KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() ); |
232 | if ( !factory ) { | 256 | if ( !factory ) { |
233 | qDebug("KRES::Factory::resource(): Factory creation failed for library %s", pi->library.latin1()); | 257 | qDebug("KRES::Factory::resource(): Factory creation failed for library %s", pi->library.latin1()); |
234 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; | 258 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; |
235 | return 0; | 259 | return 0; |
236 | } | 260 | } |
237 | 261 | ||
238 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); | 262 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); |
239 | 263 | ||
240 | if ( !pluginFactory ) { | 264 | if ( !pluginFactory ) { |
241 | qDebug("KRES::Factory::resource(): no plugin factory for library %s", pi->library.latin1()); | 265 | qDebug("KRES::Factory::resource(): no plugin factory for library %s", pi->library.latin1()); |
242 | kdDebug() << "KRES::Factory::resource(): no plugin factory." << endl; | 266 | kdDebug() << "KRES::Factory::resource(): no plugin factory." << endl; |
243 | return 0; | 267 | return 0; |
244 | } | 268 | } |
245 | 269 | ||
246 | Resource *resource = pluginFactory->resource( config ); | 270 | Resource *resource = pluginFactory->resource( config ); |
247 | if ( !resource ) { | 271 | if ( !resource ) { |
248 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; | 272 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; |
249 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); | 273 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); |
250 | return 0; | 274 | return 0; |
251 | } | 275 | } |
252 | 276 | ||
253 | resource->setType( type ); | 277 | resource->setType( type ); |
254 | 278 | ||
255 | return resource; | 279 | return resource; |
280 | |||
281 | #endif | ||
256 | } | 282 | } |
diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp index 566b8f4..a6d2007 100644 --- a/microkde/kresources/managerimpl.cpp +++ b/microkde/kresources/managerimpl.cpp | |||
@@ -19,48 +19,50 @@ | |||
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 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (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 | #include <qfile.h> |
38 | 38 | ||
39 | #include "resource.h" | 39 | #include "resource.h" |
40 | #include "factory.h" | 40 | #include "factory.h" |
41 | #include "managerimpl.h" | 41 | #include "managerimpl.h" |
42 | 42 | ||
43 | |||
44 | |||
43 | using namespace KRES; | 45 | using namespace KRES; |
44 | 46 | ||
45 | ManagerImpl::ManagerImpl( const QString &family ) | 47 | ManagerImpl::ManagerImpl( const QString &family ) |
46 | : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), | 48 | : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), |
47 | mFactory( 0 ) | 49 | mFactory( 0 ) |
48 | 50 | ||
49 | { | 51 | { |
50 | kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; | 52 | kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; |
51 | 53 | ||
52 | 54 | ||
53 | } | 55 | } |
54 | 56 | ||
55 | ManagerImpl::~ManagerImpl() | 57 | ManagerImpl::~ManagerImpl() |
56 | { | 58 | { |
57 | kdDebug(5650) << "ManagerImpl::~ManagerImpl()" << endl; | 59 | kdDebug(5650) << "ManagerImpl::~ManagerImpl()" << endl; |
58 | 60 | ||
59 | Resource::List::ConstIterator it; | 61 | Resource::List::ConstIterator it; |
60 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 62 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
61 | delete *it; | 63 | delete *it; |
62 | } | 64 | } |
63 | 65 | ||
64 | delete mStdConfig; | 66 | delete mStdConfig; |
65 | } | 67 | } |
66 | 68 | ||
diff --git a/microkde/microkde.pro b/microkde/microkde.pro index 9016260..783ec34 100644 --- a/microkde/microkde.pro +++ b/microkde/microkde.pro | |||
@@ -1,44 +1,50 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | include( ../variables.pri ) | ||
3 | #INCLUDEPATH += $(QTDIR)/include . | 4 | #INCLUDEPATH += $(QTDIR)/include . |
4 | #DEPENDPATH += $(QTDIR)/include | 5 | #DEPENDPATH += $(QTDIR)/include |
5 | INCLUDEPATH += . ../ ../kabc ./kdecore ./kdeui ./kio/kfile ./kio/kio | 6 | INCLUDEPATH += . ../ ../kabc ./kdecore ./kdeui ./kio/kfile ./kio/kio |
6 | #LIBS += -lqtcompat | 7 | #LIBS += -lqtcompat |
7 | 8 | ||
8 | TARGET = microkde | 9 | TARGET = microkde |
9 | DESTDIR= ../bin | 10 | DESTDIR= ../bin |
10 | DEFINES += DESKTOP_VERSION KDE_QT_ONLY | 11 | DEFINES += DESKTOP_VERSION KDE_QT_ONLY |
11 | unix : { | 12 | unix : { |
13 | staticlib: { | ||
14 | INCLUDEPATH += ../kabc/plugins | ||
15 | DEFINES += STATIC_RESOURCES | ||
16 | } | ||
17 | |||
18 | |||
12 | OBJECTS_DIR = obj/unix | 19 | OBJECTS_DIR = obj/unix |
13 | MOC_DIR = moc/unix | 20 | MOC_DIR = moc/unix |
14 | } | 21 | } |
15 | win32: { | 22 | win32: { |
16 | DEFINES += _WIN32_ | 23 | DEFINES += _WIN32_ |
17 | OBJECTS_DIR = obj/win | 24 | OBJECTS_DIR = obj/win |
18 | MOC_DIR = moc/win | 25 | MOC_DIR = moc/win |
19 | } | 26 | } |
20 | include( ../variables.pri ) | ||
21 | 27 | ||
22 | 28 | ||
23 | 29 | ||
24 | HEADERS = \ | 30 | HEADERS = \ |
25 | qlayoutengine_p.h \ | 31 | qlayoutengine_p.h \ |
26 | KDGanttMinimizeSplitter.h \ | 32 | KDGanttMinimizeSplitter.h \ |
27 | kapplication.h \ | 33 | kapplication.h \ |
28 | kaudioplayer.h \ | 34 | kaudioplayer.h \ |
29 | kcalendarsystem.h \ | 35 | kcalendarsystem.h \ |
30 | kcalendarsystemgregorian.h \ | 36 | kcalendarsystemgregorian.h \ |
31 | kcolorbutton.h \ | 37 | kcolorbutton.h \ |
32 | kcolordialog.h \ | 38 | kcolordialog.h \ |
33 | kcombobox.h \ | 39 | kcombobox.h \ |
34 | kconfig.h \ | 40 | kconfig.h \ |
35 | kdatetbl.h \ | 41 | kdatetbl.h \ |
36 | kdebug.h \ | 42 | kdebug.h \ |
37 | kdialog.h \ | 43 | kdialog.h \ |
38 | kdialogbase.h \ | 44 | kdialogbase.h \ |
39 | keditlistbox.h \ | 45 | keditlistbox.h \ |
40 | kemailsettings.h \ | 46 | kemailsettings.h \ |
41 | kfiledialog.h \ | 47 | kfiledialog.h \ |
42 | kfontdialog.h \ | 48 | kfontdialog.h \ |
43 | kglobal.h \ | 49 | kglobal.h \ |
44 | kglobalsettings.h \ | 50 | kglobalsettings.h \ |