author | sandman <sandman> | 2002-10-02 22:15:33 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-02 22:15:33 (UTC) |
commit | 7e864eb22b5663ad9771b562fbe901042dc68657 (patch) (unidiff) | |
tree | c7cc270012ff2aba51308088b51022b2056f9721 /core/settings/launcher/taskbarsettings.cpp | |
parent | c8d4ed632ac27261219e5824f988a320b96b8ae2 (diff) | |
download | opie-7e864eb22b5663ad9771b562fbe901042dc68657.zip opie-7e864eb22b5663ad9771b562fbe901042dc68657.tar.gz opie-7e864eb22b5663ad9771b562fbe901042dc68657.tar.bz2 |
Launcher settings now also supports the new menu applets interface
Diffstat (limited to 'core/settings/launcher/taskbarsettings.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/settings/launcher/taskbarsettings.cpp | 18 |
1 files changed, 13 insertions, 5 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 | |||
@@ -43,25 +43,25 @@ | |||
43 | #include <qwhatsthis.h> | 43 | #include <qwhatsthis.h> |
44 | 44 | ||
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | 46 | ||
47 | 47 | ||
48 | TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) | 48 | 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 | ||
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 | ||
@@ -76,55 +76,63 @@ void TaskbarSettings::init ( ) | |||
76 | 76 | ||
77 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; | 77 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; |
78 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); | 78 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); |
79 | 79 | ||
80 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { | 80 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { |
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 | |||
89 | QString lang = getenv( "LANG" ); | 88 | QString lang = getenv( "LANG" ); |
90 | QTranslator *trans = new QTranslator ( qApp ); | 89 | QTranslator *trans = new QTranslator ( qApp ); |
91 | QString type = (*it). left ((*it). find (".")); | 90 | QString type = (*it). left ((*it). find (".")); |
92 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; | 91 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; |
93 | if ( trans-> load ( tfn )) | 92 | if ( trans-> load ( tfn )) |
94 | qApp-> installTranslator ( trans ); | 93 | qApp-> installTranslator ( trans ); |
95 | else | 94 | else |
96 | delete trans; | 95 | delete trans; |
97 | name = iface-> name ( ); | 96 | name = iface-> name ( ); |
98 | icon = iface-> icon ( ); | 97 | icon = iface-> icon ( ); |
99 | iface-> release ( ); | 98 | iface-> release ( ); |
100 | lib-> unload ( ); | 99 | } |
101 | } else { | 100 | if ( !iface ) { |
102 | delete lib; | 101 | lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); |
102 | |||
103 | if ( iface ) { | ||
103 | name = (*it). mid ( 3 ); | 104 | name = (*it). mid ( 3 ); |
104 | int sep = name. find( ".so" ); | 105 | int sep = name. find( ".so" ); |
105 | if ( sep > 0 ) | 106 | if ( sep > 0 ) |
106 | name. truncate ( sep ); | 107 | name. truncate ( sep ); |
107 | sep = name. find ( "applet" ); | 108 | sep = name. find ( "applet" ); |
108 | if ( sep == (int) name.length ( ) - 6 ) | 109 | if ( sep == (int) name.length ( ) - 6 ) |
109 | name. truncate ( sep ); | 110 | name. truncate ( sep ); |
110 | name[0] = name[0]. upper ( ); | 111 | name[0] = name[0]. upper ( ); |
112 | iface-> release ( ); | ||
111 | } | 113 | } |
114 | } | ||
115 | |||
116 | if ( iface ) { | ||
112 | QCheckListItem *item; | 117 | QCheckListItem *item; |
113 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); | 118 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); |
114 | if ( !icon. isNull ( )) | 119 | if ( !icon. isNull ( )) |
115 | item-> setPixmap ( 0, icon ); | 120 | item-> setPixmap ( 0, icon ); |
116 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); | 121 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); |
117 | m_applets [*it] = item; | 122 | m_applets [*it] = item; |
118 | } | 123 | } |
124 | lib-> unload ( ); | ||
125 | delete lib; | ||
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; |
124 | } | 132 | } |
125 | 133 | ||
126 | void TaskbarSettings::accept ( ) | 134 | void TaskbarSettings::accept ( ) |
127 | { | 135 | { |
128 | Config cfg ( "Taskbar" ); | 136 | Config cfg ( "Taskbar" ); |
129 | cfg. setGroup ( "Applets" ); | 137 | cfg. setGroup ( "Applets" ); |
130 | if ( m_applets_changed ) { | 138 | if ( m_applets_changed ) { |