summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/tabconfig.h13
-rw-r--r--core/settings/launcher/tabdialog.cpp18
-rw-r--r--core/settings/launcher/tabssettings.cpp6
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
@@ -6,66 +6,67 @@
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27#ifndef __TABCONFIG_H__ 27#ifndef __TABCONFIG_H__
28#define __TABCONFIG_H__ 28#define __TABCONFIG_H__
29 29
30struct TabConfig { 30struct TabConfig {
31 enum ViewMode { 31 enum ViewMode {
32 Icon, 32 Icon,
33 List 33 List
34 }; 34 };
35 enum BackgroundType { 35 enum BackgroundType {
36 Ruled, 36 Ruled,
37 SolidColor, 37 SolidColor,
38 Image 38 Image
39 }; 39 };
40 40
41 ViewMode m_view; 41 ViewMode m_view;
42 BackgroundType m_bg_type; 42 BackgroundType m_bg_type;
43 QString m_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
@@ -19,38 +19,43 @@
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
51using namespace Opie::Ui; 56using namespace Opie::Ui;
52class SampleItem : public QIconViewItem { 57class SampleItem : public QIconViewItem {
53public: 58public:
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;
@@ -405,38 +410,39 @@ QWidget *TabDialog::createIconTab ( QWidget *parent )
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
435void TabDialog::iconSizeClicked ( int s ) 441void TabDialog::iconSizeClicked ( int s )
436{ 442{
437 m_sample-> setViewMode ((TabConfig::ViewMode) s ); 443 m_sample-> setViewMode ((TabConfig::ViewMode) s );
438} 444}
439 445
440void TabDialog::fontClicked ( const QFont &f ) 446void TabDialog::fontClicked ( const QFont &f )
441{ 447{
442 m_sample-> setViewFont ( f ); 448 m_sample-> setViewFont ( f );
@@ -471,26 +477,28 @@ void TabDialog::iconColorClicked ( const QColor &col )
471} 477}
472 478
473void TabDialog::bgImageClicked ( ) 479void 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
490void TabDialog::bgDefaultClicked ( ) 498void 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
496void TabDialog::accept ( ) 504void TabDialog::accept ( )
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
@@ -134,45 +134,48 @@ void TabsSettings::readTabSettings ( Config &cfg )
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 }
@@ -191,50 +194,53 @@ void TabsSettings::readTabSettings ( Config &cfg )
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
200void TabsSettings::accept ( ) 203void 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: