summaryrefslogtreecommitdiff
path: root/core/launcher/systray.cpp
Unidiff
Diffstat (limited to 'core/launcher/systray.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/systray.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp
index 3c72d25..d0f1808 100644
--- a/core/launcher/systray.cpp
+++ b/core/launcher/systray.cpp
@@ -76,73 +76,73 @@ void SysTray::clearApplets()
76 QValueList<TaskbarApplet>::Iterator mit; 76 QValueList<TaskbarApplet>::Iterator mit;
77 for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { 77 for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) {
78 (*mit).iface->release(); 78 (*mit).iface->release();
79 (*mit).library->unload(); 79 (*mit).library->unload();
80 delete (*mit).library; 80 delete (*mit).library;
81 } 81 }
82 82
83#endif 83#endif
84 appletList.clear(); 84 appletList.clear();
85 if ( layout ) 85 if ( layout )
86 delete layout; 86 delete layout;
87 layout = new QHBoxLayout( this, 0, 1 ); 87 layout = new QHBoxLayout( this, 0, 1 );
88 layout->setAutoAdd(TRUE); 88 layout->setAutoAdd(TRUE);
89} 89}
90 90
91void SysTray::addApplets() 91void SysTray::addApplets()
92{ 92{
93 hide(); 93 hide();
94#ifndef QT_NO_COMPONENTS 94#ifndef QT_NO_COMPONENTS
95 Config cfg( "Taskbar" ); 95 Config cfg( "Taskbar" );
96 cfg.setGroup( "Applets" ); 96 cfg.setGroup( "Applets" );
97 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); 97 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' );
98 98
99 QString lang = getenv( "LANG" ); 99 QString lang = getenv( "LANG" );
100 QString path = QPEApplication::qpeDir() + "/plugins/applets"; 100 QString path = QPEApplication::qpeDir() + "plugins/applets";
101#ifdef Q_OS_MACX 101#ifdef Q_OS_MACX
102 QDir dir( path, "lib*.dylib" ); 102 QDir dir( path, "lib*.dylib" );
103#else 103#else
104 QDir dir( path, "lib*.so" ); 104 QDir dir( path, "lib*.so" );
105#endif /* Q_OS_MACX */ 105#endif /* Q_OS_MACX */
106 QStringList list = dir.entryList(); 106 QStringList list = dir.entryList();
107 QStringList::Iterator it; 107 QStringList::Iterator it;
108 int napplets=0; 108 int napplets=0;
109 TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; 109 TaskbarApplet* *applets = new TaskbarApplet*[list.count()];
110 for ( it = list.begin(); it != list.end(); ++it ) { 110 for ( it = list.begin(); it != list.end(); ++it ) {
111 if ( exclude.find( *it ) != exclude.end() ) 111 if ( exclude.find( *it ) != exclude.end() )
112 continue; 112 continue;
113 owarn << "Found Applet: " << (*it) << "" << oendl; 113 owarn << "Found Applet: " << (*it) << "" << oendl;
114 TaskbarAppletInterface *iface = 0; 114 TaskbarAppletInterface *iface = 0;
115 QLibrary *lib = new QLibrary( path + "/" + *it ); 115 QLibrary *lib = new QLibrary( path + "/" + *it );
116 if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { 116 if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) {
117 TaskbarApplet *applet = new TaskbarApplet; 117 TaskbarApplet *applet = new TaskbarApplet;
118 applets[napplets++] = applet; 118 applets[napplets++] = applet;
119 applet->library = lib; 119 applet->library = lib;
120 applet->iface = iface; 120 applet->iface = iface;
121 121
122 QTranslator *trans = new QTranslator(qApp); 122 QTranslator *trans = new QTranslator(qApp);
123 QString type = (*it).left( (*it).find(".") ); 123 QString type = (*it).left( (*it).find(".") );
124 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 124 QString tfn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+type+".qm";
125 if ( trans->load( tfn )) 125 if ( trans->load( tfn ))
126 qApp->installTranslator( trans ); 126 qApp->installTranslator( trans );
127 else 127 else
128 delete trans; 128 delete trans;
129 } else { 129 } else {
130 exclude += *it; 130 exclude += *it;
131 delete lib; 131 delete lib;
132 } 132 }
133 } 133 }
134 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 134 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
135 qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); 135 qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions);
136 while (napplets--) { 136 while (napplets--) {
137 TaskbarApplet *applet = applets[napplets]; 137 TaskbarApplet *applet = applets[napplets];
138 applet->applet = applet->iface->applet( this ); 138 applet->applet = applet->iface->applet( this );
139 appletList.append(*applet); 139 appletList.append(*applet);
140 } 140 }
141 delete [] applets; 141 delete [] applets;
142#else /* ## FIXME single app */ 142#else /* ## FIXME single app */
143 TaskbarApplet * const applet = new TaskbarApplet(); 143 TaskbarApplet * const applet = new TaskbarApplet();
144 applet->iface = new ClockAppletImpl(); 144 applet->iface = new ClockAppletImpl();
145 applet->applet = applet->iface->applet( this ); 145 applet->applet = applet->iface->applet( this );
146 appletList.append( applet ); 146 appletList.append( applet );
147#endif 147#endif
148 show(); 148 show();