Diffstat (limited to 'core/settings/launcher/tabdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
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,140 +1,145 @@ | |||
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; |
@@ -321,196 +326,199 @@ QWidget *TabDialog::createFontTab ( QWidget *parent ) | |||
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 | } |