summaryrefslogtreecommitdiff
path: root/core/settings/launcher/menusettings.cpp
Unidiff
Diffstat (limited to 'core/settings/launcher/menusettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/menusettings.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp
index 29ce841..d63b203 100644
--- a/core/settings/launcher/menusettings.cpp
+++ b/core/settings/launcher/menusettings.cpp
@@ -12,48 +12,49 @@ _;:, .> :=|. This file is free software; you can
12 .%`+i> _;_. 12 .%`+i> _;_.
13 .i_,=:_. -<s. This file is distributed in the hope that 13 .i_,=:_. -<s. This file is distributed in the hope that
14 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 14 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
15 : .. .:, . . . without even the implied warranty of 15 : .. .:, . . . without even the implied warranty of
16 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 16 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
17 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 17 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.= = ; Public License for more details. 18..}^=.= = ; Public License for more details.
19++= -. .` .: 19++= -. .` .:
20: = ...= . :.=- You should have received a copy of the GNU 20: = ...= . :.=- You should have received a copy of the GNU
21-. .:....=;==+<; General Public License along with this file; 21-. .:....=;==+<; General Public License along with this file;
22 -_. . . )=. = see the file COPYING. If not, write to the 22 -_. . . )=. = see the file COPYING. If not, write to the
23 -- :-=` Free Software Foundation, Inc., 23 -- :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "menusettings.h" 29#include "menusettings.h"
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qpe/qlibrary.h> 32#include <qpe/qlibrary.h>
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/menuappletinterface.h> 34#include <qpe/menuappletinterface.h>
35#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
36#include <opie2/odebug.h>
36 37
37#include <qdir.h> 38#include <qdir.h>
38#include <qlistview.h> 39#include <qlistview.h>
39#include <qcheckbox.h> 40#include <qcheckbox.h>
40#include <qheader.h> 41#include <qheader.h>
41#include <qlayout.h> 42#include <qlayout.h>
42#include <qlabel.h> 43#include <qlabel.h>
43#include <qwhatsthis.h> 44#include <qwhatsthis.h>
44 45
45#include <stdlib.h> 46#include <stdlib.h>
46 47
47 48
48MenuSettings::MenuSettings ( QWidget *parent, const char *name ) 49MenuSettings::MenuSettings ( QWidget *parent, const char *name )
49 : QWidget ( parent, name ) 50 : QWidget ( parent, name )
50{ 51{
51 m_applets_changed = false; 52 m_applets_changed = false;
52 53
53 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 54 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
54 55
55 QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this ); 56 QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this );
56 lay-> addWidget ( l ); 57 lay-> addWidget ( l );
57 58
58 m_list = new QListView ( this ); 59 m_list = new QListView ( this );
59 m_list-> addColumn ( "foobar" ); 60 m_list-> addColumn ( "foobar" );
@@ -73,49 +74,51 @@ MenuSettings::MenuSettings ( QWidget *parent, const char *name )
73 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged())); 74 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged()));
74 75
75 init ( ); 76 init ( );
76} 77}
77 78
78void MenuSettings::init ( ) 79void MenuSettings::init ( )
79{ 80{
80 Config cfg ( "StartMenu" ); 81 Config cfg ( "StartMenu" );
81 cfg. setGroup ( "Applets" ); 82 cfg. setGroup ( "Applets" );
82 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); 83 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
83 84
84 QString path = QPEApplication::qpeDir ( ) + "plugins/applets"; 85 QString path = QPEApplication::qpeDir ( ) + "plugins/applets";
85#ifdef Q_OS_MACX 86#ifdef Q_OS_MACX
86 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); 87 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
87#else 88#else
88 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 89 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
89#endif /* Q_OS_MACX */ 90#endif /* Q_OS_MACX */
90 91
91 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 92 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
92 QString name; 93 QString name;
93 QPixmap icon; 94 QPixmap icon;
94 MenuAppletInterface *iface = 0; 95 MenuAppletInterface *iface = 0;
95 96
96 QLibrary *lib = new QLibrary ( path + "/" + *it ); 97 QLibrary *lib = new QLibrary ( path + "/" + *it );
97 lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); 98 QRESULT retVal = QS_OK;
99 if ((retVal = lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**)(&iface) )) != QS_OK )
100 owarn << "queryInterface failed with " << retVal << oendl;
98 if ( iface ) { 101 if ( iface ) {
99 QString lang = getenv( "LANG" ); 102 QString lang = getenv( "LANG" );
100 QTranslator *trans = new QTranslator ( qApp ); 103 QTranslator *trans = new QTranslator ( qApp );
101 QString type = (*it). left ((*it). find (".")); 104 QString type = (*it). left ((*it). find ("."));
102 QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm"; 105 QString tfn = QPEApplication::qpeDir ( ) + "i18n/" + lang + "/" + type + ".qm";
103 if ( trans-> load ( tfn )) 106 if ( trans-> load ( tfn ))
104 qApp-> installTranslator ( trans ); 107 qApp-> installTranslator ( trans );
105 else 108 else
106 delete trans; 109 delete trans;
107 name = iface-> name ( ); 110 name = iface-> name ( );
108 icon = iface-> icon ( ). pixmap (); 111 icon = iface-> icon ( ). pixmap ();
109 iface-> release ( ); 112 iface-> release ( );
110 lib-> unload ( ); 113 lib-> unload ( );
111 114
112 QCheckListItem *item; 115 QCheckListItem *item;
113 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 116 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
114 if ( !icon. isNull ( )) 117 if ( !icon. isNull ( ))
115 item-> setPixmap ( 0, icon ); 118 item-> setPixmap ( 0, icon );
116 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 119 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
117 m_applets [*it] = item; 120 m_applets [*it] = item;
118 } else { 121 } else {
119 delete lib; 122 delete lib;
120 } 123 }
121 } 124 }