summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/formattabwidget.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/netsystemtime/formattabwidget.cpp b/noncore/settings/netsystemtime/formattabwidget.cpp
index daa020f..982305b 100644
--- a/noncore/settings/netsystemtime/formattabwidget.cpp
+++ b/noncore/settings/netsystemtime/formattabwidget.cpp
@@ -1,168 +1,168 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. 3 =.
4             .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> 4             .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "formattabwidget.h" 29#include "formattabwidget.h"
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32 32
33#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 33#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
34#include <qpe/qcopenvelope_qws.h> 34#include <qpe/qcopenvelope_qws.h>
35#endif 35#endif
36 36
37#include <qcombobox.h> 37#include <qcombobox.h>
38#include <qlabel.h> 38#include <qlabel.h>
39#include <qlayout.h> 39#include <qlayout.h>
40#include <qscrollview.h> 40#include <qscrollview.h>
41#include <qtimer.h> 41#include <qtimer.h>
42 42
43FormatTabWidget::FormatTabWidget( QWidget *parent ) 43FormatTabWidget::FormatTabWidget( QWidget *parent )
44 : QWidget( parent, 0x0, 0 ) 44 : QWidget( parent, 0x0, 0 )
45{ 45{
46 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 46 QVBoxLayout *tmpvb = new QVBoxLayout( this );
47 QScrollView *sv = new QScrollView( this ); 47 QScrollView *sv = new QScrollView( this );
48 tmpvb->addWidget( sv, 0, 0 ); 48 tmpvb->addWidget( sv, 0, 0 );
49 sv->setResizePolicy( QScrollView::AutoOneFit ); 49 sv->setResizePolicy( QScrollView::AutoOneFit );
50 sv->setFrameStyle( QFrame::NoFrame ); 50 sv->setFrameStyle( QFrame::NoFrame );
51 QWidget *container = new QWidget( sv->viewport() ); 51 QWidget *container = new QWidget( sv->viewport() );
52 sv->addChild( container ); 52 sv->addChild( container );
53 53
54 QGridLayout *layout = new QGridLayout( container ); 54 QGridLayout *layout = new QGridLayout( container );
55 layout->setMargin( 2 ); 55 layout->setMargin( 2 );
56 layout->setSpacing( 4 ); 56 layout->setSpacing( 4 );
57 57
58 // Time format selector 58 // Time format selector
59 layout->addWidget( new QLabel( tr( "Time format" ), container ), 0, 0 ); 59 layout->addWidget( new QLabel( tr( "Time format" ), container ), 0, 0 );
60 cbAppletFormat = new QComboBox( container ); 60 cbAppletFormat = new QComboBox( container );
61 cbAppletFormat->insertItem( tr( "hh:mm" ), 0 ); 61 cbAppletFormat->insertItem( tr( "hh:mm" ), 0 );
62 cbAppletFormat->insertItem( tr( "D/M hh:mm" ), 1 ); 62 cbAppletFormat->insertItem( tr( "D/M hh:mm" ), 1 );
63 cbAppletFormat->insertItem( tr( "M/D hh:mm" ), 2 ); 63 cbAppletFormat->insertItem( tr( "M/D hh:mm" ), 2 );
64 layout->addWidget( cbAppletFormat, 0, 1 ); 64 layout->addWidget( cbAppletFormat, 0, 1 );
65 65
66 // 12/24 hour selector 66 // 12/24 hour selector
67 layout->addWidget( new QLabel( tr( "12/24 hour" ), container ), 1, 0 ); 67 layout->addWidget( new QLabel( tr( "12/24 hour" ), container ), 1, 0 );
68 cbAmpm = new QComboBox( container ); 68 cbAmpm = new QComboBox( container );
69 cbAmpm->insertItem( tr( "24 hour" ), 0 ); 69 cbAmpm->insertItem( tr( "24 hour" ), 0 );
70 cbAmpm->insertItem( tr( "12 hour" ), 1 ); 70 cbAmpm->insertItem( tr( "12 hour" ), 1 );
71 connect( cbAmpm, SIGNAL(activated(int)), this, SIGNAL(show12HourTime(int)) ); 71 connect( cbAmpm, SIGNAL(activated(int)), this, SIGNAL(show12HourTime(int)) );
72 layout->addWidget( cbAmpm, 1, 1 ); 72 layout->addWidget( cbAmpm, 1, 1 );
73 73
74 // Date format selector 74 // Date format selector
75 layout->addWidget( new QLabel( tr( "Date format" ), container ), 2, 0 ); 75 layout->addWidget( new QLabel( tr( "Date format" ), container ), 2, 0 );
76 cbDateFormat = new QComboBox( container ); 76 cbDateFormat = new QComboBox( container );
77 connect( cbDateFormat, SIGNAL(activated(int)), this, SLOT(slotDateFormatChanged(int)) ); 77 connect( cbDateFormat, SIGNAL(activated(int)), this, SLOT(slotDateFormatChanged(int)) );
78 layout->addWidget( cbDateFormat, 2, 1 ); 78 layout->addWidget( cbDateFormat, 2, 1 );
79 79
80 // Week starts on selector 80 // Week starts on selector
81 layout->addWidget( new QLabel( tr( "Weeks start on" ), container ), 3, 0 ); 81 layout->addWidget( new QLabel( tr( "Weeks start on" ), container ), 3, 0 );
82 cbWeekStart = new QComboBox( container ); 82 cbWeekStart = new QComboBox( container );
83 cbWeekStart->insertItem( tr( "Sunday" ), 0 ); 83 cbWeekStart->insertItem( tr( "Sunday" ), 0 );
84 cbWeekStart->insertItem( tr( "Monday" ), 1 ); 84 cbWeekStart->insertItem( tr( "Monday" ), 1 );
85 connect( cbWeekStart, SIGNAL(activated(int)), this, SIGNAL(weekStartChanged(int)) ); 85 connect( cbWeekStart, SIGNAL(activated(int)), this, SIGNAL(weekStartChanged(int)) );
86 layout->addWidget( cbWeekStart, 3, 1 ); 86 layout->addWidget( cbWeekStart, 3, 1 );
87 87
88 // Initialize values 88 // Initialize values
89 Config config( "qpe" ); 89 Config config( "qpe" );
90 config.setGroup( "Date" ); 90 config.setGroup( "Date" );
91 cbAppletFormat->setCurrentItem( config.readNumEntry( "ClockApplet", 0 ) ); 91 cbAppletFormat->setCurrentItem( config.readNumEntry( "ClockApplet", 0 ) );
92 92
93 DateFormat df(QChar(config.readEntry("Separator", "/")[0]), 93 DateFormat df(QChar(config.readEntry("Separator", "/")[0]),
94 (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear), 94 (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear),
95 (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear)); 95 (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear));
96 96
97 int currentdf = 0; 97 int currentdf = 0;
98 date_formats[0] = DateFormat( '/', DateFormat::MonthDayYear ); 98 date_formats[0] = DateFormat( '/', DateFormat::MonthDayYear );
99 cbDateFormat->insertItem( tr( date_formats[0].toNumberString() ) ); 99 cbDateFormat->insertItem( tr( date_formats[0].toNumberString() ) );
100 date_formats[1] = DateFormat( '.', DateFormat::DayMonthYear ); 100 date_formats[1] = DateFormat( '.', DateFormat::DayMonthYear );
101 if ( df == date_formats[1] ) 101 if ( df == date_formats[1] )
102 currentdf = 1; 102 currentdf = 1;
103 cbDateFormat->insertItem( tr( date_formats[1].toNumberString() ) ); 103 cbDateFormat->insertItem( tr( date_formats[1].toNumberString() ) );
104 date_formats[2] = DateFormat( '-', DateFormat::YearMonthDay, DateFormat::DayMonthYear ); 104 date_formats[2] = DateFormat( '-', DateFormat::YearMonthDay, DateFormat::DayMonthYear );
105 if ( df == date_formats[2] ) 105 if ( df == date_formats[2] )
106 currentdf = 2; 106 currentdf = 2;
107 cbDateFormat->insertItem( tr( date_formats[2].toNumberString() ) ); //ISO8601 107 cbDateFormat->insertItem( tr( date_formats[2].toNumberString() ) ); //ISO8601
108 date_formats[3] = DateFormat( '/', DateFormat::DayMonthYear ); 108 date_formats[3] = DateFormat( '/', DateFormat::DayMonthYear );
109 if ( df == date_formats[3] ) 109 if ( df == date_formats[3] )
110 currentdf = 3; 110 currentdf = 3;
111 cbDateFormat->insertItem( tr( date_formats[3].toNumberString() ) ); 111 cbDateFormat->insertItem( tr( date_formats[3].toNumberString() ) );
112 112
113 cbDateFormat->setCurrentItem( currentdf ); 113 cbDateFormat->setCurrentItem( currentdf );
114 //dateButton->setDateFormat( df ); 114 //dateButton->setDateFormat( df );
115 115
116 config.setGroup( "Time" ); 116 config.setGroup( "Time" );
117 cbAmpm->setCurrentItem( config.readBoolEntry( "AMPM" ) ? 1 : 0 ); 117 cbAmpm->setCurrentItem( config.readBoolEntry( "AMPM", FALSE ) ? 1 : 0 );
118 cbWeekStart->setCurrentItem( config.readBoolEntry( "MONDAY" ) ? 1 : 0 ); 118 cbWeekStart->setCurrentItem( config.readBoolEntry( "MONDAY", TRUE ) ? 1 : 0 );
119 119
120 // Send initial configuration options 120 // Send initial configuration options
121 QTimer::singleShot( 1200, this, SLOT(sendOptions()) ); 121 QTimer::singleShot( 1200, this, SLOT(sendOptions()) );
122} 122}
123 123
124FormatTabWidget::~FormatTabWidget() 124FormatTabWidget::~FormatTabWidget()
125{ 125{
126} 126}
127 127
128void FormatTabWidget::saveSettings( bool commit ) 128void FormatTabWidget::saveSettings( bool commit )
129{ 129{
130 int ampm = cbAmpm->currentItem(); 130 int ampm = cbAmpm->currentItem();
131 int weekstart = cbWeekStart->currentItem(); 131 int weekstart = cbWeekStart->currentItem();
132 DateFormat df = date_formats[cbDateFormat->currentItem()]; 132 DateFormat df = date_formats[cbDateFormat->currentItem()];
133 int appletformat = cbAppletFormat->currentItem(); 133 int appletformat = cbAppletFormat->currentItem();
134 134
135 if ( commit ) 135 if ( commit )
136 { 136 {
137 // Write settings to config file 137 // Write settings to config file
138 Config config("qpe"); 138 Config config("qpe");
139 config.setGroup( "Time" ); 139 config.setGroup( "Time" );
140 config.writeEntry( "AMPM", ampm ); 140 config.writeEntry( "AMPM", ampm );
141 config.writeEntry( "MONDAY", weekstart ); 141 config.writeEntry( "MONDAY", weekstart );
142 config.setGroup( "Date" ); 142 config.setGroup( "Date" );
143 config.writeEntry( "Separator", QString( df.separator() ) ); 143 config.writeEntry( "Separator", QString( df.separator() ) );
144 config.writeEntry( "ShortOrder", df.shortOrder() ); 144 config.writeEntry( "ShortOrder", df.shortOrder() );
145 config.writeEntry( "LongOrder", df.longOrder() ); 145 config.writeEntry( "LongOrder", df.longOrder() );
146 config.writeEntry( "ClockApplet", appletformat ); 146 config.writeEntry( "ClockApplet", appletformat );
147 } 147 }
148 148
149 // Make rest of system aware of new settings 149 // Make rest of system aware of new settings
150 QCopEnvelope setClock( "QPE/System", "clockChange(bool)" ); 150 QCopEnvelope setClock( "QPE/System", "clockChange(bool)" );
151 setClock << ampm; 151 setClock << ampm;
152 QCopEnvelope setWeek( "QPE/System", "weekChange(bool)" ); 152 QCopEnvelope setWeek( "QPE/System", "weekChange(bool)" );
153 setWeek << weekstart; 153 setWeek << weekstart;
154 QCopEnvelope setDateFormat( "QPE/System", "setDateFormat(DateFormat)" ); 154 QCopEnvelope setDateFormat( "QPE/System", "setDateFormat(DateFormat)" );
155 setDateFormat << df; 155 setDateFormat << df;
156} 156}
157 157
158void FormatTabWidget::slotDateFormatChanged( int selected ) 158void FormatTabWidget::slotDateFormatChanged( int selected )
159{ 159{
160 emit dateFormatChanged( date_formats[selected] ); 160 emit dateFormatChanged( date_formats[selected] );
161} 161}
162 162
163void FormatTabWidget::sendOptions() 163void FormatTabWidget::sendOptions()
164{ 164{
165 emit show12HourTime( cbAmpm->currentItem() ); 165 emit show12HourTime( cbAmpm->currentItem() );
166 emit dateFormatChanged( date_formats[cbDateFormat->currentItem()] ); 166 emit dateFormatChanged( date_formats[cbDateFormat->currentItem()] );
167 emit weekStartChanged( cbWeekStart->currentItem() ); 167 emit weekStartChanged( cbWeekStart->currentItem() );
168} 168}