-rw-r--r-- | kabc/addressee.cpp | 16 | ||||
-rw-r--r-- | kabc/addressee.h | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kabprefs.cpp | 1 | ||||
-rw-r--r-- | kalarmd/simplealarmdaemonapplet.cpp | 1 | ||||
-rw-r--r-- | kmicromail/koprefs.cpp | 381 | ||||
-rw-r--r-- | korganizer/main.cpp | 6 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 6 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 2 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.cpp | 8 | ||||
-rw-r--r-- | microkde/kstaticdeleter.h | 6 |
11 files changed, 35 insertions, 395 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index e571980..19a1845 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -302,32 +302,48 @@ void Addressee::mergeContact( const Addressee& ad ) if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; // pending: // merging phonenumbers // merging addresses // merging emails; // merging categories; // merging custom; // merging keys qDebug("merge contact %s ", ad.uid().latin1()); setUid( ad.uid() ); setRevision( ad.revision() ); } +void Addressee::simplifyAddresses() +{ + if ( mData->addresses.count() < 3 ) return ; + int count = 0; + Address::List list; + Address::List::Iterator it; + for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { + if ( count > 1 ) + list.append( *it ); + ++count; + } + for( it = list.begin(); it != list.end(); ++it ) { + removeAddress( (*it) ); + } +} + // removes all emails but the first // needed by phone sync void Addressee::simplifyEmails() { if ( mData->emails.count() == 0 ) return ; QString email = mData->emails.first(); detach(); mData->emails.clear(); mData->emails.append( email ); } void Addressee::simplifyPhoneNumbers() { KABC::PhoneNumber::List removeNumbers; KABC::PhoneNumber::List::Iterator phoneIter; for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); diff --git a/kabc/addressee.h b/kabc/addressee.h index 4cafa86..44f0629 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h @@ -105,32 +105,33 @@ class Addressee QString getID( const QString & ); void setCsum( const QString &, const QString & ); QString getCsum( const QString & ); void removeID(const QString &); void computeCsum(const QString &dev); ulong getCsum4List( const QStringList & attList); /** Return, if the address book entry is empty. */ bool isEmpty() const; void setExternalUID( const QString &id ); QString externalUID() const; void setOriginalExternalUID( const QString &id ); QString originalExternalUID() const; void mergeContact( const Addressee& ad ); void simplifyEmails(); + void simplifyAddresses(); void simplifyPhoneNumbers(); void simplifyPhoneNumberTypes(); /** Set unique identifier. */ void setUid( const QString &uid ); /** Return unique identifier. */ QString uid() const; /** Return translated label for uid field. */ static QString uidLabel(); diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 939296f..9b059d3 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -309,32 +309,33 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const #endif //KAB_EMBEDDED mEditorDialog = 0; createAddresseeEditorDialog( this ); setModified( false ); } KABCore::~KABCore() { // save(); //saveSettings(); //KABPrefs::instance()->writeConfig(); delete AddresseeConfig::instance(); mAddressBook = 0; KABC::StdAddressBook::close(); delete syncManager; + } void KABCore::restoreSettings() { mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; bool state; if (mMultipleViewsAtOnce) state = KABPrefs::instance()->mDetailsPageVisible; else state = false; mActionDetails->setChecked( state ); setDetailsVisible( state ); @@ -689,32 +690,33 @@ void KABCore::export2phone() QString fileName = locateLocal("tmp", "tempfile.vcf"); #else QString fileName = "/tmp/kdepimtemp.vcf"; #endif KABC::VCardConverter converter; QString description; QString datastream; for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { KABC::Addressee a = mAddressBook->findByUid( *it ); if ( a.isEmpty() ) continue; a.simplifyEmails(); a.simplifyPhoneNumbers(); a.simplifyPhoneNumberTypes(); + a.simplifyAddresses(); if (description.isEmpty()) description = a.formattedName(); QString vcard; QString vcardnew; converter.addresseeToVCard( a, vcard ); int start = 0; int next; while ( (next = vcard.find("TYPE=", start) )>= 0 ) { int semi = vcard.find(";", next); int dopp = vcard.find(":", next); int sep; if ( semi < dopp && semi >= 0 ) sep = semi ; else sep = dopp; diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 552c933..dded2bf 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp @@ -69,32 +69,33 @@ KABPrefs::KABPrefs() 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() "); } KABPrefs *KABPrefs::instance() { if ( !sInstance ) { #ifdef KAB_EMBEDDED sInstance = staticDeleter.setObject( new KABPrefs() ); #else //KAB_EMBEDDED //US the following line has changed ???. Why staticDeleter.setObject( sInstance, new KABPrefs() ); #endif //KAB_EMBEDDED sInstance->readConfig(); } return sInstance; } diff --git a/kalarmd/simplealarmdaemonapplet.cpp b/kalarmd/simplealarmdaemonapplet.cpp index bb89606..7e8125d 100644 --- a/kalarmd/simplealarmdaemonapplet.cpp +++ b/kalarmd/simplealarmdaemonapplet.cpp @@ -1,21 +1,20 @@ #include "simplealarmdaemonapplet.h" #include "simplealarmdaemonimpl.h" -#include <qpe/global.h> #include <qcopchannel_qws.h> #include <qlabel.h> #include <qapp.h> #include <qpe/resource.h> SimpleAlarmDaemonApplet::SimpleAlarmDaemonApplet() : mApplet( 0 ), ref( 0 ) { } SimpleAlarmDaemonApplet::~SimpleAlarmDaemonApplet() { delete mApplet; } diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp index 6484c45..c0200ff 100644 --- a/kmicromail/koprefs.cpp +++ b/kmicromail/koprefs.cpp @@ -55,453 +55,74 @@ KOPrefs::KOPrefs() : mAppFont = QFont("helvetica",12); mComposeFont = QFont("helvetica",12); mReadFont = QFont("helvetica",12); KPrefs::setCurrentGroup("General"); addItemString("SenderName",&mName,i18n ("Please set at") ); addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); addItemBool("ViewMailAsHtml",&mViewAsHtml,false); addItemBool("SendMailLater",&mSendLater,true); addItemBool("UseKapi",&mUseKapi,false); KPrefs::setCurrentGroup("Fonts"); addItemFont("Application Font",&mAppFont); addItemFont("Compose Font",&mComposeFont); addItemFont("Read Font",&mReadFont); -#if 0 - 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); - - 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); - - addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); - addItemBool("Enable Project View",&mEnableProjectView,false); - addItemBool("Auto Save",&mAutoSave,false); - addItemInt("Auto Save Interval",&mAutoSaveInterval,3); - addItemBool("Confirm Deletes",&mConfirm,true); - addItemString("Archive File",&mArchiveFile); - addItemString("Html Export File",&mHtmlExportFile, - QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); - addItemBool("Html With Save",&mHtmlWithSave,false); - - KPrefs::setCurrentGroup("Personal Settings"); - - addItemInt("Mail Client",&mMailClient,MailClientKMail); - addItemBool("Use Control Center Email",&mEmailControlCenter,false); - addItemBool("Bcc",&mBcc,false); - - KPrefs::setCurrentGroup("Time & Date"); - - // addItemString("Time Zone",&mTimeZone,"+0100"); - addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); - // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); - addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); - addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); - addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); - - - addItemInt("Default Start Time",&mStartTime,10); - addItemInt("Default Duration",&mDefaultDuration,2); - addItemInt("Default Alarm Time",&mAlarmTime,3); - addItemInt("Daylight Savings",&mDaylightSavings,0); - KPrefs::setCurrentGroup("AlarmSettings"); - addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); - addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); - addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); - addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); - - - KPrefs::setCurrentGroup("Calendar"); - - addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); - - KPrefs::setCurrentGroup("Fonts"); - // qDebug(" KPrefs::setCurrentGroup(Fonts); "); - addItemFont("TimeBar Font",&mTimeBarFont); - addItemFont("MonthView Font",&mMonthViewFont); - addItemFont("AgendaView Font",&mAgendaViewFont); - addItemFont("MarcusBains Font",&mMarcusBainsFont); - addItemFont("TimeLabels Font",&mTimeLabelsFont); - addItemFont("TodoView Font",&mTodoViewFont); - addItemFont("ListView Font",&mListViewFont); - addItemFont("DateNavigator Font",&mDateNavigatorFont); - addItemFont("EditBox Font",&mEditBoxFont); - addItemFont("JournalView Font",&mJornalViewFont); - addItemFont("WhatsNextView Font",&mWhatsNextFont); - addItemFont("EventView Font",&mEventViewFont); - -// KPrefs::setCurrentGroup("SyncProfiles"); -// addItemString("LocalMachineName",&mLocalMachineName, "undefined"); -// addItemStringList("SyncProfileNames",&mSyncProfileNames); -// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); - - KPrefs::setCurrentGroup("RemoteSyncing"); -// addItemBool("UsePasswd",&mUsePassWd,false); -// addItemBool("WriteBackFile",&mWriteBackFile,true); -// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); -// addItemBool("AskForPreferences",&mAskForPreferences,true); -// addItemBool("ShowSyncSummary",&mShowSyncSummary,true); - addItemBool("ShowSyncEvents",&mShowSyncEvents,false); - addItemInt("LastSyncTime",&mLastSyncTime,0); - addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); - addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); - -#ifdef _WIN32_ - QString hdp= locateLocal("data","korganizer")+"\\\\"; -#else - QString hdp= locateLocal("data","korganizer")+"/"; -#endif -// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); -// addItemString("RemoteUser",&mRemoteUser, "zaurus"); -// addItemString("RemotePassWd",&mRemotePassWd, ""); -// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); -// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); - - - 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" ); - addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); - - - 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("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); - addItemBool("Show Daily Recurrences",&mDailyRecur,true); - addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); - addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); - addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); - addItemBool("ShowShortMonthName",&mMonthShowShort,false); - addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); - addItemBool("Enable ToolTips",&mEnableToolTips,false); - addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); - addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); - addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); - addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); - addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); - addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); - addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); - addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); - addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); - addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); - addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); - addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); - addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); - addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); - addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); - addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); - addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); - addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); -#ifdef DESKTOP_VERSION - addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); -#else - addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); -#endif - addItemInt("Day Begins",&mDayBegins,7); - addItemInt("Working Hours Start",&mWorkingHoursStart,8); - addItemInt("Working Hours End",&mWorkingHoursEnd,17); - addItemBool("Exclude Holidays",&mExcludeHolidays,true); - addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); - - addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); - addItemBool("Full View Month",&mFullViewMonth,true); - addItemBool("Full View Todo",&mFullViewTodo,true); - addItemBool("Quick Todo",&mEnableQuickTodo,false); - - addItemInt("Next X Days",&mNextXDays,3); - - KPrefs::setCurrentGroup("Printer"); - - KPrefs::setCurrentGroup("Layout"); - - addItemBool("CompactDialogs",&mCompactDialogs,false); - addItemBool("VerticalScreen",&mVerticalScreen,true); - - KPrefs::setCurrentGroup("KOrganizer Plugins"); - - addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); - - KPrefs::setCurrentGroup("Group Scheduling"); - - addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); - 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); - -#endif } KOPrefs::~KOPrefs() { if (mInstance == this) mInstance = insd.setObject(0); -#if 0 - setLocaleDict( 0 ); - if ( mLocaleDict ) - delete mLocaleDict; - //qDebug("KOPrefs::~KOPrefs() "); -#endif + } 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"); } void KOPrefs::setTimeZoneIdDefault() { mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); } void KOPrefs::usrReadConfig() { -#if 0 - mLocaleDict = 0; - // pending LR fix translation - // qDebug("KOPrefs::usrReadConfig() fix translation "); - if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) { - 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 == 3 ) - fileName = MainWindow::resourcePath()+"usertranslation.txt"; - else if ( mPreferredLanguage == 2 ) - fileName = MainWindow::resourcePath()+"frenchtranslation.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 ) { - mLocationDefaults.clear(); - mEventSummaryUser.clear(); - mTodoSummaryUser.clear(); - } - 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; - for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { - setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); - - } - - if (mTimeZoneId.isEmpty()) { - setTimeZoneIdDefault(); - } -#endif KPimPrefs::usrReadConfig(); } void KOPrefs::usrWriteConfig() { -#if 0 - config()->setGroup("General"); - config()->writeEntry("Custom Categories",mCustomCategories); - - config()->setGroup("Personal Settings"); - config()->writeEntry("user_name",mName); - config()->writeEntry("user_email",mEmail); - - config()->setGroup("Category Colors"); - QDictIterator<QColor> it(mCategoryColors); - while (it.current()) { - config()->writeEntry(it.currentKey(),*(it.current())); - ++it; - } -#endif KPimPrefs::usrWriteConfig(); } KConfig* KOPrefs::getConfig() { return config(); } diff --git a/korganizer/main.cpp b/korganizer/main.cpp index 7f9b5c6..16186c0 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp @@ -1,20 +1,21 @@ #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> +#include <qcopchannel_qws.h> #include <qpe/global.h> #include <stdlib.h> #else #include <qapplication.h> #include <qstring.h> #include <qwindowsstyle.h> #include <qplatinumstyle.h> #include <qsgistyle.h> #endif #include <qdir.h> #include <kstandarddirs.h> #include <kglobal.h> #include <stdio.h> #include "mainwindow.h" @@ -66,37 +67,42 @@ int main( int argc, char **argv ) exitHelp = true; } } if ( ! exitHelp ) { KGlobal::setAppName( "korganizer" ); QString fileName ; #ifndef DESKTOP_VERSION fileName = getenv("QPEDIR"); KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); #else fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); #endif KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); MainWindow m; #ifndef DESKTOP_VERSION + QCopChannel* c1 = new QCopChannel("QPE/Application/datebook",&m, "channel" ) ; + QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); a.showMainWidget(&m ); #else a.setMainWidget(&m ); m.show(); //m.resize( 800, 600 ); QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); #endif if ( argc > 1 ) { QCString command = argv[1]; if ( argc > 2 ) command += argv[2]; qApp->processEvents(); m.recieve(command, QByteArray() ); } a.exec(); +#ifndef DESKTOP_VERSION + delete c1; +#endif } qDebug("KO: Bye! "); } diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 2d17986..3c16458 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -117,33 +117,32 @@ class KOex2phonePrefs : public QDialog } public: QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; QCheckBox* mWriteBackFuture; QSpinBox* mWriteBackFutureWeeks; }; int globalFlagBlockStartup; MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : QMainWindow( parent, name ) { #ifdef DESKTOP_VERSION setFont( QFont("Arial"), 14 ); #endif - mServerSocket = 0; mClosed = false; //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; QString confFile = locateLocal("config","korganizerrc"); QFileInfo finf ( confFile ); bool showWarning = !finf.exists(); setIcon(SmallIcon( "ko24" ) ); mBlockAtStartup = true; mFlagKeyPressed = false; setCaption("KOrganizer/Pi"); KOPrefs *p = KOPrefs::instance(); KPimGlobalPrefs::instance()->setGlobalConfig(); if ( p->mHourSize > 18 ) p->mHourSize = 18; QMainWindow::ToolBarDock tbd; if ( p->mToolBarHor ) { if ( p->mToolBarUp ) @@ -266,36 +265,34 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : if ( showWarning ) { KMessageBox::information( this, "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); qApp->processEvents(); mView->dialogManager()->showSyncOptions(); } //US listen for result adressed from Ka/Pi #ifndef DESKTOP_VERSION connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); #endif } MainWindow::~MainWindow() { //qDebug("MainWindow::~MainWindow() "); //save toolbar location - delete mServerSocket; delete mCalendar; - delete KOPrefs::instance(); - delete KIncidenceFormatter::instance(); + delete mSyncManager; } void MainWindow::showMaximized () { #ifndef DESKTOP_VERSION if ( ! globalFlagBlockStartup ) if ( mClosed ) mView->goToday(); #endif QWidget::showMaximized () ; mClosed = false; } void MainWindow::closeEvent( QCloseEvent* ce ) { @@ -469,33 +466,32 @@ void MainWindow::initActions() } else { QPEMenuBar *menuBar1; menuBar1 = new QPEMenuBar( iconToolBar ); QPopupMenu *menuBar = new QPopupMenu( this ); menuBar1->insertItem( i18n("ME"), menuBar); menuBar->insertItem( i18n("File"), importMenu ); menuBar->insertItem( i18n("View"), viewMenu ); menuBar->insertItem( i18n("Actions"), actionMenu ); menuBar->insertItem( i18n("Synchronize"), syncMenu ); menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); menuBar->insertItem( i18n("Filter"),selectFilterMenu ); menuBar->insertItem( i18n("Help"), helpMenu ); //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); menuBar1->setMaximumSize( menuBar1->sizeHint( )); } - connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); // ****************** QAction *action; QIconSet icon; // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); configureToolBarMenu->setCheckable( true ); QString pathString = ""; if ( !p->mToolBarMiniIcons ) { if ( QApplication::desktop()->width() < 480 ) pathString += "icons16/"; } else pathString += "iconsmini/"; configureAgendaMenu->setCheckable( true ); diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index ee7bd87..e3383ed 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -79,34 +79,32 @@ class MainWindow : public QMainWindow protected: void displayText( QString, QString); void displayFile( QString, QString); void enableIncidenceActions( bool ); private slots: QSocket* piSocket; QString piFileString; QTime piTime; void getFile( bool ); void syncFileRequest(); private: KSyncManager* mSyncManager; - //QTimer* mTimerCommandSocket; - KServerSocket * mServerSocket; bool mClosed; void saveOnClose(); bool mFlagKeyPressed; bool mBlockAtStartup; QPEToolBar *iconToolBar; void initActions(); void setDefaultPreferences(); void keyPressEvent ( QKeyEvent * ) ; void keyReleaseEvent ( QKeyEvent * ) ; QPopupMenu *configureToolBarMenu; QPopupMenu *selectFilterMenu; QPopupMenu *configureAgendaMenu, *syncMenu; CalendarLocal *mCalendar; CalendarView *mView; QAction *mNewSubTodoAction; diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index b71e18d..5081b26 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp @@ -49,35 +49,32 @@ KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) 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,i18n ("+01:00 Europe/Oslo(CET)") ); addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 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, "" ); addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); addItemString( "FaxChannel", &mFaxOtherChannel, "" ); @@ -86,55 +83,56 @@ KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) 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, NONE_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() { 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 ); } KPimGlobalPrefs::~KPimGlobalPrefs() { + //qDebug("KPimGlobalPrefs::~KPimGlobalPrefs() "); + writeConfig(); } KPimGlobalPrefs *KPimGlobalPrefs::instance() { if ( !sInstance ) { sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); sInstance->readConfig(); } return sInstance; } diff --git a/microkde/kstaticdeleter.h b/microkde/kstaticdeleter.h index 190f3e4..dfd3929 100644 --- a/microkde/kstaticdeleter.h +++ b/microkde/kstaticdeleter.h @@ -15,21 +15,23 @@ * * 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) { return obj; } - virtual ~KStaticDeleter() {}; + type *setObject( type *obj, bool isArray = false) { _mobj = obj;return obj; } + virtual ~KStaticDeleter() {delete _mobj;}; + private: + type* _mobj; }; #endif |