Diffstat (limited to 'core/settings/launcher/menusettings.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/settings/launcher/menusettings.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp index 5a9fada..6fca621 100644 --- a/core/settings/launcher/menusettings.cpp +++ b/core/settings/launcher/menusettings.cpp | |||
@@ -34,97 +34,101 @@ | |||
34 | #include <qpe/menuappletinterface.h> | 34 | #include <qpe/menuappletinterface.h> |
35 | #include <qpe/qcopenvelope_qws.h> | 35 | #include <qpe/qcopenvelope_qws.h> |
36 | 36 | ||
37 | #include <qdir.h> | 37 | #include <qdir.h> |
38 | #include <qlistview.h> | 38 | #include <qlistview.h> |
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qheader.h> | 40 | #include <qheader.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
43 | #include <qwhatsthis.h> | 43 | #include <qwhatsthis.h> |
44 | 44 | ||
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | 46 | ||
47 | 47 | ||
48 | MenuSettings::MenuSettings ( QWidget *parent, const char *name ) | 48 | MenuSettings::MenuSettings ( 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 in O-Menu:" ), this ); | 55 | QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), 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 | m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this ); | 64 | m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this ); |
65 | lay-> addWidget ( m_menutabs ); | 65 | lay-> addWidget ( m_menutabs ); |
66 | 66 | ||
67 | QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." )); | 67 | QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." )); |
68 | QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." )); | 68 | QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." )); |
69 | 69 | ||
70 | connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); | 70 | connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); |
71 | 71 | ||
72 | init ( ); | 72 | init ( ); |
73 | } | 73 | } |
74 | 74 | ||
75 | void MenuSettings::init ( ) | 75 | void MenuSettings::init ( ) |
76 | { | 76 | { |
77 | Config cfg ( "StartMenu" ); | 77 | Config cfg ( "StartMenu" ); |
78 | cfg. setGroup ( "Applets" ); | 78 | cfg. setGroup ( "Applets" ); |
79 | QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); | 79 | QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); |
80 | 80 | ||
81 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; | 81 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; |
82 | #ifdef Q_OS_MACX | ||
83 | QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); | ||
84 | #else | ||
82 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); | 85 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); |
86 | #endif /* Q_OS_MACX */ | ||
83 | 87 | ||
84 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { | 88 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { |
85 | QString name; | 89 | QString name; |
86 | QPixmap icon; | 90 | QPixmap icon; |
87 | MenuAppletInterface *iface = 0; | 91 | MenuAppletInterface *iface = 0; |
88 | 92 | ||
89 | QLibrary *lib = new QLibrary ( path + "/" + *it ); | 93 | QLibrary *lib = new QLibrary ( path + "/" + *it ); |
90 | lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); | 94 | lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); |
91 | if ( iface ) { | 95 | if ( iface ) { |
92 | QString lang = getenv( "LANG" ); | 96 | QString lang = getenv( "LANG" ); |
93 | QTranslator *trans = new QTranslator ( qApp ); | 97 | QTranslator *trans = new QTranslator ( qApp ); |
94 | QString type = (*it). left ((*it). find (".")); | 98 | QString type = (*it). left ((*it). find (".")); |
95 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; | 99 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; |
96 | if ( trans-> load ( tfn )) | 100 | if ( trans-> load ( tfn )) |
97 | qApp-> installTranslator ( trans ); | 101 | qApp-> installTranslator ( trans ); |
98 | else | 102 | else |
99 | delete trans; | 103 | delete trans; |
100 | name = iface-> name ( ); | 104 | name = iface-> name ( ); |
101 | icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); | 105 | icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); |
102 | iface-> release ( ); | 106 | iface-> release ( ); |
103 | lib-> unload ( ); | 107 | lib-> unload ( ); |
104 | 108 | ||
105 | QCheckListItem *item; | 109 | QCheckListItem *item; |
106 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); | 110 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); |
107 | if ( !icon. isNull ( )) | 111 | if ( !icon. isNull ( )) |
108 | item-> setPixmap ( 0, icon ); | 112 | item-> setPixmap ( 0, icon ); |
109 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); | 113 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); |
110 | m_applets [*it] = item; | 114 | m_applets [*it] = item; |
111 | } else { | 115 | } else { |
112 | delete lib; | 116 | delete lib; |
113 | } | 117 | } |
114 | } | 118 | } |
115 | 119 | ||
116 | cfg. setGroup ( "Menu" ); | 120 | cfg. setGroup ( "Menu" ); |
117 | m_menutabs-> setChecked ( cfg. readBoolEntry ( "LauncherTabs", true )); | 121 | m_menutabs-> setChecked ( cfg. readBoolEntry ( "LauncherTabs", true )); |
118 | } | 122 | } |
119 | 123 | ||
120 | void MenuSettings::appletChanged() | 124 | void MenuSettings::appletChanged() |
121 | { | 125 | { |
122 | m_applets_changed = true; | 126 | m_applets_changed = true; |
123 | } | 127 | } |
124 | 128 | ||
125 | void MenuSettings::accept ( ) | 129 | void MenuSettings::accept ( ) |
126 | { | 130 | { |
127 | bool apps_changed = false; | 131 | bool apps_changed = false; |
128 | 132 | ||
129 | Config cfg ( "StartMenu" ); | 133 | Config cfg ( "StartMenu" ); |
130 | cfg. setGroup ( "Applets" ); | 134 | cfg. setGroup ( "Applets" ); |