1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
$NetBSD: patch-cb,v 1.1 2001/10/15 22:46:04 skrll Exp $
--- kicker/share/pluginmgr.cpp.orig Mon Apr 9 12:04:06 2001
+++ kicker/share/pluginmgr.cpp
@@ -51,27 +51,28 @@
if(!dlregistered){
dlregistered = true;
- lt_dlinit();
+ loader = KLibLoader::self();
}
- lt_dlhandle handle = lt_dlopen(QFile::encodeName(libStr));
+ KLibrary* handle = loader->library(QFile::encodeName(libStr));
+
if(!handle){
- kdWarning() << "cannot open applet: " << libStr << " because of " << lt_dlerror() << endl;
+ kdWarning() << "cannot open applet: " << libStr << " because of " << loader->lastErrorMessage() << endl;
return(NULL);
}
- lt_ptr_t init_func = lt_dlsym(handle, "init");
+ void* init_func = handle->symbol(QString("init").utf8());
if(!init_func){
kdWarning() << libStr << " is not a kicker applet!" << endl;
- lt_dlclose(handle);
+ loader->unloadLibrary(QFile::encodeName(libStr));
return(NULL);
}
KPanelApplet* (*init_ptr)(QWidget *, const QString&);
init_ptr = (KPanelApplet* (*)(QWidget *, const QString&))init_func;
KPanelApplet *w = init_ptr(parent, configFile);
- lt_dlhandle *tmp = new lt_dlhandle;
- *tmp = handle;
+ QString* tmp = new QString;
+ *tmp = libStr;
handleDict.insert((long)w, tmp);
return(w);
}
@@ -96,48 +97,42 @@
if(!dlregistered){
dlregistered = true;
- lt_dlinit();
+ loader = KLibLoader::self();
}
- lt_dlhandle handle = lt_dlopen(QFile::encodeName(libStr));
+ KLibrary* handle = loader->library(QFile::encodeName(libStr));
if(!handle){
- kdWarning() << "cannot open extension: " << libStr << " because of " << lt_dlerror() << endl;
+ kdWarning() << "cannot open extension: " << libStr << " because of " << loader->lastErrorMessage() << endl;
return(NULL);
}
- lt_ptr_t init_func = lt_dlsym(handle, "init");
+ void* init_func = handle->symbol(QString("init").utf8());
if(!init_func){
kdWarning() << libStr << " is not a kicker extension!" << endl;
- lt_dlclose(handle);
+ loader->unloadLibrary(QFile::encodeName(libStr));
return(NULL);
}
KPanelExtension* (*init_ptr)(QWidget *, const QString&);
init_ptr = (KPanelExtension* (*)(QWidget *, const QString&))init_func;
KPanelExtension *w = init_ptr(parent, configFile);
- lt_dlhandle *tmp = new lt_dlhandle;
- *tmp = handle;
+ QString* tmp = new QString;
+ *tmp = libStr;
handleDict.insert((long)w, tmp);
return(w);
}
bool KickerPluginManager::removePlugin(QWidget *w)
{
- lt_dlhandle *handle = handleDict.find((long)w);
+ QString* handle = handleDict.find((long)w);
if(!handle){
kdWarning() << "Cannot find handle to remove plugin!" << endl;
return(false);
}
handleDict.remove((long)w);
delete w;
- if(!lt_dlclose(*handle)){
- kdWarning() << "Unable to unload plugin!" << endl;
- return(false);
- }
+ loader->unloadLibrary(QFile::encodeName(*handle));
+ // kdWarning() << "Unable to unload plugin!" << endl;
+ // return(false);
return(true);
}
-
-
-
-
-
|