summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp56
-rw-r--r--kaddressbook/mainembedded.cpp15
-rw-r--r--kaddressbook/nameeditdialog.cpp7
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
@@ -87,7 +87,6 @@ AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension,
mAConfig = AddresseeConfig::instance();
- kdDebug(5720) << "AddresseeEditorWidget()" << endl;
mFormattedNameType = NameEditDialog::CustomName;
initGUI();
mCategoryDialog = 0;
@@ -632,6 +631,7 @@ void AddresseeEditorWidget::setupTab2()
//US layout->addWidget( label, 4, 3 );
layout->addWidget( label, 8, 1 );
mBirthdayPicker = new KDateEdit( tab2 );
+ mBirthdayPicker->toggleDateFormat();
mBirthdayPicker->setHandleInvalid( true );
connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
@@ -947,7 +947,6 @@ void AddresseeEditorWidget::setupTab3_1()
void AddresseeEditorWidget::load()
{
- kdDebug(5720) << "AddresseeEditorWidget::load()" << endl;
// Block signals in case anything tries to emit modified
// CS: This doesn't seem to work.
@@ -1028,17 +1027,25 @@ void AddresseeEditorWidget::load()
void AddresseeEditorWidget::save()
{
- if ( !mDirty ) return;
+ if ( !dirty() ) {
+ return;
+ }
mAddressee.setRole( mRoleEdit->text() );
mAddressee.setOrganization( mOrgEdit->text() );
mAddressee.setUrl( KURL( mURLEdit->text() ) );
mAddressee.setNote( mNoteEdit->text() );
- if ( mBirthdayPicker->inputIsValid() )
- mAddressee.setBirthday( QDateTime( mBirthdayPicker->date() ) );
- else
+ if ( mBirthdayPicker->inputIsValid() ) {
+ QDate da = mBirthdayPicker->date();
+ if ( da > QDate::currentDate() )
+ da.setYMD(da.year()-100, da.month(), da.day() );
+ mAddressee.setBirthday( QDateTime( da ) );
+ qDebug("bday %s ",da.toString().latin1());
+ }
+ else {
mAddressee.setBirthday( QDateTime() );
-
+ mBirthdayPicker->clear();
+ }
mAddressee.setNickName( mNicknameEdit->text() );
mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
@@ -1062,14 +1069,13 @@ void AddresseeEditorWidget::save()
mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
if ( mAnniversaryPicker->inputIsValid() ) {
-
-//US mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary",
-//US mAnniversaryPicker->date().toString( Qt::ISODate ) );
QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
}
- else
+ else {
mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
+ mAnniversaryPicker->clear();
+ }
// Save the email addresses
QStringList emails = mAddressee.emails();
@@ -1114,6 +1120,26 @@ void AddresseeEditorWidget::save()
bool AddresseeEditorWidget::dirty()
{
+
+ if ( ! mDirty ) {
+ if ( mBirthdayPicker->inputIsValid() ) {
+ QDate da = mBirthdayPicker->date();
+ if ( !(da == mAddressee.birthday().date()))
+ mDirty = true;
+ }
+ else {
+ mBirthdayPicker->clear();
+ }
+ if ( mAnniversaryPicker->inputIsValid() ) {
+ QDate da = mAnniversaryPicker->date();
+ if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
+ "%Y-%m-%d"))
+ mDirty = true;
+ }
+ else {
+ mAnniversaryPicker->clear();
+ }
+ }
return mDirty;
}
@@ -1123,9 +1149,9 @@ void AddresseeEditorWidget::nameTextChanged( const QString &text )
mAConfig->setUid( mAddressee.uid() );
if ( mAConfig->automaticNameParsing() ) {
if ( !mAddressee.formattedName().isEmpty() ) {
- QString fn = mAddressee.formattedName();
- mAddressee.setNameFromString( text );
- mAddressee.setFormattedName( fn );
+ QString fn = mAddressee.formattedName();
+ mAddressee.setNameFromString( text );
+ mAddressee.setFormattedName( fn );
} else {
// use extra addressee to avoid a formatted name assignment
Addressee addr;
@@ -1169,7 +1195,7 @@ void AddresseeEditorWidget::nameButtonClicked()
// show the name dialog.
NameEditDialog dialog( mAddressee, mFormattedNameType, this );
- if ( dialog.exec() ) {
+ if ( KApplication::execDialog( &dialog) ) {
if ( dialog.changed() ) {
mAddressee.setFamilyName( dialog.familyName() );
mAddressee.setGivenName( dialog.givenName() );
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index d781f67..4230c07 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -71,6 +71,21 @@ int main( int argc, char **argv )
//US MainWindow m;
QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
+ {
+ KConfig kon ( locateLocal( "config", "korganizerrc" ) );
+ kon.setGroup("Locale");
+ KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) );
+ QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( "");
+ KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) );
+ KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
+ dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" );
+ KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
+ kon.setGroup("Time & Date");
+ KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ),
+ kon.readNumEntry( "DaylightsavingStart", 90),
+ kon.readNumEntry( "DaylightsavingEnd",304) );
+ KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") );
+ }
#ifndef DESKTOP_VERSION
a.showMainWidget( &m );
#else
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp
index fb7eb22..8213c2b 100644
--- a/kaddressbook/nameeditdialog.cpp
+++ b/kaddressbook/nameeditdialog.cpp
@@ -109,7 +109,7 @@ NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type,
mParseBox = new QCheckBox( i18n( "Parse name automatically" ), page );
connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( parseBoxChanged(bool) ) );
connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( modified() ) );
- layout->addMultiCellWidget( mParseBox, 6, 6, 0, 1 );
+ layout->addMultiCellWidget( mParseBox, 6, 6, 0, 2 );
// Fill in the values
mFamilyNameEdit->setText( addr.familyName() );
@@ -175,10 +175,7 @@ NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type,
updateTypeCombo();
mFormattedNameCombo->setCurrentItem( type );
-#ifdef KAB_EMBEDDED
- resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300));
-#endif //KAB_EMBEDDED
-
+
mChanged = false;
}