-rw-r--r-- | libopie/orecurrancewidget.cpp | 50 |
1 files changed, 36 insertions, 14 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... |
11 | const QString strDayTemplate = QObject::tr("Every"); | 11 | // the problem is these strings get initialized before QPEApplication can install the translator -zecke |
12 | const QString strYearTemplate = QObject::tr("%1 %2 every "); | 12 | namespace { |
13 | const QString strMonthDateTemplate = QObject::tr("The %1 every "); | 13 | QString strDayTemplate; |
14 | const QString strMonthDayTemplate = QObject::tr("The %1 %1 of every"); | 14 | QString strYearTemplate; |
15 | const QString strWeekTemplate = QObject::tr("Every "); | 15 | QString strMonthDateTemplate; |
16 | const QString dayLabel[] = { QObject::tr("Monday"), | 16 | QString strMonthDayTemplate; |
17 | QObject::tr("Tuesday"), | 17 | QString strWeekTemplate; |
18 | QObject::tr("Wednesday"), | 18 | QString 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 | */ | ||
27 | static 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 | */ |
86 | void ORecurranceWidget::setStartDate( const QDate& date ) { | 108 | void 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 | } |
373 | void ORecurranceWidget::slotMonthLabel(int type) { | 395 | void ORecurranceWidget::slotMonthLabel(int type) { |