-rw-r--r-- | core/launcher/systray.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp index 64356ca..6122770 100644 --- a/core/launcher/systray.cpp +++ b/core/launcher/systray.cpp | |||
@@ -48,48 +48,56 @@ SysTray::~SysTray() | |||
48 | { | 48 | { |
49 | clearApplets(); | 49 | clearApplets(); |
50 | } | 50 | } |
51 | 51 | ||
52 | static int compareAppletPositions(const void *a, const void *b) | 52 | static int compareAppletPositions(const void *a, const void *b) |
53 | { | 53 | { |
54 | const TaskbarApplet* aa = *(const TaskbarApplet**)a; | 54 | const TaskbarApplet* aa = *(const TaskbarApplet**)a; |
55 | const TaskbarApplet* ab = *(const TaskbarApplet**)b; | 55 | const TaskbarApplet* ab = *(const TaskbarApplet**)b; |
56 | int d = ab->iface->position() - aa->iface->position(); | 56 | int d = ab->iface->position() - aa->iface->position(); |
57 | if ( d ) return d; | 57 | if ( d ) return d; |
58 | return QString::compare(ab->name,aa->name); | 58 | return QString::compare(ab->name,aa->name); |
59 | } | 59 | } |
60 | 60 | ||
61 | void SysTray::loadApplets() | 61 | void SysTray::loadApplets() |
62 | { | 62 | { |
63 | hide(); | 63 | hide(); |
64 | clearApplets(); | 64 | clearApplets(); |
65 | addApplets(); | 65 | addApplets(); |
66 | } | 66 | } |
67 | 67 | ||
68 | void SysTray::clearApplets() | 68 | void SysTray::clearApplets() |
69 | { | 69 | { |
70 | #ifndef QT_NO_COMPONENTS | 70 | #ifndef QT_NO_COMPONENTS |
71 | 71 | ||
72 | /* | ||
73 | * Note on clearing. SOme applets delete their | ||
74 | * applets themselves some don't do it | ||
75 | * and on restart this can crash. If we delete it | ||
76 | * here we might end up in a double deletion. We could | ||
77 | * use QGuardedPtr but that would be one QOBject | ||
78 | * for every applet more but only useful for restart | ||
79 | */ | ||
72 | QValueList<TaskbarApplet>::Iterator mit; | 80 | QValueList<TaskbarApplet>::Iterator mit; |
73 | for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { | 81 | for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { |
74 | (*mit).iface->release(); | 82 | (*mit).iface->release(); |
75 | (*mit).library->unload(); | 83 | (*mit).library->unload(); |
76 | delete (*mit).library; | 84 | delete (*mit).library; |
77 | } | 85 | } |
78 | 86 | ||
79 | #endif | 87 | #endif |
80 | appletList.clear(); | 88 | appletList.clear(); |
81 | if ( layout ) | 89 | if ( layout ) |
82 | delete layout; | 90 | delete layout; |
83 | layout = new QHBoxLayout( this, 0, 1 ); | 91 | layout = new QHBoxLayout( this, 0, 1 ); |
84 | layout->setAutoAdd(TRUE); | 92 | layout->setAutoAdd(TRUE); |
85 | } | 93 | } |
86 | 94 | ||
87 | void SysTray::addApplets() | 95 | void SysTray::addApplets() |
88 | { | 96 | { |
89 | hide(); | 97 | hide(); |
90 | #ifndef QT_NO_COMPONENTS | 98 | #ifndef QT_NO_COMPONENTS |
91 | Config cfg( "Taskbar" ); | 99 | Config cfg( "Taskbar" ); |
92 | cfg.setGroup( "Applets" ); | 100 | cfg.setGroup( "Applets" ); |
93 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); | 101 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); |
94 | 102 | ||
95 | QString lang = getenv( "LANG" ); | 103 | QString lang = getenv( "LANG" ); |