summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp27
-rw-r--r--kabc/addressbook.h5
-rw-r--r--kabc/addressee.cpp54
-rw-r--r--kabc/addressee.h12
-rw-r--r--kaddressbook/kabcore.cpp93
-rw-r--r--kaddressbook/kabcore.h2
6 files changed, 156 insertions, 37 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 70eda1b..9332e21 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -21,48 +21,49 @@
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
/*US
#include <qfile.h>
#include <qregexp.h>
#include <qtimer.h>
#include <kapplication.h>
#include <kinstance.h>
#include <kstandarddirs.h>
#include "errorhandler.h"
*/
#include <qptrlist.h>
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
+#include <libkcal/syncdefines.h>
#include "addressbook.h"
#include "resource.h"
//US #include "addressbook.moc"
using namespace KABC;
struct AddressBook::AddressBookData
{
Addressee::List mAddressees;
Addressee::List mRemovedAddressees;
Field::List mAllFields;
KConfig *mConfig;
KRES::Manager<Resource> *mManager;
//US ErrorHandler *mErrorHandler;
};
struct AddressBook::Iterator::IteratorData
{
Addressee::List::Iterator mIt;
};
struct AddressBook::ConstIterator::ConstIteratorData
{
@@ -491,48 +492,74 @@ void AddressBook::removeAddressee( const Iterator &it )
d->mAddressees.remove( it.d->mIt );
}
AddressBook::Iterator AddressBook::find( const Addressee &a )
{
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( a.uid() == (*it).uid() ) {
return it;
}
}
return end();
}
Addressee AddressBook::findByUid( const QString &uid )
{
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( uid == (*it).uid() ) {
return *it;
}
}
return Addressee();
}
+Addressee::List AddressBook::getExternLastSyncAddressees()
+{
+ Addressee::List results;
+
+ Iterator it;
+ for ( it = begin(); it != end(); ++it ) {
+ if ( (*it).uid().left( 20 ) == "last-syncAddressee-" ) {
+ if ( (*it).familyName().left(3) == "E: " )
+ results.append( *it );
+ }
+ }
+
+ return results;
+}
+void AddressBook::resetTempSyncStat()
+{
+
+
+ Iterator it;
+ for ( it = begin(); it != end(); ++it ) {
+ (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL );
+ }
+
+}
+
+
Addressee::List AddressBook::allAddressees()
{
return d->mAddressees;
}
Addressee::List AddressBook::findByName( const QString &name )
{
Addressee::List results;
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( name == (*it).realName() ) {
results.append( *it );
}
}
return results;
}
Addressee::List AddressBook::findByEmail( const QString &email )
{
Addressee::List results;
QStringList mailList;
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index e43de31..05225f9 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -267,48 +267,53 @@ class AddressBook : public QObject
*/
bool removeResource( Resource * );
/**
Return pointer list of all resources.
*/
QPtrList<Resource> resources();
/**
Set the @p ErrorHandler, that is used by @ref error() to
provide gui-independend error messages.
*/
void setErrorHandler( ErrorHandler * );
/**
Shows gui independend error messages.
*/
void error( const QString& );
/**
Query all resources to clean up their lock files
*/
void cleanUp();
+ // sync stuff
+ Addressee::List getExternLastSyncAddressees();
+ void resetTempSyncStat();
+
+
signals:
/**
Emitted, when the address book has changed on disk.
*/
void addressBookChanged( AddressBook * );
/**
Emitted, when the address book has been locked for writing.
*/
void addressBookLocked( AddressBook * );
/**
Emitted, when the address book has been unlocked.
*/
void addressBookUnlocked( AddressBook * );
protected:
void deleteRemovedAddressees();
void setStandardResource( Resource * );
Resource *standardResource();
KRES::Manager<Resource> *resourceManager();
void init(const QString &config, const QString &family);
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 4cdd5e5..fb32f6e 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -11,115 +11,120 @@
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kconfig.h>
#include <ksharedptr.h>
#include <kdebug.h>
#include <kapplication.h>
#include <klocale.h>
+#include <kidmanager.h>
//US
#include <kstandarddirs.h>
+#include <libkcal/syncdefines.h>
//US #include "resource.h"
#include "addressee.h"
using namespace KABC;
static bool matchBinaryPattern( int value, int pattern );
struct Addressee::AddresseeData : public KShared
{
QString uid;
QString name;
QString formattedName;
QString familyName;
QString givenName;
QString additionalName;
QString prefix;
QString suffix;
QString nickName;
QDateTime birthday;
QString mailer;
TimeZone timeZone;
Geo geo;
QString title;
QString role;
QString organization;
QString note;
QString productId;
QDateTime revision;
QString sortString;
KURL url;
Secrecy secrecy;
Picture logo;
Picture photo;
Sound sound;
Agent agent;
-
+ QString mExternalId;
PhoneNumber::List phoneNumbers;
Address::List addresses;
Key::List keys;
QStringList emails;
QStringList categories;
QStringList custom;
Resource *resource;
bool empty :1;
bool changed :1;
};
Addressee::Addressee()
{
mData = new AddresseeData;
mData->empty = true;
mData->changed = false;
mData->resource = 0;
+ mData->mExternalId = ":";
+ mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
}
Addressee::~Addressee()
{
}
Addressee::Addressee( const Addressee &a )
{
mData = a.mData;
+ mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
}
Addressee &Addressee::operator=( const Addressee &a )
{
mData = a.mData;
return (*this);
}
Addressee Addressee::copy()
{
Addressee a;
*(a.mData) = *mData;
return a;
}
void Addressee::detach()
{
if ( mData.count() == 1 ) return;
*this = copy();
}
bool Addressee::operator==( const Addressee &a ) const
{
if ( uid() != a.uid() ) return false;
@@ -147,48 +152,95 @@ bool Addressee::operator==( const Addressee &a ) const
if ( mData->photo != a.mData->photo ) return false;
if ( mData->sound != a.mData->sound ) return false;
if ( mData->agent != a.mData->agent ) return false;
if ( ( mData->url.isValid() || a.mData->url.isValid() ) &&
( mData->url != a.mData->url ) ) return false;
if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false;
if ( mData->addresses != a.mData->addresses ) return false;
if ( mData->keys != a.mData->keys ) return false;
if ( mData->emails != a.mData->emails ) return false;
if ( mData->categories != a.mData->categories ) return false;
if ( mData->custom != a.mData->custom ) return false;
return true;
}
bool Addressee::operator!=( const Addressee &a ) const
{
return !( a == *this );
}
bool Addressee::isEmpty() const
{
return mData->empty;
}
+void Addressee::removeID(const QString &prof)
+{
+ detach();
+ mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
+
+}
+void Addressee::setID( const QString & prof , const QString & id )
+{
+ detach();
+ mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
+}
+void Addressee::setTempSyncStat( int id )
+{
+ mTempSyncStat = id;
+}
+int Addressee::tempSyncStat() const
+{
+ return mTempSyncStat;
+}
+
+QString Addressee::getID( const QString & prof)
+{
+ return KIdManager::getId ( mData->mExternalId, prof );
+}
+
+void Addressee::setCsum( const QString & prof , const QString & id )
+{
+ detach();
+ mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
+}
+
+QString Addressee::getCsum( const QString & prof)
+{
+ return KIdManager::getCsum ( mData->mExternalId, prof );
+}
+
+void Addressee::setIDStr( const QString & s )
+{
+ detach();
+ mData->mExternalId = s;
+}
+
+QString Addressee::IDStr() const
+{
+ return mData->mExternalId;
+}
+
void Addressee::setUid( const QString &id )
{
if ( id == mData->uid ) return;
detach();
mData->empty = false;
mData->uid = id;
}
QString Addressee::uid() const
{
if ( mData->uid.isEmpty() )
mData->uid = KApplication::randomString( 10 );
return mData->uid;
}
QString Addressee::uidLabel()
{
return i18n("Unique Identifier");
}
void Addressee::setName( const QString &name )
{
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 27782f9..f098371 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -75,49 +75,58 @@ class Resource;
nothing else is set it uses name().
name() is the NAME type of RFC2426. It can be used as internal name for the
data enty, but shouldn't be used for displaying the data to the user.
*/
class Addressee
{
friend QDataStream &operator<<( QDataStream &, const Addressee & );
friend QDataStream &operator>>( QDataStream &, Addressee & );
public:
typedef QValueList<Addressee> List;
/**
Construct an empty address book entry.
*/
Addressee();
~Addressee();
Addressee( const Addressee & );
Addressee &operator=( const Addressee & );
bool operator==( const Addressee & ) const;
bool operator!=( const Addressee & ) const;
-
+ // sync stuff
+ void setTempSyncStat(int id);
+ int tempSyncStat() const;
+ void setIDStr( const QString & );
+ QString IDStr() const;
+ void setID( const QString &, const QString & );
+ QString getID( const QString & );
+ void setCsum( const QString &, const QString & );
+ QString getCsum( const QString & );
+ void removeID(const QString &);
/**
Return, if the address book entry is empty.
*/
bool isEmpty() const;
/**
Set unique identifier.
*/
void setUid( const QString &uid );
/**
Return unique identifier.
*/
QString uid() const;
/**
Return translated label for uid field.
*/
static QString uidLabel();
/**
Set name.
*/
void setName( const QString &name );
/**
Return name.
@@ -794,35 +803,36 @@ class Addressee
/**
Return pointer to resource.
*/
Resource *resource() const;
/**
Return resourcelabel.
*/
//US
static QString resourceLabel();
/**
Mark addressee as changed.
*/
void setChanged( bool value );
/**
Return whether the addressee is changed.
*/
bool changed() const;
private:
Addressee copy();
void detach();
+ int mTempSyncStat;
struct AddresseeData;
mutable KSharedPtr<AddresseeData> mData;
};
QDataStream &operator<<( QDataStream &, const Addressee & );
QDataStream &operator>>( QDataStream &, Addressee & );
}
#endif
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 1196360..53c63ff 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2492,112 +2492,135 @@ void KABCore::edit_sync_options()
QString KABCore::getPassword( )
{
QString retfile = "";
QDialog dia ( this, "input-dialog", true );
QLineEdit lab ( &dia );
lab.setEchoMode( QLineEdit::Password );
QVBoxLayout lay( &dia );
lay.setMargin(7);
lay.setSpacing(7);
lay.addWidget( &lab);
dia.setFixedSize( 230,50 );
dia.setCaption( i18n("Enter password") );
QPushButton pb ( "OK", &dia);
lay.addWidget( &pb );
connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
dia.show();
int res = dia.exec();
if ( res )
retfile = lab.text();
dia.hide();
qApp->processEvents();
return retfile;
}
+#include <libkcal/syncdefines.h>
+
+KABC::Addressee KABCore::getLastSyncAddressee()
+{
+ Addressee lse;
+ //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
+ lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
+ if (lse.isEmpty()) {
+ lse.setUid( "last-syncEvent-"+mCurrentSyncDevice );
+ QString sum = "";
+ if ( KABPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
+ sum = "E: ";
+ lse.setFamilyName(sum+mCurrentSyncDevice + i18n(" - sync event"));
+ lse.setRevision( mLastAddressbookSync );
+ lse.setCategories( i18n("SyncEvent") );
+ mAddressBook->insertAddressee( lse );
+ }
+ return lse;
+}
+
bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
{
-#if 0
bool syncOK = true;
int addedAddressee = 0;
int addedAddresseeR = 0;
int deletedAddresseeR = 0;
int deletedAddresseeL = 0;
int changedLocal = 0;
int changedRemote = 0;
//QPtrList<Addressee> el = local->rawAddressees();
- Addressee* addresseeR;
+ Addressee addresseeR;
QString uid;
int take;
- Addressee* addresseeL;
- Addressee* addresseeRSync;
- Addressee* addresseeLSync;
- QPtrList<Addressee> addresseeRSyncSharp = remote->getExternLastSyncAddressees();
- QPtrList<Addressee> addresseeLSyncSharp = local->getExternLastSyncAddressees();
+ Addressee addresseeL;
+ Addressee addresseeRSync;
+ Addressee addresseeLSync;
+ KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees();
+ KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees();
bool fullDateRange = false;
local->resetTempSyncStat();
- mLastCalendarSync = QDateTime::currentDateTime();
- QDateTime modifiedCalendar = mLastCalendarSync;;
+ mLastAddressbookSync = QDateTime::currentDateTime();
+ QDateTime modifiedCalendar = mLastAddressbookSync;;
addresseeLSync = getLastSyncAddressee();
- addresseeR = remote->addressee("last-syncAddressee-"+mCurrentSyncName );
- if ( addresseeR ) {
- addresseeRSync = (Addressee*) addresseeR->clone();
- remote->deleteAddressee(addresseeR );
+ addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName );
+ if ( !addresseeR.isEmpty() ) {
+ addresseeRSync = addresseeR;
+ remote->removeAddressee(addresseeR );
} else {
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
- addresseeRSync = (Addressee*)addresseeLSync->clone();
+ addresseeRSync = addresseeLSync ;
} else {
fullDateRange = true;
- addresseeRSync = new Addressee();
- addresseeRSync->setSummary(mCurrentSyncName + i18n(" - sync addressee"));
- addresseeRSync->setUid("last-syncAddressee-"+mCurrentSyncName );
- addresseeRSync->setDtStart( mLastCalendarSync );
- addresseeRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
- addresseeRSync->setCategories( i18n("SyncAddressee") );
+ Addressee newAdd;
+ addresseeRSync = newAdd;
+ addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
+ addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
+ addresseeRSync.setRevision( mLastAddressbookSync );
+ addresseeRSync.setCategories( i18n("SyncAddressee") );
}
}
- if ( addresseeLSync->dtStart() == mLastCalendarSync )
+ if ( addresseeLSync.revision() == mLastAddressbookSync )
fullDateRange = true;
-
if ( ! fullDateRange ) {
- if ( addresseeLSync->dtStart() != addresseeRSync->dtStart() ) {
+ if ( addresseeLSync.revision() != addresseeRSync.revision() ) {
// qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
//qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
fullDateRange = true;
}
}
if ( fullDateRange )
- mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
+ mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365);
else
- mLastCalendarSync = addresseeLSync->dtStart();
+ mLastAddressbookSync = addresseeLSync.revision();
// for resyncing if own file has changed
+ // PENDING fixme later when implemented
+#if 0
if ( mCurrentSyncDevice == "deleteaftersync" ) {
- mLastCalendarSync = loadedFileVersion;
- qDebug("setting mLastCalendarSync ");
+ mLastAddressbookSync = loadedFileVersion;
+ qDebug("setting mLastAddressbookSync ");
}
+#endif
+
+ #if 0
//qDebug("*************************** ");
- qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() );
+ qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
QPtrList<Incidence> er = remote->rawIncidences();
Incidence* inR = er.first();
Incidence* inL;
QProgressBar bar( er.count(),0 );
bar.setCaption (i18n("Syncing - close to abort!") );
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();
bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
int modulo = (er.count()/10)+1;
int incCounter = 0;
while ( inR ) {
if ( ! bar.isVisible() )
return false;
if ( incCounter % modulo == 0 )
bar.setProgress( incCounter );
++incCounter;
uid = inR->uid();
bool skipIncidence = false;
@@ -2636,49 +2659,49 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
local->deleteIncidence( inL );
inL = inR->clone();
inL->setIDStr( idS );
local->addIncidence( inL );
++changedLocal;
}
}
} else { // no conflict
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
QString des = addresseeLSync->description();
QString pref = "e";
if ( inR->type() == "Todo" )
pref = "t";
if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
//remote->deleteIncidence( inR );
++deletedAddresseeR;
} else {
inR->setLastModified( modifiedCalendar );
inL = inR->clone();
local->addIncidence( inL );
++addedAddressee;
}
} else {
- if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
+ if ( inR->lastModified() > mLastAddressbookSync || mode == 5 ) {
inR->setLastModified( modifiedCalendar );
local->addIncidence( inR->clone() );
++addedAddressee;
} else {
checkExternSyncAddressee(addresseeRSyncSharp, inR);
remote->deleteIncidence( inR );
++deletedAddresseeR;
}
}
}
}
inR = er.next();
}
QPtrList<Incidence> el = local->rawIncidences();
inL = el.first();
modulo = (el.count()/10)+1;
bar.setCaption (i18n("Add / remove addressees") );
bar.setTotalSteps ( el.count() ) ;
bar.show();
incCounter = 0;
while ( inL ) {
qApp->processAddressees();
@@ -2692,101 +2715,101 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
if ( uid.left(15) == QString("last-syncAddressee-") )
skipIncidence = true;
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
skipIncidence = true;
if ( !skipIncidence ) {
inR = remote->incidence( uid );
if ( ! inR ) {
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
checkExternSyncAddressee(addresseeLSyncSharp, inL);
local->deleteIncidence( inL );
++deletedAddresseeL;
} else {
if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
inL->removeID(mCurrentSyncDevice );
++addedAddresseeR;
//qDebug("remote added Incidence %s ", inL->summary().latin1());
inL->setLastModified( modifiedCalendar );
inR = inL->clone();
inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
remote->addIncidence( inR );
}
}
} else {
- if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
+ if ( inL->lastModified() < mLastAddressbookSync && mode != 4 ) {
checkExternSyncAddressee(addresseeLSyncSharp, inL);
local->deleteIncidence( inL );
++deletedAddresseeL;
} else {
if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
++addedAddresseeR;
inL->setLastModified( modifiedCalendar );
remote->addIncidence( inL->clone() );
}
}
}
}
}
inL = el.next();
}
int delFut = 0;
if ( KOPrefs::instance()->mWriteBackInFuture ) {
er = remote->rawIncidences();
inR = er.first();
QDateTime dt;
QDateTime cur = QDateTime::currentDateTime();
QDateTime end = cur.addSecs( KOPrefs::instance()->mWriteBackInFuture * 3600 *24 *7 );
while ( inR ) {
if ( inR->type() == "Todo" ) {
Todo * t = (Todo*)inR;
if ( t->hasDueDate() )
dt = t->dtDue();
else
dt = cur.addSecs( 62 );
}
else if (inR->type() == "Addressee" ) {
bool ok;
dt = inR->getNextOccurence( cur, &ok );
if ( !ok )
dt = cur.addSecs( -62 );
}
else
dt = inR->dtStart();
if ( dt < cur || dt > end ) {
remote->deleteIncidence( inR );
++delFut;
}
inR = er.next();
}
}
bar.hide();
- mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
+ mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
addresseeLSync->setReadOnly( false );
- addresseeLSync->setDtStart( mLastCalendarSync );
- addresseeRSync->setDtStart( mLastCalendarSync );
- addresseeLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
- addresseeRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
+ addresseeLSync->setDtStart( mLastAddressbookSync );
+ addresseeRSync->setDtStart( mLastAddressbookSync );
+ addresseeLSync->setDtEnd( mLastAddressbookSync.addSecs( 3600 ) );
+ addresseeRSync->setDtEnd( mLastAddressbookSync.addSecs( 3600 ) );
addresseeRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
addresseeLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
addresseeLSync->setReadOnly( true );
if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
remote->addAddressee( addresseeRSync );
QString mes;
mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR );
QString delmess;
if ( delFut ) {
delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture );
mes += delmess;
}
if ( KOPrefs::instance()->mShowSyncSummary ) {
KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
}
qDebug( mes );
mCalendar->checkAlarmForIncidence( 0, true );
return syncOK;
#endif
return false;
}
bool KABCore::syncAB(QString filename, int mode)
{
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 4487a8a..c67cee6 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -451,31 +451,33 @@ class KABCore : public QWidget
#ifdef KAB_EMBEDDED
KAddressBookMain *mMainWindow; // should be the same like mGUIClient
#endif //KAB_EMBEDDED
// LR *******************************
// sync stuff!
QPopupMenu *syncMenu;
void fillSyncMenu();
QString mCurrentSyncDevice;
QString mCurrentSyncName;
void quickSyncLocalFile();
bool syncWithFile( QString fn , bool quick );
void KABCore::syncLocalFile();
void KABCore::syncPhone();
void KABCore::syncSharp();
void multiSync( bool askforPrefs );
int mCurrentSyncProfile ;
void syncRemote( KSyncProfile* prof, bool ask = true);
void edit_sync_options();
bool syncAB(QString filename, int mode);
int ringSync();
QString getPassword( );
int mGlobalSyncMode;
bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
+ KABC::Addressee getLastSyncAddressee();
+ QDateTime mLastAddressbookSync;
public slots:
void confSync();
// *********************
};
#endif