summaryrefslogtreecommitdiff
path: root/core/settings/launcher
authorar <ar>2004-05-02 17:31:50 (UTC)
committer ar <ar>2004-05-02 17:31:50 (UTC)
commita210b9a597ba0c929d95c38ffbaf972916c7b8a7 (patch) (unidiff)
treece121d5017eb054222c86e0afb6057a28ea7bf8a /core/settings/launcher
parent18759e9156c96795831120408a9da0d3b4ec71a4 (diff)
downloadopie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.zip
opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.tar.gz
opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.tar.bz2
- convert qDebug to odebug
Diffstat (limited to 'core/settings/launcher') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/doctabsettings.cpp6
-rw-r--r--core/settings/launcher/inputmethodsettings.cpp6
-rw-r--r--core/settings/launcher/tabdialog.cpp632
-rw-r--r--core/settings/launcher/taskbarsettings.cpp196
4 files changed, 427 insertions, 413 deletions
diff --git a/core/settings/launcher/doctabsettings.cpp b/core/settings/launcher/doctabsettings.cpp
index 179a7f9..dfdc9be 100644
--- a/core/settings/launcher/doctabsettings.cpp
+++ b/core/settings/launcher/doctabsettings.cpp
@@ -19,50 +19,54 @@
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 "doctabsettings.h" 29#include "doctabsettings.h"
30 30
31/* OPIE */
31#include <qpe/config.h> 32#include <qpe/config.h>
33#include <opie2/odebug.h>
32 34
35/* QT */
33#include <qcheckbox.h> 36#include <qcheckbox.h>
34#include <qlayout.h> 37#include <qlayout.h>
35#include <qlabel.h> 38#include <qlabel.h>
36#include <qwhatsthis.h> 39#include <qwhatsthis.h>
37 40
41
38DocTabSettings::DocTabSettings( QWidget *parent, const char *name ):QWidget( parent, name ) 42DocTabSettings::DocTabSettings( QWidget *parent, const char *name ):QWidget( parent, name )
39{ 43{
40 QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); 44 QBoxLayout *lay = new QVBoxLayout( this, 4, 4 );
41 45
42 _enable = new QCheckBox( tr( "Enable the Documents Tab" ), this ); 46 _enable = new QCheckBox( tr( "Enable the Documents Tab" ), this );
43 47
44 Config cfg( "Launcher" ); 48 Config cfg( "Launcher" );
45 cfg.setGroup( "DocTab" ); 49 cfg.setGroup( "DocTab" );
46 _enable->setChecked( cfg.readBoolEntry( "Enable", true ) ); 50 _enable->setChecked( cfg.readBoolEntry( "Enable", true ) );
47 51
48 lay->addWidget( _enable ); 52 lay->addWidget( _enable );
49 lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) ); 53 lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) );
50 54
51 lay->addStretch(); 55 lay->addStretch();
52 56
53 QWhatsThis::add( _enable, tr( "Check, if you want the Documents Tab to be visible." ) ); 57 QWhatsThis::add( _enable, tr( "Check, if you want the Documents Tab to be visible." ) );
54} 58}
55 59
56void DocTabSettings::appletChanged() 60void DocTabSettings::appletChanged()
57{ 61{
58} 62}
59 63
60void DocTabSettings::accept() 64void DocTabSettings::accept()
61{ 65{
62 qDebug( "DocTabSettings::accept()" ); 66 odebug << "DocTabSettings::accept()" << oendl;
63 Config cfg( "Launcher" ); 67 Config cfg( "Launcher" );
64 cfg.setGroup( "DocTab" ); 68 cfg.setGroup( "DocTab" );
65 cfg.writeEntry( "Enable", _enable->isChecked() ); 69 cfg.writeEntry( "Enable", _enable->isChecked() );
66 cfg.write(); 70 cfg.write();
67} 71}
68 72
diff --git a/core/settings/launcher/inputmethodsettings.cpp b/core/settings/launcher/inputmethodsettings.cpp
index e342c09..0422075 100644
--- a/core/settings/launcher/inputmethodsettings.cpp
+++ b/core/settings/launcher/inputmethodsettings.cpp
@@ -19,32 +19,36 @@
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 "inputmethodsettings.h" 29#include "inputmethodsettings.h"
30 30
31/* OPIE */
31#include <qpe/config.h> 32#include <qpe/config.h>
33#include <opie2/odebug.h>
32 34
35/* QT */
33#include <qspinbox.h> 36#include <qspinbox.h>
34#include <qcheckbox.h> 37#include <qcheckbox.h>
35#include <qlayout.h> 38#include <qlayout.h>
36#include <qlabel.h> 39#include <qlabel.h>
37#include <qwhatsthis.h> 40#include <qwhatsthis.h>
38 41
42
39InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name ) 43InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name )
40{ 44{
41 QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); 45 QBoxLayout *lay = new QVBoxLayout( this, 4, 4 );
42 46
43 _resize = new QCheckBox( tr( "Resize application on Popup" ), this ); 47 _resize = new QCheckBox( tr( "Resize application on Popup" ), this );
44 _float = new QCheckBox( tr( "Enable floating and resizing" ), this ); 48 _float = new QCheckBox( tr( "Enable floating and resizing" ), this );
45 49
46 QHBoxLayout* hbox = new QHBoxLayout( lay, 4 ); 50 QHBoxLayout* hbox = new QHBoxLayout( lay, 4 );
47 hbox->addWidget( new QLabel( "Initial Width:", this ) ); 51 hbox->addWidget( new QLabel( "Initial Width:", this ) );
48 _size = new QSpinBox( 10, 100, 10, this ); 52 _size = new QSpinBox( 10, 100, 10, this );
49 _size->setSuffix( "%" ); 53 _size->setSuffix( "%" );
50 hbox->addWidget( _size ); 54 hbox->addWidget( _size );
@@ -64,21 +68,21 @@ InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QW
64 68
65 QWhatsThis::add( _resize, tr( "Check, if you want the application to be automatically resized if the input method pops up." ) ); 69 QWhatsThis::add( _resize, tr( "Check, if you want the application to be automatically resized if the input method pops up." ) );
66 QWhatsThis::add( _float, tr( "Check, if you want to move and/or resize input methods" ) ); 70 QWhatsThis::add( _float, tr( "Check, if you want to move and/or resize input methods" ) );
67 QWhatsThis::add( _size, tr( "Specify the percentage of the screen width for the input method" ) ); 71 QWhatsThis::add( _size, tr( "Specify the percentage of the screen width for the input method" ) );
68} 72}
69 73
70void InputMethodSettings::appletChanged() 74void InputMethodSettings::appletChanged()
71{ 75{
72} 76}
73 77
74void InputMethodSettings::accept() 78void InputMethodSettings::accept()
75{ 79{
76 qDebug( "InputMethodSettings::accept()" ); 80 odebug << "InputMethodSettings::accept()" << oendl;
77 Config cfg( "Launcher" ); 81 Config cfg( "Launcher" );
78 cfg.setGroup( "InputMethods" ); 82 cfg.setGroup( "InputMethods" );
79 cfg.writeEntry( "Resize", _resize->isChecked() ); 83 cfg.writeEntry( "Resize", _resize->isChecked() );
80 cfg.writeEntry( "Float", _float->isChecked() ); 84 cfg.writeEntry( "Float", _float->isChecked() );
81 cfg.writeEntry( "Width", _size->value() ); 85 cfg.writeEntry( "Width", _size->value() );
82 cfg.write(); 86 cfg.write();
83} 87}
84 88
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
index 763b360..546e229 100644
--- a/core/settings/launcher/tabdialog.cpp
+++ b/core/settings/launcher/tabdialog.cpp
@@ -16,499 +16,501 @@
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 "tabdialog.h"
29
30/* OPIE */
28#include <qpe/resource.h> 31#include <qpe/resource.h>
32#include <opie2/ofontselector.h>
33#include <opie2/otabwidget.h>
34#include <opie2/ocolorbutton.h>
35#include <opie2/ofiledialog.h>
36#include <opie2/odebug.h>
29 37
38/* QT */
30#include <qlayout.h> 39#include <qlayout.h>
31#include <qvbox.h> 40#include <qvbox.h>
32#include <qtabbar.h> 41#include <qtabbar.h>
33#include <qiconview.h> 42#include <qiconview.h>
34#include <qapplication.h> 43#include <qapplication.h>
35#include <qlabel.h> 44#include <qlabel.h>
36#include <qradiobutton.h> 45#include <qradiobutton.h>
37#include <qbuttongroup.h> 46#include <qbuttongroup.h>
38#include <qwhatsthis.h> 47#include <qwhatsthis.h>
39#include <qcheckbox.h> 48#include <qcheckbox.h>
40 49
41#include <opie2/ofontselector.h>
42#include <opie2/otabwidget.h>
43#include <opie2/ocolorbutton.h>
44#include <opie2/ofiledialog.h>
45
46#include "tabdialog.h"
47
48 50
49using namespace Opie::Ui; 51using namespace Opie::Ui;
50class SampleItem : public QIconViewItem { 52class SampleItem : public QIconViewItem {
51public: 53public:
52 SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) 54 SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text )
53 { 55 {
54 m_large = pix; 56 m_large = pix;
55 m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); 57 m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 ));
56 } 58 }
57 59
58 void sizeChange ( ) 60 void sizeChange ( )
59 { 61 {
60 calcRect ( ); 62 calcRect ( );
61 repaint ( ); 63 repaint ( );
62 } 64 }
63 65
64 QPixmap *pixmap ( ) const 66 QPixmap *pixmap ( ) const
65 { 67 {
66 if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) 68 if ( iconView ( )-> itemTextPos ( ) == QIconView::Right )
67 return (QPixmap *) &m_small; 69 return (QPixmap *) &m_small;
68 else 70 else
69 return (QPixmap *) &m_large; 71 return (QPixmap *) &m_large;
70 } 72 }
71 73
72private: 74private:
73 QPixmap m_large, m_small; 75 QPixmap m_large, m_small;
74}; 76};
75 77
76class SampleView : public QIconView { 78class SampleView : public QIconView {
77public: 79public:
78 SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) 80 SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name )
79 { 81 {
80 setItemsMovable ( false ); 82 setItemsMovable ( false );
81 setAutoArrange ( true ); 83 setAutoArrange ( true );
82 setSorting ( true ); 84 setSorting ( true );
83 setFrameStyle ( QFrame::NoFrame ); 85 setFrameStyle ( QFrame::NoFrame );
84 setSpacing ( 4 ); 86 setSpacing ( 4 );
85 setMargin ( 0 ); 87 setMargin ( 0 );
86 setSelectionMode ( QIconView::NoSelection ); 88 setSelectionMode ( QIconView::NoSelection );
87 setBackgroundMode ( PaletteBase ); 89 setBackgroundMode ( PaletteBase );
88 setViewMode ( TabConfig::Icon ); 90 setViewMode ( TabConfig::Icon );
89 calculateGrid ( Bottom ); 91 calculateGrid ( Bottom );
90 92
91 93
92 new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); 94 new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" ));
93 new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); 95 new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" ));
94 new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); 96 new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" ));
95 97
96 setBackgroundType ( TabConfig::Ruled, QString::null ); 98 setBackgroundType ( TabConfig::Ruled, QString::null );
97 99
98 setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); 100 setMaximumHeight ( firstItem ( )-> height ( ) + 16 );
99 } 101 }
100 102
101 void setViewMode ( TabConfig::ViewMode m ) 103 void setViewMode ( TabConfig::ViewMode m )
102 { 104 {
103 viewport ( )-> setUpdatesEnabled ( false ); 105 viewport ( )-> setUpdatesEnabled ( false );
104 106
105 switch ( m ) { 107 switch ( m ) {
106 case TabConfig::List: 108 case TabConfig::List:
107 setItemTextPos( QIconView::Right ); 109 setItemTextPos( QIconView::Right );
108 break; 110 break;
109 case TabConfig::Icon: 111 case TabConfig::Icon:
110 setItemTextPos( QIconView::Bottom ); 112 setItemTextPos( QIconView::Bottom );
111 break; 113 break;
112 } 114 }
113 // hideOrShowItems ( false ); 115// hideOrShowItems ( false );
114 116
115 for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) 117 for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( ))
116 ((SampleItem *) it )-> sizeChange ( ); 118 ((SampleItem *) it )-> sizeChange ( );
117 arrangeItemsInGrid ( true ); 119 arrangeItemsInGrid ( true );
118 viewport ( )-> setUpdatesEnabled ( true ); 120 viewport ( )-> setUpdatesEnabled ( true );
119 update ( ); 121 update ( );
120 } 122 }
121 123
122 124
123 void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) 125 void setBackgroundType( TabConfig::BackgroundType t, const QString &val )
124 { 126 {
125 switch ( t ) { 127 switch ( t ) {
126 case TabConfig::Ruled: { 128 case TabConfig::Ruled: {
127 QPixmap bg ( width ( ), 9 ); 129 QPixmap bg ( width ( ), 9 );
128 QPainter painter ( &bg ); 130 QPainter painter ( &bg );
129 for ( int i = 0; i < 3; i++ ) { 131 for ( int i = 0; i < 3; i++ ) {
130 painter. setPen ( white ); 132 painter. setPen ( white );
131 painter. drawLine ( 0, i*3, width()-1, i*3 ); 133 painter. drawLine ( 0, i*3, width()-1, i*3 );
132 painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); 134 painter. drawLine ( 0, i*3+1, width()-1, i*3+1 );
133 painter. setPen ( colorGroup().background().light(105) ); 135 painter. setPen ( colorGroup().background().light(105) );
134 painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); 136 painter. drawLine ( 0, i*3+2, width()-1, i*3+2 );
135 } 137 }
136 painter.end ( ); 138 painter.end ( );
137 setBackgroundPixmap ( bg ); 139 setBackgroundPixmap ( bg );
138 break; 140 break;
139 } 141 }
140 142
141 case TabConfig::SolidColor: { 143 case TabConfig::SolidColor: {
142 setBackgroundPixmap ( QPixmap ( )); 144 setBackgroundPixmap ( QPixmap ( ));
143 if ( val. isEmpty ( )) 145 if ( val. isEmpty ( ))
144 setBackgroundColor ( colorGroup ( ). base ( )); 146 setBackgroundColor ( colorGroup ( ). base ( ));
145 else 147 else
146 setBackgroundColor ( val ); 148 setBackgroundColor ( val );
147 break; 149 break;
148 } 150 }
149 151
150 case TabConfig::Image: { 152 case TabConfig::Image: {
151 qDebug( "Loading image: %s", val.latin1() ); 153 odebug << "Loading image: " << val << "" << oendl;
152 QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); 154 QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val ));
153 if ( bg. isNull ( )) { 155 if ( bg. isNull ( )) {
154 QImageIO imgio; 156 QImageIO imgio;
155 imgio. setFileName ( val ); 157 imgio. setFileName ( val );
156 QSize ds = qApp-> desktop ( )-> size ( ); 158 QSize ds = qApp-> desktop ( )-> size ( );
157 QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr 159 QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr
158 imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); 160 imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( ));
159 imgio. read ( ); 161 imgio. read ( );
160 bg = imgio. image ( ); 162 bg = imgio. image ( );
161 } 163 }
162 setBackgroundPixmap ( bg ); 164 setBackgroundPixmap ( bg );
163 break; 165 break;
164 } 166 }
165 } 167 }
166 m_bgtype = t; 168 m_bgtype = t;
167 viewport ( )-> update ( ); 169 viewport ( )-> update ( );
168 } 170 }
169 171
170 void setTextColor ( const QColor &tc ) 172 void setTextColor ( const QColor &tc )
171 { 173 {
172 m_textcolor = tc; 174 m_textcolor = tc;
173 QColorGroup cg = colorGroup ( ); 175 QColorGroup cg = colorGroup ( );
174 cg. setColor ( QColorGroup::Text, tc ); 176 cg. setColor ( QColorGroup::Text, tc );
175 setPalette ( QPalette ( cg, cg, cg )); 177 setPalette ( QPalette ( cg, cg, cg ));
176 viewport ( )-> update ( ); 178 viewport ( )-> update ( );
177 } 179 }
178 180
179 void setViewFont ( const QFont &f ) 181 void setViewFont ( const QFont &f )
180 { 182 {
181 setFont ( f ); 183 setFont ( f );
182 } 184 }
183 185
184 void setItemTextPos ( ItemTextPos pos ) 186 void setItemTextPos ( ItemTextPos pos )
185 { 187 {
186 calculateGrid ( pos ); 188 calculateGrid ( pos );
187 QIconView::setItemTextPos( pos ); 189 QIconView::setItemTextPos( pos );
188 } 190 }
189 191
190 void calculateGrid ( ItemTextPos pos ) 192 void calculateGrid ( ItemTextPos pos )
191 { 193 {
192 int dw = QApplication::desktop ( )-> width ( ); 194 int dw = QApplication::desktop ( )-> width ( );
193 int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); 195 int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( );
194 if ( pos == Bottom ) { 196 if ( pos == Bottom ) {
195 int cols = 3; 197 int cols = 3;
196 if ( viewerWidth <= 200 ) 198 if ( viewerWidth <= 200 )
197 cols = 2; 199 cols = 2;
198 else if ( viewerWidth >= 400 ) 200 else if ( viewerWidth >= 400 )
199 cols = viewerWidth/96; 201 cols = viewerWidth/96;
200 setSpacing ( 4 ); 202 setSpacing ( 4 );
201 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); 203 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols );
202 setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); 204 setGridY ( fontMetrics ( ). height ( ) * 2 + 24 );
203 } 205 }
204 else { 206 else {
205 int cols = 2; 207 int cols = 2;
206 if ( viewerWidth < 150 ) 208 if ( viewerWidth < 150 )
207 cols = 1; 209 cols = 1;
208 else if ( viewerWidth >= 400 ) 210 else if ( viewerWidth >= 400 )
209 cols = viewerWidth / 150; 211 cols = viewerWidth / 150;
210 setSpacing ( 2 ); 212 setSpacing ( 2 );
211 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); 213 setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols );
212 setGridY ( fontMetrics ( ). height ( ) + 2 ); 214 setGridY ( fontMetrics ( ). height ( ) + 2 );
213 } 215 }
214 } 216 }
215 217
216 void paletteChange( const QPalette &p ) 218 void paletteChange( const QPalette &p )
217 { 219 {
218 static bool excllock = false; 220 static bool excllock = false;
219 221
220 if ( excllock ) 222 if ( excllock )
221 return; 223 return;
222 excllock = true; 224 excllock = true;
223 225
224 unsetPalette ( ); 226 unsetPalette ( );
225 QIconView::paletteChange ( p ); 227 QIconView::paletteChange ( p );
226 if ( m_bgtype == TabConfig::Ruled ) 228 if ( m_bgtype == TabConfig::Ruled )
227 setBackgroundType ( TabConfig::Ruled, QString::null ); 229 setBackgroundType ( TabConfig::Ruled, QString::null );
228 QColorGroup cg = colorGroup ( ); 230 QColorGroup cg = colorGroup ( );
229 cg.setColor ( QColorGroup::Text, m_textcolor ); 231 cg.setColor ( QColorGroup::Text, m_textcolor );
230 setPalette ( QPalette ( cg, cg, cg )); 232 setPalette ( QPalette ( cg, cg, cg ));
231 233
232 excllock = false; 234 excllock = false;
233 } 235 }
234 236
235 void setBackgroundPixmap ( const QPixmap &pm ) 237 void setBackgroundPixmap ( const QPixmap &pm )
236 { 238 {
237 m_bgpix = pm; 239 m_bgpix = pm;
238 } 240 }
239 241
240 void setBackgroundColor ( const QColor &c ) 242 void setBackgroundColor ( const QColor &c )
241 { 243 {
242 m_bgcolor = c; 244 m_bgcolor = c;
243 } 245 }
244 246
245 void drawBackground ( QPainter *p, const QRect &r ) 247 void drawBackground ( QPainter *p, const QRect &r )
246 { 248 {
247 if ( !m_bgpix. isNull ( )) { 249 if ( !m_bgpix. isNull ( )) {
248 p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), 250 p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ),
249 ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); 251 ( r. y ( ) + contentsY ( )) % m_bgpix. height ( )));
250 } 252 }
251 else 253 else
252 p-> fillRect ( r, m_bgcolor ); 254 p-> fillRect ( r, m_bgcolor );
253 } 255 }
254 256
255private: 257private:
256 QColor m_textcolor; 258 QColor m_textcolor;
257 QColor m_bgcolor; 259 QColor m_bgcolor;
258 QPixmap m_bgpix; 260 QPixmap m_bgpix;
259 TabConfig::BackgroundType m_bgtype; 261 TabConfig::BackgroundType m_bgtype;
260}; 262};
261 263
262 264
263 265
264TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) 266TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl )
265 : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) 267 : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc )
266{ 268{
267 setCaption ( tr( "Edit Tab" )); 269 setCaption ( tr( "Edit Tab" ));
268 270
269 QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); 271 QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 );
270 272
271 OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 273 OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
272 QWidget *bgtab; 274 QWidget *bgtab;
273 275
274 tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" )); 276 tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" ));
275 tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); 277 tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" ));
276 tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); 278 tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) );
277 279
278 tw-> setCurrentTab ( bgtab ); 280 tw-> setCurrentTab ( bgtab );
279 281
280 QWidget *sample = new QVBox ( this ); 282 QWidget *sample = new QVBox ( this );
281 QTabBar *tb = new QTabBar ( sample ); 283 QTabBar *tb = new QTabBar ( sample );
282 QString name ( tr( "Previewing %1" ). arg ( tabname )); 284 QString name ( tr( "Previewing %1" ). arg ( tabname ));
283 285
284 tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); 286 tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name ));
285 287
286 m_sample = new SampleView ( sample ); 288 m_sample = new SampleView ( sample );
287 289
288 lay-> addWidget ( tw, 10 ); 290 lay-> addWidget ( tw, 10 );
289 lay-> addWidget ( sample, 1 ); 291 lay-> addWidget ( sample, 1 );
290 292
291 m_iconsize-> setButton ( tc. m_view ); 293 m_iconsize-> setButton ( tc. m_view );
292 iconSizeClicked ( tc. m_view ); 294 iconSizeClicked ( tc. m_view );
293 //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); 295 //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color ));
294 iconColorClicked ( m_iconcolor-> color ( )); 296 iconColorClicked ( m_iconcolor-> color ( ));
295 m_bgtype-> setButton ( tc. m_bg_type ); 297 m_bgtype-> setButton ( tc. m_bg_type );
296 //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); 298 //m_solidcolor-> setColor ( QColor ( tc. m_bg_color ));
297 m_bgimage = tc. m_bg_image; 299 m_bgimage = tc. m_bg_image;
298 bgTypeClicked ( tc. m_bg_type ); 300 bgTypeClicked ( tc. m_bg_type );
299 m_fontuse-> setChecked ( tc. m_font_use ); 301 m_fontuse-> setChecked ( tc. m_font_use );
300 m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); 302 m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic ));
301 m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); 303 m_fontselect-> setEnabled ( m_fontuse-> isChecked ( ));
302 fontClicked ( m_fontselect-> selectedFont ( )); 304 fontClicked ( m_fontselect-> selectedFont ( ));
303 305
304 QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); 306 QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." ));
305} 307}
306 308
307 309
308TabDialog::~TabDialog ( ) 310TabDialog::~TabDialog ( )
309{ 311{
310} 312}
311 313
312QWidget *TabDialog::createFontTab ( QWidget *parent ) 314QWidget *TabDialog::createFontTab ( QWidget *parent )
313{ 315{
314 QWidget *tab = new QWidget ( parent, "FontTab" ); 316 QWidget *tab = new QWidget ( parent, "FontTab" );
315 QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); 317 QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 );
316 318
317 m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); 319 m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab );
318 vertLayout-> addWidget ( m_fontuse ); 320 vertLayout-> addWidget ( m_fontuse );
319 321
320 m_fontselect = new OFontSelector ( false, tab, "fontsel" ); 322 m_fontselect = new OFontSelector ( false, tab, "fontsel" );
321 vertLayout-> addWidget ( m_fontselect ); 323 vertLayout-> addWidget ( m_fontselect );
322 324
323 connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool))); 325 connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool)));
324 connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), 326 connect( m_fontselect, SIGNAL( fontSelected(const QFont&)),
325 this, SLOT( fontClicked(const QFont&))); 327 this, SLOT( fontClicked(const QFont&)));
326 328
327 return tab; 329 return tab;
328} 330}
329 331
330QWidget *TabDialog::createBgTab ( QWidget *parent ) 332QWidget *TabDialog::createBgTab ( QWidget *parent )
331{ 333{
332 QWidget *tab = new QWidget( parent, "BgTab" ); 334 QWidget *tab = new QWidget( parent, "BgTab" );
333 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 335 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
334 336
335 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 337 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
336 gridLayout-> setColStretch ( 1, 10 ); 338 gridLayout-> setColStretch ( 1, 10 );
337 339
338 QLabel* label = new QLabel( tr( "Type:" ), tab ); 340 QLabel* label = new QLabel( tr( "Type:" ), tab );
339 gridLayout-> addWidget ( label, 0, 0 ); 341 gridLayout-> addWidget ( label, 0, 0 );
340 m_bgtype = new QButtonGroup( tab, "buttongroup" ); 342 m_bgtype = new QButtonGroup( tab, "buttongroup" );
341 m_bgtype-> hide ( ); 343 m_bgtype-> hide ( );
342 m_bgtype-> setExclusive ( true ); 344 m_bgtype-> setExclusive ( true );
343 345
344 QRadioButton *rb; 346 QRadioButton *rb;
345 rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); 347 rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" );
346 m_bgtype-> insert ( rb, TabConfig::Ruled ); 348 m_bgtype-> insert ( rb, TabConfig::Ruled );
347 gridLayout-> addWidget( rb, 0, 1 ); 349 gridLayout-> addWidget( rb, 0, 1 );
348 350
349 QHBoxLayout *hb = new QHBoxLayout ( ); 351 QHBoxLayout *hb = new QHBoxLayout ( );
350 hb-> setSpacing ( 3 ); 352 hb-> setSpacing ( 3 );
351 353
352 rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); 354 rb = new QRadioButton( tr( "Solid color" ), tab, "solid" );
353 m_bgtype-> insert ( rb, TabConfig::SolidColor ); 355 m_bgtype-> insert ( rb, TabConfig::SolidColor );
354 hb-> addWidget ( rb ); 356 hb-> addWidget ( rb );
355 hb-> addSpacing ( 10 ); 357 hb-> addSpacing ( 10 );
356 358
357 m_solidcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); 359 m_solidcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_bg_color ) );
358 connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&))); 360 connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&)));
359 hb-> addWidget ( m_solidcolor ); 361 hb-> addWidget ( m_solidcolor );
360 hb-> addStretch ( 10 ); 362 hb-> addStretch ( 10 );
361 363
362 gridLayout-> addLayout ( hb, 1, 1 ); 364 gridLayout-> addLayout ( hb, 1, 1 );
363 365
364 hb = new QHBoxLayout ( ); 366 hb = new QHBoxLayout ( );
365 hb-> setSpacing ( 3 ); 367 hb-> setSpacing ( 3 );
366 368
367 rb = new QRadioButton( tr( "Image" ), tab, "image" ); 369 rb = new QRadioButton( tr( "Image" ), tab, "image" );
368 m_bgtype-> insert ( rb, TabConfig::Image ); 370 m_bgtype-> insert ( rb, TabConfig::Image );
369 hb-> addWidget( rb ); 371 hb-> addWidget( rb );
370 hb-> addSpacing ( 10 ); 372 hb-> addSpacing ( 10 );
371 373
372 m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); 374 m_imagebrowse = new QPushButton ( tr( "Select..." ), tab );
373 connect ( m_imagebrowse, SIGNAL( clicked()), this, SLOT( bgImageClicked())); 375 connect ( m_imagebrowse, SIGNAL( clicked()), this, SLOT( bgImageClicked()));
374 hb-> addWidget ( m_imagebrowse ); 376 hb-> addWidget ( m_imagebrowse );
375 hb-> addStretch ( 10 ); 377 hb-> addStretch ( 10 );
376 378
377 gridLayout-> addLayout ( hb, 2, 1 ); 379 gridLayout-> addLayout ( hb, 2, 1 );
378 380
379 QPushButton *p = new QPushButton ( tr( "Default" ), tab ); 381 QPushButton *p = new QPushButton ( tr( "Default" ), tab );
380 connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked())); 382 connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked()));
381 gridLayout-> addWidget ( p, 3, 1 ); 383 gridLayout-> addWidget ( p, 3, 1 );
382 384
383 connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int))); 385 connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int)));
384 386
385 vertLayout-> addStretch ( 10 ); 387 vertLayout-> addStretch ( 10 );
386 388
387 return tab; 389 return tab;
388} 390}
389 391
390QWidget *TabDialog::createIconTab ( QWidget *parent ) 392QWidget *TabDialog::createIconTab ( QWidget *parent )
391{ 393{
392 QWidget *tab = new QWidget( parent, "IconTab" ); 394 QWidget *tab = new QWidget( parent, "IconTab" );
393 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); 395 QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
394 396
395 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 397 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
396 gridLayout-> setColStretch ( 1, 10 ); 398 gridLayout-> setColStretch ( 1, 10 );
397 399
398 QLabel* label = new QLabel( tr( "Size:" ), tab ); 400 QLabel* label = new QLabel( tr( "Size:" ), tab );
399 gridLayout-> addWidget ( label, 0, 0 ); 401 gridLayout-> addWidget ( label, 0, 0 );
400 m_iconsize = new QButtonGroup( tab, "buttongroup" ); 402 m_iconsize = new QButtonGroup( tab, "buttongroup" );
401 m_iconsize-> hide ( ); 403 m_iconsize-> hide ( );
402 m_iconsize-> setExclusive ( true ); 404 m_iconsize-> setExclusive ( true );
403 405
404 QRadioButton *rb; 406 QRadioButton *rb;
405 rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); 407 rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" );
406 m_iconsize-> insert ( rb, TabConfig::List ); 408 m_iconsize-> insert ( rb, TabConfig::List );
407 gridLayout-> addWidget( rb, 0, 1 ); 409 gridLayout-> addWidget( rb, 0, 1 );
408 410
409 rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); 411 rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" );
410 m_iconsize-> insert ( rb, TabConfig::Icon ); 412 m_iconsize-> insert ( rb, TabConfig::Icon );
411 gridLayout-> addWidget( rb, 1, 1 ); 413 gridLayout-> addWidget( rb, 1, 1 );
412 414
413 connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int))); 415 connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int)));
414 416
415 //vertLayout-> addSpacing ( 8 ); 417// vertLayout-> addSpacing ( 8 );
416 418
417 //gridLayout = new QGridLayout ( vertLayout ); 419// gridLayout = new QGridLayout ( vertLayout );
418 gridLayout-> addRowSpacing ( 2, 8 ); 420 gridLayout-> addRowSpacing ( 2, 8 );
419 421
420 label = new QLabel ( tr( "Color:" ), tab ); 422 label = new QLabel ( tr( "Color:" ), tab );
421 gridLayout-> addWidget ( label, 3, 0 ); 423 gridLayout-> addWidget ( label, 3, 0 );
422 424
423 m_iconcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_text_color ) ); 425 m_iconcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_text_color ) );
424 connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&))); 426 connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&)));
425 gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); 427 gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft );
426 428
427 vertLayout-> addStretch ( 10 ); 429 vertLayout-> addStretch ( 10 );
428 430
429 return tab; 431 return tab;
430} 432}
431 433
432 434
433void TabDialog::iconSizeClicked ( int s ) 435void TabDialog::iconSizeClicked ( int s )
434{ 436{
435 m_sample-> setViewMode ((TabConfig::ViewMode) s ); 437 m_sample-> setViewMode ((TabConfig::ViewMode) s );
436} 438}
437 439
438void TabDialog::fontClicked ( const QFont &f ) 440void TabDialog::fontClicked ( const QFont &f )
439{ 441{
440 m_sample-> setViewFont ( f ); 442 m_sample-> setViewFont ( f );
441} 443}
442 444
443void TabDialog::bgTypeClicked ( int t ) 445void TabDialog::bgTypeClicked ( int t )
444{ 446{
445 QString s; 447 QString s;
446 448
447 if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) 449 if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t )
448 m_bgtype-> setButton ( t ); 450 m_bgtype-> setButton ( t );
449 451
450 m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); 452 m_solidcolor-> setEnabled ( t == TabConfig::SolidColor );
451 m_imagebrowse-> setEnabled ( t == TabConfig::Image ); 453 m_imagebrowse-> setEnabled ( t == TabConfig::Image );
452 454
453 if ( t == TabConfig::SolidColor ) 455 if ( t == TabConfig::SolidColor )
454 s = m_solidcolor-> color ( ). name ( ); 456 s = m_solidcolor-> color ( ). name ( );
455 else if ( t == TabConfig::Image ) 457 else if ( t == TabConfig::Image )
456 s = Resource::findPixmap ( m_bgimage ); 458 s = Resource::findPixmap ( m_bgimage );
457 459
458 m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); 460 m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s );
459} 461}
460 462
461void TabDialog::bgColorClicked ( const QColor & ) 463void TabDialog::bgColorClicked ( const QColor & )
462{ 464{
463 bgTypeClicked ( TabConfig::SolidColor ); 465 bgTypeClicked ( TabConfig::SolidColor );
464} 466}
465 467
466void TabDialog::iconColorClicked ( const QColor &col ) 468void TabDialog::iconColorClicked ( const QColor &col )
467{ 469{
468 m_sample-> setTextColor ( col ); 470 m_sample-> setTextColor ( col );
469} 471}
470 472
471void TabDialog::bgImageClicked ( ) 473void TabDialog::bgImageClicked ( )
472{ 474{
473 // ### use OFileSelector here ### 475 // ### use OFileSelector here ###
474 // this is just a quick c&p from the old appearance app 476 // this is just a quick c&p from the old appearance app
475 477
476 MimeTypes types; 478 MimeTypes types;
477 QStringList list; 479 QStringList list;
478 list << "image/*"; 480 list << "image/*";
479 types. insert ( "Images", list ); 481 types. insert ( "Images", list );
480 482
481 QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); 483 QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types );
482 if ( !file. isEmpty ( )) { 484 if ( !file. isEmpty ( )) {
483 m_bgimage = DocLnk ( file ). file ( ); 485 m_bgimage = DocLnk ( file ). file ( );
484 bgTypeClicked ( TabConfig::Image ); 486 bgTypeClicked ( TabConfig::Image );
485 } 487 }
486} 488}
487 489
488void TabDialog::bgDefaultClicked ( ) 490void TabDialog::bgDefaultClicked ( )
489{ 491{
490 m_bgimage = "launcher/opie-background"; 492 m_bgimage = "launcher/opie-background";
491 bgTypeClicked ( TabConfig::Image ); 493 bgTypeClicked ( TabConfig::Image );
492} 494}
493 495
494void TabDialog::accept ( ) 496void TabDialog::accept ( )
495{ 497{
496 m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); 498 m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( ));
497 m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); 499 m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( ));
498 m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); 500 m_tc. m_bg_color = m_solidcolor-> color ( ). name ( );
499 m_tc. m_bg_image = m_bgimage; 501 m_tc. m_bg_image = m_bgimage;
500 m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); 502 m_tc. m_text_color = m_iconcolor-> color ( ). name ( );
501 503
502 m_tc. m_font_use = m_fontuse-> isChecked ( ); 504 m_tc. m_font_use = m_fontuse-> isChecked ( );
503 505
504 if ( m_tc. m_font_use ) { 506 if ( m_tc. m_font_use ) {
505 QFont f = m_fontselect-> selectedFont ( ); 507 QFont f = m_fontselect-> selectedFont ( );
506 508
507 m_tc. m_font_family = f. family ( ); 509 m_tc. m_font_family = f. family ( );
508 m_tc. m_font_size = f. pointSize ( ); 510 m_tc. m_font_size = f. pointSize ( );
509 m_tc. m_font_weight = f. weight ( ); 511 m_tc. m_font_weight = f. weight ( );
510 m_tc. m_font_italic = f. italic ( ); 512 m_tc. m_font_italic = f. italic ( );
511 } 513 }
512 514
513 QDialog::accept ( ); 515 QDialog::accept ( );
514} 516}
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp
index 43886c9..8dd9e97 100644
--- a/core/settings/launcher/taskbarsettings.cpp
+++ b/core/settings/launcher/taskbarsettings.cpp
@@ -7,166 +7,170 @@
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/* OPIE */
31#include <qpe/config.h> 32#include <qpe/config.h>
32#include <qpe/qlibrary.h> 33#include <qpe/qlibrary.h>
33#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
34#include <qpe/taskbarappletinterface.h> 35#include <qpe/taskbarappletinterface.h>
35#include <qpe/qcopenvelope_qws.h> 36#include <qpe/qcopenvelope_qws.h>
37#include <opie2/odebug.h>
36 38
39/* QT */
37#include <qdir.h> 40#include <qdir.h>
38#include <qlistview.h> 41#include <qlistview.h>
39#include <qheader.h> 42#include <qheader.h>
40#include <qlayout.h> 43#include <qlayout.h>
41#include <qlabel.h> 44#include <qlabel.h>
42#include <qwhatsthis.h> 45#include <qwhatsthis.h>
43 46
47/* STD */
44#include <stdlib.h> 48#include <stdlib.h>
45 49
46 50
47TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) 51TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name )
48 : QWidget ( parent, name ) 52 : QWidget ( parent, name )
49{ 53{
50 m_applets_changed = false; 54 m_applets_changed = false;
51 55
52 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 56 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
53 57
54 QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this ); 58 QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this );
55 lay-> addWidget ( l ); 59 lay-> addWidget ( l );
56 60
57 m_list = new QListView ( this ); 61 m_list = new QListView ( this );
58 m_list-> addColumn ( "foobar" ); 62 m_list-> addColumn ( "foobar" );
59 m_list-> header ( )-> hide ( ); 63 m_list-> header ( )-> hide ( );
60 64
61 lay-> addWidget ( m_list ); 65 lay-> addWidget ( m_list );
62 66
63 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); 67 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." ));
64 68
65 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged())); 69 connect ( m_list, SIGNAL( clicked(QListViewItem*)), this, SLOT( appletChanged()));
66 70
67 init ( ); 71 init ( );
68} 72}
69 73
70void TaskbarSettings::init ( ) 74void TaskbarSettings::init ( )
71{ 75{
72 Config cfg ( "Taskbar" ); 76 Config cfg ( "Taskbar" );
73 cfg. setGroup ( "Applets" ); 77 cfg. setGroup ( "Applets" );
74 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); 78 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
75 79
76 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; 80 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets";
77#ifdef Q_OS_MACX 81#ifdef Q_OS_MACX
78 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); 82 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
79#else 83#else
80 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 84 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
81#endif /* Q_OS_MACX */ 85#endif /* Q_OS_MACX */
82 86
83 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 87 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
84 QString name; 88 QString name;
85 QPixmap icon; 89 QPixmap icon;
86 TaskbarNamedAppletInterface *iface = 0; 90 TaskbarNamedAppletInterface *iface = 0;
87 91
88 qWarning("Load applet: %s", (*it).latin1() ); 92 owarn << "Load applet: " << (*it) << "" << oendl;
89 QLibrary *lib = new QLibrary ( path + "/" + *it ); 93 QLibrary *lib = new QLibrary ( path + "/" + *it );
90 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); 94 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface );
91 qWarning("<1>"); 95 owarn << "<1>" << oendl;
92 if ( iface ) { 96 if ( iface ) {
93 qWarning("<2>"); 97 owarn << "<2>" << oendl;
94 QString lang = getenv( "LANG" ); 98 QString lang = getenv( "LANG" );
95 QTranslator *trans = new QTranslator ( qApp ); 99 QTranslator *trans = new QTranslator ( qApp );
96 QString type = (*it). left ((*it). find (".")); 100 QString type = (*it). left ((*it). find ("."));
97 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; 101 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm";
98 if ( trans-> load ( tfn )) 102 if ( trans-> load ( tfn ))
99 qApp-> installTranslator ( trans ); 103 qApp-> installTranslator ( trans );
100 else 104 else
101 delete trans; 105 delete trans;
102 name = iface-> name ( ); 106 name = iface-> name ( );
103 icon = iface-> icon ( ); 107 icon = iface-> icon ( );
104 iface-> release ( ); 108 iface-> release ( );
105 } 109 }
106 qWarning("<3>"); 110 owarn << "<3>" << oendl;
107 if ( !iface ) { 111 if ( !iface ) {
108 qWarning("<4>"); 112 owarn << "<4>" << oendl;
109 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); 113 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface );
110 114
111 if ( iface ) { 115 if ( iface ) {
112 qWarning("<5>"); 116 owarn << "<5>" << oendl;
113 name = (*it). mid ( 3 ); 117 name = (*it). mid ( 3 );
114 qWarning("Found applet: %s", name.latin1() ); 118 owarn << "Found applet: " << name << "" << oendl;
115#ifdef Q_OS_MACX 119#ifdef Q_OS_MACX
116 int sep = name. find( ".dylib" ); 120 int sep = name. find( ".dylib" );
117#else 121#else
118 int sep = name. find( ".so" ); 122 int sep = name. find( ".so" );
119#endif /* Q_OS_MACX */ 123#endif /* Q_OS_MACX */
120 if ( sep > 0 ) 124 if ( sep > 0 )
121 name. truncate ( sep ); 125 name. truncate ( sep );
122 sep = name. find ( "applet" ); 126 sep = name. find ( "applet" );
123 if ( sep == (int) name.length ( ) - 6 ) 127 if ( sep == (int) name.length ( ) - 6 )
124 name. truncate ( sep ); 128 name. truncate ( sep );
125 name[0] = name[0]. upper ( ); 129 name[0] = name[0]. upper ( );
126 iface-> release ( ); 130 iface-> release ( );
127 } 131 }
128 } 132 }
129 qWarning("<6>"); 133 owarn << "<6>" << oendl;
130 134
131 if ( iface ) { 135 if ( iface ) {
132 qWarning("<7>"); 136 owarn << "<7>" << oendl;
133 QCheckListItem *item; 137 QCheckListItem *item;
134 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 138 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
135 if ( !icon. isNull ( )) 139 if ( !icon. isNull ( ))
136 item-> setPixmap ( 0, icon ); 140 item-> setPixmap ( 0, icon );
137 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 141 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
138 m_applets [*it] = item; 142 m_applets [*it] = item;
139 } 143 }
140 lib-> unload ( ); 144 lib-> unload ( );
141 delete lib; 145 delete lib;
142 } 146 }
143} 147}
144 148
145void TaskbarSettings::appletChanged() 149void TaskbarSettings::appletChanged()
146{ 150{
147 m_applets_changed = true; 151 m_applets_changed = true;
148} 152}
149 153
150void TaskbarSettings::accept ( ) 154void TaskbarSettings::accept ( )
151{ 155{
152 Config cfg ( "Taskbar" ); 156 Config cfg ( "Taskbar" );
153 cfg. setGroup ( "Applets" ); 157 cfg. setGroup ( "Applets" );
154 158
155 if ( m_applets_changed ) { 159 if ( m_applets_changed ) {
156 QStringList exclude; 160 QStringList exclude;
157 QMap <QString, QCheckListItem *>::Iterator it; 161 QMap <QString, QCheckListItem *>::Iterator it;
158 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { 162 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
159 if ( !(*it)-> isOn ( )) 163 if ( !(*it)-> isOn ( ))
160 exclude << it. key ( ); 164 exclude << it. key ( );
161 } 165 }
162 cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); 166 cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
163 } 167 }
164 cfg. writeEntry ( "SafeMode", false ); 168 cfg. writeEntry ( "SafeMode", false );
165 cfg. write ( ); 169 cfg. write ( );
166 170
167 if ( m_applets_changed ) { 171 if ( m_applets_changed ) {
168 QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" ); 172 QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" );
169 m_applets_changed = false; 173 m_applets_changed = false;
170 } 174 }
171} 175}
172 176