summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kabc/addressbook.cpp9
-rw-r--r--kabc/addressee.cpp2
-rw-r--r--kabc/secrecy.h2
-rw-r--r--kabc/vcard/VCardv.cpp2
-rw-r--r--kaddressbook/filter.cpp0
-rw-r--r--kaddressbook/filter.h0
-rw-r--r--kaddressbook/filtereditdialog.cpp1
-rw-r--r--kaddressbook/kabcore.cpp12
-rw-r--r--kaddressbook/kaddressbookmain.cpp2
-rw-r--r--kaddressbook/viewmanager.cpp3
10 files changed, 23 insertions, 10 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 8487ff3..4de7da2 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -899,70 +899,77 @@ AddressBook::Iterator AddressBook::find( const Addressee &a )
Addressee AddressBook::findByUid( const QString &uid )
{
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( uid == (*it).uid() ) {
return *it;
}
}
return Addressee();
}
void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset )
{
//qDebug("AddressBook::preExternSync ");
AddressBook::Iterator it;
for ( it = begin(); it != end(); ++it ) {
(*it).setID( csd, (*it).externalUID() );
(*it).computeCsum( csd );
}
mergeAB( aBook ,csd, isSubset );
}
void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID)
{
//qDebug("AddressBook::postExternSync ");
AddressBook::Iterator it;
+ int foundEmpty = 0;
for ( it = begin(); it != end(); ++it ) {
//qDebug("check uid %s ", (*it).uid().latin1() );
if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ||
(*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ||
(*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) {
Addressee ad = aBook->findByUid( ( (*it).uid() ));
if ( ad.isEmpty() ) {
- qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1());
+ ++foundEmpty;
+ //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1());
+ //qDebug("-- formatted name %s ",(*it).formattedName().latin1() );
} else {
(*it).setIDStr(":");
if ( setID ) {
if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID )
ad.setID( csd, (*it).externalUID() );
} else
ad.setID( csd, (*it).uid() );
(*it).computeCsum( csd );
ad.setCsum( csd, (*it).getCsum( csd ) );
//qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() );
aBook->insertAddressee( ad , false);
}
}
}
+ if ( foundEmpty ) {
+ qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty );
+ }
+
}
bool AddressBook::containsExternalUid( const QString& uid )
{
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( uid == (*it).externalUID( ) )
return true;
}
return false;
}
Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile )
{
Iterator it;
for ( it = begin(); it != end(); ++it ) {
if ( uid == (*it).getID( profile ) )
return (*it);
}
return Addressee();
}
void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset )
{
Iterator it;
Addressee ad;
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 568dfc4..d60cd6b 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -251,53 +251,55 @@ void Addressee::computeCsum(const QString &dev)
l.append( t[iii] );
t = mData->categories;
t.sort();
for ( iii = 0; iii < t.count(); ++iii)
l.append( t[iii] );
t = mData->custom;
t.sort();
for ( iii = 0; iii < t.count(); ++iii)
if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) {
int find = t[iii].find (':')+1;
//qDebug("lennnn %d %d ", find, t[iii].length());
if ( find < t[iii].length())
l.append( t[iii] );
}
KABC::Address::List::Iterator addressIter;
for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end();
++addressIter ) {
t = (*addressIter).asList();
t.sort();
for ( iii = 0; iii < t.count(); ++iii)
l.append( t[iii] );
}
uint cs = getCsum4List(l);
+
#if 0
for ( iii = 0; iii < l.count(); ++iii)
qDebug("%d***%s***",iii,l[iii].latin1());
qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
#endif
+
setCsum( dev, QString::number (cs ));
}
void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
{
detach();
if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
if ( !mData->birthday.isValid() )
if ( ad.mData->birthday.isValid())
mData->birthday = ad.mData->birthday;
if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
diff --git a/kabc/secrecy.h b/kabc/secrecy.h
index 8f2f736..b2ff565 100644
--- a/kabc/secrecy.h
+++ b/kabc/secrecy.h
@@ -38,49 +38,49 @@ class Secrecy
friend QDataStream &operator>>( QDataStream &, Secrecy & );
public:
typedef QValueList<int> TypeList;
/**
* Secrecy types
*
* @li Public - for public access
* @li Private - only private access
* @li Confidential - access for confidential persons
*/
enum Types {
Public,
Private,
Confidential,
Invalid
};
/**
* Constructor.
*
* @param type The secrecy type, @see Types.
*/
- Secrecy( int type = Invalid );
+ Secrecy( int type = Public );
bool operator==( const Secrecy & ) const;
bool operator!=( const Secrecy & ) const;
/**
Returns if the Secrecy object has a valid value.
*/
bool isValid() const;
/**
* Sets the type, @see Types.
*/
void setType( int type );
/**
* Returns the type, @see Types.
*/
int type() const;
/**
* Returns a list of all available secrecy types.
*/
static TypeList typeList();
diff --git a/kabc/vcard/VCardv.cpp b/kabc/vcard/VCardv.cpp
index 1166aac..bad2ef1 100644
--- a/kabc/vcard/VCardv.cpp
+++ b/kabc/vcard/VCardv.cpp
@@ -151,49 +151,49 @@ VCard::_parse()
if (valuePart.left(5) != "VCARD") { // Not a vcard !
qDebug("not a VCARD ");
return;
}
///////////////////////////////////////////////////////////////
// CONTENT LINES
//
vDebug("Content lines");
// Handle folded lines.
QStringList refolded;
QStringList::Iterator it = l.begin();
QString cur;
for (; it != l.end(); ++it) {
cur = (*it);
++it;
while ( it!= l.end() && (*it).at(0) == ' ' && (*it).length()!= 1) {
- cur += (*it) ;
+ cur += (*it).mid(1) ;
++it;
}
--it;
refolded.append(cur);
}
QStringList::Iterator it2 = refolded.begin();
for (; it2 != refolded.end(); ++it2) {
ContentLine * cl = new ContentLine(QCString((*it2).latin1()));
cl->parse();
if (cl->value() == 0)
{
qDebug("Content line could not be parsed. Discarded: %s", (*it2).latin1());
delete cl;
}
else
contentLineList_.append(cl);
}
///////////////////////////////////////////////////////////////
// LAST LINE
// LR: sorry, but the remaining code in this method makes no sense
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp
index 9cb4c2d..7a869fa 100644
--- a/kaddressbook/filter.cpp
+++ b/kaddressbook/filter.cpp
diff --git a/kaddressbook/filter.h b/kaddressbook/filter.h
index 26870d7..93f1352 100644
--- a/kaddressbook/filter.h
+++ b/kaddressbook/filter.h
diff --git a/kaddressbook/filtereditdialog.cpp b/kaddressbook/filtereditdialog.cpp
index 987f234..1194406 100644
--- a/kaddressbook/filtereditdialog.cpp
+++ b/kaddressbook/filtereditdialog.cpp
@@ -75,49 +75,48 @@ FilterEditDialog::~FilterEditDialog()
void FilterEditDialog::setFilter( const Filter &filter )
{
mNameEdit->setText( filter.name() );
QStringList categories = filter.categories();
QListViewItem *item = mCategoriesView->firstChild();
while ( item != 0 ) {
if ( categories.contains( item->text( 0 ) ) ) {
QCheckListItem *checkItem = static_cast<QCheckListItem*>( item );
checkItem->setOn( true );
}
item = item->nextSibling();
}
if ( filter.matchRule() == Filter::Matching )
mMatchRuleGroup->setButton( 0 );
else
mMatchRuleGroup->setButton( 1 );
int c = filter.criteria() ;
mPublic->setChecked(c &Filter::ShowPublic);
mPrivate->setChecked(c & Filter::ShowPrivate);
mConfidential->setChecked(c & Filter::ShowConfidential);
-
}
Filter FilterEditDialog::filter()
{
Filter filter;
filter.setName( mNameEdit->text() );
QStringList categories;
QListViewItem *item = mCategoriesView->firstChild();
while ( item != 0 ) {
QCheckListItem *checkItem = static_cast<QCheckListItem*>( item );
if ( checkItem->isOn() )
categories.append( item->text( 0 ) );
item = item->nextSibling();
}
filter.setCategories( categories );
if ( mMatchRuleGroup->find( 0 )->isOn() )
filter.setMatchRule( Filter::Matching );
else
filter.setMatchRule( Filter::NotMatching );
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index e61f65f..aa04631 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -544,48 +544,50 @@ void KABCore::restoreSettings()
}
mExtensionBarSplitter->setSizes( splitterSize );
}
}
void KABCore::saveSettings()
{
KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
if ( mExtensionBarSplitter )
KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
#ifndef KAB_EMBEDDED
KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
#endif //KAB_EMBEDDED
mExtensionManager->saveSettings();
mViewManager->saveSettings();
KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
+ KABPrefs::instance()->writeConfig();
+ qDebug("KABPrefs::instance()->writeConfig() ");
}
KABC::AddressBook *KABCore::addressBook() const
{
return mAddressBook;
}
KConfig *KABCore::config()
{
#ifndef KAB_EMBEDDED
return KABPrefs::instance()->config();
#else //KAB_EMBEDDED
return KABPrefs::instance()->getConfig();
#endif //KAB_EMBEDDED
}
KActionCollection *KABCore::actionCollection() const
{
return mGUIClient->actionCollection();
}
KABC::Field *KABCore::currentSearchField() const
{
if (mIncSearchWidget)
@@ -2664,48 +2666,49 @@ KABC::Addressee KABCore::getLastSyncAddressee()
int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
{
//void setZaurusId(int id);
// int zaurusId() const;
// void setZaurusUid(int id);
// int zaurusUid() const;
// void setZaurusStat(int id);
// int zaurusStat() const;
// 0 equal
// 1 take local
// 2 take remote
// 3 cancel
QDateTime lastSync = mLastAddressbookSync;
QDateTime localMod = local->revision();
QDateTime remoteMod = remote->revision();
QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
bool remCh, locCh;
remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
//qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
locCh = ( localMod > mLastAddressbookSync );
+ //qDebug("cahnged rem %d loc %d",remCh, locCh );
if ( !remCh && ! locCh ) {
//qDebug("both not changed ");
lastSync = localMod.addDays(1);
if ( mode <= SYNC_PREF_ASK )
return 0;
} else {
if ( locCh ) {
//qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
lastSync = localMod.addDays( -1 );
if ( !remCh )
remoteMod =( lastSync.addDays( -1 ) );
} else {
//qDebug(" not loc changed ");
lastSync = localMod.addDays( 1 );
if ( remCh ) {
//qDebug("rem changed ");
remoteMod =( lastSync.addDays( 1 ) );
}
}
}
full = true;
if ( mode < SYNC_PREF_ASK )
mode = SYNC_PREF_ASK;
@@ -2741,50 +2744,51 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
case SYNC_PREF_LOCAL:
if ( lastSync > remoteMod )
return 1;
if ( lastSync > localMod )
return 2;
return 1;
break;
case SYNC_PREF_REMOTE:
if ( lastSync > remoteMod )
return 1;
if ( lastSync > localMod )
return 2;
return 2;
break;
case SYNC_PREF_NEWEST:
if ( localMod > remoteMod )
return 1;
else
return 2;
break;
case SYNC_PREF_ASK:
//qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
if ( lastSync > remoteMod )
return 1;
- if ( lastSync > localMod )
+ if ( lastSync > localMod ) {
return 2;
+ }
localIsNew = localMod >= remoteMod;
//qDebug("conflict! ************************************** ");
{
KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this );
result = acd.executeD(localIsNew);
return result;
}
break;
case SYNC_PREF_FORCE_LOCAL:
return 1;
break;
case SYNC_PREF_FORCE_REMOTE:
return 2;
break;
default:
// SYNC_PREF_TAKE_BOTH not implemented
break;
}
return 0;
}
bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
@@ -2985,52 +2989,54 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
++deletedAddresseeR;
}
}
}
}
}
++incCounter;
}
er.clear();
QStringList el = local->uidList();
modulo = (el.count()/10)+1;
syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count());
incCounter = 0;
while ( incCounter < el.count()) {
qApp->processEvents();
if (syncManager->isProgressBarCanceled())
return false;
if ( incCounter % modulo == 0 )
syncManager->showProgressBar(incCounter);
uid = el[ incCounter ];
bool skipIncidence = false;
if ( uid.left(19) == QString("last-syncAddressee-") )
skipIncidence = true;
- if ( !filterOUT.name().isEmpty() && ! filterOUT.filterAddressee( inL ) )
- skipIncidence = true;
if ( !skipIncidence ) {
inL = local->findByUid( uid );
+ if ( (!filterOUT.name().isEmpty()) && (! filterOUT.filterAddressee( inL ) ) )
+ skipIncidence = true;
+ }
+ if ( !skipIncidence ) {
if ( !inL.resource() || inL.resource()->includeInSync() ) {
inR = remote->findByUid( uid );
if ( inR.isEmpty() ) { // no conflict ********** add or delete local
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
// pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
local->removeAddressee( inL );
++deletedAddresseeL;
} else {
if ( ! syncManager->mWriteBackExistingOnly ) {
inL.removeID(mCurrentSyncDevice );
++addedAddresseeR;
inL.setRevision( modifiedCalendar );
local->insertAddressee( inL, false );
inR = inL;
inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
inR.setResource( 0 );
remote->insertAddressee( inR, false );
}
}
} else {
if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
//qDebug("data %s ", inL.revision().toString().latin1());
// pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index 2832257..519dc92 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -206,34 +206,34 @@ void KAddressBookMain::closeEvent( QCloseEvent* ce )
mess += i18n( "\nChanges will be saved!");
else
mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!");
bool mQuit = true;
if (mAskForQuit)
{
int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 );
if (res == 0)
mQuit = true;
else
mQuit = false;
}
if (mQuit == false)
return;
if (mModified == true)
{
save();
mCore->saveSettings();
- KABPrefs::instance()->writeConfig();
+ //KABPrefs::instance()->writeConfig();
}
ce->accept();
}
#ifndef KAB_EMBEDDED
#include "kaddressbookmain.moc"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index 9c3a641..4be860e 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -262,54 +262,53 @@ void ViewManager::setActiveView( const QString &name )
mViewWidgetStack->raiseWidget( view );
// Set the proper filter in the view. By setting the combo
// box, the activated slot will be called, which will push
// the filter to the view and refresh it.
if ( view->defaultFilterType() == KAddressBookView::None ) {
mActionSelectFilter->setCurrentItem( 0 );
setActiveFilter( 0 );
} else if ( view->defaultFilterType() == KAddressBookView::Active ) {
setActiveFilter( mActionSelectFilter->currentItem() );
} else {
uint pos = filterPosition( view->defaultFilterName() );
mActionSelectFilter->setCurrentItem( pos );
setActiveFilter( pos );
}
//US qDebug("ViewManager::setActiveView 6" );
// Update the inc search widget to show the fields in the new active
// view.
mCore->setSearchFields( mActiveView->fields() );
//US performance optimization. setActiveFilter calls also mActiveView->refresh()
//US mActiveView->refresh();
-
+ mCore->saveSettings();
}
else
{
qDebug("ViewManager::setActiveView: unable to find view" );
- kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n";
}
}
//US added another method with no parameter, since my moc compiler does not support default parameters.
void ViewManager::refreshView()
{
refreshView( QString::null );
}
void ViewManager::refreshView( const QString &uid )
{
if ( mActiveView )
mActiveView->refresh( uid );
}
void ViewManager::setFocusAV()
{
if ( mActiveView )
mActiveView->setFocusAV();
}
void ViewManager::editView()
{
if ( !mActiveView )
return;