summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile2
-rw-r--r--kaddressbook/kabprefs.cpp73
-rw-r--r--kaddressbook/kabprefs.h1
-rw-r--r--kmicromail/koprefs.h2
-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
-rw-r--r--libkdepim/kpimglobalprefs.cpp76
-rw-r--r--libkdepim/kpimglobalprefs.h2
-rw-r--r--microkde/kstaticdeleter.h5
-rw-r--r--pwmanager/pwmanager/pwmprefs.cpp12
13 files changed, 105 insertions, 185 deletions
diff --git a/Makefile b/Makefile
index 2f5691a..a88bd06 100644
--- a/Makefile
+++ b/Makefile
@@ -1,27 +1,27 @@
#############################################################################
# Makefile for building: kdepim-desktop
-# Generated by qmake (1.07a) (Qt 3.3.3) on: Sat Oct 23 09:29:11 2004
+# Generated by qmake (1.07a) (Qt 3.3.3) on: Sat Oct 23 12:23:49 2004
# Project: kdepim-desktop.pro
# Template: subdirs
# Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kdepim-desktop.pro
#############################################################################
MAKEFILE = Makefile
QMAKE = qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
INSTALL_FILE=
INSTALL_DIR =
SUBTARGETS = \
sub-gammu-emb-common \
sub-gammu-emb-gammu \
sub-libical \
sub-libkcal \
sub-microkde \
sub-libkdepim \
sub-kabc \
sub-korganizer \
sub-kaddressbook \
sub-kabc-plugins-file \
sub-kabc-plugins-dir \
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index 01c935f..3cbcc9a 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -22,192 +22,129 @@
*/
//US#ifdef KAB_EMBEDDED
//#include <qstring.h>
//#endif //KAB_EMBEDDED
#include <qtextstream.h>
#include <qfile.h>
#include <qregexp.h>
#include <stdlib.h>
#include <libkdepim/kpimglobalprefs.h>
#include <kconfig.h>
#include <klocale.h>
#include <kstaticdeleter.h>
//US#include <kdebug.h> // defines kdDebug()
#include "kabprefs.h"
#ifdef DESKTOP_VERSION
#include <qapplication.h>
#endif
KABPrefs *KABPrefs::sInstance = 0;
-static KStaticDeleter<KABPrefs> staticDeleter;
+static KStaticDeleter<KABPrefs> staticDeleterAB;
KABPrefs::KABPrefs()
: KPimPrefs("kaddressbookrc")
{
-
- mLocaleDict = 0;
mDetailsFont = QFont("helvetica",12);
KPrefs::setCurrentGroup( "Views" );
addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
KPrefs::setCurrentGroup( "General" );
addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
#ifdef KAB_EMBEDDED
addItemBool("AskForQuit",&mAskForQuit,true);
addItemBool("ToolBarHor",&mToolBarHor, true );
addItemBool("ToolBarUp",&mToolBarUp, false );
addItemBool("SearchWithReturn",&mSearchWithReturn, true );
addItemFont("DetailsFont",&mDetailsFont);
#endif //KAB_EMBEDDED
KPrefs::setCurrentGroup( "MainWindow" );
addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true );
addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
addItemIntList( "DetailsSplitter", &mDetailsSplitter );
addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true );
KPrefs::setCurrentGroup( "Extensions_General" );
QStringList defaultExtensions;
defaultExtensions << "merge";
defaultExtensions << "distribution_list_editor";
addItemInt( "CurrentExtension", &mCurrentExtension, 0 );
addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions );
KPrefs::setCurrentGroup( "Views" );
QString defaultView = i18n( "Default Table View" );
addItemString( "CurrentView", &mCurrentView, defaultView );
addItemStringList( "ViewNames", &mViewNames, defaultView );
KPrefs::setCurrentGroup( "Filters" );
addItemInt( "CurrentFilter", &mCurrentFilter, 0 );
}
KABPrefs::~KABPrefs()
{
//qDebug("KABPrefs::~KABPrefs() ");
- setLocaleDict( 0 );
- if ( mLocaleDict )
- delete mLocaleDict;
+ if (sInstance == this)
+ sInstance = staticDeleterAB.setObject(0);
}
KABPrefs *KABPrefs::instance()
{
if ( !sInstance ) {
#ifdef KAB_EMBEDDED
- sInstance = staticDeleter.setObject( new KABPrefs() );
+ sInstance = staticDeleterAB.setObject( new KABPrefs() );
#else //KAB_EMBEDDED
//US the following line has changed ???. Why
- staticDeleter.setObject( sInstance, new KABPrefs() );
+ staticDeleterAB.setObject( sInstance, new KABPrefs() );
#endif //KAB_EMBEDDED
sInstance->readConfig();
}
return sInstance;
}
void KABPrefs::setCategoryDefaults()
{
mCustomCategories.clear();
mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
<< i18n( "Customer" ) << i18n( "Friend" );
}
// US introduce a nonconst way to return the config object.
KConfig* KABPrefs::getConfig()
{
return config();
}
void KABPrefs::usrReadConfig()
{
- QString fileName ;
-#ifndef DESKTOP_VERSION
- fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/";
-#else
- fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/";
-#endif
- int mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
- mLocaleDict = 0;
- if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
-
- if ( mPreferredLanguage == 1 )
- fileName = fileName+"germantranslation.txt";
- else if ( mPreferredLanguage == 4 )
- fileName = fileName+"usertranslation.txt";
- else if ( mPreferredLanguage == 2 )
- fileName = fileName+"frenchtranslation.txt";
- else if ( mPreferredLanguage == 3 )
- fileName = fileName+"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() );
- }
-
-
- }
KPimPrefs::usrReadConfig();
}
/*US
void KABPrefs::usrSetDefaults()
{
KPimPrefs::usrSetDefaults();
}
void KABPrefs::usrReadConfig()
{
KPimPrefs::usrReadConfig();
}
void KABPrefs::usrWriteConfig()
{
KPimPrefs::usrWriteConfig();
}
*/
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index 1098f4c..cc8413e 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -68,29 +68,28 @@ class KABPrefs : public KPimPrefs
bool mJumpButtonBarVisible;
bool mDetailsPageVisible;
bool mMultipleViewsAtOnce;
bool mSearchWithReturn;
QValueList<int> mExtensionsSplitter;
QValueList<int> mDetailsSplitter;
// Extensions stuff
int mCurrentExtension;
QStringList mActiveExtensions;
// Views stuff
QString mCurrentView;
QStringList mViewNames;
// Filter
int mCurrentFilter;
void setCategoryDefaults();
QFont mDetailsFont;
private:
KABPrefs();
- QDict<QString> *mLocaleDict;
static KABPrefs *sInstance;
};
#endif
diff --git a/kmicromail/koprefs.h b/kmicromail/koprefs.h
index a47642b..f0a4463 100644
--- a/kmicromail/koprefs.h
+++ b/kmicromail/koprefs.h
@@ -2,78 +2,76 @@
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOPREFS_H
#define KOPREFS_H
-#include <qdict.h>
#include <libkdepim/kpimprefs.h>
class KConfig;
class QFont;
class QColor;
class QStringList;
class KOPrefs : public KPimPrefs
{
public:
virtual ~KOPrefs();
/** Get instance of KOPrefs. It is made sure that there is only one
instance. */
static KOPrefs *instance();
/** Set preferences to default values */
void usrSetDefaults();
/** Read preferences from config file */
void usrReadConfig();
/** Write preferences to config file */
void usrWriteConfig();
void setCategoryDefaults(){;};
protected:
/** Fill empty mail fields with default values. */
void fillMailDefaults();
private:
/** Constructor disabled for public. Use instance() to create a KOPrefs
object. */
KOPrefs();
static KOPrefs *mInstance;
- QDict<QString> *mLocaleDict;
public:
// preferences data
KConfig* getConfig();
QFont mAppFont;
QFont mComposeFont;
QFont mReadFont;
QString mName;
QString mEmail;
bool mSendLater, mViewAsHtml, mUseKapi;
private:
};
#endif
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp
index 58198a2..db7c3f2 100644
--- a/korganizer/kodialogmanager.cpp
+++ b/korganizer/kodialogmanager.cpp
@@ -68,69 +68,68 @@ KODialogManager::~KODialogManager()
delete mFilterEditDialog;
#ifndef KORG_NOPLUGINS
delete mPluginDialog;
#endif
}
OutgoingDialog *KODialogManager::outgoingDialog()
{
createOutgoingDialog();
return mOutgoingDialog;
}
void KODialogManager::createOutgoingDialog()
{
if (!mOutgoingDialog) {
mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView);
if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog);
connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)),
mMainView,SIGNAL(numOutgoingChanged(int)));
}
}
void KODialogManager::showOptionsDialog( bool showSync )
{
- int curLanguage = KOPrefs::instance()->mPreferredLanguage;
+
if (!mOptionsDialog) {
mOptionsDialog = new KOPrefsDialog(mMainView);
//mOptionsDialog->readConfig();
connect(mOptionsDialog,SIGNAL(configChanged()),
mMainView,SLOT(updateConfig()));
//connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
// mOptionsDialog,SLOT(updateCategories()));
}
mOptionsDialog->readConfig();
#ifndef DESKTOP_VERSION
mOptionsDialog->showMaximized();
#else
mOptionsDialog->show();
#endif
if ( showSync )
mOptionsDialog->showSyncPage();
mOptionsDialog->exec();
- if ( curLanguage != KOPrefs::instance()->mPreferredLanguage )
- KOPrefs::instance()->mLanguageChanged = true;
+
}
void KODialogManager::showSyncOptions()
{
showOptionsDialog( true );
}
void KODialogManager::showOutgoingDialog()
{
createOutgoingDialog();
mOutgoingDialog->show();
mOutgoingDialog->raise();
}
IncomingDialog *KODialogManager::incomingDialog()
{
createOutgoingDialog();
if (!mIncomingDialog) {
mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView);
connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)),
mMainView,SIGNAL(numIncomingChanged(int)));
connect(mIncomingDialog,SIGNAL(calendarUpdated()),
mMainView,SLOT(updateView()));
}
return mIncomingDialog;
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index ba1c6d1..f44debc 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -25,103 +25,97 @@
#ifndef _WIN32_
#include <unistd.h>
#endif
#include <qdir.h>
#include <qtextstream.h>
#include <qtextcodec.h>
#include <qstring.h>
#include <qregexp.h>
#include <qfont.h>
#include <qcolor.h>
#include <qstringlist.h>
#include <stdlib.h>
#include <kglobal.h>
#include <kconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include <kemailsettings.h>
#include <kstaticdeleter.h>
#include <libkdepim/kpimglobalprefs.h>
#include "koprefs.h"
#include "mainwindow.h"
-const char *germanwords[][2] = {
-#include "wordsgerman.h"
- "", ""
-};
-
KOPrefs *KOPrefs::mInstance = 0;
static KStaticDeleter<KOPrefs> insd;
KOPrefs::KOPrefs() :
KPimPrefs("korganizerrc")
{
mCategoryColors.setAutoDelete(true);
- mLocaleDict = 0;
fillMailDefaults();
mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
QColor defaultHolidayColor = QColor(255,0,0);
QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
QColor defaultTodoDueTodayColor = QColor(255,220,100);
QColor defaultTodoOverdueColor = QColor(255,153,125);
mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
mDefaultViewFont = QFont("helvetica",10);
mDefaultMonthViewFont = QFont("helvetica",8);
mMarcusBainsFont= QFont("helvetica",10);
mDateNavigatorFont= QFont("helvetica",10, QFont::Bold);
mEditBoxFont = QFont("helvetica",12);
mJornalViewFont = QFont("helvetica",12);
KPrefs::setCurrentGroup("General");
addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
addItemBool("ShowIconSearch",&mShowIconSearch,true);
addItemBool("ShowIconList",&mShowIconList,true);
addItemBool("ShowIconDay1",&mShowIconDay1,true);
addItemBool("ShowIconDay5",&mShowIconDay5,true);
addItemBool("ShowIconDay7",&mShowIconDay7,true);
addItemBool("ShowIconMonth",&mShowIconMonth,true);
addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
addItemBool("ShowIconBack",&mShowIconBack,true);
addItemBool("ShowIconToday",&mShowIconToday,true);
addItemBool("ShowIconForward",&mShowIconForward,true);
addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
addItemBool("ShowIconNext",&mShowIconNext,true);
addItemBool("ShowIconJournal",&mShowIconJournal,true);
addItemBool("ShowIconStretch",&mShowIconStretch,true);
- addItemBool("LanguageChanged",&mLanguageChanged,false);
+ addItemInt("LastLoadedLanguage",&mOldLanguage,0);
addItemBool("AskForQuit",&mAskForQuit,false);
#ifndef DESKTOP_VERSION
addItemBool("ShowFullMenu",&mShowFullMenu,false);
#else
addItemBool("ShowFullMenu",&mShowFullMenu,true);
#endif
addItemBool("ToolBarHor",&mToolBarHor, true );
addItemBool("ToolBarUp",&mToolBarUp, false );
addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
addItemInt("Whats Next Days",&mWhatsNextDays,3);
addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
addItemInt("AllDay Size",&mAllDaySize,28);
QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
addItemStringList("LocationDefaults",&mLocationDefaults );
addItemStringList("EventSummary User",&mEventSummaryUser);
addItemStringList("TodoSummary User",&mTodoSummaryUser);
@@ -183,55 +177,49 @@ KOPrefs::KOPrefs() :
// addItemBool("WriteBackFile",&mWriteBackFile,true);
// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
// addItemBool("AskForPreferences",&mAskForPreferences,true);
// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
addItemInt("LastSyncTime",&mLastSyncTime,0);
#ifdef _WIN32_
QString hdp= locateLocal("data","korganizer")+"\\\\";
#else
QString hdp= locateLocal("data","korganizer")+"/";
#endif
KPrefs::setCurrentGroup("LoadSaveFileNames");
addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
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");
KPrefs::setCurrentGroup("Colors");
addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
addItemBool("UseAppColors",&mUseAppColors,false);
KPrefs::setCurrentGroup("Views");
addItemInt("Hour Size",&mHourSize,8);
@@ -295,51 +283,49 @@ KOPrefs::KOPrefs() :
addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
addItemStringList("AdditionalMails",&mAdditionalMails,"");
addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
KPrefs::setCurrentGroup( "Editors" );
addItemStringList( "EventTemplates", &mEventTemplates );
addItemStringList( "TodoTemplates", &mTodoTemplates );
addItemInt("DestinationPolicy",&mDestination,standardDestination);
}
KOPrefs::~KOPrefs()
{
if (mInstance == this)
mInstance = insd.setObject(0);
- setLocaleDict( 0 );
- if ( mLocaleDict )
- delete mLocaleDict;
+
//qDebug("KOPrefs::~KOPrefs() ");
}
KOPrefs *KOPrefs::instance()
{
if (!mInstance) {
mInstance = insd.setObject(new KOPrefs());
mInstance->readConfig();
}
return mInstance;
}
void KOPrefs::usrSetDefaults()
{
}
void KOPrefs::fillMailDefaults()
{
if (mName.isEmpty()) mName = i18n("Anonymous");
if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
}
@@ -356,122 +342,58 @@ void KOPrefs::setCategoryDefaults()
QStringList::Iterator it;
for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
setCategoryColor(*it,mDefaultCategoryColor);
}
}
QStringList KOPrefs::getDefaultList()
{
QStringList retval ;
retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
<< i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
<< i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
<< i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
<< i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
<< i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
<< i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
<< i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
retval.sort();
return retval;
}
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")
<< i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
<< i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
// << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
mLocationDefaults.sort();
}
if (mEventSummaryUser.isEmpty()) {
mEventSummaryUser = getDefaultList() ;
}
if (mTodoSummaryUser.isEmpty()) {
mTodoSummaryUser = getDefaultList() ;
}
if (mCustomCategories.isEmpty()) setCategoryDefaults();
config()->setGroup("Personal Settings");
mName = config()->readEntry("user_name","");
mEmail = config()->readEntry("user_email","");
fillMailDefaults();
config()->setGroup("Category Colors");
QStringList::Iterator it;
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index c74b0ef..0656644 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -2,96 +2,95 @@
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOPREFS_H
#define KOPREFS_H
-#include <qdict.h>
#include <libkdepim/kpimprefs.h>
+#include <qdict.h>
class KConfig;
class QFont;
class QColor;
class QStringList;
class KOPrefs : public KPimPrefs
{
public:
enum { FormatVCalendar, FormatICalendar };
enum { MailClientKMail, MailClientSendmail };
enum { IMIPDummy, IMIPKMail };
enum { IMIPOutbox, IMIPdirectsend };
enum { neverAuto, addressbookAuto, selectedAuto };
enum { standardDestination, askDestination };
virtual ~KOPrefs();
/** Get instance of KOPrefs. It is made sure that there is only one
instance. */
static KOPrefs *instance();
/** Set preferences to default values */
void usrSetDefaults();
/** Read preferences from config file */
void usrReadConfig();
/** Write preferences to config file */
void usrWriteConfig();
void setCategoryDefaults();
protected:
void setTimeZoneIdDefault();
/** Fill empty mail fields with default values. */
void fillMailDefaults();
private:
/** Constructor disabled for public. Use instance() to create a KOPrefs
object. */
KOPrefs();
static KOPrefs *mInstance;
- QDict<QString> *mLocaleDict;
QStringList getDefaultList();
public:
// preferences data
KConfig* getConfig();
void setFullName(const QString &);
QString fullName();
void setEmail(const QString &);
QString email();
QString mAdditional;
bool mEmailControlCenter;
bool mBcc;
bool mAutoSave;
int mAutoSaveInterval;
bool mConfirm;
bool mEnableGroupScheduling;
bool mEnableProjectView;
int mDefaultFormat;
int mMailClient;
@@ -137,49 +136,48 @@ class KOPrefs : public KPimPrefs
QColor mAppColor2;
bool mUseAppColors;
int mDayBegins;
int mHourSize;
int mAllDaySize;
bool mShowFullMenu;
bool mDailyRecur;
bool mWeeklyRecur;
bool mMonthDailyRecur;
bool mMonthWeeklyRecur;
bool mMonthShowIcons;
bool mMonthShowShort;
bool mEnableToolTips;
bool mEnableMonthScroll;
bool mFullViewMonth;
bool mMonthViewUsesCategoryColor;
bool mFullViewTodo;
bool mShowCompletedTodo;
bool mMarcusBainsEnabled;
int mNextXDays;
int mWhatsNextDays;
int mWhatsNextPrios;
bool mEnableQuickTodo;
- bool mLanguageChanged;
bool mCompactDialogs;
bool mVerticalScreen;
bool mShowIconNewTodo;
bool mShowIconNewEvent;
bool mShowIconSearch;
bool mShowIconList;
bool mShowIconDay1;
bool mShowIconDay5;
bool mShowIconDay7;
bool mShowIconMonth;
bool mShowIconTodoview;
bool mShowIconBackFast;
bool mShowIconBack;
bool mShowIconToday;
bool mShowIconForward;
bool mShowIconForwardFast;
bool mShowIconWhatsThis;
bool mShowIconNextDays;
bool mShowIconNext;
bool mShowIconJournal;
bool mShowIconStretch;
@@ -232,52 +230,44 @@ class KOPrefs : public KPimPrefs
bool mSetTimeToDayStartAt;
bool mHighlightCurrentDay;
bool mUseHighlightLightColor;
bool mListViewMonthTimespan;
bool mWNViewShowsParents;
bool mWNViewShowLocation;
bool mTodoViewShowsPercentage;
bool mTodoViewUsesCatColors;
bool mTodoViewUsesSmallFont;
bool mTodoViewUsesForegroundColor;
bool mMonthViewUsesForegroundColor;
bool mHightlightDateTimeEdit;
bool mShortDateInViewer;
QStringList mLocationDefaults;
QStringList mEventSummaryUser;
QStringList mTodoSummaryUser;
bool mUseInternalAlarmNotification;
int mAlarmPlayBeeps;
int mAlarmSuspendTime;
int mAlarmSuspendCount;
int mAlarmBeepInterval;
+ int mOldLanguage;
+ int mOldLoadedLanguage;
QString mActiveSyncPort;
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;
QColor mDefaultCategoryColor;
QFont mDefaultTimeBarFont;
QFont mDefaultViewFont;
QFont mDefaultMonthViewFont;
QString mName;
QString mEmail;
};
#endif
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index cf07a1a..f5a1c50 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -10,48 +10,49 @@
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qkeycode.h>
#include <qcombobox.h>
#include <qdatetime.h>
#include <qlineedit.h>
#include <qapplication.h>
#include <kmessagebox.h>
#include <kglobal.h>
#include <kdebug.h>
#include <klocale.h>
+#include <kpimglobalprefs.h>
#include "ktimeedit.h"
#include "koprefs.h"
#include <qvalidator.h>
// Validator for a time value with only hours and minutes (no seconds)
// Mostly locale aware. Author: David Faure <faure@kde.org>
class KOTimeValidator : public QValidator
{
public:
KOTimeValidator(QWidget* parent, const char* name=0) : QValidator(parent, name) {}
virtual State validate(QString& str, int& /*cursorPos*/) const
{
return Acceptable;
bool ok = false;
// TODO use KLocale::WithoutSeconds in HEAD
/*QTime time =*/ KGlobal::locale()->readTime(str, &ok);
if ( ok )
return Acceptable;
// readTime doesn't help knowing when the string is "Intermediate".
int length = str.length();
if ( !str ) // empty string?
return Invalid; // there should always be a ':' in it, right?
@@ -90,49 +91,49 @@ KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
if ( QApplication::desktop()->width() < 650 )
setSizeLimit ( 6 );
mTime = qt;
// mNoTimeString = i18n("No Time");
// insertItem( mNoTimeString );
// Fill combo box with selection of times in localized format.
QTime timeEntry(0,0,0);
do {
insertItem(KGlobal::locale()->formatTime(timeEntry));
timeEntry = timeEntry.addSecs(60*15);
} while (!timeEntry.isNull());
// Add end of day.
insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) );
updateText();
setFocusPolicy(QWidget::StrongFocus);
connect(this, SIGNAL(activated(int)), this, SLOT(activ(int)));
connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int)));
connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText()));
QFontMetrics fm ( font() );
QString timeString = "24:00";
- if ( KOPrefs::instance()->mPreferredTime == 1 )
+ if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 )
timeString = "02:00pm";
int addSpace = 32;
if ( QApplication::desktop()->width() > 320 )
timeString += ":00";
setFixedWidth(fm.width( timeString ) + 32 );
// Highlight Background and Textcolor change from default
QPalette palette = QWidget::palette();
unsigned char red, green, blue;
red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10;
green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10;
blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10;
palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) );
palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) );
setPalette( palette );
}
KOTimeEdit::~KOTimeEdit()
{
}
bool KOTimeEdit::hasTime() const
{
// Can't happen
@@ -217,49 +218,49 @@ void KOTimeEdit::subTime(QTime qt, bool update)
// void KOTimeEdit::focusInEvent ( QFocusEvent * )
// {
// qDebug("focusInEvent ( QFocusEvent * ) ");
// }
void KOTimeEdit::keyReleaseEvent(QKeyEvent *e)
{
if ( !e->isAutoRepeat() ) {
mFlagKeyPressed = false;
}
}
void KOTimeEdit::setSelect( int from, int to )
{
if ( KOPrefs::instance()->mHightlightDateTimeEdit)
lineEdit()->setSelection( from , to );
}
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 ) {
e->ignore();
// qDebug(" ignore %d",e->isAutoRepeat() );
return;
}
if (! e->isAutoRepeat() ) {
mFlagKeyPressed = true;
}
// Tap -> Focus Next Widget
if ( e->key() == Key_Tab ) {
QComboBox::keyPressEvent(e);
return;
}
// save Text from QLineEdit and CursorPosition
QString text = lineEdit()->text();
int cpos = lineEdit()->cursorPosition();
// qDebug("cpos %d ", cpos);
// Switch for arrows, backspace and escape
switch(e->key()) {
case Key_Escape:
lineEdit()->deselect();
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index fbfcd20..dc2026b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -204,52 +204,51 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
finfo.setFile( oldFile );
if (finfo.exists() ) {
KMessageBox::information( this, message);
mView->openCalendar( oldFile );
qApp->processEvents();
} else {
oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
finfo.setFile( oldFile );
if (finfo.exists() ) {
KMessageBox::information( this, message);
mView->openCalendar( oldFile );
qApp->processEvents();
}
}
mView->saveCalendar( defaultFileName() );
newFile = true;
}
QTime neededSaveTime = QDateTime::currentDateTime().time();
mView->openCalendar( defaultFileName() );
int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
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 );
connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
SLOT( processIncidenceSelection( Incidence * ) ) );
connect( mView, SIGNAL( modifiedChanged( bool ) ),
SLOT( slotModifiedChanged( bool ) ) );
connect( mView, SIGNAL( tempDisableBR(bool) ),
SLOT( disableBR(bool) ) );
connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
mView->setModified( false );
mBlockAtStartup = false;
mView->setModified( false );
setCentralWidget( mView );
globalFlagBlockStartup = 0;
mView->show();
delete splash;
if ( newFile )
mView->updateConfig();
// qApp->processEvents();
//qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
//fillSyncMenu();
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 0a580ca..5298f0c 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -14,58 +14,61 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kglobal.h>
#include <kconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include <kstaticdeleter.h>
#include <qregexp.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qapplication.h>
#include "kpimglobalprefs.h"
KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
-static KStaticDeleter<KPimGlobalPrefs> staticDeleter;
+static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP;
KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
: KPrefs("microkdeglobalrc")
{
-
+ mLocaleDict = 0;
KPrefs::setCurrentGroup("Locale");
addItemInt("PreferredLanguage",&mPreferredLanguage,0);
addItemInt("PreferredTime",&mPreferredTime,0);
addItemInt("PreferredDate",&mPreferredDate,0);
addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
//addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
// addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
KPrefs::setCurrentGroup("Time & Date");
addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") );
addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false);
addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
KPrefs::setCurrentGroup( "ExternalApplications" );
addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
addItemString( "EmailChannel", &mEmailOtherChannel, "" );
addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
@@ -83,57 +86,122 @@ KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
addItemString( "SMSChannel", &mSMSOtherChannel, "" );
addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
addItemString( "PagerChannel", &mPagerOtherChannel, "" );
addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC );
addItemString( "SIPChannel", &mSipOtherChannel, "" );
addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
KPrefs::setCurrentGroup( "PhoneAccess" );
addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
}
-
void KPimGlobalPrefs::setGlobalConfig()
{
+ if ( mLocaleDict == 0 ) {
+ QString fileName ;
+ QString name = KGlobal::getAppName() +"/";
+#ifndef DESKTOP_VERSION
+ fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name
+#else
+ fileName = qApp->applicationDirPath () + "/kdepim/"+ name;
+#endif
+ mLocaleDict = 0;
+ if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
+
+ if ( mPreferredLanguage == 1 )
+ fileName = fileName+"germantranslation.txt";
+ else if ( mPreferredLanguage == 4 )
+ fileName = fileName+"usertranslation.txt";
+ else if ( mPreferredLanguage == 2 )
+ fileName = fileName+"frenchtranslation.txt";
+ else if ( mPreferredLanguage == 3 )
+ fileName = fileName+"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() );
+ }
+ }
+ }
KGlobal::locale()->setHore24Format( !mPreferredTime );
KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
KGlobal::locale()->setLanguage( mPreferredLanguage );
QString dummy = mUserDateFormatLong;
KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
dummy = mUserDateFormatShort;
KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
mDaylightsavingStart,
mDaylightsavingEnd );
KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min );
}
KPimGlobalPrefs::~KPimGlobalPrefs()
{
+ if (sInstance == this)
+ sInstance = staticDeleterGP.setObject(0);
+ else
+ qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?");
//qDebug("KPimGlobalPrefs::~KPimGlobalPrefs() ");
writeConfig();
+ if ( mLocaleDict )
+ delete mLocaleDict;
}
KPimGlobalPrefs *KPimGlobalPrefs::instance()
{
if ( !sInstance ) {
- sInstance = staticDeleter.setObject( new KPimGlobalPrefs() );
+ sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() );
sInstance->readConfig();
}
return sInstance;
}
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index d09c3da..11c534a 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -11,48 +11,49 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KPIMGLOBALPREFS_H
#define KPIMGLOBALPREFS_H
#include "kprefs.h"
+#include <qdict.h>
class KPimGlobalPrefs : public KPrefs
{
public:
void setGlobalConfig();
static KPimGlobalPrefs *instance();
virtual ~KPimGlobalPrefs();
enum EMailClients {
NONE_EMC = 0,
OTHER_EMC = 1,
OMPI_EMC = 2,
QTOPIA_EMC = 3,
OPIE_EMC = 4
};
enum PhoneClients {
NONE_PHC = 0,
OTHER_PHC = 1,
KPPI_PHC = 2
@@ -62,48 +63,49 @@ class KPimGlobalPrefs : public KPrefs
NONE_FAC = 0,
OTHER_FAC = 1
};
enum SMSClients {
NONE_SMC = 0,
OTHER_SMC = 1
};
enum PagerClients {
NONE_PAC = 0,
OTHER_PAC = 1
};
enum SIPClients {
NONE_SIC = 0,
OTHER_SIC = 1,
KPPI_SIC = 2
};
private:
KPimGlobalPrefs( const QString &name = QString::null );
static KPimGlobalPrefs *sInstance;
+ QDict<QString> *mLocaleDict;
public:
//US I copied the following "locale" settings from KOPrefs
int mPreferredDate;
QString mUserDateFormatLong;
QString mUserDateFormatShort;
int mPreferredLanguage;
int mPreferredTime;
bool mWeekStartsOnSunday;
QString mTimeZoneId;
bool mUseDaylightsaving;
int mDaylightsavingStart;
int mDaylightsavingEnd;
bool mTimeZoneAdd30min;
int mEmailClient;
QString mEmailOtherChannel;
QString mEmailOtherMessage;
QString mEmailOtherMessageParameters;
QString mEmailOtherMessage2;
QString mEmailOtherMessageParameters2;
int mPhoneClient;
diff --git a/microkde/kstaticdeleter.h b/microkde/kstaticdeleter.h
index dfd3929..d9c2b72 100644
--- a/microkde/kstaticdeleter.h
+++ b/microkde/kstaticdeleter.h
@@ -7,31 +7,32 @@
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef _KSTATIC_DELETER_H_
#define _KSTATIC_DELETER_H_
template<class type>
class KStaticDeleter
{
public:
KStaticDeleter() {};
- type *setObject( type *obj, bool isArray = false) { _mobj = obj;return obj; }
- virtual ~KStaticDeleter() {delete _mobj;};
+ type *setObject( type *obj, bool isArray = false) { _mobj = obj;_isArray = isArray;return obj; }
+ virtual ~KStaticDeleter() {if (_isArray) delete[] _mobj; else delete _mobj;};
private:
type* _mobj;
+ bool _isArray;
};
#endif
diff --git a/pwmanager/pwmanager/pwmprefs.cpp b/pwmanager/pwmanager/pwmprefs.cpp
index fdc34e0..68d5b68 100644
--- a/pwmanager/pwmanager/pwmprefs.cpp
+++ b/pwmanager/pwmanager/pwmprefs.cpp
@@ -10,96 +10,100 @@
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#include <kconfig.h>
#include <klocale.h>
#include <kstaticdeleter.h>
#include "pwmprefs.h"
PWMPrefs *PWMPrefs::sInstance = 0;
-static KStaticDeleter<PWMPrefs> staticDeleter;
+static KStaticDeleter<PWMPrefs> staticDeleterPP;
PWMPrefs::PWMPrefs()
: KPimPrefs("pwmanagerrc")
{
KPrefs::setCurrentGroup( "Global" );
addItemString( "autoStart", &mAutoStart, "" );
addItemString( "browserCommand", &mBrowserCommand, "" );
addItemString( "xtermCommand", &mXTermCommand, CONF_DEFAULT_XTERMCOMMAND);
addItemFont( "entryFont", &mEntryFont);
addItemInt( "pwTimeout", &mPwTimeout, CONF_DEFAULT_PWTIMEOUT );
addItemInt( "lockTimeout", &mLockTimeout, CONF_DEFAULT_LOCKTIMEOUT );
addItemInt( "compression", &mCompression, CONF_DEFAULT_COMPRESSION );
addItemInt("cryptAlgo", &mCryptAlgo, CONF_DEFAULT_CRYPTALGO);
addItemInt("hashAlgo", &mHashAlgo, CONF_DEFAULT_HASHALGO);
addItemInt( "filePermissions", &mFilePermissions, CONF_DEFAULT_FILEPERMISSIONS );
addItemInt( "minimizeLock", &mMinimizeLock, CONF_DEFAULT_MINIMIZELOCK );
addItemBool( "unlockOnOpen", &mUnlockOnOpen, CONF_DEFAULT_UNLOCKONOPEN );
addItemBool( "tray", &mTray, CONF_DEFAULT_TRAY );
addItemBool( "makeFileBackup", &mMakeFileBackup, CONF_DEFAULT_MAKEFILEBACKUP );
addItemBool( "autostartDeepLocked", &mAutostartDeeplocked, CONF_DEFAULT_AUTOSTART_DEEPL );
addItemBool( "autoDeepLock", &mAutoDeeplock, CONF_DEFAULT_AUTODEEPLOCK );
addItemBool( "kwalletEmu", &mKWalletEmu, CONF_DEFAULT_KWALLETEMU );
addItemBool( "newEntrLockStat", &mNewEntrLockStat, CONF_DEFAULT_NEWENTRLOCKSTAT );
KPrefs::setCurrentGroup( "Wnd" );
addItemSize( "MainWndSize", &mMainWndSize);
addItemInt( "MainViewStyle", &mMainViewStyle, CONF_DEFAULT_MAINVIEWSTYLE );
addItemBool( "autoMinimizeOnStart", &mAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE );
addItemBool( "close", &mClose, CONF_DEFAULT_WNDCLOSE );
addItemIntList( "commentSplitter", &mCommentSplitter );
addItemIntList( "categorySplitter", &mCategorySplitter );
}
PWMPrefs::~PWMPrefs()
-{
+{
+ if (sInstance == this)
+ sInstance = staticDeleterPP.setObject(0);
+ else
+ qDebug("Whats this? Error in PWMPrefs::~PWMPrefs()?");
}
PWMPrefs *PWMPrefs::instance()
{
if ( !sInstance ) {
#ifdef PWM_EMBEDDED
- sInstance = staticDeleter.setObject( new PWMPrefs() );
+ sInstance = staticDeleterPP.setObject( new PWMPrefs() );
#else //PWM_EMBEDDED
//US the following line has changed ???. Why
- staticDeleter.setObject( sInstance, new PWMPrefs() );
+ staticDeleterPP.setObject( sInstance, new PWMPrefs() );
#endif //KAB_EMBEDDED
sInstance->readConfig();
}
return sInstance;
}
// US introduce a nonconst way to return the config object.
KConfig* PWMPrefs::getConfig()
{
return config();
}
/*******************************************************************
* functions for reading the configuration settings
*******************************************************************/
QString PWMPrefs::confGlobAutoStart()
{
return mAutoStart;
}
QString PWMPrefs::confGlobBrowserCommand()
{