summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-09-18 08:25:05 (UTC)
committer zautrix <zautrix>2004-09-18 08:25:05 (UTC)
commit983b010853dfadfec3638e2afd90e522985f67fb (patch) (side-by-side diff)
treeb691b7664b9f6f23d0d92a0e05bf3e8cbcf2df67 /kaddressbook
parentdf03bd8c7ff6a738dd386001679542ae4b493a07 (diff)
downloadkdepimpi-983b010853dfadfec3638e2afd90e522985f67fb.zip
kdepimpi-983b010853dfadfec3638e2afd90e522985f67fb.tar.gz
kdepimpi-983b010853dfadfec3638e2afd90e522985f67fb.tar.bz2
more AB syncing
Diffstat (limited to 'kaddressbook') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp93
-rw-r--r--kaddressbook/kabcore.h5
2 files changed, 85 insertions, 13 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 49c3b19..e912941 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -150,2 +150,3 @@ $Id$
#include <libkdepim/ksyncprofile.h>
+#include <libkdepim/ksyncprefsdialog.h>
@@ -181,2 +182,4 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
+#if 0
+ // LP moved to addressbook init method
mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
@@ -206,3 +209,3 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
"X-FreeBusyUrl", "KADDRESSBOOK" );
-
+#endif
initGUI();
@@ -2197,4 +2200,4 @@ void KABCore::slotSyncMenu( int action )
if ( temp->getIsLocalFileSync() ) {
- if ( syncWithFile( temp->getRemoteFileName( ), false ) )
- KABPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
+ if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
+ KABPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
} else {
@@ -2319,3 +2322,3 @@ int KABCore::ringSync()
temp->readConfig(&config);
- if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
+ if ( temp->getIncludeInRingSyncAB() && ( i < 1 || i > 2 )) {
setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
@@ -2335,4 +2338,4 @@ int KABCore::ringSync()
if ( temp->getIsLocalFileSync() ) {
- if ( syncWithFile( temp->getRemoteFileName( ), true ) )
- KABPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
+ if ( syncWithFile( temp->getRemoteFileNameAB( ), true ) )
+ KABPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
} else {
@@ -2375,3 +2378,3 @@ void KABCore::syncRemote( KSyncProfile* prof, bool ask)
}
- QString command = prof->getPreSyncCommand();
+ QString command = prof->getPreSyncCommandAB();
int fi;
@@ -2407,3 +2410,3 @@ void KABCore::syncRemote( KSyncProfile* prof, bool ask)
//qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
- if ( syncWithFile( prof->getLocalTempFile(), true ) ) {
+ if ( syncWithFile( prof->getLocalTempFileAB(), true ) ) {
// Event* e = mView->getLastSyncEvent();
@@ -2413,3 +2416,3 @@ void KABCore::syncRemote( KSyncProfile* prof, bool ask)
if ( KABPrefs::instance()->mWriteBackFile ) {
- command = prof->getPostSyncCommand();
+ command = prof->getPostSyncCommandAB();
int fi;
@@ -2512,3 +2515,6 @@ QString KABCore::getPassword( )
}
+bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
+{
+}
bool KABCore::syncAB(QString filename, int mode)
@@ -2516,2 +2522,54 @@ bool KABCore::syncAB(QString filename, int mode)
+
+
+ mGlobalSyncMode = SYNC_MODE_NORMAL;
+ AddressBook abLocal(filename,"syncContact");
+ bool syncOK = false;
+ if ( abLocal.load() ) {
+ qDebug("AB loaded %s mode %d",filename.latin1(), mode );
+ AddressBook::Iterator it;
+ QStringList vcards;
+ for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
+ qDebug("Name %s ", (*it).familyName().latin1());
+ }
+ syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
+ if ( syncOK ) {
+ if ( KABPrefs::instance()->mWriteBackFile )
+ {
+ abLocal.saveAB();
+ }
+ }
+ setModified();
+
+ }
+ if ( syncOK )
+ ;//updateView();
+ return syncOK;
+#if 0
+ mGlobalSyncMode = SYNC_MODE_NORMAL;
+ CalendarLocal* calendar = new CalendarLocal();
+ calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
+ FileStorage* storage = new FileStorage( calendar );
+ bool syncOK = false;
+ storage->setFileName( filename );
+ // qDebug("loading ... ");
+ if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) {
+ getEventViewerDialog()->setSyncMode( true );
+ syncOK = synchronizeCalendar( mCalendar, calendar, mode );
+ getEventViewerDialog()->setSyncMode( false );
+ if ( syncOK ) {
+ if ( KOPrefs::instance()->mWriteBackFile )
+ {
+ storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
+ storage->save();
+ }
+ }
+ setModified();
+ }
+ delete storage;
+ delete calendar;
+ if ( syncOK )
+ updateView();
+ return syncOK;
+#endif
}
@@ -2521,4 +2579,15 @@ void KABCore::confSync()
{
- //mView->confSync();
- qDebug("pending KABCore::confSync() ");
+ static KSyncPrefsDialog* sp = 0;
+ if ( ! sp ) {
+ sp = new KSyncPrefsDialog( this, "syncprefs", true );
+ }
+ sp->usrReadConfig();
+#ifndef DESKTOP_VERSION
+ sp->showMaximized();
+#else
+ sp->show();
+#endif
+ sp->exec();
+ KABPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames();
+ KABPrefs::instance()->mLocalMachineName = sp->getLocalMachineName ();
fillSyncMenu();
@@ -2531,3 +2600,3 @@ void KABCore::syncSharp()
//mView->syncSharp();
- mModified = true ;
+ setModified();
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 10ce8f4..4487a8a 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -458,3 +458,2 @@ class KABCore : public QWidget
void fillSyncMenu();
- void confSync();
QString mCurrentSyncDevice;
@@ -473,2 +472,6 @@ class KABCore : public QWidget
QString getPassword( );
+ int mGlobalSyncMode;
+ bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
+ public slots:
+ void confSync();
// *********************