summaryrefslogtreecommitdiff
path: root/noncore/settings/netsystemtime/formattabwidget.cpp
Unidiff
Diffstat (limited to 'noncore/settings/netsystemtime/formattabwidget.cpp') (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
@@ -69,98 +69,98 @@ FormatTabWidget::FormatTabWidget( QWidget *parent )
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()] );