summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-11-08 21:29:18 (UTC)
committer zautrix <zautrix>2004-11-08 21:29:18 (UTC)
commit7b899c8a9c38cf96fca6c46b20ae406a716dd213 (patch) (unidiff)
tree8c1df14a990de3a630d54a3edf8a6838a7697438
parent4481ce9842b3820087b24a8bfce2c194974aae73 (diff)
downloadkdepimpi-7b899c8a9c38cf96fca6c46b20ae406a716dd213.zip
kdepimpi-7b899c8a9c38cf96fca6c46b20ae406a716dd213.tar.gz
kdepimpi-7b899c8a9c38cf96fca6c46b20ae406a716dd213.tar.bz2
Better phone export contact selection
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp19
-rw-r--r--kaddressbook/xxportselectdialog.cpp9
-rw-r--r--kaddressbook/xxportselectdialog.h1
-rw-r--r--version2
4 files changed, 23 insertions, 8 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index c339244..755da11 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,245 +1,246 @@
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 <qregexp.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qcheckbox.h> 40#include <qcheckbox.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qprogressbar.h> 42#include <qprogressbar.h>
43#include <libkdepim/phoneaccess.h> 43#include <libkdepim/phoneaccess.h>
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46#include <qclipboard.h> 46#include <qclipboard.h>
47#include <qdir.h> 47#include <qdir.h>
48#include <qfile.h> 48#include <qfile.h>
49#include <qapplicaton.h> 49#include <qapplicaton.h>
50#include <qprogressbar.h> 50#include <qprogressbar.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qregexp.h> 52#include <qregexp.h>
53#include <qvbox.h> 53#include <qvbox.h>
54#include <kabc/addresseelist.h> 54#include <kabc/addresseelist.h>
55#include <kabc/errorhandler.h> 55#include <kabc/errorhandler.h>
56#include <kabc/resource.h> 56#include <kabc/resource.h>
57#include <kabc/vcardconverter.h> 57#include <kabc/vcardconverter.h>
58#include <kapplication.h> 58#include <kapplication.h>
59#include <kactionclasses.h> 59#include <kactionclasses.h>
60#include <kcmultidialog.h> 60#include <kcmultidialog.h>
61#include <kdebug.h> 61#include <kdebug.h>
62#include <kdeversion.h> 62#include <kdeversion.h>
63#include <kkeydialog.h> 63#include <kkeydialog.h>
64#include <kmessagebox.h> 64#include <kmessagebox.h>
65#include <kprinter.h> 65#include <kprinter.h>
66#include <kprotocolinfo.h> 66#include <kprotocolinfo.h>
67#include <kresources/selectdialog.h> 67#include <kresources/selectdialog.h>
68#include <kstandarddirs.h> 68#include <kstandarddirs.h>
69#include <ktempfile.h> 69#include <ktempfile.h>
70#include <kxmlguiclient.h> 70#include <kxmlguiclient.h>
71#include <kaboutdata.h> 71#include <kaboutdata.h>
72#include <libkdepim/categoryselectdialog.h> 72#include <libkdepim/categoryselectdialog.h>
73 73
74#include "addresseeutil.h" 74#include "addresseeutil.h"
75#include "addresseeeditordialog.h" 75#include "addresseeeditordialog.h"
76#include "extensionmanager.h" 76#include "extensionmanager.h"
77#include "kstdaction.h" 77#include "kstdaction.h"
78#include "kaddressbookservice.h" 78#include "kaddressbookservice.h"
79#include "ldapsearchdialog.h" 79#include "ldapsearchdialog.h"
80#include "printing/printingwizard.h" 80#include "printing/printingwizard.h"
81#else // KAB_EMBEDDED 81#else // KAB_EMBEDDED
82 82
83#include <kapplication.h> 83#include <kapplication.h>
84#include "KDGanttMinimizeSplitter.h" 84#include "KDGanttMinimizeSplitter.h"
85#include "kaddressbookmain.h" 85#include "kaddressbookmain.h"
86#include "kactioncollection.h" 86#include "kactioncollection.h"
87#include "addresseedialog.h" 87#include "addresseedialog.h"
88//US 88//US
89#include <addresseeview.h> 89#include <addresseeview.h>
90 90
91#include <qapp.h> 91#include <qapp.h>
92#include <qmenubar.h> 92#include <qmenubar.h>
93//#include <qtoolbar.h> 93//#include <qtoolbar.h>
94#include <qmessagebox.h> 94#include <qmessagebox.h>
95#include <kdebug.h> 95#include <kdebug.h>
96#include <kiconloader.h> // needed for SmallIcon 96#include <kiconloader.h> // needed for SmallIcon
97#include <kresources/kcmkresources.h> 97#include <kresources/kcmkresources.h>
98#include <ktoolbar.h> 98#include <ktoolbar.h>
99 99
100 100
101//#include <qlabel.h> 101//#include <qlabel.h>
102 102
103 103
104#ifndef DESKTOP_VERSION 104#ifndef DESKTOP_VERSION
105#include <qpe/ir.h> 105#include <qpe/ir.h>
106#include <qpe/qpemenubar.h> 106#include <qpe/qpemenubar.h>
107#include <qtopia/qcopenvelope_qws.h> 107#include <qtopia/qcopenvelope_qws.h>
108#else 108#else
109 109
110#include <qmenubar.h> 110#include <qmenubar.h>
111#endif 111#endif
112 112
113#endif // KAB_EMBEDDED 113#endif // KAB_EMBEDDED
114#include "kcmconfigs/kcmkabconfig.h" 114#include "kcmconfigs/kcmkabconfig.h"
115#include "kcmconfigs/kcmkdepimconfig.h" 115#include "kcmconfigs/kcmkdepimconfig.h"
116#include "kpimglobalprefs.h" 116#include "kpimglobalprefs.h"
117#include "externalapphandler.h" 117#include "externalapphandler.h"
118#include "xxportselectdialog.h"
118 119
119 120
120#include <kresources/selectdialog.h> 121#include <kresources/selectdialog.h>
121#include <kmessagebox.h> 122#include <kmessagebox.h>
122 123
123#include <picture.h> 124#include <picture.h>
124#include <resource.h> 125#include <resource.h>
125 126
126//US#include <qsplitter.h> 127//US#include <qsplitter.h>
127#include <qmap.h> 128#include <qmap.h>
128#include <qdir.h> 129#include <qdir.h>
129#include <qfile.h> 130#include <qfile.h>
130#include <qvbox.h> 131#include <qvbox.h>
131#include <qlayout.h> 132#include <qlayout.h>
132#include <qclipboard.h> 133#include <qclipboard.h>
133#include <qtextstream.h> 134#include <qtextstream.h>
134#include <qradiobutton.h> 135#include <qradiobutton.h>
135#include <qbuttongroup.h> 136#include <qbuttongroup.h>
136 137
137#include <libkdepim/categoryselectdialog.h> 138#include <libkdepim/categoryselectdialog.h>
138#include <libkdepim/categoryeditdialog.h> 139#include <libkdepim/categoryeditdialog.h>
139#include <kabc/vcardconverter.h> 140#include <kabc/vcardconverter.h>
140 141
141 142
142#include "addresseeutil.h" 143#include "addresseeutil.h"
143#include "undocmds.h" 144#include "undocmds.h"
144#include "addresseeeditordialog.h" 145#include "addresseeeditordialog.h"
145#include "viewmanager.h" 146#include "viewmanager.h"
146#include "details/detailsviewcontainer.h" 147#include "details/detailsviewcontainer.h"
147#include "kabprefs.h" 148#include "kabprefs.h"
148#include "xxportmanager.h" 149#include "xxportmanager.h"
149#include "incsearchwidget.h" 150#include "incsearchwidget.h"
150#include "jumpbuttonbar.h" 151#include "jumpbuttonbar.h"
151#include "extensionmanager.h" 152#include "extensionmanager.h"
152#include "addresseeconfig.h" 153#include "addresseeconfig.h"
153#include <kcmultidialog.h> 154#include <kcmultidialog.h>
154 155
155#ifdef _WIN32_ 156#ifdef _WIN32_
156 157
157#include "kaimportoldialog.h" 158#include "kaimportoldialog.h"
158#else 159#else
159#include <unistd.h> 160#include <unistd.h>
160#endif 161#endif
161// sync includes 162// sync includes
162#include <libkdepim/ksyncprofile.h> 163#include <libkdepim/ksyncprofile.h>
163#include <libkdepim/ksyncprefsdialog.h> 164#include <libkdepim/ksyncprefsdialog.h>
164 165
165 166
166class KABCatPrefs : public QDialog 167class KABCatPrefs : public QDialog
167{ 168{
168 public: 169 public:
169 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 170 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
170 QDialog( parent, name, true ) 171 QDialog( parent, name, true )
171 { 172 {
172 setCaption( i18n("Manage new Categories") ); 173 setCaption( i18n("Manage new Categories") );
173 QVBoxLayout* lay = new QVBoxLayout( this ); 174 QVBoxLayout* lay = new QVBoxLayout( this );
174 lay->setSpacing( 3 ); 175 lay->setSpacing( 3 );
175 lay->setMargin( 3 ); 176 lay->setMargin( 3 );
176 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 177 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
177 lay->addWidget( lab ); 178 lay->addWidget( lab );
178 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 179 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
179 lay->addWidget( format ); 180 lay->addWidget( format );
180 format->setExclusive ( true ) ; 181 format->setExclusive ( true ) ;
181 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 182 addCatBut = new QRadioButton(i18n("Add to category list"), format );
182 new QRadioButton(i18n("Remove from addressees"), format ); 183 new QRadioButton(i18n("Remove from addressees"), format );
183 addCatBut->setChecked( true ); 184 addCatBut->setChecked( true );
184 QPushButton * ok = new QPushButton( i18n("OK"), this ); 185 QPushButton * ok = new QPushButton( i18n("OK"), this );
185 lay->addWidget( ok ); 186 lay->addWidget( ok );
186 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 187 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
187 lay->addWidget( cancel ); 188 lay->addWidget( cancel );
188 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 189 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
189 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 190 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
190 resize( 200, 200 ); 191 resize( 200, 200 );
191 } 192 }
192 193
193 bool addCat() { return addCatBut->isChecked(); } 194 bool addCat() { return addCatBut->isChecked(); }
194private: 195private:
195 QRadioButton* addCatBut; 196 QRadioButton* addCatBut;
196}; 197};
197 198
198 199
199 200
200class KAex2phonePrefs : public QDialog 201class KAex2phonePrefs : public QDialog
201{ 202{
202 public: 203 public:
203 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 204 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
204 QDialog( parent, name, true ) 205 QDialog( parent, name, true )
205 { 206 {
206 setCaption( i18n("Export to phone options") ); 207 setCaption( i18n("Export to phone options") );
207 QVBoxLayout* lay = new QVBoxLayout( this ); 208 QVBoxLayout* lay = new QVBoxLayout( this );
208 lay->setSpacing( 3 ); 209 lay->setSpacing( 3 );
209 lay->setMargin( 3 ); 210 lay->setMargin( 3 );
210 QLabel *lab; 211 QLabel *lab;
211 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 212 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
212 lab->setAlignment (AlignHCenter ); 213 lab->setAlignment (AlignHCenter );
213 QHBox* temphb; 214 QHBox* temphb;
214 temphb = new QHBox( this ); 215 temphb = new QHBox( this );
215 new QLabel( i18n("I/O device: "), temphb ); 216 new QLabel( i18n("I/O device: "), temphb );
216 mPhoneDevice = new QLineEdit( temphb); 217 mPhoneDevice = new QLineEdit( temphb);
217 lay->addWidget( temphb ); 218 lay->addWidget( temphb );
218 temphb = new QHBox( this ); 219 temphb = new QHBox( this );
219 new QLabel( i18n("Connection: "), temphb ); 220 new QLabel( i18n("Connection: "), temphb );
220 mPhoneConnection = new QLineEdit( temphb); 221 mPhoneConnection = new QLineEdit( temphb);
221 lay->addWidget( temphb ); 222 lay->addWidget( temphb );
222 temphb = new QHBox( this ); 223 temphb = new QHBox( this );
223 new QLabel( i18n("Model(opt.): "), temphb ); 224 new QLabel( i18n("Model(opt.): "), temphb );
224 mPhoneModel = new QLineEdit( temphb); 225 mPhoneModel = new QLineEdit( temphb);
225 lay->addWidget( temphb ); 226 lay->addWidget( temphb );
226 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 227 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
227 // lay->addWidget( mWriteToSim ); 228 // lay->addWidget( mWriteToSim );
228 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 229 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
229 lab->setAlignment (AlignHCenter ); 230 lab->setAlignment (AlignHCenter );
230 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 231 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
231 lay->addWidget( ok ); 232 lay->addWidget( ok );
232 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 233 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
233 lay->addWidget( cancel ); 234 lay->addWidget( cancel );
234 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 235 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
235 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 236 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
236 resize( 220, 240 ); 237 resize( 220, 240 );
237 238
238 } 239 }
239 240
240public: 241public:
241 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 242 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
242 QCheckBox* mWriteToSim; 243 QCheckBox* mWriteToSim;
243}; 244};
244 245
245 246
@@ -553,380 +554,384 @@ KABC::Field *KABCore::currentSearchField() const
553} 554}
554 555
555QStringList KABCore::selectedUIDs() const 556QStringList KABCore::selectedUIDs() const
556{ 557{
557 return mViewManager->selectedUids(); 558 return mViewManager->selectedUids();
558} 559}
559 560
560KABC::Resource *KABCore::requestResource( QWidget *parent ) 561KABC::Resource *KABCore::requestResource( QWidget *parent )
561{ 562{
562 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 563 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
563 564
564 QPtrList<KRES::Resource> kresResources; 565 QPtrList<KRES::Resource> kresResources;
565 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 566 QPtrListIterator<KABC::Resource> resIt( kabcResources );
566 KABC::Resource *resource; 567 KABC::Resource *resource;
567 while ( ( resource = resIt.current() ) != 0 ) { 568 while ( ( resource = resIt.current() ) != 0 ) {
568 ++resIt; 569 ++resIt;
569 if ( !resource->readOnly() ) { 570 if ( !resource->readOnly() ) {
570 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 571 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
571 if ( res ) 572 if ( res )
572 kresResources.append( res ); 573 kresResources.append( res );
573 } 574 }
574 } 575 }
575 576
576 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 577 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
577 return static_cast<KABC::Resource*>( res ); 578 return static_cast<KABC::Resource*>( res );
578} 579}
579 580
580#ifndef KAB_EMBEDDED 581#ifndef KAB_EMBEDDED
581KAboutData *KABCore::createAboutData() 582KAboutData *KABCore::createAboutData()
582#else //KAB_EMBEDDED 583#else //KAB_EMBEDDED
583void KABCore::createAboutData() 584void KABCore::createAboutData()
584#endif //KAB_EMBEDDED 585#endif //KAB_EMBEDDED
585{ 586{
586#ifndef KAB_EMBEDDED 587#ifndef KAB_EMBEDDED
587 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 588 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
588 "3.1", I18N_NOOP( "The KDE Address Book" ), 589 "3.1", I18N_NOOP( "The KDE Address Book" ),
589 KAboutData::License_GPL_V2, 590 KAboutData::License_GPL_V2,
590 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 591 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
591 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 592 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
592 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 593 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
593 about->addAuthor( "Cornelius Schumacher", 594 about->addAuthor( "Cornelius Schumacher",
594 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 595 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
595 "schumacher@kde.org" ); 596 "schumacher@kde.org" );
596 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 597 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
597 "mpilone@slac.com" ); 598 "mpilone@slac.com" );
598 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 599 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
599 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 600 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
600 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 601 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
601 "michel@klaralvdalens-datakonsult.se" ); 602 "michel@klaralvdalens-datakonsult.se" );
602 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 603 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
603 "hansen@kde.org" ); 604 "hansen@kde.org" );
604 605
605 return about; 606 return about;
606#endif //KAB_EMBEDDED 607#endif //KAB_EMBEDDED
607 608
608 QString version; 609 QString version;
609#include <../version> 610#include <../version>
610 QMessageBox::about( this, "About KAddressbook/Pi", 611 QMessageBox::about( this, "About KAddressbook/Pi",
611 "KAddressbook/Platform-independent\n" 612 "KAddressbook/Platform-independent\n"
612 "(KA/Pi) " +version + " - " + 613 "(KA/Pi) " +version + " - " +
613#ifdef DESKTOP_VERSION 614#ifdef DESKTOP_VERSION
614 "Desktop Edition\n" 615 "Desktop Edition\n"
615#else 616#else
616 "PDA-Edition\n" 617 "PDA-Edition\n"
617 "for: Zaurus 5500 / 7x0 / 8x0\n" 618 "for: Zaurus 5500 / 7x0 / 8x0\n"
618#endif 619#endif
619 620
620 "(c) 2004 Ulf Schenk\n" 621 "(c) 2004 Ulf Schenk\n"
621 "(c) 2004 Lutz Rogowski\n" 622 "(c) 2004 Lutz Rogowski\n"
622 "(c) 1997-2003, The KDE PIM Team\n" 623 "(c) 1997-2003, The KDE PIM Team\n"
623 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 624 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
624 "Don Sanders Original author\n" 625 "Don Sanders Original author\n"
625 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 626 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
626 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 627 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
627 "Greg Stern DCOP interface\n" 628 "Greg Stern DCOP interface\n"
628 "Mark Westcot Contact pinning\n" 629 "Mark Westcot Contact pinning\n"
629 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 630 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
630 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 631 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
631#ifdef _WIN32_ 632#ifdef _WIN32_
632 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 633 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
633#endif 634#endif
634 ); 635 );
635} 636}
636 637
637void KABCore::setContactSelected( const QString &uid ) 638void KABCore::setContactSelected( const QString &uid )
638{ 639{
639 KABC::Addressee addr = mAddressBook->findByUid( uid ); 640 KABC::Addressee addr = mAddressBook->findByUid( uid );
640 if ( !mDetails->isHidden() ) 641 if ( !mDetails->isHidden() )
641 mDetails->setAddressee( addr ); 642 mDetails->setAddressee( addr );
642 643
643 if ( !addr.isEmpty() ) { 644 if ( !addr.isEmpty() ) {
644 emit contactSelected( addr.formattedName() ); 645 emit contactSelected( addr.formattedName() );
645 KABC::Picture pic = addr.photo(); 646 KABC::Picture pic = addr.photo();
646 if ( pic.isIntern() ) { 647 if ( pic.isIntern() ) {
647//US emit contactSelected( pic.data() ); 648//US emit contactSelected( pic.data() );
648//US instead use: 649//US instead use:
649 QPixmap px; 650 QPixmap px;
650 if (pic.data().isNull() != true) 651 if (pic.data().isNull() != true)
651 { 652 {
652 px.convertFromImage(pic.data()); 653 px.convertFromImage(pic.data());
653 } 654 }
654 655
655 emit contactSelected( px ); 656 emit contactSelected( px );
656 } 657 }
657 } 658 }
658 659
659 660
660 mExtensionManager->setSelectionChanged(); 661 mExtensionManager->setSelectionChanged();
661 662
662 // update the actions 663 // update the actions
663 bool selected = !uid.isEmpty(); 664 bool selected = !uid.isEmpty();
664 665
665 if ( mReadWrite ) { 666 if ( mReadWrite ) {
666 mActionCut->setEnabled( selected ); 667 mActionCut->setEnabled( selected );
667 mActionPaste->setEnabled( selected ); 668 mActionPaste->setEnabled( selected );
668 } 669 }
669 670
670 mActionCopy->setEnabled( selected ); 671 mActionCopy->setEnabled( selected );
671 mActionDelete->setEnabled( selected ); 672 mActionDelete->setEnabled( selected );
672 mActionEditAddressee->setEnabled( selected ); 673 mActionEditAddressee->setEnabled( selected );
673 mActionMail->setEnabled( selected ); 674 mActionMail->setEnabled( selected );
674 mActionMailVCard->setEnabled( selected ); 675 mActionMailVCard->setEnabled( selected );
675 //if (mActionBeam) 676 //if (mActionBeam)
676 //mActionBeam->setEnabled( selected ); 677 //mActionBeam->setEnabled( selected );
677 678
678 if (mActionBeamVCard) 679 if (mActionBeamVCard)
679 mActionBeamVCard->setEnabled( selected ); 680 mActionBeamVCard->setEnabled( selected );
680 681
681 mActionExport2phone->setEnabled( selected );
682 mActionWhoAmI->setEnabled( selected ); 682 mActionWhoAmI->setEnabled( selected );
683 mActionCategories->setEnabled( selected ); 683 mActionCategories->setEnabled( selected );
684} 684}
685 685
686void KABCore::sendMail() 686void KABCore::sendMail()
687{ 687{
688 sendMail( mViewManager->selectedEmails().join( ", " ) ); 688 sendMail( mViewManager->selectedEmails().join( ", " ) );
689} 689}
690 690
691void KABCore::sendMail( const QString& emaillist ) 691void KABCore::sendMail( const QString& emaillist )
692{ 692{
693 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 693 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
694 if (emaillist.contains(",") > 0) 694 if (emaillist.contains(",") > 0)
695 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 695 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
696 else 696 else
697 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 697 ExternalAppHandler::instance()->mailToOneContact( emaillist );
698} 698}
699 699
700 700
701 701
702void KABCore::mailVCard() 702void KABCore::mailVCard()
703{ 703{
704 QStringList uids = mViewManager->selectedUids(); 704 QStringList uids = mViewManager->selectedUids();
705 if ( !uids.isEmpty() ) 705 if ( !uids.isEmpty() )
706 mailVCard( uids ); 706 mailVCard( uids );
707} 707}
708 708
709void KABCore::mailVCard( const QStringList& uids ) 709void KABCore::mailVCard( const QStringList& uids )
710{ 710{
711 QStringList urls; 711 QStringList urls;
712 712
713// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 713// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
714 714
715 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 715 QString dirName = "/tmp/" + KApplication::randomString( 8 );
716 716
717 717
718 718
719 QDir().mkdir( dirName, true ); 719 QDir().mkdir( dirName, true );
720 720
721 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 721 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
722 KABC::Addressee a = mAddressBook->findByUid( *it ); 722 KABC::Addressee a = mAddressBook->findByUid( *it );
723 723
724 if ( a.isEmpty() ) 724 if ( a.isEmpty() )
725 continue; 725 continue;
726 726
727 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 727 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
728 728
729 QString fileName = dirName + "/" + name; 729 QString fileName = dirName + "/" + name;
730 730
731 QFile outFile(fileName); 731 QFile outFile(fileName);
732 732
733 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 733 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
734 KABC::VCardConverter converter; 734 KABC::VCardConverter converter;
735 QString vcard; 735 QString vcard;
736 736
737 converter.addresseeToVCard( a, vcard ); 737 converter.addresseeToVCard( a, vcard );
738 738
739 QTextStream t( &outFile ); // use a text stream 739 QTextStream t( &outFile ); // use a text stream
740 t.setEncoding( QTextStream::UnicodeUTF8 ); 740 t.setEncoding( QTextStream::UnicodeUTF8 );
741 t << vcard; 741 t << vcard;
742 742
743 outFile.close(); 743 outFile.close();
744 744
745 urls.append( fileName ); 745 urls.append( fileName );
746 } 746 }
747 } 747 }
748 748
749 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 749 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
750 750
751 751
752/*US 752/*US
753 kapp->invokeMailer( QString::null, QString::null, QString::null, 753 kapp->invokeMailer( QString::null, QString::null, QString::null,
754 QString::null, // subject 754 QString::null, // subject
755 QString::null, // body 755 QString::null, // body
756 QString::null, 756 QString::null,
757 urls ); // attachments 757 urls ); // attachments
758*/ 758*/
759 759
760} 760}
761 761
762/** 762/**
763 Beams the "WhoAmI contact. 763 Beams the "WhoAmI contact.
764*/ 764*/
765void KABCore::beamMySelf() 765void KABCore::beamMySelf()
766{ 766{
767 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 767 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
768 if (!a.isEmpty()) 768 if (!a.isEmpty())
769 { 769 {
770 QStringList uids; 770 QStringList uids;
771 uids << a.uid(); 771 uids << a.uid();
772 772
773 beamVCard(uids); 773 beamVCard(uids);
774 } else { 774 } else {
775 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 775 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
776 776
777 777
778 } 778 }
779} 779}
780 780
781void KABCore::export2phone() 781void KABCore::export2phone()
782{ 782{
783 783 QStringList uids;
784 XXPortSelectDialog dlg( this, false, this );
785 if ( dlg.exec() )
786 uids = dlg.uids();
787 else
788 return;
789 if ( uids.isEmpty() )
790 return;
791 // qDebug("count %d ", uids.count());
792
784 KAex2phonePrefs ex2phone; 793 KAex2phonePrefs ex2phone;
785 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 794 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
786 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 795 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
787 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 796 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
788 797
789 if ( !ex2phone.exec() ) { 798 if ( !ex2phone.exec() ) {
790 return; 799 return;
791 } 800 }
792 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 801 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
793 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 802 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
794 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 803 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
795 804
796 805
797 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 806 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
798 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 807 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
799 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 808 KPimGlobalPrefs::instance()->mEx2PhoneModel );
800 809
801 QStringList uids = mViewManager->selectedUids();
802 if ( uids.isEmpty() )
803 return;
804
805 QString fileName = getPhoneFile(); 810 QString fileName = getPhoneFile();
806 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 811 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
807 return; 812 return;
808 813
809 message(i18n("Exporting to phone...")); 814 message(i18n("Exporting to phone..."));
810 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 815 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
811 816
812} 817}
813QString KABCore::getPhoneFile() 818QString KABCore::getPhoneFile()
814{ 819{
815#ifdef DESKTOP_VERSION 820#ifdef DESKTOP_VERSION
816 return locateLocal("tmp", "phonefile.vcf"); 821 return locateLocal("tmp", "phonefile.vcf");
817#else 822#else
818 return "/tmp/phonefile.vcf"; 823 return "/tmp/phonefile.vcf";
819#endif 824#endif
820 825
821} 826}
822void KABCore::writeToPhone( ) 827void KABCore::writeToPhone( )
823{ 828{
824 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 829 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
825 message(i18n("Export to phone finished!")); 830 message(i18n("Export to phone finished!"));
826 else 831 else
827 qDebug(i18n("Error exporting to phone")); 832 qDebug(i18n("Error exporting to phone"));
828} 833}
829void KABCore::beamVCard() 834void KABCore::beamVCard()
830{ 835{
831 QStringList uids = mViewManager->selectedUids(); 836 QStringList uids = mViewManager->selectedUids();
832 if ( !uids.isEmpty() ) 837 if ( !uids.isEmpty() )
833 beamVCard( uids ); 838 beamVCard( uids );
834} 839}
835 840
836 841
837void KABCore::beamVCard(const QStringList& uids) 842void KABCore::beamVCard(const QStringList& uids)
838{ 843{
839 844
840 // LR: we should use the /tmp dir on the Zaurus, 845 // LR: we should use the /tmp dir on the Zaurus,
841 // because: /tmp = RAM, (HOME)/kdepim = flash memory 846 // because: /tmp = RAM, (HOME)/kdepim = flash memory
842 847
843#ifdef DESKTOP_VERSION 848#ifdef DESKTOP_VERSION
844 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 849 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
845#else 850#else
846 QString fileName = "/tmp/kapibeamfile.vcf"; 851 QString fileName = "/tmp/kapibeamfile.vcf";
847#endif 852#endif
848 853
849 KABC::VCardConverter converter; 854 KABC::VCardConverter converter;
850 QString description; 855 QString description;
851 QString datastream; 856 QString datastream;
852 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 857 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
853 KABC::Addressee a = mAddressBook->findByUid( *it ); 858 KABC::Addressee a = mAddressBook->findByUid( *it );
854 859
855 if ( a.isEmpty() ) 860 if ( a.isEmpty() )
856 continue; 861 continue;
857 862
858 if (description.isEmpty()) 863 if (description.isEmpty())
859 description = a.formattedName(); 864 description = a.formattedName();
860 865
861 QString vcard; 866 QString vcard;
862 converter.addresseeToVCard( a, vcard ); 867 converter.addresseeToVCard( a, vcard );
863 int start = 0; 868 int start = 0;
864 int next; 869 int next;
865 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 870 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
866 int semi = vcard.find(";", next); 871 int semi = vcard.find(";", next);
867 int dopp = vcard.find(":", next); 872 int dopp = vcard.find(":", next);
868 int sep; 873 int sep;
869 if ( semi < dopp && semi >= 0 ) 874 if ( semi < dopp && semi >= 0 )
870 sep = semi ; 875 sep = semi ;
871 else 876 else
872 sep = dopp; 877 sep = dopp;
873 datastream +=vcard.mid( start, next - start); 878 datastream +=vcard.mid( start, next - start);
874 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 879 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
875 start = sep; 880 start = sep;
876 } 881 }
877 datastream += vcard.mid( start,vcard.length() ); 882 datastream += vcard.mid( start,vcard.length() );
878 } 883 }
879#ifndef DESKTOP_VERSION 884#ifndef DESKTOP_VERSION
880 QFile outFile(fileName); 885 QFile outFile(fileName);
881 if ( outFile.open(IO_WriteOnly) ) { 886 if ( outFile.open(IO_WriteOnly) ) {
882 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 887 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
883 QTextStream t( &outFile ); // use a text stream 888 QTextStream t( &outFile ); // use a text stream
884 //t.setEncoding( QTextStream::UnicodeUTF8 ); 889 //t.setEncoding( QTextStream::UnicodeUTF8 );
885 t.setEncoding( QTextStream::Latin1 ); 890 t.setEncoding( QTextStream::Latin1 );
886 t <<datastream.latin1(); 891 t <<datastream.latin1();
887 outFile.close(); 892 outFile.close();
888 Ir *ir = new Ir( this ); 893 Ir *ir = new Ir( this );
889 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 894 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
890 ir->send( fileName, description, "text/x-vCard" ); 895 ir->send( fileName, description, "text/x-vCard" );
891 } else { 896 } else {
892 qDebug("Error open temp beam file "); 897 qDebug("Error open temp beam file ");
893 return; 898 return;
894 } 899 }
895#endif 900#endif
896 901
897} 902}
898 903
899void KABCore::beamDone( Ir *ir ) 904void KABCore::beamDone( Ir *ir )
900{ 905{
901#ifndef DESKTOP_VERSION 906#ifndef DESKTOP_VERSION
902 delete ir; 907 delete ir;
903#endif 908#endif
904 topLevelWidget()->raise(); 909 topLevelWidget()->raise();
905 message( i18n("Beaming finished!") ); 910 message( i18n("Beaming finished!") );
906} 911}
907 912
908 913
909void KABCore::browse( const QString& url ) 914void KABCore::browse( const QString& url )
910{ 915{
911#ifndef KAB_EMBEDDED 916#ifndef KAB_EMBEDDED
912 kapp->invokeBrowser( url ); 917 kapp->invokeBrowser( url );
913#else //KAB_EMBEDDED 918#else //KAB_EMBEDDED
914 qDebug("KABCore::browse must be fixed"); 919 qDebug("KABCore::browse must be fixed");
915#endif //KAB_EMBEDDED 920#endif //KAB_EMBEDDED
916} 921}
917 922
918void KABCore::selectAllContacts() 923void KABCore::selectAllContacts()
919{ 924{
920 mViewManager->setSelected( QString::null, true ); 925 mViewManager->setSelected( QString::null, true );
921} 926}
922 927
923void KABCore::deleteContacts() 928void KABCore::deleteContacts()
924{ 929{
925 QStringList uidList = mViewManager->selectedUids(); 930 QStringList uidList = mViewManager->selectedUids();
926 deleteContacts( uidList ); 931 deleteContacts( uidList );
927} 932}
928 933
929void KABCore::deleteContacts( const QStringList &uids ) 934void KABCore::deleteContacts( const QStringList &uids )
930{ 935{
931 if ( uids.count() > 0 ) { 936 if ( uids.count() > 0 ) {
932 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 937 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
@@ -1674,257 +1679,257 @@ void KABCore::initGUI()
1674 topLayout = new QHBoxLayout( this ); 1679 topLayout = new QHBoxLayout( this );
1675 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1680 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1676 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1681 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1677 } else { 1682 } else {
1678 1683
1679 topLayout = new QHBoxLayout( this ); 1684 topLayout = new QHBoxLayout( this );
1680 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1685 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1681 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1686 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1682 } 1687 }
1683 1688
1684 topLayout->addWidget(mMiniSplitter ); 1689 topLayout->addWidget(mMiniSplitter );
1685 mViewManager = new ViewManager( this, mMiniSplitter ); 1690 mViewManager = new ViewManager( this, mMiniSplitter );
1686 mDetails = new ViewContainer( mMiniSplitter ); 1691 mDetails = new ViewContainer( mMiniSplitter );
1687 1692
1688 1693
1689 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1694 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1690#endif 1695#endif
1691 //eh->hide(); 1696 //eh->hide();
1692 // topLayout->addWidget(mExtensionManager ); 1697 // topLayout->addWidget(mExtensionManager );
1693 1698
1694 1699
1695/*US 1700/*US
1696#ifndef KAB_NOSPLITTER 1701#ifndef KAB_NOSPLITTER
1697 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1702 QHBoxLayout *topLayout = new QHBoxLayout( this );
1698//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1703//US topLayout->setSpacing( KDialogBase::spacingHint() );
1699 topLayout->setSpacing( 10 ); 1704 topLayout->setSpacing( 10 );
1700 1705
1701 mDetailsSplitter = new QSplitter( this ); 1706 mDetailsSplitter = new QSplitter( this );
1702 1707
1703 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1708 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1704 1709
1705 mViewManager = new ViewManager( this, viewSpace ); 1710 mViewManager = new ViewManager( this, viewSpace );
1706 viewSpace->setStretchFactor( mViewManager, 1 ); 1711 viewSpace->setStretchFactor( mViewManager, 1 );
1707 1712
1708 mDetails = new ViewContainer( mDetailsSplitter ); 1713 mDetails = new ViewContainer( mDetailsSplitter );
1709 1714
1710 topLayout->addWidget( mDetailsSplitter ); 1715 topLayout->addWidget( mDetailsSplitter );
1711 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1716 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1712#else //KAB_NOSPLITTER 1717#else //KAB_NOSPLITTER
1713 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1718 QHBoxLayout *topLayout = new QHBoxLayout( this );
1714//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1719//US topLayout->setSpacing( KDialogBase::spacingHint() );
1715 topLayout->setSpacing( 10 ); 1720 topLayout->setSpacing( 10 );
1716 1721
1717// mDetailsSplitter = new QSplitter( this ); 1722// mDetailsSplitter = new QSplitter( this );
1718 1723
1719 QVBox *viewSpace = new QVBox( this ); 1724 QVBox *viewSpace = new QVBox( this );
1720 1725
1721 mViewManager = new ViewManager( this, viewSpace ); 1726 mViewManager = new ViewManager( this, viewSpace );
1722 viewSpace->setStretchFactor( mViewManager, 1 ); 1727 viewSpace->setStretchFactor( mViewManager, 1 );
1723 1728
1724 mDetails = new ViewContainer( this ); 1729 mDetails = new ViewContainer( this );
1725 1730
1726 topLayout->addWidget( viewSpace ); 1731 topLayout->addWidget( viewSpace );
1727// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1732// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1728 topLayout->addWidget( mDetails ); 1733 topLayout->addWidget( mDetails );
1729#endif //KAB_NOSPLITTER 1734#endif //KAB_NOSPLITTER
1730*/ 1735*/
1731 1736
1732 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1737 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1733 syncManager->setBlockSave(false); 1738 syncManager->setBlockSave(false);
1734 1739
1735 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1740 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1736 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1741 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1737 syncManager->setDefaultFileName( sentSyncFile()); 1742 syncManager->setDefaultFileName( sentSyncFile());
1738 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1743 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1739 1744
1740#endif //KAB_EMBEDDED 1745#endif //KAB_EMBEDDED
1741 initActions(); 1746 initActions();
1742 1747
1743#ifdef KAB_EMBEDDED 1748#ifdef KAB_EMBEDDED
1744 addActionsManually(); 1749 addActionsManually();
1745 //US make sure the export and import menues are initialized before creating the xxPortManager. 1750 //US make sure the export and import menues are initialized before creating the xxPortManager.
1746 mXXPortManager = new XXPortManager( this, this ); 1751 mXXPortManager = new XXPortManager( this, this );
1747 1752
1748 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1753 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1749 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1754 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1750 // mActionQuit->plug ( mMainWindow->toolBar()); 1755 // mActionQuit->plug ( mMainWindow->toolBar());
1751 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1756 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1752 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1757 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1753 // mIncSearchWidget->hide(); 1758 // mIncSearchWidget->hide();
1754 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1759 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1755 SLOT( incrementalSearch( const QString& ) ) ); 1760 SLOT( incrementalSearch( const QString& ) ) );
1756 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1761 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1757 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1762 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1758 1763
1759 mJumpButtonBar = new JumpButtonBar( this, this ); 1764 mJumpButtonBar = new JumpButtonBar( this, this );
1760 1765
1761 topLayout->addWidget( mJumpButtonBar ); 1766 topLayout->addWidget( mJumpButtonBar );
1762//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1767//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1763 1768
1764// mMainWindow->getIconToolBar()->raise(); 1769// mMainWindow->getIconToolBar()->raise();
1765 1770
1766#endif //KAB_EMBEDDED 1771#endif //KAB_EMBEDDED
1767 1772
1768} 1773}
1769void KABCore::initActions() 1774void KABCore::initActions()
1770{ 1775{
1771//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1776//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1772 1777
1773#ifndef KAB_EMBEDDED 1778#ifndef KAB_EMBEDDED
1774 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1779 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1775 SLOT( clipboardDataChanged() ) ); 1780 SLOT( clipboardDataChanged() ) );
1776#endif //KAB_EMBEDDED 1781#endif //KAB_EMBEDDED
1777 1782
1778 // file menu 1783 // file menu
1779 if ( mIsPart ) { 1784 if ( mIsPart ) {
1780 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1785 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1781 SLOT( sendMail() ), actionCollection(), 1786 SLOT( sendMail() ), actionCollection(),
1782 "kaddressbook_mail" ); 1787 "kaddressbook_mail" );
1783 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1788 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1784 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1789 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1785 1790
1786 } else { 1791 } else {
1787 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1792 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1788 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1793 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1789 } 1794 }
1790 1795
1791 1796
1792 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1797 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1793 SLOT( save() ), actionCollection(), "file_sync" ); 1798 SLOT( save() ), actionCollection(), "file_sync" );
1794 1799
1795 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1800 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1796 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1801 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1797 1802
1798 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1803 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1799 this, SLOT( mailVCard() ), 1804 this, SLOT( mailVCard() ),
1800 actionCollection(), "file_mail_vcard"); 1805 actionCollection(), "file_mail_vcard");
1801 1806
1802 mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, 1807 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
1803 SLOT( export2phone() ), actionCollection(), 1808 SLOT( export2phone() ), actionCollection(),
1804 "kaddressbook_ex2phone" ); 1809 "kaddressbook_ex2phone" );
1805 1810
1806 mActionBeamVCard = 0; 1811 mActionBeamVCard = 0;
1807 mActionBeam = 0; 1812 mActionBeam = 0;
1808 1813
1809#ifndef DESKTOP_VERSION 1814#ifndef DESKTOP_VERSION
1810 if ( Ir::supported() ) { 1815 if ( Ir::supported() ) {
1811 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1816 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1812 SLOT( beamVCard() ), actionCollection(), 1817 SLOT( beamVCard() ), actionCollection(),
1813 "kaddressbook_beam_vcard" ); 1818 "kaddressbook_beam_vcard" );
1814 1819
1815 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1820 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1816 SLOT( beamMySelf() ), actionCollection(), 1821 SLOT( beamMySelf() ), actionCollection(),
1817 "kaddressbook_beam_myself" ); 1822 "kaddressbook_beam_myself" );
1818 } 1823 }
1819#endif 1824#endif
1820 1825
1821 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1826 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1822 this, SLOT( editContact2() ), 1827 this, SLOT( editContact2() ),
1823 actionCollection(), "file_properties" ); 1828 actionCollection(), "file_properties" );
1824 1829
1825#ifdef KAB_EMBEDDED 1830#ifdef KAB_EMBEDDED
1826 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1831 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1827 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1832 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1828 mMainWindow, SLOT( exit() ), 1833 mMainWindow, SLOT( exit() ),
1829 actionCollection(), "quit" ); 1834 actionCollection(), "quit" );
1830#endif //KAB_EMBEDDED 1835#endif //KAB_EMBEDDED
1831 1836
1832 // edit menu 1837 // edit menu
1833 if ( mIsPart ) { 1838 if ( mIsPart ) {
1834 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1839 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1835 SLOT( copyContacts() ), actionCollection(), 1840 SLOT( copyContacts() ), actionCollection(),
1836 "kaddressbook_copy" ); 1841 "kaddressbook_copy" );
1837 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1842 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1838 SLOT( cutContacts() ), actionCollection(), 1843 SLOT( cutContacts() ), actionCollection(),
1839 "kaddressbook_cut" ); 1844 "kaddressbook_cut" );
1840 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1845 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1841 SLOT( pasteContacts() ), actionCollection(), 1846 SLOT( pasteContacts() ), actionCollection(),
1842 "kaddressbook_paste" ); 1847 "kaddressbook_paste" );
1843 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1848 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1844 SLOT( selectAllContacts() ), actionCollection(), 1849 SLOT( selectAllContacts() ), actionCollection(),
1845 "kaddressbook_select_all" ); 1850 "kaddressbook_select_all" );
1846 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1851 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1847 SLOT( undo() ), actionCollection(), 1852 SLOT( undo() ), actionCollection(),
1848 "kaddressbook_undo" ); 1853 "kaddressbook_undo" );
1849 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1854 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1850 this, SLOT( redo() ), actionCollection(), 1855 this, SLOT( redo() ), actionCollection(),
1851 "kaddressbook_redo" ); 1856 "kaddressbook_redo" );
1852 } else { 1857 } else {
1853 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1858 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1854 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1859 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1855 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1860 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1856 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1861 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1857 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1862 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1858 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1863 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1859 } 1864 }
1860 1865
1861 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1866 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1862 Key_Delete, this, SLOT( deleteContacts() ), 1867 Key_Delete, this, SLOT( deleteContacts() ),
1863 actionCollection(), "edit_delete" ); 1868 actionCollection(), "edit_delete" );
1864 1869
1865 mActionUndo->setEnabled( false ); 1870 mActionUndo->setEnabled( false );
1866 mActionRedo->setEnabled( false ); 1871 mActionRedo->setEnabled( false );
1867 1872
1868 // settings menu 1873 // settings menu
1869#ifdef KAB_EMBEDDED 1874#ifdef KAB_EMBEDDED
1870//US special menuentry to configure the addressbook resources. On KDE 1875//US special menuentry to configure the addressbook resources. On KDE
1871// you do that through the control center !!! 1876// you do that through the control center !!!
1872 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1877 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1873 SLOT( configureResources() ), actionCollection(), 1878 SLOT( configureResources() ), actionCollection(),
1874 "kaddressbook_configure_resources" ); 1879 "kaddressbook_configure_resources" );
1875#endif //KAB_EMBEDDED 1880#endif //KAB_EMBEDDED
1876 1881
1877 if ( mIsPart ) { 1882 if ( mIsPart ) {
1878 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1883 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1879 SLOT( openConfigDialog() ), actionCollection(), 1884 SLOT( openConfigDialog() ), actionCollection(),
1880 "kaddressbook_configure" ); 1885 "kaddressbook_configure" );
1881 1886
1882 //US not implemented yet 1887 //US not implemented yet
1883 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1888 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1884 // this, SLOT( configureKeyBindings() ), actionCollection(), 1889 // this, SLOT( configureKeyBindings() ), actionCollection(),
1885 // "kaddressbook_configure_shortcuts" ); 1890 // "kaddressbook_configure_shortcuts" );
1886#ifdef KAB_EMBEDDED 1891#ifdef KAB_EMBEDDED
1887 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1892 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1888 mActionConfigureToolbars->setEnabled( false ); 1893 mActionConfigureToolbars->setEnabled( false );
1889#endif //KAB_EMBEDDED 1894#endif //KAB_EMBEDDED
1890 1895
1891 } else { 1896 } else {
1892 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1897 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1893 1898
1894 //US not implemented yet 1899 //US not implemented yet
1895 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1900 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1896 } 1901 }
1897 1902
1898 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1903 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1899 actionCollection(), "options_show_jump_bar" ); 1904 actionCollection(), "options_show_jump_bar" );
1900 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1905 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1901 1906
1902 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1907 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1903 actionCollection(), "options_show_details" ); 1908 actionCollection(), "options_show_details" );
1904 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1909 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1905 1910
1906 1911
1907 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 1912 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
1908 SLOT( toggleBeamReceive() ), actionCollection(), 1913 SLOT( toggleBeamReceive() ), actionCollection(),
1909 "kaddressbook_beam_rec" ); 1914 "kaddressbook_beam_rec" );
1910 1915
1911 1916
1912 // misc 1917 // misc
1913 // only enable LDAP lookup if we can handle the protocol 1918 // only enable LDAP lookup if we can handle the protocol
1914#ifndef KAB_EMBEDDED 1919#ifndef KAB_EMBEDDED
1915 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1920 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1916 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1921 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1917 this, SLOT( openLDAPDialog() ), actionCollection(), 1922 this, SLOT( openLDAPDialog() ), actionCollection(),
1918 "ldap_lookup" ); 1923 "ldap_lookup" );
1919 } 1924 }
1920#else //KAB_EMBEDDED 1925#else //KAB_EMBEDDED
1921 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1926 //qDebug("KABCore::initActions() LDAP has to be implemented");
1922#endif //KAB_EMBEDDED 1927#endif //KAB_EMBEDDED
1923 1928
1924 1929
1925 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1930 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1926 SLOT( setWhoAmI() ), actionCollection(), 1931 SLOT( setWhoAmI() ), actionCollection(),
1927 "set_personal" ); 1932 "set_personal" );
1928 1933
1929 1934
1930 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1935 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp
index 41c999b..be254c0 100644
--- a/kaddressbook/xxportselectdialog.cpp
+++ b/kaddressbook/xxportselectdialog.cpp
@@ -1,229 +1,238 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk> 3 Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
4 Tobias Koenig <tokoe@kde.org> 4 Tobias Koenig <tokoe@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program 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 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25/* 25/*
26Enhanced Version of the file for platform independent KDE tools. 26Enhanced Version of the file for platform independent KDE tools.
27Copyright (c) 2004 Ulf Schenk 27Copyright (c) 2004 Ulf Schenk
28 28
29$Id$ 29$Id$
30*/ 30*/
31 31
32#include <kabc/addressbook.h> 32#include <kabc/addressbook.h>
33#include <kapplication.h> 33#include <kapplication.h>
34#include <kcombobox.h> 34#include <kcombobox.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kglobal.h> 36#include <kglobal.h>
37 37
38#include <qbuttongroup.h> 38#include <qbuttongroup.h>
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qheader.h> 40#include <qheader.h>
41#include <qlabel.h> 41#include <qlabel.h>
42#include <qlayout.h> 42#include <qlayout.h>
43#include <qlistview.h> 43#include <qlistview.h>
44#include <qpushbutton.h> 44#include <qpushbutton.h>
45#include <qradiobutton.h> 45#include <qradiobutton.h>
46#include <qstringlist.h> 46#include <qstringlist.h>
47#include <qwhatsthis.h> 47#include <qwhatsthis.h>
48 48
49#include "kabcore.h" 49#include "kabcore.h"
50#include "kabprefs.h" 50#include "kabprefs.h"
51 51
52#include "xxportselectdialog.h" 52#include "xxportselectdialog.h"
53 53
54XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, 54XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort,
55 QWidget* parent, const char* name ) 55 QWidget* parent, const char* name )
56 : KDialogBase( Plain, i18n( "Choose which contacts to export" ), Help | Ok | Cancel, 56 : KDialogBase( Plain, i18n( "Choose which contacts to export" ), Help | Ok | Cancel,
57 Ok, parent, name, true, true ), mCore( core ), 57 Ok, parent, name, true, true ), mCore( core ),
58 mUseSorting( sort ) 58 mUseSorting( sort )
59{ 59{
60 initGUI(); 60 initGUI();
61 61
62 connect( mFiltersCombo, SIGNAL( activated( int ) ), 62 connect( mFiltersCombo, SIGNAL( activated( int ) ),
63 SLOT( filterChanged( int ) ) ); 63 SLOT( filterChanged( int ) ) );
64 connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), 64 connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ),
65 SLOT( categoryClicked( QListViewItem* ) ) ); 65 SLOT( categoryClicked( QListViewItem* ) ) );
66 66
67 // setup filters 67 // setup filters
68#ifndef KAB_EMBEDDED 68#ifndef KAB_EMBEDDED
69 mFilters = Filter::restore( kapp->config(), "Filter" ); 69 mFilters = Filter::restore( kapp->config(), "Filter" );
70 Filter::List::iterator filterIt; 70 Filter::List::iterator filterIt;
71#else //KAB_EMBEDDED 71#else //KAB_EMBEDDED
72 mFilters = Filter::restore( KGlobal::config(), "Filter" ); 72 mFilters = Filter::restore( KGlobal::config(), "Filter" );
73 Filter::List::Iterator filterIt; 73 Filter::List::Iterator filterIt;
74#endif //KAB_EMBEDDED 74#endif //KAB_EMBEDDED
75 QStringList filters; 75 QStringList filters;
76 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) 76 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
77 filters.append( (*filterIt).name() ); 77 filters.append( (*filterIt).name() );
78 78
79 mFiltersCombo->insertStringList( filters ); 79 mFiltersCombo->insertStringList( filters );
80 mUseFilters->setEnabled( filters.count() > 0 ); 80 mUseFilters->setEnabled( filters.count() > 0 );
81 81
82 // setup categories 82 // setup categories
83 QStringList categories = KABPrefs::instance()->mCustomCategories; 83 QStringList categories = KABPrefs::instance()->mCustomCategories;
84 QStringList::Iterator it; 84 QStringList::Iterator it;
85 for ( it = categories.begin(); it != categories.end(); ++it ) 85 for ( it = categories.begin(); it != categories.end(); ++it )
86 new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); 86 new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox );
87 mUseCategories->setEnabled( categories.count() > 0 ); 87 mUseCategories->setEnabled( categories.count() > 0 );
88 88
89 int count = mCore->selectedUIDs().count(); 89 int count = mCore->selectedUIDs().count();
90 mUseSelection->setEnabled( count != 0 ); 90 mUseSelection->setEnabled( count != 0 );
91 mUseSelection->setChecked( count > 1 ); 91 mUseSelection->setChecked( count > 1 );
92 92
93 mSortTypeCombo->insertItem( i18n( "Ascending" ) ); 93 mSortTypeCombo->insertItem( i18n( "Ascending" ) );
94 mSortTypeCombo->insertItem( i18n( "Descending" ) ); 94 mSortTypeCombo->insertItem( i18n( "Descending" ) );
95 95
96 mFields = mCore->addressBook()->fields( KABC::Field::All ); 96 mFields = mCore->addressBook()->fields( KABC::Field::All );
97 KABC::Field::List::Iterator fieldIt; 97 KABC::Field::List::Iterator fieldIt;
98 for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) 98 for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt )
99 mFieldCombo->insertItem( (*fieldIt)->label() ); 99 mFieldCombo->insertItem( (*fieldIt)->label() );
100} 100}
101 101
102QStringList XXPortSelectDialog::uids()
103{
104 QStringList uidlist;
105 KABC::AddresseeList list = contacts();
106 KABC::Addressee::List::Iterator it;
107 for ( it = list.begin(); it != list.end(); ++it )
108 uidlist.append((*it).uid());
109 return uidlist;
110}
102KABC::AddresseeList XXPortSelectDialog::contacts() 111KABC::AddresseeList XXPortSelectDialog::contacts()
103{ 112{
104 QStringList selection = mCore->selectedUIDs(); 113 QStringList selection = mCore->selectedUIDs();
105 114
106 KABC::AddresseeList list; 115 KABC::AddresseeList list;
107 if ( mUseSelection->isChecked() ) { 116 if ( mUseSelection->isChecked() ) {
108 QStringList::Iterator it; 117 QStringList::Iterator it;
109 for ( it = selection.begin(); it != selection.end(); ++it ) { 118 for ( it = selection.begin(); it != selection.end(); ++it ) {
110 KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); 119 KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
111 if ( !addr.isEmpty() ) 120 if ( !addr.isEmpty() )
112 list.append( addr ); 121 list.append( addr );
113 } 122 }
114 } else if ( mUseFilters->isChecked() ) { 123 } else if ( mUseFilters->isChecked() ) {
115 // find contacts that can pass selected filter 124 // find contacts that can pass selected filter
116 Filter::List::Iterator filterIt; 125 Filter::List::Iterator filterIt;
117 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) 126 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
118 if ( (*filterIt).name() == mFiltersCombo->currentText() ) 127 if ( (*filterIt).name() == mFiltersCombo->currentText() )
119 break; 128 break;
120 129
121 KABC::AddressBook::Iterator it; 130 KABC::AddressBook::Iterator it;
122 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { 131 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
123 if ( (*filterIt).filterAddressee( *it ) ) 132 if ( (*filterIt).filterAddressee( *it ) )
124 list.append( *it ); 133 list.append( *it );
125 } 134 }
126 } else if ( mUseCategories->isChecked() ) { 135 } else if ( mUseCategories->isChecked() ) {
127 QStringList categorieList = categories(); 136 QStringList categorieList = categories();
128 KABC::AddressBook::Iterator it; 137 KABC::AddressBook::Iterator it;
129 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { 138 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
130 QStringList tmp( (*it).categories() ); 139 QStringList tmp( (*it).categories() );
131 QStringList::Iterator tmpIt; 140 QStringList::Iterator tmpIt;
132 for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) 141 for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt )
133 if ( categorieList.contains( *tmpIt ) ) { 142 if ( categorieList.contains( *tmpIt ) ) {
134 list.append( *it ); 143 list.append( *it );
135 break; 144 break;
136 } 145 }
137 } 146 }
138 } else { 147 } else {
139 // create a string list of all entries: 148 // create a string list of all entries:
140 KABC::AddressBook::Iterator it; 149 KABC::AddressBook::Iterator it;
141 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) 150 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it )
142 list.append( *it ); 151 list.append( *it );
143 } 152 }
144 153
145 if ( mUseSorting ) { 154 if ( mUseSorting ) {
146 list.setReverseSorting( mSortTypeCombo->currentItem() == 1 ); 155 list.setReverseSorting( mSortTypeCombo->currentItem() == 1 );
147 uint pos = mFieldCombo->currentItem(); 156 uint pos = mFieldCombo->currentItem();
148 if ( pos < mFields.count() ) 157 if ( pos < mFields.count() )
149 list.sortByField( mFields[ pos ] ); 158 list.sortByField( mFields[ pos ] );
150 } 159 }
151 160
152 return list; 161 return list;
153} 162}
154 163
155QStringList XXPortSelectDialog::categories() const 164QStringList XXPortSelectDialog::categories() const
156{ 165{
157 QStringList list; 166 QStringList list;
158 167
159 QListViewItemIterator it( mCategoriesView ); 168 QListViewItemIterator it( mCategoriesView );
160 for ( ; it.current(); ++it ) { 169 for ( ; it.current(); ++it ) {
161 QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); 170 QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current());
162 if ( qcli->isOn() ) 171 if ( qcli->isOn() )
163 list.append( it.current()->text( 0 ) ); 172 list.append( it.current()->text( 0 ) );
164 } 173 }
165 174
166 return list; 175 return list;
167} 176}
168 177
169void XXPortSelectDialog::filterChanged( int ) 178void XXPortSelectDialog::filterChanged( int )
170{ 179{
171 mUseFilters->setChecked( true ); 180 mUseFilters->setChecked( true );
172} 181}
173 182
174void XXPortSelectDialog::categoryClicked( QListViewItem *i ) 183void XXPortSelectDialog::categoryClicked( QListViewItem *i )
175{ 184{
176 QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); 185 QCheckListItem *qcli = static_cast<QCheckListItem*>( i );
177 if ( qcli->isOn() ) 186 if ( qcli->isOn() )
178 mUseCategories->setChecked( true ); 187 mUseCategories->setChecked( true );
179} 188}
180 189
181void XXPortSelectDialog::slotHelp() 190void XXPortSelectDialog::slotHelp()
182{ 191{
183#ifndef KAB_EMBEDDED 192#ifndef KAB_EMBEDDED
184 kapp->invokeHelp( "import-and-export" ); 193 kapp->invokeHelp( "import-and-export" );
185#else //KAB_EMBEDDED 194#else //KAB_EMBEDDED
186 qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); 195 qDebug("XXPortSelectDialog::slotHelp is not implemented yet");
187#endif //KAB_EMBEDDED 196#endif //KAB_EMBEDDED
188 197
189} 198}
190 199
191void XXPortSelectDialog::initGUI() 200void XXPortSelectDialog::initGUI()
192{ 201{
193 QFrame *page = plainPage(); 202 QFrame *page = plainPage();
194 203
195 QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(), 204 QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(),
196 KDialog::spacingHint() ); 205 KDialog::spacingHint() );
197 206
198 QLabel *label = new QLabel( i18n( "Which contacts do you want to export?" ), page ); 207 QLabel *label = new QLabel( i18n( "Which contacts do you want to export?" ), page );
199 topLayout->addWidget( label ); 208 topLayout->addWidget( label );
200 209
201 mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); 210 mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page );
202 mButtonGroup->setColumnLayout( 0, Qt::Vertical ); 211 mButtonGroup->setColumnLayout( 0, Qt::Vertical );
203 mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); 212 mButtonGroup->layout()->setSpacing( KDialog::spacingHint() );
204 mButtonGroup->layout()->setMargin( KDialog::marginHint() ); 213 mButtonGroup->layout()->setMargin( KDialog::marginHint() );
205 214
206 QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); 215 QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() );
207 groupLayout->setAlignment( Qt::AlignTop ); 216 groupLayout->setAlignment( Qt::AlignTop );
208 217
209 mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); 218 mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup );
210 mUseWholeBook->setChecked( true ); 219 mUseWholeBook->setChecked( true );
211 QWhatsThis::add( mUseWholeBook, i18n( "Export the entire address book" ) ); 220 QWhatsThis::add( mUseWholeBook, i18n( "Export the entire address book" ) );
212 groupLayout->addWidget( mUseWholeBook, 0, 0 ); 221 groupLayout->addWidget( mUseWholeBook, 0, 0 );
213 222
214 mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); 223 mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup );
215 QWhatsThis::add( mUseSelection, i18n( "Only export contacts selected in KAddressBook.\n" 224 QWhatsThis::add( mUseSelection, i18n( "Only export contacts selected in KAddressBook.\n"
216 "This option is disabled if no contacts are selected." ) ); 225 "This option is disabled if no contacts are selected." ) );
217 groupLayout->addWidget( mUseSelection, 1, 0 ); 226 groupLayout->addWidget( mUseSelection, 1, 0 );
218 227
219 mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); 228 mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup );
220 QWhatsThis::add( mUseFilters, i18n( "Only export contacts matching the selected filter.\n" 229 QWhatsThis::add( mUseFilters, i18n( "Only export contacts matching the selected filter.\n"
221 "This option is disabled if you haven't defined any filters" ) ); 230 "This option is disabled if you haven't defined any filters" ) );
222 groupLayout->addWidget( mUseFilters, 2, 0 ); 231 groupLayout->addWidget( mUseFilters, 2, 0 );
223 232
224 mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); 233 mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup );
225 QWhatsThis::add( mUseCategories, i18n( "Only export contacts who are members of a category that is checked on the list to the left.\n" 234 QWhatsThis::add( mUseCategories, i18n( "Only export contacts who are members of a category that is checked on the list to the left.\n"
226 "This option is disabled if you have no categories." ) ); 235 "This option is disabled if you have no categories." ) );
227 groupLayout->addWidget( mUseCategories, 3, 0 ); 236 groupLayout->addWidget( mUseCategories, 3, 0 );
228 237
229 mFiltersCombo = new QComboBox( false, mButtonGroup ); 238 mFiltersCombo = new QComboBox( false, mButtonGroup );
diff --git a/kaddressbook/xxportselectdialog.h b/kaddressbook/xxportselectdialog.h
index 8d56f66..3bb696f 100644
--- a/kaddressbook/xxportselectdialog.h
+++ b/kaddressbook/xxportselectdialog.h
@@ -1,81 +1,82 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk> 3 Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
4 Tobias Koenig <tokoe@kde.org> 4 Tobias Koenig <tokoe@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program 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 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef XXPORTSELECTDIALOG_H 24#ifndef XXPORTSELECTDIALOG_H
25#define XXPORTSELECTDIALOG_H 25#define XXPORTSELECTDIALOG_H
26 26
27#include <kabc/addresseelist.h> 27#include <kabc/addresseelist.h>
28#include <kabc/field.h> 28#include <kabc/field.h>
29#include <kdialogbase.h> 29#include <kdialogbase.h>
30 30
31#include "filter.h" 31#include "filter.h"
32 32
33class QButtonGroup; 33class QButtonGroup;
34class QComboBox; 34class QComboBox;
35class QListView; 35class QListView;
36class QListViewItem; 36class QListViewItem;
37class QRadioButton; 37class QRadioButton;
38 38
39class KABCore; 39class KABCore;
40class KComboBox; 40class KComboBox;
41 41
42class XXPortSelectDialog : public KDialogBase 42class XXPortSelectDialog : public KDialogBase
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 45
46 public: 46 public:
47 XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent, 47 XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent,
48 const char* name = 0 ); 48 const char* name = 0 );
49 49
50 KABC::AddresseeList contacts(); 50 KABC::AddresseeList contacts();
51 QStringList uids();
51 52
52 private slots: 53 private slots:
53 void filterChanged( int ); 54 void filterChanged( int );
54 void categoryClicked( QListViewItem * i ); 55 void categoryClicked( QListViewItem * i );
55 56
56 protected slots: 57 protected slots:
57 void slotHelp(); 58 void slotHelp();
58 59
59 private: 60 private:
60 void initGUI(); 61 void initGUI();
61 QStringList categories() const; 62 QStringList categories() const;
62 63
63 QButtonGroup* mButtonGroup; 64 QButtonGroup* mButtonGroup;
64 QRadioButton* mUseCategories; 65 QRadioButton* mUseCategories;
65 QRadioButton* mUseFilters; 66 QRadioButton* mUseFilters;
66 QRadioButton* mUseWholeBook; 67 QRadioButton* mUseWholeBook;
67 QRadioButton* mUseSelection; 68 QRadioButton* mUseSelection;
68 QComboBox* mFiltersCombo; 69 QComboBox* mFiltersCombo;
69 QListView* mCategoriesView; 70 QListView* mCategoriesView;
70 71
71 KComboBox *mFieldCombo; 72 KComboBox *mFieldCombo;
72 KComboBox *mSortTypeCombo; 73 KComboBox *mSortTypeCombo;
73 74
74 KABCore *mCore; 75 KABCore *mCore;
75 KABC::AddresseeList mAddresseeList; 76 KABC::AddresseeList mAddresseeList;
76 Filter::List mFilters; 77 Filter::List mFilters;
77 KABC::Field::List mFields; 78 KABC::Field::List mFields;
78 bool mUseSorting; 79 bool mUseSorting;
79}; 80};
80 81
81#endif 82#endif
diff --git a/version b/version
index 4368d49..c4fe6e2 100644
--- a/version
+++ b/version
@@ -1 +1 @@
version = "1.9.12"; version = "1.9.13";