summaryrefslogtreecommitdiffabout
path: root/kabc
Side-by-side diff
Diffstat (limited to 'kabc') (more/less context) (show whitespace changes)
-rw-r--r--kabc/addressbook.cpp3
-rw-r--r--kabc/addressbook.h2
-rw-r--r--kabc/addressee.cpp1
3 files changed, 4 insertions, 2 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 6e8d027..3ec0795 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -424,63 +424,64 @@ void AddressBook::clear()
Ticket *AddressBook::requestSaveTicket( Resource *resource )
{
kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl;
if ( !resource )
{
qDebug("AddressBook::requestSaveTicket no resource" );
resource = standardResource();
}
KRES::Manager<Resource>::ActiveIterator it;
for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) {
if ( (*it) == resource ) {
if ( (*it)->readOnly() || !(*it)->isOpen() )
return 0;
else
return (*it)->requestSaveTicket();
}
}
return 0;
}
-void AddressBook::insertAddressee( const Addressee &a )
+void AddressBook::insertAddressee( const Addressee &a, bool setRev )
{
Addressee::List::Iterator it;
for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) {
if ( a.uid() == (*it).uid() ) {
bool changed = false;
Addressee addr = a;
if ( addr != (*it) )
changed = true;
(*it) = a;
if ( (*it).resource() == 0 )
(*it).setResource( standardResource() );
if ( changed ) {
+ if ( setRev )
(*it).setRevision( QDateTime::currentDateTime() );
(*it).setChanged( true );
}
return;
}
}
d->mAddressees.append( a );
Addressee& addr = d->mAddressees.last();
if ( addr.resource() == 0 )
addr.setResource( standardResource() );
addr.setChanged( true );
}
void AddressBook::removeAddressee( const Addressee &a )
{
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( a.uid() == (*it).uid() ) {
removeAddressee( it );
return;
}
}
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 650a638..253de68 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -152,49 +152,49 @@ class AddressBook : public QObject
Returns a const iterator for first entry of address book.
*/
ConstIterator begin() const;
/**
Returns a iterator for first entry of address book.
*/
Iterator end();
/**
Returns a const iterator for first entry of address book.
*/
ConstIterator end() const;
/**
Removes all entries from address book.
*/
void clear();
/**
Insert an Addressee object into address book. If an object with the same
unique id already exists in the address book it it replaced by the new
one. If not the new object is appended to the address book.
*/
- void insertAddressee( const Addressee & );
+ void insertAddressee( const Addressee &, bool setRev = true );
/**
Removes entry from the address book.
*/
void removeAddressee( const Addressee & );
/**
This is like @ref removeAddressee() just above, with the difference that
the first element is a iterator, returned by @ref begin().
*/
void removeAddressee( const Iterator & );
/**
Find the specified entry in address book. Returns end(), if the entry
couldn't be found.
*/
Iterator find( const Addressee & );
/**
Find the entry specified by an unique id. Returns an empty Addressee
object, if the address book does not contain an entry with this id.
*/
Addressee findByUid( const QString & );
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index fb32f6e..7f04d8f 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -72,48 +72,49 @@ struct Addressee::AddresseeData : public KShared
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 = ":";
+ mData->revision = QDateTime ( QDate( 2004,1,1));
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;