summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseeview.cpp66
-rw-r--r--kabc/addresseeview.h18
-rw-r--r--kaddressbook/kabcore.cpp7
3 files changed, 89 insertions, 2 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index b4717d7..487e8a5 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -17,33 +17,38 @@
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kabc/address.h>
#include <kabc/addressee.h>
#include <kabc/phonenumber.h>
#include <kglobal.h>
//US#include <kglobalsettings.h>
#include <kiconloader.h>
#include <klocale.h>
//US #include <kstringhandler.h>
#include <qscrollview.h>
#include <qregexp.h>
#include <qfile.h>
+#include <qvbox.h>
+#include <qlabel.h>
+#include <qwidget.h>
+#include <qlayout.h>
#include <qapplication.h>
+#include <qpushbutton.h>
#include "externalapphandler.h"
#include "addresseeview.h"
//US #ifndef DESKTOP_VERSION
//US #include <qtopia/qcopenvelope_qws.h>
//US #include <qpe/qpeapplication.h>
//US #endif
//US static int kphoneInstalled = 0;
using namespace KPIM;
AddresseeView::AddresseeView( QWidget *parent, const char *name )
@@ -386,16 +391,77 @@ void AddresseeView::addTag(const QString & tag,const QString & text)
pos=tmpText.find("\n");
tmp=tmpText.left(pos);
tmpText=tmpText.right(tmpText.length()-pos-1);
tmpStr+=tmp+"<br>";
}
}
else tmpStr += tmpText;
tmpStr+="</" + tag + ">";
mText.append(tmpStr);
}
else
{
str += text + "</" + tag + ">";
mText.append(str);
}
}
+
+AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name,
+ true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false)
+{
+ findButton( Close )->setText( i18n("Cancel Sync"));
+ findButton( Ok )->setText( i18n("Remote"));
+ findButton( User1 )->setText( i18n("Local"));
+ QWidget* topframe = new QWidget( this );
+ //QVBox* topframe = new QVBox( this );
+ setMainWidget( topframe );
+ QBoxLayout* bl;
+ if ( QApplication::desktop()->width() < 640 ) {
+ bl = new QVBoxLayout( topframe );
+
+ } else {
+ bl = new QHBoxLayout( topframe );
+
+ }
+ QVBox* subframe = new QVBox( topframe );
+ bl->addWidget(subframe );
+ QLabel* lab = new QLabel( i18n("Local Addressee"), subframe );
+ AddresseeView * av = new AddresseeView( subframe );
+ av->setAddressee( loc );
+ subframe = new QVBox( topframe );
+ bl->addWidget(subframe );
+ lab = new QLabel( i18n("Remote Addressee"), subframe );
+ av = new AddresseeView( subframe );
+ av->setAddressee( rem );
+
+ QObject::connect(findButton( Ok ),SIGNAL(clicked()),
+ SLOT(slot_remote()));
+ QObject::connect(this,SIGNAL(user1Clicked()),
+ SLOT(slot_local()));
+#ifndef DESKTOP_VERSION
+ showMaximized();
+#else
+ resize ( 640, 400 );
+#endif
+}
+
+int AddresseeChooser::executeD( bool local )
+{
+ mSyncResult = 3;
+ if ( local )
+ findButton( User1 )->setFocus();
+ else
+ findButton( Ok )->setFocus();
+ exec();
+ qDebug("returning %d ",mSyncResult );
+ return mSyncResult;
+}
+void AddresseeChooser::slot_remote()
+{
+ mSyncResult = 2;
+ accept();
+}
+void AddresseeChooser::slot_local()
+{
+ mSyncResult = 1;
+ accept();
+}
diff --git a/kabc/addresseeview.h b/kabc/addresseeview.h
index 1865fc4..689d997 100644
--- a/kabc/addresseeview.h
+++ b/kabc/addresseeview.h
@@ -10,51 +10,69 @@
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KPIM_ADDRESSEEVIEW_H
#define KPIM_ADDRESSEEVIEW_H
#include <kabc/addressee.h>
+#include <kdialogbase.h>
//US #include <ktextbrowser.h>
#include <qtextbrowser.h>
namespace KPIM {
//US class AddresseeView : public KTextBrowser
class AddresseeView : public QTextBrowser
{
public:
AddresseeView( QWidget *parent = 0, const char *name = 0 );
/**
Sets the addressee object. The addressee is displayed immediately.
@param addr The addressee object.
*/
void setAddressee( const KABC::Addressee& addr );
void setSource(const QString& n);
/**
Returns the current addressee object.
*/
KABC::Addressee addressee() const;
private:
KABC::Addressee mAddressee;
QString mText;
void addTag(const QString & tag,const QString & text);
class AddresseeViewPrivate;
AddresseeViewPrivate *d;
};
+class AddresseeChooser : public KDialogBase
+{
+ Q_OBJECT
+
+ public:
+ AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent = 0, const char *name = 0 );
+
+ int executeD( bool local );
+
+ private:
+ int mSyncResult;
+
+ private slots:
+ void slot_remote();
+ void slot_local();
+
+};
}
#endif
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 74c10d2..b1a951c 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2639,35 +2639,37 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
getEventViewerDialog()->setColorMode( 1 );
else
getEventViewerDialog()->setColorMode( 2 );
getEventViewerDialog()->setIncidence(local);
if ( localIsNew )
getEventViewerDialog()->setColorMode( 2 );
else
getEventViewerDialog()->setColorMode( 1 );
getEventViewerDialog()->addIncidence(remote);
getEventViewerDialog()->setColorMode( 0 );
//qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
getEventViewerDialog()->showMe();
result = getEventViewerDialog()->executeS( localIsNew );
#endif
qDebug("conflict! ************************************** ");
- result = 1;
+ {
+ KPIM::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)
{
@@ -2712,32 +2714,33 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
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();