summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp27
-rw-r--r--kabc/addressbook.h3
-rw-r--r--kabc/addressee.cpp6
-rw-r--r--kabc/plugins/qtopia/qtopiaconverter.cpp2
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.cpp79
-rw-r--r--kaddressbook/kabcore.cpp58
-rw-r--r--korganizer/calendarview.cpp44
7 files changed, 153 insertions, 66 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 86dc7c2..17b9ba2 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -551,24 +551,23 @@ void AddressBook::removeAddressee( const Addressee &a )
removeAddressee( it2 );
}
-void AddressBook::removeDeletedAddressees()
+void AddressBook::removeSyncAddressees( bool removeDeleted )
{
- deleteRemovedAddressees();
Iterator it = begin();
Iterator it2 ;
QDateTime dt ( QDate( 2004,1,1) );
while ( it != end() ) {
(*it).setRevision( dt );
(*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" );
(*it).setIDStr("");
- if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE || (*it).uid().left( 19 ) == QString("last-syncAddressee-")) {
+ if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) {
it2 = it;
//qDebug("removing %s ",(*it).uid().latin1() );
++it;
removeAddressee( it2 );
- } else {
+ } else {
//qDebug("skipping %s ",(*it).uid().latin1() );
++it;
}
}
@@ -616,13 +615,14 @@ void AddressBook::postExternSync( AddressBook* aBook , const QString& csd)
{
qDebug("AddressBook::postExternSync ");
AddressBook::Iterator it;
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 ) {
Addressee ad = aBook->findByUid( ( (*it).uid() ));
if ( ad.isEmpty() ) {
- qDebug("ERROR ad empty ");
+ qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1());
} else {
(*it).computeCsum( csd );
if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID )
ad.setID( csd, (*it).externalUID() );
@@ -632,9 +632,17 @@ void AddressBook::postExternSync( AddressBook* aBook , const QString& csd)
}
}
}
-
+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 ) {
@@ -652,8 +660,15 @@ void AddressBook::mergeAB( AddressBook *aBook, const QString& profile )
if ( !ad.isEmpty() ) {
(*it).mergeContact( ad );
}
}
+#if 0
+ // test only
+ for ( it = begin(); it != end(); ++it ) {
+
+ qDebug("uid %s ", (*it).uid().latin1());
+ }
+#endif
}
#if 0
Addressee::List AddressBook::getExternLastSyncAddressees()
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 157dc56..8f62f0d 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -291,11 +291,12 @@ class AddressBook : public QObject
// sync stuff
//Addressee::List getExternLastSyncAddressees();
void resetTempSyncStat();
QStringList uidList();
- void removeDeletedAddressees();
+ void removeSyncAddressees( bool removeDeleted = false );
void mergeAB( AddressBook *aBook, const QString& profile );
Addressee findByExternUid( const QString& uid , const QString& profile );
+ bool containsExternalUid( const QString& uid );
void preExternSync( AddressBook* aBook, const QString& csd );
void postExternSync( AddressBook* aBook, const QString& csd );
signals:
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index fda62f1..e241281 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -94,9 +94,9 @@ Addressee::Addressee()
mData->empty = true;
mData->changed = false;
mData->resource = 0;
mData->mExternalId = ":";
- mData->revision = QDateTime ( QDate( 2004,1,1));
+ mData->revision = QDateTime ( QDate( 2003,1,1));
mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
}
Addressee::~Addressee()
@@ -307,8 +307,10 @@ void Addressee::mergeContact( const Addressee& ad )
// merging emails;
// merging categories;
// merging custom;
// merging keys
+ qDebug("merge contact %s ", ad.uid().latin1());
+ setUid( ad.uid() );
}
void Addressee::removeID(const QString &prof)
{
@@ -378,8 +380,9 @@ void Addressee::setOriginalExternalUID( const QString &id )
{
if ( id == mData->originalExternalUID ) return;
detach();
mData->empty = false;
+ qDebug("*******Set orig uid %s ", id.latin1());
mData->originalExternalUID = id;
}
QString Addressee::originalExternalUID() const
@@ -390,8 +393,9 @@ QString Addressee::originalExternalUID() const
void Addressee::setUid( const QString &id )
{
if ( id == mData->uid ) return;
detach();
+ qDebug("****setuid %s ", id.latin1());
mData->empty = false;
mData->uid = id;
}
diff --git a/kabc/plugins/qtopia/qtopiaconverter.cpp b/kabc/plugins/qtopia/qtopiaconverter.cpp
index de45e63..430c7b3 100644
--- a/kabc/plugins/qtopia/qtopiaconverter.cpp
+++ b/kabc/plugins/qtopia/qtopiaconverter.cpp
@@ -85,9 +85,9 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
exuid = exuid.mid(1);
if ( ente > -1 )
exuid = exuid.left( ente-1 );
addr.setExternalUID( exuid );
- //qDebug("QtopiaConverter:set uid %s ",addr.externalUID().latin1() );
+ qDebug("QtopiaConverter:set %s uid %s ",addr.originalExternalUID().latin1(),addr.externalUID().latin1() );
// email
QStringList emails = contact.emailList();
for ( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp
index 935a1cf..1f90fcb 100644
--- a/kabc/plugins/qtopia/resourceqtopia.cpp
+++ b/kabc/plugins/qtopia/resourceqtopia.cpp
@@ -196,36 +196,91 @@ bool ResourceQtopia::save( Ticket *ticket )
mDirWatch.stopScan();
KABC::AddressBook::Iterator it;
bool res;
-
+ KABC::Addressee::List changedAddressees;
+ QStringList addedUID;
for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) {
//KABC::Addressee addressee = (*it);
+ // qDebug("AAAfor uid %s ", (*it).originalExternalUID().latin1() );
if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) {
QUuid uid( (*it).originalExternalUID() );
bool ok;
PimContact c = mAccess->contactForId( uid, &ok );
+ qDebug("ResourceQtopia::save:Found %d for uid %s ", ok,(*it).originalExternalUID().latin1() );
res = mConverter->addresseeToQtopia( *it, c );
if (res == true) {
if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL ) {
- mAccess->addContact(c);
- KABC::Addressee addressee;
- mConverter->qtopiaToAddressee( c, addressee );
- addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
- addressBook()->insertAddressee( addressee );
+ qDebug("skipping adding of contact ");
+ continue;
+ PimContact e;
+ AddressBookAccess Access2;
+ Access2.addContact(e);
+ const PimContact* contact;
+ bool res;
+ QString uid2, Ouid;
+ AddressBookIterator itt(Access2);
+ for (contact=itt.toFirst(); itt.current(); ++itt)
+ {
+ contact = itt.current();
+ QString exuid = contact->uid().toString();
+ Ouid =exuid;
+ int ente = exuid.find( "-0000");
+ if ( exuid.left(1) == "{" )
+ exuid = exuid.mid(1);
+ if ( ente > -1 )
+ exuid = exuid.left( ente-1 );
+ uid2 = exuid;
+ qDebug("trying find uid ");
+ if ( !addressBook()->containsExternalUid( uid2 ) ) {
+ qDebug("ab not contains ");
+ if ( !addedUID.contains( uid2 )) {
+ qDebug("list not contains ");
+ break;
+ }
+ }
+
+ }
+ if ( !itt.current()) {
+ qDebug("ERROR uid ");
+ continue;
+ }
+ else
+ qDebug("ADD uid detected ");
+
+
+ QUuid uid3( Ouid);
+ PimContact d = Access2.contactForId( uid3, &ok );
+ if ( ! ok ) {
+ qDebug("ADD: Error getting new uid ");
+ } else {
+ qDebug("NEW UID found ");
+ PimContact g = mAccess->contactForId( c.uid(), &ok );
+ KABC::Addressee addressee;
+ mConverter->qtopiaToAddressee( g, addressee );
+ addressee.setUid((*it).uid() );
+ addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
+ changedAddressees.append( addressee );
+ addedUID.append( uid2 );
+ }
+
} else if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
+ qDebug("Remove contact ");
if ( ok )
mAccess->removeContact(c);
else
- qDebug("Error revoe contact from qtopia ");
+ qDebug("Error remove contact from qtopia ");
} else if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) {
if ( ok ) {
+ qDebug("Update contact ");
mAccess->updateContact(c);
+ PimContact g = mAccess->contactForId( c.uid(), &ok );
KABC::Addressee addressee;
- mConverter->qtopiaToAddressee( c, addressee );
+ mConverter->qtopiaToAddressee( g, addressee );
+ addressee.setUid((*it).uid() );
addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM );
- addressBook()->insertAddressee( addressee );
+ changedAddressees.append( addressee );
}
else
qDebug("Error update contact from qtopia ");
@@ -236,9 +291,13 @@ bool ResourceQtopia::save( Ticket *ticket )
}
}
}
- // mAccess->addressBookUpdated();
+ KABC::Addressee::List::Iterator it2;
+ for ( it2 = changedAddressees.begin(); it2 != changedAddressees.end(); ++it2 )
+ addressBook()->insertAddressee((*it2));
+
+
mDirWatch.startScan();
delete ticket;
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 8f3ca9b..f8683e7 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2548,44 +2548,46 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
// 1 take local
// 2 take remote
// 3 cancel
QDateTime lastSync = mLastAddressbookSync;
+ QDateTime localMod = local->revision();
+ QDateTime remoteMod = remote->revision();
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 = ( local->revision() > mLastAddressbookSync );
+ qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
+ locCh = ( localMod > mLastAddressbookSync );
if ( !remCh && ! locCh ) {
- //qDebug("both not changed ");
- lastSync = local->revision().addDays(1);
+ qDebug("both not changed ");
+ lastSync = localMod.addDays(1);
if ( mode <= SYNC_PREF_ASK )
return 0;
} else {
if ( locCh ) {
- //qDebug("loc changed %s %s", local->revision().toString().latin1(), mLastAddressbookSync.toString().latin1());
- lastSync = local->revision().addDays( -1 );
+ qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
+ lastSync = localMod.addDays( -1 );
if ( !remCh )
- remote->setRevision( lastSync.addDays( -1 ) );
+ remoteMod =( lastSync.addDays( -1 ) );
} else {
//qDebug(" not loc changed ");
- lastSync = local->revision().addDays( 1 );
+ lastSync = localMod.addDays( 1 );
if ( remCh )
- remote->setRevision( lastSync.addDays( 1 ) );
+ remoteMod =( lastSync.addDays( 1 ) );
}
}
full = true;
if ( mode < SYNC_PREF_ASK )
mode = SYNC_PREF_ASK;
} else {
- if ( local->revision() == remote->revision() )
+ if ( localMod == remoteMod )
return 0;
}
// qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
- //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision());
+ //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod);
//qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
//full = true; //debug only
if ( full ) {
bool equ = ( (*local) == (*remote) );
@@ -2608,34 +2610,34 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
mode = SYNC_PREF_ASK;
switch( mode ) {
case SYNC_PREF_LOCAL:
- if ( lastSync > remote->revision() )
+ if ( lastSync > remoteMod )
return 1;
- if ( lastSync > local->revision() )
+ if ( lastSync > localMod )
return 2;
return 1;
break;
case SYNC_PREF_REMOTE:
- if ( lastSync > remote->revision() )
+ if ( lastSync > remoteMod )
return 1;
- if ( lastSync > local->revision() )
+ if ( lastSync > localMod )
return 2;
return 2;
break;
case SYNC_PREF_NEWEST:
- if ( local->revision() > remote->revision() )
+ if ( localMod > remoteMod )
return 1;
else
return 2;
break;
case SYNC_PREF_ASK:
- //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->revision().toString().latin1(), remote->revision().toString().latin1() );
- if ( lastSync > remote->revision() )
+ //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
+ if ( lastSync > remoteMod )
return 1;
- if ( lastSync > local->revision() )
+ if ( lastSync > localMod )
return 2;
- localIsNew = local->revision() >= remote->revision();
+ localIsNew = localMod >= remoteMod;
//qDebug("conflict! ************************************** ");
{
KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this );
result = acd.executeD(localIsNew);
@@ -2785,8 +2787,12 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
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 );
@@ -2924,23 +2930,23 @@ bool KABCore::syncAB(QString filename, int mode)
bool syncOK = false;
if ( abLocal.load() ) {
qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
bool external = false;
-
+ bool isXML = false;
if ( filename.right(4) == ".xml") {
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
+ isXML = true;
abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
} else {
Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
if ( ! lse.isEmpty() ) {
if ( lse.familyName().left(4) == "!E: " )
external = true;
} else {
bool found = false;
- QDateTime dt( QDate( 2004,1,1));
AddressBook::Iterator it;
for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
- if ( (*it).revision() != dt ) {
+ if ( (*it).revision().date().year() > 2003 ) {
found = true;
break;
}
}
@@ -2965,13 +2971,13 @@ bool KABCore::syncAB(QString filename, int mode)
syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
if ( syncOK ) {
if ( KABPrefs::instance()->mWriteBackFile )
{
- if ( external && filename.right(4) != ".xml")
- abLocal.removeDeletedAddressees();
+ if ( external )
+ abLocal.removeSyncAddressees( !isXML);
qDebug("Saving remote AB ");
abLocal.saveAB();
- if ( external && filename.right(4) == ".xml") {
+ if ( isXML ) {
// afterwrite processing
abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
}
}
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 0c75632..8e83723 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -725,46 +725,48 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
// 1 take local
// 2 take remote
// 3 cancel
QDateTime lastSync = mLastCalendarSync;
+ QDateTime localMod = local->lastModified();
+ QDateTime remoteMod = remote->lastModified();
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
bool remCh, locCh;
remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
//if ( remCh )
//qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
- locCh = ( local->lastModified() > mLastCalendarSync );
+ locCh = ( localMod > mLastCalendarSync );
if ( !remCh && ! locCh ) {
//qDebug("both not changed ");
- lastSync = local->lastModified().addDays(1);
+ lastSync = localMod.addDays(1);
if ( mode <= SYNC_PREF_ASK )
return 0;
} else {
if ( locCh ) {
- //qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1());
- lastSync = local->lastModified().addDays( -1 );
+ //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
+ lastSync = localMod.addDays( -1 );
if ( !remCh )
- remote->setLastModified( lastSync.addDays( -1 ) );
+ remoteMod = ( lastSync.addDays( -1 ) );
} else {
//qDebug(" not loc changed ");
- lastSync = local->lastModified().addDays( 1 );
+ lastSync = localMod.addDays( 1 );
if ( remCh )
- remote->setLastModified( lastSync.addDays( 1 ) );
+ remoteMod =( lastSync.addDays( 1 ) );
}
}
full = true;
if ( mode < SYNC_PREF_ASK )
mode = SYNC_PREF_ASK;
} else {
- if ( local->lastModified() == remote->lastModified() )
+ if ( localMod == remoteMod )
if ( local->revision() == remote->revision() )
return 0;
}
// qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
- //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision());
- //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
+ //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
+ //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
//full = true; //debug only
if ( full ) {
bool equ = false;
if ( local->type() == "Event" ) {
@@ -786,42 +788,42 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
//qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
}
int result;
bool localIsNew;
- //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() );
+ //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
if ( full && mode < SYNC_PREF_NEWEST )
mode = SYNC_PREF_ASK;
switch( mode ) {
case SYNC_PREF_LOCAL:
- if ( lastSync > remote->lastModified() )
+ if ( lastSync > remoteMod )
return 1;
- if ( lastSync > local->lastModified() )
+ if ( lastSync > localMod )
return 2;
return 1;
break;
case SYNC_PREF_REMOTE:
- if ( lastSync > remote->lastModified() )
+ if ( lastSync > remoteMod )
return 1;
- if ( lastSync > local->lastModified() )
+ if ( lastSync > localMod )
return 2;
return 2;
break;
case SYNC_PREF_NEWEST:
- if ( local->lastModified() > remote->lastModified() )
+ if ( localMod > remoteMod )
return 1;
else
return 2;
break;
case SYNC_PREF_ASK:
- //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() );
- if ( lastSync > remote->lastModified() )
+ //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
+ if ( lastSync > remoteMod )
return 1;
- if ( lastSync > local->lastModified() )
+ if ( lastSync > localMod )
return 2;
- //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() );
- localIsNew = local->lastModified() >= remote->lastModified();
+ //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
+ localIsNew = localMod >= remoteMod;
if ( localIsNew )
getEventViewerDialog()->setColorMode( 1 );
else
getEventViewerDialog()->setColorMode( 2 );