summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-06 19:41:10 (UTC)
committer zautrix <zautrix>2004-10-06 19:41:10 (UTC)
commitbe3a5ea82c9a160eeeaad187a357c9a085fdb20a (patch) (unidiff)
tree933c685c84430f5c19a0657239b5c8b50a88de05
parent656636acfb8c607901c97c4f55129e29e1df9913 (diff)
downloadkdepimpi-be3a5ea82c9a160eeeaad187a357c9a085fdb20a.zip
kdepimpi-be3a5ea82c9a160eeeaad187a357c9a085fdb20a.tar.gz
kdepimpi-be3a5ea82c9a160eeeaad187a357c9a085fdb20a.tar.bz2
bugfixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/gsmstate.h2
-rw-r--r--kaddressbook/kabcore.cpp6
-rw-r--r--libkdepim/phoneaccess.cpp12
3 files changed, 10 insertions, 10 deletions
diff --git a/gammu/emb/common/gsmstate.h b/gammu/emb/common/gsmstate.h
index 2b4806c..f15a6a7 100644
--- a/gammu/emb/common/gsmstate.h
+++ b/gammu/emb/common/gsmstate.h
@@ -116,97 +116,96 @@ typedef struct _GSM_Reply_Function GSM_Reply_Function;
116#ifdef GSM_ENABLE_MBUS2 116#ifdef GSM_ENABLE_MBUS2
117# include "protocol/nokia/mbus2.h" 117# include "protocol/nokia/mbus2.h"
118#endif 118#endif
119#if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET) 119#if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET)
120# include "protocol/nokia/phonet.h" 120# include "protocol/nokia/phonet.h"
121#endif 121#endif
122#if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT) 122#if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT)
123# include "protocol/at/at.h" 123# include "protocol/at/at.h"
124#endif 124#endif
125#ifdef GSM_ENABLE_ALCABUS 125#ifdef GSM_ENABLE_ALCABUS
126# include "protocol/alcatel/alcabus.h" 126# include "protocol/alcatel/alcabus.h"
127#endif 127#endif
128#if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX) 128#if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX)
129# include "protocol/obex/obex.h" 129# include "protocol/obex/obex.h"
130#endif 130#endif
131#if defined(GSM_ENABLE_MROUTERBLUE) 131#if defined(GSM_ENABLE_MROUTERBLUE)
132# include "protocol/symbian/mrouter.h" 132# include "protocol/symbian/mrouter.h"
133#endif 133#endif
134 134
135#define GSM_ENABLE_SERIALDEVICE 135#define GSM_ENABLE_SERIALDEVICE
136#ifndef GSM_USED_SERIALDEVICE 136#ifndef GSM_USED_SERIALDEVICE
137# undef GSM_ENABLE_SERIALDEVICE 137# undef GSM_ENABLE_SERIALDEVICE
138#endif 138#endif
139#define GSM_ENABLE_IRDADEVICE 139#define GSM_ENABLE_IRDADEVICE
140#ifndef GSM_USED_IRDADEVICE 140#ifndef GSM_USED_IRDADEVICE
141# undef GSM_ENABLE_IRDADEVICE 141# undef GSM_ENABLE_IRDADEVICE
142#endif 142#endif
143#define GSM_ENABLE_BLUETOOTHDEVICE 143#define GSM_ENABLE_BLUETOOTHDEVICE
144#ifndef GSM_USED_BLUETOOTHDEVICE 144#ifndef GSM_USED_BLUETOOTHDEVICE
145# undef GSM_ENABLE_BLUETOOTHDEVICE 145# undef GSM_ENABLE_BLUETOOTHDEVICE
146#endif 146#endif
147 147
148#ifdef DJGPP 148#ifdef DJGPP
149# undef GSM_ENABLE_IRDADEVICE 149# undef GSM_ENABLE_IRDADEVICE
150# undef GSM_ENABLE_IRDAPHONET 150# undef GSM_ENABLE_IRDAPHONET
151# undef GSM_ENABLE_IRDAOBEX 151# undef GSM_ENABLE_IRDAOBEX
152# undef GSM_ENABLE_IRDAAT 152# undef GSM_ENABLE_IRDAAT
153# undef GSM_ENABLE_FBUS2IRDA 153# undef GSM_ENABLE_FBUS2IRDA
154 154
155# undef GSM_ENABLE_BLUETOOTHDEVICE 155# undef GSM_ENABLE_BLUETOOTHDEVICE
156# undef GSM_ENABLE_BLUEPHONET 156# undef GSM_ENABLE_BLUEPHONET
157# undef GSM_ENABLE_BLUEOBEX 157# undef GSM_ENABLE_BLUEOBEX
158# undef GSM_ENABLE_BLUEAT 158# undef GSM_ENABLE_BLUEAT
159# undef GSM_ENABLE_BLUEFBUS2 159# undef GSM_ENABLE_BLUEFBUS2
160# undef GSM_ENABLE_PHONETBLUE 160# undef GSM_ENABLE_PHONETBLUE
161# undef GSM_ENABLE_FBUS2BLUE 161# undef GSM_ENABLE_FBUS2BLUE
162# undef GSM_ENABLE_MROUTERBLUE 162# undef GSM_ENABLE_MROUTERBLUE
163#endif 163#endif
164
165#ifndef WIN32 164#ifndef WIN32
166# ifdef ENABLE_LGPL 165# ifdef ENABLE_LGPL
167# undef GSM_ENABLE_IRDADEVICE 166# undef GSM_ENABLE_IRDADEVICE
168# undef GSM_ENABLE_IRDAPHONET 167# undef GSM_ENABLE_IRDAPHONET
169# undef GSM_ENABLE_IRDAOBEX 168# undef GSM_ENABLE_IRDAOBEX
170# undef GSM_ENABLE_IRDAAT 169# undef GSM_ENABLE_IRDAAT
171# undef GSM_ENABLE_FBUS2IRDA 170# undef GSM_ENABLE_FBUS2IRDA
172 171
173# undef GSM_ENABLE_BLUETOOTHDEVICE 172# undef GSM_ENABLE_BLUETOOTHDEVICE
174# undef GSM_ENABLE_BLUEPHONET 173# undef GSM_ENABLE_BLUEPHONET
175# undef GSM_ENABLE_BLUEOBEX 174# undef GSM_ENABLE_BLUEOBEX
176# undef GSM_ENABLE_BLUEAT 175# undef GSM_ENABLE_BLUEAT
177# undef GSM_ENABLE_BLUEFBUS2 176# undef GSM_ENABLE_BLUEFBUS2
178# undef GSM_ENABLE_PHONETBLUE 177# undef GSM_ENABLE_PHONETBLUE
179# undef GSM_ENABLE_FBUS2BLUE 178# undef GSM_ENABLE_FBUS2BLUE
180# undef GSM_ENABLE_MROUTERBLUE 179# undef GSM_ENABLE_MROUTERBLUE
181# endif 180# endif
182#endif 181#endif
183 182
184#ifdef GSM_ENABLE_SERIALDEVICE 183#ifdef GSM_ENABLE_SERIALDEVICE
185# include "device/serial/ser_w32.h" 184# include "device/serial/ser_w32.h"
186# include "device/serial/ser_unx.h" 185# include "device/serial/ser_unx.h"
187# include "device/serial/ser_djg.h" 186# include "device/serial/ser_djg.h"
188#endif 187#endif
189#ifdef GSM_ENABLE_IRDADEVICE 188#ifdef GSM_ENABLE_IRDADEVICE
190# include "device/irda/irda.h" 189# include "device/irda/irda.h"
191#endif 190#endif
192#ifdef GSM_ENABLE_BLUETOOTHDEVICE 191#ifdef GSM_ENABLE_BLUETOOTHDEVICE
193# include "device/bluetoth/bluetoth.h" 192# include "device/bluetoth/bluetoth.h"
194#endif 193#endif
195 194
196#include "service/gsmpbk.h" 195#include "service/gsmpbk.h"
197#include "service/gsmnet.h" 196#include "service/gsmnet.h"
198#include "service/gsmring.h" 197#include "service/gsmring.h"
199#include "service/gsmcal.h" 198#include "service/gsmcal.h"
200#include "service/gsmdata.h" 199#include "service/gsmdata.h"
201#include "service/gsmlogo.h" 200#include "service/gsmlogo.h"
202#include "service/gsmmisc.h" 201#include "service/gsmmisc.h"
203#include "service/gsmprof.h" 202#include "service/gsmprof.h"
204#include "service/gsmcall.h" 203#include "service/gsmcall.h"
205#include "service/sms/gsmsms.h" 204#include "service/sms/gsmsms.h"
206#include "service/sms/gsmems.h" 205#include "service/sms/gsmems.h"
207#include "service/sms/gsmmulti.h" 206#include "service/sms/gsmmulti.h"
208#include "service/backup/gsmback.h" 207#include "service/backup/gsmback.h"
209 208
210 209
211/* ------------------------- Device layer ---------------------------------- */ 210/* ------------------------- Device layer ---------------------------------- */
212 211
@@ -1532,48 +1531,49 @@ typedef enum {
1532 F_NOFILESYSTEM, /* No images, ringtones, java saved in special filesystem*/ 1531 F_NOFILESYSTEM, /* No images, ringtones, java saved in special filesystem*/
1533 F_NOMMS, /* No MMS sets in phone */ 1532 F_NOMMS, /* No MMS sets in phone */
1534 F_NOGPRSPOINT, /* GPRS point are not useable */ 1533 F_NOGPRSPOINT, /* GPRS point are not useable */
1535 F_CAL35, /* Calendar,3510 style - Reminder,Call,Birthday */ 1534 F_CAL35, /* Calendar,3510 style - Reminder,Call,Birthday */
1536 F_CAL65, /* Calendar,6510 style - CBMM, method 3 */ 1535 F_CAL65, /* Calendar,6510 style - CBMM, method 3 */
1537 F_WAPMMSPROXY, /* WAP & MMS settings contains first & second proxy */ 1536 F_WAPMMSPROXY, /* WAP & MMS settings contains first & second proxy */
1538 1537
1539 /* n6510.c && n7110.c */ 1538 /* n6510.c && n7110.c */
1540 F_VOICETAGS, /* Voice tags available */ 1539 F_VOICETAGS, /* Voice tags available */
1541 F_CAL62, /* Calendar,6210 style - Call,Birthday,Memo,Meeting */ 1540 F_CAL62, /* Calendar,6210 style - Call,Birthday,Memo,Meeting */
1542 F_NOTES, 1541 F_NOTES,
1543 1542
1544 /* AT modules */ 1543 /* AT modules */
1545 F_SMSONLYSENT, /* Phone supports only sent/unsent messages */ 1544 F_SMSONLYSENT, /* Phone supports only sent/unsent messages */
1546 F_BROKENCPBS, /* CPBS on some memories can hang phone */ 1545 F_BROKENCPBS, /* CPBS on some memories can hang phone */
1547 F_M20SMS, /* Siemens M20 like SMS handling */ 1546 F_M20SMS, /* Siemens M20 like SMS handling */
1548 F_SLOWWRITE, /* Use slower writing which some phone need */ 1547 F_SLOWWRITE, /* Use slower writing which some phone need */
1549 F_SMSME900, /* SMS in ME start from location 900 - case of Sagem */ 1548 F_SMSME900, /* SMS in ME start from location 900 - case of Sagem */
1550 F_ALCATEL /* Phone supports Alcatel protocol */ 1549 F_ALCATEL /* Phone supports Alcatel protocol */
1551} Feature; 1550} Feature;
1552 1551
1553/* For models table */ 1552/* For models table */
1554struct _OnePhoneModel { 1553struct _OnePhoneModel {
1555 char *model; 1554 char *model;
1556 char *number; 1555 char *number;
1557 char *irdamodel; 1556 char *irdamodel;
1558 Feature features[12]; 1557 Feature features[12];
1559}; 1558};
1560 1559
1561 bool IsPhoneFeatureAvailable(OnePhoneModel *model, Feature feature); 1560 bool IsPhoneFeatureAvailable(OnePhoneModel *model, Feature feature);
1562 OnePhoneModel *GetModelData (char *model, char *number, char *irdamodel); 1561 OnePhoneModel *GetModelData (char *model, char *number, char *irdamodel);
1563 1562
1564#ifdef __GNUC__ 1563#ifdef __GNUC__
1565__attribute__((format(printf, 2, 3))) 1564__attribute__((format(printf, 2, 3)))
1566#endif 1565#endif
1567int smprintf(GSM_StateMachine *s, const char *format, ...); 1566int smprintf(GSM_StateMachine *s, const char *format, ...);
1568 1567
1569void GSM_OSErrorInfo(GSM_StateMachine *s, char *description); 1568void GSM_OSErrorInfo(GSM_StateMachine *s, char *description);
1570 1569
1571#ifdef GSM_ENABLE_BACKUP 1570#ifdef GSM_ENABLE_BACKUP
1572void GSM_GetPhoneFeaturesForBackup(GSM_StateMachine *s, GSM_Backup_Info *info); 1571void GSM_GetPhoneFeaturesForBackup(GSM_StateMachine *s, GSM_Backup_Info *info);
1573#endif 1572#endif
1574 1573
1575#endif 1574#endif
1576 1575
1577/* How should editor hadle tabs in this file? Add editor commands here. 1576/* How should editor hadle tabs in this file? Add editor commands here.
1578 * vim: noexpandtab sw=8 ts=8 sts=8: 1577 * vim: noexpandtab sw=8 ts=8 sts=8:
1579 */ 1578 */
1579
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 7bec90a..b014cba 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,85 +1,86 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/*s 24/*s
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include "kabcore.h" 31#include "kabcore.h"
32 32
33#include <stdaddressbook.h> 33#include <stdaddressbook.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kfiledialog.h> 35#include <kfiledialog.h>
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qlabel.h> 37#include <qlabel.h>
38#include <qregexp.h>
38#include <qlineedit.h> 39#include <qlineedit.h>
39#include <qcheckbox.h> 40#include <qcheckbox.h>
40#include <qpushbutton.h> 41#include <qpushbutton.h>
41#include <qprogressbar.h> 42#include <qprogressbar.h>
42#include <libkdepim/phoneaccess.h> 43#include <libkdepim/phoneaccess.h>
43 44
44#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
45#include <qclipboard.h> 46#include <qclipboard.h>
46#include <qdir.h> 47#include <qdir.h>
47#include <qfile.h> 48#include <qfile.h>
48#include <qapplicaton.h> 49#include <qapplicaton.h>
49#include <qprogressbar.h> 50#include <qprogressbar.h>
50#include <qlayout.h> 51#include <qlayout.h>
51#include <qregexp.h> 52#include <qregexp.h>
52#include <qvbox.h> 53#include <qvbox.h>
53#include <kabc/addresseelist.h> 54#include <kabc/addresseelist.h>
54#include <kabc/errorhandler.h> 55#include <kabc/errorhandler.h>
55#include <kabc/resource.h> 56#include <kabc/resource.h>
56#include <kabc/vcardconverter.h> 57#include <kabc/vcardconverter.h>
57#include <kapplication.h> 58#include <kapplication.h>
58#include <kactionclasses.h> 59#include <kactionclasses.h>
59#include <kcmultidialog.h> 60#include <kcmultidialog.h>
60#include <kdebug.h> 61#include <kdebug.h>
61#include <kdeversion.h> 62#include <kdeversion.h>
62#include <kkeydialog.h> 63#include <kkeydialog.h>
63#include <kmessagebox.h> 64#include <kmessagebox.h>
64#include <kprinter.h> 65#include <kprinter.h>
65#include <kprotocolinfo.h> 66#include <kprotocolinfo.h>
66#include <kresources/selectdialog.h> 67#include <kresources/selectdialog.h>
67#include <kstandarddirs.h> 68#include <kstandarddirs.h>
68#include <ktempfile.h> 69#include <ktempfile.h>
69#include <kxmlguiclient.h> 70#include <kxmlguiclient.h>
70#include <kaboutdata.h> 71#include <kaboutdata.h>
71#include <libkdepim/categoryselectdialog.h> 72#include <libkdepim/categoryselectdialog.h>
72 73
73#include "addresseeutil.h" 74#include "addresseeutil.h"
74#include "addresseeeditordialog.h" 75#include "addresseeeditordialog.h"
75#include "extensionmanager.h" 76#include "extensionmanager.h"
76#include "kstdaction.h" 77#include "kstdaction.h"
77#include "kaddressbookservice.h" 78#include "kaddressbookservice.h"
78#include "ldapsearchdialog.h" 79#include "ldapsearchdialog.h"
79#include "printing/printingwizard.h" 80#include "printing/printingwizard.h"
80#else // KAB_EMBEDDED 81#else // KAB_EMBEDDED
81 82
82#include <kapplication.h> 83#include <kapplication.h>
83#include "KDGanttMinimizeSplitter.h" 84#include "KDGanttMinimizeSplitter.h"
84#include "kaddressbookmain.h" 85#include "kaddressbookmain.h"
85#include "kactioncollection.h" 86#include "kactioncollection.h"
@@ -681,96 +682,101 @@ void KABCore::export2phone()
681 682
682 QStringList uids = mViewManager->selectedUids(); 683 QStringList uids = mViewManager->selectedUids();
683 if ( uids.isEmpty() ) 684 if ( uids.isEmpty() )
684 return; 685 return;
685 686
686#ifdef _WIN32_ 687#ifdef _WIN32_
687 QString fileName = locateLocal("tmp", "tempfile.vcf"); 688 QString fileName = locateLocal("tmp", "tempfile.vcf");
688#else 689#else
689 QString fileName = "/tmp/kdepimtemp.vcf"; 690 QString fileName = "/tmp/kdepimtemp.vcf";
690#endif 691#endif
691 692
692 KABC::VCardConverter converter; 693 KABC::VCardConverter converter;
693 QString description; 694 QString description;
694 QString datastream; 695 QString datastream;
695 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 696 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
696 KABC::Addressee a = mAddressBook->findByUid( *it ); 697 KABC::Addressee a = mAddressBook->findByUid( *it );
697 698
698 if ( a.isEmpty() ) 699 if ( a.isEmpty() )
699 continue; 700 continue;
700 701
701 if (description.isEmpty()) 702 if (description.isEmpty())
702 description = a.formattedName(); 703 description = a.formattedName();
703 704
704 QString vcard; 705 QString vcard;
705 converter.addresseeToVCard( a, vcard ); 706 converter.addresseeToVCard( a, vcard );
706 int start = 0; 707 int start = 0;
707 int next; 708 int next;
708 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 709 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
709 int semi = vcard.find(";", next); 710 int semi = vcard.find(";", next);
710 int dopp = vcard.find(":", next); 711 int dopp = vcard.find(":", next);
711 int sep; 712 int sep;
712 if ( semi < dopp && semi >= 0 ) 713 if ( semi < dopp && semi >= 0 )
713 sep = semi ; 714 sep = semi ;
714 else 715 else
715 sep = dopp; 716 sep = dopp;
716 datastream +=vcard.mid( start, next - start); 717 datastream +=vcard.mid( start, next - start);
717 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 718 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
718 start = sep; 719 start = sep;
719 } 720 }
720 datastream += vcard.mid( start,vcard.length() ); 721 datastream += vcard.mid( start,vcard.length() );
721 } 722 }
722 QFile outFile(fileName); 723 QFile outFile(fileName);
723 if ( outFile.open(IO_WriteOnly) ) { 724 if ( outFile.open(IO_WriteOnly) ) {
724 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 725 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
725 QTextStream t( &outFile ); // use a text stream 726 QTextStream t( &outFile ); // use a text stream
726 t.setEncoding( QTextStream::UnicodeUTF8 ); 727 t.setEncoding( QTextStream::UnicodeUTF8 );
727 t <<datastream; 728 t <<datastream;
728 outFile.close(); 729 outFile.close();
730 if ( PhoneAccess::writeToPhone( fileName ) )
731 qDebug("Export okay ");
732 else
733 qDebug("Error export contacts ");
734
729 } else { 735 } else {
730 qDebug("Error open temp file "); 736 qDebug("Error open temp file ");
731 return; 737 return;
732 } 738 }
733 739
734 740
735#if 0 741#if 0
736 742
737 setCaption( i18n("Writing to phone...")); 743 setCaption( i18n("Writing to phone..."));
738 if ( PhoneFormat::writeToPhone( cal ) ) 744 if ( PhoneFormat::writeToPhone( cal ) )
739 setCaption( i18n("Export to phone successful!")); 745 setCaption( i18n("Export to phone successful!"));
740 else 746 else
741 setCaption( i18n("Error exporting to phone!")); 747 setCaption( i18n("Error exporting to phone!"));
742#endif 748#endif
743 749
744 750
745} 751}
746void KABCore::beamVCard() 752void KABCore::beamVCard()
747{ 753{
748 QStringList uids = mViewManager->selectedUids(); 754 QStringList uids = mViewManager->selectedUids();
749 if ( !uids.isEmpty() ) 755 if ( !uids.isEmpty() )
750 beamVCard( uids ); 756 beamVCard( uids );
751} 757}
752 758
753 759
754void KABCore::beamVCard(const QStringList& uids) 760void KABCore::beamVCard(const QStringList& uids)
755{ 761{
756/*US 762/*US
757 QString beamFilename; 763 QString beamFilename;
758 Opie::OPimContact c; 764 Opie::OPimContact c;
759 if ( actionPersonal->isOn() ) { 765 if ( actionPersonal->isOn() ) {
760 beamFilename = addressbookPersonalVCardName(); 766 beamFilename = addressbookPersonalVCardName();
761 if ( !QFile::exists( beamFilename ) ) 767 if ( !QFile::exists( beamFilename ) )
762 return; // can't beam a non-existent file 768 return; // can't beam a non-existent file
763 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 769 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
764 beamFilename ); 770 beamFilename );
765 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 771 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
766 Opie::OPimContactAccess::List allList = access->allRecords(); 772 Opie::OPimContactAccess::List allList = access->allRecords();
767 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first 773 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
768 c = *it; 774 c = *it;
769 775
770 delete access; 776 delete access;
771 } else { 777 } else {
772 unlink( beamfile ); // delete if exists 778 unlink( beamfile ); // delete if exists
773 mkdir("/tmp/obex/", 0755); 779 mkdir("/tmp/obex/", 0755);
774 c = m_abView -> currentEntry(); 780 c = m_abView -> currentEntry();
775 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 781 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
776 beamfile ); 782 beamfile );
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp
index c0bd6cc..357cd39 100644
--- a/libkdepim/phoneaccess.cpp
+++ b/libkdepim/phoneaccess.cpp
@@ -1,153 +1,147 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 3
4 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> 4 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
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 22
23#include <qstring.h> 23#include <qstring.h>
24#include <qapplication.h> 24#include <qapplication.h>
25#include <qptrlist.h> 25#include <qptrlist.h>
26#include <qregexp.h> 26#include <qregexp.h>
27#include <qfile.h> 27#include <qfile.h>
28#include <qtextstream.h> 28#include <qtextstream.h>
29#include <qtextcodec.h> 29#include <qtextcodec.h>
30#include <qdir.h> 30#include <qdir.h>
31#include <kmessagebox.h> 31#include <kmessagebox.h>
32#include <stdlib.h> 32#include <stdlib.h>
33#include "phoneaccess.h" 33#include "phoneaccess.h"
34 34
35void PhoneAccess::writeConfig( QString device, QString connection, QString model ) 35void PhoneAccess::writeConfig( QString device, QString connection, QString model )
36{ 36{
37#ifdef _WIN32_ 37#ifdef _WIN32_
38 QString fileName = qApp->applicationDirPath () +"\\gammurc"; 38 QString fileName = qApp->applicationDirPath () +"\\gammurc";
39#else 39#else
40 QString fileName = QDir::homeDirPath() +"/.gammurc"; 40 QString fileName = QDir::homeDirPath() +"/.gammurc";
41#endif 41#endif
42 //qDebug("save %d ", load ); 42 //qDebug("save %d ", load );
43 QString content; 43 QString content = "[gammu]\n";;
44 bool write = false; 44 bool write = false;
45 bool addPort = true, addConnection = true, addModel = true; 45 bool addPort = true, addConnection = true, addModel = true;
46 QFile file( fileName ); 46 QFile file( fileName );
47 if ( QFile::exists( fileName) ) { 47 if ( QFile::exists( fileName) ) {
48 if (!file.open( IO_ReadOnly ) ) { 48 if (!file.open( IO_ReadOnly ) ) {
49 qDebug("Error: cannot open %s ", fileName.latin1() ); 49 qDebug("Error: cannot open %s ", fileName.latin1() );
50 return; 50 return;
51 } 51 }
52 QString line; 52 QString line;
53 while ( file.readLine( line, 1024 ) > 0 ) { 53 while ( file.readLine( line, 1024 ) > 0 ) {
54 //qDebug("*%s* ", line.latin1() ); 54 //qDebug("*%s* ", line.latin1() );
55 if ( line.left(7 ) == "[gammu]" ) { 55 if ( line.left(7 ) == "[gammu]" ) {
56 ; 56 ;
57 } else 57 } else
58 if ( line.left(4 ) == "port" ) { 58 if ( line.left(4 ) == "port" ) {
59 if ( line == "port = " + device+"\n" ) { 59 if ( line == "port = " + device+"\n" ) {
60 content += line ; 60 content += line ;
61 addPort = false; 61 addPort = false;
62 //qDebug("port found" ); 62 //qDebug("port found" );
63 } 63 }
64 64
65 } else if ( line.left(5 ) == "model" ) { 65 } else if ( line.left(5 ) == "model" ) {
66 if ( line == "model = " + model +"\n") { 66 if ( line == "model = " + model +"\n") {
67 content += line ; 67 content += line ;
68 addModel = false; 68 addModel = false;
69 //qDebug("model found" ); 69 //qDebug("model found" );
70 } 70 }
71 71
72 } else if ( line.left( 10 ) == "connection" ) { 72 } else if ( line.left( 10 ) == "connection" ) {
73 if ( line == "connection = " + connection +"\n") { 73 if ( line == "connection = " + connection +"\n") {
74 addConnection = false; 74 addConnection = false;
75 content += line ; 75 content += line ;
76 //qDebug("con found" ); 76 //qDebug("con found" );
77 } 77 }
78 78
79 } else { 79 } else {
80 content += line ; 80 content += line ;
81 } 81 }
82 } 82 }
83 file.close(); 83 file.close();
84 } else { 84 } else {
85 if ( ! connection.isEmpty() ) { 85 if ( ! connection.isEmpty() ) {
86 addConnection = true; 86 addConnection = true;
87 } 87 }
88 if ( ! device.isEmpty() ) { 88 if ( ! device.isEmpty() ) {
89 addPort = true; 89 addPort = true;
90 90
91 } 91 }
92 if ( ! model.isEmpty() ) { 92 if ( ! model.isEmpty() ) {
93 addModel = true; 93 addModel = true;
94 } 94 }
95 } 95 }
96 96
97 if ( addConnection ) { 97 if ( addConnection ) {
98 if ( ! write )
99 content += "[gammu]\n";
100 write = true; 98 write = true;
101 content += "connection = "; 99 content += "connection = ";
102 content += connection; 100 content += connection;
103 content += "\n"; 101 content += "\n";
104 } 102 }
105 if ( addPort ) { 103 if ( addPort ) {
106 if ( ! write )
107 content += "[gammu]\n";
108 write = true; 104 write = true;
109 content += "port = "; 105 content += "port = ";
110 content += device; 106 content += device;
111 content += "\n"; 107 content += "\n";
112 108
113 } 109 }
114 if ( addModel ) { 110 if ( addModel ) {
115 if ( ! write )
116 content += "[gammu]\n";
117 write = true; 111 write = true;
118 content += "model = "; 112 content += "model = ";
119 content += model; 113 content += model;
120 content += "\n"; 114 content += "\n";
121 } 115 }
122 if ( write ) { 116 if ( write ) {
123 if (!file.open( IO_WriteOnly ) ) { 117 if (!file.open( IO_WriteOnly ) ) {
124 qDebug("Error: cannot write file %s ", fileName.latin1() ); 118 qDebug("Error: cannot write file %s ", fileName.latin1() );
125 return; 119 return;
126 } 120 }
127 qDebug("Writing file %s ", fileName.latin1() ); 121 qDebug("Writing file %s ", fileName.latin1() );
128 QTextStream ts( &file ); 122 QTextStream ts( &file );
129 ts << content ; 123 ts << content ;
130 file.close(); 124 file.close();
131 } 125 }
132 126
133} 127}
134 128
135 129
136bool PhoneAccess::writeToPhone( QString fileName) 130bool PhoneAccess::writeToPhone( QString fileName)
137{ 131{
138 132
139#ifdef DESKTOP_VERSION 133#ifdef DESKTOP_VERSION
140 QString command ="./kammu --restore " + fileName ; 134 QString command ="./kammu --restore " + fileName ;
141#else 135#else
142 QString command ="kammu --restore " + fileName ; 136 QString command ="kammu --restore " + fileName ;
143#endif 137#endif
144 int ret; 138 int ret;
145 while ( (ret = system ( command.latin1())) != 0 ) { 139 while ( (ret = system ( command.latin1())) != 0 ) {
146 qDebug("Error S::command returned %d. asking users", ret); 140 qDebug("Error S::command returned %d. asking users", ret);
147 int retval = KMessageBox::warningContinueCancel(0, 141 int retval = KMessageBox::warningContinueCancel(0,
148 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone access"),i18n("Retry"),i18n("Cancel")); 142 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone access"),i18n("Retry"),i18n("Cancel"));
149 if ( retval != KMessageBox::Continue ) 143 if ( retval != KMessageBox::Continue )
150 return false; 144 return false;
151 } 145 }
152 return true; 146 return true;
153} 147}