summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/launchersettings.cpp2
-rw-r--r--core/settings/launcher/menusettings.cpp4
-rw-r--r--core/settings/launcher/tabconfig.h13
-rw-r--r--core/settings/launcher/tabdialog.cpp5
-rw-r--r--core/settings/launcher/tabssettings.cpp65
5 files changed, 73 insertions, 16 deletions
diff --git a/core/settings/launcher/launchersettings.cpp b/core/settings/launcher/launchersettings.cpp
index c32d998..7b85602 100644
--- a/core/settings/launcher/launchersettings.cpp
+++ b/core/settings/launcher/launchersettings.cpp
@@ -1,72 +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#include <qapplication.h>
30 30
31#include <opie/otabwidget.h> 31#include <opie/otabwidget.h>
32 32
33#include "launchersettings.h" 33#include "launchersettings.h"
34#include "tabssettings.h" 34#include "tabssettings.h"
35#include "menusettings.h" 35#include "menusettings.h"
36#include "taskbarsettings.h" 36#include "taskbarsettings.h"
37 37
38 38
39LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false ) 39LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp )
40{ 40{
41 setCaption ( tr( "Launcher Settings" )); 41 setCaption ( tr( "Launcher Settings" ));
42 42
43 QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 43 QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
44 44
45 OTabWidget *tw = new OTabWidget ( this, "otab" ); 45 OTabWidget *tw = new OTabWidget ( this, "otab" );
46 lay-> addWidget ( tw ); 46 lay-> addWidget ( tw );
47 47
48 m_tabs = new TabsSettings ( tw ); 48 m_tabs = new TabsSettings ( tw );
49 m_taskbar = new TaskbarSettings ( tw ); 49 m_taskbar = new TaskbarSettings ( tw );
50 m_menu = new MenuSettings ( tw ); 50 m_menu = new MenuSettings ( tw );
51 51
52 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" )); 53 tw-> addTab ( m_menu, "launchersettings/menutab.png", tr( "O-Menu" ));
54 tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" )); 54 tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" ));
55 55
56 tw-> setCurrentTab ( m_taskbar ); 56 tw-> setCurrentTab ( m_taskbar );
57} 57}
58 58
59void LauncherSettings::accept ( ) 59void LauncherSettings::accept ( )
60{ 60{
61 m_taskbar-> accept ( ); 61 m_taskbar-> accept ( );
62 m_menu-> accept ( ); 62 m_menu-> accept ( );
63 m_tabs-> accept ( ); 63 m_tabs-> accept ( );
64 64
65 QDialog::accept ( ); 65 QDialog::accept ( );
66} 66}
67 67
68void LauncherSettings::done ( int r ) 68void LauncherSettings::done ( int r )
69{ 69{
70 QDialog::done ( r ); 70 QDialog::done ( r );
71 close ( ); 71 close ( );
72} 72}
diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp
index 8d363fa..5a9fada 100644
--- a/core/settings/launcher/menusettings.cpp
+++ b/core/settings/launcher/menusettings.cpp
@@ -1,159 +1,159 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> 3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
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 "menusettings.h" 29#include "menusettings.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/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
48MenuSettings::MenuSettings ( QWidget *parent, const char *name ) 48MenuSettings::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 displayed 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 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
75void MenuSettings::init ( ) 75void 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 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 82 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
83 83
84 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 84 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
85 QString name; 85 QString name;
86 QPixmap icon; 86 QPixmap icon;
87 MenuAppletInterface *iface = 0; 87 MenuAppletInterface *iface = 0;
88 88
89 QLibrary *lib = new QLibrary ( path + "/" + *it ); 89 QLibrary *lib = new QLibrary ( path + "/" + *it );
90 lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); 90 lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface );
91 if ( iface ) { 91 if ( iface ) {
92 QString lang = getenv( "LANG" ); 92 QString lang = getenv( "LANG" );
93 QTranslator *trans = new QTranslator ( qApp ); 93 QTranslator *trans = new QTranslator ( qApp );
94 QString type = (*it). left ((*it). find (".")); 94 QString type = (*it). left ((*it). find ("."));
95 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; 95 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm";
96 if ( trans-> load ( tfn )) 96 if ( trans-> load ( tfn ))
97 qApp-> installTranslator ( trans ); 97 qApp-> installTranslator ( trans );
98 else 98 else
99 delete trans; 99 delete trans;
100 name = iface-> name ( ); 100 name = iface-> name ( );
101 icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); 101 icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal );
102 iface-> release ( ); 102 iface-> release ( );
103 lib-> unload ( ); 103 lib-> unload ( );
104 104
105 QCheckListItem *item; 105 QCheckListItem *item;
106 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 106 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
107 if ( !icon. isNull ( )) 107 if ( !icon. isNull ( ))
108 item-> setPixmap ( 0, icon ); 108 item-> setPixmap ( 0, icon );
109 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 109 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
110 m_applets [*it] = item; 110 m_applets [*it] = item;
111 } else { 111 } else {
112 delete lib; 112 delete lib;
113 } 113 }
114 } 114 }
115 115
116 cfg. setGroup ( "Menu" ); 116 cfg. setGroup ( "Menu" );
117 m_menutabs-> setChecked ( cfg. readBoolEntry ( "LauncherTabs", true )); 117 m_menutabs-> setChecked ( cfg. readBoolEntry ( "LauncherTabs", true ));
118} 118}
119 119
120void MenuSettings::appletChanged() 120void MenuSettings::appletChanged()
121{ 121{
122 m_applets_changed = true; 122 m_applets_changed = true;
123} 123}
124 124
125void MenuSettings::accept ( ) 125void MenuSettings::accept ( )
126{ 126{
127 bool apps_changed = false; 127 bool apps_changed = false;
128 128
129 Config cfg ( "StartMenu" ); 129 Config cfg ( "StartMenu" );
130 cfg. setGroup ( "Applets" ); 130 cfg. setGroup ( "Applets" );
131 if ( m_applets_changed ) { 131 if ( m_applets_changed ) {
132 QStringList exclude; 132 QStringList exclude;
133 QMap <QString, QCheckListItem *>::Iterator it; 133 QMap <QString, QCheckListItem *>::Iterator it;
134 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { 134 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
135 if ( !(*it)-> isOn ( )) 135 if ( !(*it)-> isOn ( ))
136 exclude << it. key ( ); 136 exclude << it. key ( );
137 } 137 }
138 cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); 138 cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
139 } 139 }
140 cfg. writeEntry ( "SafeMode", false ); 140 cfg. writeEntry ( "SafeMode", false );
141 141
142 cfg. setGroup ( "Menu" ); 142 cfg. setGroup ( "Menu" );
143 143
144 if ( m_menutabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) { 144 if ( m_menutabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) {
145 apps_changed = true; 145 apps_changed = true;
146 cfg. writeEntry ( "LauncherTabs", m_menutabs-> isChecked ( )); 146 cfg. writeEntry ( "LauncherTabs", m_menutabs-> isChecked ( ));
147 } 147 }
148 148
149 cfg. write ( ); 149 cfg. write ( );
150 150
151 if ( m_applets_changed ) { 151 if ( m_applets_changed ) {
152 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); 152 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" );
153 m_applets_changed = false; 153 m_applets_changed = false;
154 } 154 }
155 if ( apps_changed ) { 155 if ( apps_changed ) {
156 QCopEnvelope ( "QPE/TaskBar", "reloadApps()" ); 156 QCopEnvelope ( "QPE/TaskBar", "reloadApps()" );
157 } 157 }
158} 158}
159 159
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h
index 8b6b103..eebfd36 100644
--- a/core/settings/launcher/tabconfig.h
+++ b/core/settings/launcher/tabconfig.h
@@ -1,53 +1,66 @@
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 __TABCONFIG_H__ 27#ifndef __TABCONFIG_H__
28#define __TABCONFIG_H__ 28#define __TABCONFIG_H__
29 29
30struct TabConfig { 30struct TabConfig {
31 enum ViewMode { 31 enum ViewMode {
32 Icon, 32 Icon,
33 List 33 List
34 }; 34 };
35 enum BackgroundType { 35 enum BackgroundType {
36 Ruled, 36 Ruled,
37 SolidColor, 37 SolidColor,
38 Image 38 Image
39 }; 39 };
40 40
41 ViewMode m_view; 41 ViewMode m_view;
42 BackgroundType m_bg_type; 42 BackgroundType m_bg_type;
43 QString m_bg_image; 43 QString m_bg_image;
44 QString m_bg_color; 44 QString m_bg_color;
45 QString m_text_color; 45 QString m_text_color;
46 QString m_font_family; 46 QString m_font_family;
47 int m_font_size; 47 int m_font_size;
48 int m_font_weight; 48 int m_font_weight;
49 bool m_font_italic; 49 bool m_font_italic;
50 bool m_changed; 50 bool m_changed;
51
52 bool operator == ( const TabConfig &tc )
53 {
54 return ( m_view == tc. m_view ) &&
55 ( m_bg_type == tc. m_bg_type ) &&
56 ( m_bg_image == tc. m_bg_image ) &&
57 ( m_bg_color == tc. m_bg_color ) &&
58 ( m_text_color == tc. m_text_color ) &&
59 ( m_font_family == tc. m_font_family ) &&
60 ( m_font_size == tc. m_font_size ) &&
61 ( m_font_weight == tc. m_font_weight ) &&
62 ( m_font_italic == tc. m_font_italic );
63 }
51}; 64};
52 65
53#endif 66#endif
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
index 6288f5f..a90ba7d 100644
--- a/core/settings/launcher/tabdialog.cpp
+++ b/core/settings/launcher/tabdialog.cpp
@@ -1,492 +1,495 @@
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 <qpe/resource.h> 28#include <qpe/resource.h>
29#include <qpe/config.h> 29#include <qpe/config.h>
30#include <qpe/applnk.h> 30#include <qpe/applnk.h>
31 31
32#include <qlayout.h> 32#include <qlayout.h>
33#include <qvbox.h> 33#include <qvbox.h>
34#include <qtabbar.h> 34#include <qtabbar.h>
35#include <qiconview.h> 35#include <qiconview.h>
36#include <qapplication.h> 36#include <qapplication.h>
37#include <qlabel.h> 37#include <qlabel.h>
38#include <qradiobutton.h> 38#include <qradiobutton.h>
39#include <qbuttongroup.h> 39#include <qbuttongroup.h>
40#include <qpushbutton.h> 40#include <qpushbutton.h>
41#include <qwhatsthis.h>
41 42
42#include <opie/ofontselector.h> 43#include <opie/ofontselector.h>
43#include <opie/otabwidget.h> 44#include <opie/otabwidget.h>
44#include <opie/ocolorbutton.h> 45#include <opie/ocolorbutton.h>
45#include <opie/ofiledialog.h> 46#include <opie/ofiledialog.h>
46 47
47#include "tabdialog.h" 48#include "tabdialog.h"
48 49
49 50
50class SampleItem : public QIconViewItem { 51class SampleItem : public QIconViewItem {
51public: 52public:
52 SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) 53 SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text )
53 { 54 {
54 m_large = pix; 55 m_large = pix;
55 m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); 56 m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 ));
56 } 57 }
57 58
58 void sizeChange ( ) 59 void sizeChange ( )
59 { 60 {
60 calcRect ( ); 61 calcRect ( );
61 repaint ( ); 62 repaint ( );
62 } 63 }
63 64
64 QPixmap *pixmap ( ) const 65 QPixmap *pixmap ( ) const
65 { 66 {
66 if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) 67 if ( iconView ( )-> itemTextPos ( ) == QIconView::Right )
67 return (QPixmap *) &m_small; 68 return (QPixmap *) &m_small;
68 else 69 else
69 return (QPixmap *) &m_large; 70 return (QPixmap *) &m_large;
70 } 71 }
71 72
72private: 73private:
73 QPixmap m_large, m_small; 74 QPixmap m_large, m_small;
74}; 75};
75 76
76class SampleView : public QIconView { 77class SampleView : public QIconView {
77public: 78public:
78 SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) 79 SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name )
79 { 80 {
80 setItemsMovable ( false ); 81 setItemsMovable ( false );
81 setAutoArrange ( true ); 82 setAutoArrange ( true );
82 setSorting ( true ); 83 setSorting ( true );
83 setFrameStyle ( QFrame::NoFrame ); 84 setFrameStyle ( QFrame::NoFrame );
84 setSpacing ( 4 ); 85 setSpacing ( 4 );
85 setMargin ( 0 ); 86 setMargin ( 0 );
86 setSelectionMode ( QIconView::NoSelection ); 87 setSelectionMode ( QIconView::NoSelection );
87 setBackgroundMode ( PaletteBase ); 88 setBackgroundMode ( PaletteBase );
88 setViewMode ( TabConfig::Icon ); 89 setViewMode ( TabConfig::Icon );
89 calculateGrid ( Bottom ); 90 calculateGrid ( Bottom );
90 91
91 92
92 new SampleItem ( this, tr( "Sample 1" ), Resource::loadPixmap ( "DateBook" )); 93 new SampleItem ( this, tr( "Sample 1" ), Resource::loadPixmap ( "DateBook" ));
93 new SampleItem ( this, tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); 94 new SampleItem ( this, tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" ));
94 new SampleItem ( this, tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); 95 new SampleItem ( this, tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" ));
95 96
96 setBackgroundType ( TabConfig::Ruled, QString::null ); 97 setBackgroundType ( TabConfig::Ruled, QString::null );
97 98
98 setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); 99 setMaximumHeight ( firstItem ( )-> height ( ) + 16 );
99 } 100 }
100 101
101 void setViewMode ( TabConfig::ViewMode m ) 102 void setViewMode ( TabConfig::ViewMode m )
102 { 103 {
103 viewport ( )-> setUpdatesEnabled ( false ); 104 viewport ( )-> setUpdatesEnabled ( false );
104 105
105 switch ( m ) { 106 switch ( m ) {
106 case TabConfig::List: 107 case TabConfig::List:
107 setItemTextPos( QIconView::Right ); 108 setItemTextPos( QIconView::Right );
108 break; 109 break;
109 case TabConfig::Icon: 110 case TabConfig::Icon:
110 setItemTextPos( QIconView::Bottom ); 111 setItemTextPos( QIconView::Bottom );
111 break; 112 break;
112 } 113 }
113 // hideOrShowItems ( false ); 114 // hideOrShowItems ( false );
114 115
115 for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) 116 for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( ))
116 ((SampleItem *) it )-> sizeChange ( ); 117 ((SampleItem *) it )-> sizeChange ( );
117 arrangeItemsInGrid ( true ); 118 arrangeItemsInGrid ( true );
118 viewport ( )-> setUpdatesEnabled ( true ); 119 viewport ( )-> setUpdatesEnabled ( true );
119 update ( ); 120 update ( );
120 } 121 }
121 122
122 123
123 void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) 124 void setBackgroundType( TabConfig::BackgroundType t, const QString &val )
124 { 125 {
125 switch ( t ) { 126 switch ( t ) {
126 case TabConfig::Ruled: { 127 case TabConfig::Ruled: {
127 QPixmap bg ( width ( ), 9 ); 128 QPixmap bg ( width ( ), 9 );
128 QPainter painter ( &bg ); 129 QPainter painter ( &bg );
129 for ( int i = 0; i < 3; i++ ) { 130 for ( int i = 0; i < 3; i++ ) {
130 painter. setPen ( white ); 131 painter. setPen ( white );
131 painter. drawLine ( 0, i*3, width()-1, i*3 ); 132 painter. drawLine ( 0, i*3, width()-1, i*3 );
132 painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); 133 painter. drawLine ( 0, i*3+1, width()-1, i*3+1 );
133 painter. setPen ( colorGroup().background().light(105) ); 134 painter. setPen ( colorGroup().background().light(105) );
134 painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); 135 painter. drawLine ( 0, i*3+2, width()-1, i*3+2 );
135 } 136 }
136 painter.end ( ); 137 painter.end ( );
137 setBackgroundPixmap ( bg ); 138 setBackgroundPixmap ( bg );
138 break; 139 break;
139 } 140 }
140 141
141 case TabConfig::SolidColor: { 142 case TabConfig::SolidColor: {
142 setBackgroundPixmap ( QPixmap ( )); 143 setBackgroundPixmap ( QPixmap ( ));
143 if ( val. isEmpty ( )) 144 if ( val. isEmpty ( ))
144 setBackgroundColor ( colorGroup ( ). base ( )); 145 setBackgroundColor ( colorGroup ( ). base ( ));
145 else 146 else
146 setBackgroundColor ( val ); 147 setBackgroundColor ( val );
147 break; 148 break;
148 } 149 }
149 150
150 case TabConfig::Image: { 151 case TabConfig::Image: {
151 qDebug( "Loading image: %s", val.latin1() ); 152 qDebug( "Loading image: %s", val.latin1() );
152 QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); 153 QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val ));
153 if ( bg. isNull ( )) { 154 if ( bg. isNull ( )) {
154 QImageIO imgio; 155 QImageIO imgio;
155 imgio. setFileName ( val ); 156 imgio. setFileName ( val );
156 QSize ds = qApp-> desktop ( )-> size ( ); 157 QSize ds = qApp-> desktop ( )-> size ( );
157 QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr 158 QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr
158 imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); 159 imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( ));
159 imgio. read ( ); 160 imgio. read ( );
160 bg = imgio. image ( ); 161 bg = imgio. image ( );
161 } 162 }
162 setBackgroundPixmap ( bg ); 163 setBackgroundPixmap ( bg );
163 break; 164 break;
164 } 165 }
165 } 166 }
166 m_bgtype = t; 167 m_bgtype = t;
167 viewport ( )-> update ( ); 168 viewport ( )-> update ( );
168 } 169 }
169 170
170 void setTextColor ( const QColor &tc ) 171 void setTextColor ( const QColor &tc )
171 { 172 {
172 m_textcolor = tc; 173 m_textcolor = tc;
173 QColorGroup cg = colorGroup ( ); 174 QColorGroup cg = colorGroup ( );
174 cg. setColor ( QColorGroup::Text, tc ); 175 cg. setColor ( QColorGroup::Text, tc );
175 setPalette ( QPalette ( cg, cg, cg )); 176 setPalette ( QPalette ( cg, cg, cg ));
176 viewport ( )-> update ( ); 177 viewport ( )-> update ( );
177 } 178 }
178 179
179 void setViewFont ( const QFont &f ) 180 void setViewFont ( const QFont &f )
180 { 181 {
181 setFont ( f ); 182 setFont ( f );
182 } 183 }
183 184
184 void setItemTextPos ( ItemTextPos pos ) 185 void setItemTextPos ( ItemTextPos pos )
185 { 186 {
186 calculateGrid ( pos ); 187 calculateGrid ( pos );
187 QIconView::setItemTextPos( pos ); 188 QIconView::setItemTextPos( pos );
188 } 189 }
189 190
190 void calculateGrid ( ItemTextPos pos ) 191 void calculateGrid ( ItemTextPos pos )
191 { 192 {
192 int dw = QApplication::desktop ( )-> width ( ); 193 int dw = QApplication::desktop ( )-> width ( );
193 int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); 194 int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( );
194 if ( pos == Bottom ) { 195 if ( pos == Bottom ) {
195 int cols = 3; 196 int cols = 3;
196 if ( viewerWidth <= 200 ) 197 if ( viewerWidth <= 200 )
197 cols = 2; 198 cols = 2;
198 else if ( viewerWidth >= 400 ) 199 else if ( viewerWidth >= 400 )
199 cols = viewerWidth/96; 200 cols = viewerWidth/96;
200 setSpacing ( 4 ); 201 setSpacing ( 4 );
201 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); 202 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols );
202 setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); 203 setGridY ( fontMetrics ( ). height ( ) * 2 + 24 );
203 } 204 }
204 else { 205 else {
205 int cols = 2; 206 int cols = 2;
206 if ( viewerWidth < 150 ) 207 if ( viewerWidth < 150 )
207 cols = 1; 208 cols = 1;
208 else if ( viewerWidth >= 400 ) 209 else if ( viewerWidth >= 400 )
209 cols = viewerWidth / 150; 210 cols = viewerWidth / 150;
210 setSpacing ( 2 ); 211 setSpacing ( 2 );
211 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); 212 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols );
212 setGridY ( fontMetrics ( ). height ( ) + 2 ); 213 setGridY ( fontMetrics ( ). height ( ) + 2 );
213 } 214 }
214 } 215 }
215 216
216 void paletteChange( const QPalette &p ) 217 void paletteChange( const QPalette &p )
217 { 218 {
218 static bool excllock = false; 219 static bool excllock = false;
219 220
220 if ( excllock ) 221 if ( excllock )
221 return; 222 return;
222 excllock = true; 223 excllock = true;
223 224
224 unsetPalette ( ); 225 unsetPalette ( );
225 QIconView::paletteChange ( p ); 226 QIconView::paletteChange ( p );
226 if ( m_bgtype == TabConfig::Ruled ) 227 if ( m_bgtype == TabConfig::Ruled )
227 setBackgroundType ( TabConfig::Ruled, QString::null ); 228 setBackgroundType ( TabConfig::Ruled, QString::null );
228 QColorGroup cg = colorGroup ( ); 229 QColorGroup cg = colorGroup ( );
229 cg.setColor ( QColorGroup::Text, m_textcolor ); 230 cg.setColor ( QColorGroup::Text, m_textcolor );
230 setPalette ( QPalette ( cg, cg, cg )); 231 setPalette ( QPalette ( cg, cg, cg ));
231 232
232 excllock = false; 233 excllock = false;
233 } 234 }
234 235
235 void setBackgroundPixmap ( const QPixmap &pm ) 236 void setBackgroundPixmap ( const QPixmap &pm )
236 { 237 {
237 m_bgpix = pm; 238 m_bgpix = pm;
238 } 239 }
239 240
240 void setBackgroundColor ( const QColor &c ) 241 void setBackgroundColor ( const QColor &c )
241 { 242 {
242 m_bgcolor = c; 243 m_bgcolor = c;
243 } 244 }
244 245
245 void drawBackground ( QPainter *p, const QRect &r ) 246 void drawBackground ( QPainter *p, const QRect &r )
246 { 247 {
247 if ( !m_bgpix. isNull ( )) { 248 if ( !m_bgpix. isNull ( )) {
248 p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), 249 p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ),
249 ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); 250 ( r. y ( ) + contentsY ( )) % m_bgpix. height ( )));
250 } 251 }
251 else 252 else
252 p-> fillRect ( r, m_bgcolor ); 253 p-> fillRect ( r, m_bgcolor );
253 } 254 }
254 255
255private: 256private:
256 QColor m_textcolor; 257 QColor m_textcolor;
257 QColor m_bgcolor; 258 QColor m_bgcolor;
258 QPixmap m_bgpix; 259 QPixmap m_bgpix;
259 TabConfig::BackgroundType m_bgtype; 260 TabConfig::BackgroundType m_bgtype;
260}; 261};
261 262
262 263
263 264
264TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *name, bool modal, WFlags fl ) 265TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *name, bool modal, WFlags fl )
265 : QDialog ( parent, name, modal, fl ), m_tc ( tc ) 266 : QDialog ( parent, name, modal, fl | WStyle_ContextHelp ), m_tc ( tc )
266{ 267{
267 setCaption ( tr( "Edit Tab" )); 268 setCaption ( tr( "Edit Tab" ));
268 269
269 QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 270 QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
270 271
271 OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 272 OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
272 QWidget *bgtab; 273 QWidget *bgtab;
273 274
274 tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" )); 275 tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" ));
275 tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); 276 tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" ));
276 tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) ); 277 tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) );
277 278
278 tw-> setCurrentTab ( bgtab ); 279 tw-> setCurrentTab ( bgtab );
279 280
280 QWidget *sample = new QVBox ( this ); 281 QWidget *sample = new QVBox ( this );
281 QTabBar *tb = new QTabBar ( sample ); 282 QTabBar *tb = new QTabBar ( sample );
282 QString name ( tr( "Previewing %1" ). arg ( tabname )); 283 QString name ( tr( "Previewing %1" ). arg ( tabname ));
283 284
284 tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); 285 tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name ));
285 286
286 m_sample = new SampleView ( sample ); 287 m_sample = new SampleView ( sample );
287 288
288 lay-> addWidget ( tw, 10 ); 289 lay-> addWidget ( tw, 10 );
289 lay-> addWidget ( sample, 1 ); 290 lay-> addWidget ( sample, 1 );
290 291
291 m_iconsize-> setButton ( tc. m_view ); 292 m_iconsize-> setButton ( tc. m_view );
292 iconSizeClicked ( tc. m_view ); 293 iconSizeClicked ( tc. m_view );
293 m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); 294 m_iconcolor-> setColor ( QColor ( m_tc. m_text_color ));
294 iconColorClicked ( m_iconcolor-> color ( )); 295 iconColorClicked ( m_iconcolor-> color ( ));
295 m_bgtype-> setButton ( tc. m_bg_type ); 296 m_bgtype-> setButton ( tc. m_bg_type );
296 m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); 297 m_solidcolor-> setColor ( QColor ( tc. m_bg_color ));
297 m_bgimage = tc. m_bg_image; 298 m_bgimage = tc. m_bg_image;
298 bgTypeClicked ( tc. m_bg_type ); 299 bgTypeClicked ( tc. m_bg_type );
299 m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); 300 m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic ));
300 fontClicked ( m_fontselect-> selectedFont ( )); 301 fontClicked ( m_fontselect-> selectedFont ( ));
302
303 QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." ));
301} 304}
302 305
303 306
304TabDialog::~TabDialog ( ) 307TabDialog::~TabDialog ( )
305{ 308{
306} 309}
307 310
308QWidget *TabDialog::createFontTab ( QWidget *parent ) 311QWidget *TabDialog::createFontTab ( QWidget *parent )
309{ 312{
310 m_fontselect = new OFontSelector ( false, parent, "FontTab" ); 313 m_fontselect = new OFontSelector ( false, parent, "FontTab" );
311 314
312 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), 315 connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
313 this, SLOT( fontClicked ( const QFont & ))); 316 this, SLOT( fontClicked ( const QFont & )));
314 317
315 return m_fontselect; 318 return m_fontselect;
316} 319}
317 320
318QWidget *TabDialog::createBgTab ( QWidget *parent ) 321QWidget *TabDialog::createBgTab ( QWidget *parent )
319{ 322{
320 QWidget *tab = new QWidget( parent, "AdvancedTab" ); 323 QWidget *tab = new QWidget( parent, "AdvancedTab" );
321 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); 324 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 );
322 325
323 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 326 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
324 gridLayout-> setColStretch ( 1, 10 ); 327 gridLayout-> setColStretch ( 1, 10 );
325 328
326 QLabel* label = new QLabel( tr( "Type:" ), tab ); 329 QLabel* label = new QLabel( tr( "Type:" ), tab );
327 gridLayout-> addWidget ( label, 0, 0 ); 330 gridLayout-> addWidget ( label, 0, 0 );
328 m_bgtype = new QButtonGroup( tab, "buttongroup" ); 331 m_bgtype = new QButtonGroup( tab, "buttongroup" );
329 m_bgtype-> hide ( ); 332 m_bgtype-> hide ( );
330 m_bgtype-> setExclusive ( true ); 333 m_bgtype-> setExclusive ( true );
331 334
332 QRadioButton *rb; 335 QRadioButton *rb;
333 rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); 336 rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" );
334 m_bgtype-> insert ( rb, TabConfig::Ruled ); 337 m_bgtype-> insert ( rb, TabConfig::Ruled );
335 gridLayout-> addWidget( rb, 0, 1 ); 338 gridLayout-> addWidget( rb, 0, 1 );
336 339
337 QHBoxLayout *hb = new QHBoxLayout ( ); 340 QHBoxLayout *hb = new QHBoxLayout ( );
338 hb-> setSpacing ( 4 ); 341 hb-> setSpacing ( 4 );
339 342
340 rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); 343 rb = new QRadioButton( tr( "Solid color" ), tab, "solid" );
341 m_bgtype-> insert ( rb, TabConfig::SolidColor ); 344 m_bgtype-> insert ( rb, TabConfig::SolidColor );
342 hb-> addWidget ( rb ); 345 hb-> addWidget ( rb );
343 hb-> addSpacing ( 10 ); 346 hb-> addSpacing ( 10 );
344 347
345 m_solidcolor = new OColorButton ( tab ); 348 m_solidcolor = new OColorButton ( tab );
346 connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & ))); 349 connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & )));
347 hb-> addWidget ( m_solidcolor ); 350 hb-> addWidget ( m_solidcolor );
348 hb-> addStretch ( 10 ); 351 hb-> addStretch ( 10 );
349 352
350 gridLayout-> addLayout ( hb, 1, 1 ); 353 gridLayout-> addLayout ( hb, 1, 1 );
351 354
352 hb = new QHBoxLayout ( ); 355 hb = new QHBoxLayout ( );
353 hb-> setSpacing ( 4 ); 356 hb-> setSpacing ( 4 );
354 357
355 rb = new QRadioButton( tr( "Image" ), tab, "image" ); 358 rb = new QRadioButton( tr( "Image" ), tab, "image" );
356 m_bgtype-> insert ( rb, TabConfig::Image ); 359 m_bgtype-> insert ( rb, TabConfig::Image );
357 hb-> addWidget( rb ); 360 hb-> addWidget( rb );
358 hb-> addSpacing ( 10 ); 361 hb-> addSpacing ( 10 );
359 362
360 m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); 363 m_imagebrowse = new QPushButton ( tr( "Select..." ), tab );
361 connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( ))); 364 connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( )));
362 hb-> addWidget ( m_imagebrowse ); 365 hb-> addWidget ( m_imagebrowse );
363 hb-> addStretch ( 10 ); 366 hb-> addStretch ( 10 );
364 367
365 gridLayout-> addLayout ( hb, 2, 1 ); 368 gridLayout-> addLayout ( hb, 2, 1 );
366 369
367 QPushButton *p = new QPushButton ( tr( "Default" ), tab ); 370 QPushButton *p = new QPushButton ( tr( "Default" ), tab );
368 connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( ))); 371 connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( )));
369 gridLayout-> addWidget ( p, 3, 1 ); 372 gridLayout-> addWidget ( p, 3, 1 );
370 373
371 connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); 374 connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int )));
372 375
373 vertLayout-> addStretch ( 10 ); 376 vertLayout-> addStretch ( 10 );
374 377
375 return tab; 378 return tab;
376} 379}
377 380
378QWidget *TabDialog::createIconTab ( QWidget *parent ) 381QWidget *TabDialog::createIconTab ( QWidget *parent )
379{ 382{
380 QWidget *tab = new QWidget( parent, "AdvancedTab" ); 383 QWidget *tab = new QWidget( parent, "AdvancedTab" );
381 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); 384 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 );
382 385
383 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 386 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
384 gridLayout-> setColStretch ( 1, 10 ); 387 gridLayout-> setColStretch ( 1, 10 );
385 388
386 QLabel* label = new QLabel( tr( "Size:" ), tab ); 389 QLabel* label = new QLabel( tr( "Size:" ), tab );
387 gridLayout-> addWidget ( label, 0, 0 ); 390 gridLayout-> addWidget ( label, 0, 0 );
388 m_iconsize = new QButtonGroup( tab, "buttongroup" ); 391 m_iconsize = new QButtonGroup( tab, "buttongroup" );
389 m_iconsize-> hide ( ); 392 m_iconsize-> hide ( );
390 m_iconsize-> setExclusive ( true ); 393 m_iconsize-> setExclusive ( true );
391 394
392 QRadioButton *rb; 395 QRadioButton *rb;
393 rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); 396 rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" );
394 m_iconsize-> insert ( rb, TabConfig::List ); 397 m_iconsize-> insert ( rb, TabConfig::List );
395 gridLayout-> addWidget( rb, 0, 1 ); 398 gridLayout-> addWidget( rb, 0, 1 );
396 399
397 rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); 400 rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" );
398 m_iconsize-> insert ( rb, TabConfig::Icon ); 401 m_iconsize-> insert ( rb, TabConfig::Icon );
399 gridLayout-> addWidget( rb, 1, 1 ); 402 gridLayout-> addWidget( rb, 1, 1 );
400 403
401 connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); 404 connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int )));
402 405
403 //vertLayout-> addSpacing ( 8 ); 406 //vertLayout-> addSpacing ( 8 );
404 407
405 //gridLayout = new QGridLayout ( vertLayout ); 408 //gridLayout = new QGridLayout ( vertLayout );
406 gridLayout-> addRowSpacing ( 2, 8 ); 409 gridLayout-> addRowSpacing ( 2, 8 );
407 410
408 label = new QLabel ( tr( "Color:" ), tab ); 411 label = new QLabel ( tr( "Color:" ), tab );
409 gridLayout-> addWidget ( label, 3, 0 ); 412 gridLayout-> addWidget ( label, 3, 0 );
410 413
411 m_iconcolor = new OColorButton ( tab ); 414 m_iconcolor = new OColorButton ( tab );
412 connect ( m_iconcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( iconColorClicked ( const QColor & ))); 415 connect ( m_iconcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( iconColorClicked ( const QColor & )));
413 gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); 416 gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft );
414 417
415 vertLayout-> addStretch ( 10 ); 418 vertLayout-> addStretch ( 10 );
416 419
417 return tab; 420 return tab;
418} 421}
419 422
420 423
421void TabDialog::iconSizeClicked ( int s ) 424void TabDialog::iconSizeClicked ( int s )
422{ 425{
423 m_sample-> setViewMode ((TabConfig::ViewMode) s ); 426 m_sample-> setViewMode ((TabConfig::ViewMode) s );
424} 427}
425 428
426void TabDialog::fontClicked ( const QFont &f ) 429void TabDialog::fontClicked ( const QFont &f )
427{ 430{
428 m_sample-> setViewFont ( f ); 431 m_sample-> setViewFont ( f );
429} 432}
430 433
431void TabDialog::bgTypeClicked ( int t ) 434void TabDialog::bgTypeClicked ( int t )
432{ 435{
433 QString s; 436 QString s;
434 437
435 if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) 438 if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t )
436 m_bgtype-> setButton ( t ); 439 m_bgtype-> setButton ( t );
437 440
438 m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); 441 m_solidcolor-> setEnabled ( t == TabConfig::SolidColor );
439 m_imagebrowse-> setEnabled ( t == TabConfig::Image ); 442 m_imagebrowse-> setEnabled ( t == TabConfig::Image );
440 443
441 if ( t == TabConfig::SolidColor ) 444 if ( t == TabConfig::SolidColor )
442 s = m_solidcolor-> color ( ). name ( ); 445 s = m_solidcolor-> color ( ). name ( );
443 else if ( t == TabConfig::Image ) 446 else if ( t == TabConfig::Image )
444 s = Resource::findPixmap ( m_bgimage ); 447 s = Resource::findPixmap ( m_bgimage );
445 448
446 m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); 449 m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s );
447} 450}
448 451
449void TabDialog::bgColorClicked ( const QColor & ) 452void TabDialog::bgColorClicked ( const QColor & )
450{ 453{
451 bgTypeClicked ( TabConfig::SolidColor ); 454 bgTypeClicked ( TabConfig::SolidColor );
452} 455}
453 456
454void TabDialog::iconColorClicked ( const QColor &col ) 457void TabDialog::iconColorClicked ( const QColor &col )
455{ 458{
456 m_sample-> setTextColor ( col ); 459 m_sample-> setTextColor ( col );
457} 460}
458 461
459void TabDialog::bgImageClicked ( ) 462void TabDialog::bgImageClicked ( )
460{ 463{
461 // ### use OFileSelector here ### 464 // ### use OFileSelector here ###
462 // this is just a quick c&p from the old appearance app 465 // this is just a quick c&p from the old appearance app
463 466
464 MimeTypes types; 467 MimeTypes types;
465 QStringList list; 468 QStringList list;
466 list << "image/*"; 469 list << "image/*";
467 types. insert ( "Images", list ); 470 types. insert ( "Images", list );
468 471
469 QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); 472 QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types );
470 if ( !file. isEmpty ( )) { 473 if ( !file. isEmpty ( )) {
471 m_bgimage = DocLnk ( file ). file ( ); 474 m_bgimage = DocLnk ( file ). file ( );
472 bgTypeClicked ( TabConfig::Image ); 475 bgTypeClicked ( TabConfig::Image );
473 } 476 }
474} 477}
475 478
476void TabDialog::bgDefaultClicked ( ) 479void TabDialog::bgDefaultClicked ( )
477{ 480{
478 m_bgimage = "launcher/opie-background"; 481 m_bgimage = "launcher/opie-background";
479 bgTypeClicked ( TabConfig::Image ); 482 bgTypeClicked ( TabConfig::Image );
480} 483}
481 484
482void TabDialog::accept ( ) 485void TabDialog::accept ( )
483{ 486{
484 m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); 487 m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( ));
485 m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); 488 m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( ));
486 m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); 489 m_tc. m_bg_color = m_solidcolor-> color ( ). name ( );
487 m_tc. m_bg_image = m_bgimage; 490 m_tc. m_bg_image = m_bgimage;
488 m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); 491 m_tc. m_text_color = m_iconcolor-> color ( ). name ( );
489 492
490 QFont f = m_fontselect-> selectedFont ( ); 493 QFont f = m_fontselect-> selectedFont ( );
491 494
492 m_tc. m_font_family = f. family ( ); 495 m_tc. m_font_family = f. family ( );
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index 6cc69c0..a5afaf2 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -1,252 +1,293 @@
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#include <qcheckbox.h>
43 43
44#include "tabdialog.h" 44#include "tabdialog.h"
45 45
46#include <stdlib.h> 46#include <stdlib.h>
47#include <qmessagebox.h> 47#include <qmessagebox.h>
48 48
49 49
50 #define GLOBALID "_launchersettings_global_dummy_"
51
50 52
51TabsSettings::TabsSettings ( QWidget *parent, const char *name ) 53TabsSettings::TabsSettings ( QWidget *parent, const char *name )
52 : QWidget ( parent, name ) 54 : QWidget ( parent, name )
53{ 55{
54 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); 56 QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 );
55 57
56 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); 58 QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this );
57 lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); 59 lay-> addMultiCellWidget ( l, 0, 0, 0, 1 );
58 60
59 m_list = new QListBox ( this ); 61 m_list = new QListBox ( this );
60 lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); 62 lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 );
61 63
62 QWhatsThis::add ( m_list, tr( "foobar" )); 64 QWhatsThis::add ( m_list, tr( "foobar" ));
63 65
64 QPushButton *p; 66 QPushButton *p1, *p2, *p3;
65 p = new QPushButton ( tr( "New" ), this ); 67 p1 = new QPushButton ( tr( "New" ), this );
66 lay-> addWidget ( p, 1, 1 ); 68 lay-> addWidget ( p1, 1, 1 );
67 connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); 69 connect ( p1, SIGNAL( clicked ( )), this, SLOT( newClicked ( )));
68 70
69 p = new QPushButton ( tr( "Edit" ), this ); 71 p2 = new QPushButton ( tr( "Edit" ), this );
70 lay-> addWidget ( p, 2, 1 ); 72 lay-> addWidget ( p2, 2, 1 );
71 connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); 73 connect ( p2, SIGNAL( clicked ( )), this, SLOT( editClicked ( )));
72 74
73 p = new QPushButton ( tr( "Delete" ), this ); 75 p3 = new QPushButton ( tr( "Delete" ), this );
74 lay-> addWidget ( p, 3, 1 ); 76 lay-> addWidget ( p3, 3, 1 );
75 connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); 77 connect ( p3, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( )));
76 78
77 lay-> setRowStretch ( 4, 10 ); 79 lay-> setRowStretch ( 4, 10 );
78 80
79 m_busyblink = new QCheckBox ( tr( "Enable blinking busy indicator" ), this ); 81 m_busyblink = new QCheckBox ( tr( "Enable blinking busy indicator" ), this );
80 lay-> addMultiCellWidget ( m_busyblink, 5, 5, 0, 1 ); 82 lay-> addMultiCellWidget ( m_busyblink, 5, 5, 0, 1 );
81 83
84 p1-> setEnabled ( false );
85 p3-> setEnabled ( false );
86
82 init ( ); 87 init ( );
88
89 QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." ));
90 QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." ));
91 QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." ));
92 QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." ));
93 QWhatsThis::add ( m_busyblink, tr( "Activate this, if you want a blinking busy indicator for starting applications in the Launcher." ));
83} 94}
84 95
85void TabsSettings::init ( ) 96void TabsSettings::init ( )
86{ 97{
87 AppLnkSet rootFolder( MimeType::appsFolderName ( )); 98 AppLnkSet rootFolder( MimeType::appsFolderName ( ));
88 QStringList types = rootFolder. types ( ); 99 QStringList types = rootFolder. types ( );
100
101 m_list-> insertItem ( tr( "All Tabs" ));
102 m_ids << GLOBALID;
89 103
90 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { 104 for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) {
91 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); 105 m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it ));
92 m_ids << *it; 106 m_ids << *it;
93 } 107 }
94 QImage img ( Resource::loadImage ( "DocsIcon" )); 108 QImage img ( Resource::loadImage ( "DocsIcon" ));
95 QPixmap pix; 109 QPixmap pix;
96 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); 110 pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( ));
97 m_list-> insertItem ( pix, tr( "Documents" )); 111 m_list-> insertItem ( pix, tr( "Documents" ));
98 m_ids += "Documents"; // No tr 112 m_ids += "Documents"; // No tr
99 113
100 Config cfg ( "Launcher" ); 114 Config cfg ( "Launcher" );
101 115
102 readTabSettings ( cfg ); 116 readTabSettings ( cfg );
103 117
104 cfg. setGroup ( "GUI" ); 118 cfg. setGroup ( "GUI" );
105 m_busyblink-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "blink" ); 119 m_busyblink-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "blink" );
106} 120}
107 121
108void TabsSettings::readTabSettings ( Config &cfg ) 122void TabsSettings::readTabSettings ( Config &cfg )
109{ 123{
110 QString grp ( "Tab %1" ); // No tr 124 QString grp ( "Tab %1" ); // No tr
111 m_tabs. clear ( ); 125 m_tabs. clear ( );
112 126
113 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 127 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
114 TabConfig tc; 128 TabConfig tc;
115 tc. m_view = TabConfig::Icon; 129 tc. m_view = TabConfig::Icon;
116 tc. m_bg_type = TabConfig::Ruled; 130 tc. m_bg_type = TabConfig::Ruled;
117 tc. m_changed = false; 131 tc. m_changed = false;
118 132
119 cfg. setGroup ( grp. arg ( *it )); 133 cfg. setGroup ( grp. arg ( *it ));
134 if ( *it == GLOBALID )
135 cfg. clearGroup ( );
120 136
121 QString view = cfg. readEntry ( "View", "Icon" ); 137 QString view = cfg. readEntry ( "View", "Icon" );
122 if ( view == "List" ) // No tr 138 if ( view == "List" ) // No tr
123 tc. m_view = TabConfig::List; 139 tc. m_view = TabConfig::List;
124 140
125 QString bgType = cfg. readEntry ( "BackgroundType", "Image" ); 141 QString bgType = cfg. readEntry ( "BackgroundType", "Image" );
126 if ( bgType == "SolidColor" ) 142 if ( bgType == "SolidColor" )
127 tc. m_bg_type = TabConfig::SolidColor; 143 tc. m_bg_type = TabConfig::SolidColor;
128 else if ( bgType == "Image" ) // No tr 144 else if ( bgType == "Image" ) // No tr
129 tc. m_bg_type = TabConfig::Image; 145 tc. m_bg_type = TabConfig::Image;
130 146
131 tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "launcher/opie-background" ); 147 tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "launcher/opie-background" );
132 tc. m_bg_color = cfg. readEntry ( "BackgroundColor", colorGroup ( ). color ( QColorGroup::Base ). name ( )); 148 tc. m_bg_color = cfg. readEntry ( "BackgroundColor", colorGroup ( ). color ( QColorGroup::Base ). name ( ));
133 tc. m_text_color = cfg. readEntry ( "TextColor", colorGroup ( ). color ( QColorGroup::Text ). name ( )); 149 tc. m_text_color = cfg. readEntry ( "TextColor", colorGroup ( ). color ( QColorGroup::Text ). name ( ));
134 QStringList f = cfg. readListEntry ( "Font", ',' ); 150 QStringList f = cfg. readListEntry ( "Font", ',' );
135 if ( f. count ( ) == 4 ) { 151 if ( f. count ( ) == 4 ) {
136 tc. m_font_family = f [0]; 152 tc. m_font_family = f [0];
137 tc. m_font_size = f [1]. toInt ( ); 153 tc. m_font_size = f [1]. toInt ( );
138 tc. m_font_weight = f [2]. toInt ( ); 154 tc. m_font_weight = f [2]. toInt ( );
139 tc. m_font_italic = ( f [3]. toInt ( )); 155 tc. m_font_italic = ( f [3]. toInt ( ));
140 } else { 156 } else {
141 tc. m_font_family = font ( ). family ( ); 157 tc. m_font_family = font ( ). family ( );
142 tc. m_font_size = font ( ). pointSize ( ); 158 tc. m_font_size = font ( ). pointSize ( );
143 tc. m_font_weight = 50; 159 tc. m_font_weight = 50;
144 tc. m_font_italic = false; 160 tc. m_font_italic = false;
145 } 161 }
162
146 m_tabs [*it] = tc; 163 m_tabs [*it] = tc;
147 } 164 }
165
166 // if all tabs have the same config, then initialize the GLOBALID tab to these values
167
168 TabConfig *first = 0;
169 bool same = true;
170
171 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
172 if ( *it == GLOBALID )
173 continue;
174 else if ( !first )
175 first = &m_tabs [*it];
176 else
177 same &= ( *first == m_tabs [*it] );
178 }
179 if ( same )
180 m_tabs [GLOBALID] = *first;
148} 181}
149 182
150 183
151void TabsSettings::accept ( ) 184void TabsSettings::accept ( )
152{ 185{
153 Config cfg ( "Launcher" ); 186 Config cfg ( "Launcher" );
154 187
155 // Launcher Tab 188 // Launcher Tab
156 QString grp ( "Tab %1" ); // No tr 189 QString grp ( "Tab %1" ); // No tr
157 190
158 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { 191 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
159 TabConfig &tc = m_tabs [*it]; 192 TabConfig &tc = m_tabs [*it];
160 193
161 cfg. setGroup ( grp. arg ( *it )); 194 if ( !tc. m_changed || ( *it == GLOBALID ))
162 if ( !tc. m_changed )
163 continue; 195 continue;
196
197 cfg. setGroup ( grp. arg ( *it ));
164 switch ( tc. m_view ) { 198 switch ( tc. m_view ) {
165 case TabConfig::Icon: 199 case TabConfig::Icon:
166 cfg.writeEntry ( "View", "Icon" ); 200 cfg.writeEntry ( "View", "Icon" );
167 break; 201 break;
168 case TabConfig::List: 202 case TabConfig::List:
169 cfg.writeEntry ( "View", "List" ); 203 cfg.writeEntry ( "View", "List" );
170 break; 204 break;
171 } 205 }
172 206
173 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); 207 QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" );
174 e << *it << tc. m_view; 208 e << *it << tc. m_view;
175 209
176 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); 210 cfg. writeEntry ( "BackgroundImage", tc. m_bg_image );
177 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); 211 cfg. writeEntry ( "BackgroundColor", tc. m_bg_color );
178 cfg. writeEntry ( "TextColor", tc. m_text_color ); 212 cfg. writeEntry ( "TextColor", tc. m_text_color );
179 213
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" ); 214 QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" );
181 cfg. writeEntry ( "Font", f ); 215 cfg. writeEntry ( "Font", f );
182 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); 216 QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" );
183 217
184 switch ( tc. m_bg_type ) { 218 switch ( tc. m_bg_type ) {
185 case TabConfig::Ruled: 219 case TabConfig::Ruled:
186 cfg.writeEntry( "BackgroundType", "Ruled" ); 220 cfg.writeEntry( "BackgroundType", "Ruled" );
187 be << *it << tc. m_bg_type << QString(""); 221 be << *it << tc. m_bg_type << QString("");
188 break; 222 break;
189 case TabConfig::SolidColor: 223 case TabConfig::SolidColor:
190 cfg.writeEntry( "BackgroundType", "SolidColor" ); 224 cfg.writeEntry( "BackgroundType", "SolidColor" );
191 be << *it << tc. m_bg_type << tc. m_bg_color; 225 be << *it << tc. m_bg_type << tc. m_bg_color;
192 break; 226 break;
193 case TabConfig::Image: 227 case TabConfig::Image:
194 cfg.writeEntry( "BackgroundType", "Image" ); 228 cfg.writeEntry( "BackgroundType", "Image" );
195 be << *it << tc. m_bg_type << tc. m_bg_image; 229 be << *it << tc. m_bg_type << tc. m_bg_image;
196 break; 230 break;
197 } 231 }
198 232
199 QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); 233 QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" );
200 te << *it << tc. m_text_color; 234 te << *it << tc. m_text_color;
201 235
202 QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); 236 QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" );
203 fe << *it << tc. m_font_family; 237 fe << *it << tc. m_font_family;
204 fe << tc. m_font_size; 238 fe << tc. m_font_size;
205 fe << tc. m_font_weight << ( tc. m_font_italic ? 1 : 0 ); 239 fe << tc. m_font_weight << ( tc. m_font_italic ? 1 : 0 );
206 240
207 tc. m_changed = false; 241 tc. m_changed = false;
208 } 242 }
209 cfg. setGroup ( "GUI" ); 243 cfg. setGroup ( "GUI" );
210 QString busytype = QString ( m_busyblink-> isChecked ( ) ? "blink" : "" ); 244 QString busytype = QString ( m_busyblink-> isChecked ( ) ? "blink" : "" );
211 245
212 cfg. writeEntry ( "BusyType", busytype ); 246 cfg. writeEntry ( "BusyType", busytype );
213 { 247 {
214 QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); 248 QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" );
215 e << busytype; 249 e << busytype;
216 } 250 }
217} 251}
218 252
219void TabsSettings::newClicked ( ) 253void TabsSettings::newClicked ( )
220{ 254{
221 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); 255 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
222} 256}
223 257
224void TabsSettings::deleteClicked ( ) 258void TabsSettings::deleteClicked ( )
225{ 259{
226 int ind = m_list-> currentItem ( ); 260 int ind = m_list-> currentItem ( );
227 261
228 if ( ind < 0 ) 262 if ( ind < 0 )
229 return; 263 return;
230 264
231 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); 265 QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
232} 266}
233 267
234void TabsSettings::editClicked ( ) 268void TabsSettings::editClicked ( )
235{ 269{
236 int ind = m_list-> currentItem ( ); 270 int ind = m_list-> currentItem ( );
237 271
238 if ( ind < 0 ) 272 if ( ind < 0 )
239 return; 273 return;
240 274
241 TabConfig tc = m_tabs [m_ids [ind]]; 275 TabConfig tc = m_tabs [m_ids [ind]];
242 276
243 TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); 277 TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true );
244 278
245 d-> showMaximized ( ); 279 d-> showMaximized ( );
246 if ( d-> exec ( ) == QDialog::Accepted ) { 280 if ( d-> exec ( ) == QDialog::Accepted ) {
247 tc. m_changed = true; 281 tc. m_changed = true;
248 m_tabs [m_ids [ind]] = tc; 282 m_tabs [m_ids [ind]] = tc;
283
284 if ( m_ids [ind] == GLOBALID ) {
285 for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
286 if ( *it != GLOBALID )
287 m_tabs [*it] = tc;
288 }
289 }
249 } 290 }
250 291
251 delete d; 292 delete d;
252} 293}