author | zautrix <zautrix> | 2004-09-13 21:35:12 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-13 21:35:12 (UTC) |
commit | bd6b4acb39498ffea3beea7d9b5f7620b60c14db (patch) (unidiff) | |
tree | e2d7425b7bb49fbcb7acb5ced497ac1fed06dfaf /kaddressbook | |
parent | 06eabf6e82c0390699d11fd12580d91261829431 (diff) | |
download | kdepimpi-bd6b4acb39498ffea3beea7d9b5f7620b60c14db.zip kdepimpi-bd6b4acb39498ffea3beea7d9b5f7620b60c14db.tar.gz kdepimpi-bd6b4acb39498ffea3beea7d9b5f7620b60c14db.tar.bz2 |
Many bugfixes
-rw-r--r-- | kaddressbook/addresseeeditorwidget.cpp | 56 | ||||
-rw-r--r-- | kaddressbook/mainembedded.cpp | 15 | ||||
-rw-r--r-- | kaddressbook/nameeditdialog.cpp | 7 |
3 files changed, 58 insertions, 20 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 3cfc1f2..826c69b 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp | |||
@@ -84,13 +84,12 @@ AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension, | |||
84 | : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ), | 84 | : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ), |
85 | mBlockSignals( false ) | 85 | mBlockSignals( false ) |
86 | { | 86 | { |
87 | 87 | ||
88 | mAConfig = AddresseeConfig::instance(); | 88 | mAConfig = AddresseeConfig::instance(); |
89 | 89 | ||
90 | kdDebug(5720) << "AddresseeEditorWidget()" << endl; | ||
91 | mFormattedNameType = NameEditDialog::CustomName; | 90 | mFormattedNameType = NameEditDialog::CustomName; |
92 | initGUI(); | 91 | initGUI(); |
93 | mCategoryDialog = 0; | 92 | mCategoryDialog = 0; |
94 | mCategoryEditDialog = 0; | 93 | mCategoryEditDialog = 0; |
95 | 94 | ||
96 | // Load the empty addressee as defaults | 95 | // Load the empty addressee as defaults |
@@ -629,12 +628,13 @@ void AddresseeEditorWidget::setupTab2() | |||
629 | layout->addWidget( mSpouseEdit, 7, 2 ); | 628 | layout->addWidget( mSpouseEdit, 7, 2 ); |
630 | 629 | ||
631 | label = new QLabel( i18n( "Birthday:" ), tab2 ); | 630 | label = new QLabel( i18n( "Birthday:" ), tab2 ); |
632 | //US layout->addWidget( label, 4, 3 ); | 631 | //US layout->addWidget( label, 4, 3 ); |
633 | layout->addWidget( label, 8, 1 ); | 632 | layout->addWidget( label, 8, 1 ); |
634 | mBirthdayPicker = new KDateEdit( tab2 ); | 633 | mBirthdayPicker = new KDateEdit( tab2 ); |
634 | mBirthdayPicker->toggleDateFormat(); | ||
635 | mBirthdayPicker->setHandleInvalid( true ); | 635 | mBirthdayPicker->setHandleInvalid( true ); |
636 | connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), | 636 | connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), |
637 | SLOT( dateChanged( QDate ) ) ); | 637 | SLOT( dateChanged( QDate ) ) ); |
638 | 638 | ||
639 | 639 | ||
640 | #ifndef KAB_EMBEDDED | 640 | #ifndef KAB_EMBEDDED |
@@ -944,13 +944,12 @@ void AddresseeEditorWidget::setupTab3_1() | |||
944 | mTabWidget->addTab( tab3, i18n( "&Images" ) ); | 944 | mTabWidget->addTab( tab3, i18n( "&Images" ) ); |
945 | } | 945 | } |
946 | 946 | ||
947 | 947 | ||
948 | void AddresseeEditorWidget::load() | 948 | void AddresseeEditorWidget::load() |
949 | { | 949 | { |
950 | kdDebug(5720) << "AddresseeEditorWidget::load()" << endl; | ||
951 | 950 | ||
952 | // Block signals in case anything tries to emit modified | 951 | // Block signals in case anything tries to emit modified |
953 | // CS: This doesn't seem to work. | 952 | // CS: This doesn't seem to work. |
954 | bool block = signalsBlocked(); | 953 | bool block = signalsBlocked(); |
955 | blockSignals( true ); | 954 | blockSignals( true ); |
956 | mBlockSignals = true; // used for internal signal blocking | 955 | mBlockSignals = true; // used for internal signal blocking |
@@ -1025,23 +1024,31 @@ void AddresseeEditorWidget::load() | |||
1025 | 1024 | ||
1026 | mDirty = false; | 1025 | mDirty = false; |
1027 | } | 1026 | } |
1028 | 1027 | ||
1029 | void AddresseeEditorWidget::save() | 1028 | void AddresseeEditorWidget::save() |
1030 | { | 1029 | { |
1031 | if ( !mDirty ) return; | 1030 | if ( !dirty() ) { |
1031 | return; | ||
1032 | } | ||
1032 | 1033 | ||
1033 | mAddressee.setRole( mRoleEdit->text() ); | 1034 | mAddressee.setRole( mRoleEdit->text() ); |
1034 | mAddressee.setOrganization( mOrgEdit->text() ); | 1035 | mAddressee.setOrganization( mOrgEdit->text() ); |
1035 | mAddressee.setUrl( KURL( mURLEdit->text() ) ); | 1036 | mAddressee.setUrl( KURL( mURLEdit->text() ) ); |
1036 | mAddressee.setNote( mNoteEdit->text() ); | 1037 | mAddressee.setNote( mNoteEdit->text() ); |
1037 | if ( mBirthdayPicker->inputIsValid() ) | 1038 | if ( mBirthdayPicker->inputIsValid() ) { |
1038 | mAddressee.setBirthday( QDateTime( mBirthdayPicker->date() ) ); | 1039 | QDate da = mBirthdayPicker->date(); |
1039 | else | 1040 | if ( da > QDate::currentDate() ) |
1041 | da.setYMD(da.year()-100, da.month(), da.day() ); | ||
1042 | mAddressee.setBirthday( QDateTime( da ) ); | ||
1043 | qDebug("bday %s ",da.toString().latin1()); | ||
1044 | } | ||
1045 | else { | ||
1040 | mAddressee.setBirthday( QDateTime() ); | 1046 | mAddressee.setBirthday( QDateTime() ); |
1041 | 1047 | mBirthdayPicker->clear(); | |
1048 | } | ||
1042 | mAddressee.setNickName( mNicknameEdit->text() ); | 1049 | mAddressee.setNickName( mNicknameEdit->text() ); |
1043 | mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); | 1050 | mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); |
1044 | 1051 | ||
1045 | mAddressee.setGeo( mGeoWidget->geo() ); | 1052 | mAddressee.setGeo( mGeoWidget->geo() ); |
1046 | mAddressee.setPhoto( mImageWidget->photo() ); | 1053 | mAddressee.setPhoto( mImageWidget->photo() ); |
1047 | mAddressee.setLogo( mImageWidget->logo() ); | 1054 | mAddressee.setLogo( mImageWidget->logo() ); |
@@ -1059,20 +1066,19 @@ void AddresseeEditorWidget::save() | |||
1059 | mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); | 1066 | mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); |
1060 | mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); | 1067 | mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); |
1061 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); | 1068 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); |
1062 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); | 1069 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); |
1063 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); | 1070 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); |
1064 | if ( mAnniversaryPicker->inputIsValid() ) { | 1071 | if ( mAnniversaryPicker->inputIsValid() ) { |
1065 | |||
1066 | //US mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", | ||
1067 | //US mAnniversaryPicker->date().toString( Qt::ISODate ) ); | ||
1068 | QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); | 1072 | QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); |
1069 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); | 1073 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); |
1070 | } | 1074 | } |
1071 | else | 1075 | else { |
1072 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); | 1076 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); |
1077 | mAnniversaryPicker->clear(); | ||
1078 | } | ||
1073 | 1079 | ||
1074 | // Save the email addresses | 1080 | // Save the email addresses |
1075 | QStringList emails = mAddressee.emails(); | 1081 | QStringList emails = mAddressee.emails(); |
1076 | QStringList::Iterator iter; | 1082 | QStringList::Iterator iter; |
1077 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) | 1083 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) |
1078 | mAddressee.removeEmail( *iter ); | 1084 | mAddressee.removeEmail( *iter ); |
@@ -1111,24 +1117,44 @@ void AddresseeEditorWidget::save() | |||
1111 | mAddressee.insertAddress( *addressIter ); | 1117 | mAddressee.insertAddress( *addressIter ); |
1112 | mDirty = false; | 1118 | mDirty = false; |
1113 | } | 1119 | } |
1114 | 1120 | ||
1115 | bool AddresseeEditorWidget::dirty() | 1121 | bool AddresseeEditorWidget::dirty() |
1116 | { | 1122 | { |
1123 | |||
1124 | if ( ! mDirty ) { | ||
1125 | if ( mBirthdayPicker->inputIsValid() ) { | ||
1126 | QDate da = mBirthdayPicker->date(); | ||
1127 | if ( !(da == mAddressee.birthday().date())) | ||
1128 | mDirty = true; | ||
1129 | } | ||
1130 | else { | ||
1131 | mBirthdayPicker->clear(); | ||
1132 | } | ||
1133 | if ( mAnniversaryPicker->inputIsValid() ) { | ||
1134 | QDate da = mAnniversaryPicker->date(); | ||
1135 | if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), | ||
1136 | "%Y-%m-%d")) | ||
1137 | mDirty = true; | ||
1138 | } | ||
1139 | else { | ||
1140 | mAnniversaryPicker->clear(); | ||
1141 | } | ||
1142 | } | ||
1117 | return mDirty; | 1143 | return mDirty; |
1118 | } | 1144 | } |
1119 | 1145 | ||
1120 | void AddresseeEditorWidget::nameTextChanged( const QString &text ) | 1146 | void AddresseeEditorWidget::nameTextChanged( const QString &text ) |
1121 | { | 1147 | { |
1122 | // use the addressee class to parse the name for us | 1148 | // use the addressee class to parse the name for us |
1123 | mAConfig->setUid( mAddressee.uid() ); | 1149 | mAConfig->setUid( mAddressee.uid() ); |
1124 | if ( mAConfig->automaticNameParsing() ) { | 1150 | if ( mAConfig->automaticNameParsing() ) { |
1125 | if ( !mAddressee.formattedName().isEmpty() ) { | 1151 | if ( !mAddressee.formattedName().isEmpty() ) { |
1126 | QString fn = mAddressee.formattedName(); | 1152 | QString fn = mAddressee.formattedName(); |
1127 | mAddressee.setNameFromString( text ); | 1153 | mAddressee.setNameFromString( text ); |
1128 | mAddressee.setFormattedName( fn ); | 1154 | mAddressee.setFormattedName( fn ); |
1129 | } else { | 1155 | } else { |
1130 | // use extra addressee to avoid a formatted name assignment | 1156 | // use extra addressee to avoid a formatted name assignment |
1131 | Addressee addr; | 1157 | Addressee addr; |
1132 | addr.setNameFromString( text ); | 1158 | addr.setNameFromString( text ); |
1133 | mAddressee.setPrefix( addr.prefix() ); | 1159 | mAddressee.setPrefix( addr.prefix() ); |
1134 | mAddressee.setGivenName( addr.givenName() ); | 1160 | mAddressee.setGivenName( addr.givenName() ); |
@@ -1166,13 +1192,13 @@ void AddresseeEditorWidget::nameBoxChanged() | |||
1166 | 1192 | ||
1167 | void AddresseeEditorWidget::nameButtonClicked() | 1193 | void AddresseeEditorWidget::nameButtonClicked() |
1168 | { | 1194 | { |
1169 | // show the name dialog. | 1195 | // show the name dialog. |
1170 | NameEditDialog dialog( mAddressee, mFormattedNameType, this ); | 1196 | NameEditDialog dialog( mAddressee, mFormattedNameType, this ); |
1171 | 1197 | ||
1172 | if ( dialog.exec() ) { | 1198 | if ( KApplication::execDialog( &dialog) ) { |
1173 | if ( dialog.changed() ) { | 1199 | if ( dialog.changed() ) { |
1174 | mAddressee.setFamilyName( dialog.familyName() ); | 1200 | mAddressee.setFamilyName( dialog.familyName() ); |
1175 | mAddressee.setGivenName( dialog.givenName() ); | 1201 | mAddressee.setGivenName( dialog.givenName() ); |
1176 | mAddressee.setPrefix( dialog.prefix() ); | 1202 | mAddressee.setPrefix( dialog.prefix() ); |
1177 | mAddressee.setSuffix( dialog.suffix() ); | 1203 | mAddressee.setSuffix( dialog.suffix() ); |
1178 | mAddressee.setAdditionalName( dialog.additionalName() ); | 1204 | mAddressee.setAdditionalName( dialog.additionalName() ); |
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index d781f67..4230c07 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -68,12 +68,27 @@ int main( int argc, char **argv ) | |||
68 | #endif | 68 | #endif |
69 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 69 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
70 | KAddressBookMain m ; | 70 | KAddressBookMain m ; |
71 | //US MainWindow m; | 71 | //US MainWindow m; |
72 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 72 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
73 | 73 | ||
74 | { | ||
75 | KConfig kon ( locateLocal( "config", "korganizerrc" ) ); | ||
76 | kon.setGroup("Locale"); | ||
77 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) ); | ||
78 | QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( ""); | ||
79 | KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) ); | ||
80 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | ||
81 | dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" ); | ||
82 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | ||
83 | kon.setGroup("Time & Date"); | ||
84 | KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ), | ||
85 | kon.readNumEntry( "DaylightsavingStart", 90), | ||
86 | kon.readNumEntry( "DaylightsavingEnd",304) ); | ||
87 | KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") ); | ||
88 | } | ||
74 | #ifndef DESKTOP_VERSION | 89 | #ifndef DESKTOP_VERSION |
75 | a.showMainWidget( &m ); | 90 | a.showMainWidget( &m ); |
76 | #else | 91 | #else |
77 | a.setMainWidget( &m ); | 92 | a.setMainWidget( &m ); |
78 | m.resize (640, 480 ); | 93 | m.resize (640, 480 ); |
79 | m.show(); | 94 | m.show(); |
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp index fb7eb22..8213c2b 100644 --- a/kaddressbook/nameeditdialog.cpp +++ b/kaddressbook/nameeditdialog.cpp | |||
@@ -106,13 +106,13 @@ NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type, | |||
106 | mFormattedNameEdit->setEnabled( type == CustomName ); | 106 | mFormattedNameEdit->setEnabled( type == CustomName ); |
107 | layout->addMultiCellWidget( mFormattedNameEdit, 5, 5, 1, 2 ); | 107 | layout->addMultiCellWidget( mFormattedNameEdit, 5, 5, 1, 2 ); |
108 | 108 | ||
109 | mParseBox = new QCheckBox( i18n( "Parse name automatically" ), page ); | 109 | mParseBox = new QCheckBox( i18n( "Parse name automatically" ), page ); |
110 | connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( parseBoxChanged(bool) ) ); | 110 | connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( parseBoxChanged(bool) ) ); |
111 | connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( modified() ) ); | 111 | connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( modified() ) ); |
112 | layout->addMultiCellWidget( mParseBox, 6, 6, 0, 1 ); | 112 | layout->addMultiCellWidget( mParseBox, 6, 6, 0, 2 ); |
113 | 113 | ||
114 | // Fill in the values | 114 | // Fill in the values |
115 | mFamilyNameEdit->setText( addr.familyName() ); | 115 | mFamilyNameEdit->setText( addr.familyName() ); |
116 | mGivenNameEdit->setText( addr.givenName() ); | 116 | mGivenNameEdit->setText( addr.givenName() ); |
117 | mAdditionalNameEdit->setText( addr.additionalName() ); | 117 | mAdditionalNameEdit->setText( addr.additionalName() ); |
118 | mFormattedNameEdit->setText( addr.formattedName() ); | 118 | mFormattedNameEdit->setText( addr.formattedName() ); |
@@ -172,16 +172,13 @@ NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type, | |||
172 | connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( modified() ) ); | 172 | connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( modified() ) ); |
173 | connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); | 173 | connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); |
174 | 174 | ||
175 | updateTypeCombo(); | 175 | updateTypeCombo(); |
176 | mFormattedNameCombo->setCurrentItem( type ); | 176 | mFormattedNameCombo->setCurrentItem( type ); |
177 | 177 | ||
178 | #ifdef KAB_EMBEDDED | 178 | |
179 | resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300)); | ||
180 | #endif //KAB_EMBEDDED | ||
181 | |||
182 | mChanged = false; | 179 | mChanged = false; |
183 | } | 180 | } |
184 | 181 | ||
185 | NameEditDialog::~NameEditDialog() | 182 | NameEditDialog::~NameEditDialog() |
186 | { | 183 | { |
187 | } | 184 | } |