summaryrefslogtreecommitdiff
path: root/core/settings/launcher/taskbarsettings.cpp
Unidiff
Diffstat (limited to 'core/settings/launcher/taskbarsettings.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/settings/launcher/taskbarsettings.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp
index b3e302a..d03ea49 100644
--- a/core/settings/launcher/taskbarsettings.cpp
+++ b/core/settings/launcher/taskbarsettings.cpp
@@ -54,87 +54,104 @@ TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name )
54 54
55 QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this ); 55 QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this );
56 lay-> addWidget ( l ); 56 lay-> addWidget ( l );
57 57
58 m_list = new QListView ( this ); 58 m_list = new QListView ( this );
59 m_list-> addColumn ( "foobar" ); 59 m_list-> addColumn ( "foobar" );
60 m_list-> header ( )-> hide ( ); 60 m_list-> header ( )-> hide ( );
61 61
62 lay-> addWidget ( m_list ); 62 lay-> addWidget ( m_list );
63 63
64 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); 64 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." ));
65 65
66 connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); 66 connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( )));
67 67
68 init ( ); 68 init ( );
69} 69}
70 70
71void TaskbarSettings::init ( ) 71void TaskbarSettings::init ( )
72{ 72{
73 Config cfg ( "Taskbar" ); 73 Config cfg ( "Taskbar" );
74 cfg. setGroup ( "Applets" ); 74 cfg. setGroup ( "Applets" );
75 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); 75 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
76 76
77 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; 77 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets";
78#ifdef Q_OS_MACX
79 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
80#else
78 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 81 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
82#endif /* Q_OS_MACX */
79 83
80 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 84 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
81 QString name; 85 QString name;
82 QPixmap icon; 86 QPixmap icon;
83 TaskbarNamedAppletInterface *iface = 0; 87 TaskbarNamedAppletInterface *iface = 0;
84 88
89 qWarning("Load applet: %s", (*it).latin1() );
85 QLibrary *lib = new QLibrary ( path + "/" + *it ); 90 QLibrary *lib = new QLibrary ( path + "/" + *it );
86 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); 91 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface );
92 qWarning("<1>");
87 if ( iface ) { 93 if ( iface ) {
94 qWarning("<2>");
88 QString lang = getenv( "LANG" ); 95 QString lang = getenv( "LANG" );
89 QTranslator *trans = new QTranslator ( qApp ); 96 QTranslator *trans = new QTranslator ( qApp );
90 QString type = (*it). left ((*it). find (".")); 97 QString type = (*it). left ((*it). find ("."));
91 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; 98 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm";
92 if ( trans-> load ( tfn )) 99 if ( trans-> load ( tfn ))
93 qApp-> installTranslator ( trans ); 100 qApp-> installTranslator ( trans );
94 else 101 else
95 delete trans; 102 delete trans;
96 name = iface-> name ( ); 103 name = iface-> name ( );
97 icon = iface-> icon ( ); 104 icon = iface-> icon ( );
98 iface-> release ( ); 105 iface-> release ( );
99 } 106 }
107 qWarning("<3>");
100 if ( !iface ) { 108 if ( !iface ) {
109 qWarning("<4>");
101 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); 110 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface );
102 111
103 if ( iface ) { 112 if ( iface ) {
113 qWarning("<5>");
104 name = (*it). mid ( 3 ); 114 name = (*it). mid ( 3 );
115 qWarning("Found applet: %s", name.latin1() );
116#ifdef Q_OS_MACX
117 int sep = name. find( ".dylib" );
118#else
105 int sep = name. find( ".so" ); 119 int sep = name. find( ".so" );
120#endif /* Q_OS_MACX */
106 if ( sep > 0 ) 121 if ( sep > 0 )
107 name. truncate ( sep ); 122 name. truncate ( sep );
108 sep = name. find ( "applet" ); 123 sep = name. find ( "applet" );
109 if ( sep == (int) name.length ( ) - 6 ) 124 if ( sep == (int) name.length ( ) - 6 )
110 name. truncate ( sep ); 125 name. truncate ( sep );
111 name[0] = name[0]. upper ( ); 126 name[0] = name[0]. upper ( );
112 iface-> release ( ); 127 iface-> release ( );
113 } 128 }
114 } 129 }
130 qWarning("<6>");
115 131
116 if ( iface ) { 132 if ( iface ) {
133 qWarning("<7>");
117 QCheckListItem *item; 134 QCheckListItem *item;
118 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 135 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
119 if ( !icon. isNull ( )) 136 if ( !icon. isNull ( ))
120 item-> setPixmap ( 0, icon ); 137 item-> setPixmap ( 0, icon );
121 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 138 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
122 m_applets [*it] = item; 139 m_applets [*it] = item;
123 } 140 }
124 lib-> unload ( ); 141 lib-> unload ( );
125 delete lib; 142 delete lib;
126 } 143 }
127} 144}
128 145
129void TaskbarSettings::appletChanged() 146void TaskbarSettings::appletChanged()
130{ 147{
131 m_applets_changed = true; 148 m_applets_changed = true;
132} 149}
133 150
134void TaskbarSettings::accept ( ) 151void TaskbarSettings::accept ( )
135{ 152{
136 Config cfg ( "Taskbar" ); 153 Config cfg ( "Taskbar" );
137 cfg. setGroup ( "Applets" ); 154 cfg. setGroup ( "Applets" );
138 155
139 if ( m_applets_changed ) { 156 if ( m_applets_changed ) {
140 QStringList exclude; 157 QStringList exclude;