summaryrefslogtreecommitdiff
authorsandman <sandman>2002-10-02 22:15:33 (UTC)
committer sandman <sandman>2002-10-02 22:15:33 (UTC)
commit7e864eb22b5663ad9771b562fbe901042dc68657 (patch) (unidiff)
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 @@
1/*
2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28
29#include "guisettings.h"
30
31#include <qpe/config.h>
32#include <qpe/qpeapplication.h>
33#include <qpe/qcopenvelope_qws.h>
34
35#include <qlistview.h>
36#include <qcheckbox.h>
37#include <qheader.h>
38#include <qlayout.h>
39#include <qlabel.h>
40#include <qwhatsthis.h>
41
42#include <stdlib.h>
43
44
45GuiSettings::GuiSettings ( QWidget *parent, const char *name )
46 : QWidget ( parent, name )
47{
48 m_menu_changed = false;
49 m_busy_changed = false;
50
51 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 );
52 lay-> addColSpacing ( 0, 16 );
53
54 m_omenu = new QCheckBox ( tr( "Show O-Menu" ), this );
55 lay-> addMultiCellWidget ( m_omenu, 0, 0, 0, 1 );
56
57 m_omenu_tabs = new QCheckBox ( tr( "Add Launcher tabs to O-Menu" ), this );
58 lay-> addWidget ( m_omenu_tabs, 1, 1 );
59
60 m_omenu_home = new QCheckBox ( tr( "Add 'Home' shortcut to O-Menu" ), this );
61 lay-> addWidget ( m_omenu_home, 2, 1 );
62
63 m_omenu_suspend = new QCheckBox ( tr( "Add 'Suspend' shortcut to O-Menu" ), this );
64 lay-> addWidget ( m_omenu_suspend, 3, 1 );
65
66 QWhatsThis::add( m_omenu_tabs, tr( "Adds the contents of the Launcher as menus in the O-Menu." ));
67 QWhatsThis::add( m_omenu, tr( "Check if you want the O-Menu in the taskbar." ));
68
69 connect ( m_omenu, SIGNAL( toggled ( bool )), m_omenu_tabs, SLOT( setEnabled ( bool )));
70 connect ( m_omenu, SIGNAL( toggled ( bool )), m_omenu_home, SLOT( setEnabled ( bool )));
71 connect ( m_omenu, SIGNAL( toggled ( bool )), m_omenu_suspend, SLOT( setEnabled ( bool )));
72
73 connect ( m_omenu, SIGNAL( toggled ( bool )), this, SLOT( menuChanged ( )));
74 connect ( m_omenu_tabs, SIGNAL( toggled ( bool )), this, SLOT( menuChanged ( )));
75 connect ( m_omenu_home, SIGNAL( toggled ( bool )), this, SLOT( menuChanged ( )));
76 connect ( m_omenu_suspend, SIGNAL( toggled ( bool )), this, SLOT( menuChanged ( )));
77
78 lay-> addRowSpacing ( 4, 8 );
79
80 m_busy = new QCheckBox ( tr( "Enable blinking busy indicator" ), this );
81 lay-> addMultiCellWidget ( m_busy, 5, 5, 0, 1 );
82
83 connect ( m_busy, SIGNAL( toggled( bool )), this, SLOT( busyChanged ( )));
84
85 lay-> setRowStretch ( 6, 10 );
86
87 init ( );
88}
89
90void GuiSettings::init ( )
91{
92 Config cfg ( "Taskbar" );
93 cfg. setGroup ( "Menu" );
94
95 m_omenu-> setChecked ( cfg. readBoolEntry ( "ShowMenu", true ));
96 m_omenu_tabs-> setChecked ( cfg. readBoolEntry ( "LauncherTabs", true ));
97 m_omenu_home-> setChecked ( cfg. readBoolEntry ( "Home", true ));
98 m_omenu_suspend-> setChecked ( cfg. readBoolEntry ( "Suspend", true ));
99
100 m_omenu_tabs-> setEnabled ( m_omenu-> isChecked ( ));
101 m_omenu_home-> setEnabled ( m_omenu-> isChecked ( ));
102 m_omenu_suspend-> setEnabled ( m_omenu-> isChecked ( ));
103
104 Config cfg2 ( "Launcher" );
105 cfg2. setGroup ( "GUI" );
106
107 m_busy-> setChecked ( cfg2. readEntry ( "BusyType" ). lower ( ) == "blink" );
108}
109
110void GuiSettings::menuChanged()
111{
112 m_menu_changed = true;
113}
114
115void GuiSettings::busyChanged()
116{
117 m_busy_changed = true;
118}
119
120void GuiSettings::accept ( )
121{
122 Config cfg ( "Taskbar" );
123 cfg. setGroup ( "Menu" );
124
125 if ( m_menu_changed ) {
126 cfg. writeEntry ( "ShowMenu", m_omenu-> isChecked ( ));
127 cfg. writeEntry ( "LauncherTabs", m_omenu_tabs-> isChecked ( ));
128 cfg. writeEntry ( "Home", m_omenu_home-> isChecked ( ));
129 cfg. writeEntry ( "Suspend", m_omenu_suspend-> isChecked ( ));
130 }
131 cfg. write ( );
132
133 if ( m_menu_changed )
134 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" );
135
136 Config cfg2 ( "Launcher" );
137 cfg2. setGroup ( "GUI" );
138
139 QString busytype = QString ( m_busy-> isChecked ( ) ? "blink" : "" );
140
141 if ( m_busy_changed ) {
142
143 cfg2. writeEntry ( "BusyType", busytype );
144 }
145
146 cfg2. write ( );
147
148 if ( m_busy_changed ) {
149 QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" );
150 e << busytype;
151 }
152}
153
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 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA.
25
26*/
27
28#ifndef __GUI_SETTINGS_H__
29#define __GUI_SETTINGS_H__
30
31#include <qwidget.h>
32#include <qmap.h>
33
34class QListView;
35class QCheckListItem;
36class QCheckBox;
37
38
39class GuiSettings : public QWidget {
40 Q_OBJECT
41
42public:
43 GuiSettings ( QWidget *parent = 0, const char *name = 0 );
44
45 void accept ( );
46
47protected slots:
48 void menuChanged ( );
49 void busyChanged ( );
50
51protected:
52 void init ( );
53
54private:
55 QCheckBox *m_omenu;
56 QCheckBox *m_omenu_tabs;
57 QCheckBox *m_omenu_home;
58 QCheckBox *m_omenu_suspend;
59 QCheckBox *m_busy;
60
61 bool m_menu_changed;
62 bool m_busy_changed;
63};
64
65#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 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/bin 3DESTDIR = $(OPIEDIR)/bin
4HEADERS = launchersettings.h \ 4HEADERS = launchersettings.h \
5 tabssettings.h \ 5 tabssettings.h \
6 taskbarsettings.h \ 6 taskbarsettings.h \
7 guisettings.h \ 7 menusettings.h \
8 tabconfig.h \ 8 tabconfig.h \
9 tabdialog.h 9 tabdialog.h
10 10
11SOURCES = main.cpp \ 11SOURCES = main.cpp \
12 launchersettings.cpp \ 12 launchersettings.cpp \
13 tabssettings.cpp \ 13 tabssettings.cpp \
14 taskbarsettings.cpp \ 14 taskbarsettings.cpp \
15 guisettings.cpp \ 15 menusettings.cpp \
16 tabdialog.cpp 16 tabdialog.cpp
17 17
18INCLUDEPATH += $(OPIEDIR)/include 18INCLUDEPATH += $(OPIEDIR)/include
19DEPENDPATH += $(OPIEDIR)/include 19DEPENDPATH += $(OPIEDIR)/include
20LIBS += -lqpe -lopie 20LIBS += -lqpe -lopie
21TARGET = launchersettings 21TARGET = launchersettings
22 22
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
@@ -1,71 +1,72 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qapplication.h>
29 30
30#include <opie/otabwidget.h> 31#include <opie/otabwidget.h>
31 32
32#include "launchersettings.h" 33#include "launchersettings.h"
33#include "tabssettings.h" 34#include "tabssettings.h"
35#include "menusettings.h"
34#include "taskbarsettings.h" 36#include "taskbarsettings.h"
35#include "guisettings.h"
36 37
37 38
38LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false ) 39LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false )
39{ 40{
40 setCaption ( tr( "Launcher Settings" )); 41 setCaption ( tr( "Launcher Settings" ));
41 42
42 QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 43 QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
43 44
44 OTabWidget *tw = new OTabWidget ( this, "otab" ); 45 OTabWidget *tw = new OTabWidget ( this, "otab" );
45 lay-> addWidget ( tw ); 46 lay-> addWidget ( tw );
46 47
47 m_tabs = new TabsSettings ( tw ); 48 m_tabs = new TabsSettings ( tw );
48 m_taskbar = new TaskbarSettings ( tw ); 49 m_taskbar = new TaskbarSettings ( tw );
49 m_gui = new GuiSettings ( tw ); 50 m_menu = new MenuSettings ( tw );
50 51
51 tw-> addTab ( m_taskbar, "launchersettings/taskbartab.png", tr( "Taskbar" )); 52 tw-> addTab ( m_taskbar, "launchersettings/taskbartab.png", tr( "Taskbar" ));
53 tw-> addTab ( m_menu, "launchersettings/menutab.png", tr( "O-Menu" ));
52 tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" )); 54 tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" ));
53 tw-> addTab ( m_gui, "launchersettings/guitab.png", tr( "GUI" ));
54 55
55 tw-> setCurrentTab ( m_taskbar ); 56 tw-> setCurrentTab ( m_taskbar );
56} 57}
57 58
58void LauncherSettings::accept ( ) 59void LauncherSettings::accept ( )
59{ 60{
60 m_taskbar-> accept ( ); 61 m_taskbar-> accept ( );
62 m_menu-> accept ( );
61 m_tabs-> accept ( ); 63 m_tabs-> accept ( );
62 m_gui-> accept ( );
63 64
64 QDialog::accept ( ); 65 QDialog::accept ( );
65} 66}
66 67
67void LauncherSettings::done ( int r ) 68void LauncherSettings::done ( int r )
68{ 69{
69 QDialog::done ( r ); 70 QDialog::done ( r );
70 close ( ); 71 close ( );
71} 72}
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
@@ -1,52 +1,52 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#ifndef __LAUNCHER_SETTINGS_H__ 28#ifndef __LAUNCHER_SETTINGS_H__
29#define __LAUNCHER_SETTINGS_H__ 29#define __LAUNCHER_SETTINGS_H__
30 30
31#include <qdialog.h> 31#include <qdialog.h>
32 32
33class TabsSettings; 33class TabsSettings;
34class TaskbarSettings; 34class TaskbarSettings;
35class GuiSettings; 35class MenuSettings;
36 36
37class LauncherSettings : public QDialog { 37class LauncherSettings : public QDialog {
38 Q_OBJECT 38 Q_OBJECT
39 39
40public: 40public:
41 LauncherSettings ( ); 41 LauncherSettings ( );
42 42
43 virtual void accept ( ); 43 virtual void accept ( );
44 virtual void done ( int r ); 44 virtual void done ( int r );
45 45
46private: 46private:
47 TabsSettings *m_tabs; 47 TabsSettings *m_tabs;
48 TaskbarSettings *m_taskbar; 48 TaskbarSettings *m_taskbar;
49 GuiSettings *m_gui; 49 MenuSettings *m_menu;
50}; 50};
51 51
52#endif 52#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
@@ -1,149 +1,157 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#include "tabssettings.h" 28#include "tabssettings.h"
29 29
30#include <qpe/qpeapplication.h> 30#include <qpe/qpeapplication.h>
31#include <qpe/resource.h> 31#include <qpe/resource.h>
32#include <qpe/applnk.h> 32#include <qpe/applnk.h>
33#include <qpe/mimetype.h> 33#include <qpe/mimetype.h>
34#include <qpe/qcopenvelope_qws.h> 34#include <qpe/qcopenvelope_qws.h>
35#include <qpe/config.h> 35#include <qpe/config.h>
36 36
37#include <qlistbox.h> 37#include <qlistbox.h>
38#include <qpushbutton.h> 38#include <qpushbutton.h>
39#include <qlayout.h> 39#include <qlayout.h>
40#include <qlabel.h> 40#include <qlabel.h>
41#include <qwhatsthis.h> 41#include <qwhatsthis.h>
42#include <qcheckbox.h>
42 43
43#include "tabdialog.h" 44#include "tabdialog.h"
44 45
45#include <stdlib.h> 46#include <stdlib.h>
46#include <qmessagebox.h> 47#include <qmessagebox.h>
47 48
48 49
49 50
50TabsSettings::TabsSettings ( QWidget *parent, const char *name ) 51TabsSettings::TabsSettings ( QWidget *parent, const char *name )
51 : QWidget ( parent, name ) 52 : QWidget ( parent, name )
52{ 53{
53 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); 54 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 );
54 55
55 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); 56 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this );
56 lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); 57 lay-> addMultiCellWidget ( l, 0, 0, 0, 1 );
57 58
58 m_list = new QListBox ( this ); 59 m_list = new QListBox ( this );
59 lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); 60 lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 );
60 61
61 QWhatsThis::add ( m_list, tr( "foobar" )); 62 QWhatsThis::add ( m_list, tr( "foobar" ));
62 63
63 QPushButton *p; 64 QPushButton *p;
64 p = new QPushButton ( tr( "New" ), this ); 65 p = new QPushButton ( tr( "New" ), this );
65 lay-> addWidget ( p, 1, 1 ); 66 lay-> addWidget ( p, 1, 1 );
66 connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); 67 connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( )));
67 68
68 p = new QPushButton ( tr( "Edit" ), this ); 69 p = new QPushButton ( tr( "Edit" ), this );
69 lay-> addWidget ( p, 2, 1 ); 70 lay-> addWidget ( p, 2, 1 );
70 connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); 71 connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( )));
71 72
72 p = new QPushButton ( tr( "Delete" ), this ); 73 p = new QPushButton ( tr( "Delete" ), this );
73 lay-> addWidget ( p, 3, 1 ); 74 lay-> addWidget ( p, 3, 1 );
74 connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); 75 connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( )));
75 76
76 lay-> setRowStretch ( 4, 10 ); 77 lay-> setRowStretch ( 4, 10 );
77 78
79 m_busyblink = new QCheckBox ( tr( "Enable blinking busy indicator" ), this );
80 lay-> addMultiCellWidget ( m_busyblink, 5, 5, 0, 1 );
81
78 init ( ); 82 init ( );
79} 83}
80 84
81void TabsSettings::init ( ) 85void TabsSettings::init ( )
82{ 86{
83 AppLnkSet rootFolder( MimeType::appsFolderName ( )); 87 AppLnkSet rootFolder( MimeType::appsFolderName ( ));
84 QStringList types = rootFolder. types ( ); 88 QStringList types = rootFolder. types ( );
85 89
86 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { 90 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) {
87 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); 91 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it ));
88 m_ids << *it; 92 m_ids << *it;
89 } 93 }
90 QImage img ( Resource::loadImage ( "DocsIcon" )); 94 QImage img ( Resource::loadImage ( "DocsIcon" ));
91 QPixmap pix; 95 QPixmap pix;
92 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); 96 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( ));
93 m_list-> insertItem ( pix, tr( "Documents" )); 97 m_list-> insertItem ( pix, tr( "Documents" ));
94 m_ids += "Documents"; // No tr 98 m_ids += "Documents"; // No tr
95 99
96 readTabSettings ( ); 100 Config cfg ( "Launcher" );
101
102 readTabSettings ( cfg );
103
104 cfg. setGroup ( "GUI" );
105 m_busyblink-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "blink" );
97} 106}
98 107
99void TabsSettings::readTabSettings ( ) 108void TabsSettings::readTabSettings ( Config &cfg )
100{ 109{
101 Config cfg ( "Launcher" );
102 QString grp ( "Tab %1" ); // No tr 110 QString grp ( "Tab %1" ); // No tr
103 m_tabs. clear ( ); 111 m_tabs. clear ( );
104 112
105 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 113 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
106 TabConfig tc; 114 TabConfig tc;
107 tc. m_view = TabConfig::Icon; 115 tc. m_view = TabConfig::Icon;
108 tc. m_bg_type = TabConfig::Ruled; 116 tc. m_bg_type = TabConfig::Ruled;
109 tc. m_changed = false; 117 tc. m_changed = false;
110 118
111 cfg. setGroup ( grp. arg ( *it )); 119 cfg. setGroup ( grp. arg ( *it ));
112 120
113 QString view = cfg. readEntry ( "View", "Icon" ); 121 QString view = cfg. readEntry ( "View", "Icon" );
114 if ( view == "List" ) // No tr 122 if ( view == "List" ) // No tr
115 tc. m_view = TabConfig::List; 123 tc. m_view = TabConfig::List;
116 124
117 QString bgType = cfg. readEntry ( "BackgroundType", "Image" ); 125 QString bgType = cfg. readEntry ( "BackgroundType", "Image" );
118 if ( bgType == "SolidColor" ) 126 if ( bgType == "SolidColor" )
119 tc. m_bg_type = TabConfig::SolidColor; 127 tc. m_bg_type = TabConfig::SolidColor;
120 else if ( bgType == "Image" ) // No tr 128 else if ( bgType == "Image" ) // No tr
121 tc. m_bg_type = TabConfig::Image; 129 tc. m_bg_type = TabConfig::Image;
122 130
123 tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "launcher/opie-background" ); 131 tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "launcher/opie-background" );
124 tc. m_bg_color = cfg. readEntry ( "BackgroundColor", colorGroup ( ). color ( QColorGroup::Base ). name ( )); 132 tc. m_bg_color = cfg. readEntry ( "BackgroundColor", colorGroup ( ). color ( QColorGroup::Base ). name ( ));
125 tc. m_text_color = cfg. readEntry ( "TextColor", colorGroup ( ). color ( QColorGroup::Text ). name ( )); 133 tc. m_text_color = cfg. readEntry ( "TextColor", colorGroup ( ). color ( QColorGroup::Text ). name ( ));
126 QStringList f = cfg. readListEntry ( "Font", ',' ); 134 QStringList f = cfg. readListEntry ( "Font", ',' );
127 if ( f. count ( ) == 4 ) { 135 if ( f. count ( ) == 4 ) {
128 tc. m_font_family = f [0]; 136 tc. m_font_family = f [0];
129 tc. m_font_size = f [1]. toInt ( ); 137 tc. m_font_size = f [1]. toInt ( );
130 tc. m_font_weight = f [2]. toInt ( ); 138 tc. m_font_weight = f [2]. toInt ( );
131 tc. m_font_italic = ( f [3]. toInt ( )); 139 tc. m_font_italic = ( f [3]. toInt ( ));
132 } else { 140 } else {
133 tc. m_font_family = font ( ). family ( ); 141 tc. m_font_family = font ( ). family ( );
134 tc. m_font_size = font ( ). pointSize ( ); 142 tc. m_font_size = font ( ). pointSize ( );
135 tc. m_font_weight = 50; 143 tc. m_font_weight = 50;
136 tc. m_font_italic = false; 144 tc. m_font_italic = false;
137 } 145 }
138 m_tabs [*it] = tc; 146 m_tabs [*it] = tc;
139 } 147 }
140} 148}
141 149
142 150
143void TabsSettings::accept ( ) 151void TabsSettings::accept ( )
144{ 152{
145 Config cfg ( "Launcher" ); 153 Config cfg ( "Launcher" );
146 154
147 // Launcher Tab 155 // Launcher Tab
148 QString grp ( "Tab %1" ); // No tr 156 QString grp ( "Tab %1" ); // No tr
149 157
@@ -153,84 +161,92 @@ void TabsSettings::accept ( )
153 cfg. setGroup ( grp. arg ( *it )); 161 cfg. setGroup ( grp. arg ( *it ));
154 if ( !tc. m_changed ) 162 if ( !tc. m_changed )
155 continue; 163 continue;
156 switch ( tc. m_view ) { 164 switch ( tc. m_view ) {
157 case TabConfig::Icon: 165 case TabConfig::Icon:
158 cfg.writeEntry ( "View", "Icon" ); 166 cfg.writeEntry ( "View", "Icon" );
159 break; 167 break;
160 case TabConfig::List: 168 case TabConfig::List:
161 cfg.writeEntry ( "View", "List" ); 169 cfg.writeEntry ( "View", "List" );
162 break; 170 break;
163 } 171 }
164 172
165 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); 173 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" );
166 e << *it << tc. m_view; 174 e << *it << tc. m_view;
167 175
168 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); 176 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image );
169 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); 177 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color );
170 cfg. writeEntry ( "TextColor", tc. m_text_color ); 178 cfg. writeEntry ( "TextColor", tc. m_text_color );
171 179
172 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); 180 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" );
173 cfg. writeEntry ( "Font", f ); 181 cfg. writeEntry ( "Font", f );
174 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); 182 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" );
175 183
176 switch ( tc. m_bg_type ) { 184 switch ( tc. m_bg_type ) {
177 case TabConfig::Ruled: 185 case TabConfig::Ruled:
178 cfg.writeEntry( "BackgroundType", "Ruled" ); 186 cfg.writeEntry( "BackgroundType", "Ruled" );
179 be << *it << tc. m_bg_type << QString(""); 187 be << *it << tc. m_bg_type << QString("");
180 break; 188 break;
181 case TabConfig::SolidColor: 189 case TabConfig::SolidColor:
182 cfg.writeEntry( "BackgroundType", "SolidColor" ); 190 cfg.writeEntry( "BackgroundType", "SolidColor" );
183 be << *it << tc. m_bg_type << tc. m_bg_color; 191 be << *it << tc. m_bg_type << tc. m_bg_color;
184 break; 192 break;
185 case TabConfig::Image: 193 case TabConfig::Image:
186 cfg.writeEntry( "BackgroundType", "Image" ); 194 cfg.writeEntry( "BackgroundType", "Image" );
187 be << *it << tc. m_bg_type << tc. m_bg_image; 195 be << *it << tc. m_bg_type << tc. m_bg_image;
188 break; 196 break;
189 } 197 }
190 198
191 QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); 199 QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" );
192 te << *it << tc. m_text_color; 200 te << *it << tc. m_text_color;
193 201
194 QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); 202 QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" );
195 fe << *it << tc. m_font_family; 203 fe << *it << tc. m_font_family;
196 fe << tc. m_font_size; 204 fe << tc. m_font_size;
197 fe << tc. m_font_weight << ( tc. m_font_italic ? 1 : 0 ); 205 fe << tc. m_font_weight << ( tc. m_font_italic ? 1 : 0 );
198 206
199 tc. m_changed = false; 207 tc. m_changed = false;
200 } 208 }
209 cfg. setGroup ( "GUI" );
210 QString busytype = QString ( m_busyblink-> isChecked ( ) ? "blink" : "" );
211
212 cfg. writeEntry ( "BusyType", busytype );
213 {
214 QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" );
215 e << busytype;
216 }
201} 217}
202 218
203void TabsSettings::newClicked ( ) 219void TabsSettings::newClicked ( )
204{ 220{
205 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); 221 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
206} 222}
207 223
208void TabsSettings::deleteClicked ( ) 224void TabsSettings::deleteClicked ( )
209{ 225{
210 int ind = m_list-> currentItem ( ); 226 int ind = m_list-> currentItem ( );
211 227
212 if ( ind < 0 ) 228 if ( ind < 0 )
213 return; 229 return;
214 230
215 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); 231 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
216} 232}
217 233
218void TabsSettings::editClicked ( ) 234void TabsSettings::editClicked ( )
219{ 235{
220 int ind = m_list-> currentItem ( ); 236 int ind = m_list-> currentItem ( );
221 237
222 if ( ind < 0 ) 238 if ( ind < 0 )
223 return; 239 return;
224 240
225 TabConfig tc = m_tabs [m_ids [ind]]; 241 TabConfig tc = m_tabs [m_ids [ind]];
226 242
227 TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); 243 TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true );
228 244
229 d-> showMaximized ( ); 245 d-> showMaximized ( );
230 if ( d-> exec ( ) == QDialog::Accepted ) { 246 if ( d-> exec ( ) == QDialog::Accepted ) {
231 tc. m_changed = true; 247 tc. m_changed = true;
232 m_tabs [m_ids [ind]] = tc; 248 m_tabs [m_ids [ind]] = tc;
233 } 249 }
234 250
235 delete d; 251 delete d;
236} 252}
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
@@ -1,65 +1,68 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can 5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27#ifndef __TABS_SETTINGS_H__ 27#ifndef __TABS_SETTINGS_H__
28#define __TABS_SETTINGS_H__ 28#define __TABS_SETTINGS_H__
29 29
30#include <qwidget.h> 30#include <qwidget.h>
31#include <qmap.h> 31#include <qmap.h>
32 32
33#include "tabconfig.h" 33#include "tabconfig.h"
34 34
35class QListBox; 35class QListBox;
36class QCheckBox;
37class Config;
36 38
37 39
38class TabsSettings : public QWidget { 40class TabsSettings : public QWidget {
39 Q_OBJECT 41 Q_OBJECT
40 42
41public: 43public:
42 TabsSettings ( QWidget *parent = 0, const char *name = 0 ); 44 TabsSettings ( QWidget *parent = 0, const char *name = 0 );
43 45
44 void accept ( ); 46 void accept ( );
45 47
46protected slots: 48protected slots:
47 void newClicked ( ); 49 void newClicked ( );
48 void deleteClicked ( ); 50 void deleteClicked ( );
49 void editClicked ( ); 51 void editClicked ( );
50 52
51protected: 53protected:
52 void init ( ); 54 void init ( );
53 void readTabSettings ( ); 55 void readTabSettings ( Config & );
54 56
55private: 57private:
56 QListBox *m_list; 58 QListBox *m_list;
57 //QString currentTab; 59 //QString currentTab;
58 QStringList m_ids; 60 QStringList m_ids;
59 QMap <QString, TabConfig> m_tabs; 61 QMap <QString, TabConfig> m_tabs;
62 QCheckBox *m_busyblink;
60}; 63};
61 64
62 65
63 66
64 67
65#endif 68#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
@@ -7,141 +7,149 @@
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
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 "taskbarsettings.h" 29#include "taskbarsettings.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/taskbarappletinterface.h> 34#include <qpe/taskbarappletinterface.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
48TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) 48TaskbarSettings::TaskbarSettings ( 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:" ), 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
71void TaskbarSettings::init ( ) 71void 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 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 78 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
79 79
80 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 80 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
81 QString name; 81 QString name;
82 QPixmap icon; 82 QPixmap icon;
83 TaskbarNamedAppletInterface *iface = 0; 83 TaskbarNamedAppletInterface *iface = 0;
84 84
85 QLibrary *lib = new QLibrary ( path + "/" + *it ); 85 QLibrary *lib = new QLibrary ( path + "/" + *it );
86 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); 86 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface );
87 if ( iface ) { 87 if ( iface ) {
88 88 QString lang = getenv( "LANG" );
89 QString lang = getenv( "LANG" ); 89 QTranslator *trans = new QTranslator ( qApp );
90 QTranslator *trans = new QTranslator ( qApp ); 90 QString type = (*it). left ((*it). find ("."));
91 QString type = (*it). left ((*it). find (".")); 91 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm";
92 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; 92 if ( trans-> load ( tfn ))
93 if ( trans-> load ( tfn )) 93 qApp-> installTranslator ( trans );
94 qApp-> installTranslator ( trans ); 94 else
95 else 95 delete trans;
96 delete trans; 96 name = iface-> name ( );
97 name = iface-> name ( ); 97 icon = iface-> icon ( );
98 icon = iface-> icon ( );
99 iface-> release ( ); 98 iface-> release ( );
100 lib-> unload ( );
101 } else {
102 delete lib;
103 name = (*it). mid ( 3 );
104 int sep = name. find( ".so" );
105 if ( sep > 0 )
106 name. truncate ( sep );
107 sep = name. find ( "applet" );
108 if ( sep == (int) name.length ( ) - 6 )
109 name. truncate ( sep );
110 name[0] = name[0]. upper ( );
111 } 99 }
112 QCheckListItem *item; 100 if ( !iface ) {
113 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 101 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface );
114 if ( !icon. isNull ( )) 102
115 item-> setPixmap ( 0, icon ); 103 if ( iface ) {
116 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 104 name = (*it). mid ( 3 );
117 m_applets [*it] = item; 105 int sep = name. find( ".so" );
106 if ( sep > 0 )
107 name. truncate ( sep );
108 sep = name. find ( "applet" );
109 if ( sep == (int) name.length ( ) - 6 )
110 name. truncate ( sep );
111 name[0] = name[0]. upper ( );
112 iface-> release ( );
113 }
114 }
115
116 if ( iface ) {
117 QCheckListItem *item;
118 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
119 if ( !icon. isNull ( ))
120 item-> setPixmap ( 0, icon );
121 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
122 m_applets [*it] = item;
123 }
124 lib-> unload ( );
125 delete lib;
118 } 126 }
119} 127}
120 128
121void TaskbarSettings::appletChanged() 129void TaskbarSettings::appletChanged()
122{ 130{
123 m_applets_changed = true; 131 m_applets_changed = true;
124} 132}
125 133
126void TaskbarSettings::accept ( ) 134void TaskbarSettings::accept ( )
127{ 135{
128 Config cfg ( "Taskbar" ); 136 Config cfg ( "Taskbar" );
129 cfg. setGroup ( "Applets" ); 137 cfg. setGroup ( "Applets" );
130 if ( m_applets_changed ) { 138 if ( m_applets_changed ) {
131 QStringList exclude; 139 QStringList exclude;
132 QMap <QString, QCheckListItem *>::Iterator it; 140 QMap <QString, QCheckListItem *>::Iterator it;
133 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { 141 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
134 if ( !(*it)-> isOn ( )) 142 if ( !(*it)-> isOn ( ))
135 exclude << it. key ( ); 143 exclude << it. key ( );
136 } 144 }
137 cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); 145 cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
138 } 146 }
139 cfg. writeEntry ( "SafeMode", false ); 147 cfg. writeEntry ( "SafeMode", false );
140 cfg. write ( ); 148 cfg. write ( );
141 149
142 if ( m_applets_changed ) { 150 if ( m_applets_changed ) {
143 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); 151 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" );
144 m_applets_changed = false; 152 m_applets_changed = false;
145 } 153 }
146} 154}
147 155