summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-10-06 16:20:25 (UTC)
committer zautrix <zautrix>2004-10-06 16:20:25 (UTC)
commit656636acfb8c607901c97c4f55129e29e1df9913 (patch) (unidiff)
tree25efd61a6b691822a11f43719efcbf69ce7d5c25 /kaddressbook
parenta22de800110d8350a5200a994b041e47d51bf4c6 (diff)
downloadkdepimpi-656636acfb8c607901c97c4f55129e29e1df9913.zip
kdepimpi-656636acfb8c607901c97c4f55129e29e1df9913.tar.gz
kdepimpi-656636acfb8c607901c97c4f55129e29e1df9913.tar.bz2
more fixes
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 185cf46..7bec90a 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -12,42 +12,43 @@
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/* 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 <qlineedit.h> 38#include <qlineedit.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qpushbutton.h> 40#include <qpushbutton.h>
41#include <qprogressbar.h> 41#include <qprogressbar.h>
42#include <libkdepim/phoneaccess.h>
42 43
43#ifndef KAB_EMBEDDED 44#ifndef KAB_EMBEDDED
44#include <qclipboard.h> 45#include <qclipboard.h>
45#include <qdir.h> 46#include <qdir.h>
46#include <qfile.h> 47#include <qfile.h>
47#include <qapplicaton.h> 48#include <qapplicaton.h>
48#include <qprogressbar.h> 49#include <qprogressbar.h>
49#include <qlayout.h> 50#include <qlayout.h>
50#include <qregexp.h> 51#include <qregexp.h>
51#include <qvbox.h> 52#include <qvbox.h>
52#include <kabc/addresseelist.h> 53#include <kabc/addresseelist.h>
53#include <kabc/errorhandler.h> 54#include <kabc/errorhandler.h>
@@ -664,39 +665,39 @@ void KABCore::export2phone()
664 KAex2phonePrefs ex2phone; 665 KAex2phonePrefs ex2phone;
665 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 666 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
666 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 667 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
667 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 668 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
668 669
669 if ( !ex2phone.exec() ) { 670 if ( !ex2phone.exec() ) {
670 return; 671 return;
671 } 672 }
672 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 673 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
673 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 674 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
674 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 675 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
675 676
676#if 0 677
677 PhoneFormat::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 678 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
678 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 679 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
679 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 680 KPimGlobalPrefs::instance()->mEx2PhoneModel );
680 681
682 QStringList uids = mViewManager->selectedUids();
683 if ( uids.isEmpty() )
684 return;
681 685
686#ifdef _WIN32_
687 QString fileName = locateLocal("tmp", "tempfile.vcf");
688#else
689 QString fileName = "/tmp/kdepimtemp.vcf";
690#endif
682 691
683
684
685 QString fileName = "/tmp/kapibeamfile.vcf";
686
687
688 //QDir().mkdir( dirName, true );
689
690
691 KABC::VCardConverter converter; 692 KABC::VCardConverter converter;
692 QString description; 693 QString description;
693 QString datastream; 694 QString datastream;
694 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 695 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
695 KABC::Addressee a = mAddressBook->findByUid( *it ); 696 KABC::Addressee a = mAddressBook->findByUid( *it );
696 697
697 if ( a.isEmpty() ) 698 if ( a.isEmpty() )
698 continue; 699 continue;
699 700
700 if (description.isEmpty()) 701 if (description.isEmpty())
701 description = a.formattedName(); 702 description = a.formattedName();
702 703
@@ -709,43 +710,38 @@ void KABCore::export2phone()
709 int dopp = vcard.find(":", next); 710 int dopp = vcard.find(":", next);
710 int sep; 711 int sep;
711 if ( semi < dopp && semi >= 0 ) 712 if ( semi < dopp && semi >= 0 )
712 sep = semi ; 713 sep = semi ;
713 else 714 else
714 sep = dopp; 715 sep = dopp;
715 datastream +=vcard.mid( start, next - start); 716 datastream +=vcard.mid( start, next - start);
716 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 717 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
717 start = sep; 718 start = sep;
718 } 719 }
719 datastream += vcard.mid( start,vcard.length() ); 720 datastream += vcard.mid( start,vcard.length() );
720 } 721 }
721#ifndef DESKTOP_VERSION
722 QFile outFile(fileName); 722 QFile outFile(fileName);
723 if ( outFile.open(IO_WriteOnly) ) { 723 if ( outFile.open(IO_WriteOnly) ) {
724 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 724 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
725 QTextStream t( &outFile ); // use a text stream 725 QTextStream t( &outFile ); // use a text stream
726 t.setEncoding( QTextStream::UnicodeUTF8 ); 726 t.setEncoding( QTextStream::UnicodeUTF8 );
727 t <<datastream; 727 t <<datastream;
728 outFile.close(); 728 outFile.close();
729 Ir *ir = new Ir( this );
730 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
731 ir->send( fileName, description, "text/x-vCard" );
732 } else { 729 } else {
733 qDebug("Error open temp beam file "); 730 qDebug("Error open temp file ");
734 return; 731 return;
735 } 732 }
736#endif
737
738 733
739 734
735#if 0
740 736
741 setCaption( i18n("Writing to phone...")); 737 setCaption( i18n("Writing to phone..."));
742 if ( PhoneFormat::writeToPhone( cal ) ) 738 if ( PhoneFormat::writeToPhone( cal ) )
743 setCaption( i18n("Export to phone successful!")); 739 setCaption( i18n("Export to phone successful!"));
744 else 740 else
745 setCaption( i18n("Error exporting to phone!")); 741 setCaption( i18n("Error exporting to phone!"));
746#endif 742#endif
747 743
748 744
749} 745}
750void KABCore::beamVCard() 746void KABCore::beamVCard()
751{ 747{