From bd6b4acb39498ffea3beea7d9b5f7620b60c14db Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 13 Sep 2004 21:35:12 +0000 Subject: Many bugfixes --- diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 6b282e2..4cdd5e5 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -801,35 +801,39 @@ void Addressee::setNameFromString( const QString &str ) setFormattedName( str ); setName( str ); - QStringList titles; - titles += i18n( "Dr." ); - titles += i18n( "Miss" ); - titles += i18n( "Mr." ); - titles += i18n( "Mrs." ); - titles += i18n( "Ms." ); - titles += i18n( "Prof." ); - - QStringList suffixes; - suffixes += i18n( "I" ); - suffixes += i18n( "II" ); - suffixes += i18n( "III" ); - suffixes += i18n( "Jr." ); - suffixes += i18n( "Sr." ); - - QStringList prefixes; - prefixes += "van"; - prefixes += "von"; - prefixes += "de"; - -//US KConfig config( "kabcrc" ); - KConfig config( locateLocal( "config", "kabcrc") ); - config.setGroup( "General" ); - titles += config.readListEntry( "Prefixes" ); - titles.remove( "" ); - prefixes += config.readListEntry( "Inclusions" ); - prefixes.remove( "" ); - suffixes += config.readListEntry( "Suffixes" ); - suffixes.remove( "" ); + static bool first = true; + static QStringList titles; + static QStringList suffixes; + static QStringList prefixes; + + if ( first ) { + first = false; + titles += i18n( "Dr." ); + titles += i18n( "Miss" ); + titles += i18n( "Mr." ); + titles += i18n( "Mrs." ); + titles += i18n( "Ms." ); + titles += i18n( "Prof." ); + + suffixes += i18n( "I" ); + suffixes += i18n( "II" ); + suffixes += i18n( "III" ); + suffixes += i18n( "Jr." ); + suffixes += i18n( "Sr." ); + + prefixes += "van"; + prefixes += "von"; + prefixes += "de"; + + KConfig config( locateLocal( "config", "kabcrc") ); + config.setGroup( "General" ); + titles += config.readListEntry( "Prefixes" ); + titles.remove( "" ); + prefixes += config.readListEntry( "Inclusions" ); + prefixes.remove( "" ); + suffixes += config.readListEntry( "Suffixes" ); + suffixes.remove( "" ); + } // clear all name parts setPrefix( "" ); 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; } diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index ed591fc..c3a1627 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp @@ -37,6 +37,8 @@ QString Genericwrapper::parseDateTime( mailimf_date_time *date ) 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), diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index d5d31e2..258bd43 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1260,9 +1260,11 @@ void CalendarView::syncExternal( int mode ) { QPtrList iL = mCalendar->rawIncidences(); Incidence* inc = iL.first(); - while ( inc ) { - inc->removeID(mCurrentSyncDevice); - inc = iL.next(); + if ( phoneFormat ) { + while ( inc ) { + inc->removeID(mCurrentSyncDevice); + inc = iL.next(); + } } #ifndef DESKTOP_VERSION if ( sharpFormat ) diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp index d710541..5c69010 100644 --- a/libkdepim/addresseeview.cpp +++ b/libkdepim/addresseeview.cpp @@ -65,7 +65,7 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name ) void AddresseeView::setSource(const QString& n) { - qDebug("********AddresseeView::setSource %s", n.latin1()); + //qDebug("********AddresseeView::setSource %s", n.latin1()); if ( n.left( 6 ) == "mailto" ) ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); @@ -124,7 +124,13 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) ++emailIt; } } - + if ( mAddressee.birthday().date().isValid() ) { + dynamicPart += QString( + "%1" + "%2" ) + .arg( i18n ("Birthday") ) + .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); + } KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); KABC::PhoneNumber::List::ConstIterator phoneIt; QString extension; diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp index 5fb948a..c4c0081 100644 --- a/libkdepim/kdateedit.cpp +++ b/libkdepim/kdateedit.cpp @@ -124,7 +124,13 @@ KDateEdit::~KDateEdit() { delete mDateFrame; } - +void KDateEdit::clear() +{ + bool b = mDateEdit->signalsBlocked(); + mDateEdit->blockSignals(true); + mDateEdit->setText(""); + mDateEdit->blockSignals(b); +} void KDateEdit::setDate(QDate newDate) { if (!newDate.isValid() && !mHandleInvalid) @@ -463,8 +469,7 @@ bool KDateEdit::eventFilter(QObject *, QEvent *e) // switch dateFormShort by double klick with mouse else if (e->type() == QEvent::MouseButtonDblClick) { - dateFormShort = dateFormShort?false:true; - mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort)); + toggleDateFormat(); } else if (e->type() == QEvent::FocusIn) { @@ -473,6 +478,12 @@ bool KDateEdit::eventFilter(QObject *, QEvent *e) return false; } +void KDateEdit::toggleDateFormat() +{ + dateFormShort = ! dateFormShort; + mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort)); + +} void KDateEdit::textChanged(const QString &) { diff --git a/libkdepim/kdateedit.h b/libkdepim/kdateedit.h index 742d843..cf3b90a 100644 --- a/libkdepim/kdateedit.h +++ b/libkdepim/kdateedit.h @@ -78,7 +78,8 @@ class KDateEdit : public QHBox * to display the proper date when the focus leaves. */ virtual bool eventFilter(QObject *o, QEvent *e); - + void toggleDateFormat(); + void clear(); signals: /** This signal is emitted whenever the user modifies the date. This * may not get emitted until the user presses enter in the line edit or diff --git a/microkde/kdeui/kaction.cpp b/microkde/kdeui/kaction.cpp index 77d36a5..d38a6d5 100644 --- a/microkde/kdeui/kaction.cpp +++ b/microkde/kdeui/kaction.cpp @@ -212,7 +212,6 @@ KAction::KAction( QObject* parent, const char* name ) KAction::~KAction() { - kdDebug(129) << "KAction::~KAction( this = \"" << name() << "\" )" << endl; // -- ellis #ifndef KDE_NO_COMPAT if (d->m_kaccel) unplugAccel(); @@ -435,7 +434,8 @@ bool KAction::setShortcut( const KShortcut& cut ) bool KAction::updateKAccelShortcut( KAccel* kaccel ) { - qDebug("KAction::updateKAccelShortcut~ ...1 has top be fixed"); + //qDebug("KAction::updateKAccelShortcut~ ...1 has top be fixed"); + // Check if action is permitted /*US if (kapp && !kapp->authorizeKAction(name())) @@ -462,7 +462,8 @@ bool KAction::updateKAccelShortcut( KAccel* kaccel ) void KAction::insertKAccel( KAccel* kaccel ) { - qDebug("KAction::updateKAccelShortcut~ ...1 has top be fixed"); + //qDebug("KAction::updateKAccelShortcut~ ...1 has top be fixed"); + /*US //kdDebug(129) << "KAction::insertKAccel( " << kaccel << " ): this = " << this << endl; if ( !kaccel->actions().actionPtr( name() ) ) { @@ -478,7 +479,8 @@ void KAction::insertKAccel( KAccel* kaccel ) void KAction::removeKAccel( KAccel* kaccel ) { - qDebug("KAction::removeKAccel~ ...1 has top be fixed"); + // qDebug("KAction::removeKAccel~ ...1 has top be fixed"); + /*US //kdDebug(129) << "KAction::removeKAccel( " << i << " ): this = " << this << endl; for( uint i = 0; i < d->m_kaccelList.count(); i++ ) { @@ -511,7 +513,8 @@ void KAction::updateShortcut( int i ) else if ( w->inherits( "QMenuBar" ) ) //US static_cast(w)->setAccel( d->m_cut.keyCodeQt(), id ); //US (QMenuBar*)(w)->setAccel( d->m_cut.keyCodeQt(), id ); - qDebug("KAction::updateShortcut( int i ) ...1 has top be fixed"); + + ; //qDebug("KAction::updateShortcut( int i ) ...1 has top be fixed"); } @@ -539,7 +542,9 @@ void KAction::updateShortcut( QPopupMenu* menu, int id ) kdWarning(129) << "KAction::updateShortcut(): name = \"" << name() << "\", cut = " << d->m_cut.toStringInternal() << "; No KAccel, probably missing a parent collection." << endl; } */ - qDebug("KAction::updateShortcut( QPopupMenu* menu, int id ) ...1 has top be fixed"); + + +//qDebug("KAction::updateShortcut( QPopupMenu* menu, int id ) ...1 has top be fixed"); } @@ -565,7 +570,7 @@ void KAction::setShortcutText( const QString& s ) int KAction::accel() const { - qDebug("KAction::accel() ...1 has top be fixed"); + // qDebug("KAction::accel() ...1 has top be fixed"); //US return d->m_cut.keyCodeQt(); return 0; } @@ -601,7 +606,7 @@ bool KAction::isShortcutConfigurable() const void KAction::setToolTip( const QString& tt ) { - qDebug("KAction::setToolTip ...1 has top be fixed"); + //qDebug("KAction::setToolTip ...1 has top be fixed"); d->setToolTip( tt ); int len = containerCount(); @@ -611,7 +616,7 @@ void KAction::setToolTip( const QString& tt ) void KAction::updateToolTip( int i ) { - qDebug("KAction::updateToolTip ...1 has top be fixed"); + //qDebug("KAction::updateToolTip ...1 has top be fixed"); QWidget *w = container( i ); if ( w->inherits( "KToolBar" ) ) @@ -633,14 +638,7 @@ int KAction::plug( QWidget *w, int index ) return -1; } -#ifndef NDEBUG - KAccel* kaccel = kaccelCurrent(); - // If there is a shortcut, but no KAccel available - if( !d->m_cut.isNull() && kaccel == 0 ) { - kdWarning(129) << "KAction::plug(): has no KAccel object; this = " << this << " name = " << name() << " parentCollection = " << m_parentCollection << endl; // ellis -//US kdDebug(129) << kdBacktrace() << endl; - } -#endif + // Check if action is permitted //US if (kapp && !kapp->authorizeKAction(name())) @@ -775,7 +773,8 @@ void KAction::unplug( QWidget *w ) void KAction::plugAccel(KAccel *kacc, bool configurable) { - qDebug("KAction::plugAccel ...1 has top be fixed"); + // qDebug("KAction::plugAccel ...1 has top be fixed"); + /*US kdWarning(129) << "KAction::plugAccel(): call to deprecated action." << endl; kdDebug(129) << kdBacktrace() << endl; @@ -806,7 +805,7 @@ void KAction::plugAccel(KAccel *kacc, bool configurable) void KAction::unplugAccel() { - qDebug("KAction::unplugAccel ...1 has top be fixed"); + // qDebug("KAction::unplugAccel ...1 has top be fixed"); /*US //kdDebug(129) << "KAction::unplugAccel() " << this << " " << name() << endl; if ( d->m_kaccel ) @@ -819,7 +818,8 @@ void KAction::unplugAccel() void KAction::plugMainWindowAccel( QWidget *w ) { - qDebug("KAction::plugMainWindowAccel ...1 has top be fixed"); + // qDebug("KAction::plugMainWindowAccel ...1 has top be fixed"); + /*US // Note: topLevelWidget() stops too early, we can't use it. QWidget * tl = w; @@ -915,7 +915,7 @@ void KAction::updateText( int i ) static_cast(w)->changeItem( itemId( i ), d->text() ); else if ( w->inherits( "KToolBar" ) ) { - qDebug("KAction::updateText ...3 has top be fixed"); + //qDebug("KAction::updateText ...3 has top be fixed"); QWidget *button = static_cast(w)->getWidget( itemId( i ) ); if ( button->inherits( "KToolBarButton" ) ) static_cast(button)->setText( d->plainText() ); @@ -1118,7 +1118,7 @@ void KAction::slotActivated() void KAction::slotDestroyed() { - kdDebug(129) << "KAction::slotDestroyed(): this = " << this << ", name = \"" << name() << "\", sender = " << sender() << endl; + const QObject* o = sender(); /* -- cgit v0.9.0.2