summaryrefslogtreecommitdiff
authorsandman <sandman>2002-10-02 22:15:33 (UTC)
committer sandman <sandman>2002-10-02 22:15:33 (UTC)
commit7e864eb22b5663ad9771b562fbe901042dc68657 (patch) (side-by-side diff)
treec7cc270012ff2aba51308088b51022b2056f9721
parentc8d4ed632ac27261219e5824f988a320b96b8ae2 (diff)
downloadopie-7e864eb22b5663ad9771b562fbe901042dc68657.zip
opie-7e864eb22b5663ad9771b562fbe901042dc68657.tar.gz
opie-7e864eb22b5663ad9771b562fbe901042dc68657.tar.bz2
Launcher settings now also supports the new menu applets interface
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/guisettings.cpp153
-rw-r--r--core/settings/launcher/guisettings.h65
-rw-r--r--core/settings/launcher/launcher.pro4
-rw-r--r--core/settings/launcher/launchersettings.cpp9
-rw-r--r--core/settings/launcher/launchersettings.h4
-rw-r--r--core/settings/launcher/tabssettings.cpp22
-rw-r--r--core/settings/launcher/tabssettings.h5
-rw-r--r--core/settings/launcher/taskbarsettings.cpp68
8 files changed, 70 insertions, 260 deletions
diff --git a/core/settings/launcher/guisettings.cpp b/core/settings/launcher/guisettings.cpp
deleted file mode 100644
index a292663..0000000
--- a/core/settings/launcher/guisettings.cpp
+++ b/dev/null
@@ -1,153 +0,0 @@
-/*
-                This file is part of the OPIE Project
- =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
-             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
-           .>+-=
- _;:,     .>    :=|. This file is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This file is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` 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
-    --        :-=` Free Software Foundation, Inc.,
- 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-*/
-
-#include "guisettings.h"
-
-#include <qpe/config.h>
-#include <qpe/qpeapplication.h>
-#include <qpe/qcopenvelope_qws.h>
-
-#include <qlistview.h>
-#include <qcheckbox.h>
-#include <qheader.h>
-#include <qlayout.h>
-#include <qlabel.h>
-#include <qwhatsthis.h>
-
-#include <stdlib.h>
-
-
-GuiSettings::GuiSettings ( QWidget *parent, const char *name )
- : QWidget ( parent, name )
-{
- m_menu_changed = false;
- m_busy_changed = false;
-
- QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 );
- lay-> addColSpacing ( 0, 16 );
-
- m_omenu = new QCheckBox ( tr( "Show O-Menu" ), this );
- lay-> addMultiCellWidget ( m_omenu, 0, 0, 0, 1 );
-
- m_omenu_tabs = new QCheckBox ( tr( "Add Launcher tabs to O-Menu" ), this );
- lay-> addWidget ( m_omenu_tabs, 1, 1 );
-
- m_omenu_home = new QCheckBox ( tr( "Add 'Home' shortcut to O-Menu" ), this );
- lay-> addWidget ( m_omenu_home, 2, 1 );
-
- m_omenu_suspend = new QCheckBox ( tr( "Add 'Suspend' shortcut to O-Menu" ), this );
- lay-> addWidget ( m_omenu_suspend, 3, 1 );
-
- QWhatsThis::add( m_omenu_tabs, tr( "Adds the contents of the Launcher as menus in the O-Menu." ));
- QWhatsThis::add( m_omenu, tr( "Check if you want the O-Menu in the taskbar." ));
-
- connect ( m_omenu, SIGNAL( toggled ( bool )), m_omenu_tabs, SLOT( setEnabled ( bool )));
- connect ( m_omenu, SIGNAL( toggled ( bool )), m_omenu_home, SLOT( setEnabled ( bool )));
- connect ( m_omenu, SIGNAL( toggled ( bool )), m_omenu_suspend, SLOT( setEnabled ( bool )));
-
- connect ( m_omenu, SIGNAL( toggled ( bool )), this, SLOT( menuChanged ( )));
- connect ( m_omenu_tabs, SIGNAL( toggled ( bool )), this, SLOT( menuChanged ( )));
- connect ( m_omenu_home, SIGNAL( toggled ( bool )), this, SLOT( menuChanged ( )));
- connect ( m_omenu_suspend, SIGNAL( toggled ( bool )), this, SLOT( menuChanged ( )));
-
- lay-> addRowSpacing ( 4, 8 );
-
- m_busy = new QCheckBox ( tr( "Enable blinking busy indicator" ), this );
- lay-> addMultiCellWidget ( m_busy, 5, 5, 0, 1 );
-
- connect ( m_busy, SIGNAL( toggled( bool )), this, SLOT( busyChanged ( )));
-
- lay-> setRowStretch ( 6, 10 );
-
- init ( );
-}
-
-void GuiSettings::init ( )
-{
- Config cfg ( "Taskbar" );
- cfg. setGroup ( "Menu" );
-
- m_omenu-> setChecked ( cfg. readBoolEntry ( "ShowMenu", true ));
- m_omenu_tabs-> setChecked ( cfg. readBoolEntry ( "LauncherTabs", true ));
- m_omenu_home-> setChecked ( cfg. readBoolEntry ( "Home", true ));
- m_omenu_suspend-> setChecked ( cfg. readBoolEntry ( "Suspend", true ));
-
- m_omenu_tabs-> setEnabled ( m_omenu-> isChecked ( ));
- m_omenu_home-> setEnabled ( m_omenu-> isChecked ( ));
- m_omenu_suspend-> setEnabled ( m_omenu-> isChecked ( ));
-
- Config cfg2 ( "Launcher" );
- cfg2. setGroup ( "GUI" );
-
- m_busy-> setChecked ( cfg2. readEntry ( "BusyType" ). lower ( ) == "blink" );
-}
-
-void GuiSettings::menuChanged()
-{
- m_menu_changed = true;
-}
-
-void GuiSettings::busyChanged()
-{
- m_busy_changed = true;
-}
-
-void GuiSettings::accept ( )
-{
- Config cfg ( "Taskbar" );
- cfg. setGroup ( "Menu" );
-
- if ( m_menu_changed ) {
- cfg. writeEntry ( "ShowMenu", m_omenu-> isChecked ( ));
- cfg. writeEntry ( "LauncherTabs", m_omenu_tabs-> isChecked ( ));
- cfg. writeEntry ( "Home", m_omenu_home-> isChecked ( ));
- cfg. writeEntry ( "Suspend", m_omenu_suspend-> isChecked ( ));
- }
- cfg. write ( );
-
- if ( m_menu_changed )
- QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" );
-
- Config cfg2 ( "Launcher" );
- cfg2. setGroup ( "GUI" );
-
- QString busytype = QString ( m_busy-> isChecked ( ) ? "blink" : "" );
-
- if ( m_busy_changed ) {
-
- cfg2. writeEntry ( "BusyType", busytype );
- }
-
- cfg2. write ( );
-
- if ( m_busy_changed ) {
- QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" );
- e << busytype;
- }
-}
-
diff --git a/core/settings/launcher/guisettings.h b/core/settings/launcher/guisettings.h
deleted file mode 100644
index 2673981..0000000
--- a/core/settings/launcher/guisettings.h
+++ b/dev/null
@@ -1,65 +0,0 @@
-/*
-               =. This file is part of the OPIE Project
-             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
-           .>+-=
- _;:,     .>    :=|. This file is free software; you can
-.> <`_,   >  .   <= redistribute it and/or modify it under
-:`=1 )Y*s>-.--   : the terms of the GNU General Public
-.="- .-=="i,     .._ License as published by the Free Software
- - .   .-<_>     .<> Foundation; either version 2 of the License,
-     ._= =}       : or (at your option) any later version.
-    .%`+i>       _;_.
-    .i_,=:_.      -<s. This file is distributed in the hope that
-     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
-    : ..    .:,     . . . without even the implied warranty of
-    =_        +     =;=|` 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
-    --        :-=` Free Software Foundation, Inc.,
- 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-*/
-
-#ifndef __GUI_SETTINGS_H__
-#define __GUI_SETTINGS_H__
-
-#include <qwidget.h>
-#include <qmap.h>
-
-class QListView;
-class QCheckListItem;
-class QCheckBox;
-
-
-class GuiSettings : public QWidget {
- Q_OBJECT
-
-public:
- GuiSettings ( QWidget *parent = 0, const char *name = 0 );
-
- void accept ( );
-
-protected slots:
- void menuChanged ( );
- void busyChanged ( );
-
-protected:
- void init ( );
-
-private:
- QCheckBox *m_omenu;
- QCheckBox *m_omenu_tabs;
- QCheckBox *m_omenu_home;
- QCheckBox *m_omenu_suspend;
- QCheckBox *m_busy;
-
- bool m_menu_changed;
- bool m_busy_changed;
-};
-
-#endif
diff --git a/core/settings/launcher/launcher.pro b/core/settings/launcher/launcher.pro
index 0554d0a..1c72126 100644
--- a/core/settings/launcher/launcher.pro
+++ b/core/settings/launcher/launcher.pro
@@ -1,22 +1,22 @@
TEMPLATE = app
CONFIG += qt warn_on release
DESTDIR = $(OPIEDIR)/bin
HEADERS = launchersettings.h \
tabssettings.h \
taskbarsettings.h \
- guisettings.h \
+ menusettings.h \
tabconfig.h \
tabdialog.h
SOURCES = main.cpp \
launchersettings.cpp \
tabssettings.cpp \
taskbarsettings.cpp \
- guisettings.cpp \
+ menusettings.cpp \
tabdialog.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
TARGET = launchersettings
diff --git a/core/settings/launcher/launchersettings.cpp b/core/settings/launcher/launchersettings.cpp
index 22bf1d1..c32d998 100644
--- a/core/settings/launcher/launchersettings.cpp
+++ b/core/settings/launcher/launchersettings.cpp
@@ -5,67 +5,68 @@
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` 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
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qlayout.h>
+#include <qapplication.h>
#include <opie/otabwidget.h>
#include "launchersettings.h"
#include "tabssettings.h"
+#include "menusettings.h"
#include "taskbarsettings.h"
-#include "guisettings.h"
LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false )
{
setCaption ( tr( "Launcher Settings" ));
QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
OTabWidget *tw = new OTabWidget ( this, "otab" );
lay-> addWidget ( tw );
m_tabs = new TabsSettings ( tw );
m_taskbar = new TaskbarSettings ( tw );
- m_gui = new GuiSettings ( tw );
+ m_menu = new MenuSettings ( tw );
tw-> addTab ( m_taskbar, "launchersettings/taskbartab.png", tr( "Taskbar" ));
+ tw-> addTab ( m_menu, "launchersettings/menutab.png", tr( "O-Menu" ));
tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" ));
- tw-> addTab ( m_gui, "launchersettings/guitab.png", tr( "GUI" ));
tw-> setCurrentTab ( m_taskbar );
}
void LauncherSettings::accept ( )
{
m_taskbar-> accept ( );
+ m_menu-> accept ( );
m_tabs-> accept ( );
- m_gui-> accept ( );
QDialog::accept ( );
}
void LauncherSettings::done ( int r )
{
QDialog::done ( r );
close ( );
}
diff --git a/core/settings/launcher/launchersettings.h b/core/settings/launcher/launchersettings.h
index fa9977e..56c916e 100644
--- a/core/settings/launcher/launchersettings.h
+++ b/core/settings/launcher/launchersettings.h
@@ -11,42 +11,42 @@
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` 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
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __LAUNCHER_SETTINGS_H__
#define __LAUNCHER_SETTINGS_H__
#include <qdialog.h>
class TabsSettings;
class TaskbarSettings;
-class GuiSettings;
+class MenuSettings;
class LauncherSettings : public QDialog {
Q_OBJECT
public:
LauncherSettings ( );
virtual void accept ( );
virtual void done ( int r );
private:
TabsSettings *m_tabs;
TaskbarSettings *m_taskbar;
- GuiSettings *m_gui;
+ MenuSettings *m_menu;
};
#endif
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index 8f5f7fa..6cc69c0 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -18,108 +18,116 @@
++=   -.     .`     .:
 :     =  ...= . :.=- 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
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "tabssettings.h"
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/applnk.h>
#include <qpe/mimetype.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/config.h>
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qwhatsthis.h>
+#include <qcheckbox.h>
#include "tabdialog.h"
#include <stdlib.h>
#include <qmessagebox.h>
TabsSettings::TabsSettings ( QWidget *parent, const char *name )
: QWidget ( parent, name )
{
QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 );
QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this );
lay-> addMultiCellWidget ( l, 0, 0, 0, 1 );
m_list = new QListBox ( this );
lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 );
QWhatsThis::add ( m_list, tr( "foobar" ));
QPushButton *p;
p = new QPushButton ( tr( "New" ), this );
lay-> addWidget ( p, 1, 1 );
connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( )));
p = new QPushButton ( tr( "Edit" ), this );
lay-> addWidget ( p, 2, 1 );
connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( )));
p = new QPushButton ( tr( "Delete" ), this );
lay-> addWidget ( p, 3, 1 );
connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( )));
lay-> setRowStretch ( 4, 10 );
+ m_busyblink = new QCheckBox ( tr( "Enable blinking busy indicator" ), this );
+ lay-> addMultiCellWidget ( m_busyblink, 5, 5, 0, 1 );
+
init ( );
}
void TabsSettings::init ( )
{
AppLnkSet rootFolder( MimeType::appsFolderName ( ));
QStringList types = rootFolder. types ( );
for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) {
m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it ));
m_ids << *it;
}
QImage img ( Resource::loadImage ( "DocsIcon" ));
QPixmap pix;
pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( ));
m_list-> insertItem ( pix, tr( "Documents" ));
m_ids += "Documents"; // No tr
- readTabSettings ( );
+ Config cfg ( "Launcher" );
+
+ readTabSettings ( cfg );
+
+ cfg. setGroup ( "GUI" );
+ m_busyblink-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "blink" );
}
-void TabsSettings::readTabSettings ( )
+void TabsSettings::readTabSettings ( Config &cfg )
{
- Config cfg ( "Launcher" );
QString grp ( "Tab %1" ); // No tr
m_tabs. clear ( );
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
TabConfig tc;
tc. m_view = TabConfig::Icon;
tc. m_bg_type = TabConfig::Ruled;
tc. m_changed = false;
cfg. setGroup ( grp. arg ( *it ));
QString view = cfg. readEntry ( "View", "Icon" );
if ( view == "List" ) // No tr
tc. m_view = TabConfig::List;
QString bgType = cfg. readEntry ( "BackgroundType", "Image" );
if ( bgType == "SolidColor" )
tc. m_bg_type = TabConfig::SolidColor;
else if ( bgType == "Image" ) // No tr
tc. m_bg_type = TabConfig::Image;
tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "launcher/opie-background" );
tc. m_bg_color = cfg. readEntry ( "BackgroundColor", colorGroup ( ). color ( QColorGroup::Base ). name ( ));
tc. m_text_color = cfg. readEntry ( "TextColor", colorGroup ( ). color ( QColorGroup::Text ). name ( ));
@@ -177,48 +185,56 @@ void TabsSettings::accept ( )
case TabConfig::Ruled:
cfg.writeEntry( "BackgroundType", "Ruled" );
be << *it << tc. m_bg_type << QString("");
break;
case TabConfig::SolidColor:
cfg.writeEntry( "BackgroundType", "SolidColor" );
be << *it << tc. m_bg_type << tc. m_bg_color;
break;
case TabConfig::Image:
cfg.writeEntry( "BackgroundType", "Image" );
be << *it << tc. m_bg_type << tc. m_bg_image;
break;
}
QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" );
te << *it << tc. m_text_color;
QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" );
fe << *it << tc. m_font_family;
fe << tc. m_font_size;
fe << tc. m_font_weight << ( tc. m_font_italic ? 1 : 0 );
tc. m_changed = false;
}
+ cfg. setGroup ( "GUI" );
+ QString busytype = QString ( m_busyblink-> isChecked ( ) ? "blink" : "" );
+
+ cfg. writeEntry ( "BusyType", busytype );
+ {
+ QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" );
+ e << busytype;
+ }
}
void TabsSettings::newClicked ( )
{
QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
}
void TabsSettings::deleteClicked ( )
{
int ind = m_list-> currentItem ( );
if ( ind < 0 )
return;
QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
}
void TabsSettings::editClicked ( )
{
int ind = m_list-> currentItem ( );
if ( ind < 0 )
return;
diff --git a/core/settings/launcher/tabssettings.h b/core/settings/launcher/tabssettings.h
index b17b523..47fcee2 100644
--- a/core/settings/launcher/tabssettings.h
+++ b/core/settings/launcher/tabssettings.h
@@ -12,54 +12,57 @@
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` 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
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __TABS_SETTINGS_H__
#define __TABS_SETTINGS_H__
#include <qwidget.h>
#include <qmap.h>
#include "tabconfig.h"
class QListBox;
+class QCheckBox;
+class Config;
class TabsSettings : public QWidget {
Q_OBJECT
public:
TabsSettings ( QWidget *parent = 0, const char *name = 0 );
void accept ( );
protected slots:
void newClicked ( );
void deleteClicked ( );
void editClicked ( );
protected:
void init ( );
- void readTabSettings ( );
+ void readTabSettings ( Config & );
private:
QListBox *m_list;
// QString currentTab;
QStringList m_ids;
QMap <QString, TabConfig> m_tabs;
+ QCheckBox *m_busyblink;
};
#endif
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
@@ -31,111 +31,119 @@
#include <qpe/config.h>
#include <qpe/qlibrary.h>
#include <qpe/qpeapplication.h>
#include <qpe/taskbarappletinterface.h>
#include <qpe/qcopenvelope_qws.h>
#include <qdir.h>
#include <qlistview.h>
#include <qcheckbox.h>
#include <qheader.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qwhatsthis.h>
#include <stdlib.h>
TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name )
: QWidget ( parent, name )
{
m_applets_changed = false;
QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
- QLabel *l = new QLabel ( tr( "Load applets:" ), this );
+ 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 ( );
lay-> addWidget ( m_list );
QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." ));
connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( )));
init ( );
}
void TaskbarSettings::init ( )
{
Config cfg ( "Taskbar" );
cfg. setGroup ( "Applets" );
QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
QString path = QPEApplication::qpeDir ( ) + "/plugins/applets";
QStringList list = QDir ( path, "lib*.so" ). entryList ( );
for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
QString name;
QPixmap icon;
TaskbarNamedAppletInterface *iface = 0;
QLibrary *lib = new QLibrary ( path + "/" + *it );
lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface );
- if ( iface ) {
-
- 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 ( );
+ if ( iface ) {
+ 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 ( );
- lib-> unload ( );
- } else {
- delete lib;
- name = (*it). mid ( 3 );
- int sep = name. find( ".so" );
- if ( sep > 0 )
- name. truncate ( sep );
- sep = name. find ( "applet" );
- if ( sep == (int) name.length ( ) - 6 )
- name. truncate ( sep );
- name[0] = name[0]. upper ( );
}
- 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;
+ if ( !iface ) {
+ lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface );
+
+ if ( iface ) {
+ name = (*it). mid ( 3 );
+ int sep = name. find( ".so" );
+ 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 ( );
+ }
+ }
+
+ if ( iface ) {
+ 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;
}
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 ( );