Diffstat (limited to 'core/settings/launcher/taskbarsettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/launcher/taskbarsettings.cpp | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp index b5c03c8..5bc5ad2 100644 --- a/core/settings/launcher/taskbarsettings.cpp +++ b/core/settings/launcher/taskbarsettings.cpp | |||
@@ -49,13 +49,13 @@ TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) | |||
49 | : QWidget ( parent, name ) | 49 | : QWidget ( parent, name ) |
50 | { | 50 | { |
51 | m_applets_changed = false; | 51 | m_applets_changed = false; |
52 | 52 | ||
53 | QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); | 53 | QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); |
54 | 54 | ||
55 | QLabel *l = new QLabel ( tr( "Load applets:" ), 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 | ||
@@ -81,43 +81,51 @@ void TaskbarSettings::init ( ) | |||
81 | QString name; | 81 | QString name; |
82 | QPixmap icon; | 82 | QPixmap icon; |
83 | TaskbarNamedAppletInterface *iface = 0; | 83 | TaskbarNamedAppletInterface *iface = 0; |
84 | 84 | ||
85 | QLibrary *lib = new QLibrary ( path + "/" + *it ); | 85 | QLibrary *lib = new QLibrary ( path + "/" + *it ); |
86 | lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); | 86 | lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); |
87 | if ( iface ) { | 87 | if ( iface ) { |
88 | 88 | QString lang = getenv( "LANG" ); | |
89 | QString lang = getenv( "LANG" ); | 89 | QTranslator *trans = new QTranslator ( qApp ); |
90 | QTranslator *trans = new QTranslator ( qApp ); | 90 | QString type = (*it). left ((*it). find (".")); |
91 | QString type = (*it). left ((*it). find (".")); | 91 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; |
92 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; | 92 | if ( trans-> load ( tfn )) |
93 | if ( trans-> load ( tfn )) | 93 | qApp-> installTranslator ( trans ); |
94 | qApp-> installTranslator ( trans ); | 94 | else |
95 | else | 95 | delete trans; |
96 | delete trans; | 96 | name = iface-> name ( ); |
97 | name = iface-> name ( ); | 97 | icon = iface-> icon ( ); |
98 | icon = iface-> icon ( ); | ||
99 | iface-> release ( ); | 98 | iface-> release ( ); |
100 | lib-> unload ( ); | ||
101 | } else { | ||
102 | delete lib; | ||
103 | name = (*it). mid ( 3 ); | ||
104 | int sep = name. find( ".so" ); | ||
105 | if ( sep > 0 ) | ||
106 | name. truncate ( sep ); | ||
107 | sep = name. find ( "applet" ); | ||
108 | if ( sep == (int) name.length ( ) - 6 ) | ||
109 | name. truncate ( sep ); | ||
110 | name[0] = name[0]. upper ( ); | ||
111 | } | 99 | } |
112 | QCheckListItem *item; | 100 | if ( !iface ) { |
113 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); | 101 | lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); |
114 | if ( !icon. isNull ( )) | 102 | |
115 | item-> setPixmap ( 0, icon ); | 103 | if ( iface ) { |
116 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); | 104 | name = (*it). mid ( 3 ); |
117 | m_applets [*it] = item; | 105 | int sep = name. find( ".so" ); |
106 | if ( sep > 0 ) | ||
107 | name. truncate ( sep ); | ||
108 | sep = name. find ( "applet" ); | ||
109 | if ( sep == (int) name.length ( ) - 6 ) | ||
110 | name. truncate ( sep ); | ||
111 | name[0] = name[0]. upper ( ); | ||
112 | iface-> release ( ); | ||
113 | } | ||
114 | } | ||
115 | |||
116 | if ( iface ) { | ||
117 | QCheckListItem *item; | ||
118 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); | ||
119 | if ( !icon. isNull ( )) | ||
120 | item-> setPixmap ( 0, icon ); | ||
121 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); | ||
122 | m_applets [*it] = item; | ||
123 | } | ||
124 | lib-> unload ( ); | ||
125 | delete lib; | ||
118 | } | 126 | } |
119 | } | 127 | } |
120 | 128 | ||
121 | void TaskbarSettings::appletChanged() | 129 | void TaskbarSettings::appletChanged() |
122 | { | 130 | { |
123 | m_applets_changed = true; | 131 | m_applets_changed = true; |