summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kodialogmanager.cpp5
-rw-r--r--korganizer/koprefs.cpp88
-rw-r--r--korganizer/koprefs.h16
-rw-r--r--korganizer/ktimeedit.cpp5
-rw-r--r--korganizer/mainwindow.cpp3
5 files changed, 14 insertions, 103 deletions
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp
index 58198a2..db7c3f2 100644
--- a/korganizer/kodialogmanager.cpp
+++ b/korganizer/kodialogmanager.cpp
@@ -90,5 +90,5 @@ void KODialogManager::createOutgoingDialog()
void KODialogManager::showOptionsDialog( bool showSync )
{
- int curLanguage = KOPrefs::instance()->mPreferredLanguage;
+
if (!mOptionsDialog) {
mOptionsDialog = new KOPrefsDialog(mMainView);
@@ -109,6 +109,5 @@ void KODialogManager::showOptionsDialog( bool showSync )
mOptionsDialog->showSyncPage();
mOptionsDialog->exec();
- if ( curLanguage != KOPrefs::instance()->mPreferredLanguage )
- KOPrefs::instance()->mLanguageChanged = true;
+
}
void KODialogManager::showSyncOptions()
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index ba1c6d1..f44debc 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -47,9 +47,4 @@
#include "mainwindow.h"
-const char *germanwords[][2] = {
-#include "wordsgerman.h"
- "", ""
-};
-
KOPrefs *KOPrefs::mInstance = 0;
static KStaticDeleter<KOPrefs> insd;
@@ -59,5 +54,4 @@ KOPrefs::KOPrefs() :
{
mCategoryColors.setAutoDelete(true);
- mLocaleDict = 0;
fillMailDefaults();
mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
@@ -101,5 +95,5 @@ KOPrefs::KOPrefs() :
addItemBool("ShowIconJournal",&mShowIconJournal,true);
addItemBool("ShowIconStretch",&mShowIconStretch,true);
- addItemBool("LanguageChanged",&mLanguageChanged,false);
+ addItemInt("LastLoadedLanguage",&mOldLanguage,0);
addItemBool("AskForQuit",&mAskForQuit,false);
@@ -205,11 +199,5 @@ KOPrefs::KOPrefs() :
KPrefs::setCurrentGroup("Locale");
- addItemInt("PreferredLanguage",&mPreferredLanguage,0);
- addItemInt("PreferredTime",&mPreferredTime,0);
- addItemInt("PreferredDate",&mPreferredDate,0);
- addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
- addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
- addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
@@ -317,7 +305,5 @@ KOPrefs::~KOPrefs()
if (mInstance == this)
mInstance = insd.setObject(0);
- setLocaleDict( 0 );
- if ( mLocaleDict )
- delete mLocaleDict;
+
//qDebug("KOPrefs::~KOPrefs() ");
}
@@ -378,78 +364,14 @@ QStringList KOPrefs::getDefaultList()
void KOPrefs::usrReadConfig()
{
- mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
- mLocaleDict = 0;
- // pending LR fix translation
- // qDebug("KOPrefs::usrReadConfig() fix translation ");
- if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
- if ( mPreferredLanguage == 1 ) {
- mLocaleDict = new QDict<QString>;
- int i = 0;
- QString fw ( germanwords[i] [0]);
- while ( !fw.isEmpty() ) {
- mLocaleDict->insert( fw, new QString (germanwords[i] [1] ));
- ++i;
- fw = germanwords[i] [0];
- }
-
- setLocaleDict( mLocaleDict );
- } else {
- QString fileName ;
- if ( mPreferredLanguage == 4 )
- fileName = MainWindow::resourcePath()+"usertranslation.txt";
- else if ( mPreferredLanguage == 2 )
- fileName = MainWindow::resourcePath()+"frenchtranslation.txt";
- else if ( mPreferredLanguage == 3 )
- fileName = MainWindow::resourcePath()+"italiantranslation.txt";
- QFile file( fileName );
- if (file.open( IO_ReadOnly ) ) {
- QTextStream ts( &file );
- ts.setEncoding( QTextStream::Latin1 );
- //ts.setCodec( QTextCodec::latin1 );
- QString text = ts.read();
- file.close();
- text.replace( QRegExp("\\\\n"), "\n" );
- QString line;
- QString we;
- QString wt;
- int br = 0;
- int nbr;
- nbr = text.find ( "},", br );
- line = text.mid( br, nbr - br );
- br = nbr+1;
- int se, ee, st, et;
- mLocaleDict = new QDict<QString>;
- QString end = "{ \"\",\"\" }";
- while ( (line != end) && (br > 1) ) {
- //qDebug("%d *%s* ", br, line.latin1());
- se = line.find("\"")+1;
- et = line.findRev("\"",-1);
- ee = line.find("\",\"");
- st = ee+3;
- we = line.mid( se, ee-se );
- wt = line.mid( st, et-st );
- //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
- mLocaleDict->insert( we, new QString (wt) );
- nbr = text.find ( "}", br );
- line = text.mid( br, nbr - br );
- br = nbr+1;
- }
- //qDebug("end *%s* ", end.latin1());
-
- setLocaleDict( mLocaleDict );
- } else {
- qDebug("KO: Cannot find translation file %s",fileName.latin1() );
- }
-
- }
- }
config()->setGroup("General");
mCustomCategories = config()->readListEntry("Custom Categories");
- if ( KOPrefs::instance()->mLanguageChanged ) {
+ if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) {
mLocationDefaults.clear();
mEventSummaryUser.clear();
mTodoSummaryUser.clear();
}
+ mOldLoadedLanguage = mOldLanguage ;
+ mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
if (mLocationDefaults.isEmpty()) {
mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index c74b0ef..0656644 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -24,7 +24,7 @@
#define KOPREFS_H
-#include <qdict.h>
#include <libkdepim/kpimprefs.h>
+#include <qdict.h>
class KConfig;
@@ -71,5 +71,4 @@ class KOPrefs : public KPimPrefs
static KOPrefs *mInstance;
- QDict<QString> *mLocaleDict;
QStringList getDefaultList();
public:
@@ -159,5 +158,4 @@ class KOPrefs : public KPimPrefs
int mWhatsNextPrios;
bool mEnableQuickTodo;
- bool mLanguageChanged;
bool mCompactDialogs;
@@ -254,4 +252,6 @@ class KOPrefs : public KPimPrefs
int mAlarmSuspendCount;
int mAlarmBeepInterval;
+ int mOldLanguage;
+ int mOldLoadedLanguage;
@@ -259,14 +259,4 @@ class KOPrefs : public KPimPrefs
QString mActiveSyncIP;
-
- //US I copied the following settings into KPimGlobalPrefs
- // that allows us later to easily remove the settings from here.
- int mPreferredDate;
- QString mUserDateFormatLong;
- QString mUserDateFormatShort;
- int mPreferredLanguage;
- int mPreferredTime;
- bool mWeekStartsOnSunday;
-
private:
QDict<QColor> mCategoryColors;
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index cf07a1a..f5a1c50 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -32,4 +32,5 @@
#include <kdebug.h>
#include <klocale.h>
+#include <kpimglobalprefs.h>
#include "ktimeedit.h"
@@ -112,5 +113,5 @@ KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
QFontMetrics fm ( font() );
QString timeString = "24:00";
- if ( KOPrefs::instance()->mPreferredTime == 1 )
+ if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 )
timeString = "02:00pm";
int addSpace = 32;
@@ -239,5 +240,5 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
qApp->processEvents();
- bool hour12Format = ( KOPrefs::instance()->mPreferredTime == 1 );
+ bool hour12Format = ( KPimGlobalPrefs::instance()->mPreferredTime == 1 );
int maxpos = hour12Format?7:5;
if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index fbfcd20..dc2026b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -226,8 +226,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
qDebug("KO: Calendar loading time: %d ms",msNeeded );
- if ( KOPrefs::instance()->mLanguageChanged ) {
+ if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
KOPrefs::instance()->setCategoryDefaults();
int count = mView->addCategories();
- KOPrefs::instance()->mLanguageChanged = false;
}
processIncidenceSelection( 0 );