summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp62
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp56
-rw-r--r--kaddressbook/mainembedded.cpp15
-rw-r--r--kaddressbook/nameeditdialog.cpp7
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp2
-rw-r--r--korganizer/calendarview.cpp8
-rw-r--r--libkdepim/addresseeview.cpp10
-rw-r--r--libkdepim/kdateedit.cpp17
-rw-r--r--libkdepim/kdateedit.h3
-rw-r--r--microkde/kdeui/kaction.cpp44
10 files changed, 144 insertions, 80 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 6b282e2..4cdd5e5 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -788,61 +788,65 @@ Agent Addressee::agent() const
{
return mData->agent;
}
QString Addressee::agentLabel()
{
return i18n("Agent");
}
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( "" );
setGivenName( "" );
setAdditionalName( "" );
setFamilyName( "" );
setSuffix( "" );
if ( str.isEmpty() )
return;
int i = str.find(',');
if( i < 0 ) {
QStringList parts = QStringList::split( " ", str );
int leftOffset = 0;
int rightOffset = parts.count() - 1;
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 3cfc1f2..826c69b 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -74,33 +74,32 @@
#include "emaileditwidget.h"
#include "kabcore.h"
#include "kabprefs.h"
#include "addresseeeditorwidget.h"
AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension,
QWidget *parent, const char *name )
: ExtensionWidget( core, parent, name ), mIsExtension( isExtension ),
mBlockSignals( false )
{
mAConfig = AddresseeConfig::instance();
- kdDebug(5720) << "AddresseeEditorWidget()" << endl;
mFormattedNameType = NameEditDialog::CustomName;
initGUI();
mCategoryDialog = 0;
mCategoryEditDialog = 0;
// Load the empty addressee as defaults
load();
mDirty = false;
}
AddresseeEditorWidget::~AddresseeEditorWidget()
{
kdDebug(5720) << "~AddresseeEditorWidget()" << endl;
}
@@ -619,32 +618,33 @@ void AddresseeEditorWidget::setupTab2()
layout->addWidget( mNicknameEdit, 6, 2 );
label = new QLabel( i18n( "Spouse's name:" ), tab2 );
//US layout->addWidget( label, 5, 1 );
layout->addWidget( label, 7, 1 );
mSpouseEdit = new KLineEdit( tab2 );
connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mSpouseEdit );
//US layout->addWidget( mSpouseEdit, 5, 2 );
layout->addWidget( mSpouseEdit, 7, 2 );
label = new QLabel( i18n( "Birthday:" ), tab2 );
//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 ) ) );
#ifndef KAB_EMBEDDED
//US invalid dates are handdled by the KDateEdit widget itself
connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ),
SLOT( invalidDate() ) );
connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ),
SLOT( emitModified() ) );
#endif //KAB_EMBEDDED
label->setBuddy( mBirthdayPicker );
//US layout->addWidget( mBirthdayPicker, 4, 4 );
layout->addWidget( mBirthdayPicker, 8, 2 );
@@ -934,33 +934,32 @@ void AddresseeEditorWidget::setupTab3_1()
connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop );
/*US
//////////////////////////////////////
// Keys
mKeyWidget = new KeyWidget( tab3 );
mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
*/
mTabWidget->addTab( tab3, i18n( "&Images" ) );
}
void AddresseeEditorWidget::load()
{
- kdDebug(5720) << "AddresseeEditorWidget::load()" << endl;
// Block signals in case anything tries to emit modified
// CS: This doesn't seem to work.
bool block = signalsBlocked();
blockSignals( true );
mBlockSignals = true; // used for internal signal blocking
mNameEdit->setText( mAddressee.assembledName() );
if ( mAddressee.formattedName().isEmpty() ) {
//US KConfig config( "kaddressbookrc" );
KConfig config( locateLocal("config", "kaddressbookrc") );
config.setGroup( "General" );
mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 );
mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
} else {
@@ -1015,74 +1014,81 @@ void AddresseeEditorWidget::load()
mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) );
mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) );
mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) );
mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) );
mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) );
mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) );
mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) );
blockSignals( block );
mBlockSignals = false;
mDirty = false;
}
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() ) );
mAddressee.setGeo( mGeoWidget->geo() );
mAddressee.setPhoto( mImageWidget->photo() );
mAddressee.setLogo( mImageWidget->logo() );
mAddressee.setKeys( mKeyWidget->keys() );
#ifndef KAB_EMBEDDED
mAddressee.setSound( mSoundWidget->sound() );
#else //KAB_EMBEDDED
//US qDebug("AddresseeEditorWidget::save sound not supported");
#endif //KAB_EMBEDDED
mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
// save custom fields
mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
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();
QStringList::Iterator iter;
for ( iter = emails.begin(); iter != emails.end(); ++iter )
mAddressee.removeEmail( *iter );
emails = mEmailWidget->emails();
bool first = true;
for ( iter = emails.begin(); iter != emails.end(); ++iter ) {
mAddressee.insertEmail( *iter, first );
first = false;
}
// Save the phone numbers
KABC::PhoneNumber::List phoneNumbers;
@@ -1101,44 +1107,64 @@ void AddresseeEditorWidget::save()
KABC::Address::List addresses;
KABC::Address::List::Iterator addressIter;
addresses = mAddressee.addresses();
for ( addressIter = addresses.begin(); addressIter != addresses.end();
++addressIter )
mAddressee.removeAddress( *addressIter );
addresses = mAddressEditWidget->addresses();
for ( addressIter = addresses.begin(); addressIter != addresses.end();
++addressIter )
mAddressee.insertAddress( *addressIter );
mDirty = false;
}
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;
}
void AddresseeEditorWidget::nameTextChanged( const QString &text )
{
// use the addressee class to parse the name for us
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;
addr.setNameFromString( text );
mAddressee.setPrefix( addr.prefix() );
mAddressee.setGivenName( addr.givenName() );
mAddressee.setAdditionalName( addr.additionalName() );
mAddressee.setFamilyName( addr.familyName() );
mAddressee.setSuffix( addr.suffix() );
}
}
nameBoxChanged();
emitModified();
}
@@ -1156,33 +1182,33 @@ void AddresseeEditorWidget::nameBoxChanged()
mNameEdit->hide();
mNameLabel->setText( mNameEdit->text() );
mNameLabel->show();
}
if ( mFormattedNameType != NameEditDialog::CustomName ) {
mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
}
}
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() );
mAddressee.setPrefix( dialog.prefix() );
mAddressee.setSuffix( dialog.suffix() );
mAddressee.setAdditionalName( dialog.additionalName() );
mFormattedNameType = dialog.formattedNameType();
if ( mFormattedNameType == NameEditDialog::CustomName ) {
mFormattedNameLabel->setText( dialog.customFormattedName() );
mAddressee.setFormattedName( dialog.customFormattedName() );
}
// Update the name edit.
bool block = mNameEdit->signalsBlocked();
mNameEdit->blockSignals( true );
mNameEdit->setText( mAddressee.assembledName() );
mNameEdit->blockSignals( block );
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index d781f67..4230c07 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -58,32 +58,47 @@ int main( int argc, char **argv )
if ( QApplication::desktop()->width() > 320 )
KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
else
KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
#else
QString fileName ;
fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
QApplication::addLibraryPath ( qApp->applicationDirPath () );
#endif
KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
KAddressBookMain m ;
//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
a.setMainWidget( &m );
m.resize (640, 480 );
m.show();
#endif
a.exec();
}
qDebug("KA: Bye! ");
}
/*
#include <stdlib.h>
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp
index fb7eb22..8213c2b 100644
--- a/kaddressbook/nameeditdialog.cpp
+++ b/kaddressbook/nameeditdialog.cpp
@@ -96,33 +96,33 @@ NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type,
label->setBuddy( mSuffixCombo );
layout->addMultiCellWidget( mSuffixCombo, 4, 4, 1, 2 );
mFormattedNameCombo = new KComboBox( page );
mFormattedNameCombo->setMaximumWidth(100);
layout->addMultiCellWidget( mFormattedNameCombo, 5, 5, 0, 0 );
connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( typeChanged( int ) ) );
mFormattedNameEdit = new KLineEdit( page );
mFormattedNameEdit->setEnabled( type == CustomName );
layout->addMultiCellWidget( mFormattedNameEdit, 5, 5, 1, 2 );
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() );
mGivenNameEdit->setText( addr.givenName() );
mAdditionalNameEdit->setText( addr.additionalName() );
mFormattedNameEdit->setText( addr.formattedName() );
// Prefix and suffix combos
//US KConfig config( "kabcrc" );
KConfig config( locateLocal("config", "kabcrc") );
config.setGroup( "General" );
QStringList sTitle;
sTitle += i18n( "Dr." );
sTitle += i18n( "Miss" );
sTitle += i18n( "Mr." );
@@ -162,36 +162,33 @@ NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type,
connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( modified() ) );
connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
updateTypeCombo();
mFormattedNameCombo->setCurrentItem( type );
-#ifdef KAB_EMBEDDED
- resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300));
-#endif //KAB_EMBEDDED
-
+
mChanged = false;
}
NameEditDialog::~NameEditDialog()
{
}
QString NameEditDialog::familyName() const
{
return mFamilyNameEdit->text();
}
QString NameEditDialog::givenName() const
{
return mGivenNameEdit->text();
}
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
@@ -24,32 +24,34 @@ Genericwrapper::~Genericwrapper()
}
if (m_storage) {
mailstorage_free(m_storage);
}
cleanMimeCache();
}
QString Genericwrapper::parseDateTime( mailimf_date_time *date )
{
static bool init = false ;
if ( ! init ) {
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)") );
init = true;
}
QDate da (date->dt_year,date->dt_month, date->dt_day );
QTime ti ( date->dt_hour, date->dt_min, date->dt_sec );
QDateTime dt ( da ,ti );
int off = KGlobal::locale()->localTimeOffset( dt );
//dt = dt.addSecs( off*60 );
QString ret;
if ( da == QDate::currentDate () )
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index d5d31e2..258bd43 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1247,35 +1247,37 @@ void CalendarView::syncExternal( int mode )
KOPrefs::instance()->mPhoneConnection,
KOPrefs::instance()->mPhoneModel);
loadSuccess = phoneFormat->load( calendar,mCalendar);
} else
return;
if ( loadSuccess ) {
getEventViewerDialog()->setSyncMode( true );
syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
getEventViewerDialog()->setSyncMode( false );
qApp->processEvents();
if ( syncOK ) {
if ( KOPrefs::instance()->mWriteBackFile )
{
QPtrList<Incidence> 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 )
sharpFormat->save(calendar);
#endif
if ( phoneFormat )
phoneFormat->save(calendar);
iL = calendar->rawIncidences();
inc = iL.first();
Incidence* loc;
while ( inc ) {
if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
loc = mCalendar->incidence(inc->uid() );
if ( loc ) {
loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp
index d710541..5c69010 100644
--- a/libkdepim/addresseeview.cpp
+++ b/libkdepim/addresseeview.cpp
@@ -52,33 +52,33 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name )
{
//US setWrapPolicy( QTextEdit::AtWordBoundary );
setLinkUnderline( false );
// setVScrollBarMode( QScrollView::AlwaysOff );
//setHScrollBarMode( QScrollView::AlwaysOff );
//US QStyleSheet *sheet = styleSheet();
//US QStyleSheetItem *link = sheet->item( "a" );
//US link->setColor( KGlobalSettings::linkColor() );
}
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) );
else if ( n.left( 7 ) == "phoneto" )
ExternalAppHandler::instance()->callByPhone( n.mid(8) );
else if ( n.left( 5 ) == "faxto" )
ExternalAppHandler::instance()->callByFax( n.mid(6) );
else if ( n.left( 5 ) == "smsto" )
ExternalAppHandler::instance()->callBySMS( n.mid(6) );
else if ( n.left( 7 ) == "pagerto" )
ExternalAppHandler::instance()->callByPager( n.mid(8) );
}
void AddresseeView::setAddressee( const KABC::Addressee& addr )
{
ExternalAppHandler* eah = ExternalAppHandler::instance();
@@ -111,33 +111,39 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr )
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
.arg( type )
.arg( name )
.arg( *emailIt )
.arg( *emailIt );
++emailIt;
} else {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>" )
.arg( type )
.arg( *emailIt );
++emailIt;
}
}
-
+ if ( mAddressee.birthday().date().isValid() ) {
+ dynamicPart += QString(
+ "<tr><td align=\"right\"><b>%1</b></td>"
+ "<td align=\"left\">%2</td></tr>" )
+ .arg( i18n ("Birthday") )
+ .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) );
+ }
KABC::PhoneNumber::List phones = mAddressee.phoneNumbers();
KABC::PhoneNumber::List::ConstIterator phoneIt;
QString extension;
int phonetype;
QString sms;
for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
phonetype = (*phoneIt).type();
if (ksmsAvail &&
(
((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) ||
((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell)
)
)
{
sms = QString("<a href=\"smsto:%1 \">(sms)</a>" )
.arg( (*phoneIt).number() );
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp
index 5fb948a..c4c0081 100644
--- a/libkdepim/kdateedit.cpp
+++ b/libkdepim/kdateedit.cpp
@@ -111,33 +111,39 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP )
dayName = KGlobal::locale()->weekDayName(i).lower();
if (i >= currentDay)
mKeywordMap[dayName] = i - currentDay;
else
mKeywordMap[dayName] = 7 - currentDay + i;
}
mTextChanged = false;
mHandleInvalid = false;
QWidget::setTabOrder( mDateEdit, mDateButton );
}
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)
return;
if ( readDate() == newDate )
return;
QString dateString = "";
if(newDate.isValid())
dateString = KGlobal::locale()->formatDate( newDate, dateFormShort );
mTextChanged = false;
// We do not want to generate a signal here, since we explicity setting
// the date
bool b = mDateEdit->signalsBlocked();
mDateEdit->blockSignals(true);
@@ -450,37 +456,42 @@ QDate KDateEdit::readDate() const
return date;
}
bool KDateEdit::eventFilter(QObject *, QEvent *e)
{
// We only process the focus out event if the text has changed
// since we got focus
if ((e->type() == QEvent::FocusOut) && mTextChanged)
{
lineEnterPressed();
mTextChanged = false;
}
// 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)
{
maxDay = readDate().day();
}
return false;
}
+void KDateEdit::toggleDateFormat()
+{
+ dateFormShort = ! dateFormShort;
+ mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort));
+
+}
void KDateEdit::textChanged(const QString &)
{
if(mHandleInvalid && mDateEdit->text().stripWhiteSpace().isEmpty()) {
QDate date; //invalid date
emit(dateChanged(date));
} else {
mTextChanged = true;
}
maxDay = readDate().day();
}
diff --git a/libkdepim/kdateedit.h b/libkdepim/kdateedit.h
index 742d843..cf3b90a 100644
--- a/libkdepim/kdateedit.h
+++ b/libkdepim/kdateedit.h
@@ -65,33 +65,34 @@ class KDateEdit : public QHBox
/** @return The date entered. This will not
* modify the display of the date, but only return it.
*/
QDate date() const;
/** @param handleInvalid If true the date edit accepts invalid dates
* and displays them as the empty ("") string. It also returns an invalid date.
* If false (default) invalid dates are not accepted and instead the date
* of today will be returned.
*/
void setHandleInvalid(bool handleInvalid);
/** Checks for a focus out event. The display of the date is updated
* 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
* focus leaves the widget (ie: the user confirms their selection).
*/
void dateChanged(QDate);
void returnPressed();
public slots:
/** Sets the date.
*
* @param date The new date to display. This date must be valid or
* it will not be displayed.
*/
void setDate(QDate date);
// set Date with key_up key_down to relation of cursor Position
// and set selection from begin to end of single date
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
@@ -199,33 +199,32 @@ KAction::KAction( const QString& text, const QString& pix,
: QObject( parent, name )
{
initPrivate( text, cut, receiver, slot );
d->setIconName(pix);
}
KAction::KAction( QObject* parent, const char* name )
: QObject( parent, name )
{
initPrivate( QString::null, KShortcut(), 0, 0 );
}
// KDE 4: remove end
KAction::~KAction()
{
- kdDebug(129) << "KAction::~KAction( this = \"" << name() << "\" )" << endl; // -- ellis
#ifndef KDE_NO_COMPAT
if (d->m_kaccel)
unplugAccel();
#endif
// If actionCollection hasn't already been destructed,
if ( m_parentCollection ) {
m_parentCollection->take( this );
for( uint i = 0; i < d->m_kaccelList.count(); i++ )
//US d->m_kaccelList[i]->remove( name() );
qDebug("KAction::KAction~ ...1 has top be fixed");
}
// Do not call unplugAll from here, as tempting as it sounds.
// KAction is designed around the idea that you need to plug
// _and_ to unplug it "manually". Unplugging leads to an important
@@ -422,163 +421,169 @@ bool KAction::setShortcut( const KShortcut& cut )
if( bChanged ) {
// KDE 4: remove
if ( d->m_kaccel )
d->m_kaccel->setShortcut( name(), cut );
// KDE 4: remove end
int len = containerCount();
for( int i = 0; i < len; ++i )
updateShortcut( i );
}
*/
return true;
}
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()))
return false;
bool b = true;
if ( !kaccel->actions().actionPtr( name() ) ) {
if(!d->m_cut.isNull() ) {
kdDebug(129) << "Inserting " << name() << ", " << d->text() << ", " << d->plainText() << endl;
b = kaccel->insert( name(), d->plainText(), QString::null,
d->m_cut,
this, SLOT(slotActivated()),
isShortcutConfigurable(), isEnabled() );
}
}
else
b = kaccel->setShortcut( name(), d->m_cut );
return b;
*/
return true;
}
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() ) ) {
if( updateKAccelShortcut( kaccel ) ) {
d->m_kaccelList.append( kaccel );
connect( kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) );
}
}
else
kdWarning(129) << "KAction::insertKAccel( kaccel = " << kaccel << " ): KAccel object already contains an action name \"" << name() << "\"" << endl; // -- ellis
*/
}
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++ ) {
if( d->m_kaccelList[i] == kaccel ) {
kaccel->remove( name() );
d->m_kaccelList.remove( d->m_kaccelList.at( i ) );
disconnect( kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) );
break;
}
}
*/
}
// KDE 4: remove
void KAction::setAccel( int keyQt )
{
setShortcut( KShortcut(keyQt) );
}
// KDE 4: remove end
void KAction::updateShortcut( int i )
{
int id = itemId( i );
QWidget* w = container( i );
if ( w->inherits( "QPopupMenu" ) ) {
QPopupMenu* menu = static_cast<QPopupMenu*>(w);
updateShortcut( menu, id );
}
else if ( w->inherits( "QMenuBar" ) )
//US static_cast<QMenuBar*>(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");
}
void KAction::updateShortcut( QPopupMenu* menu, int id )
{
/*US
//kdDebug(129) << "KAction::updateShortcut(): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl;
// If the action has a KAccel object,
// show the string representation of its shortcut.
if ( d->m_kaccel || d->m_kaccelList.count() ) {
QString s = menu->text( id );
int i = s.find( '\t' );
if ( i >= 0 )
s.replace( i+1, s.length()-i, d->m_cut.seq(0).toString() );
else
s += "\t" + d->m_cut.seq(0).toString();
menu->changeItem( id, s );
}
// Otherwise insert the shortcut itself into the popup menu.
else {
// This is a fall-hack in case the KAction is missing a proper parent collection.
// It should be removed eventually. --ellis
menu->setAccel( d->m_cut.keyCodeQt(), 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");
}
const KShortcut& KAction::shortcut() const
{
return d->m_cut;
}
const KShortcut& KAction::shortcutDefault() const
{
return d->m_cutDefault;
}
QString KAction::shortcutText() const
{
return d->m_cut.toStringInternal();
}
void KAction::setShortcutText( const QString& s )
{
setShortcut( KShortcut(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;
}
void KAction::setGroup( const QString& grp )
{
d->m_group = grp;
int len = containerCount();
for( int i = 0; i < len; ++i )
updateGroup( i );
}
void KAction::updateGroup( int )
{
// DO SOMETHING
@@ -588,72 +593,65 @@ QString KAction::group() const
{
return d->m_group;
}
bool KAction::isEnabled() const
{
return d->isEnabled();
}
bool KAction::isShortcutConfigurable() const
{
return d->m_configurable;
}
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();
for( int i = 0; i < len; ++i )
updateToolTip( i );
}
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" ) )
QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() );
else if ( w->inherits( "QToolBar" ) )
QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() );
}
QString KAction::toolTip() const
{
return d->toolTip();
}
int KAction::plug( QWidget *w, int index )
{
//kdDebug(129) << "KAction::plug( " << w << ", " << index << " )" << endl;
if (w == 0) {
kdWarning(129) << "KAction::plug called with 0 argument\n";
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()))
//US return -1;
plugShortcut();
if ( w->inherits("QPopupMenu") )
{
QPopupMenu* menu = static_cast<QPopupMenu*>( w );
int id;
// Don't insert shortcut into menu if it's already in a KAccel object.
//qDebug("KAction::plug warning: real shortcuts not available yet. ");
//US int keyQt = (d->m_kaccelList.count() || d->m_kaccel) ? 0 : d->m_cut.keyCodeQt();
int keyQt = 0;
@@ -762,77 +760,79 @@ void KAction::unplug( QWidget *w )
bar->removeItemDelayed( id );
}
else if ( w->inherits( "QMenuBar" ) )
{
QMenuBar *bar = static_cast<QMenuBar *>( w );
bar->removeItem( id );
}
removeContainer( i );
if ( m_parentCollection )
m_parentCollection->disconnectHighlight( w, this );
}
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;
//kdDebug(129) << "KAction::plugAccel( kacc = " << kacc << " ): name \"" << name() << "\"" << endl;
if ( d->m_kaccel )
unplugAccel();
// If the parent collection's accel ptr isn't set yet
//if ( m_parentCollection && !m_parentCollection->accel() )
// m_parentCollection->setAccel( kacc );
// We can only plug this action into the given KAccel object
// if it does not already contain an action with the same name.
if ( !kacc->actions().actionPtr(name()) )
{
d->m_kaccel = kacc;
d->m_kaccel->insert(name(), d->plainText(), QString::null,
KShortcut(d->m_cut),
this, SLOT(slotActivated()),
configurable, isEnabled());
connect(d->m_kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()));
//connect(d->m_kaccel, SIGNAL(keycodeChanged()), this, SLOT(slotKeycodeChanged()));
}
else
kdWarning(129) << "KAction::plugAccel( kacc = " << kacc << " ): KAccel object already contains an action name \"" << name() << "\"" << endl; // -- ellis
*/
}
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 )
{
d->m_kaccel->remove(name());
d->m_kaccel = 0;
}
*/
}
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;
QWidget * n;
while ( !tl->isDialog() && ( n = tl->parentWidget() ) ) // lookup parent and store
tl = n;
KMainWindow * mw = dynamic_cast<KMainWindow *>(tl); // try to see if it's a kmainwindow
if (mw)
plugAccel( mw->accel() );
else
kdDebug(129) << "KAction::plugMainWindowAccel: Toplevel widget isn't a KMainWindow, can't plug accel. " << tl << endl;
*/
}
void KAction::setEnabled(bool enable)
@@ -902,33 +902,33 @@ void KAction::setText( const QString& text )
}
void KAction::updateText( int i )
{
QWidget *w = container( i );
if ( w->inherits( "QPopupMenu" ) ) {
int id = itemId( i );
static_cast<QPopupMenu*>(w)->changeItem( id, d->text() );
updateShortcut( static_cast<QPopupMenu*>(w), id );
}
else if ( w->inherits( "QMenuBar" ) )
static_cast<QMenuBar*>(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<KToolBar *>(w)->getWidget( itemId( i ) );
if ( button->inherits( "KToolBarButton" ) )
static_cast<KToolBarButton *>(button)->setText( d->plainText() );
}
}
QString KAction::text() const
{
return d->text();
}
QString KAction::plainText() const
{
return d->plainText( );
}
@@ -1105,33 +1105,33 @@ void KAction::addContainer( QWidget* c, QWidget* w )
p.m_representative = w;
d->m_containers.append( p );
}
void KAction::activate()
{
slotActivated();
}
void KAction::slotActivated()
{
emit activated();
}
void KAction::slotDestroyed()
{
- kdDebug(129) << "KAction::slotDestroyed(): this = " << this << ", name = \"" << name() << "\", sender = " << sender() << endl;
+
const QObject* o = sender();
/*
// KDE 4: remove
if ( o == d->m_kaccel )
{
d->m_kaccel = 0;
return;
}
// KDE 4: remove end
for( uint i = 0; i < d->m_kaccelList.count(); i++ )
{
if ( o == d->m_kaccelList[i] )