From kde-core-devel Tue Feb 26 12:37:27 2002 From: Cornelius Schumacher Date: Tue, 26 Feb 2002 12:37:27 +0000 To: kde-core-devel Subject: PATCH: Port klprfax to kabc X-MARC-Message: https://marc.info/?l=kde-core-devel&m=101472739125807 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--------------Boundary-00=_FE45WKH7TB7G4A0YJ02S" --------------Boundary-00=_FE45WKH7TB7G4A0YJ02S Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit This patch ports klprfax to the new addressbook API. Ok to commit? -- Cornelius Schumacher --------------Boundary-00=_FE45WKH7TB7G4A0YJ02S Content-Type: text/x-diff; charset="us-ascii"; name="usekabc.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="usekabc.patch" ? usekabc.patch Index: klprfax/Makefile.am =================================================================== RCS file: /home/kde/kdeutils/klprfax/klprfax/Makefile.am,v retrieving revision 1.11 diff -u -p -r1.11 Makefile.am --- klprfax/Makefile.am 2001/11/11 06:34:09 1.11 +++ klprfax/Makefile.am 2002/02/26 12:33:33 @@ -2,7 +2,7 @@ bin_PROGRAMS = klprfax bin_SCRIPTS = klprfax_filter klprfax_lpd klprfax_SOURCES = klprfax_config.cpp klprfax.cpp main.cpp klprfax_widget.cpp noinst_HEADERS = klprfax_config.h klprfax.h klprfax_widget.h -klprfax_LDADD = $(LIB_KAB) $(LIB_KIO) +klprfax_LDADD = -lkabc $(LIB_KIO) klprfax_LDFLAGS = $(all_libraries) $(KDE_RPATH) KDE_ICON=AUTO Index: klprfax/klprfax.cpp =================================================================== RCS file: /home/kde/kdeutils/klprfax/klprfax/klprfax.cpp,v retrieving revision 1.14 diff -u -p -r1.14 klprfax.cpp --- klprfax/klprfax.cpp 2002/01/21 06:31:43 1.14 +++ klprfax/klprfax.cpp 2002/02/26 12:33:33 @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include @@ -37,10 +39,6 @@ Klprfax::Klprfax(KApplication *_app,KConfigBase *cnf,QCString faxF,QWidget *parent, const char *_name) : QWidget(parent, _name) { -AddressBook::ErrorCode err; -AddressBook *bk; -int n,i; -QString name,fax0,fax1,fax2,fax3; QString nil=""; app=_app; @@ -67,18 +65,14 @@ QString nil=""; // Search all entries with fax numbers - kab=new KabAPI; - err=kab->init(); - bk=kab->addressbook(); - n=bk->noOfEntries(); - + KABC::AddressBook *ab = KABC::StdAddressBook::self(); + + KABC::AddressBook::Iterator it; + int rows=-1,col0=0,col1=0; - for(i=0;igetKey(i,k); - err=bk->getEntry(k,e); - if (NameFax(e,name,fax0,fax1,fax2,fax3)) { + for( it = ab->begin(); it != ab->end(); ++it ) { + QString name,fax0,fax1,fax2,fax3; + if (NameFax(*it,name,fax0,fax1,fax2,fax3)) { klprfax_widget *tmp; rows+=1;if (rows>=names->numRows()) { names->setNumRows(rows+1); } @@ -207,60 +201,40 @@ Klprfax::~Klprfax() } /** No descriptions */ -bool Klprfax::NameFax(AddressBook::Entry & e,QString & name, QString & fax0,QString & fax1, QString & fax2, QString & fax3) +bool Klprfax::NameFax(KABC::Addressee & a,QString & name, QString & fax0,QString & fax1, QString & fax2, QString & fax3) { - bool isFax=false; - AddressBook::Telephone faxEnum=AddressBook::Fax; - int fn=0; - QString fax; - - fax0=QString::null; - fax1=QString::null; - fax2=QString::null; - fax3=QString::null; - - int phone_nrs=e.telephone.count(); -qWarning("Phone nrs: %d", phone_nrs); - for(int i=0;i #include +#include #include #include #include -#include -#include #include #include #include @@ -93,8 +92,6 @@ private: // Private attributes bool canCancel; bool canceled; - KabAPI * kab; - KShellProcess efax_helper; QString efax_diagnostic; @@ -108,7 +105,7 @@ public: // Public attributes private: // Private methods void doLog(QString s); - bool NameFax(AddressBook::Entry & e,QString & name, QString & fax0,QString & fax1,QString & fax2,QString & fax3); + bool NameFax(KABC::Addressee & e,QString & name, QString & fax0,QString & fax1,QString & fax2,QString & fax3); void findEFax(); void enableAll(bool yes=true); --------------Boundary-00=_FE45WKH7TB7G4A0YJ02S--