summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
Side-by-side diff
Diffstat (limited to 'kabc/plugins/sharpdtm/resourcesharpdtm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/sharpdtm/resourcesharpdtm.cpp57
1 files changed, 10 insertions, 47 deletions
diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
index bba5f9a..48d3985 100644
--- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
+++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp
@@ -129,7 +129,7 @@ bool ResourceSharpDTM::doOpen()
// the last parameter in the SlZDataBase constructor means "readonly"
mAccess = new SlZDataBase(fileName(),
SlZDataBase::addressbookItems(),
- NULL, true);
+ NULL, false);
if ( !mAccess ) {
qDebug("Unable to load file() %s", fileName().latin1());
@@ -139,7 +139,7 @@ bool ResourceSharpDTM::doOpen()
if (mConverter == 0)
{
mConverter = new SharpDTMConverter();
- bool res = mConverter->init();
+ bool res = mConverter->init();
if ( !res )
{
QString msg("Unable to initialize sharp converter. Most likely a problem with the category file");
@@ -224,19 +224,18 @@ bool ResourceSharpDTM::save( Ticket *ticket )
if (res == true)
{
KABC::Addressee addressee;
- qDebug("1NEW id is %d", id);
res = mConverter->sharpToAddressee( id, mAccess, addressee );
addressee.setUid((*it).uid() );
- addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM );
- changedAddressees.append( addressee );
+ addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
res = mAccess->finishEditCard(&id);
- qDebug("2NEW id is %d", id);
+ //qDebug("2NEW id is %d", id);
+ addressee.setExternalUID( QString::number( id ) );
+ addressee.setOriginalExternalUID( QString::number( id ) );
+ changedAddressees.append( addressee );
if (res == false)
qDebug("Unable to append Contact: %s", addressee.formattedName().latin1());
- else {
- qDebug("added card success ");
- }
+
}
else
{
@@ -255,6 +254,7 @@ bool ResourceSharpDTM::save( Ticket *ticket )
} else if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) {
//changed
+ qDebug("changed ****");
res = mAccess->startEditCard(id);
if (res == true)
{
@@ -269,9 +269,7 @@ bool ResourceSharpDTM::save( Ticket *ticket )
res = mAccess->finishEditCard(&id);
if (res == false)
qDebug("Unable to append Contact: %s", addressee.formattedName().latin1());
- else {
- qDebug("change card succes ");
- }
+
}
else
{
@@ -280,42 +278,7 @@ bool ResourceSharpDTM::save( Ticket *ticket )
}
}
}
-
-
-
-
-
-
-
-
- }
-
-#if 0
- // old code
- CardId id = 0; // 0 means new card
- KABC::Addressee addressee = (*it);
-
- res = mAccess->startEditCard(id);
- if (res == true)
- {
- res = mConverter->addresseeToSharp( *it, mAccess, id );
- if (res == true)
- {
- res = mAccess->finishEditCard(&id);
- if (res == false)
- qDebug("Unable to append Contact: %s", addressee.formattedName().latin1());
}
- else
- {
- qDebug("Unable to convert Addressee: %s", addressee.formattedName().latin1());
- mAccess->cancelEditCard();
- }
- }
- else
- {
- qDebug("Unable to add new card. Addressee: %s", addressee.formattedName().latin1());
- }
-#endif
}
KABC::Addressee::List::Iterator it2;