summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditordialog.cpp1
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp6
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp10
-rw-r--r--microkde/kdecore/klocale.cpp39
-rw-r--r--microkde/kdecore/klocale.h14
6 files changed, 33 insertions, 39 deletions
diff --git a/kaddressbook/addresseeeditordialog.cpp b/kaddressbook/addresseeeditordialog.cpp
index d8c1aca..5e42640 100644
--- a/kaddressbook/addresseeeditordialog.cpp
+++ b/kaddressbook/addresseeeditordialog.cpp
@@ -1,122 +1,121 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qapplication.h> 25#include <qapplication.h>
26 26
27#include <kdebug.h> 27#include <kdebug.h>
28#include <klocale.h> 28#include <klocale.h>
29#include <kglobal.h> 29#include <kglobal.h>
30 30
31#include "addresseeeditorwidget.h" 31#include "addresseeeditorwidget.h"
32#include "kabcore.h" 32#include "kabcore.h"
33 33
34#include "addresseeeditordialog.h" 34#include "addresseeeditordialog.h"
35 35
36AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, 36AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent,
37 const char *name ) 37 const char *name )
38 : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ), 38 : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ),
39 KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply, 39 KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply,
40 KDialogBase::Ok, parent, name, true ) 40 KDialogBase::Ok, parent, name, true )
41{ 41{
42 42
43 43
44 QWidget *page = plainPage(); 44 QWidget *page = plainPage();
45 45
46 QVBoxLayout *layout = new QVBoxLayout( page ); 46 QVBoxLayout *layout = new QVBoxLayout( page );
47 47
48 mEditorWidget = new AddresseeEditorWidget( core, false, page ); 48 mEditorWidget = new AddresseeEditorWidget( core, false, page );
49 connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ), 49 connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ),
50 SLOT( widgetModified() ) ); 50 SLOT( widgetModified() ) );
51 layout->addWidget( mEditorWidget ); 51 layout->addWidget( mEditorWidget );
52 52
53 enableButton( KDialogBase::Apply, false ); 53 enableButton( KDialogBase::Apply, false );
54 if ( QApplication::desktop()->width() < 480 ) { 54 if ( QApplication::desktop()->width() < 480 ) {
55 hideButtons(); 55 hideButtons();
56 } 56 }
57} 57}
58 58
59AddresseeEditorDialog::~AddresseeEditorDialog() 59AddresseeEditorDialog::~AddresseeEditorDialog()
60{ 60{
61 qDebug("AddresseeEditorDialog::~AddresseeEditorDialog()");
62 //emit editorDestroyed( mEditorWidget->addressee().uid() ); 61 //emit editorDestroyed( mEditorWidget->addressee().uid() );
63} 62}
64 63
65void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr ) 64void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr )
66{ 65{
67 enableButton( KDialogBase::Apply, false ); 66 enableButton( KDialogBase::Apply, false );
68 67
69 mEditorWidget->setAddressee( addr ); 68 mEditorWidget->setAddressee( addr );
70} 69}
71 70
72KABC::Addressee AddresseeEditorDialog::addressee() 71KABC::Addressee AddresseeEditorDialog::addressee()
73{ 72{
74 return mEditorWidget->addressee(); 73 return mEditorWidget->addressee();
75} 74}
76 75
77bool AddresseeEditorDialog::dirty() 76bool AddresseeEditorDialog::dirty()
78{ 77{
79 return mEditorWidget->dirty(); 78 return mEditorWidget->dirty();
80} 79}
81 80
82void AddresseeEditorDialog::slotApply() 81void AddresseeEditorDialog::slotApply()
83{ 82{
84 if ( mEditorWidget->dirty() ) { 83 if ( mEditorWidget->dirty() ) {
85 mEditorWidget->save(); 84 mEditorWidget->save();
86 emit contactModified( mEditorWidget->addressee() ); 85 emit contactModified( mEditorWidget->addressee() );
87 } 86 }
88 87
89 enableButton( KDialogBase::Apply, false ); 88 enableButton( KDialogBase::Apply, false );
90 89
91 KDialogBase::slotApply(); 90 KDialogBase::slotApply();
92} 91}
93 92
94void AddresseeEditorDialog:: accept () 93void AddresseeEditorDialog:: accept ()
95{ 94{
96 slotOk(); 95 slotOk();
97 96
98} 97}
99void AddresseeEditorDialog::slotOk() 98void AddresseeEditorDialog::slotOk()
100{ 99{
101 slotApply(); 100 slotApply();
102 101
103 //KDialogBase::slotOk(); 102 //KDialogBase::slotOk();
104 emit okClicked(); 103 emit okClicked();
105 QDialog::accept(); 104 QDialog::accept();
106} 105}
107 106
108void AddresseeEditorDialog::widgetModified() 107void AddresseeEditorDialog::widgetModified()
109{ 108{
110 enableButton( KDialogBase::Apply, true ); 109 enableButton( KDialogBase::Apply, true );
111} 110}
112 111
113void AddresseeEditorDialog::slotCancel() 112void AddresseeEditorDialog::slotCancel()
114{ 113{
115 KDialogBase::slotCancel(); 114 KDialogBase::slotCancel();
116 115
117 116
118} 117}
119 118
120#ifndef KAB_EMBEDDED 119#ifndef KAB_EMBEDDED
121#include "addresseeeditordialog.moc" 120#include "addresseeeditordialog.moc"
122#endif //KAB_EMBEDDED 121#endif //KAB_EMBEDDED
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 4365ee5..3cfc1f2 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -1004,133 +1004,129 @@ void AddresseeEditorWidget::load()
1004 mImageWidget->setPhoto( mAddressee.photo() ); 1004 mImageWidget->setPhoto( mAddressee.photo() );
1005 mImageWidget->setLogo( mAddressee.logo() ); 1005 mImageWidget->setLogo( mAddressee.logo() );
1006 mKeyWidget->setKeys( mAddressee.keys() ); 1006 mKeyWidget->setKeys( mAddressee.keys() );
1007 mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); 1007 mSecrecyWidget->setSecrecy( mAddressee.secrecy() );
1008#ifndef KAB_EMBEDDED 1008#ifndef KAB_EMBEDDED
1009 mSoundWidget->setSound( mAddressee.sound() ); 1009 mSoundWidget->setSound( mAddressee.sound() );
1010#else //KAB_EMBEDDED 1010#else //KAB_EMBEDDED
1011//US qDebug("AddresseeEditorWidget::load has to be changed 2"); 1011//US qDebug("AddresseeEditorWidget::load has to be changed 2");
1012#endif //KAB_EMBEDDED 1012#endif //KAB_EMBEDDED
1013 1013
1014 // Load customs 1014 // Load customs
1015 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); 1015 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) );
1016 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); 1016 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) );
1017 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); 1017 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) );
1018 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); 1018 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) );
1019 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); 1019 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) );
1020 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); 1020 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) );
1021 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); 1021 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) );
1022 1022
1023 blockSignals( block ); 1023 blockSignals( block );
1024 mBlockSignals = false; 1024 mBlockSignals = false;
1025 1025
1026 mDirty = false; 1026 mDirty = false;
1027} 1027}
1028 1028
1029void AddresseeEditorWidget::save() 1029void AddresseeEditorWidget::save()
1030{ 1030{
1031 if ( !mDirty ) return; 1031 if ( !mDirty ) return;
1032 1032
1033 mAddressee.setRole( mRoleEdit->text() ); 1033 mAddressee.setRole( mRoleEdit->text() );
1034 mAddressee.setOrganization( mOrgEdit->text() ); 1034 mAddressee.setOrganization( mOrgEdit->text() );
1035 mAddressee.setUrl( KURL( mURLEdit->text() ) ); 1035 mAddressee.setUrl( KURL( mURLEdit->text() ) );
1036 mAddressee.setNote( mNoteEdit->text() ); 1036 mAddressee.setNote( mNoteEdit->text() );
1037 if ( mBirthdayPicker->inputIsValid() ) 1037 if ( mBirthdayPicker->inputIsValid() )
1038 mAddressee.setBirthday( QDateTime( mBirthdayPicker->date() ) ); 1038 mAddressee.setBirthday( QDateTime( mBirthdayPicker->date() ) );
1039 else 1039 else
1040 mAddressee.setBirthday( QDateTime() ); 1040 mAddressee.setBirthday( QDateTime() );
1041 1041
1042 mAddressee.setNickName( mNicknameEdit->text() ); 1042 mAddressee.setNickName( mNicknameEdit->text() );
1043 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); 1043 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
1044 1044
1045 mAddressee.setGeo( mGeoWidget->geo() ); 1045 mAddressee.setGeo( mGeoWidget->geo() );
1046 mAddressee.setPhoto( mImageWidget->photo() ); 1046 mAddressee.setPhoto( mImageWidget->photo() );
1047 mAddressee.setLogo( mImageWidget->logo() ); 1047 mAddressee.setLogo( mImageWidget->logo() );
1048 mAddressee.setKeys( mKeyWidget->keys() ); 1048 mAddressee.setKeys( mKeyWidget->keys() );
1049#ifndef KAB_EMBEDDED 1049#ifndef KAB_EMBEDDED
1050 mAddressee.setSound( mSoundWidget->sound() ); 1050 mAddressee.setSound( mSoundWidget->sound() );
1051#else //KAB_EMBEDDED 1051#else //KAB_EMBEDDED
1052//US qDebug("AddresseeEditorWidget::save sound not supported"); 1052//US qDebug("AddresseeEditorWidget::save sound not supported");
1053#endif //KAB_EMBEDDED 1053#endif //KAB_EMBEDDED
1054 mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); 1054 mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
1055 1055
1056 // save custom fields 1056 // save custom fields
1057 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); 1057 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
1058 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); 1058 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
1059 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); 1059 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
1060 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); 1060 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
1061 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); 1061 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
1062 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); 1062 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
1063 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); 1063 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
1064 if ( mAnniversaryPicker->inputIsValid() ) { 1064 if ( mAnniversaryPicker->inputIsValid() ) {
1065 1065
1066//US mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", 1066//US mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary",
1067//US mAnniversaryPicker->date().toString( Qt::ISODate ) ); 1067//US mAnniversaryPicker->date().toString( Qt::ISODate ) );
1068 int orgformat = KGlobal::locale()->getIntDateFormat(); 1068 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
1069 QDate da = mAnniversaryPicker->date();
1070 KGlobal::locale()->setIntDateFormat( 2 ); // = Qt::ISODate
1071 QString dt = KGlobal::locale()->formatDate(da, true);
1072 KGlobal::locale()->setIntDateFormat(orgformat );
1073 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 1069 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
1074 } 1070 }
1075 else 1071 else
1076 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); 1072 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
1077 1073
1078 // Save the email addresses 1074 // Save the email addresses
1079 QStringList emails = mAddressee.emails(); 1075 QStringList emails = mAddressee.emails();
1080 QStringList::Iterator iter; 1076 QStringList::Iterator iter;
1081 for ( iter = emails.begin(); iter != emails.end(); ++iter ) 1077 for ( iter = emails.begin(); iter != emails.end(); ++iter )
1082 mAddressee.removeEmail( *iter ); 1078 mAddressee.removeEmail( *iter );
1083 1079
1084 emails = mEmailWidget->emails(); 1080 emails = mEmailWidget->emails();
1085 bool first = true; 1081 bool first = true;
1086 for ( iter = emails.begin(); iter != emails.end(); ++iter ) { 1082 for ( iter = emails.begin(); iter != emails.end(); ++iter ) {
1087 mAddressee.insertEmail( *iter, first ); 1083 mAddressee.insertEmail( *iter, first );
1088 first = false; 1084 first = false;
1089 } 1085 }
1090 1086
1091 // Save the phone numbers 1087 // Save the phone numbers
1092 KABC::PhoneNumber::List phoneNumbers; 1088 KABC::PhoneNumber::List phoneNumbers;
1093 KABC::PhoneNumber::List::Iterator phoneIter; 1089 KABC::PhoneNumber::List::Iterator phoneIter;
1094 phoneNumbers = mAddressee.phoneNumbers(); 1090 phoneNumbers = mAddressee.phoneNumbers();
1095 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1091 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1096 ++phoneIter ) 1092 ++phoneIter )
1097 mAddressee.removePhoneNumber( *phoneIter ); 1093 mAddressee.removePhoneNumber( *phoneIter );
1098 1094
1099 phoneNumbers = mPhoneEditWidget->phoneNumbers(); 1095 phoneNumbers = mPhoneEditWidget->phoneNumbers();
1100 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1096 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1101 ++phoneIter ) 1097 ++phoneIter )
1102 mAddressee.insertPhoneNumber( *phoneIter ); 1098 mAddressee.insertPhoneNumber( *phoneIter );
1103 1099
1104 // Save the addresses 1100 // Save the addresses
1105 KABC::Address::List addresses; 1101 KABC::Address::List addresses;
1106 KABC::Address::List::Iterator addressIter; 1102 KABC::Address::List::Iterator addressIter;
1107 addresses = mAddressee.addresses(); 1103 addresses = mAddressee.addresses();
1108 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1104 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1109 ++addressIter ) 1105 ++addressIter )
1110 mAddressee.removeAddress( *addressIter ); 1106 mAddressee.removeAddress( *addressIter );
1111 1107
1112 addresses = mAddressEditWidget->addresses(); 1108 addresses = mAddressEditWidget->addresses();
1113 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1109 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1114 ++addressIter ) 1110 ++addressIter )
1115 mAddressee.insertAddress( *addressIter ); 1111 mAddressee.insertAddress( *addressIter );
1116 mDirty = false; 1112 mDirty = false;
1117} 1113}
1118 1114
1119bool AddresseeEditorWidget::dirty() 1115bool AddresseeEditorWidget::dirty()
1120{ 1116{
1121 return mDirty; 1117 return mDirty;
1122} 1118}
1123 1119
1124void AddresseeEditorWidget::nameTextChanged( const QString &text ) 1120void AddresseeEditorWidget::nameTextChanged( const QString &text )
1125{ 1121{
1126 // use the addressee class to parse the name for us 1122 // use the addressee class to parse the name for us
1127 mAConfig->setUid( mAddressee.uid() ); 1123 mAConfig->setUid( mAddressee.uid() );
1128 if ( mAConfig->automaticNameParsing() ) { 1124 if ( mAConfig->automaticNameParsing() ) {
1129 if ( !mAddressee.formattedName().isEmpty() ) { 1125 if ( !mAddressee.formattedName().isEmpty() ) {
1130 QString fn = mAddressee.formattedName(); 1126 QString fn = mAddressee.formattedName();
1131 mAddressee.setNameFromString( text ); 1127 mAddressee.setNameFromString( text );
1132 mAddressee.setFormattedName( fn ); 1128 mAddressee.setFormattedName( fn );
1133 } else { 1129 } else {
1134 // use extra addressee to avoid a formatted name assignment 1130 // use extra addressee to avoid a formatted name assignment
1135 Addressee addr; 1131 Addressee addr;
1136 addr.setNameFromString( text ); 1132 addr.setNameFromString( text );
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index c3c3d47..58b3d70 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1715,129 +1715,129 @@ void CalendarView::readFilterSettings(KConfig *config)
1715 mFilters.append(filter); 1715 mFilters.append(filter);
1716 } 1716 }
1717 mFilterView->updateFilters(); 1717 mFilterView->updateFilters();
1718 config->setGroup("FilterView"); 1718 config->setGroup("FilterView");
1719 1719
1720 mFilterView->blockSignals(true); 1720 mFilterView->blockSignals(true);
1721 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 1721 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
1722 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 1722 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
1723 mFilterView->blockSignals(false); 1723 mFilterView->blockSignals(false);
1724 // We do it manually to avoid it being done twice by the above calls 1724 // We do it manually to avoid it being done twice by the above calls
1725 updateFilter(); 1725 updateFilter();
1726} 1726}
1727 1727
1728void CalendarView::writeFilterSettings(KConfig *config) 1728void CalendarView::writeFilterSettings(KConfig *config)
1729{ 1729{
1730 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 1730 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
1731 1731
1732 QStringList filterList; 1732 QStringList filterList;
1733 1733
1734 CalFilter *filter = mFilters.first(); 1734 CalFilter *filter = mFilters.first();
1735 while(filter) { 1735 while(filter) {
1736 // kdDebug() << " fn: " << filter->name() << endl; 1736 // kdDebug() << " fn: " << filter->name() << endl;
1737 filterList << filter->name(); 1737 filterList << filter->name();
1738 config->setGroup("Filter_" + filter->name()); 1738 config->setGroup("Filter_" + filter->name());
1739 config->writeEntry("Criteria",filter->criteria()); 1739 config->writeEntry("Criteria",filter->criteria());
1740 config->writeEntry("CategoryList",filter->categoryList()); 1740 config->writeEntry("CategoryList",filter->categoryList());
1741 filter = mFilters.next(); 1741 filter = mFilters.next();
1742 } 1742 }
1743 config->setGroup("General"); 1743 config->setGroup("General");
1744 config->writeEntry("CalendarFilters",filterList); 1744 config->writeEntry("CalendarFilters",filterList);
1745 1745
1746 config->setGroup("FilterView"); 1746 config->setGroup("FilterView");
1747 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 1747 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
1748 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 1748 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
1749} 1749}
1750 1750
1751 1751
1752void CalendarView::goToday() 1752void CalendarView::goToday()
1753{ 1753{
1754 mNavigator->selectToday(); 1754 mNavigator->selectToday();
1755} 1755}
1756 1756
1757void CalendarView::goNext() 1757void CalendarView::goNext()
1758{ 1758{
1759 mNavigator->selectNext(); 1759 mNavigator->selectNext();
1760} 1760}
1761 1761
1762void CalendarView::goPrevious() 1762void CalendarView::goPrevious()
1763{ 1763{
1764 mNavigator->selectPrevious(); 1764 mNavigator->selectPrevious();
1765} 1765}
1766void CalendarView::goNextMonth() 1766void CalendarView::goNextMonth()
1767{ 1767{
1768 mNavigator->selectNextMonth(); 1768 mNavigator->selectNextMonth();
1769} 1769}
1770 1770
1771void CalendarView::goPreviousMonth() 1771void CalendarView::goPreviousMonth()
1772{ 1772{
1773 mNavigator->selectPreviousMonth(); 1773 mNavigator->selectPreviousMonth();
1774} 1774}
1775void CalendarView::writeLocale() 1775void CalendarView::writeLocale()
1776{ 1776{
1777 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 1777 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
1778 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 1778 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
1779 KGlobal::locale()->setIntDateFormat( KOPrefs::instance()->mPreferredDate ); 1779 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
1780 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 1780 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
1781 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1781 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1782 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 1782 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
1783 dummy = KOPrefs::instance()->mUserDateFormatShort; 1783 dummy = KOPrefs::instance()->mUserDateFormatShort;
1784 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 1784 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
1785 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 1785 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
1786 KOPrefs::instance()->mDaylightsavingStart, 1786 KOPrefs::instance()->mDaylightsavingStart,
1787 KOPrefs::instance()->mDaylightsavingEnd ); 1787 KOPrefs::instance()->mDaylightsavingEnd );
1788 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); 1788 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId );
1789} 1789}
1790void CalendarView::updateConfig() 1790void CalendarView::updateConfig()
1791{ 1791{
1792 writeLocale(); 1792 writeLocale();
1793 if ( KOPrefs::instance()->mUseAppColors ) 1793 if ( KOPrefs::instance()->mUseAppColors )
1794 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 1794 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
1795 emit configChanged(); 1795 emit configChanged();
1796 mTodoList->updateConfig(); 1796 mTodoList->updateConfig();
1797 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 1797 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
1798 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1798 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1799 // To make the "fill window" configurations work 1799 // To make the "fill window" configurations work
1800 //mViewManager->raiseCurrentView(); 1800 //mViewManager->raiseCurrentView();
1801} 1801}
1802 1802
1803 1803
1804void CalendarView::eventChanged(Event *event) 1804void CalendarView::eventChanged(Event *event)
1805{ 1805{
1806 changeEventDisplay(event,KOGlobals::EVENTEDITED); 1806 changeEventDisplay(event,KOGlobals::EVENTEDITED);
1807 //updateUnmanagedViews(); 1807 //updateUnmanagedViews();
1808} 1808}
1809 1809
1810void CalendarView::eventAdded(Event *event) 1810void CalendarView::eventAdded(Event *event)
1811{ 1811{
1812 changeEventDisplay(event,KOGlobals::EVENTADDED); 1812 changeEventDisplay(event,KOGlobals::EVENTADDED);
1813} 1813}
1814 1814
1815void CalendarView::eventToBeDeleted(Event *) 1815void CalendarView::eventToBeDeleted(Event *)
1816{ 1816{
1817 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 1817 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
1818} 1818}
1819 1819
1820void CalendarView::eventDeleted() 1820void CalendarView::eventDeleted()
1821{ 1821{
1822 changeEventDisplay(0,KOGlobals::EVENTDELETED); 1822 changeEventDisplay(0,KOGlobals::EVENTDELETED);
1823} 1823}
1824void CalendarView::changeTodoDisplay(Todo *which, int action) 1824void CalendarView::changeTodoDisplay(Todo *which, int action)
1825{ 1825{
1826 changeIncidenceDisplay((Incidence *)which, action); 1826 changeIncidenceDisplay((Incidence *)which, action);
1827} 1827}
1828void CalendarView::checkZaurusId( int id, bool todo ) 1828void CalendarView::checkZaurusId( int id, bool todo )
1829{ 1829{
1830 if ( id >= 0 ) { 1830 if ( id >= 0 ) {
1831 Incidence* lse = mCalendar->event( "last-syncEvent-device-Sharp-DTM"); 1831 Incidence* lse = mCalendar->event( "last-syncEvent-device-Sharp-DTM");
1832 if ( lse ) { 1832 if ( lse ) {
1833 QString des = lse->description(); 1833 QString des = lse->description();
1834 QString pref = "e"; 1834 QString pref = "e";
1835 if ( todo ) 1835 if ( todo )
1836 pref = "t"; 1836 pref = "t";
1837 des += pref+ QString::number ( id ) + ","; 1837 des += pref+ QString::number ( id ) + ",";
1838 lse->setReadOnly( false ); 1838 lse->setReadOnly( false );
1839 lse->setDescription( des ); 1839 lse->setDescription( des );
1840 lse->setReadOnly( true ); 1840 lse->setReadOnly( true );
1841 } 1841 }
1842 } 1842 }
1843} 1843}
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 0547a2e..b2001ec 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -389,251 +389,245 @@ void KOWhatsNextView::changeEventDisplay(Event *, int action)
389 default: 389 default:
390 updateView(); 390 updateView();
391 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; 391 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl;
392 } 392 }
393} 393}
394 394
395void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) 395void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
396{ 396{
397 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(21) == QString("last-syncEvent-device") ) 397 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(21) == QString("last-syncEvent-device") )
398 return; 398 return;
399 QDateTime cdt = QDateTime::currentDateTime(); 399 QDateTime cdt = QDateTime::currentDateTime();
400 mText += "<tr><td><b>"; 400 mText += "<tr><td><b>";
401 if (ev->type()=="Event") { 401 if (ev->type()=="Event") {
402 402
403 if (!ev->doesFloat()) { 403 if (!ev->doesFloat()) {
404 Event *event = static_cast<Event *>(ev); 404 Event *event = static_cast<Event *>(ev);
405 QDateTime st,end; 405 QDateTime st,end;
406 if ( event->recurrence()->doesRecur() ) { 406 if ( event->recurrence()->doesRecur() ) {
407 QDate recDate= mEventDate; 407 QDate recDate= mEventDate;
408 int days = event->dtStart().date().daysTo (event->dtEnd().date() ); 408 int days = event->dtStart().date().daysTo (event->dtEnd().date() );
409 while ( ! event->recursOn( recDate ) ) { 409 while ( ! event->recursOn( recDate ) ) {
410 recDate = recDate.addDays( -1 ); 410 recDate = recDate.addDays( -1 );
411 411
412 } 412 }
413 st = QDateTime ( recDate, event->dtStart().time() ); 413 st = QDateTime ( recDate, event->dtStart().time() );
414 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); 414 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() );
415 } 415 }
416 else { 416 else {
417 st = event->dtStart(); 417 st = event->dtStart();
418 end = event->dtEnd(); 418 end = event->dtEnd();
419 } 419 }
420 420
421 if (reply) mText += "on " + event->dtStartDateStr() + ": "; 421 if (reply) mText += "on " + event->dtStartDateStr() + ": ";
422 QString dateText; 422 QString dateText;
423 // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); 423 // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() );
424 if ( st.date() < mEventDate ) 424 if ( st.date() < mEventDate )
425 dateText = "++:++-"; 425 dateText = "++:++-";
426 else 426 else
427 dateText = event->dtStartTimeStr() + "-"; 427 dateText = event->dtStartTimeStr() + "-";
428 if ( end.date() > mEventDate ) 428 if ( end.date() > mEventDate )
429 dateText += "++:++"; 429 dateText += "++:++";
430 else 430 else
431 dateText += event->dtEndTimeStr(); 431 dateText += event->dtEndTimeStr();
432 if ( notRed ) 432 if ( notRed )
433 mText += dateText; 433 mText += dateText;
434 else { 434 else {
435 if ( end < cdt ) 435 if ( end < cdt )
436 mText += "<font color=\"#F00000\">" + dateText + "</font>"; 436 mText += "<font color=\"#F00000\">" + dateText + "</font>";
437 else if ( st < cdt ) 437 else if ( st < cdt )
438 mText += "<font color=\"#008000\">" + dateText + "</font>"; 438 mText += "<font color=\"#008000\">" + dateText + "</font>";
439 else 439 else
440 mText += dateText; 440 mText += dateText;
441 } 441 }
442 442
443 } else { 443 } else {
444 mText += i18n("Allday:"); 444 mText += i18n("Allday:");
445 445
446 } 446 }
447 } else { 447 } else {
448 mTodos.append( ev ); 448 mTodos.append( ev );
449 mText += i18n("ToDo:"); 449 mText += i18n("ToDo:");
450 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { 450 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) {
451 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 451 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
452 QString dfs = KGlobal::locale()->dateFormatShort(); 452 QString dfs = KGlobal::locale()->dateFormatShort();
453 KGlobal::locale()->setIntDateFormat( 3 );
454 KGlobal::locale()->setDateFormatShort("%d.%b"); 453 KGlobal::locale()->setDateFormatShort("%d.%b");
455 mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true) + "</font>"; 454 mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>";
456
457 KGlobal::locale()->setDateFormatShort(dfs); 455 KGlobal::locale()->setDateFormatShort(dfs);
458 KGlobal::locale()->setIntDateFormat( KOPrefs::instance()->mPreferredDate );
459 } else { 456 } else {
460 if (!ev->doesFloat() ) 457 if (!ev->doesFloat() )
461 if( ( (Todo*)ev)->dtDue() < cdt ) { 458 if( ( (Todo*)ev)->dtDue() < cdt ) {
462 mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; 459 mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>";
463 460
464 461
465 } else 462 } else
466 mText +=((Todo*)ev)->dtDueTimeStr(); 463 mText +=((Todo*)ev)->dtDueTimeStr();
467 mTodos.append( ev ); 464 mTodos.append( ev );
468 } 465 }
469 } 466 }
470 mText += "</b></td><td>"; 467 mText += "</b></td><td>";
471 bool needClose = false; 468 bool needClose = false;
472 if ( ev->cancelled() ) { 469 if ( ev->cancelled() ) {
473 mText += "<font color=\"#F00000\">[c"; 470 mText += "<font color=\"#F00000\">[c";
474 needClose =true; 471 needClose =true;
475 472
476 } 473 }
477 if ( ev->isAlarmEnabled() ) { 474 if ( ev->isAlarmEnabled() ) {
478 if ( !needClose) 475 if ( !needClose)
479 mText +="["; 476 mText +="[";
480 mText += "a"; 477 mText += "a";
481 needClose =true; 478 needClose =true;
482 479
483 } 480 }
484 if ( ev->description().length() > 0 ) { 481 if ( ev->description().length() > 0 ) {
485 if ( !needClose) 482 if ( !needClose)
486 mText +="["; 483 mText +="[";
487 mText += "i"; 484 mText += "i";
488 needClose =true; 485 needClose =true;
489 } 486 }
490 if ( ev->recurrence()->doesRecur() ) { 487 if ( ev->recurrence()->doesRecur() ) {
491 if ( !needClose) 488 if ( !needClose)
492 mText +="["; 489 mText +="[";
493 mText += "r"; 490 mText += "r";
494 needClose =true; 491 needClose =true;
495 } 492 }
496 if ( needClose ) { 493 if ( needClose ) {
497 mText += "] "; 494 mText += "] ";
498 } 495 }
499 if ( ev->cancelled() ) 496 if ( ev->cancelled() )
500 mText += "</font>"; 497 mText += "</font>";
501 mText += "<a "; 498 mText += "<a ";
502 if (ev->type()=="Event") mText += "href=\"event:"; 499 if (ev->type()=="Event") mText += "href=\"event:";
503 if (ev->type()=="Todo") mText += "href=\"todo:"; 500 if (ev->type()=="Todo") mText += "href=\"todo:";
504 mText += ev->uid() + "\">"; 501 mText += ev->uid() + "\">";
505 if ( ev->summary().length() > 0 ) 502 if ( ev->summary().length() > 0 )
506 mText += ev->summary(); 503 mText += ev->summary();
507 else 504 else
508 mText += i18n("-no summary-"); 505 mText += i18n("-no summary-");
509 mText += "</a>"; 506 mText += "</a>";
510 if ( KOPrefs::instance()->mWNViewShowLocation ) 507 if ( KOPrefs::instance()->mWNViewShowLocation )
511 if ( !ev->location().isEmpty() ) 508 if ( !ev->location().isEmpty() )
512 mText += " ("+ev->location() +")"; 509 mText += " ("+ev->location() +")";
513 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) 510 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
514 mText += " ["+ev->relatedTo()->summary() +"]"; 511 mText += " ["+ev->relatedTo()->summary() +"]";
515 mText += "</td></tr>\n"; 512 mText += "</td></tr>\n";
516} 513}
517 514
518bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) 515bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
519{ 516{
520 if ( mTodos.find( ev ) != mTodos.end() ) return false; 517 if ( mTodos.find( ev ) != mTodos.end() ) return false;
521 518
522 mTodos.append( ev ); 519 mTodos.append( ev );
523 if ( !isSub ) 520 if ( !isSub )
524 mText += "<p>"; 521 mText += "<p>";
525 else 522 else
526 mText += "<li>"; 523 mText += "<li>";
527 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; 524 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] ";
528 525
529 526
530 mText += ind; 527 mText += ind;
531 bool needClose = false; 528 bool needClose = false;
532 if ( ev->cancelled() ) { 529 if ( ev->cancelled() ) {
533 mText += "<font color=\"#F00000\">[c"; 530 mText += "<font color=\"#F00000\">[c";
534 needClose =true; 531 needClose =true;
535 532
536 } 533 }
537 if ( ev->isAlarmEnabled() ) { 534 if ( ev->isAlarmEnabled() ) {
538 if ( !needClose) 535 if ( !needClose)
539 mText +="["; 536 mText +="[";
540 mText += "a"; 537 mText += "a";
541 needClose =true; 538 needClose =true;
542 539
543 } 540 }
544 541
545 if ( ev->description().length() > 0 ) { 542 if ( ev->description().length() > 0 ) {
546 if ( !needClose) 543 if ( !needClose)
547 mText +="["; 544 mText +="[";
548 mText += "i"; 545 mText += "i";
549 needClose =true; 546 needClose =true;
550 } 547 }
551 // if ( ev->recurrence()->doesRecur() ) { 548 // if ( ev->recurrence()->doesRecur() ) {
552 // if ( !needClose) 549 // if ( !needClose)
553 // mText +="("; 550 // mText +="(";
554 // mText += "r"; 551 // mText += "r";
555 // needClose =true; 552 // needClose =true;
556 // } 553 // }
557 if ( needClose ) 554 if ( needClose )
558 mText += "] "; 555 mText += "] ";
559 if ( ev->cancelled() ) 556 if ( ev->cancelled() )
560 mText += "</font>"; 557 mText += "</font>";
561 mText += "<a href=\"todo:" + ev->uid() + "\">"; 558 mText += "<a href=\"todo:" + ev->uid() + "\">";
562 mText += ev->summary(); 559 mText += ev->summary();
563 mText += "</a>"; 560 mText += "</a>";
564 if ( ((Todo*)ev)->hasDueDate () ) { 561 if ( ((Todo*)ev)->hasDueDate () ) {
565 QString year = ""; 562 QString year = "";
566 int ye = ((Todo*)ev)->dtDue().date().year(); 563 int ye = ((Todo*)ev)->dtDue().date().year();
567 if ( QDateTime::currentDateTime().date().year() != ye ) 564 if ( QDateTime::currentDateTime().date().year() != ye )
568 year = QString::number( ye ); 565 year = QString::number( ye );
569 QString dfs = KGlobal::locale()->dateFormatShort(); 566 QString dfs = KGlobal::locale()->dateFormatShort();
570 KGlobal::locale()->setIntDateFormat( 3 );
571 KGlobal::locale()->setDateFormatShort("%d.%b"); 567 KGlobal::locale()->setDateFormatShort("%d.%b");
572 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true) + "."+ year +"]</font>"; 568 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>";
573
574 KGlobal::locale()->setDateFormatShort(dfs); 569 KGlobal::locale()->setDateFormatShort(dfs);
575 KGlobal::locale()->setIntDateFormat( KOPrefs::instance()->mPreferredDate );
576 } 570 }
577 if ( KOPrefs::instance()->mWNViewShowLocation ) 571 if ( KOPrefs::instance()->mWNViewShowLocation )
578 if ( !ev->location().isEmpty() ) 572 if ( !ev->location().isEmpty() )
579 mText += " ("+ev->location() +")"; 573 mText += " ("+ev->location() +")";
580 if ( !isSub ) { 574 if ( !isSub ) {
581 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) 575 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents)
582 mText += " ["+ev->relatedTo()->summary() +"]"; 576 mText += " ["+ev->relatedTo()->summary() +"]";
583 mText += "</p>\n"; 577 mText += "</p>\n";
584 } 578 }
585 else { 579 else {
586 ind += "-"; 580 ind += "-";
587 mText += "</li>\n"; 581 mText += "</li>\n";
588 } 582 }
589 QPtrList<Incidence> Relations = ev->relations(); 583 QPtrList<Incidence> Relations = ev->relations();
590 Incidence *to; 584 Incidence *to;
591 for (to=Relations.first();to;to=Relations.next()) { 585 for (to=Relations.first();to;to=Relations.next()) {
592 if (!((Todo*)to)->isCompleted()) 586 if (!((Todo*)to)->isCompleted())
593 appendTodo( to, ind , true ); 587 appendTodo( to, ind , true );
594 } 588 }
595 589
596 return true; 590 return true;
597} 591}
598 592
599/* 593/*
600 void KOWhatsNextView::createEventViewer() 594 void KOWhatsNextView::createEventViewer()
601 { 595 {
602 if (!mEventViewer) { 596 if (!mEventViewer) {
603 597
604 mEventViewer = new KOEventViewerDialog(this); 598 mEventViewer = new KOEventViewerDialog(this);
605 } 599 }
606 } 600 }
607*/ 601*/
608void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) 602void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v )
609{ 603{
610 if ( mEventViewer ) 604 if ( mEventViewer )
611 delete mEventViewer; 605 delete mEventViewer;
612 mEventViewer = v; 606 mEventViewer = v;
613} 607}
614 608
615// TODO: Create this function in CalendarView and remove it from here 609// TODO: Create this function in CalendarView and remove it from here
616void KOWhatsNextView::showIncidence(const QString &uid) 610void KOWhatsNextView::showIncidence(const QString &uid)
617{ 611{
618 if ( !mEventViewer ) { 612 if ( !mEventViewer ) {
619 qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); 613 qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set ");
620 return; 614 return;
621 } 615 }
622 //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; 616 //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl;
623 //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); 617 //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1());
624 if (uid.startsWith("event:")) { 618 if (uid.startsWith("event:")) {
625#ifdef DESKTOP_VERSION 619#ifdef DESKTOP_VERSION
626 Event *event = calendar()->event(uid.mid(8)); 620 Event *event = calendar()->event(uid.mid(8));
627#else 621#else
628 Event *event = calendar()->event(uid.mid(6)); 622 Event *event = calendar()->event(uid.mid(6));
629#endif 623#endif
630 //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); 624 //qDebug("event %d uid %s ", event, uid.mid(6).latin1());
631 if (!event) return; 625 if (!event) return;
632 //createEventViewer(); 626 //createEventViewer();
633 mEventViewer->setEvent(event); 627 mEventViewer->setEvent(event);
634 } else if (uid.startsWith("todo:")) { 628 } else if (uid.startsWith("todo:")) {
635#ifdef DESKTOP_VERSION 629#ifdef DESKTOP_VERSION
636 Todo *todo = calendar()->todo(uid.mid(7)); 630 Todo *todo = calendar()->todo(uid.mid(7));
637#else 631#else
638 Todo *todo = calendar()->todo(uid.mid(5)); 632 Todo *todo = calendar()->todo(uid.mid(5));
639#endif 633#endif
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp
index d77e251..9d7e60b 100644
--- a/microkde/kdecore/klocale.cpp
+++ b/microkde/kdecore/klocale.cpp
@@ -25,286 +25,286 @@ QString i18n(const char *text)
25 else { 25 else {
26 if ( (*ret).isEmpty() ) 26 if ( (*ret).isEmpty() )
27 return QString( text ); 27 return QString( text );
28 else 28 else
29 return (*ret); 29 return (*ret);
30 } 30 }
31 } 31 }
32 32
33} 33}
34 34
35QString i18n(const char *,const char *text) 35QString i18n(const char *,const char *text)
36{ 36{
37 return i18n( text ); 37 return i18n( text );
38} 38}
39 39
40QString i18n(const char *text1, const char *textn, int num) 40QString i18n(const char *text1, const char *textn, int num)
41{ 41{
42 if ( num == 1 ) return i18n( text1 ); 42 if ( num == 1 ) return i18n( text1 );
43 else { 43 else {
44 QString text = i18n( textn ); 44 QString text = i18n( textn );
45 int pos = text.find( "%n" ); 45 int pos = text.find( "%n" );
46 if ( pos >= 0 ) text.replace( pos, 2, QString::number( num ) ); 46 if ( pos >= 0 ) text.replace( pos, 2, QString::number( num ) );
47 return text; 47 return text;
48 } 48 }
49} 49}
50 50
51inline void put_it_in( QChar *buffer, uint& index, const QString &s ) 51inline void put_it_in( QChar *buffer, uint& index, const QString &s )
52{ 52{
53 for ( uint l = 0; l < s.length(); l++ ) 53 for ( uint l = 0; l < s.length(); l++ )
54 buffer[index++] = s.at( l ); 54 buffer[index++] = s.at( l );
55} 55}
56 56
57inline void put_it_in( QChar *buffer, uint& index, int number ) 57inline void put_it_in( QChar *buffer, uint& index, int number )
58{ 58{
59 buffer[index++] = number / 10 + '0'; 59 buffer[index++] = number / 10 + '0';
60 buffer[index++] = number % 10 + '0'; 60 buffer[index++] = number % 10 + '0';
61} 61}
62 62
63static int readInt(const QString &str, uint &pos) 63static int readInt(const QString &str, uint &pos)
64{ 64{
65 if (!str.at(pos).isDigit()) return -1; 65 if (!str.at(pos).isDigit()) return -1;
66 int result = 0; 66 int result = 0;
67 for (; str.length() > pos && str.at(pos).isDigit(); pos++) 67 for (; str.length() > pos && str.at(pos).isDigit(); pos++)
68 { 68 {
69 result *= 10; 69 result *= 10;
70 result += str.at(pos).digitValue(); 70 result += str.at(pos).digitValue();
71 } 71 }
72 72
73 return result; 73 return result;
74} 74}
75 75
76KLocale::KLocale() : mCalendarSystem( 0 ) 76KLocale::KLocale() : mCalendarSystem( 0 )
77{ 77{
78 78
79 m_decimalSymbol = "."; 79 m_decimalSymbol = ".";
80 m_positiveSign = ""; 80 m_positiveSign = "";
81 m_negativeSign = "-"; 81 m_negativeSign = "-";
82 m_thousandsSeparator = ","; 82 m_thousandsSeparator = ",";
83 83
84 84
85 85
86 86
87 mWeekStartsMonday = true; 87 mWeekStartsMonday = true;
88 mHourF24Format = true; 88 mHourF24Format = true;
89 mIntDateFormat = 0; 89 mIntDateFormat = Default;
90 mLanguage = 0; 90 mLanguage = 0;
91 mDateFormat = "%a %Y %b %d"; 91 mDateFormat = "%a %Y %b %d";
92 mDateFormatShort = "%Y-%m-%d"; 92 mDateFormatShort = "%Y-%m-%d";
93 mTimeZoneList << i18n ("-11:00 US/Samoa") 93 mTimeZoneList << i18n ("-11:00 US/Samoa")
94 << i18n ("-10:00 US/Hawaii") 94 << i18n ("-10:00 US/Hawaii")
95 << i18n ("-09:00 US/Alaska") 95 << i18n ("-09:00 US/Alaska")
96 << i18n ("-08:00 US/Pacific") 96 << i18n ("-08:00 US/Pacific")
97 << i18n ("-07:00 US/Mountain") 97 << i18n ("-07:00 US/Mountain")
98 << i18n ("-06:00 US/Central") 98 << i18n ("-06:00 US/Central")
99 << i18n ("-05:00 US/Eastern") 99 << i18n ("-05:00 US/Eastern")
100 << i18n ("-04:00 Brazil/West") 100 << i18n ("-04:00 Brazil/West")
101 << i18n ("-03:00 Brazil/East") 101 << i18n ("-03:00 Brazil/East")
102 << i18n ("-02:00 Brazil/DeNoronha") 102 << i18n ("-02:00 Brazil/DeNoronha")
103 << i18n ("-01:00 Atlantic/Azores") 103 << i18n ("-01:00 Atlantic/Azores")
104 << i18n (" 00:00 Europe/London(UTC)") 104 << i18n (" 00:00 Europe/London(UTC)")
105 << i18n ("+01:00 Europe/Oslo(CET)") 105 << i18n ("+01:00 Europe/Oslo(CET)")
106 << i18n ("+02:00 Europe/Helsinki") 106 << i18n ("+02:00 Europe/Helsinki")
107 << i18n ("+03:00 Europe/Moscow") 107 << i18n ("+03:00 Europe/Moscow")
108 << i18n ("+04:00 Indian/Mauritius") 108 << i18n ("+04:00 Indian/Mauritius")
109 << i18n ("+05:00 Indian/Maldives") 109 << i18n ("+05:00 Indian/Maldives")
110 << i18n ("+06:00 Indian/Chagos") 110 << i18n ("+06:00 Indian/Chagos")
111 << i18n ("+07:00 Asia/Bangkok") 111 << i18n ("+07:00 Asia/Bangkok")
112 << i18n ("+08:00 Asia/Hongkong") 112 << i18n ("+08:00 Asia/Hongkong")
113 << i18n ("+09:00 Asia/Tokyo") 113 << i18n ("+09:00 Asia/Tokyo")
114 << i18n ("+10:00 Asia/Vladivostok") 114 << i18n ("+10:00 Asia/Vladivostok")
115 << i18n ("+11:00 Asia/Magadan") 115 << i18n ("+11:00 Asia/Magadan")
116 << i18n ("+12:00 Asia/Kamchatka") 116 << i18n ("+12:00 Asia/Kamchatka")
117 // << i18n (" xx:xx User defined offset") 117 // << i18n (" xx:xx User defined offset")
118 << i18n (" Local Time"); 118 << i18n (" Local Time");
119 mSouthDaylight = false; 119 mSouthDaylight = false;
120 mTimeZoneOffset = 0; 120 mTimeZoneOffset = 0;
121 daylightEnabled = false; 121 daylightEnabled = false;
122} 122}
123 123
124void KLocale::setDateFormat( QString s ) 124void KLocale::setDateFormat( QString s )
125{ 125{
126 mDateFormat = s; 126 mDateFormat = s;
127} 127}
128 128
129void KLocale::setDateFormatShort( QString s ) 129void KLocale::setDateFormatShort( QString s )
130{ 130{
131 mDateFormatShort = s; 131 mDateFormatShort = s;
132} 132}
133 133
134void KLocale::setHore24Format ( bool b ) 134void KLocale::setHore24Format ( bool b )
135{ 135{
136 mHourF24Format = b; 136 mHourF24Format = b;
137} 137}
138void KLocale::setWeekStartMonday( bool b ) 138void KLocale::setWeekStartMonday( bool b )
139{ 139{
140 mWeekStartsMonday = b; 140 mWeekStartsMonday = b;
141} 141}
142int KLocale::getIntDateFormat( ) 142KLocale::IntDateFormat KLocale::getIntDateFormat( )
143{ 143{
144 return mIntDateFormat ; 144 return mIntDateFormat;
145 145
146} 146}
147void KLocale::setIntDateFormat( int i ) 147void KLocale::setIntDateFormat( KLocale::IntDateFormat i )
148{ 148{
149 mIntDateFormat = i; 149 mIntDateFormat = i;
150} 150}
151void KLocale::setLanguage( int i ) 151void KLocale::setLanguage( int i )
152{ 152{
153 mLanguage = i; 153 mLanguage = i;
154} 154}
155QString KLocale::translate( const char *index ) const 155QString KLocale::translate( const char *index ) const
156{ 156{
157 return i18n( index ); 157 return i18n( index );
158} 158}
159 159
160QString KLocale::translate( const char *, const char *fallback) const 160QString KLocale::translate( const char *, const char *fallback) const
161{ 161{
162 return i18n( fallback ); 162 return i18n( fallback );
163} 163}
164 164
165QString KLocale::formatTime(const QTime &pTime, bool includeSecs) const 165QString KLocale::formatTime(const QTime &pTime, bool includeSecs) const
166{ 166{
167 const QString rst = timeFormat(); 167 const QString rst = timeFormat();
168 168
169 // only "pm/am" here can grow, the rest shrinks, but 169 // only "pm/am" here can grow, the rest shrinks, but
170 // I'm rather safe than sorry 170 // I'm rather safe than sorry
171 QChar *buffer = new QChar[rst.length() * 3 / 2 + 30]; 171 QChar *buffer = new QChar[rst.length() * 3 / 2 + 30];
172 172
173 uint index = 0; 173 uint index = 0;
174 bool escape = false; 174 bool escape = false;
175 int number = 0; 175 int number = 0;
176 176
177 for ( uint format_index = 0; format_index < rst.length(); format_index++ ) 177 for ( uint format_index = 0; format_index < rst.length(); format_index++ )
178 { 178 {
179 if ( !escape ) 179 if ( !escape )
180 { 180 {
181 if ( rst.at( format_index ).unicode() == '%' ) 181 if ( rst.at( format_index ).unicode() == '%' )
182 escape = true; 182 escape = true;
183 else 183 else
184 buffer[index++] = rst.at( format_index ); 184 buffer[index++] = rst.at( format_index );
185 } 185 }
186 else 186 else
187 { 187 {
188 switch ( rst.at( format_index ).unicode() ) 188 switch ( rst.at( format_index ).unicode() )
189 { 189 {
190 case '%': 190 case '%':
191 buffer[index++] = '%'; 191 buffer[index++] = '%';
192 break; 192 break;
193 case 'H': 193 case 'H':
194 put_it_in( buffer, index, pTime.hour() ); 194 put_it_in( buffer, index, pTime.hour() );
195 break; 195 break;
196 case 'I': 196 case 'I':
197 put_it_in( buffer, index, ( pTime.hour() + 11) % 12 + 1 ); 197 put_it_in( buffer, index, ( pTime.hour() + 11) % 12 + 1 );
198 break; 198 break;
199 case 'M': 199 case 'M':
200 put_it_in( buffer, index, pTime.minute() ); 200 put_it_in( buffer, index, pTime.minute() );
201 break; 201 break;
202 case 'S': 202 case 'S':
203 if (includeSecs) 203 if (includeSecs)
204 put_it_in( buffer, index, pTime.second() ); 204 put_it_in( buffer, index, pTime.second() );
205 else 205 else
206 { 206 {
207 // we remove the seperator sign before the seconds and 207 // we remove the seperator sign before the seconds and
208 // assume that works everywhere 208 // assume that works everywhere
209 --index; 209 --index;
210 break; 210 break;
211 } 211 }
212 break; 212 break;
213 case 'k': 213 case 'k':
214 number = pTime.hour(); 214 number = pTime.hour();
215 case 'l': 215 case 'l':
216 // to share the code 216 // to share the code
217 if ( rst.at( format_index ).unicode() == 'l' ) 217 if ( rst.at( format_index ).unicode() == 'l' )
218 number = (pTime.hour() + 11) % 12 + 1; 218 number = (pTime.hour() + 11) % 12 + 1;
219 if ( number / 10 ) 219 if ( number / 10 )
220 buffer[index++] = number / 10 + '0'; 220 buffer[index++] = number / 10 + '0';
221 buffer[index++] = number % 10 + '0'; 221 buffer[index++] = number % 10 + '0';
222 break; 222 break;
223 case 'p': 223 case 'p':
224 { 224 {
225 QString s; 225 QString s;
226 if ( pTime.hour() >= 12 ) 226 if ( pTime.hour() >= 12 )
227 put_it_in( buffer, index, i18n("pm") ); 227 put_it_in( buffer, index, i18n("pm") );
228 else 228 else
229 put_it_in( buffer, index, i18n("am") ); 229 put_it_in( buffer, index, i18n("am") );
230 break; 230 break;
231 } 231 }
232 default: 232 default:
233 buffer[index++] = rst.at( format_index ); 233 buffer[index++] = rst.at( format_index );
234 break; 234 break;
235 } 235 }
236 escape = false; 236 escape = false;
237 } 237 }
238 } 238 }
239 QString ret( buffer, index ); 239 QString ret( buffer, index );
240 delete [] buffer; 240 delete [] buffer;
241 return ret; 241 return ret;
242} 242}
243 243
244QString KLocale::formatDate(const QDate &pDate, bool shortFormat) const 244QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat intIntDateFormat) const
245{ 245{
246 const QString rst = shortFormat?dateFormatShort():dateFormat(); 246 const QString rst = shortFormat?dateFormatShort(intIntDateFormat):dateFormat(intIntDateFormat);
247 247
248 // I'm rather safe than sorry 248 // I'm rather safe than sorry
249 QChar *buffer = new QChar[rst.length() * 3 / 2 + 50]; 249 QChar *buffer = new QChar[rst.length() * 3 / 2 + 50];
250 250
251 unsigned int index = 0; 251 unsigned int index = 0;
252 bool escape = false; 252 bool escape = false;
253 int number = 0; 253 int number = 0;
254 254
255 for ( uint format_index = 0; format_index < rst.length(); ++format_index ) 255 for ( uint format_index = 0; format_index < rst.length(); ++format_index )
256 { 256 {
257 if ( !escape ) 257 if ( !escape )
258 { 258 {
259 if ( rst.at( format_index ).unicode() == '%' ) 259 if ( rst.at( format_index ).unicode() == '%' )
260 escape = true; 260 escape = true;
261 else 261 else
262 buffer[index++] = rst.at( format_index ); 262 buffer[index++] = rst.at( format_index );
263 } 263 }
264 else 264 else
265 { 265 {
266 switch ( rst.at( format_index ).unicode() ) 266 switch ( rst.at( format_index ).unicode() )
267 { 267 {
268 case '%': 268 case '%':
269 buffer[index++] = '%'; 269 buffer[index++] = '%';
270 break; 270 break;
271 case 'Y': 271 case 'Y':
272 put_it_in( buffer, index, pDate.year() / 100 ); 272 put_it_in( buffer, index, pDate.year() / 100 );
273 case 'y': 273 case 'y':
274 put_it_in( buffer, index, pDate.year() % 100 ); 274 put_it_in( buffer, index, pDate.year() % 100 );
275 break; 275 break;
276 case 'n': 276 case 'n':
277 number = pDate.month(); 277 number = pDate.month();
278 case 'e': 278 case 'e':
279 // to share the code 279 // to share the code
280 if ( rst.at( format_index ).unicode() == 'e' ) 280 if ( rst.at( format_index ).unicode() == 'e' )
281 number = pDate.day(); 281 number = pDate.day();
282 if ( number / 10 ) 282 if ( number / 10 )
283 buffer[index++] = number / 10 + '0'; 283 buffer[index++] = number / 10 + '0';
284 buffer[index++] = number % 10 + '0'; 284 buffer[index++] = number % 10 + '0';
285 break; 285 break;
286 case 'm': 286 case 'm':
287 put_it_in( buffer, index, pDate.month() ); 287 put_it_in( buffer, index, pDate.month() );
288 break; 288 break;
289 case 'b': 289 case 'b':
290 put_it_in( buffer, index, monthName(pDate.month(), true) ); 290 put_it_in( buffer, index, monthName(pDate.month(), true) );
291 break; 291 break;
292 case 'B': 292 case 'B':
293 put_it_in( buffer, index, monthName(pDate.month(), false) ); 293 put_it_in( buffer, index, monthName(pDate.month(), false) );
294 break; 294 break;
295 case 'd': 295 case 'd':
296 put_it_in( buffer, index, pDate.day() ); 296 put_it_in( buffer, index, pDate.day() );
297 break; 297 break;
298 case 'a': 298 case 'a':
299 put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), true) ); 299 put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), true) );
300 break; 300 break;
301 case 'A': 301 case 'A':
302 put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), false) ); 302 put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), false) );
303 break; 303 break;
304 default: 304 default:
305 buffer[index++] = rst.at( format_index ); 305 buffer[index++] = rst.at( format_index );
306 break; 306 break;
307 } 307 }
308 escape = false; 308 escape = false;
309 } 309 }
310 } 310 }
@@ -583,157 +583,160 @@ QString KLocale::weekDayName(int i,bool shortName) const
583 case 3: return i18n("Wednesday", "Wed"); 583 case 3: return i18n("Wednesday", "Wed");
584 case 4: return i18n("Thursday", "Thu"); 584 case 4: return i18n("Thursday", "Thu");
585 case 5: return i18n("Friday", "Fri"); 585 case 5: return i18n("Friday", "Fri");
586 case 6: return i18n("Saturday", "Sat"); 586 case 6: return i18n("Saturday", "Sat");
587 case 7: return i18n("Sunday", "Sun"); 587 case 7: return i18n("Sunday", "Sun");
588 } 588 }
589 else 589 else
590 switch ( i ) 590 switch ( i )
591 { 591 {
592 case 1: return i18n("Monday"); 592 case 1: return i18n("Monday");
593 case 2: return i18n("Tuesday"); 593 case 2: return i18n("Tuesday");
594 case 3: return i18n("Wednesday"); 594 case 3: return i18n("Wednesday");
595 case 4: return i18n("Thursday"); 595 case 4: return i18n("Thursday");
596 case 5: return i18n("Friday"); 596 case 5: return i18n("Friday");
597 case 6: return i18n("Saturday"); 597 case 6: return i18n("Saturday");
598 case 7: return i18n("Sunday"); 598 case 7: return i18n("Sunday");
599 } 599 }
600 600
601 return QString::null; 601 return QString::null;
602} 602}
603 603
604QString KLocale::monthName(int i,bool shortName) const 604QString KLocale::monthName(int i,bool shortName) const
605{ 605{
606 if ( shortName ) 606 if ( shortName )
607 switch ( i ) 607 switch ( i )
608 { 608 {
609 case 1: return i18n("January", "Jan"); 609 case 1: return i18n("January", "Jan");
610 case 2: return i18n("February", "Feb"); 610 case 2: return i18n("February", "Feb");
611 case 3: return i18n("March", "Mar"); 611 case 3: return i18n("March", "Mar");
612 case 4: return i18n("April", "Apr"); 612 case 4: return i18n("April", "Apr");
613 case 5: return i18n("May short", "May"); 613 case 5: return i18n("May short", "May");
614 case 6: return i18n("June", "Jun"); 614 case 6: return i18n("June", "Jun");
615 case 7: return i18n("July", "Jul"); 615 case 7: return i18n("July", "Jul");
616 case 8: return i18n("August", "Aug"); 616 case 8: return i18n("August", "Aug");
617 case 9: return i18n("September", "Sep"); 617 case 9: return i18n("September", "Sep");
618 case 10: return i18n("October", "Oct"); 618 case 10: return i18n("October", "Oct");
619 case 11: return i18n("November", "Nov"); 619 case 11: return i18n("November", "Nov");
620 case 12: return i18n("December", "Dec"); 620 case 12: return i18n("December", "Dec");
621 } 621 }
622 else 622 else
623 switch (i) 623 switch (i)
624 { 624 {
625 case 1: return i18n("January"); 625 case 1: return i18n("January");
626 case 2: return i18n("February"); 626 case 2: return i18n("February");
627 case 3: return i18n("March"); 627 case 3: return i18n("March");
628 case 4: return i18n("April"); 628 case 4: return i18n("April");
629 case 5: return i18n("May long", "May"); 629 case 5: return i18n("May long", "May");
630 case 6: return i18n("June"); 630 case 6: return i18n("June");
631 case 7: return i18n("July"); 631 case 7: return i18n("July");
632 case 8: return i18n("August"); 632 case 8: return i18n("August");
633 case 9: return i18n("September"); 633 case 9: return i18n("September");
634 case 10: return i18n("October"); 634 case 10: return i18n("October");
635 case 11: return i18n("November"); 635 case 11: return i18n("November");
636 case 12: return i18n("December"); 636 case 12: return i18n("December");
637 } 637 }
638 638
639 return QString::null; 639 return QString::null;
640} 640}
641 641
642QString KLocale::country() const 642QString KLocale::country() const
643{ 643{
644 return QString::null; 644 return QString::null;
645} 645}
646 646
647QString KLocale::dateFormat() const 647QString KLocale::dateFormat(IntDateFormat intIntDateFormat) const
648{ 648{
649 const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat;
650
649 if ( QApplication::desktop()->width() < 480 ) { 651 if ( QApplication::desktop()->width() < 480 ) {
650 if ( mIntDateFormat == 0 ) 652 if ( dformat == Default )
651 return "%a %d %b %Y"; 653 return "%a %d %b %Y";
652 else if ( mIntDateFormat == 1 ) 654 else if ( dformat == Format1 )
653 return "%a %b %d %Y"; 655 return "%a %b %d %Y";
654 else if ( mIntDateFormat == 2 ) 656 else if ( dformat == ISODate )
655 return "%a %Y %b %d"; 657 return "%a %Y %b %d";
656 } else { 658 } else {
657 659
658 if ( mIntDateFormat == 0 ) 660 if ( dformat == Default )
659 return "%A %d %B %Y"; 661 return "%A %d %B %Y";
660 else if ( mIntDateFormat == 1 ) 662 else if ( dformat == Format1 )
661 return "%A %B %d %Y"; 663 return "%A %B %d %Y";
662 else if ( mIntDateFormat == 2 ) 664 else if ( dformat == ISODate )
663 return "%A %Y %B %d"; 665 return "%A %Y %B %d";
664 } 666 }
665 return mDateFormat ; 667 return mDateFormat ;
666} 668}
667 669
668QString KLocale::dateFormatShort() const 670QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const
669{ 671{
672 const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat;
670 673
671 if ( mIntDateFormat == 0 ) 674 if ( dformat == Default )
672 return "%d.%m.%Y"; 675 return "%d.%m.%Y";
673 else if ( mIntDateFormat == 1 ) 676 else if ( dformat == Format1 )
674 return "%m.%d.%Y"; 677 return "%m.%d.%Y";
675 else if ( mIntDateFormat == 2 ) 678 else if ( dformat == ISODate ) // = Qt::ISODate
676 return "%Y-%m-%d"; 679 return "%Y-%m-%d";
677 return mDateFormatShort ; 680 return mDateFormatShort ;
678 681
679} 682}
680 683
681 684
682QString KLocale::timeFormat() const 685QString KLocale::timeFormat() const
683{ 686{
684 if ( mHourF24Format) 687 if ( mHourF24Format)
685 return "%H:%M:%S"; 688 return "%H:%M:%S";
686 return "%I:%M:%S%p"; 689 return "%I:%M:%S%p";
687} 690}
688 691
689void KLocale::insertCatalogue ( const QString & ) 692void KLocale::insertCatalogue ( const QString & )
690{ 693{
691} 694}
692 695
693KCalendarSystem *KLocale::calendar() 696KCalendarSystem *KLocale::calendar()
694{ 697{
695 if ( !mCalendarSystem ) { 698 if ( !mCalendarSystem ) {
696 mCalendarSystem = new KCalendarSystemGregorian; 699 mCalendarSystem = new KCalendarSystemGregorian;
697 } 700 }
698 701
699 return mCalendarSystem; 702 return mCalendarSystem;
700} 703}
701 704
702int KLocale::timezoneOffset( QString timeZone ) 705int KLocale::timezoneOffset( QString timeZone )
703{ 706{
704 int ret = 1001; 707 int ret = 1001;
705 int index = mTimeZoneList.findIndex( timeZone ); 708 int index = mTimeZoneList.findIndex( timeZone );
706 if ( index < 24 ) 709 if ( index < 24 )
707 ret = ( index-11 ) * 60 ; 710 ret = ( index-11 ) * 60 ;
708 return ret; 711 return ret;
709} 712}
710 713
711QStringList KLocale::timeZoneList() const 714QStringList KLocale::timeZoneList() const
712{ 715{
713 return mTimeZoneList; 716 return mTimeZoneList;
714} 717}
715void KLocale::setTimezone( const QString &timeZone ) 718void KLocale::setTimezone( const QString &timeZone )
716{ 719{
717 mTimeZoneOffset = timezoneOffset( timeZone ); 720 mTimeZoneOffset = timezoneOffset( timeZone );
718} 721}
719 722
720void KLocale::setDaylightSaving( bool b, int start , int end ) 723void KLocale::setDaylightSaving( bool b, int start , int end )
721{ 724{
722 daylightEnabled = b; 725 daylightEnabled = b;
723 daylightStart = start; 726 daylightStart = start;
724 daylightEnd = end; 727 daylightEnd = end;
725 mSouthDaylight = (end < start); 728 mSouthDaylight = (end < start);
726 // qDebug("klocale daylight %d %d %d ", b, start , end ); 729 // qDebug("klocale daylight %d %d %d ", b, start , end );
727} 730}
728 731
729int KLocale::localTimeOffset( const QDateTime &dt ) 732int KLocale::localTimeOffset( const QDateTime &dt )
730{ 733{
731 bool addDaylight = false; 734 bool addDaylight = false;
732 if ( daylightEnabled ) { 735 if ( daylightEnabled ) {
733 int d_end, d_start; 736 int d_end, d_start;
734 int dayofyear = dt.date().dayOfYear(); 737 int dayofyear = dt.date().dayOfYear();
735 int year = dt.date().year(); 738 int year = dt.date().year();
736 int add = 0; 739 int add = 0;
737 if ( QDate::leapYear(year) ) 740 if ( QDate::leapYear(year) )
738 add = 1; 741 add = 1;
739 QDate date ( year,1,1 ); 742 QDate date ( year,1,1 );
diff --git a/microkde/kdecore/klocale.h b/microkde/kdecore/klocale.h
index 7470cd2..f6c0253 100644
--- a/microkde/kdecore/klocale.h
+++ b/microkde/kdecore/klocale.h
@@ -1,110 +1,112 @@
1#ifndef MINIKDE_KLOCALE_H 1#ifndef MINIKDE_KLOCALE_H
2#define MINIKDE_KLOCALE_H 2#define MINIKDE_KLOCALE_H
3 3
4#include <qstring.h> 4#include <qstring.h>
5#include <qstringlist.h> 5#include <qstringlist.h>
6#include <qdatetime.h> 6#include <qdatetime.h>
7#include <qdict.h> 7#include <qdict.h>
8 8
9#ifndef I18N_NOOP 9#ifndef I18N_NOOP
10#define I18N_NOOP(x) (x) 10#define I18N_NOOP(x) (x)
11#endif 11#endif
12 12
13class KCalendarSystem; 13class KCalendarSystem;
14void setLocaleDict( QDict<QString> * dict ); 14void setLocaleDict( QDict<QString> * dict );
15QString i18n(const char *text); 15QString i18n(const char *text);
16QString i18n(const char *hint, const char *text); 16QString i18n(const char *hint, const char *text);
17QString i18n(const char *text1, const char *textn, int num); 17QString i18n(const char *text1, const char *textn, int num);
18 18
19// Qt3's uic generates i18n( "msg", "comment" ) calls which conflict 19// Qt3's uic generates i18n( "msg", "comment" ) calls which conflict
20// with our i18n method. we use uic -tr tr2i18n to redirect 20// with our i18n method. we use uic -tr tr2i18n to redirect
21// to the right i18n() function 21// to the right i18n() function
22inline QString tr2i18n(const char* message, const char* =0) { 22inline QString tr2i18n(const char* message, const char* =0) {
23 return i18n( message); 23 return i18n( message);
24} 24}
25 25
26class KLocale 26class KLocale
27{ 27{
28 public: 28 public:
29 KLocale(); 29 KLocale();
30 30
31 QString formatNumber(double num, int precision = -1) const; 31 QString formatNumber(double num, int precision = -1) const;
32 QString formatNumber(const QString &numStr) const; 32 QString formatNumber(const QString &numStr) const;
33 double readNumber(const QString &numStr, bool * ok = 0) const; 33 double readNumber(const QString &numStr, bool * ok = 0) const;
34 34
35 QString decimalSymbol() const; 35 QString decimalSymbol() const;
36 QString thousandsSeparator() const; 36 QString thousandsSeparator() const;
37 QString positiveSign() const; 37 QString positiveSign() const;
38 QString negativeSign() const; 38 QString negativeSign() const;
39 39
40 40
41 QString translate( const char *index ) const; 41 QString translate( const char *index ) const;
42 QString translate( const char *index, const char *fallback) const; 42 QString translate( const char *index, const char *fallback) const;
43 43
44 QString formatDate(const QDate &pDate, bool shortFormat = false) const; 44 enum IntDateFormat { Undefined=-1, Default=0, Format1=1, ISODate=2, Userdefined=3 };
45
46 QString formatDate(const QDate &pDate, bool shortFormat = false, IntDateFormat intIntDateFormat = Undefined) const;
45 QString formatTime(const QTime &pTime, bool includeSecs = false) const; 47 QString formatTime(const QTime &pTime, bool includeSecs = false) const;
46 QString formatDateTime(const QDateTime &pDateTime) const; 48 QString formatDateTime(const QDateTime &pDateTime) const;
47 QString formatDateTime(const QDateTime &pDateTime, 49 QString formatDateTime(const QDateTime &pDateTime,
48 bool shortFormat, 50 bool shortFormat,
49 bool includeSecs = false) const; 51 bool includeSecs = false) const;
50 52
51 QDate readDate(const QString &str, bool* ok = 0) const; 53 QDate readDate(const QString &str, bool* ok = 0) const;
52 QDate readDate( const QString &intstr, const QString &fmt, bool* ok = 0) const; 54 QDate readDate( const QString &intstr, const QString &fmt, bool* ok = 0) const;
53 QTime readTime(const QString &str, bool* ok = 0) const; 55 QTime readTime(const QString &str, bool* ok = 0) const;
54 56
55 bool use12Clock() const; 57 bool use12Clock() const;
56 bool weekStartsMonday() const; 58 bool weekStartsMonday() const;
57 int weekStartDay() const; 59 int weekStartDay() const;
58 60
59 QString weekDayName(int,bool=false) const; 61 QString weekDayName(int,bool=false) const;
60 QString monthName(int,bool=false) const; 62 QString monthName(int,bool=false) const;
61 63
62 QString country() const; 64 QString country() const;
63 65
64 QString dateFormat() const; 66 QString dateFormat(IntDateFormat intIntDateFormat = Undefined) const;
65 QString dateFormatShort() const; 67 QString dateFormatShort(IntDateFormat intIntDateFormat = Undefined) const;
66 QString timeFormat() const; 68 QString timeFormat() const;
67 69
68 void insertCatalogue ( const QString & ); 70 void insertCatalogue ( const QString & );
69 71
70 KCalendarSystem *calendar(); 72 KCalendarSystem *calendar();
71 void setHore24Format ( bool ); 73 void setHore24Format ( bool );
72 void setWeekStartMonday( bool ); 74 void setWeekStartMonday( bool );
73 void setIntDateFormat( int ); 75 void setIntDateFormat( IntDateFormat );
74 int getIntDateFormat( ); 76 IntDateFormat getIntDateFormat( );
75 void setLanguage( int ); 77 void setLanguage( int );
76 void setDateFormat( QString ); 78 void setDateFormat( QString );
77 void setDateFormatShort( QString ); 79 void setDateFormatShort( QString );
78 80
79 QString m_decimalSymbol; 81 QString m_decimalSymbol;
80 QString m_thousandsSeparator; 82 QString m_thousandsSeparator;
81 QString m_currencySymbol; 83 QString m_currencySymbol;
82 QString m_monetaryDecimalSymbol; 84 QString m_monetaryDecimalSymbol;
83 QString m_monetaryThousandsSeparator; 85 QString m_monetaryThousandsSeparator;
84 QString m_positiveSign; 86 QString m_positiveSign;
85 QString m_negativeSign; 87 QString m_negativeSign;
86 88
87 int timezoneOffset( QString ); 89 int timezoneOffset( QString );
88 QStringList timeZoneList() const; 90 QStringList timeZoneList() const;
89 void setDaylightSaving( bool, int , int ); 91 void setDaylightSaving( bool, int , int );
90 int localTimeOffset(const QDateTime &); 92 int localTimeOffset(const QDateTime &);
91 void setTimezone( const QString &timeZone ); 93 void setTimezone( const QString &timeZone );
92 private: 94 private:
93 QTime readTime(const QString &str, bool seconds, bool *ok) const; 95 QTime readTime(const QString &str, bool seconds, bool *ok) const;
94 QDate readDate(const QString &str, bool shortFormat, bool *ok) const; 96 QDate readDate(const QString &str, bool shortFormat, bool *ok) const;
95 KCalendarSystem *mCalendarSystem; 97 KCalendarSystem *mCalendarSystem;
96 bool mWeekStartsMonday; 98 bool mWeekStartsMonday;
97 bool mHourF24Format; 99 bool mHourF24Format;
98 int mIntDateFormat; 100 IntDateFormat mIntDateFormat;
99 int mLanguage; 101 int mLanguage;
100 QString mDateFormat; 102 QString mDateFormat;
101 QString mDateFormatShort; 103 QString mDateFormatShort;
102 QStringList mTimeZoneList; 104 QStringList mTimeZoneList;
103 bool daylightEnabled; 105 bool daylightEnabled;
104 int mDaylightTZoffset; 106 int mDaylightTZoffset;
105 int mNondaylightTZoffset; 107 int mNondaylightTZoffset;
106 bool mSouthDaylight; 108 bool mSouthDaylight;
107 int daylightStart, daylightEnd, mTimeZoneOffset; 109 int daylightStart, daylightEnd, mTimeZoneOffset;
108}; 110};
109 111
110#endif 112#endif