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