author | zautrix <zautrix> | 2004-07-08 00:16:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-08 00:16:46 (UTC) |
commit | e8628e6e3e98f2276fb69bbc545866cc9a022228 (patch) (unidiff) | |
tree | 798f61100c1ec3dab71a00ba63ac0d99fbd643b1 /microkde | |
parent | 5030b0bd32b1e526f28ce0339d4b4854492393ae (diff) | |
download | kdepimpi-e8628e6e3e98f2276fb69bbc545866cc9a022228.zip kdepimpi-e8628e6e3e98f2276fb69bbc545866cc9a022228.tar.gz kdepimpi-e8628e6e3e98f2276fb69bbc545866cc9a022228.tar.bz2 |
Compile fixes for windows
-rw-r--r-- | microkde/kdecore/klibloader.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/microkde/kdecore/klibloader.cpp b/microkde/kdecore/klibloader.cpp index 9eee912..1394154 100644 --- a/microkde/kdecore/klibloader.cpp +++ b/microkde/kdecore/klibloader.cpp | |||
@@ -1,654 +1,661 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 1999 Torben Weis <weis@kde.org> | 2 | Copyright (C) 1999 Torben Weis <weis@kde.org> |
3 | Copyright (C) 2000 Michael Matz <matz@kde.org> | 3 | Copyright (C) 2000 Michael Matz <matz@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License version 2 as published by the Free Software Foundation. | 7 | License version 2 as published by the Free Software Foundation. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | //US #include <config.h> | 19 | //US #include <config.h> |
20 | #include <qclipboard.h> | 20 | #include <qclipboard.h> |
21 | #include <qfile.h> | 21 | #include <qfile.h> |
22 | #include <qtimer.h> | 22 | #include <qtimer.h> |
23 | #include <qobjectdict.h> | 23 | #include <qobjectdict.h> |
24 | #include <qwidgetlist.h> | 24 | #include <qwidgetlist.h> |
25 | #include <qwidget.h> | 25 | #include <qwidget.h> |
26 | 26 | ||
27 | #include "kapplication.h" | 27 | #include "kapplication.h" |
28 | #include "klibloader.h" | 28 | #include "klibloader.h" |
29 | #include "kstandarddirs.h" | 29 | #include "kstandarddirs.h" |
30 | #include "kdebug.h" | 30 | #include "kdebug.h" |
31 | #include "klocale.h" | 31 | #include "klocale.h" |
32 | 32 | ||
33 | /*US | 33 | /*US |
34 | #ifndef NDEBUG | 34 | #ifndef NDEBUG |
35 | #include "ltdl.h" | 35 | #include "ltdl.h" |
36 | #endif | 36 | #endif |
37 | */ | 37 | */ |
38 | 38 | ||
39 | //US do everything through qlibrary | 39 | //US do everything through qlibrary |
40 | #ifndef DESKTOP_VERSION | 40 | #ifndef DESKTOP_VERSION |
41 | #include <qpe/qpeapplication.h> | 41 | #include <qpe/qpeapplication.h> |
42 | #include <qtopia/qlibrary.h> | 42 | #include <qtopia/qlibrary.h> |
43 | #else | 43 | #else |
44 | #include <qlibrary.h> | 44 | #include <qlibrary.h> |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | 47 | ||
48 | template class QAsciiDict<KLibrary>; | 48 | template class QAsciiDict<KLibrary>; |
49 | 49 | ||
50 | #include <stdlib.h> //getenv | 50 | #include <stdlib.h> //getenv |
51 | 51 | ||
52 | /*US | 52 | /*US |
53 | #if HAVE_DLFCN_H | 53 | #if HAVE_DLFCN_H |
54 | # include <dlfcn.h> | 54 | # include <dlfcn.h> |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | #ifdef RTLD_GLOBAL | 57 | #ifdef RTLD_GLOBAL |
58 | # define LT_GLOBAL RTLD_GLOBAL | 58 | # define LT_GLOBAL RTLD_GLOBAL |
59 | #else | 59 | #else |
60 | # ifdef DL_GLOBAL | 60 | # ifdef DL_GLOBAL |
61 | # define LT_GLOBAL DL_GLOBAL | 61 | # define LT_GLOBAL DL_GLOBAL |
62 | # endif | 62 | # endif |
63 | #endif | 63 | #endif |
64 | #ifndef LT_GLOBAL | 64 | #ifndef LT_GLOBAL |
65 | # define LT_GLOBAL 0 | 65 | # define LT_GLOBAL 0 |
66 | #endif | 66 | #endif |
67 | */ | 67 | */ |
68 | 68 | ||
69 | /*US | 69 | /*US |
70 | extern "C" { | 70 | extern "C" { |
71 | extern int lt_dlopen_flag; | 71 | extern int lt_dlopen_flag; |
72 | } | 72 | } |
73 | */ | 73 | */ |
74 | 74 | ||
75 | KLibFactory::KLibFactory( QObject* parent, const char* name ) | 75 | KLibFactory::KLibFactory( QObject* parent, const char* name ) |
76 | : QObject( parent, name ) | 76 | : QObject( parent, name ) |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | KLibFactory::~KLibFactory() | 80 | KLibFactory::~KLibFactory() |
81 | { | 81 | { |
82 | // kdDebug(150) << "Deleting KLibFactory " << this << endl; | 82 | // kdDebug(150) << "Deleting KLibFactory " << this << endl; |
83 | } | 83 | } |
84 | 84 | ||
85 | QObject* KLibFactory::create( QObject* parent, const char* name, const char* classname, const QStringList &args ) | 85 | QObject* KLibFactory::create( QObject* parent, const char* name, const char* classname, const QStringList &args ) |
86 | { | 86 | { |
87 | QObject* obj = createObject( parent, name, classname, args ); | 87 | QObject* obj = createObject( parent, name, classname, args ); |
88 | if ( obj ) | 88 | if ( obj ) |
89 | emit objectCreated( obj ); | 89 | emit objectCreated( obj ); |
90 | return obj; | 90 | return obj; |
91 | } | 91 | } |
92 | 92 | ||
93 | 93 | ||
94 | QObject* KLibFactory::createObject( QObject*, const char*, const char*, const QStringList &) | 94 | QObject* KLibFactory::createObject( QObject*, const char*, const char*, const QStringList &) |
95 | { | 95 | { |
96 | return 0; | 96 | return 0; |
97 | } | 97 | } |
98 | 98 | ||
99 | 99 | ||
100 | // ----------------------------------------------- | 100 | // ----------------------------------------------- |
101 | 101 | ||
102 | //US KLibrary::KLibrary( const QString& libname, const QString& filename, void * handle ) | 102 | //US KLibrary::KLibrary( const QString& libname, const QString& filename, void * handle ) |
103 | KLibrary::KLibrary( const QString& libname, const QString& filename, QLibrary* handle ) | 103 | KLibrary::KLibrary( const QString& libname, const QString& filename, QLibrary* handle ) |
104 | { | 104 | { |
105 | /* Make sure, we have a KLibLoader */ | 105 | /* Make sure, we have a KLibLoader */ |
106 | (void) KLibLoader::self(); | 106 | (void) KLibLoader::self(); |
107 | m_libname = libname; | 107 | m_libname = libname; |
108 | m_filename = filename; | 108 | m_filename = filename; |
109 | m_handle = handle; | 109 | m_handle = handle; |
110 | m_factory = 0; | 110 | m_factory = 0; |
111 | m_timer = 0; | 111 | m_timer = 0; |
112 | } | 112 | } |
113 | 113 | ||
114 | KLibrary::~KLibrary() | 114 | KLibrary::~KLibrary() |
115 | { | 115 | { |
116 | // kdDebug(150) << "Deleting KLibrary " << this << " " << m_libname << endl; | 116 | // kdDebug(150) << "Deleting KLibrary " << this << " " << m_libname << endl; |
117 | if ( m_timer && m_timer->isActive() ) | 117 | if ( m_timer && m_timer->isActive() ) |
118 | m_timer->stop(); | 118 | m_timer->stop(); |
119 | 119 | ||
120 | // If any object is remaining, delete | 120 | // If any object is remaining, delete |
121 | if ( m_objs.count() > 0 ) | 121 | if ( m_objs.count() > 0 ) |
122 | { | 122 | { |
123 | QPtrListIterator<QObject> it( m_objs ); | 123 | QPtrListIterator<QObject> it( m_objs ); |
124 | for ( ; it.current() ; ++it ) | 124 | for ( ; it.current() ; ++it ) |
125 | { | 125 | { |
126 | kdDebug(150) << "Factory still has object " << it.current() << " " << it.current()->name () << " Library = " << m_libname << endl; | 126 | kdDebug(150) << "Factory still has object " << it.current() << " " << it.current()->name () << " Library = " << m_libname << endl; |
127 | disconnect( it.current(), SIGNAL( destroyed() ), | 127 | disconnect( it.current(), SIGNAL( destroyed() ), |
128 | this, SLOT( slotObjectDestroyed() ) ); | 128 | this, SLOT( slotObjectDestroyed() ) ); |
129 | } | 129 | } |
130 | m_objs.setAutoDelete(true); | 130 | m_objs.setAutoDelete(true); |
131 | m_objs.clear(); | 131 | m_objs.clear(); |
132 | } | 132 | } |
133 | 133 | ||
134 | if ( m_factory ) { | 134 | if ( m_factory ) { |
135 | //kdDebug(150) << " ... deleting the factory " << m_factory << endl; | 135 | //kdDebug(150) << " ... deleting the factory " << m_factory << endl; |
136 | delete m_factory; | 136 | delete m_factory; |
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | QString KLibrary::name() const | 140 | QString KLibrary::name() const |
141 | { | 141 | { |
142 | return m_libname; | 142 | return m_libname; |
143 | } | 143 | } |
144 | 144 | ||
145 | QString KLibrary::fileName() const | 145 | QString KLibrary::fileName() const |
146 | { | 146 | { |
147 | return m_filename; | 147 | return m_filename; |
148 | } | 148 | } |
149 | 149 | ||
150 | KLibFactory* KLibrary::factory() | 150 | KLibFactory* KLibrary::factory() |
151 | { | 151 | { |
152 | if ( m_factory ) | 152 | if ( m_factory ) |
153 | return m_factory; | 153 | return m_factory; |
154 | 154 | ||
155 | QCString symname; | 155 | QCString symname; |
156 | symname.sprintf("init_%s", name().latin1() ); | 156 | symname.sprintf("init_%s", name().latin1() ); |
157 | 157 | ||
158 | void* sym = symbol( symname ); | 158 | void* sym = symbol( symname ); |
159 | if ( !sym ) | 159 | if ( !sym ) |
160 | { | 160 | { |
161 | qDebug("KLibrary: The library %s does not offer an %s function", name().latin1(), symname.data()); | 161 | qDebug("KLibrary: The library %s does not offer an %s function", name().latin1(), symname.data()); |
162 | #ifndef NDEBUG | 162 | #ifndef NDEBUG |
163 | //US qDebug("KLibrary: errorcode: %s", lt_dlerror()); | 163 | //US qDebug("KLibrary: errorcode: %s", lt_dlerror()); |
164 | #endif | 164 | #endif |
165 | kdWarning(150) << "KLibrary: The library " << name().latin1() << " does not offer an init_" << name().latin1() << " function" << endl; | 165 | kdWarning(150) << "KLibrary: The library " << name().latin1() << " does not offer an init_" << name().latin1() << " function" << endl; |
166 | return 0; | 166 | return 0; |
167 | } | 167 | } |
168 | 168 | ||
169 | typedef KLibFactory* (*t_func)(); | 169 | typedef KLibFactory* (*t_func)(); |
170 | t_func func = (t_func)sym; | 170 | t_func func = (t_func)sym; |
171 | m_factory = func(); | 171 | m_factory = func(); |
172 | 172 | ||
173 | if( !m_factory ) | 173 | if( !m_factory ) |
174 | { | 174 | { |
175 | kdWarning(150) << "KLibrary: The library " << name() << " does not offer a KDE compatible factory" << endl; | 175 | kdWarning(150) << "KLibrary: The library " << name() << " does not offer a KDE compatible factory" << endl; |
176 | return 0; | 176 | return 0; |
177 | } | 177 | } |
178 | 178 | ||
179 | connect( m_factory, SIGNAL( objectCreated( QObject * ) ), | 179 | connect( m_factory, SIGNAL( objectCreated( QObject * ) ), |
180 | this, SLOT( slotObjectCreated( QObject * ) ) ); | 180 | this, SLOT( slotObjectCreated( QObject * ) ) ); |
181 | 181 | ||
182 | return m_factory; | 182 | return m_factory; |
183 | } | 183 | } |
184 | 184 | ||
185 | void* KLibrary::symbol( const char* symname ) const | 185 | void* KLibrary::symbol( const char* symname ) const |
186 | { | 186 | { |
187 | //US void* sym = lt_dlsym( (lt_dlhandle) m_handle, symname ); | 187 | //US void* sym = lt_dlsym( (lt_dlhandle) m_handle, symname ); |
188 | void* sym = m_handle->resolve( symname ); | 188 | void* sym = m_handle->resolve( symname ); |
189 | if ( !sym ) | 189 | if ( !sym ) |
190 | { | 190 | { |
191 | //US kdWarning(150) << "KLibrary: " << lt_dlerror() << endl; | 191 | //US kdWarning(150) << "KLibrary: " << lt_dlerror() << endl; |
192 | return 0; | 192 | return 0; |
193 | } | 193 | } |
194 | 194 | ||
195 | return sym; | 195 | return sym; |
196 | } | 196 | } |
197 | 197 | ||
198 | bool KLibrary::hasSymbol( const char* symname ) const | 198 | bool KLibrary::hasSymbol( const char* symname ) const |
199 | { | 199 | { |
200 | //US void* sym = lt_dlsym( (lt_dlhandle) m_handle, symname ); | 200 | //US void* sym = lt_dlsym( (lt_dlhandle) m_handle, symname ); |
201 | void* sym = m_handle->resolve( symname ); | 201 | void* sym = m_handle->resolve( symname ); |
202 | return (sym != 0L ); | 202 | return (sym != 0L ); |
203 | } | 203 | } |
204 | 204 | ||
205 | void KLibrary::unload() const | 205 | void KLibrary::unload() const |
206 | { | 206 | { |
207 | if (KLibLoader::s_self) | 207 | if (KLibLoader::s_self) |
208 | KLibLoader::s_self->unloadLibrary(QFile::encodeName(name())); | 208 | KLibLoader::s_self->unloadLibrary(QFile::encodeName(name())); |
209 | } | 209 | } |
210 | 210 | ||
211 | void KLibrary::slotObjectCreated( QObject *obj ) | 211 | void KLibrary::slotObjectCreated( QObject *obj ) |
212 | { | 212 | { |
213 | if ( !obj ) | 213 | if ( !obj ) |
214 | return; | 214 | return; |
215 | 215 | ||
216 | if ( m_timer && m_timer->isActive() ) | 216 | if ( m_timer && m_timer->isActive() ) |
217 | m_timer->stop(); | 217 | m_timer->stop(); |
218 | 218 | ||
219 | if ( m_objs.containsRef( obj ) ) | 219 | if ( m_objs.containsRef( obj ) ) |
220 | return; // we know this object already | 220 | return; // we know this object already |
221 | 221 | ||
222 | connect( obj, SIGNAL( destroyed() ), | 222 | connect( obj, SIGNAL( destroyed() ), |
223 | this, SLOT( slotObjectDestroyed() ) ); | 223 | this, SLOT( slotObjectDestroyed() ) ); |
224 | 224 | ||
225 | m_objs.append( obj ); | 225 | m_objs.append( obj ); |
226 | } | 226 | } |
227 | 227 | ||
228 | void KLibrary::slotObjectDestroyed() | 228 | void KLibrary::slotObjectDestroyed() |
229 | { | 229 | { |
230 | m_objs.removeRef( sender() ); | 230 | m_objs.removeRef( sender() ); |
231 | 231 | ||
232 | if ( m_objs.count() == 0 ) | 232 | if ( m_objs.count() == 0 ) |
233 | { | 233 | { |
234 | // kdDebug(150) << "KLibrary: shutdown timer for " << name() << " started!" | 234 | // kdDebug(150) << "KLibrary: shutdown timer for " << name() << " started!" |
235 | // << endl; | 235 | // << endl; |
236 | 236 | ||
237 | if ( !m_timer ) | 237 | if ( !m_timer ) |
238 | { | 238 | { |
239 | m_timer = new QTimer( this, "klibrary_shutdown_timer" ); | 239 | m_timer = new QTimer( this, "klibrary_shutdown_timer" ); |
240 | connect( m_timer, SIGNAL( timeout() ), | 240 | connect( m_timer, SIGNAL( timeout() ), |
241 | this, SLOT( slotTimeout() ) ); | 241 | this, SLOT( slotTimeout() ) ); |
242 | } | 242 | } |
243 | 243 | ||
244 | // as long as it's not stable make the timeout short, for debugging | 244 | // as long as it's not stable make the timeout short, for debugging |
245 | // pleasure (matz) | 245 | // pleasure (matz) |
246 | //m_timer->start( 1000*60, true ); | 246 | //m_timer->start( 1000*60, true ); |
247 | m_timer->start( 1000*10, true ); | 247 | m_timer->start( 1000*10, true ); |
248 | } | 248 | } |
249 | } | 249 | } |
250 | 250 | ||
251 | void KLibrary::slotTimeout() | 251 | void KLibrary::slotTimeout() |
252 | { | 252 | { |
253 | if ( m_objs.count() != 0 ) | 253 | if ( m_objs.count() != 0 ) |
254 | return; | 254 | return; |
255 | 255 | ||
256 | /* Don't go through KLibLoader::unloadLibrary(), because that uses the | 256 | /* Don't go through KLibLoader::unloadLibrary(), because that uses the |
257 | ref counter, but this timeout means to unconditionally close this library | 257 | ref counter, but this timeout means to unconditionally close this library |
258 | The destroyed() signal will take care to remove us from all lists. | 258 | The destroyed() signal will take care to remove us from all lists. |
259 | */ | 259 | */ |
260 | delete this; | 260 | delete this; |
261 | } | 261 | } |
262 | 262 | ||
263 | // ------------------------------------------------- | 263 | // ------------------------------------------------- |
264 | 264 | ||
265 | /* This helper class is needed, because KLibraries can go away without | 265 | /* This helper class is needed, because KLibraries can go away without |
266 | being unloaded. So we need some info about KLibraries even after its | 266 | being unloaded. So we need some info about KLibraries even after its |
267 | death. */ | 267 | death. */ |
268 | class KLibWrapPrivate | 268 | class KLibWrapPrivate |
269 | { | 269 | { |
270 | public: | 270 | public: |
271 | //US KLibWrapPrivate(KLibrary *l, lt_dlhandle h); | 271 | //US KLibWrapPrivate(KLibrary *l, lt_dlhandle h); |
272 | KLibWrapPrivate(KLibrary *l, QLibrary* h); | 272 | KLibWrapPrivate(KLibrary *l, QLibrary* h); |
273 | 273 | ||
274 | KLibrary *lib; | 274 | KLibrary *lib; |
275 | enum {UNKNOWN, UNLOAD, DONT_UNLOAD} unload_mode; | 275 | enum {UNKNOWN, UNLOAD, DONT_UNLOAD} unload_mode; |
276 | int ref_count; | 276 | int ref_count; |
277 | //US lt_dlhandle handle; | 277 | //US lt_dlhandle handle; |
278 | QLibrary *handle; | 278 | QLibrary *handle; |
279 | QString name; | 279 | QString name; |
280 | QString filename; | 280 | QString filename; |
281 | }; | 281 | }; |
282 | 282 | ||
283 | //US KLibWrapPrivate::KLibWrapPrivate(KLibrary *l, lt_dlhandle h) | 283 | //US KLibWrapPrivate::KLibWrapPrivate(KLibrary *l, lt_dlhandle h) |
284 | KLibWrapPrivate::KLibWrapPrivate(KLibrary *l, QLibrary* h) | 284 | KLibWrapPrivate::KLibWrapPrivate(KLibrary *l, QLibrary* h) |
285 | : lib(l), ref_count(1), handle(h), name(l->name()), filename(l->fileName()) | 285 | : lib(l), ref_count(1), handle(h), name(l->name()), filename(l->fileName()) |
286 | { | 286 | { |
287 | unload_mode = UNKNOWN; | 287 | unload_mode = UNKNOWN; |
288 | /*US | 288 | /*US |
289 | if (lt_dlsym(handle, "__kde_do_not_unload") != 0) { | 289 | if (lt_dlsym(handle, "__kde_do_not_unload") != 0) { |
290 | // kdDebug(150) << "Will not unload " << name << endl; | 290 | // kdDebug(150) << "Will not unload " << name << endl; |
291 | unload_mode = DONT_UNLOAD; | 291 | unload_mode = DONT_UNLOAD; |
292 | } else if (lt_dlsym(handle, "__kde_do_unload") != 0) { | 292 | } else if (lt_dlsym(handle, "__kde_do_unload") != 0) { |
293 | unload_mode = UNLOAD; | 293 | unload_mode = UNLOAD; |
294 | } | 294 | } |
295 | */ | 295 | */ |
296 | //US use instead: | 296 | //US use instead: |
297 | if (h->resolve("__kde_do_not_unload") != 0) { | 297 | if (h->resolve("__kde_do_not_unload") != 0) { |
298 | // kdDebug(150) << "Will not unload " << name << endl; | 298 | // kdDebug(150) << "Will not unload " << name << endl; |
299 | unload_mode = DONT_UNLOAD; | 299 | unload_mode = DONT_UNLOAD; |
300 | } else if (h->resolve("__kde_do_unload") != 0) { | 300 | } else if (h->resolve("__kde_do_unload") != 0) { |
301 | unload_mode = UNLOAD; | 301 | unload_mode = UNLOAD; |
302 | } | 302 | } |
303 | } | 303 | } |
304 | 304 | ||
305 | class KLibLoaderPrivate | 305 | class KLibLoaderPrivate |
306 | { | 306 | { |
307 | public: | 307 | public: |
308 | QPtrList<KLibWrapPrivate> loaded_stack; | 308 | QPtrList<KLibWrapPrivate> loaded_stack; |
309 | QPtrList<KLibWrapPrivate> pending_close; | 309 | QPtrList<KLibWrapPrivate> pending_close; |
310 | enum {UNKNOWN, UNLOAD, DONT_UNLOAD} unload_mode; | 310 | enum {UNKNOWN, UNLOAD, DONT_UNLOAD} unload_mode; |
311 | 311 | ||
312 | QString errorMessage; | 312 | QString errorMessage; |
313 | }; | 313 | }; |
314 | 314 | ||
315 | KLibLoader* KLibLoader::s_self = 0; | 315 | KLibLoader* KLibLoader::s_self = 0; |
316 | 316 | ||
317 | KLibLoader* KLibLoader::self() | 317 | KLibLoader* KLibLoader::self() |
318 | { | 318 | { |
319 | if ( !s_self ) | 319 | if ( !s_self ) |
320 | s_self = new KLibLoader; | 320 | s_self = new KLibLoader; |
321 | return s_self; | 321 | return s_self; |
322 | } | 322 | } |
323 | 323 | ||
324 | void KLibLoader::cleanUp() | 324 | void KLibLoader::cleanUp() |
325 | { | 325 | { |
326 | if ( !s_self ) | 326 | if ( !s_self ) |
327 | return; | 327 | return; |
328 | 328 | ||
329 | delete s_self; | 329 | delete s_self; |
330 | s_self = 0; | 330 | s_self = 0; |
331 | } | 331 | } |
332 | 332 | ||
333 | KLibLoader::KLibLoader( QObject* parent, const char* name ) | 333 | KLibLoader::KLibLoader( QObject* parent, const char* name ) |
334 | : QObject( parent, name ) | 334 | : QObject( parent, name ) |
335 | { | 335 | { |
336 | s_self = this; | 336 | s_self = this; |
337 | d = new KLibLoaderPrivate; | 337 | d = new KLibLoaderPrivate; |
338 | //US lt_dlinit(); | 338 | //US lt_dlinit(); |
339 | d->unload_mode = KLibLoaderPrivate::UNKNOWN; | 339 | d->unload_mode = KLibLoaderPrivate::UNKNOWN; |
340 | if (getenv("KDE_NOUNLOAD") != 0) | 340 | if (getenv("KDE_NOUNLOAD") != 0) |
341 | d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD; | 341 | d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD; |
342 | else if (getenv("KDE_DOUNLOAD") != 0) | 342 | else if (getenv("KDE_DOUNLOAD") != 0) |
343 | d->unload_mode = KLibLoaderPrivate::UNLOAD; | 343 | d->unload_mode = KLibLoaderPrivate::UNLOAD; |
344 | d->loaded_stack.setAutoDelete( true ); | 344 | d->loaded_stack.setAutoDelete( true ); |
345 | } | 345 | } |
346 | 346 | ||
347 | KLibLoader::~KLibLoader() | 347 | KLibLoader::~KLibLoader() |
348 | { | 348 | { |
349 | // kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl; | 349 | // kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl; |
350 | 350 | ||
351 | QAsciiDictIterator<KLibWrapPrivate> it( m_libs ); | 351 | QAsciiDictIterator<KLibWrapPrivate> it( m_libs ); |
352 | for (; it.current(); ++it ) | 352 | for (; it.current(); ++it ) |
353 | { | 353 | { |
354 | kdDebug(150) << "The KLibLoader contains the library " << it.current()->name | 354 | kdDebug(150) << "The KLibLoader contains the library " << it.current()->name |
355 | << " (" << it.current()->lib << ")" << endl; | 355 | << " (" << it.current()->lib << ")" << endl; |
356 | d->pending_close.append(it.current()); | 356 | d->pending_close.append(it.current()); |
357 | } | 357 | } |
358 | 358 | ||
359 | close_pending(0); | 359 | close_pending(0); |
360 | 360 | ||
361 | delete d; | 361 | delete d; |
362 | } | 362 | } |
363 | 363 | ||
364 | //static | 364 | //static |
365 | QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ ) | 365 | QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ ) |
366 | { | 366 | { |
367 | QCString libname( name ); | 367 | QCString libname( name ); |
368 | 368 | ||
369 | // only append ".la" if there is no extension | 369 | // only append ".la" if there is no extension |
370 | // this allows to load non-libtool libraries as well | 370 | // this allows to load non-libtool libraries as well |
371 | // (mhk, 20000228) | 371 | // (mhk, 20000228) |
372 | int pos = libname.findRev('/'); | 372 | int pos = libname.findRev('/'); |
373 | if (pos < 0) | 373 | if (pos < 0) |
374 | pos = 0; | 374 | pos = 0; |
375 | /*US | 375 | /*US |
376 | if (libname.find('.', pos) < 0) { | 376 | if (libname.find('.', pos) < 0) { |
377 | libname += ".la"; | 377 | libname += ".la"; |
378 | } | 378 | } |
379 | */ | 379 | */ |
380 | //US in the microedition we work only with shared libraries. | 380 | //US in the microedition we work only with shared libraries. |
381 | |||
381 | if (libname.find('.', pos) < 0) { | 382 | if (libname.find('.', pos) < 0) { |
383 | #ifdef _WIN32_ | ||
384 | libname += ".dll"; | ||
385 | #else | ||
382 | libname += ".so"; | 386 | libname += ".so"; |
387 | #endif | ||
383 | } | 388 | } |
384 | 389 | ||
385 | // only look up the file if it is not an absolute filename | 390 | // only look up the file if it is not an absolute filename |
386 | // (mhk, 20000228) | 391 | // (mhk, 20000228) |
387 | QString libfile; | 392 | QString libfile; |
388 | if (libname[0] == '/') | 393 | if (libname[0] == '/') |
389 | libfile = libname; | 394 | libfile = libname; |
390 | else | 395 | else |
391 | { | 396 | { |
392 | //US at this point the libname must exist as real filesname. No expansions will be made later | 397 | //US at this point the libname must exist as real filesname. No expansions will be made later |
393 | // in findResources. Because of that we prepend the lib prefix here to the name | 398 | // in findResources. Because of that we prepend the lib prefix here to the name |
394 | //US I add also the "lib" prefix. I do not how could this could have worked before without it? | 399 | //US I add also the "lib" prefix. I do not how could this could have worked before without it? |
400 | #ifndef _WIN32_ | ||
395 | libname.insert(pos, "lib"); | 401 | libname.insert(pos, "lib"); |
402 | #endif | ||
396 | 403 | ||
397 | 404 | ||
398 | //US libfile = instance->dirs()->findResource( "module", libname ); | 405 | //US libfile = instance->dirs()->findResource( "module", libname ); |
399 | //qDebug("libname = %s ",libname.data() ); | 406 | //qDebug("libname = %s ",libname.data() ); |
400 | libfile = KGlobal::dirs()->findResource( "module", libname ); | 407 | libfile = KGlobal::dirs()->findResource( "module", libname ); |
401 | //qDebug("libfile = %s ",libfile.latin1() ); | 408 | //qDebug("libfile = %s ",libfile.latin1() ); |
402 | 409 | ||
403 | if ( libfile.isEmpty() ) | 410 | if ( libfile.isEmpty() ) |
404 | { | 411 | { |
405 | //US libfile = instance->dirs()->findResource( "lib", libname ); | 412 | //US libfile = instance->dirs()->findResource( "lib", libname ); |
406 | libfile = KGlobal::dirs()->findResource( "lib", libname ); | 413 | libfile = KGlobal::dirs()->findResource( "lib", libname ); |
407 | //qDebug("libfile2 = %s ",libfile.latin1() ); | 414 | //qDebug("libfile2 = %s ",libfile.latin1() ); |
408 | #ifndef NDEBUG | 415 | #ifndef NDEBUG |
409 | if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules | 416 | if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules |
410 | kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl; | 417 | kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl; |
411 | #endif | 418 | #endif |
412 | } | 419 | } |
413 | if ( libfile.isEmpty() ) | 420 | if ( libfile.isEmpty() ) |
414 | { | 421 | { |
415 | #ifndef NDEBUG | 422 | #ifndef NDEBUG |
416 | kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl; | 423 | kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl; |
417 | self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(libname); | 424 | self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(libname); |
418 | 425 | ||
419 | qDebug("KLibLoader::library could not find library: %s", libname.data()); | 426 | qDebug("KLibLoader::library could not find library: %s", libname.data()); |
420 | #endif | 427 | #endif |
421 | 428 | ||
422 | } | 429 | } |
423 | else | 430 | else |
424 | self()->d->errorMessage = QString::null; | 431 | self()->d->errorMessage = QString::null; |
425 | } | 432 | } |
426 | 433 | ||
427 | //qDebug("return libfile = %s ",libfile.latin1() ); | 434 | //qDebug("return libfile = %s ",libfile.latin1() ); |
428 | return libfile; | 435 | return libfile; |
429 | } | 436 | } |
430 | 437 | ||
431 | 438 | ||
432 | KLibrary* KLibLoader::globalLibrary( const char *name ) | 439 | KLibrary* KLibLoader::globalLibrary( const char *name ) |
433 | { | 440 | { |
434 | KLibrary *tmp; | 441 | KLibrary *tmp; |
435 | /*US | 442 | /*US |
436 | int olt_dlopen_flag = lt_dlopen_flag; | 443 | int olt_dlopen_flag = lt_dlopen_flag; |
437 | 444 | ||
438 | lt_dlopen_flag |= LT_GLOBAL; | 445 | lt_dlopen_flag |= LT_GLOBAL; |
439 | kdDebug(150) << "Loading the next library global with flag " | 446 | kdDebug(150) << "Loading the next library global with flag " |
440 | << lt_dlopen_flag | 447 | << lt_dlopen_flag |
441 | << "." << endl; | 448 | << "." << endl; |
442 | */ | 449 | */ |
443 | tmp = library(name); | 450 | tmp = library(name); |
444 | /*US | 451 | /*US |
445 | lt_dlopen_flag = olt_dlopen_flag; | 452 | lt_dlopen_flag = olt_dlopen_flag; |
446 | */ | 453 | */ |
447 | return tmp; | 454 | return tmp; |
448 | } | 455 | } |
449 | 456 | ||
450 | 457 | ||
451 | KLibrary* KLibLoader::library( const char *name ) | 458 | KLibrary* KLibLoader::library( const char *name ) |
452 | { | 459 | { |
453 | if (!name) | 460 | if (!name) |
454 | return 0; | 461 | return 0; |
455 | 462 | ||
456 | KLibWrapPrivate* wrap = m_libs[name]; | 463 | KLibWrapPrivate* wrap = m_libs[name]; |
457 | if (wrap) { | 464 | if (wrap) { |
458 | /* Nothing to do to load the library. */ | 465 | /* Nothing to do to load the library. */ |
459 | wrap->ref_count++; | 466 | wrap->ref_count++; |
460 | return wrap->lib; | 467 | return wrap->lib; |
461 | } | 468 | } |
462 | 469 | ||
463 | /* Test if this library was loaded at some time, but got | 470 | /* Test if this library was loaded at some time, but got |
464 | unloaded meanwhile, whithout being dlclose()'ed. */ | 471 | unloaded meanwhile, whithout being dlclose()'ed. */ |
465 | QPtrListIterator<KLibWrapPrivate> it(d->loaded_stack); | 472 | QPtrListIterator<KLibWrapPrivate> it(d->loaded_stack); |
466 | for (; it.current(); ++it) { | 473 | for (; it.current(); ++it) { |
467 | if (it.current()->name == name) | 474 | if (it.current()->name == name) |
468 | wrap = it.current(); | 475 | wrap = it.current(); |
469 | } | 476 | } |
470 | 477 | ||
471 | if (wrap) { | 478 | if (wrap) { |
472 | d->pending_close.removeRef(wrap); | 479 | d->pending_close.removeRef(wrap); |
473 | if (!wrap->lib) { | 480 | if (!wrap->lib) { |
474 | /* This lib only was in loaded_stack, but not in m_libs. */ | 481 | /* This lib only was in loaded_stack, but not in m_libs. */ |
475 | wrap->lib = new KLibrary( name, wrap->filename, wrap->handle ); | 482 | wrap->lib = new KLibrary( name, wrap->filename, wrap->handle ); |
476 | } | 483 | } |
477 | wrap->ref_count++; | 484 | wrap->ref_count++; |
478 | } else { | 485 | } else { |
479 | QString libfile = findLibrary( name ); | 486 | QString libfile = findLibrary( name ); |
480 | if ( libfile.isEmpty() ) | 487 | if ( libfile.isEmpty() ) |
481 | return 0; | 488 | return 0; |
482 | #ifdef DESKTOP_VERSION | 489 | #ifdef DESKTOP_VERSION |
483 | QLibrary *qlib = new QLibrary( libfile.latin1() ); | 490 | QLibrary *qlib = new QLibrary( libfile.latin1() ); |
484 | #else | 491 | #else |
485 | QLibrary *qlib = new QLibrary( libfile.latin1(), QLibrary::Immediately ); | 492 | QLibrary *qlib = new QLibrary( libfile.latin1(), QLibrary::Immediately ); |
486 | #endif | 493 | #endif |
487 | 494 | ||
488 | //US lt_dlhandle handle = lt_dlopen( libfile.latin1() ); | 495 | //US lt_dlhandle handle = lt_dlopen( libfile.latin1() ); |
489 | //US if ( !handle ) | 496 | //US if ( !handle ) |
490 | if ( !qlib ) | 497 | if ( !qlib ) |
491 | { | 498 | { |
492 | //US const char* errmsg = lt_dlerror(); | 499 | //US const char* errmsg = lt_dlerror(); |
493 | char* errmsg; | 500 | char* errmsg; |
494 | sprintf(errmsg, "KLibLoader::library could not load library: %s", libfile.latin1()); | 501 | sprintf(errmsg, "KLibLoader::library could not load library: %s", libfile.latin1()); |
495 | qDebug(errmsg); | 502 | qDebug(errmsg); |
496 | 503 | ||
497 | if(errmsg) | 504 | if(errmsg) |
498 | d->errorMessage = QString::fromLatin1(errmsg); | 505 | d->errorMessage = QString::fromLatin1(errmsg); |
499 | else | 506 | else |
500 | d->errorMessage = QString::null; | 507 | d->errorMessage = QString::null; |
501 | kdWarning(150) << "library=" << name << ": file=" << libfile << ": " << d->errorMessage << endl; | 508 | kdWarning(150) << "library=" << name << ": file=" << libfile << ": " << d->errorMessage << endl; |
502 | return 0; | 509 | return 0; |
503 | } | 510 | } |
504 | else | 511 | else |
505 | d->errorMessage = QString::null; | 512 | d->errorMessage = QString::null; |
506 | 513 | ||
507 | KLibrary *lib = new KLibrary( name, libfile, qlib ); | 514 | KLibrary *lib = new KLibrary( name, libfile, qlib ); |
508 | wrap = new KLibWrapPrivate(lib, qlib); | 515 | wrap = new KLibWrapPrivate(lib, qlib); |
509 | d->loaded_stack.prepend(wrap); | 516 | d->loaded_stack.prepend(wrap); |
510 | } | 517 | } |
511 | m_libs.insert( name, wrap ); | 518 | m_libs.insert( name, wrap ); |
512 | 519 | ||
513 | connect( wrap->lib, SIGNAL( destroyed() ), | 520 | connect( wrap->lib, SIGNAL( destroyed() ), |
514 | this, SLOT( slotLibraryDestroyed() ) ); | 521 | this, SLOT( slotLibraryDestroyed() ) ); |
515 | 522 | ||
516 | return wrap->lib; | 523 | return wrap->lib; |
517 | } | 524 | } |
518 | 525 | ||
519 | QString KLibLoader::lastErrorMessage() const | 526 | QString KLibLoader::lastErrorMessage() const |
520 | { | 527 | { |
521 | return d->errorMessage; | 528 | return d->errorMessage; |
522 | } | 529 | } |
523 | 530 | ||
524 | void KLibLoader::unloadLibrary( const char *libname ) | 531 | void KLibLoader::unloadLibrary( const char *libname ) |
525 | { | 532 | { |
526 | KLibWrapPrivate *wrap = m_libs[ libname ]; | 533 | KLibWrapPrivate *wrap = m_libs[ libname ]; |
527 | if (!wrap) | 534 | if (!wrap) |
528 | return; | 535 | return; |
529 | if (--wrap->ref_count) | 536 | if (--wrap->ref_count) |
530 | return; | 537 | return; |
531 | 538 | ||
532 | // kdDebug(150) << "closing library " << libname << endl; | 539 | // kdDebug(150) << "closing library " << libname << endl; |
533 | 540 | ||
534 | m_libs.remove( libname ); | 541 | m_libs.remove( libname ); |
535 | 542 | ||
536 | disconnect( wrap->lib, SIGNAL( destroyed() ), | 543 | disconnect( wrap->lib, SIGNAL( destroyed() ), |
537 | this, SLOT( slotLibraryDestroyed() ) ); | 544 | this, SLOT( slotLibraryDestroyed() ) ); |
538 | close_pending( wrap ); | 545 | close_pending( wrap ); |
539 | } | 546 | } |
540 | 547 | ||
541 | KLibFactory* KLibLoader::factory( const char* name ) | 548 | KLibFactory* KLibLoader::factory( const char* name ) |
542 | { | 549 | { |
543 | KLibrary* lib = library( name ); | 550 | KLibrary* lib = library( name ); |
544 | if ( !lib ) | 551 | if ( !lib ) |
545 | return 0; | 552 | return 0; |
546 | 553 | ||
547 | return lib->factory(); | 554 | return lib->factory(); |
548 | } | 555 | } |
549 | 556 | ||
550 | void KLibLoader::slotLibraryDestroyed() | 557 | void KLibLoader::slotLibraryDestroyed() |
551 | { | 558 | { |
552 | const KLibrary *lib = static_cast<const KLibrary *>( sender() ); | 559 | const KLibrary *lib = static_cast<const KLibrary *>( sender() ); |
553 | 560 | ||
554 | QAsciiDictIterator<KLibWrapPrivate> it( m_libs ); | 561 | QAsciiDictIterator<KLibWrapPrivate> it( m_libs ); |
555 | for (; it.current(); ++it ) | 562 | for (; it.current(); ++it ) |
556 | if ( it.current()->lib == lib ) | 563 | if ( it.current()->lib == lib ) |
557 | { | 564 | { |
558 | KLibWrapPrivate *wrap = it.current(); | 565 | KLibWrapPrivate *wrap = it.current(); |
559 | wrap->lib = 0; /* the KLibrary object is already away */ | 566 | wrap->lib = 0; /* the KLibrary object is already away */ |
560 | m_libs.remove( it.currentKey() ); | 567 | m_libs.remove( it.currentKey() ); |
561 | close_pending( wrap ); | 568 | close_pending( wrap ); |
562 | return; | 569 | return; |
563 | } | 570 | } |
564 | } | 571 | } |
565 | 572 | ||
566 | void KLibLoader::close_pending(KLibWrapPrivate *wrap) | 573 | void KLibLoader::close_pending(KLibWrapPrivate *wrap) |
567 | { | 574 | { |
568 | if (wrap && !d->pending_close.containsRef( wrap )) | 575 | if (wrap && !d->pending_close.containsRef( wrap )) |
569 | d->pending_close.append( wrap ); | 576 | d->pending_close.append( wrap ); |
570 | 577 | ||
571 | /* First delete all KLibrary objects in pending_close, but _don't_ unload | 578 | /* First delete all KLibrary objects in pending_close, but _don't_ unload |
572 | the DSO behind it. */ | 579 | the DSO behind it. */ |
573 | QPtrListIterator<KLibWrapPrivate> it(d->pending_close); | 580 | QPtrListIterator<KLibWrapPrivate> it(d->pending_close); |
574 | for (; it.current(); ++it) { | 581 | for (; it.current(); ++it) { |
575 | wrap = it.current(); | 582 | wrap = it.current(); |
576 | if (wrap->lib) { | 583 | if (wrap->lib) { |
577 | disconnect( wrap->lib, SIGNAL( destroyed() ), | 584 | disconnect( wrap->lib, SIGNAL( destroyed() ), |
578 | this, SLOT( slotLibraryDestroyed() ) ); | 585 | this, SLOT( slotLibraryDestroyed() ) ); |
579 | delete wrap->lib; | 586 | delete wrap->lib; |
580 | wrap->lib = 0; | 587 | wrap->lib = 0; |
581 | } | 588 | } |
582 | } | 589 | } |
583 | 590 | ||
584 | if (d->unload_mode == KLibLoaderPrivate::DONT_UNLOAD) return; | 591 | if (d->unload_mode == KLibLoaderPrivate::DONT_UNLOAD) return; |
585 | 592 | ||
586 | bool deleted_one = false; | 593 | bool deleted_one = false; |
587 | while ((wrap = d->loaded_stack.first())) { | 594 | while ((wrap = d->loaded_stack.first())) { |
588 | /* Let's first see, if we want to try to unload this lib. | 595 | /* Let's first see, if we want to try to unload this lib. |
589 | If the env. var KDE_DOUNLOAD is set, we try to unload every lib. | 596 | If the env. var KDE_DOUNLOAD is set, we try to unload every lib. |
590 | If not, we look at the lib itself, and unload it only, if it exports | 597 | If not, we look at the lib itself, and unload it only, if it exports |
591 | the symbol __kde_do_unload. */ | 598 | the symbol __kde_do_unload. */ |
592 | if (d->unload_mode != KLibLoaderPrivate::UNLOAD | 599 | if (d->unload_mode != KLibLoaderPrivate::UNLOAD |
593 | && wrap->unload_mode != KLibWrapPrivate::UNLOAD) | 600 | && wrap->unload_mode != KLibWrapPrivate::UNLOAD) |
594 | break; | 601 | break; |
595 | 602 | ||
596 | /* Now ensure, that the libs are only unloaded in the reverse direction | 603 | /* Now ensure, that the libs are only unloaded in the reverse direction |
597 | they were loaded. */ | 604 | they were loaded. */ |
598 | if (!d->pending_close.containsRef( wrap )) { | 605 | if (!d->pending_close.containsRef( wrap )) { |
599 | if (!deleted_one) | 606 | if (!deleted_one) |
600 | /* Only diagnose, if we really haven't deleted anything. */ | 607 | /* Only diagnose, if we really haven't deleted anything. */ |
601 | // kdDebug(150) << "try to dlclose " << wrap->name << ": not yet" << endl; | 608 | // kdDebug(150) << "try to dlclose " << wrap->name << ": not yet" << endl; |
602 | break; | 609 | break; |
603 | } | 610 | } |
604 | 611 | ||
605 | // kdDebug(150) << "try to dlclose " << wrap->name << ": yes, done." << endl; | 612 | // kdDebug(150) << "try to dlclose " << wrap->name << ": yes, done." << endl; |
606 | 613 | ||
607 | #if 0 | 614 | #if 0 |
608 | #ifndef Q_WS_QWS | 615 | #ifndef Q_WS_QWS |
609 | if ( !deleted_one ) { | 616 | if ( !deleted_one ) { |
610 | /* Only do the hack once in this loop. | 617 | /* Only do the hack once in this loop. |
611 | WABA: *HACK* | 618 | WABA: *HACK* |
612 | We need to make sure to clear the clipboard before unloading a DSO | 619 | We need to make sure to clear the clipboard before unloading a DSO |
613 | because the DSO could have defined an object derived from QMimeSource | 620 | because the DSO could have defined an object derived from QMimeSource |
614 | and placed that on the clipboard. */ | 621 | and placed that on the clipboard. */ |
615 | /*kapp->clipboard()->clear();*/ | 622 | /*kapp->clipboard()->clear();*/ |
616 | 623 | ||
617 | /* Well.. let's do something more subtle... convert the clipboard context | 624 | /* Well.. let's do something more subtle... convert the clipboard context |
618 | to text. That should be safe as it only uses objects defined by Qt. */ | 625 | to text. That should be safe as it only uses objects defined by Qt. */ |
619 | 626 | ||
620 | QWidgetList *widgetlist = QApplication::topLevelWidgets(); | 627 | QWidgetList *widgetlist = QApplication::topLevelWidgets(); |
621 | QWidget *co = widgetlist->first(); | 628 | QWidget *co = widgetlist->first(); |
622 | while (co) { | 629 | while (co) { |
623 | if (qstrcmp(co->name(), "internal clipboard owner") == 0) { | 630 | if (qstrcmp(co->name(), "internal clipboard owner") == 0) { |
624 | if (XGetSelectionOwner(co->x11Display(), XA_PRIMARY) == co->winId()) | 631 | if (XGetSelectionOwner(co->x11Display(), XA_PRIMARY) == co->winId()) |
625 | kapp->clipboard()->setText(kapp->clipboard()->text()); | 632 | kapp->clipboard()->setText(kapp->clipboard()->text()); |
626 | 633 | ||
627 | break; | 634 | break; |
628 | } | 635 | } |
629 | co = widgetlist->next(); | 636 | co = widgetlist->next(); |
630 | } | 637 | } |
631 | delete widgetlist; | 638 | delete widgetlist; |
632 | } | 639 | } |
633 | #else | 640 | #else |
634 | // FIXME(E): Implement in Qt Embedded | 641 | // FIXME(E): Implement in Qt Embedded |
635 | #endif | 642 | #endif |
636 | 643 | ||
637 | #endif // 0 | 644 | #endif // 0 |
638 | deleted_one = true; | 645 | deleted_one = true; |
639 | //US lt_dlclose(wrap->handle); | 646 | //US lt_dlclose(wrap->handle); |
640 | wrap->handle->unload(); | 647 | wrap->handle->unload(); |
641 | 648 | ||
642 | d->pending_close.removeRef(wrap); | 649 | d->pending_close.removeRef(wrap); |
643 | /* loaded_stack is AutoDelete, so wrap is freed */ | 650 | /* loaded_stack is AutoDelete, so wrap is freed */ |
644 | d->loaded_stack.remove(); | 651 | d->loaded_stack.remove(); |
645 | } | 652 | } |
646 | } | 653 | } |
647 | 654 | ||
648 | void KLibLoader::virtual_hook( int, void* ) | 655 | void KLibLoader::virtual_hook( int, void* ) |
649 | { /*BASE::virtual_hook( id, data );*/ } | 656 | { /*BASE::virtual_hook( id, data );*/ } |
650 | 657 | ||
651 | void KLibFactory::virtual_hook( int, void* ) | 658 | void KLibFactory::virtual_hook( int, void* ) |
652 | { /*BASE::virtual_hook( id, data );*/ } | 659 | { /*BASE::virtual_hook( id, data );*/ } |
653 | 660 | ||
654 | //US #include "klibloader.moc" | 661 | //US #include "klibloader.moc" |