author | zautrix <zautrix> | 2004-07-07 11:56:39 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-07 11:56:39 (UTC) |
commit | 56721aac86c9ae5253abac8962474c8d1a7e648a (patch) (unidiff) | |
tree | c12f41eba0d5724ee800cdb92727ffd6d3c1cf6c /microkde/kresources | |
parent | 13d88c91f2916090bd45e23b504d0b665c68126f (diff) | |
download | kdepimpi-56721aac86c9ae5253abac8962474c8d1a7e648a.zip kdepimpi-56721aac86c9ae5253abac8962474c8d1a7e648a.tar.gz kdepimpi-56721aac86c9ae5253abac8962474c8d1a7e648a.tar.bz2 |
Changes for compiling on desktop
-rw-r--r-- | microkde/kresources/factory.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp index 827ec38..2253de4 100644 --- a/microkde/kresources/factory.cpp +++ b/microkde/kresources/factory.cpp | |||
@@ -1,126 +1,127 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkresources. | 2 | This file is part of libkresources. |
3 | 3 | ||
4 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 4 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
5 | Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> | 5 | Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> |
6 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 6 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
7 | 7 | ||
8 | This library is free software; you can redistribute it and/or | 8 | This library is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU Library General Public | 9 | modify it under the terms of the GNU Library General Public |
10 | License as published by the Free Software Foundation; either | 10 | License as published by the Free Software Foundation; either |
11 | version 2 of the License, or (at your option) any later version. | 11 | version 2 of the License, or (at your option) any later version. |
12 | 12 | ||
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 | #include <klibloader.h> | 30 | #include <klibloader.h> |
30 | 31 | //#endif | |
31 | #include <qfile.h> | 32 | #include <qfile.h> |
32 | 33 | ||
33 | #include "resource.h" | 34 | #include "resource.h" |
34 | #include "factory.h" | 35 | #include "factory.h" |
35 | 36 | ||
36 | using namespace KRES; | 37 | using namespace KRES; |
37 | 38 | ||
38 | QDict<Factory> *Factory::mSelves = 0; | 39 | QDict<Factory> *Factory::mSelves = 0; |
39 | static KStaticDeleter< QDict<Factory> > staticDeleter; | 40 | static KStaticDeleter< QDict<Factory> > staticDeleter; |
40 | 41 | ||
41 | Factory *Factory::self( const QString& resourceFamily ) | 42 | Factory *Factory::self( const QString& resourceFamily ) |
42 | { | 43 | { |
43 | 44 | ||
44 | 45 | ||
45 | Factory *factory = 0; | 46 | Factory *factory = 0; |
46 | if ( !mSelves ) | 47 | if ( !mSelves ) |
47 | { | 48 | { |
48 | mSelves = staticDeleter.setObject( new QDict<Factory> ); | 49 | mSelves = staticDeleter.setObject( new QDict<Factory> ); |
49 | } | 50 | } |
50 | 51 | ||
51 | factory = mSelves->find( resourceFamily ); | 52 | factory = mSelves->find( resourceFamily ); |
52 | 53 | ||
53 | if ( !factory ) { | 54 | if ( !factory ) { |
54 | factory = new Factory( resourceFamily ); | 55 | factory = new Factory( resourceFamily ); |
55 | mSelves->insert( resourceFamily, factory ); | 56 | mSelves->insert( resourceFamily, factory ); |
56 | } | 57 | } |
57 | 58 | ||
58 | return factory; | 59 | return factory; |
59 | } | 60 | } |
60 | 61 | ||
61 | Factory::Factory( const QString& resourceFamily ) : | 62 | Factory::Factory( const QString& resourceFamily ) : |
62 | mResourceFamily( resourceFamily ) | 63 | mResourceFamily( resourceFamily ) |
63 | { | 64 | { |
64 | //US so far we have three types available for resourceFamily "contact" | 65 | //US so far we have three types available for resourceFamily "contact" |
65 | // and that are "file", "dir", "ldap" | 66 | // and that are "file", "dir", "ldap" |
66 | /*US | 67 | /*US |
67 | 68 | ||
68 | KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" ) | 69 | KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" ) |
69 | .arg( resourceFamily ) ); | 70 | .arg( resourceFamily ) ); |
70 | KTrader::OfferList::ConstIterator it; | 71 | KTrader::OfferList::ConstIterator it; |
71 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 72 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
72 | QVariant type = (*it)->property( "X-KDE-ResourceType" ); | 73 | QVariant type = (*it)->property( "X-KDE-ResourceType" ); |
73 | if ( !type.toString().isEmpty() ) | 74 | if ( !type.toString().isEmpty() ) |
74 | mTypeMap.insert( type.toString(), *it ); | 75 | mTypeMap.insert( type.toString(), *it ); |
75 | } | 76 | } |
76 | */ | 77 | */ |
77 | 78 | ||
78 | //US new | 79 | //US new |
79 | PluginInfo* info = new PluginInfo; | 80 | PluginInfo* info = new PluginInfo; |
80 | info->library = "microkabc_file"; | 81 | info->library = "microkabc_file"; |
81 | info->nameLabel = i18n( "file" ); | 82 | info->nameLabel = i18n( "file" ); |
82 | info->descriptionLabel = i18n( "Choose one file" ); | 83 | info->descriptionLabel = i18n( "Choose one file" ); |
83 | mTypeMap.insert( "file", info ); | 84 | mTypeMap.insert( "file", info ); |
84 | 85 | ||
85 | info = new PluginInfo; | 86 | info = new PluginInfo; |
86 | info->library = "microkabc_dir"; | 87 | info->library = "microkabc_dir"; |
87 | info->nameLabel = i18n( "dir" ); | 88 | info->nameLabel = i18n( "dir" ); |
88 | info->descriptionLabel = i18n( "Choose a directory with may files" ); | 89 | info->descriptionLabel = i18n( "Choose a directory with may files" ); |
89 | mTypeMap.insert( "dir", info ); | 90 | mTypeMap.insert( "dir", info ); |
90 | 91 | ||
91 | info = new PluginInfo; | 92 | info = new PluginInfo; |
92 | info->library = "microkabc_ldap"; | 93 | info->library = "microkabc_ldap"; |
93 | info->nameLabel = i18n( "ldap" ); | 94 | info->nameLabel = i18n( "ldap" ); |
94 | info->descriptionLabel = i18n( "No description available" ); | 95 | info->descriptionLabel = i18n( "No description available" ); |
95 | mTypeMap.insert( "ldap", info ); | 96 | mTypeMap.insert( "ldap", info ); |
96 | 97 | ||
97 | //US add opie plugin only, if the library exists | 98 | //US add opie plugin only, if the library exists |
98 | QString libname = "microkabc_opie"; | 99 | QString libname = "microkabc_opie"; |
99 | QString path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); | 100 | QString path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); |
100 | if ( !path.isEmpty() ) | 101 | if ( !path.isEmpty() ) |
101 | { | 102 | { |
102 | info = new PluginInfo; | 103 | info = new PluginInfo; |
103 | info->library = libname; | 104 | info->library = libname; |
104 | info->nameLabel = i18n( "opie" ); | 105 | info->nameLabel = i18n( "opie" ); |
105 | info->descriptionLabel = i18n( "Opie PIM Addressbook." ); | 106 | info->descriptionLabel = i18n( "Opie PIM Addressbook." ); |
106 | mTypeMap.insert( "opie", info ); | 107 | mTypeMap.insert( "opie", info ); |
107 | } | 108 | } |
108 | 109 | ||
109 | //US add qtopia plugin only, if the library exists | 110 | //US add qtopia plugin only, if the library exists |
110 | libname = "microkabc_qtopia"; | 111 | libname = "microkabc_qtopia"; |
111 | path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); | 112 | path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); |
112 | if ( !path.isEmpty() ) | 113 | if ( !path.isEmpty() ) |
113 | { | 114 | { |
114 | info = new PluginInfo; | 115 | info = new PluginInfo; |
115 | info->library = libname; | 116 | info->library = libname; |
116 | info->nameLabel = i18n( "qtopia" ); | 117 | info->nameLabel = i18n( "qtopia" ); |
117 | info->descriptionLabel = i18n( "Qtopia PIM Addressbook." ); | 118 | info->descriptionLabel = i18n( "Qtopia PIM Addressbook." ); |
118 | mTypeMap.insert( "qtopia", info ); | 119 | mTypeMap.insert( "qtopia", info ); |
119 | } | 120 | } |
120 | 121 | ||
121 | 122 | ||
122 | } | 123 | } |
123 | 124 | ||
124 | Factory::~Factory() | 125 | Factory::~Factory() |
125 | { | 126 | { |
126 | } | 127 | } |