summaryrefslogtreecommitdiff
path: root/libopie/orecurrancewidget.cpp
authoreilers <eilers>2003-08-08 15:09:29 (UTC)
committer eilers <eilers>2003-08-08 15:09:29 (UTC)
commitb87b33dc1f6e8e1276a7035ab7a3e53b8ed4bd16 (patch) (unidiff)
treeb0f96db67cfb1b9d2476530ecec9a2ba6eacbab1 /libopie/orecurrancewidget.cpp
parent14d394e6c107b037a09a31a92605034fe50f7813 (diff)
downloadopie-b87b33dc1f6e8e1276a7035ab7a3e53b8ed4bd16.zip
opie-b87b33dc1f6e8e1276a7035ab7a3e53b8ed4bd16.tar.gz
opie-b87b33dc1f6e8e1276a7035ab7a3e53b8ed4bd16.tar.bz2
Merging all changes from BRANCH_1_0.
Diffstat (limited to 'libopie/orecurrancewidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/orecurrancewidget.cpp56
1 files changed, 39 insertions, 17 deletions
diff --git a/libopie/orecurrancewidget.cpp b/libopie/orecurrancewidget.cpp
index 471249d..be8ec30 100644
--- a/libopie/orecurrancewidget.cpp
+++ b/libopie/orecurrancewidget.cpp
@@ -8,19 +8,36 @@
8#include "orecurrancewidget.h" 8#include "orecurrancewidget.h"
9 9
10// Global Templates for use in setting up the repeat label... 10// Global Templates for use in setting up the repeat label...
11const QString strDayTemplate = QObject::tr("Every"); 11// the problem is these strings get initialized before QPEApplication can install the translator -zecke
12const QString strYearTemplate = QObject::tr("%1 %2 every "); 12namespace {
13const QString strMonthDateTemplate = QObject::tr("The %1 every "); 13QString strDayTemplate;
14const QString strMonthDayTemplate = QObject::tr("The %1 %1 of every"); 14QString strYearTemplate;
15const QString strWeekTemplate = QObject::tr("Every "); 15QString strMonthDateTemplate;
16const QString dayLabel[] = { QObject::tr("Monday"), 16QString strMonthDayTemplate;
17 QObject::tr("Tuesday"), 17QString strWeekTemplate;
18 QObject::tr("Wednesday"), 18QString dayLabel[7];
19 QObject::tr("Thursday"), 19}
20 QObject::tr("Friday"),
21 QObject::tr("Saturday"),
22 QObject::tr("Sunday") };
23 20
21/*
22 * static linkage to not polute the symbol table...
23 * The problem is that const and static linkage are resolved prior to installing a translator
24 * leading to that the above strings are translted but to the original we delay the init of these strings...
25 * -zecke
26 */
27static void fillStrings() {
28 strDayTemplate = QObject::tr("Every");
29 strYearTemplate = QObject::tr("%1 %2 every ");
30 strMonthDateTemplate = QObject::tr("The %1 every ");
31 strMonthDayTemplate = QObject::tr("The %1 %2 of every");
32 strWeekTemplate = QObject::tr("Every ");
33 dayLabel[0] = QObject::tr("Monday");
34 dayLabel[1] = QObject::tr("Tuesday");
35 dayLabel[2] = QObject::tr("Wednesday");
36 dayLabel[3] = QObject::tr("Thursday");
37 dayLabel[4] = QObject::tr("Friday");
38 dayLabel[5] = QObject::tr("Saturday");
39 dayLabel[6] = QObject::tr("Sunday");
40}
24 41
25 static QString numberPlacing( int x );// return the proper word format for 42 static QString numberPlacing( int x );// return the proper word format for
26 // x (1st, 2nd, etc) 43 // x (1st, 2nd, etc)
@@ -46,6 +63,9 @@ ORecurranceWidget::ORecurranceWidget( bool startOnMonday,
46 currInterval( None ), 63 currInterval( None ),
47 startWeekOnMonday( startOnMonday ) 64 startWeekOnMonday( startOnMonday )
48{ 65{
66 if (strDayTemplate.isEmpty() )
67 fillStrings();
68
49 init(); 69 init();
50 fraType->setButton( currInterval ); 70 fraType->setButton( currInterval );
51 chkNoEnd->setChecked( TRUE ); 71 chkNoEnd->setChecked( TRUE );
@@ -71,6 +91,8 @@ ORecurranceWidget::ORecurranceWidget( bool startOnMonday,
71 end( rp.endDate() ), 91 end( rp.endDate() ),
72 startWeekOnMonday( startOnMonday ) 92 startWeekOnMonday( startOnMonday )
73{ 93{
94 if (strDayTemplate.isEmpty() )
95 fillStrings();
74 // do some stuff with the repeat pattern 96 // do some stuff with the repeat pattern
75 init(); 97 init();
76 setRecurrence( rp ); 98 setRecurrence( rp );
@@ -84,7 +106,6 @@ ORecurranceWidget::~ORecurranceWidget() {
84 * @param date the new start date 106 * @param date the new start date
85 */ 107 */
86void ORecurranceWidget::setStartDate( const QDate& date ) { 108void ORecurranceWidget::setStartDate( const QDate& date ) {
87 qWarning("ORecurranceWidget::setStartDate");
88 setRecurrence( recurrence(), date ); 109 setRecurrence( recurrence(), date );
89} 110}
90/** 111/**
@@ -367,7 +388,8 @@ void ORecurranceWidget::slotWeekLabel() {
367 str += ", " + *itStr; 388 str += ", " + *itStr;
368 } 389 }
369 } 390 }
370 str = str.prepend( "on " ); 391 str = str.prepend( tr("on ") );
392
371 lblWeekVar->setText( str ); 393 lblWeekVar->setText( str );
372} 394}
373void ORecurranceWidget::slotMonthLabel(int type) { 395void ORecurranceWidget::slotMonthLabel(int type) {
@@ -375,10 +397,10 @@ void ORecurranceWidget::slotMonthLabel(int type) {
375 if ( currInterval != Month || type > 1 ) 397 if ( currInterval != Month || type > 1 )
376 return; 398 return;
377 if ( type == 1 ) 399 if ( type == 1 )
378 str = strMonthDateTemplate.arg( numberPlacing(start.day()) ); 400 str = strMonthDateTemplate.arg( numberPlacing(start.day()) );
379 else 401 else
380 str = strMonthDayTemplate.arg( numberPlacing(week(start))) 402 str = strMonthDayTemplate.arg( numberPlacing(week(start)))
381 .arg( dayLabel[start.dayOfWeek() - 1] ); 403 .arg( dayLabel[start.dayOfWeek() - 1] );
382 lblRepeat->setText( str ); 404 lblRepeat->setText( str );
383} 405}
384void ORecurranceWidget::slotChangeStartOfWeek( bool onMonday ) { 406void ORecurranceWidget::slotChangeStartOfWeek( bool onMonday ) {