summaryrefslogtreecommitdiff
path: root/core/pim/datebook/repeatentry.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/datebook/repeatentry.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/repeatentry.cpp50
1 files changed, 36 insertions, 14 deletions
diff --git a/core/pim/datebook/repeatentry.cpp b/core/pim/datebook/repeatentry.cpp
index 5637c4d..b1a162d 100644
--- a/core/pim/datebook/repeatentry.cpp
+++ b/core/pim/datebook/repeatentry.cpp
@@ -30,25 +30,42 @@
#include <qspinbox.h>
#include <qtoolbutton.h>
#include <time.h>
// Global Templates for use in setting up the repeat label...
-const QString strDayTemplate = QObject::tr("Every");
-const QString strYearTemplate = QObject::tr("%1 %2 every ");
-const QString strMonthDateTemplate = QObject::tr("The %1 every ");
-const QString strMonthDayTemplate = QObject::tr("The %1 %1 of every");
-const QString strWeekTemplate = QObject::tr("Every ");
-const QString dayLabel[] = { QObject::tr("Monday"),
- QObject::tr("Tuesday"),
- QObject::tr("Wednesday"),
- QObject::tr("Thursday"),
- QObject::tr("Friday"),
- QObject::tr("Saturday"),
- QObject::tr("Sunday") };
+// the problem is these strings get initialized before QPEApplication can install the translator -zecke
+namespace {
+QString strDayTemplate;
+QString strYearTemplate;
+QString strMonthDateTemplate;
+QString strMonthDayTemplate;
+QString strWeekTemplate;
+QString dayLabel[7];
+}
+/*
+ * static linkage to not polute the symbol table...
+ * The problem is that const and static linkage are resolved prior to installing a translator
+ * leading to that the above strings are translted but to the original we delay the init of these strings...
+ * -zecke
+ */
+static void fillStrings() {
+ strDayTemplate = QObject::tr("Every");
+ strYearTemplate = QObject::tr("%1 %2 every ");
+ strMonthDateTemplate = QObject::tr("The %1 every ");
+ strMonthDayTemplate = QObject::tr("The %1 %1 of every");
+ strWeekTemplate = QObject::tr("Every ");
+ dayLabel[0] = QObject::tr("Monday");
+ dayLabel[1] = QObject::tr("Tuesday");
+ dayLabel[2] = QObject::tr("Wednesday");
+ dayLabel[3] = QObject::tr("Thursday");
+ dayLabel[4] = QObject::tr("Friday");
+ dayLabel[5] = QObject::tr("Saturday");
+ dayLabel[6] = QObject::tr("Sunday");
+}
static QString numberPlacing( int x ); // return the proper word format for
// x (1st, 2nd, etc)
static int week( const QDate &dt ); // what week in the month is dt?
RepeatEntry::RepeatEntry( bool startOnMonday,
@@ -56,12 +73,15 @@ RepeatEntry::RepeatEntry( bool startOnMonday,
const char *name, bool modal, WFlags fl )
: RepeatEntryBase( parent, name, modal, fl ),
start( newStart ),
currInterval( NONE ),
startWeekOnMonday( startOnMonday )
{
+ if (strDayTemplate.isEmpty() )
+ fillStrings();
+
init();
fraType->setButton( currInterval );
chkNoEnd->setChecked( TRUE );
setupNone();
}
@@ -71,12 +91,14 @@ RepeatEntry::RepeatEntry( bool startOnMonday, const Event::RepeatPattern &rp,
WFlags fl )
: RepeatEntryBase( parent, name, modal, fl ),
start( startDate ),
end( rp.endDate() ),
startWeekOnMonday( startOnMonday )
{
+ if (strDayTemplate.isEmpty() )
+ fillStrings();
// do some stuff with the repeat pattern
init();
switch ( rp.type ) {
default:
case Event::NoRepeat:
currInterval = NONE;
@@ -403,13 +425,13 @@ void RepeatEntry::setupRepeatLabel( int x )
case NONE:
break;
case DAY:
if ( x > 1 )
strVar2 = tr( "days" );
else
- strVar2 = tr( "day" );
+ strVar2 = tr( "day" );
break;
case WEEK:
if ( x > 1 )
strVar2 = tr( "weeks" );
else
strVar2 = tr( "week" );
@@ -497,13 +519,13 @@ void RepeatEntry::slotWeekLabel()
if ( bNeedCarriage )
str += ",\n" + *itStr;
else
str += ", " + *itStr;
}
}
- str = str.prepend( "on " );
+ str = str.prepend( tr("on ") );
lblWeekVar->setText( str );
}
void RepeatEntry::slotMonthLabel( int type )
{
QString str;