-rw-r--r-- | kabc/addresseeview.cpp | 66 |
1 files changed, 66 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 | |||
@@ -9,49 +9,54 @@ | |||
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <kabc/address.h> | 22 | #include <kabc/address.h> |
23 | #include <kabc/addressee.h> | 23 | #include <kabc/addressee.h> |
24 | #include <kabc/phonenumber.h> | 24 | #include <kabc/phonenumber.h> |
25 | #include <kglobal.h> | 25 | #include <kglobal.h> |
26 | //US#include <kglobalsettings.h> | 26 | //US#include <kglobalsettings.h> |
27 | #include <kiconloader.h> | 27 | #include <kiconloader.h> |
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | //US #include <kstringhandler.h> | 29 | //US #include <kstringhandler.h> |
30 | #include <qscrollview.h> | 30 | #include <qscrollview.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qvbox.h> | ||
34 | #include <qlabel.h> | ||
35 | #include <qwidget.h> | ||
36 | #include <qlayout.h> | ||
33 | #include <qapplication.h> | 37 | #include <qapplication.h> |
38 | #include <qpushbutton.h> | ||
34 | 39 | ||
35 | 40 | ||
36 | #include "externalapphandler.h" | 41 | #include "externalapphandler.h" |
37 | #include "addresseeview.h" | 42 | #include "addresseeview.h" |
38 | 43 | ||
39 | 44 | ||
40 | //US #ifndef DESKTOP_VERSION | 45 | //US #ifndef DESKTOP_VERSION |
41 | //US #include <qtopia/qcopenvelope_qws.h> | 46 | //US #include <qtopia/qcopenvelope_qws.h> |
42 | //US #include <qpe/qpeapplication.h> | 47 | //US #include <qpe/qpeapplication.h> |
43 | //US #endif | 48 | //US #endif |
44 | 49 | ||
45 | //US static int kphoneInstalled = 0; | 50 | //US static int kphoneInstalled = 0; |
46 | 51 | ||
47 | using namespace KPIM; | 52 | using namespace KPIM; |
48 | 53 | ||
49 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) | 54 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) |
50 | //US : KTextBrowser( parent, name ) | 55 | //US : KTextBrowser( parent, name ) |
51 | : QTextBrowser( parent, name ) | 56 | : QTextBrowser( parent, name ) |
52 | 57 | ||
53 | 58 | ||
54 | { | 59 | { |
55 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); | 60 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); |
56 | setLinkUnderline( false ); | 61 | setLinkUnderline( false ); |
57 | // setVScrollBarMode( QScrollView::AlwaysOff ); | 62 | // setVScrollBarMode( QScrollView::AlwaysOff ); |
@@ -378,24 +383,85 @@ void AddresseeView::addTag(const QString & tag,const QString & text) | |||
378 | QString tmpText=text; | 383 | QString tmpText=text; |
379 | QString tmpStr=str; | 384 | QString tmpStr=str; |
380 | if(number !=-1) | 385 | if(number !=-1) |
381 | { | 386 | { |
382 | if (number > 0) { | 387 | if (number > 0) { |
383 | int pos=0; | 388 | int pos=0; |
384 | QString tmp; | 389 | QString tmp; |
385 | for(int i=0;i<=number;i++) { | 390 | for(int i=0;i<=number;i++) { |
386 | pos=tmpText.find("\n"); | 391 | pos=tmpText.find("\n"); |
387 | tmp=tmpText.left(pos); | 392 | tmp=tmpText.left(pos); |
388 | tmpText=tmpText.right(tmpText.length()-pos-1); | 393 | tmpText=tmpText.right(tmpText.length()-pos-1); |
389 | tmpStr+=tmp+"<br>"; | 394 | tmpStr+=tmp+"<br>"; |
390 | } | 395 | } |
391 | } | 396 | } |
392 | else tmpStr += tmpText; | 397 | else tmpStr += tmpText; |
393 | tmpStr+="</" + tag + ">"; | 398 | tmpStr+="</" + tag + ">"; |
394 | mText.append(tmpStr); | 399 | mText.append(tmpStr); |
395 | } | 400 | } |
396 | else | 401 | else |
397 | { | 402 | { |
398 | str += text + "</" + tag + ">"; | 403 | str += text + "</" + tag + ">"; |
399 | mText.append(str); | 404 | mText.append(str); |
400 | } | 405 | } |
401 | } | 406 | } |
407 | |||
408 | AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, | ||
409 | true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false) | ||
410 | { | ||
411 | findButton( Close )->setText( i18n("Cancel Sync")); | ||
412 | findButton( Ok )->setText( i18n("Remote")); | ||
413 | findButton( User1 )->setText( i18n("Local")); | ||
414 | QWidget* topframe = new QWidget( this ); | ||
415 | //QVBox* topframe = new QVBox( this ); | ||
416 | setMainWidget( topframe ); | ||
417 | QBoxLayout* bl; | ||
418 | if ( QApplication::desktop()->width() < 640 ) { | ||
419 | bl = new QVBoxLayout( topframe ); | ||
420 | |||
421 | } else { | ||
422 | bl = new QHBoxLayout( topframe ); | ||
423 | |||
424 | } | ||
425 | QVBox* subframe = new QVBox( topframe ); | ||
426 | bl->addWidget(subframe ); | ||
427 | QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); | ||
428 | AddresseeView * av = new AddresseeView( subframe ); | ||
429 | av->setAddressee( loc ); | ||
430 | subframe = new QVBox( topframe ); | ||
431 | bl->addWidget(subframe ); | ||
432 | lab = new QLabel( i18n("Remote Addressee"), subframe ); | ||
433 | av = new AddresseeView( subframe ); | ||
434 | av->setAddressee( rem ); | ||
435 | |||
436 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), | ||
437 | SLOT(slot_remote())); | ||
438 | QObject::connect(this,SIGNAL(user1Clicked()), | ||
439 | SLOT(slot_local())); | ||
440 | #ifndef DESKTOP_VERSION | ||
441 | showMaximized(); | ||
442 | #else | ||
443 | resize ( 640, 400 ); | ||
444 | #endif | ||
445 | } | ||
446 | |||
447 | int AddresseeChooser::executeD( bool local ) | ||
448 | { | ||
449 | mSyncResult = 3; | ||
450 | if ( local ) | ||
451 | findButton( User1 )->setFocus(); | ||
452 | else | ||
453 | findButton( Ok )->setFocus(); | ||
454 | exec(); | ||
455 | qDebug("returning %d ",mSyncResult ); | ||
456 | return mSyncResult; | ||
457 | } | ||
458 | void AddresseeChooser::slot_remote() | ||
459 | { | ||
460 | mSyncResult = 2; | ||
461 | accept(); | ||
462 | } | ||
463 | void AddresseeChooser::slot_local() | ||
464 | { | ||
465 | mSyncResult = 1; | ||
466 | accept(); | ||
467 | } | ||