summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-06-29 16:14:46 (UTC)
committer zautrix <zautrix>2005-06-29 16:14:46 (UTC)
commit77aa480c9891a90c9b492618ebfd2b20f2d0727a (patch) (side-by-side diff)
tree4f2c278d016fe21f280f8ee6abbca34685aada96 /kaddressbook
parente0fa858c284dddf0d47146e666c4ece7158487be (diff)
downloadkdepimpi-77aa480c9891a90c9b492618ebfd2b20f2d0727a.zip
kdepimpi-77aa480c9891a90c9b492618ebfd2b20f2d0727a.tar.gz
kdepimpi-77aa480c9891a90c9b492618ebfd2b20f2d0727a.tar.bz2
many sync fixes
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp6
-rw-r--r--kaddressbook/kabcore.cpp5
-rw-r--r--kaddressbook/kabcore.h1
3 files changed, 8 insertions, 4 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index bd32859..5334a0e 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -614,119 +614,119 @@ void AddresseeEditorWidget::setupTab2()
if ( QApplication::desktop()->width() == 640 ) {
QHBox * nbox = new QHBox ( tab2 );
label = new QLabel( i18n( "Nick name:" )+" ", nbox );
mNicknameEdit = new KLineEdit( nbox );
connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mNicknameEdit );
label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox );
mSpouseEdit = new KLineEdit( nbox );
connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mSpouseEdit );
layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
++iii;
} else {
label = new QLabel( i18n( "Nick name:" ), tab2 );
layout->addWidget( label, iii, 1 );
mNicknameEdit = new KLineEdit( tab2 );
connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mNicknameEdit );
layout->addWidget( mNicknameEdit, iii, 2 );
++iii;
label = new QLabel( i18n( "Spouse's name:" ), tab2 );
layout->addWidget( label, iii, 1 );
mSpouseEdit = new KLineEdit( tab2 );
connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mSpouseEdit );
layout->addWidget( mSpouseEdit, iii, 2 );
++iii;
}
label = new QLabel( i18n( "Children's names:" ), tab2 );
layout->addWidget( label, iii, 1 );
mChildEdit = new KLineEdit( tab2 );
connect( mChildEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mChildEdit );
layout->addWidget( mChildEdit, iii, 2 );
++iii;
if ( QApplication::desktop()->width() == 640 ) {
QHBox * nbox = new QHBox ( tab2 );
label = new QLabel( i18n( "Birthday:" )+" ", nbox );
mBirthdayPicker = new KDateEdit( nbox );
- mBirthdayPicker->toggleDateFormat();
+ //mBirthdayPicker->toggleDateFormat();
mBirthdayPicker->setHandleInvalid( true );
connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
label->setBuddy( mBirthdayPicker );
label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox );
mAnniversaryPicker = new KDateEdit( nbox );
mAnniversaryPicker->setHandleInvalid( true );
connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
label->setBuddy( mAnniversaryPicker );
layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
++iii;
} else {
label = new QLabel( i18n( "Birthday:" ), tab2 );
layout->addWidget( label, iii, 1 );
mBirthdayPicker = new KDateEdit( tab2 );
- mBirthdayPicker->toggleDateFormat();
+ //mBirthdayPicker->toggleDateFormat();
mBirthdayPicker->setHandleInvalid( true );
connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
label->setBuddy( mBirthdayPicker );
layout->addWidget( mBirthdayPicker, iii, 2 );
++iii;
label = new QLabel( i18n( "Anniversary:" ), tab2 );
layout->addWidget( label, iii, 1 );
mAnniversaryPicker = new KDateEdit( tab2 );
mAnniversaryPicker->setHandleInvalid( true );
connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
label->setBuddy( mAnniversaryPicker );
layout->addWidget( mAnniversaryPicker, iii, 2 );
++iii;
}
label = new QLabel( i18n( "Gender:" ), tab2 );
layout->addWidget( label, iii, 1 );
mGenderBox = new QComboBox ( tab2 );
mGenderBox->insertItem ( i18n( "ALIEN (gender undefined)" ));
mGenderBox->insertItem ( i18n( "female" ));
mGenderBox->insertItem ( i18n( "male" ));
connect( mGenderBox, SIGNAL( activated ( const QString & ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mGenderBox );
layout->addWidget( mGenderBox, iii, 2 );
++iii;
// Build the layout and add to the tab widget
layout->activate(); // required
mTabWidget->addTab( tab2, i18n( "&Details" ) );
}
void AddresseeEditorWidget::setupTab2_1()
{
// This is the Details tab
QWidget *tab2_2 = new QWidget( mTabWidget );
QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 );
layout->setMargin( KDialogBase::marginHintSmall() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
QLabel *label;
@@ -1034,98 +1034,96 @@ void AddresseeEditorWidget::load()
mGeoWidget->setGeo( mAddressee.geo() );
mImageWidget->setPhoto( mAddressee.photo() );
mImageWidget->setLogo( mAddressee.logo() );
mKeyWidget->setKeys( mAddressee.keys() );
mSecrecyWidget->setSecrecy( mAddressee.secrecy() );
#ifndef KAB_EMBEDDED
mSoundWidget->setSound( mAddressee.sound() );
#else //KAB_EMBEDDED
//US qDebug("AddresseeEditorWidget::load has to be changed 2");
#endif //KAB_EMBEDDED
// Load customs
mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) );
mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) );
mChildEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Children" ) );
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" ) );
QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
if ( gen == "female" )
mGenderBox->setCurrentItem ( 1 );
else if ( gen == "male" )
mGenderBox->setCurrentItem ( 2 );
else
mGenderBox->setCurrentItem ( 0 );
blockSignals( block );
mBlockSignals = false;
mDirty = false;
}
void AddresseeEditorWidget::save()
{
if ( !dirty() ) {
return;
}
mAddressee.setRevision( QDateTime::currentDateTime() );
mAddressee.setRole( mRoleEdit->text() );
mAddressee.setOrganization( mOrgEdit->text() );
mAddressee.setUrl( KURL( mURLEdit->text() ) );
mAddressee.setNote( mNoteEdit->text() );
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-Children", mChildEdit->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() ) {
QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
}
else {
mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
mAnniversaryPicker->clear();
}
int gen = mGenderBox->currentItem ();
if ( gen == 1 )
mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female");
else if ( gen == 2 )
mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male");
else
mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" );
// Save the email addresses
QStringList emails = mAddressee.emails();
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 3715786..046cb63 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -330,96 +330,97 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
"X-IMAddress", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
"X-Anniversary", "KADDRESSBOOK" );
//US added this field to become compatible with Opie/qtopia addressbook
// values can be "female" or "male" or "". An empty field represents undefined.
mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
"X-Gender", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
"X-Children", "KADDRESSBOOK" );
mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
"X-FreeBusyUrl", "KADDRESSBOOK" );
#endif
initGUI();
mIncSearchWidget->setFocus();
connect( mViewManager, SIGNAL( selected( const QString& ) ),
SLOT( setContactSelected( const QString& ) ) );
connect( mViewManager, SIGNAL( executed( const QString& ) ),
SLOT( executeContact( const QString& ) ) );
connect( mViewManager, SIGNAL( deleteRequest( ) ),
SLOT( deleteContacts( ) ) );
connect( mViewManager, SIGNAL( modified() ),
SLOT( setModified() ) );
connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
connect( mXXPortManager, SIGNAL( modified() ),
SLOT( setModified() ) );
connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
SLOT( incrementalSearchJump( const QString& ) ) );
connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
mJumpButtonBar, SLOT( recreateButtons() ) );
connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
SLOT( sendMail( const QString& ) ) );
connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
+ connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync()));
connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog()));
#ifndef KAB_EMBEDDED
connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
mXXPortManager, SLOT( importVCard( const KURL& ) ) );
connect( mDetails, SIGNAL( browse( const QString& ) ),
SLOT( browse( const QString& ) ) );
mAddressBookService = new KAddressBookService( this );
#endif //KAB_EMBEDDED
mMessageTimer = new QTimer( this );
connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
mEditorDialog = 0;
createAddresseeEditorDialog( this );
setModified( false );
mBRdisabled = false;
#ifndef DESKTOP_VERSION
infrared = 0;
#endif
//toggleBeamReceive( );
mMainWindow->toolBar()->show();
// we have a toolbar repainting error on the Zaurus when starting KA/Pi
QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
}
void KABCore::updateToolBar()
{
static int iii = 0;
++iii;
mMainWindow->toolBar()->repaintMe();
if ( iii < 4 )
QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar()));
}
KABCore::~KABCore()
{
// save();
//saveSettings();
//KABPrefs::instance()->writeConfig();
delete AddresseeConfig::instance();
mAddressBook = 0;
KABC::StdAddressBook::close();
delete syncManager;
@@ -2535,96 +2536,100 @@ void KABCore::configureResources()
if ( !dlg.exec() )
return;
KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
}
#endif //KAB_EMBEDDED
/* this method will be called through the QCop interface from Ko/Pi to select addresses
* for the attendees list of an event.
*/
void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
{
qDebug("KABCore::requestForNameEmailUidList ");
bool ok = false;
mEmailSourceChannel = sourceChannel;
mEmailSourceUID = uid;
QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) );
//callContactdialog();
#if 0
int wid = uid.toInt( &ok );
qDebug("UID %s ", uid.latin1());
if ( ok ) {
if ( wid != QApplication::desktop()->width() ) {
qDebug("KA/Pi: Request from different desktop geometry. Resizing ...");
message( i18n("Resizing, please wait...") );
mMainWindow->showMinimized();
/*
{
QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
}
*/
QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) );
return;
}
} else {
qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid ");
}
callContactdialog();
//QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
#endif
}
void KABCore::resizeAndCallContactdialog()
{
updateMainWindow();
QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) );
}
+void KABCore::doRingSync()
+{
+ syncManager->multiSync( false );
+}
void KABCore::callContactdialog()
{
static bool running = false;
if (running) return;
running = true;
QStringList nameList;
QStringList emailList;
QStringList uidList;
qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() );
KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
uint i=0;
for (i=0; i < list.count(); i++)
{
nameList.append(list[i].realName());
emailList.append(list[i].preferredEmail());
uidList.append(list[i].uid());
}
QString uid = mEmailSourceUID;
//qDebug("%s %s ", sourceChannel.latin1(), uid.latin1());
bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList);
running = false;
}
/* this method will be called through the QCop interface from Ko/Pi to select birthdays
* to put them into the calendar.
*/
void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
{
// qDebug("KABCore::requestForBirthdayList");
QStringList birthdayList;
QStringList anniversaryList;
QStringList realNameList;
QStringList preferredEmailList;
QStringList assembledNameList;
QStringList uidList;
KABC::AddressBook::Iterator it;
int count = 0;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
++count;
}
QProgressBar bar(count,0 );
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
int h = bar.sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 6479a58..ceeeda7 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -328,96 +328,97 @@ class KABCore : public QWidget, public KSyncInterface
*/
void openConfigDialog();
void openConfigGlobalDialog();
/**
Launches the ldap search dialog.
*/
void openLDAPDialog();
/**
Creates a KAddressBookPrinter, which will display the print
dialog and do the printing.
*/
void print();
/**
Registers a new GUI client, so plugins can register its actions.
*/
void addGUIClient( KXMLGUIClient *client );
void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
signals:
void contactSelected( const QString &name );
void contactSelected( const QPixmap &pixmap );
public slots:
void recieve(QString cmsg );
void getFile( bool success );
void syncFileRequest();
void setDetailsVisible( bool visible );
void setDetailsToState();
void saveSettings();
private slots:
void updateToolBar();
void updateMainWindow();
void receive( const QCString& cmsg, const QByteArray& data );
void toggleBeamReceive( );
void disableBR(bool);
void setJumpButtonBarVisible( bool visible );
void setJumpButtonBar( bool visible );
void setCaptionBack();
void resizeAndCallContactdialog();
void callContactdialog();
+ void doRingSync();
void importFromOL();
void extensionModified( const KABC::Addressee::List &list );
void extensionChanged( int id );
void clipboardDataChanged();
void updateActionMenu();
void configureKeyBindings();
void removeVoice();
void setFormattedName();
#ifdef KAB_EMBEDDED
void configureResources();
#endif //KAB_EMBEDDED
void slotEditorDestroyed( const QString &uid );
void configurationChanged();
void addressBookChanged();
private:
QString mEmailSourceChannel;
QString mEmailSourceUID;
void resizeEvent(QResizeEvent* e );
bool mBRdisabled;
#ifndef DESKTOP_VERSION
QCopChannel* infrared;
#endif
QTimer *mMessageTimer;
void initGUI();
void initActions();
QString getPhoneFile();
AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
const char *name = 0 );
KXMLGUIClient *mGUIClient;
KABC::AddressBook *mAddressBook;
ViewManager *mViewManager;
// QSplitter *mDetailsSplitter;
KDGanttMinimizeSplitter *mExtensionBarSplitter;
ViewContainer *mDetails;
KDGanttMinimizeSplitter* mMiniSplitter;
XXPortManager *mXXPortManager;
JumpButtonBar *mJumpButtonBar;
IncSearchWidget *mIncSearchWidget;
ExtensionManager *mExtensionManager;
KCMultiDialog *mConfigureDialog;