summaryrefslogtreecommitdiff
path: root/core/settings/launcher/taskbarsettings.cpp
Side-by-side diff
Diffstat (limited to 'core/settings/launcher/taskbarsettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/taskbarsettings.cpp196
1 files changed, 100 insertions, 96 deletions
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp
index 43886c9..8dd9e97 100644
--- a/core/settings/launcher/taskbarsettings.cpp
+++ b/core/settings/launcher/taskbarsettings.cpp
@@ -16,7 +16,7 @@
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
-++=   -.     .`     .:
+++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
@@ -28,12 +28,15 @@
#include "taskbarsettings.h"
+/* OPIE */
#include <qpe/config.h>
#include <qpe/qlibrary.h>
#include <qpe/qpeapplication.h>
#include <qpe/taskbarappletinterface.h>
#include <qpe/qcopenvelope_qws.h>
+#include <opie2/odebug.h>
+/* QT */
#include <qdir.h>
#include <qlistview.h>
#include <qheader.h>
@@ -41,132 +44,133 @@
#include <qlabel.h>
#include <qwhatsthis.h>
+/* STD */
#include <stdlib.h>
TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name )
- : QWidget ( parent, name )
+ : QWidget ( parent, name )
{
- m_applets_changed = false;
+ m_applets_changed = false;
- QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
+ QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
- QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this );
- lay-> addWidget ( l );
+ QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this );
+ lay-> addWidget ( l );
- m_list = new QListView ( this );
- m_list-> addColumn ( "foobar" );
- m_list-> header ( )-> hide ( );
+ m_list = new QListView ( this );
+ m_list-> addColumn ( "foobar" );
+ m_list-> header ( )-> hide ( );
- lay-> addWidget ( m_list );
+ lay-> addWidget ( m_list );
- QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." ));
+ QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." ));
- connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged()));
+ connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged()));
- init ( );
+ init ( );
}
void TaskbarSettings::init ( )
{
- Config cfg ( "Taskbar" );
- cfg. setGroup ( "Applets" );
- QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
+ Config cfg ( "Taskbar" );
+ cfg. setGroup ( "Applets" );
+ QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
- QString path = QPEApplication::qpeDir ( ) + "/plugins/applets";
+ QString path = QPEApplication::qpeDir ( ) + "/plugins/applets";
#ifdef Q_OS_MACX
- QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
+ QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
#else
- QStringList list = QDir ( path, "lib*.so" ). entryList ( );
+ QStringList list = QDir ( path, "lib*.so" ). entryList ( );
#endif /* Q_OS_MACX */
- for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
- QString name;
- QPixmap icon;
- TaskbarNamedAppletInterface *iface = 0;
-
- qWarning("Load applet: %s", (*it).latin1() );
- QLibrary *lib = new QLibrary ( path + "/" + *it );
- lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface );
- qWarning("<1>");
- if ( iface ) {
- qWarning("<2>");
- QString lang = getenv( "LANG" );
- QTranslator *trans = new QTranslator ( qApp );
- QString type = (*it). left ((*it). find ("."));
- QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm";
- if ( trans-> load ( tfn ))
- qApp-> installTranslator ( trans );
- else
- delete trans;
- name = iface-> name ( );
- icon = iface-> icon ( );
- iface-> release ( );
- }
- qWarning("<3>");
- if ( !iface ) {
- qWarning("<4>");
- lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface );
-
- if ( iface ) {
- qWarning("<5>");
- name = (*it). mid ( 3 );
- qWarning("Found applet: %s", name.latin1() );
+ for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
+ QString name;
+ QPixmap icon;
+ TaskbarNamedAppletInterface *iface = 0;
+
+ owarn << "Load applet: " << (*it) << "" << oendl;
+ QLibrary *lib = new QLibrary ( path + "/" + *it );
+ lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface );
+ owarn << "<1>" << oendl;
+ if ( iface ) {
+ owarn << "<2>" << oendl;
+ QString lang = getenv( "LANG" );
+ QTranslator *trans = new QTranslator ( qApp );
+ QString type = (*it). left ((*it). find ("."));
+ QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm";
+ if ( trans-> load ( tfn ))
+ qApp-> installTranslator ( trans );
+ else
+ delete trans;
+ name = iface-> name ( );
+ icon = iface-> icon ( );
+ iface-> release ( );
+ }
+ owarn << "<3>" << oendl;
+ if ( !iface ) {
+ owarn << "<4>" << oendl;
+ lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface );
+
+ if ( iface ) {
+ owarn << "<5>" << oendl;
+ name = (*it). mid ( 3 );
+ owarn << "Found applet: " << name << "" << oendl;
#ifdef Q_OS_MACX
- int sep = name. find( ".dylib" );
+ int sep = name. find( ".dylib" );
#else
- int sep = name. find( ".so" );
+ int sep = name. find( ".so" );
#endif /* Q_OS_MACX */
- if ( sep > 0 )
- name. truncate ( sep );
- sep = name. find ( "applet" );
- if ( sep == (int) name.length ( ) - 6 )
- name. truncate ( sep );
- name[0] = name[0]. upper ( );
- iface-> release ( );
- }
- }
- qWarning("<6>");
-
- if ( iface ) {
- qWarning("<7>");
- QCheckListItem *item;
- item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
- if ( !icon. isNull ( ))
- item-> setPixmap ( 0, icon );
- item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
- m_applets [*it] = item;
- }
- lib-> unload ( );
- delete lib;
- }
+ if ( sep > 0 )
+ name. truncate ( sep );
+ sep = name. find ( "applet" );
+ if ( sep == (int) name.length ( ) - 6 )
+ name. truncate ( sep );
+ name[0] = name[0]. upper ( );
+ iface-> release ( );
+ }
+ }
+ owarn << "<6>" << oendl;
+
+ if ( iface ) {
+ owarn << "<7>" << oendl;
+ QCheckListItem *item;
+ item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
+ if ( !icon. isNull ( ))
+ item-> setPixmap ( 0, icon );
+ item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
+ m_applets [*it] = item;
+ }
+ lib-> unload ( );
+ delete lib;
+ }
}
void TaskbarSettings::appletChanged()
{
- m_applets_changed = true;
+ m_applets_changed = true;
}
void TaskbarSettings::accept ( )
{
- Config cfg ( "Taskbar" );
- cfg. setGroup ( "Applets" );
-
- if ( m_applets_changed ) {
- QStringList exclude;
- QMap <QString, QCheckListItem *>::Iterator it;
- for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
- if ( !(*it)-> isOn ( ))
- exclude << it. key ( );
- }
- cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
- }
- cfg. writeEntry ( "SafeMode", false );
- cfg. write ( );
-
- if ( m_applets_changed ) {
- QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" );
- m_applets_changed = false;
- }
+ Config cfg ( "Taskbar" );
+ cfg. setGroup ( "Applets" );
+
+ if ( m_applets_changed ) {
+ QStringList exclude;
+ QMap <QString, QCheckListItem *>::Iterator it;
+ for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
+ if ( !(*it)-> isOn ( ))
+ exclude << it. key ( );
+ }
+ cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
+ }
+ cfg. writeEntry ( "SafeMode", false );
+ cfg. write ( );
+
+ if ( m_applets_changed ) {
+ QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" );
+ m_applets_changed = false;
+ }
}