summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp2
-rw-r--r--kaddressbook/views/cardview.cpp10
2 files changed, 6 insertions, 6 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index d651224..c339244 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2682,129 +2682,129 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
Addressee newAdd;
addresseeRSync = newAdd;
addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
addresseeRSync.setRevision( mLastAddressbookSync );
addresseeRSync.setCategories( i18n("SyncAddressee") );
}
}
if ( addresseeLSync.revision() == mLastAddressbookSync ) {
// qDebug("FULLDATE 2");
fullDateRange = true;
}
if ( ! fullDateRange ) {
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;
//qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() );
}
}
// fullDateRange = true; // debug only!
if ( fullDateRange )
mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365);
else
mLastAddressbookSync = addresseeLSync.revision();
// for resyncing if own file has changed
// PENDING fixme later when implemented
#if 0
if ( mCurrentSyncDevice == "deleteaftersync" ) {
mLastAddressbookSync = loadedFileVersion;
qDebug("setting mLastAddressbookSync ");
}
#endif
//qDebug("*************************** ");
// qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
QStringList er = remote->uidList();
Addressee inR ;//= er.first();
Addressee inL;
syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count());
int modulo = (er.count()/10)+1;
int incCounter = 0;
while ( incCounter < er.count()) {
if (syncManager->isProgressBarCanceled())
return false;
if ( incCounter % modulo == 0 )
syncManager->showProgressBar(incCounter);
uid = er[ incCounter ];
bool skipIncidence = false;
if ( uid.left(19) == QString("last-syncAddressee-") )
skipIncidence = true;
QString idS,OidS;
qApp->processEvents();
if ( !skipIncidence ) {
inL = local->findByUid( uid );
inR = remote->findByUid( uid );
//inL.setResource( 0 );
//inR.setResource( 0 );
if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars
if ( !inL.resource() || inL.resource()->includeInSync() ) {
- if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) {
+ if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) {
//qDebug("take %d %s ", take, inL.summary().latin1());
if ( take == 3 )
return false;
if ( take == 1 ) {// take local **********************
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
local->insertAddressee( inL, false );
idS = inR.externalUID();
OidS = inR.originalExternalUID();
}
else
idS = inR.IDStr();
remote->removeAddressee( inR );
inR = inL;
inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
inR.setOriginalExternalUID( OidS );
inR.setExternalUID( idS );
if ( syncManager->syncWithDesktop() ) {
inR.setIDStr("changed" );
}
//inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" );
} else {
inR.setIDStr( idS );
}
inR.setResource( 0 );
remote->insertAddressee( inR , false);
++changedRemote;
} else { // take == 2 take remote **********************
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
if ( inR.revision().date().year() < 2004 )
inR.setRevision( modifiedCalendar );
}
idS = inL.IDStr();
local->removeAddressee( inL );
inL = inR;
inL.setIDStr( idS );
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
}
inL.setResource( 0 );
local->insertAddressee( inL , false );
++changedLocal;
}
}
}
} else { // no conflict ********** add or delete remote
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
QString des = addresseeLSync.note();
if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE );
remote->insertAddressee( inR, false );
++deletedAddresseeR;
} else {
inR.setRevision( modifiedCalendar );
remote->insertAddressee( inR, false );
inL = inR;
inL.setIDStr( ":" );
inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
inL.setResource( 0 );
local->insertAddressee( inL , false);
diff --git a/kaddressbook/views/cardview.cpp b/kaddressbook/views/cardview.cpp
index da552c3..03df444 100644
--- a/kaddressbook/views/cardview.cpp
+++ b/kaddressbook/views/cardview.cpp
@@ -93,178 +93,178 @@ class CardViewItemList : public QPtrList<CardViewItem>
return 0;
}
private:
/*int find( const CardViewItem * )
{
qDebug("DON'T USE CardViewItemList::find( item )! Use findRef( item )!");
}*/
};
//////////////////////////////////////
// CardViewSeparator
class CardViewSeparator
{
friend class CardView;
public:
CardViewSeparator(CardView *view)
: mView(view)
{
mRect = QRect(0, 0, view->separatorWidth(), 0);
}
~CardViewSeparator() {}
void paintSeparator(QPainter *p, QColorGroup &cg)
{
p->fillRect(0, 0, mRect.width(), mRect.height(),
cg.brush(QColorGroup::Button));
}
void repaintSeparator()
{
mView->repaintContents(mRect);
}
private:
CardView *mView;
QRect mRect;
};
//END Helpers
//BEGIN Private Data
class CardViewPrivate
{
public:
CardViewPrivate()
: mSelectionMode( CardView::Multi ),
mDrawCardBorder( true ),
mDrawFieldLabels( true ),
mDrawSeparators( true),
mSepWidth( 2 ),
mShowEmptyFields( false ),
mLayoutDirty( true ),
mLastClickOnItem( false ),
mItemMargin( 0 ),
mItemSpacing( 10 ),
mItemWidth( 200 ),
mMaxFieldLines( INT_MAX ),
mCurrentItem( 0L ),
mLastClickPos( QPoint(0, 0) ),
+ mResizeAnchor(0),
mRubberBandAnchor( 0 ),
- mCompText( QString::null ),
- mResizeAnchor(0)
+ mCompText( QString::null )
{};
CardViewItemList mItemList;
QPtrList<CardViewSeparator> mSeparatorList;
QFontMetrics *mFm;
QFontMetrics *mBFm; // bold font
QFont mHeaderFont; // custom header font
CardView::SelectionMode mSelectionMode;
bool mDrawCardBorder;
bool mDrawFieldLabels;
bool mDrawSeparators;
int mSepWidth;
bool mShowEmptyFields;
bool mLayoutDirty;
bool mLastClickOnItem;
uint mItemMargin; // internal margin in items
uint mItemSpacing; // spacing between items, column seperators and border
int mItemWidth; // width of all items
uint mMaxFieldLines; // Max lines to dispaly pr field
CardViewItem *mCurrentItem;
QPoint mLastClickPos;
QTimer *mTimer; // times out if mouse rests for more than 500 msecs
CardViewTip *mTip; // passed to the item under a resting cursor to display full text
bool mOnSeparator; // set/reset on mouse movement
// for resizing by dragging the separators
int mResizeAnchor; // uint, ulong? the mouse down separator left
int mRubberBandAnchor; // for erasing rubber bands
// data used for resizing.
// as they are beeded by each mouse move while resizing, we store them here,
// saving 8 calculations in each mouse move.
int colspace; // amount of space between items pr column
uint first; // the first col to anchor at for painting rubber bands
int firstX; // X position of first in pixel
int pressed; // the colummn that was pressed on at resizing start
int span; // pressed - first
// key completion
QString mCompText; // current completion string
QDateTime mCompUpdated; // ...was updated at this time
};
class CardViewItemPrivate
{
public:
CardViewItemPrivate() :
- x( 0 ),
- y( 0 ),
- mSelected( false ){};
+ mSelected( false ),
+ x( 0 ),
+ y( 0 ){};
QString mCaption;
QPtrList< CardViewItem::Field > mFieldList;
bool mSelected;
int x; // horizontal position, set by the view
int y; // vertical position, set by the view
int maxLabelWidth; // the width of the widest label, according to the view font.
int hcache; // height cache
};
//END Private Data
//BEGIN CardViewItem
CardViewItem::CardViewItem(CardView *parent, QString caption)
: d(new CardViewItemPrivate()), mView(parent)
{
d->mCaption = caption;
initialize();
}
CardViewItem::~CardViewItem()
{
// Remove ourself from the view
if (mView != 0)
mView->takeItem(this);
delete d;
d = 0;
}
void CardViewItem::initialize()
{
d->mSelected = false;
d->mFieldList.setAutoDelete(true);
d->maxLabelWidth = 0;
d->hcache=0;
//calcRect();
// Add ourself to the view
if (mView != 0)
mView->insertItem(this);
}
void CardViewItem::paintCard(QPainter *p, QColorGroup &cg)
{
if (!mView)
return;
QPen pen;
QBrush brush;
QFontMetrics fm = *(mView->d->mFm);
QFontMetrics bFm = *(mView->d->mBFm);
bool drawLabels = mView->d->mDrawFieldLabels;
bool drawBorder = mView->d->mDrawCardBorder;
int mg = mView->itemMargin();
int w = mView->itemWidth() - (mg*2);
int h = height() - (mg*2);
const int colonWidth( fm.width(":") );
int labelXPos = 2 + mg;
int labelWidth = QMIN( w/2 - 4 - mg, d->maxLabelWidth + colonWidth + 4 );