author | zautrix <zautrix> | 2004-09-18 18:46:29 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-18 18:46:29 (UTC) |
commit | ec8099bf369e5b8327ca6cfd78b34366353e3abf (patch) (side-by-side diff) | |
tree | 551c515124f7b1c47b2860803efa3922f494f938 /kabc | |
parent | 3f16c7aa0ab6badf304c537a6981ece743138821 (diff) | |
download | kdepimpi-ec8099bf369e5b8327ca6cfd78b34366353e3abf.zip kdepimpi-ec8099bf369e5b8327ca6cfd78b34366353e3abf.tar.gz kdepimpi-ec8099bf369e5b8327ca6cfd78b34366353e3abf.tar.bz2 |
More AB sync
-rw-r--r-- | kabc/addresseeview.cpp | 66 | ||||
-rw-r--r-- | kabc/addresseeview.h | 18 |
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 @@ -1,81 +1,86 @@ /* This file is part of libkdepim. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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. */ #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 ) //US : KTextBrowser( parent, name ) : QTextBrowser( parent, name ) { //US setWrapPolicy( QTextEdit::AtWordBoundary ); setLinkUnderline( false ); // setVScrollBarMode( QScrollView::AlwaysOff ); //setHScrollBarMode( QScrollView::AlwaysOff ); //US QStyleSheet *sheet = styleSheet(); //US QStyleSheetItem *link = sheet->item( "a" ); //US link->setColor( KGlobalSettings::linkColor() ); } void AddresseeView::setSource(const QString& n) { //qDebug("********AddresseeView::setSource %s", n.latin1()); if ( n.left( 6 ) == "mailto" ) ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); else if ( n.left( 7 ) == "phoneto" ) ExternalAppHandler::instance()->callByPhone( n.mid(8) ); else if ( n.left( 5 ) == "faxto" ) ExternalAppHandler::instance()->callByFax( n.mid(6) ); else if ( n.left( 5 ) == "smsto" ) ExternalAppHandler::instance()->callBySMS( n.mid(6) ); else if ( n.left( 7 ) == "pagerto" ) ExternalAppHandler::instance()->callByPager( n.mid(8) ); else if ( n.left( 5 ) == "sipto" ) ExternalAppHandler::instance()->callBySIP( n.mid(6) ); @@ -354,48 +359,109 @@ mText = "<table width=\"100%\">\n"; "<td align=\"left\">%2</td></tr>" ) .arg( i18n(" ") ) .arg( mAddressee.organization()); mText += dynamicPart; mText += notes; mText += "</table>"; } // at last display it... setText( mText ); } KABC::Addressee AddresseeView::addressee() const { return mAddressee; } void AddresseeView::addTag(const QString & tag,const QString & text) { if ( text.isEmpty() ) return; int number=text.contains("\n"); QString str = "<" + tag + ">"; QString tmpText=text; QString tmpStr=str; if(number !=-1) { if (number > 0) { int pos=0; QString tmp; for(int i=0;i<=number;i++) { 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 @@ -1,60 +1,78 @@ /* This file is part of libkdepim. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 |