author | eilers <eilers> | 2003-11-03 16:52:18 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-11-03 16:52:18 (UTC) |
commit | d34dc773591a2d467c68875a68a671d6a809f861 (patch) (unidiff) | |
tree | b57e5ae15c51e3d87ca95d57aedfd1ca3db57bfe /core/settings/launcher | |
parent | ce84f2d8bdd65c438821f0457cdad6bbbfa73380 (diff) | |
download | opie-d34dc773591a2d467c68875a68a671d6a809f861.zip opie-d34dc773591a2d467c68875a68a671d6a809f861.tar.gz opie-d34dc773591a2d467c68875a68a671d6a809f861.tar.bz2 |
Porting Opie to MacOS-X.
The base system and all platform independent applications and platforms
should work.
Please see $OPIEDIR/development/macosx for details
-rw-r--r-- | core/settings/launcher/menusettings.cpp | 4 | ||||
-rw-r--r-- | core/settings/launcher/taskbarsettings.cpp | 17 |
2 files changed, 21 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 | |||
@@ -58,49 +58,53 @@ MenuSettings::MenuSettings ( QWidget *parent, const char *name ) | |||
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 ); |
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 | ||
71 | void TaskbarSettings::init ( ) | 71 | void 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 | ||
129 | void TaskbarSettings::appletChanged() | 146 | void TaskbarSettings::appletChanged() |
130 | { | 147 | { |
131 | m_applets_changed = true; | 148 | m_applets_changed = true; |
132 | } | 149 | } |
133 | 150 | ||
134 | void TaskbarSettings::accept ( ) | 151 | void 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; |