summaryrefslogtreecommitdiffabout
path: root/kabc
Side-by-side diff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseeview.cpp66
-rw-r--r--kabc/addresseeview.h18
2 files changed, 84 insertions, 0 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index b4717d7..487e8a5 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -29,9 +29,14 @@
//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"
@@ -398,4 +403,65 @@ void AddresseeView::addTag(const QString & tag,const QString & text)
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
@@ -22,8 +22,9 @@
#ifndef KPIM_ADDRESSEEVIEW_H
#define KPIM_ADDRESSEEVIEW_H
#include <kabc/addressee.h>
+#include <kdialogbase.h>
//US #include <ktextbrowser.h>
#include <qtextbrowser.h>
@@ -53,8 +54,25 @@ class AddresseeView : public QTextBrowser
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