author | harlekin <harlekin> | 2004-06-19 10:18:25 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-06-19 10:18:25 (UTC) |
commit | e05195bbaf71fbfca033bef5855085772fa586eb (patch) (unidiff) | |
tree | 2e2aaf7a200ac7f4c2e4a8a76f62fb1ed2f5e590 | |
parent | 48ec0fc077b7834c49c1af1b1279f943ef58de41 (diff) | |
download | opie-e05195bbaf71fbfca033bef5855085772fa586eb.zip opie-e05195bbaf71fbfca033bef5855085772fa586eb.tar.gz opie-e05195bbaf71fbfca033bef5855085772fa586eb.tar.bz2 |
BUGFIX: 0001089 - remember Browse path when selecting a tab background image
-rw-r--r-- | core/settings/launcher/tabconfig.h | 13 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 18 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.cpp | 6 |
3 files changed, 26 insertions, 11 deletions
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h index 9086341..84ba073 100644 --- a/core/settings/launcher/tabconfig.h +++ b/core/settings/launcher/tabconfig.h | |||
@@ -1,71 +1,72 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | #ifndef __TABCONFIG_H__ | 27 | #ifndef __TABCONFIG_H__ |
28 | #define __TABCONFIG_H__ | 28 | #define __TABCONFIG_H__ |
29 | 29 | ||
30 | struct TabConfig { | 30 | struct 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_last_directory; | ||
43 | QString m_bg_image; | 44 | QString m_bg_image; |
44 | QString m_bg_color; | 45 | QString m_bg_color; |
45 | QString m_text_color; | 46 | QString m_text_color; |
46 | bool m_font_use; | 47 | bool m_font_use; |
47 | QString m_font_family; | 48 | QString m_font_family; |
48 | int m_font_size; | 49 | int m_font_size; |
49 | int m_font_weight; | 50 | int m_font_weight; |
50 | bool m_font_italic; | 51 | bool m_font_italic; |
51 | bool m_changed; | 52 | bool m_changed; |
52 | 53 | ||
53 | bool operator == ( const TabConfig &tc ) | 54 | bool operator == ( const TabConfig &tc ) |
54 | { | 55 | { |
55 | return ( m_view == tc. m_view ) && | 56 | return ( m_view == tc. m_view ) && |
56 | ( m_bg_type == tc. m_bg_type ) && | 57 | ( m_bg_type == tc. m_bg_type ) && |
57 | ( m_bg_image == tc. m_bg_image ) && | 58 | ( m_bg_image == tc. m_bg_image ) && |
58 | ( m_bg_color == tc. m_bg_color ) && | 59 | ( m_bg_color == tc. m_bg_color ) && |
59 | ( m_text_color == tc. m_text_color ) && | 60 | ( m_text_color == tc. m_text_color ) && |
60 | ( m_font_use == tc. m_font_use ) && | 61 | ( m_font_use == tc. m_font_use ) && |
61 | ( m_font_use ? ( | 62 | ( m_font_use ? ( |
62 | ( m_font_family == tc. m_font_family ) && | 63 | ( m_font_family == tc. m_font_family ) && |
63 | ( m_font_size == tc. m_font_size ) && | 64 | ( m_font_size == tc. m_font_size ) && |
64 | ( m_font_weight == tc. m_font_weight ) && | 65 | ( m_font_weight == tc. m_font_weight ) && |
65 | ( m_font_italic == tc. m_font_italic ) | 66 | ( m_font_italic == tc. m_font_italic ) |
66 | ) : true ); | 67 | ) : true ); |
67 | 68 | ||
68 | } | 69 | } |
69 | }; | 70 | }; |
70 | 71 | ||
71 | #endif | 72 | #endif |
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index 546e229..cef92d9 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp | |||
@@ -1,516 +1,524 @@ | |||
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 "tabdialog.h" | 28 | #include "tabdialog.h" |
29 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | #include <qpe/resource.h> | 31 | |
32 | #include <opie2/ofontselector.h> | 32 | #include <opie2/ofontselector.h> |
33 | #include <opie2/otabwidget.h> | 33 | #include <opie2/otabwidget.h> |
34 | #include <opie2/ocolorbutton.h> | 34 | #include <opie2/ocolorbutton.h> |
35 | #include <opie2/ofiledialog.h> | 35 | #include <opie2/ofiledialog.h> |
36 | #include <opie2/odebug.h> | 36 | #include <opie2/odebug.h> |
37 | 37 | ||
38 | /* QPE */ | ||
39 | #include <qpe/resource.h> | ||
40 | #include <qpe/qpeapplication.h> | ||
41 | |||
38 | /* QT */ | 42 | /* QT */ |
39 | #include <qlayout.h> | 43 | #include <qlayout.h> |
40 | #include <qvbox.h> | 44 | #include <qvbox.h> |
41 | #include <qtabbar.h> | 45 | #include <qtabbar.h> |
42 | #include <qiconview.h> | 46 | #include <qiconview.h> |
43 | #include <qapplication.h> | 47 | #include <qapplication.h> |
44 | #include <qlabel.h> | 48 | #include <qlabel.h> |
49 | #include <qfileinfo.h> | ||
45 | #include <qradiobutton.h> | 50 | #include <qradiobutton.h> |
46 | #include <qbuttongroup.h> | 51 | #include <qbuttongroup.h> |
47 | #include <qwhatsthis.h> | 52 | #include <qwhatsthis.h> |
48 | #include <qcheckbox.h> | 53 | #include <qcheckbox.h> |
49 | 54 | ||
50 | 55 | ||
51 | using namespace Opie::Ui; | 56 | using namespace Opie::Ui; |
52 | class SampleItem : public QIconViewItem { | 57 | class SampleItem : public QIconViewItem { |
53 | public: | 58 | public: |
54 | SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) | 59 | SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) |
55 | { | 60 | { |
56 | m_large = pix; | 61 | m_large = pix; |
57 | m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); | 62 | m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); |
58 | } | 63 | } |
59 | 64 | ||
60 | void sizeChange ( ) | 65 | void sizeChange ( ) |
61 | { | 66 | { |
62 | calcRect ( ); | 67 | calcRect ( ); |
63 | repaint ( ); | 68 | repaint ( ); |
64 | } | 69 | } |
65 | 70 | ||
66 | QPixmap *pixmap ( ) const | 71 | QPixmap *pixmap ( ) const |
67 | { | 72 | { |
68 | if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) | 73 | if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) |
69 | return (QPixmap *) &m_small; | 74 | return (QPixmap *) &m_small; |
70 | else | 75 | else |
71 | return (QPixmap *) &m_large; | 76 | return (QPixmap *) &m_large; |
72 | } | 77 | } |
73 | 78 | ||
74 | private: | 79 | private: |
75 | QPixmap m_large, m_small; | 80 | QPixmap m_large, m_small; |
76 | }; | 81 | }; |
77 | 82 | ||
78 | class SampleView : public QIconView { | 83 | class SampleView : public QIconView { |
79 | public: | 84 | public: |
80 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) | 85 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) |
81 | { | 86 | { |
82 | setItemsMovable ( false ); | 87 | setItemsMovable ( false ); |
83 | setAutoArrange ( true ); | 88 | setAutoArrange ( true ); |
84 | setSorting ( true ); | 89 | setSorting ( true ); |
85 | setFrameStyle ( QFrame::NoFrame ); | 90 | setFrameStyle ( QFrame::NoFrame ); |
86 | setSpacing ( 4 ); | 91 | setSpacing ( 4 ); |
87 | setMargin ( 0 ); | 92 | setMargin ( 0 ); |
88 | setSelectionMode ( QIconView::NoSelection ); | 93 | setSelectionMode ( QIconView::NoSelection ); |
89 | setBackgroundMode ( PaletteBase ); | 94 | setBackgroundMode ( PaletteBase ); |
90 | setViewMode ( TabConfig::Icon ); | 95 | setViewMode ( TabConfig::Icon ); |
91 | calculateGrid ( Bottom ); | 96 | calculateGrid ( Bottom ); |
92 | 97 | ||
93 | 98 | ||
94 | new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); | 99 | new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); |
95 | new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); | 100 | new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); |
96 | new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); | 101 | new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); |
97 | 102 | ||
98 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 103 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
99 | 104 | ||
100 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); | 105 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); |
101 | } | 106 | } |
102 | 107 | ||
103 | void setViewMode ( TabConfig::ViewMode m ) | 108 | void setViewMode ( TabConfig::ViewMode m ) |
104 | { | 109 | { |
105 | viewport ( )-> setUpdatesEnabled ( false ); | 110 | viewport ( )-> setUpdatesEnabled ( false ); |
106 | 111 | ||
107 | switch ( m ) { | 112 | switch ( m ) { |
108 | case TabConfig::List: | 113 | case TabConfig::List: |
109 | setItemTextPos( QIconView::Right ); | 114 | setItemTextPos( QIconView::Right ); |
110 | break; | 115 | break; |
111 | case TabConfig::Icon: | 116 | case TabConfig::Icon: |
112 | setItemTextPos( QIconView::Bottom ); | 117 | setItemTextPos( QIconView::Bottom ); |
113 | break; | 118 | break; |
114 | } | 119 | } |
115 | // hideOrShowItems ( false ); | 120 | // hideOrShowItems ( false ); |
116 | 121 | ||
117 | for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) | 122 | for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) |
118 | ((SampleItem *) it )-> sizeChange ( ); | 123 | ((SampleItem *) it )-> sizeChange ( ); |
119 | arrangeItemsInGrid ( true ); | 124 | arrangeItemsInGrid ( true ); |
120 | viewport ( )-> setUpdatesEnabled ( true ); | 125 | viewport ( )-> setUpdatesEnabled ( true ); |
121 | update ( ); | 126 | update ( ); |
122 | } | 127 | } |
123 | 128 | ||
124 | 129 | ||
125 | void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) | 130 | void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) |
126 | { | 131 | { |
127 | switch ( t ) { | 132 | switch ( t ) { |
128 | case TabConfig::Ruled: { | 133 | case TabConfig::Ruled: { |
129 | QPixmap bg ( width ( ), 9 ); | 134 | QPixmap bg ( width ( ), 9 ); |
130 | QPainter painter ( &bg ); | 135 | QPainter painter ( &bg ); |
131 | for ( int i = 0; i < 3; i++ ) { | 136 | for ( int i = 0; i < 3; i++ ) { |
132 | painter. setPen ( white ); | 137 | painter. setPen ( white ); |
133 | painter. drawLine ( 0, i*3, width()-1, i*3 ); | 138 | painter. drawLine ( 0, i*3, width()-1, i*3 ); |
134 | painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); | 139 | painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); |
135 | painter. setPen ( colorGroup().background().light(105) ); | 140 | painter. setPen ( colorGroup().background().light(105) ); |
136 | painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); | 141 | painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); |
137 | } | 142 | } |
138 | painter.end ( ); | 143 | painter.end ( ); |
139 | setBackgroundPixmap ( bg ); | 144 | setBackgroundPixmap ( bg ); |
140 | break; | 145 | break; |
141 | } | 146 | } |
142 | 147 | ||
143 | case TabConfig::SolidColor: { | 148 | case TabConfig::SolidColor: { |
144 | setBackgroundPixmap ( QPixmap ( )); | 149 | setBackgroundPixmap ( QPixmap ( )); |
145 | if ( val. isEmpty ( )) | 150 | if ( val. isEmpty ( )) |
146 | setBackgroundColor ( colorGroup ( ). base ( )); | 151 | setBackgroundColor ( colorGroup ( ). base ( )); |
147 | else | 152 | else |
148 | setBackgroundColor ( val ); | 153 | setBackgroundColor ( val ); |
149 | break; | 154 | break; |
150 | } | 155 | } |
151 | 156 | ||
152 | case TabConfig::Image: { | 157 | case TabConfig::Image: { |
153 | odebug << "Loading image: " << val << "" << oendl; | 158 | odebug << "Loading image: " << val << "" << oendl; |
154 | QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); | 159 | QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); |
155 | if ( bg. isNull ( )) { | 160 | if ( bg. isNull ( )) { |
156 | QImageIO imgio; | 161 | QImageIO imgio; |
157 | imgio. setFileName ( val ); | 162 | imgio. setFileName ( val ); |
158 | QSize ds = qApp-> desktop ( )-> size ( ); | 163 | QSize ds = qApp-> desktop ( )-> size ( ); |
159 | QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr | 164 | QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr |
160 | imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); | 165 | imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); |
161 | imgio. read ( ); | 166 | imgio. read ( ); |
162 | bg = imgio. image ( ); | 167 | bg = imgio. image ( ); |
163 | } | 168 | } |
164 | setBackgroundPixmap ( bg ); | 169 | setBackgroundPixmap ( bg ); |
165 | break; | 170 | break; |
166 | } | 171 | } |
167 | } | 172 | } |
168 | m_bgtype = t; | 173 | m_bgtype = t; |
169 | viewport ( )-> update ( ); | 174 | viewport ( )-> update ( ); |
170 | } | 175 | } |
171 | 176 | ||
172 | void setTextColor ( const QColor &tc ) | 177 | void setTextColor ( const QColor &tc ) |
173 | { | 178 | { |
174 | m_textcolor = tc; | 179 | m_textcolor = tc; |
175 | QColorGroup cg = colorGroup ( ); | 180 | QColorGroup cg = colorGroup ( ); |
176 | cg. setColor ( QColorGroup::Text, tc ); | 181 | cg. setColor ( QColorGroup::Text, tc ); |
177 | setPalette ( QPalette ( cg, cg, cg )); | 182 | setPalette ( QPalette ( cg, cg, cg )); |
178 | viewport ( )-> update ( ); | 183 | viewport ( )-> update ( ); |
179 | } | 184 | } |
180 | 185 | ||
181 | void setViewFont ( const QFont &f ) | 186 | void setViewFont ( const QFont &f ) |
182 | { | 187 | { |
183 | setFont ( f ); | 188 | setFont ( f ); |
184 | } | 189 | } |
185 | 190 | ||
186 | void setItemTextPos ( ItemTextPos pos ) | 191 | void setItemTextPos ( ItemTextPos pos ) |
187 | { | 192 | { |
188 | calculateGrid ( pos ); | 193 | calculateGrid ( pos ); |
189 | QIconView::setItemTextPos( pos ); | 194 | QIconView::setItemTextPos( pos ); |
190 | } | 195 | } |
191 | 196 | ||
192 | void calculateGrid ( ItemTextPos pos ) | 197 | void calculateGrid ( ItemTextPos pos ) |
193 | { | 198 | { |
194 | int dw = QApplication::desktop ( )-> width ( ); | 199 | int dw = QApplication::desktop ( )-> width ( ); |
195 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); | 200 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); |
196 | if ( pos == Bottom ) { | 201 | if ( pos == Bottom ) { |
197 | int cols = 3; | 202 | int cols = 3; |
198 | if ( viewerWidth <= 200 ) | 203 | if ( viewerWidth <= 200 ) |
199 | cols = 2; | 204 | cols = 2; |
200 | else if ( viewerWidth >= 400 ) | 205 | else if ( viewerWidth >= 400 ) |
201 | cols = viewerWidth/96; | 206 | cols = viewerWidth/96; |
202 | setSpacing ( 4 ); | 207 | setSpacing ( 4 ); |
203 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 208 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
204 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); | 209 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); |
205 | } | 210 | } |
206 | else { | 211 | else { |
207 | int cols = 2; | 212 | int cols = 2; |
208 | if ( viewerWidth < 150 ) | 213 | if ( viewerWidth < 150 ) |
209 | cols = 1; | 214 | cols = 1; |
210 | else if ( viewerWidth >= 400 ) | 215 | else if ( viewerWidth >= 400 ) |
211 | cols = viewerWidth / 150; | 216 | cols = viewerWidth / 150; |
212 | setSpacing ( 2 ); | 217 | setSpacing ( 2 ); |
213 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 218 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
214 | setGridY ( fontMetrics ( ). height ( ) + 2 ); | 219 | setGridY ( fontMetrics ( ). height ( ) + 2 ); |
215 | } | 220 | } |
216 | } | 221 | } |
217 | 222 | ||
218 | void paletteChange( const QPalette &p ) | 223 | void paletteChange( const QPalette &p ) |
219 | { | 224 | { |
220 | static bool excllock = false; | 225 | static bool excllock = false; |
221 | 226 | ||
222 | if ( excllock ) | 227 | if ( excllock ) |
223 | return; | 228 | return; |
224 | excllock = true; | 229 | excllock = true; |
225 | 230 | ||
226 | unsetPalette ( ); | 231 | unsetPalette ( ); |
227 | QIconView::paletteChange ( p ); | 232 | QIconView::paletteChange ( p ); |
228 | if ( m_bgtype == TabConfig::Ruled ) | 233 | if ( m_bgtype == TabConfig::Ruled ) |
229 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 234 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
230 | QColorGroup cg = colorGroup ( ); | 235 | QColorGroup cg = colorGroup ( ); |
231 | cg.setColor ( QColorGroup::Text, m_textcolor ); | 236 | cg.setColor ( QColorGroup::Text, m_textcolor ); |
232 | setPalette ( QPalette ( cg, cg, cg )); | 237 | setPalette ( QPalette ( cg, cg, cg )); |
233 | 238 | ||
234 | excllock = false; | 239 | excllock = false; |
235 | } | 240 | } |
236 | 241 | ||
237 | void setBackgroundPixmap ( const QPixmap &pm ) | 242 | void setBackgroundPixmap ( const QPixmap &pm ) |
238 | { | 243 | { |
239 | m_bgpix = pm; | 244 | m_bgpix = pm; |
240 | } | 245 | } |
241 | 246 | ||
242 | void setBackgroundColor ( const QColor &c ) | 247 | void setBackgroundColor ( const QColor &c ) |
243 | { | 248 | { |
244 | m_bgcolor = c; | 249 | m_bgcolor = c; |
245 | } | 250 | } |
246 | 251 | ||
247 | void drawBackground ( QPainter *p, const QRect &r ) | 252 | void drawBackground ( QPainter *p, const QRect &r ) |
248 | { | 253 | { |
249 | if ( !m_bgpix. isNull ( )) { | 254 | if ( !m_bgpix. isNull ( )) { |
250 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), | 255 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), |
251 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); | 256 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); |
252 | } | 257 | } |
253 | else | 258 | else |
254 | p-> fillRect ( r, m_bgcolor ); | 259 | p-> fillRect ( r, m_bgcolor ); |
255 | } | 260 | } |
256 | 261 | ||
257 | private: | 262 | private: |
258 | QColor m_textcolor; | 263 | QColor m_textcolor; |
259 | QColor m_bgcolor; | 264 | QColor m_bgcolor; |
260 | QPixmap m_bgpix; | 265 | QPixmap m_bgpix; |
261 | TabConfig::BackgroundType m_bgtype; | 266 | TabConfig::BackgroundType m_bgtype; |
262 | }; | 267 | }; |
263 | 268 | ||
264 | 269 | ||
265 | 270 | ||
266 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) | 271 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) |
267 | : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) | 272 | : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) |
268 | { | 273 | { |
269 | setCaption ( tr( "Edit Tab" )); | 274 | setCaption ( tr( "Edit Tab" )); |
270 | 275 | ||
271 | QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); | 276 | QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); |
272 | 277 | ||
273 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 278 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
274 | QWidget *bgtab; | 279 | QWidget *bgtab; |
275 | 280 | ||
276 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" )); | 281 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" )); |
277 | tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); | 282 | tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); |
278 | tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); | 283 | tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); |
279 | 284 | ||
280 | tw-> setCurrentTab ( bgtab ); | 285 | tw-> setCurrentTab ( bgtab ); |
281 | 286 | ||
282 | QWidget *sample = new QVBox ( this ); | 287 | QWidget *sample = new QVBox ( this ); |
283 | QTabBar *tb = new QTabBar ( sample ); | 288 | QTabBar *tb = new QTabBar ( sample ); |
284 | QString name ( tr( "Previewing %1" ). arg ( tabname )); | 289 | QString name ( tr( "Previewing %1" ). arg ( tabname )); |
285 | 290 | ||
286 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); | 291 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); |
287 | 292 | ||
288 | m_sample = new SampleView ( sample ); | 293 | m_sample = new SampleView ( sample ); |
289 | 294 | ||
290 | lay-> addWidget ( tw, 10 ); | 295 | lay-> addWidget ( tw, 10 ); |
291 | lay-> addWidget ( sample, 1 ); | 296 | lay-> addWidget ( sample, 1 ); |
292 | 297 | ||
293 | m_iconsize-> setButton ( tc. m_view ); | 298 | m_iconsize-> setButton ( tc. m_view ); |
294 | iconSizeClicked ( tc. m_view ); | 299 | iconSizeClicked ( tc. m_view ); |
295 | //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); | 300 | //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); |
296 | iconColorClicked ( m_iconcolor-> color ( )); | 301 | iconColorClicked ( m_iconcolor-> color ( )); |
297 | m_bgtype-> setButton ( tc. m_bg_type ); | 302 | m_bgtype-> setButton ( tc. m_bg_type ); |
298 | //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); | 303 | //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); |
299 | m_bgimage = tc. m_bg_image; | 304 | m_bgimage = tc. m_bg_image; |
300 | bgTypeClicked ( tc. m_bg_type ); | 305 | bgTypeClicked ( tc. m_bg_type ); |
301 | m_fontuse-> setChecked ( tc. m_font_use ); | 306 | m_fontuse-> setChecked ( tc. m_font_use ); |
302 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); | 307 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); |
303 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); | 308 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); |
304 | fontClicked ( m_fontselect-> selectedFont ( )); | 309 | fontClicked ( m_fontselect-> selectedFont ( )); |
305 | 310 | ||
306 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); | 311 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); |
307 | } | 312 | } |
308 | 313 | ||
309 | 314 | ||
310 | TabDialog::~TabDialog ( ) | 315 | TabDialog::~TabDialog ( ) |
311 | { | 316 | { |
312 | } | 317 | } |
313 | 318 | ||
314 | QWidget *TabDialog::createFontTab ( QWidget *parent ) | 319 | QWidget *TabDialog::createFontTab ( QWidget *parent ) |
315 | { | 320 | { |
316 | QWidget *tab = new QWidget ( parent, "FontTab" ); | 321 | QWidget *tab = new QWidget ( parent, "FontTab" ); |
317 | QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); | 322 | QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); |
318 | 323 | ||
319 | m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); | 324 | m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); |
320 | vertLayout-> addWidget ( m_fontuse ); | 325 | vertLayout-> addWidget ( m_fontuse ); |
321 | 326 | ||
322 | m_fontselect = new OFontSelector ( false, tab, "fontsel" ); | 327 | m_fontselect = new OFontSelector ( false, tab, "fontsel" ); |
323 | vertLayout-> addWidget ( m_fontselect ); | 328 | vertLayout-> addWidget ( m_fontselect ); |
324 | 329 | ||
325 | connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool))); | 330 | connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool))); |
326 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), | 331 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), |
327 | this, SLOT( fontClicked(const QFont&))); | 332 | this, SLOT( fontClicked(const QFont&))); |
328 | 333 | ||
329 | return tab; | 334 | return tab; |
330 | } | 335 | } |
331 | 336 | ||
332 | QWidget *TabDialog::createBgTab ( QWidget *parent ) | 337 | QWidget *TabDialog::createBgTab ( QWidget *parent ) |
333 | { | 338 | { |
334 | QWidget *tab = new QWidget( parent, "BgTab" ); | 339 | QWidget *tab = new QWidget( parent, "BgTab" ); |
335 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 340 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
336 | 341 | ||
337 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 342 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
338 | gridLayout-> setColStretch ( 1, 10 ); | 343 | gridLayout-> setColStretch ( 1, 10 ); |
339 | 344 | ||
340 | QLabel* label = new QLabel( tr( "Type:" ), tab ); | 345 | QLabel* label = new QLabel( tr( "Type:" ), tab ); |
341 | gridLayout-> addWidget ( label, 0, 0 ); | 346 | gridLayout-> addWidget ( label, 0, 0 ); |
342 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); | 347 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); |
343 | m_bgtype-> hide ( ); | 348 | m_bgtype-> hide ( ); |
344 | m_bgtype-> setExclusive ( true ); | 349 | m_bgtype-> setExclusive ( true ); |
345 | 350 | ||
346 | QRadioButton *rb; | 351 | QRadioButton *rb; |
347 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); | 352 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); |
348 | m_bgtype-> insert ( rb, TabConfig::Ruled ); | 353 | m_bgtype-> insert ( rb, TabConfig::Ruled ); |
349 | gridLayout-> addWidget( rb, 0, 1 ); | 354 | gridLayout-> addWidget( rb, 0, 1 ); |
350 | 355 | ||
351 | QHBoxLayout *hb = new QHBoxLayout ( ); | 356 | QHBoxLayout *hb = new QHBoxLayout ( ); |
352 | hb-> setSpacing ( 3 ); | 357 | hb-> setSpacing ( 3 ); |
353 | 358 | ||
354 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); | 359 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); |
355 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); | 360 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); |
356 | hb-> addWidget ( rb ); | 361 | hb-> addWidget ( rb ); |
357 | hb-> addSpacing ( 10 ); | 362 | hb-> addSpacing ( 10 ); |
358 | 363 | ||
359 | m_solidcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); | 364 | m_solidcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); |
360 | connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&))); | 365 | connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&))); |
361 | hb-> addWidget ( m_solidcolor ); | 366 | hb-> addWidget ( m_solidcolor ); |
362 | hb-> addStretch ( 10 ); | 367 | hb-> addStretch ( 10 ); |
363 | 368 | ||
364 | gridLayout-> addLayout ( hb, 1, 1 ); | 369 | gridLayout-> addLayout ( hb, 1, 1 ); |
365 | 370 | ||
366 | hb = new QHBoxLayout ( ); | 371 | hb = new QHBoxLayout ( ); |
367 | hb-> setSpacing ( 3 ); | 372 | hb-> setSpacing ( 3 ); |
368 | 373 | ||
369 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); | 374 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); |
370 | m_bgtype-> insert ( rb, TabConfig::Image ); | 375 | m_bgtype-> insert ( rb, TabConfig::Image ); |
371 | hb-> addWidget( rb ); | 376 | hb-> addWidget( rb ); |
372 | hb-> addSpacing ( 10 ); | 377 | hb-> addSpacing ( 10 ); |
373 | 378 | ||
374 | m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); | 379 | m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); |
375 | connect ( m_imagebrowse, SIGNAL( clicked()), this, SLOT( bgImageClicked())); | 380 | connect ( m_imagebrowse, SIGNAL( clicked()), this, SLOT( bgImageClicked())); |
376 | hb-> addWidget ( m_imagebrowse ); | 381 | hb-> addWidget ( m_imagebrowse ); |
377 | hb-> addStretch ( 10 ); | 382 | hb-> addStretch ( 10 ); |
378 | 383 | ||
379 | gridLayout-> addLayout ( hb, 2, 1 ); | 384 | gridLayout-> addLayout ( hb, 2, 1 ); |
380 | 385 | ||
381 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); | 386 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); |
382 | connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked())); | 387 | connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked())); |
383 | gridLayout-> addWidget ( p, 3, 1 ); | 388 | gridLayout-> addWidget ( p, 3, 1 ); |
384 | 389 | ||
385 | connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int))); | 390 | connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int))); |
386 | 391 | ||
387 | vertLayout-> addStretch ( 10 ); | 392 | vertLayout-> addStretch ( 10 ); |
388 | 393 | ||
389 | return tab; | 394 | return tab; |
390 | } | 395 | } |
391 | 396 | ||
392 | QWidget *TabDialog::createIconTab ( QWidget *parent ) | 397 | QWidget *TabDialog::createIconTab ( QWidget *parent ) |
393 | { | 398 | { |
394 | QWidget *tab = new QWidget( parent, "IconTab" ); | 399 | QWidget *tab = new QWidget( parent, "IconTab" ); |
395 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 400 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
396 | 401 | ||
397 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 402 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
398 | gridLayout-> setColStretch ( 1, 10 ); | 403 | gridLayout-> setColStretch ( 1, 10 ); |
399 | 404 | ||
400 | QLabel* label = new QLabel( tr( "Size:" ), tab ); | 405 | QLabel* label = new QLabel( tr( "Size:" ), tab ); |
401 | gridLayout-> addWidget ( label, 0, 0 ); | 406 | gridLayout-> addWidget ( label, 0, 0 ); |
402 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); | 407 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); |
403 | m_iconsize-> hide ( ); | 408 | m_iconsize-> hide ( ); |
404 | m_iconsize-> setExclusive ( true ); | 409 | m_iconsize-> setExclusive ( true ); |
405 | 410 | ||
406 | QRadioButton *rb; | 411 | QRadioButton *rb; |
407 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); | 412 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); |
408 | m_iconsize-> insert ( rb, TabConfig::List ); | 413 | m_iconsize-> insert ( rb, TabConfig::List ); |
409 | gridLayout-> addWidget( rb, 0, 1 ); | 414 | gridLayout-> addWidget( rb, 0, 1 ); |
410 | 415 | ||
411 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); | 416 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); |
412 | m_iconsize-> insert ( rb, TabConfig::Icon ); | 417 | m_iconsize-> insert ( rb, TabConfig::Icon ); |
413 | gridLayout-> addWidget( rb, 1, 1 ); | 418 | gridLayout-> addWidget( rb, 1, 1 ); |
414 | 419 | ||
415 | connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int))); | 420 | connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int))); |
416 | 421 | ||
417 | // vertLayout-> addSpacing ( 8 ); | ||
418 | |||
419 | // gridLayout = new QGridLayout ( vertLayout ); | ||
420 | gridLayout-> addRowSpacing ( 2, 8 ); | 422 | gridLayout-> addRowSpacing ( 2, 8 ); |
421 | 423 | ||
422 | label = new QLabel ( tr( "Color:" ), tab ); | 424 | label = new QLabel ( tr( "Color:" ), tab ); |
423 | gridLayout-> addWidget ( label, 3, 0 ); | 425 | gridLayout-> addWidget ( label, 3, 0 ); |
424 | 426 | ||
425 | m_iconcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_text_color ) ); | 427 | m_iconcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_text_color ) ); |
426 | connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&))); | 428 | connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&))); |
427 | gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); | 429 | gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); |
428 | 430 | ||
429 | vertLayout-> addStretch ( 10 ); | 431 | vertLayout-> addStretch ( 10 ); |
430 | 432 | ||
433 | if ( m_tc.m_last_directory == QString::null ) { | ||
434 | m_tc.m_last_directory = QPEApplication::documentDir(); | ||
435 | } | ||
436 | |||
431 | return tab; | 437 | return tab; |
432 | } | 438 | } |
433 | 439 | ||
434 | 440 | ||
435 | void TabDialog::iconSizeClicked ( int s ) | 441 | void TabDialog::iconSizeClicked ( int s ) |
436 | { | 442 | { |
437 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); | 443 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); |
438 | } | 444 | } |
439 | 445 | ||
440 | void TabDialog::fontClicked ( const QFont &f ) | 446 | void TabDialog::fontClicked ( const QFont &f ) |
441 | { | 447 | { |
442 | m_sample-> setViewFont ( f ); | 448 | m_sample-> setViewFont ( f ); |
443 | } | 449 | } |
444 | 450 | ||
445 | void TabDialog::bgTypeClicked ( int t ) | 451 | void TabDialog::bgTypeClicked ( int t ) |
446 | { | 452 | { |
447 | QString s; | 453 | QString s; |
448 | 454 | ||
449 | if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) | 455 | if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) |
450 | m_bgtype-> setButton ( t ); | 456 | m_bgtype-> setButton ( t ); |
451 | 457 | ||
452 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); | 458 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); |
453 | m_imagebrowse-> setEnabled ( t == TabConfig::Image ); | 459 | m_imagebrowse-> setEnabled ( t == TabConfig::Image ); |
454 | 460 | ||
455 | if ( t == TabConfig::SolidColor ) | 461 | if ( t == TabConfig::SolidColor ) |
456 | s = m_solidcolor-> color ( ). name ( ); | 462 | s = m_solidcolor-> color ( ). name ( ); |
457 | else if ( t == TabConfig::Image ) | 463 | else if ( t == TabConfig::Image ) |
458 | s = Resource::findPixmap ( m_bgimage ); | 464 | s = Resource::findPixmap ( m_bgimage ); |
459 | 465 | ||
460 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); | 466 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); |
461 | } | 467 | } |
462 | 468 | ||
463 | void TabDialog::bgColorClicked ( const QColor & ) | 469 | void TabDialog::bgColorClicked ( const QColor & ) |
464 | { | 470 | { |
465 | bgTypeClicked ( TabConfig::SolidColor ); | 471 | bgTypeClicked ( TabConfig::SolidColor ); |
466 | } | 472 | } |
467 | 473 | ||
468 | void TabDialog::iconColorClicked ( const QColor &col ) | 474 | void TabDialog::iconColorClicked ( const QColor &col ) |
469 | { | 475 | { |
470 | m_sample-> setTextColor ( col ); | 476 | m_sample-> setTextColor ( col ); |
471 | } | 477 | } |
472 | 478 | ||
473 | void TabDialog::bgImageClicked ( ) | 479 | void TabDialog::bgImageClicked ( ) |
474 | { | 480 | { |
475 | // ### use OFileSelector here ### | 481 | // ### use OFileSelector here ### |
476 | // this is just a quick c&p from the old appearance app | 482 | // this is just a quick c&p from the old appearance app |
477 | 483 | ||
478 | MimeTypes types; | 484 | MimeTypes types; |
479 | QStringList list; | 485 | QStringList list; |
480 | list << "image/*"; | 486 | list << "image/*"; |
481 | types. insert ( "Images", list ); | 487 | types. insert ( "Images", list ); |
482 | 488 | ||
483 | QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); | 489 | QString file = OFileDialog::getOpenFileName ( 1, m_tc.m_last_directory, QString::null, types ); |
490 | |||
484 | if ( !file. isEmpty ( )) { | 491 | if ( !file. isEmpty ( )) { |
492 | m_tc.m_last_directory = QFileInfo( file ).dirPath(); | ||
485 | m_bgimage = DocLnk ( file ). file ( ); | 493 | m_bgimage = DocLnk ( file ). file ( ); |
486 | bgTypeClicked ( TabConfig::Image ); | 494 | bgTypeClicked ( TabConfig::Image ); |
487 | } | 495 | } |
488 | } | 496 | } |
489 | 497 | ||
490 | void TabDialog::bgDefaultClicked ( ) | 498 | void TabDialog::bgDefaultClicked ( ) |
491 | { | 499 | { |
492 | m_bgimage = "launcher/opie-background"; | 500 | m_bgimage = "launcher/opie-background"; |
493 | bgTypeClicked ( TabConfig::Image ); | 501 | bgTypeClicked ( TabConfig::Image ); |
494 | } | 502 | } |
495 | 503 | ||
496 | void TabDialog::accept ( ) | 504 | void TabDialog::accept ( ) |
497 | { | 505 | { |
498 | m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); | 506 | m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); |
499 | m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); | 507 | m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); |
500 | m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); | 508 | m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); |
501 | m_tc. m_bg_image = m_bgimage; | 509 | m_tc. m_bg_image = m_bgimage; |
502 | m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); | 510 | m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); |
503 | 511 | ||
504 | m_tc. m_font_use = m_fontuse-> isChecked ( ); | 512 | m_tc. m_font_use = m_fontuse-> isChecked ( ); |
505 | 513 | ||
506 | if ( m_tc. m_font_use ) { | 514 | if ( m_tc. m_font_use ) { |
507 | QFont f = m_fontselect-> selectedFont ( ); | 515 | QFont f = m_fontselect-> selectedFont ( ); |
508 | 516 | ||
509 | m_tc. m_font_family = f. family ( ); | 517 | m_tc. m_font_family = f. family ( ); |
510 | m_tc. m_font_size = f. pointSize ( ); | 518 | m_tc. m_font_size = f. pointSize ( ); |
511 | m_tc. m_font_weight = f. weight ( ); | 519 | m_tc. m_font_weight = f. weight ( ); |
512 | m_tc. m_font_italic = f. italic ( ); | 520 | m_tc. m_font_italic = f. italic ( ); |
513 | } | 521 | } |
514 | 522 | ||
515 | QDialog::accept ( ); | 523 | QDialog::accept ( ); |
516 | } | 524 | } |
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp index e5a7087..5ac625b 100644 --- a/core/settings/launcher/tabssettings.cpp +++ b/core/settings/launcher/tabssettings.cpp | |||
@@ -1,317 +1,323 @@ | |||
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/resource.h> | 30 | #include <qpe/resource.h> |
31 | #include <qpe/applnk.h> | 31 | #include <qpe/applnk.h> |
32 | #include <qpe/mimetype.h> | 32 | #include <qpe/mimetype.h> |
33 | #include <qpe/qcopenvelope_qws.h> | 33 | #include <qpe/qcopenvelope_qws.h> |
34 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.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 ".global." | 50 | #define GLOBALID ".global." |
51 | 51 | ||
52 | 52 | ||
53 | TabsSettings::TabsSettings ( QWidget *parent, const char *name ) | 53 | TabsSettings::TabsSettings ( QWidget *parent, const char *name ) |
54 | : QWidget ( parent, name ) | 54 | : QWidget ( parent, name ) |
55 | { | 55 | { |
56 | QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); | 56 | QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); |
57 | 57 | ||
58 | QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); | 58 | QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); |
59 | lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); | 59 | lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); |
60 | 60 | ||
61 | m_list = new QListBox ( this ); | 61 | m_list = new QListBox ( this ); |
62 | lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); | 62 | lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); |
63 | 63 | ||
64 | QWhatsThis::add ( m_list, tr( "foobar" )); | 64 | QWhatsThis::add ( m_list, tr( "foobar" )); |
65 | 65 | ||
66 | QPushButton *p1, *p2, *p3; | 66 | QPushButton *p1, *p2, *p3; |
67 | p1 = new QPushButton ( tr( "New" ), this ); | 67 | p1 = new QPushButton ( tr( "New" ), this ); |
68 | lay-> addWidget ( p1, 1, 1 ); | 68 | lay-> addWidget ( p1, 1, 1 ); |
69 | connect ( p1, SIGNAL( clicked()), this, SLOT( newClicked())); | 69 | connect ( p1, SIGNAL( clicked()), this, SLOT( newClicked())); |
70 | 70 | ||
71 | p2 = new QPushButton ( tr( "Edit" ), this ); | 71 | p2 = new QPushButton ( tr( "Edit" ), this ); |
72 | lay-> addWidget ( p2, 2, 1 ); | 72 | lay-> addWidget ( p2, 2, 1 ); |
73 | connect ( p2, SIGNAL( clicked()), this, SLOT( editClicked())); | 73 | connect ( p2, SIGNAL( clicked()), this, SLOT( editClicked())); |
74 | 74 | ||
75 | p3 = new QPushButton ( tr( "Delete" ), this ); | 75 | p3 = new QPushButton ( tr( "Delete" ), this ); |
76 | lay-> addWidget ( p3, 3, 1 ); | 76 | lay-> addWidget ( p3, 3, 1 ); |
77 | connect ( p3, SIGNAL( clicked()), this, SLOT( deleteClicked())); | 77 | connect ( p3, SIGNAL( clicked()), this, SLOT( deleteClicked())); |
78 | 78 | ||
79 | lay-> setRowStretch ( 4, 10 ); | 79 | lay-> setRowStretch ( 4, 10 ); |
80 | 80 | ||
81 | m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this ); | 81 | m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this ); |
82 | lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 ); | 82 | lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 ); |
83 | 83 | ||
84 | m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this ); | 84 | m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this ); |
85 | lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 ); | 85 | lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 ); |
86 | 86 | ||
87 | p1-> setEnabled ( false ); | 87 | p1-> setEnabled ( false ); |
88 | p3-> setEnabled ( false ); | 88 | p3-> setEnabled ( false ); |
89 | 89 | ||
90 | init ( ); | 90 | init ( ); |
91 | 91 | ||
92 | QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." )); | 92 | QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." )); |
93 | 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>." )); | 93 | 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>." )); |
94 | QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." )); | 94 | QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." )); |
95 | QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); | 95 | QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); |
96 | QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." )); | 96 | QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." )); |
97 | QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." )); | 97 | QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." )); |
98 | } | 98 | } |
99 | 99 | ||
100 | void TabsSettings::init ( ) | 100 | void TabsSettings::init ( ) |
101 | { | 101 | { |
102 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); | 102 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); |
103 | QStringList types = rootFolder. types ( ); | 103 | QStringList types = rootFolder. types ( ); |
104 | 104 | ||
105 | m_list-> insertItem ( tr( "All Tabs" )); | 105 | m_list-> insertItem ( tr( "All Tabs" )); |
106 | m_ids << GLOBALID; | 106 | m_ids << GLOBALID; |
107 | 107 | ||
108 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { | 108 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { |
109 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); | 109 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); |
110 | m_ids << *it; | 110 | m_ids << *it; |
111 | } | 111 | } |
112 | QImage img ( Resource::loadImage ( "DocsIcon" )); | 112 | QImage img ( Resource::loadImage ( "DocsIcon" )); |
113 | QPixmap pix; | 113 | QPixmap pix; |
114 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); | 114 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); |
115 | m_list-> insertItem ( pix, tr( "Documents" )); | 115 | m_list-> insertItem ( pix, tr( "Documents" )); |
116 | m_ids += "Documents"; // No tr | 116 | m_ids += "Documents"; // No tr |
117 | 117 | ||
118 | Config cfg ( "Launcher" ); | 118 | Config cfg ( "Launcher" ); |
119 | 119 | ||
120 | readTabSettings ( cfg ); | 120 | readTabSettings ( cfg ); |
121 | 121 | ||
122 | cfg. setGroup ( "GUI" ); | 122 | cfg. setGroup ( "GUI" ); |
123 | m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); | 123 | m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); |
124 | m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); | 124 | m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); |
125 | } | 125 | } |
126 | 126 | ||
127 | 127 | ||
128 | void TabsSettings::readTabSettings ( Config &cfg ) | 128 | void TabsSettings::readTabSettings ( Config &cfg ) |
129 | { | 129 | { |
130 | QString grp ( "Tab %1" ); // No tr | 130 | QString grp ( "Tab %1" ); // No tr |
131 | m_tabs. clear ( ); | 131 | m_tabs. clear ( ); |
132 | 132 | ||
133 | TabConfig global_def; | 133 | TabConfig global_def; |
134 | global_def. m_view = TabConfig::Icon; | 134 | global_def. m_view = TabConfig::Icon; |
135 | global_def. m_bg_type = TabConfig::Ruled; | 135 | global_def. m_bg_type = TabConfig::Ruled; |
136 | global_def. m_bg_image = "launcher/opie-background"; | 136 | global_def. m_bg_image = "launcher/opie-background"; |
137 | global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); | 137 | global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); |
138 | global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); | 138 | global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); |
139 | global_def. m_font_use = false; | 139 | global_def. m_font_use = false; |
140 | global_def. m_font_family = font ( ). family ( ); | 140 | global_def. m_font_family = font ( ). family ( ); |
141 | global_def. m_font_size = font ( ). pointSize ( ); | 141 | global_def. m_font_size = font ( ). pointSize ( ); |
142 | global_def. m_font_weight = 50; | 142 | global_def. m_font_weight = 50; |
143 | global_def. m_font_italic = false; | 143 | global_def. m_font_italic = false; |
144 | global_def. m_changed = false; | 144 | global_def. m_changed = false; |
145 | 145 | ||
146 | Config cfg2 = Config( "Launchersettings" ); | ||
146 | 147 | ||
147 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 148 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
148 | TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; | 149 | TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; |
149 | 150 | ||
150 | cfg. setGroup ( grp. arg ( *it )); | 151 | cfg. setGroup ( grp. arg ( *it )); |
152 | cfg2. setGroup( grp. arg ( *it )); | ||
151 | 153 | ||
152 | QString view = cfg. readEntry ( "View" ); | 154 | QString view = cfg. readEntry ( "View" ); |
153 | if ( view == "Icon" ) // No tr | 155 | if ( view == "Icon" ) // No tr |
154 | tc. m_view = TabConfig::Icon; | 156 | tc. m_view = TabConfig::Icon; |
155 | if ( view == "List" ) // No tr | 157 | if ( view == "List" ) // No tr |
156 | tc. m_view = TabConfig::List; | 158 | tc. m_view = TabConfig::List; |
157 | 159 | ||
158 | QString bgType = cfg. readEntry ( "BackgroundType" ); | 160 | QString bgType = cfg. readEntry ( "BackgroundType" ); |
159 | if ( bgType == "Image" ) | 161 | if ( bgType == "Image" ) |
160 | tc. m_bg_type = TabConfig::Image; | 162 | tc. m_bg_type = TabConfig::Image; |
161 | else if ( bgType == "SolidColor" ) | 163 | else if ( bgType == "SolidColor" ) |
162 | tc. m_bg_type = TabConfig::SolidColor; | 164 | tc. m_bg_type = TabConfig::SolidColor; |
163 | else if ( bgType == "Image" ) // No tr | 165 | else if ( bgType == "Image" ) // No tr |
164 | tc. m_bg_type = TabConfig::Image; | 166 | tc. m_bg_type = TabConfig::Image; |
165 | 167 | ||
166 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); | 168 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); |
169 | tc. m_last_directory = cfg2.readEntry( "DefaultDir", "" ); | ||
167 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); | 170 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); |
168 | tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); | 171 | tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); |
169 | QStringList f = cfg. readListEntry ( "Font", ',' ); | 172 | QStringList f = cfg. readListEntry ( "Font", ',' ); |
170 | if ( f. count ( ) == 4 ) { | 173 | if ( f. count ( ) == 4 ) { |
171 | tc. m_font_use = true; | 174 | tc. m_font_use = true; |
172 | tc. m_font_family = f [0]; | 175 | tc. m_font_family = f [0]; |
173 | tc. m_font_size = f [1]. toInt ( ); | 176 | tc. m_font_size = f [1]. toInt ( ); |
174 | tc. m_font_weight = f [2]. toInt ( ); | 177 | tc. m_font_weight = f [2]. toInt ( ); |
175 | tc. m_font_italic = ( f [3]. toInt ( )); | 178 | tc. m_font_italic = ( f [3]. toInt ( )); |
176 | } | 179 | } |
177 | m_tabs [*it] = tc; | 180 | m_tabs [*it] = tc; |
178 | } | 181 | } |
179 | 182 | ||
180 | // if all tabs have the same config, then initialize the GLOBALID tab to these values | 183 | // if all tabs have the same config, then initialize the GLOBALID tab to these values |
181 | 184 | ||
182 | TabConfig *first = 0; | 185 | TabConfig *first = 0; |
183 | bool same = true; | 186 | bool same = true; |
184 | 187 | ||
185 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 188 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
186 | if ( *it == GLOBALID ) | 189 | if ( *it == GLOBALID ) |
187 | continue; | 190 | continue; |
188 | else if ( !first ) | 191 | else if ( !first ) |
189 | first = &m_tabs [*it]; | 192 | first = &m_tabs [*it]; |
190 | else | 193 | else |
191 | same &= ( *first == m_tabs [*it] ); | 194 | same &= ( *first == m_tabs [*it] ); |
192 | } | 195 | } |
193 | if ( same ) { | 196 | if ( same ) { |
194 | m_tabs [GLOBALID] = *first; | 197 | m_tabs [GLOBALID] = *first; |
195 | m_tabs [GLOBALID]. m_changed = true; | 198 | m_tabs [GLOBALID]. m_changed = true; |
196 | } | 199 | } |
197 | } | 200 | } |
198 | 201 | ||
199 | 202 | ||
200 | void TabsSettings::accept ( ) | 203 | void TabsSettings::accept ( ) |
201 | { | 204 | { |
202 | Config cfg ( "Launcher" ); | 205 | Config cfg ( "Launcher" ); |
206 | Config cfg2 ( "Launchersettings" ); | ||
203 | 207 | ||
204 | // Launcher Tab | 208 | // Launcher Tab |
205 | QString grp ( "Tab %1" ); // No tr | 209 | QString grp ( "Tab %1" ); // No tr |
206 | 210 | ||
207 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 211 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
208 | TabConfig &tc = m_tabs [*it]; | 212 | TabConfig &tc = m_tabs [*it]; |
209 | 213 | ||
210 | if ( !tc. m_changed ) | 214 | if ( !tc. m_changed ) |
211 | continue; | 215 | continue; |
212 | 216 | ||
213 | cfg. setGroup ( grp. arg ( *it )); | 217 | cfg. setGroup ( grp. arg ( *it )); |
218 | cfg2. setGroup ( grp. arg ( *it )); | ||
214 | switch ( tc. m_view ) { | 219 | switch ( tc. m_view ) { |
215 | case TabConfig::Icon: | 220 | case TabConfig::Icon: |
216 | cfg.writeEntry ( "View", "Icon" ); | 221 | cfg.writeEntry ( "View", "Icon" ); |
217 | break; | 222 | break; |
218 | case TabConfig::List: | 223 | case TabConfig::List: |
219 | cfg.writeEntry ( "View", "List" ); | 224 | cfg.writeEntry ( "View", "List" ); |
220 | break; | 225 | break; |
221 | } | 226 | } |
222 | 227 | ||
223 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); | 228 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); |
224 | e << *it << tc. m_view; | 229 | e << *it << tc. m_view; |
225 | 230 | ||
226 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); | 231 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); |
227 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); | 232 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); |
228 | cfg. writeEntry ( "TextColor", tc. m_text_color ); | 233 | cfg. writeEntry ( "TextColor", tc. m_text_color ); |
234 | cfg2. writeEntry ( "DefaultDir", tc.m_last_directory ); | ||
229 | 235 | ||
230 | if ( tc. m_font_use ) { | 236 | if ( tc. m_font_use ) { |
231 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); | 237 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); |
232 | cfg. writeEntry ( "Font", f ); | 238 | cfg. writeEntry ( "Font", f ); |
233 | } | 239 | } |
234 | else | 240 | else |
235 | cfg. removeEntry ( "Font" ); | 241 | cfg. removeEntry ( "Font" ); |
236 | 242 | ||
237 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); | 243 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); |
238 | 244 | ||
239 | switch ( tc. m_bg_type ) { | 245 | switch ( tc. m_bg_type ) { |
240 | case TabConfig::Ruled: | 246 | case TabConfig::Ruled: |
241 | cfg.writeEntry( "BackgroundType", "Ruled" ); | 247 | cfg.writeEntry( "BackgroundType", "Ruled" ); |
242 | be << *it << tc. m_bg_type << QString(""); | 248 | be << *it << tc. m_bg_type << QString(""); |
243 | break; | 249 | break; |
244 | case TabConfig::SolidColor: | 250 | case TabConfig::SolidColor: |
245 | cfg.writeEntry( "BackgroundType", "SolidColor" ); | 251 | cfg.writeEntry( "BackgroundType", "SolidColor" ); |
246 | be << *it << tc. m_bg_type << tc. m_bg_color; | 252 | be << *it << tc. m_bg_type << tc. m_bg_color; |
247 | break; | 253 | break; |
248 | case TabConfig::Image: | 254 | case TabConfig::Image: |
249 | cfg.writeEntry( "BackgroundType", "Image" ); | 255 | cfg.writeEntry( "BackgroundType", "Image" ); |
250 | be << *it << tc. m_bg_type << tc. m_bg_image; | 256 | be << *it << tc. m_bg_type << tc. m_bg_image; |
251 | break; | 257 | break; |
252 | } | 258 | } |
253 | 259 | ||
254 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); | 260 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); |
255 | te << *it << tc. m_text_color; | 261 | te << *it << tc. m_text_color; |
256 | 262 | ||
257 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); | 263 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); |
258 | fe << *it; | 264 | fe << *it; |
259 | fe << ( tc. m_font_use ? tc. m_font_family : QString::null ); | 265 | fe << ( tc. m_font_use ? tc. m_font_family : QString::null ); |
260 | fe << tc. m_font_size; | 266 | fe << tc. m_font_size; |
261 | fe << tc. m_font_weight; | 267 | fe << tc. m_font_weight; |
262 | fe << ( tc. m_font_italic ? 1 : 0 ); | 268 | fe << ( tc. m_font_italic ? 1 : 0 ); |
263 | 269 | ||
264 | tc. m_changed = false; | 270 | tc. m_changed = false; |
265 | } | 271 | } |
266 | cfg. setGroup ( "GUI" ); | 272 | cfg. setGroup ( "GUI" ); |
267 | QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" ); | 273 | QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" ); |
268 | cfg. writeEntry ( "BusyType", busytype ); | 274 | cfg. writeEntry ( "BusyType", busytype ); |
269 | 275 | ||
270 | cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) ); | 276 | cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) ); |
271 | 277 | ||
272 | { | 278 | { |
273 | QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); | 279 | QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); |
274 | e << busytype; | 280 | e << busytype; |
275 | } | 281 | } |
276 | } | 282 | } |
277 | 283 | ||
278 | void TabsSettings::newClicked ( ) | 284 | void TabsSettings::newClicked ( ) |
279 | { | 285 | { |
280 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 286 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
281 | } | 287 | } |
282 | 288 | ||
283 | void TabsSettings::deleteClicked ( ) | 289 | void TabsSettings::deleteClicked ( ) |
284 | { | 290 | { |
285 | int ind = m_list-> currentItem ( ); | 291 | int ind = m_list-> currentItem ( ); |
286 | 292 | ||
287 | if ( ind < 0 ) | 293 | if ( ind < 0 ) |
288 | return; | 294 | return; |
289 | 295 | ||
290 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 296 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
291 | } | 297 | } |
292 | 298 | ||
293 | void TabsSettings::editClicked ( ) | 299 | void TabsSettings::editClicked ( ) |
294 | { | 300 | { |
295 | int ind = m_list-> currentItem ( ); | 301 | int ind = m_list-> currentItem ( ); |
296 | 302 | ||
297 | if ( ind < 0 ) | 303 | if ( ind < 0 ) |
298 | return; | 304 | return; |
299 | 305 | ||
300 | TabConfig tc = m_tabs [m_ids [ind]]; | 306 | TabConfig tc = m_tabs [m_ids [ind]]; |
301 | 307 | ||
302 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); | 308 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); |
303 | 309 | ||
304 | if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) { | 310 | if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) { |
305 | tc. m_changed = true; | 311 | tc. m_changed = true; |
306 | m_tabs [m_ids [ind]] = tc; | 312 | m_tabs [m_ids [ind]] = tc; |
307 | 313 | ||
308 | if ( m_ids [ind] == GLOBALID ) { | 314 | if ( m_ids [ind] == GLOBALID ) { |
309 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 315 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
310 | if ( *it != GLOBALID ) | 316 | if ( *it != GLOBALID ) |
311 | m_tabs [*it] = tc; | 317 | m_tabs [*it] = tc; |
312 | } | 318 | } |
313 | } | 319 | } |
314 | } | 320 | } |
315 | 321 | ||
316 | delete d; | 322 | delete d; |
317 | } | 323 | } |