summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-11-08 23:23:02 (UTC)
committer zautrix <zautrix>2004-11-08 23:23:02 (UTC)
commitc20c85c383cb36c7ece87af9e3a60d14b36a9de5 (patch) (unidiff)
treeec1d983fbeb9b719f1871683b47862b528e50c0d /kaddressbook
parentd92ceb39af0bf0c655b68cb166dfea44cd688f1c (diff)
downloadkdepimpi-c20c85c383cb36c7ece87af9e3a60d14b36a9de5.zip
kdepimpi-c20c85c383cb36c7ece87af9e3a60d14b36a9de5.tar.gz
kdepimpi-c20c85c383cb36c7ece87af9e3a60d14b36a9de5.tar.bz2
fixed orientation change in kapi
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/incsearchwidget.cpp1
-rw-r--r--kaddressbook/kabcore.cpp30
-rw-r--r--kaddressbook/kabcore.h1
3 files changed, 23 insertions, 9 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp
index 78eaf65..dd2121a 100644
--- a/kaddressbook/incsearchwidget.cpp
+++ b/kaddressbook/incsearchwidget.cpp
@@ -1,167 +1,168 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2002 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#include <qlabel.h> 24#include <qlabel.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qtooltip.h> 26#include <qtooltip.h>
27#include <qcombobox.h> 27#include <qcombobox.h>
28 28
29#include <kdialog.h> 29#include <kdialog.h>
30#include <klineedit.h> 30#include <klineedit.h>
31#include <klocale.h> 31#include <klocale.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <kglobal.h> 33#include <kglobal.h>
34#include "kabprefs.h" 34#include "kabprefs.h"
35 35
36#include "incsearchwidget.h" 36#include "incsearchwidget.h"
37 37
38IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) 38IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name )
39 : QWidget( parent, name ) 39 : QWidget( parent, name )
40{ 40{
41#ifndef KAB_EMBEDDED 41#ifndef KAB_EMBEDDED
42//US setCaption( i18n( "Incremental Search" ) ); 42//US setCaption( i18n( "Incremental Search" ) );
43#endif //KAB_EMBEDDED 43#endif //KAB_EMBEDDED
44 44
45 QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() ); 45 QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() );
46 46
47#ifdef DESKTOP_VERSION 47#ifdef DESKTOP_VERSION
48 QLabel *label = new QLabel( i18n( "Search:" ), this ); 48 QLabel *label = new QLabel( i18n( "Search:" ), this );
49 label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight ); 49 label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight );
50 layout->addWidget( label ); 50 layout->addWidget( label );
51#endif //KAB_EMBEDDED 51#endif //KAB_EMBEDDED
52 52
53 mSearchText = new KLineEdit( this ); 53 mSearchText = new KLineEdit( this );
54 layout->addWidget( mSearchText ); 54 layout->addWidget( mSearchText );
55// #ifdef KAB_EMBEDDED 55// #ifdef KAB_EMBEDDED
56// if (KGlobal::getOrientation() == KGlobal::Portrait) 56// if (KGlobal::getOrientation() == KGlobal::Portrait)
57// mSearchText->setMaximumWidth(30); 57// mSearchText->setMaximumWidth(30);
58// #endif //KAB_EMBEDDED 58// #endif //KAB_EMBEDDED
59 //mSearchText->setMaximumWidth(60);
59 60
60 61
61 mFieldCombo = new QComboBox( false, this ); 62 mFieldCombo = new QComboBox( false, this );
62 layout->addWidget( mFieldCombo ); 63 layout->addWidget( mFieldCombo );
63 mFieldCombo->setMaximumHeight( 34 ); 64 mFieldCombo->setMaximumHeight( 34 );
64 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); 65 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) );
65 66
66// #ifndef KAB_EMBEDDED 67// #ifndef KAB_EMBEDDED
67// resize( QSize(420, 50).expandedTo( sizeHint() ) ); 68// resize( QSize(420, 50).expandedTo( sizeHint() ) );
68// #else //KAB_EMBEDDED 69// #else //KAB_EMBEDDED
69// resize( QSize(30, 10).expandedTo( sizeHint() ) ); 70// resize( QSize(30, 10).expandedTo( sizeHint() ) );
70// #endif //KAB_EMBEDDED 71// #endif //KAB_EMBEDDED
71 72
72 73
73 // for performance reasons, we do a search on the pda only after return is pressed 74 // for performance reasons, we do a search on the pda only after return is pressed
74 connect( mSearchText, SIGNAL( textChanged( const QString& ) ), 75 connect( mSearchText, SIGNAL( textChanged( const QString& ) ),
75 SLOT( announceDoSearch2() ) ); 76 SLOT( announceDoSearch2() ) );
76 connect( mFieldCombo, SIGNAL( activated( const QString& ) ), 77 connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
77 SLOT( announceDoSearch2() ) ); 78 SLOT( announceDoSearch2() ) );
78 79
79 connect( mSearchText, SIGNAL( returnPressed() ), 80 connect( mSearchText, SIGNAL( returnPressed() ),
80 SLOT( announceDoSearch() ) ); 81 SLOT( announceDoSearch() ) );
81 connect( mFieldCombo, SIGNAL( activated( const QString& ) ), 82 connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
82 SLOT( announceFieldChanged() ) ); 83 SLOT( announceFieldChanged() ) );
83 84
84 85
85 86
86 connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() )); 87 connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() ));
87 connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() )); 88 connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() ));
88 89
89 90
90 setFocusProxy( mSearchText ); 91 setFocusProxy( mSearchText );
91} 92}
92 93
93IncSearchWidget::~IncSearchWidget() 94IncSearchWidget::~IncSearchWidget()
94{ 95{
95 96
96} 97}
97void IncSearchWidget::announceDoSearch2() 98void IncSearchWidget::announceDoSearch2()
98{ 99{
99 if ( KABPrefs::instance()->mSearchWithReturn ) 100 if ( KABPrefs::instance()->mSearchWithReturn )
100 return; 101 return;
101 emit doSearch( mSearchText->text() ); 102 emit doSearch( mSearchText->text() );
102 //qDebug("emit dosreach "); 103 //qDebug("emit dosreach ");
103} 104}
104 105
105void IncSearchWidget::announceDoSearch() 106void IncSearchWidget::announceDoSearch()
106{ 107{
107 108
108 emit doSearch( mSearchText->text() ); 109 emit doSearch( mSearchText->text() );
109 // qDebug("emit dosreach "); 110 // qDebug("emit dosreach ");
110} 111}
111 112
112void IncSearchWidget::announceFieldChanged() 113void IncSearchWidget::announceFieldChanged()
113{ 114{
114 emit fieldChanged(); 115 emit fieldChanged();
115} 116}
116 117
117void IncSearchWidget::setFields( const KABC::Field::List &list ) 118void IncSearchWidget::setFields( const KABC::Field::List &list )
118{ 119{
119 120
120 mFieldCombo->clear(); 121 mFieldCombo->clear();
121 mFieldCombo->insertItem( i18n( "All Fields" ) ); 122 mFieldCombo->insertItem( i18n( "All Fields" ) );
122 QFontMetrics fm ( mFieldCombo->font() ); 123 QFontMetrics fm ( mFieldCombo->font() );
123 int wid = fm.width(i18n( "All Fields" ) ); 124 int wid = fm.width(i18n( "All Fields" ) );
124 int max = wid; 125 int max = wid;
125 126
126 KABC::Field::List::ConstIterator it; 127 KABC::Field::List::ConstIterator it;
127 for ( it = list.begin(); it != list.end(); ++it ) { 128 for ( it = list.begin(); it != list.end(); ++it ) {
128 mFieldCombo->insertItem( (*it)->label() ); 129 mFieldCombo->insertItem( (*it)->label() );
129 // wid = fm.width((*it)->label() ); 130 // wid = fm.width((*it)->label() );
130 //if ( wid > max ) 131 //if ( wid > max )
131 // max = wid; 132 // max = wid;
132 } 133 }
133 134
134 mFieldList = list; 135 mFieldList = list;
135 136
136 announceDoSearch(); 137 announceDoSearch();
137 announceFieldChanged(); 138 announceFieldChanged();
138 mFieldCombo->setMaximumWidth( wid+60 ); 139 mFieldCombo->setMaximumWidth( wid+60 );
139} 140}
140 141
141KABC::Field::List IncSearchWidget::fields() const 142KABC::Field::List IncSearchWidget::fields() const
142{ 143{
143 return mFieldList; 144 return mFieldList;
144} 145}
145 146
146KABC::Field *IncSearchWidget::currentField()const 147KABC::Field *IncSearchWidget::currentField()const
147{ 148{
148 if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 ) 149 if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 )
149 return 0; // for error or 'use all fields' 150 return 0; // for error or 'use all fields'
150 else 151 else
151 return mFieldList[ mFieldCombo->currentItem() - 1 ]; 152 return mFieldList[ mFieldCombo->currentItem() - 1 ];
152} 153}
153 154
154void IncSearchWidget::setCurrentItem( int pos ) 155void IncSearchWidget::setCurrentItem( int pos )
155{ 156{
156 mFieldCombo->setCurrentItem( pos ); 157 mFieldCombo->setCurrentItem( pos );
157 announceFieldChanged(); 158 announceFieldChanged();
158} 159}
159 160
160int IncSearchWidget::currentItem() const 161int IncSearchWidget::currentItem() const
161{ 162{
162 163
163 return mFieldCombo->currentItem(); 164 return mFieldCombo->currentItem();
164} 165}
165#ifndef KAB_EMBEDDED 166#ifndef KAB_EMBEDDED
166#include "incsearchwidget.moc" 167#include "incsearchwidget.moc"
167#endif //KAB_EMBEDDED 168#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 7acf1ee..a6fc677 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -108,947 +108,959 @@ $Id$
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#include "xxportselectdialog.h"
119 119
120 120
121#include <kresources/selectdialog.h> 121#include <kresources/selectdialog.h>
122#include <kmessagebox.h> 122#include <kmessagebox.h>
123 123
124#include <picture.h> 124#include <picture.h>
125#include <resource.h> 125#include <resource.h>
126 126
127//US#include <qsplitter.h> 127//US#include <qsplitter.h>
128#include <qmap.h> 128#include <qmap.h>
129#include <qdir.h> 129#include <qdir.h>
130#include <qfile.h> 130#include <qfile.h>
131#include <qvbox.h> 131#include <qvbox.h>
132#include <qlayout.h> 132#include <qlayout.h>
133#include <qclipboard.h> 133#include <qclipboard.h>
134#include <qtextstream.h> 134#include <qtextstream.h>
135#include <qradiobutton.h> 135#include <qradiobutton.h>
136#include <qbuttongroup.h> 136#include <qbuttongroup.h>
137 137
138#include <libkdepim/categoryselectdialog.h> 138#include <libkdepim/categoryselectdialog.h>
139#include <libkdepim/categoryeditdialog.h> 139#include <libkdepim/categoryeditdialog.h>
140#include <kabc/vcardconverter.h> 140#include <kabc/vcardconverter.h>
141 141
142 142
143#include "addresseeutil.h" 143#include "addresseeutil.h"
144#include "undocmds.h" 144#include "undocmds.h"
145#include "addresseeeditordialog.h" 145#include "addresseeeditordialog.h"
146#include "viewmanager.h" 146#include "viewmanager.h"
147#include "details/detailsviewcontainer.h" 147#include "details/detailsviewcontainer.h"
148#include "kabprefs.h" 148#include "kabprefs.h"
149#include "xxportmanager.h" 149#include "xxportmanager.h"
150#include "incsearchwidget.h" 150#include "incsearchwidget.h"
151#include "jumpbuttonbar.h" 151#include "jumpbuttonbar.h"
152#include "extensionmanager.h" 152#include "extensionmanager.h"
153#include "addresseeconfig.h" 153#include "addresseeconfig.h"
154#include <kcmultidialog.h> 154#include <kcmultidialog.h>
155 155
156#ifdef _WIN32_ 156#ifdef _WIN32_
157 157
158#include "kaimportoldialog.h" 158#include "kaimportoldialog.h"
159#else 159#else
160#include <unistd.h> 160#include <unistd.h>
161#endif 161#endif
162// sync includes 162// sync includes
163#include <libkdepim/ksyncprofile.h> 163#include <libkdepim/ksyncprofile.h>
164#include <libkdepim/ksyncprefsdialog.h> 164#include <libkdepim/ksyncprefsdialog.h>
165 165
166 166
167class KABCatPrefs : public QDialog 167class KABCatPrefs : public QDialog
168{ 168{
169 public: 169 public:
170 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 170 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
171 QDialog( parent, name, true ) 171 QDialog( parent, name, true )
172 { 172 {
173 setCaption( i18n("Manage new Categories") ); 173 setCaption( i18n("Manage new Categories") );
174 QVBoxLayout* lay = new QVBoxLayout( this ); 174 QVBoxLayout* lay = new QVBoxLayout( this );
175 lay->setSpacing( 3 ); 175 lay->setSpacing( 3 );
176 lay->setMargin( 3 ); 176 lay->setMargin( 3 );
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 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 );
178 lay->addWidget( lab ); 178 lay->addWidget( lab );
179 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 );
180 lay->addWidget( format ); 180 lay->addWidget( format );
181 format->setExclusive ( true ) ; 181 format->setExclusive ( true ) ;
182 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 182 addCatBut = new QRadioButton(i18n("Add to category list"), format );
183 new QRadioButton(i18n("Remove from addressees"), format ); 183 new QRadioButton(i18n("Remove from addressees"), format );
184 addCatBut->setChecked( true ); 184 addCatBut->setChecked( true );
185 QPushButton * ok = new QPushButton( i18n("OK"), this ); 185 QPushButton * ok = new QPushButton( i18n("OK"), this );
186 lay->addWidget( ok ); 186 lay->addWidget( ok );
187 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 187 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
188 lay->addWidget( cancel ); 188 lay->addWidget( cancel );
189 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 189 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
190 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 190 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
191 resize( 200, 200 ); 191 resize( 200, 200 );
192 } 192 }
193 193
194 bool addCat() { return addCatBut->isChecked(); } 194 bool addCat() { return addCatBut->isChecked(); }
195private: 195private:
196 QRadioButton* addCatBut; 196 QRadioButton* addCatBut;
197}; 197};
198 198
199 199
200 200
201class KAex2phonePrefs : public QDialog 201class KAex2phonePrefs : public QDialog
202{ 202{
203 public: 203 public:
204 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 204 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
205 QDialog( parent, name, true ) 205 QDialog( parent, name, true )
206 { 206 {
207 setCaption( i18n("Export to phone options") ); 207 setCaption( i18n("Export to phone options") );
208 QVBoxLayout* lay = new QVBoxLayout( this ); 208 QVBoxLayout* lay = new QVBoxLayout( this );
209 lay->setSpacing( 3 ); 209 lay->setSpacing( 3 );
210 lay->setMargin( 3 ); 210 lay->setMargin( 3 );
211 QLabel *lab; 211 QLabel *lab;
212 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 ) );
213 lab->setAlignment (AlignHCenter ); 213 lab->setAlignment (AlignHCenter );
214 QHBox* temphb; 214 QHBox* temphb;
215 temphb = new QHBox( this ); 215 temphb = new QHBox( this );
216 new QLabel( i18n("I/O device: "), temphb ); 216 new QLabel( i18n("I/O device: "), temphb );
217 mPhoneDevice = new QLineEdit( temphb); 217 mPhoneDevice = new QLineEdit( temphb);
218 lay->addWidget( temphb ); 218 lay->addWidget( temphb );
219 temphb = new QHBox( this ); 219 temphb = new QHBox( this );
220 new QLabel( i18n("Connection: "), temphb ); 220 new QLabel( i18n("Connection: "), temphb );
221 mPhoneConnection = new QLineEdit( temphb); 221 mPhoneConnection = new QLineEdit( temphb);
222 lay->addWidget( temphb ); 222 lay->addWidget( temphb );
223 temphb = new QHBox( this ); 223 temphb = new QHBox( this );
224 new QLabel( i18n("Model(opt.): "), temphb ); 224 new QLabel( i18n("Model(opt.): "), temphb );
225 mPhoneModel = new QLineEdit( temphb); 225 mPhoneModel = new QLineEdit( temphb);
226 lay->addWidget( temphb ); 226 lay->addWidget( temphb );
227 // 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 );
228 // lay->addWidget( mWriteToSim ); 228 // lay->addWidget( mWriteToSim );
229 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 ) );
230 lab->setAlignment (AlignHCenter ); 230 lab->setAlignment (AlignHCenter );
231 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 231 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
232 lay->addWidget( ok ); 232 lay->addWidget( ok );
233 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 233 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
234 lay->addWidget( cancel ); 234 lay->addWidget( cancel );
235 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 235 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
236 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 236 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
237 resize( 220, 240 ); 237 resize( 220, 240 );
238 238
239 } 239 }
240 240
241public: 241public:
242 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 242 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
243 QCheckBox* mWriteToSim; 243 QCheckBox* mWriteToSim;
244}; 244};
245 245
246 246
247bool pasteWithNewUid = true; 247bool pasteWithNewUid = true;
248 248
249#ifdef KAB_EMBEDDED 249#ifdef KAB_EMBEDDED
250KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 250KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
251 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 251 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
252 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 252 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
253 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 253 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
254#else //KAB_EMBEDDED 254#else //KAB_EMBEDDED
255KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 255KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
256 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 256 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
257 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 257 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
258 mReadWrite( readWrite ), mModified( false ) 258 mReadWrite( readWrite ), mModified( false )
259#endif //KAB_EMBEDDED 259#endif //KAB_EMBEDDED
260{ 260{
261 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 261 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
262 // syncManager->setBlockSave(false); 262 // syncManager->setBlockSave(false);
263 mMiniSplitter = 0; 263 mMiniSplitter = 0;
264 mExtensionBarSplitter = 0; 264 mExtensionBarSplitter = 0;
265 mIsPart = !parent->inherits( "KAddressBookMain" ); 265 mIsPart = !parent->inherits( "KAddressBookMain" );
266 mAddressBook = KABC::StdAddressBook::self(); 266 mAddressBook = KABC::StdAddressBook::self();
267 KABC::StdAddressBook::setAutomaticSave( false ); 267 KABC::StdAddressBook::setAutomaticSave( false );
268 268
269#ifndef KAB_EMBEDDED 269#ifndef KAB_EMBEDDED
270 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 270 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
271#endif //KAB_EMBEDDED 271#endif //KAB_EMBEDDED
272 272
273 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 273 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
274 SLOT( addressBookChanged() ) ); 274 SLOT( addressBookChanged() ) );
275 275
276#if 0 276#if 0
277 // LP moved to addressbook init method 277 // LP moved to addressbook init method
278 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 278 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
279 "X-Department", "KADDRESSBOOK" ); 279 "X-Department", "KADDRESSBOOK" );
280 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 280 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
281 "X-Profession", "KADDRESSBOOK" ); 281 "X-Profession", "KADDRESSBOOK" );
282 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 282 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
283 "X-AssistantsName", "KADDRESSBOOK" ); 283 "X-AssistantsName", "KADDRESSBOOK" );
284 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 284 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
285 "X-ManagersName", "KADDRESSBOOK" ); 285 "X-ManagersName", "KADDRESSBOOK" );
286 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 286 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
287 "X-SpousesName", "KADDRESSBOOK" ); 287 "X-SpousesName", "KADDRESSBOOK" );
288 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 288 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
289 "X-Office", "KADDRESSBOOK" ); 289 "X-Office", "KADDRESSBOOK" );
290 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 290 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
291 "X-IMAddress", "KADDRESSBOOK" ); 291 "X-IMAddress", "KADDRESSBOOK" );
292 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 292 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
293 "X-Anniversary", "KADDRESSBOOK" ); 293 "X-Anniversary", "KADDRESSBOOK" );
294 294
295 //US added this field to become compatible with Opie/qtopia addressbook 295 //US added this field to become compatible with Opie/qtopia addressbook
296 // values can be "female" or "male" or "". An empty field represents undefined. 296 // values can be "female" or "male" or "". An empty field represents undefined.
297 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 297 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
298 "X-Gender", "KADDRESSBOOK" ); 298 "X-Gender", "KADDRESSBOOK" );
299 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 299 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
300 "X-Children", "KADDRESSBOOK" ); 300 "X-Children", "KADDRESSBOOK" );
301 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 301 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
302 "X-FreeBusyUrl", "KADDRESSBOOK" ); 302 "X-FreeBusyUrl", "KADDRESSBOOK" );
303#endif 303#endif
304 initGUI(); 304 initGUI();
305 305
306 mIncSearchWidget->setFocus(); 306 mIncSearchWidget->setFocus();
307 307
308 308
309 connect( mViewManager, SIGNAL( selected( const QString& ) ), 309 connect( mViewManager, SIGNAL( selected( const QString& ) ),
310 SLOT( setContactSelected( const QString& ) ) ); 310 SLOT( setContactSelected( const QString& ) ) );
311 connect( mViewManager, SIGNAL( executed( const QString& ) ), 311 connect( mViewManager, SIGNAL( executed( const QString& ) ),
312 SLOT( executeContact( const QString& ) ) ); 312 SLOT( executeContact( const QString& ) ) );
313 313
314 connect( mViewManager, SIGNAL( deleteRequest( ) ), 314 connect( mViewManager, SIGNAL( deleteRequest( ) ),
315 SLOT( deleteContacts( ) ) ); 315 SLOT( deleteContacts( ) ) );
316 connect( mViewManager, SIGNAL( modified() ), 316 connect( mViewManager, SIGNAL( modified() ),
317 SLOT( setModified() ) ); 317 SLOT( setModified() ) );
318 318
319 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 319 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
320 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 320 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
321 321
322 connect( mXXPortManager, SIGNAL( modified() ), 322 connect( mXXPortManager, SIGNAL( modified() ),
323 SLOT( setModified() ) ); 323 SLOT( setModified() ) );
324 324
325 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 325 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
326 SLOT( incrementalSearch( const QString& ) ) ); 326 SLOT( incrementalSearch( const QString& ) ) );
327 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 327 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
328 mJumpButtonBar, SLOT( recreateButtons() ) ); 328 mJumpButtonBar, SLOT( recreateButtons() ) );
329 329
330 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 330 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
331 SLOT( sendMail( const QString& ) ) ); 331 SLOT( sendMail( const QString& ) ) );
332 332
333 333
334 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 334 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
335 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 335 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
336 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 336 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
337 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 337 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
338 338
339 339
340#ifndef KAB_EMBEDDED 340#ifndef KAB_EMBEDDED
341 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 341 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
342 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 342 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
343 343
344 connect( mDetails, SIGNAL( browse( const QString& ) ), 344 connect( mDetails, SIGNAL( browse( const QString& ) ),
345 SLOT( browse( const QString& ) ) ); 345 SLOT( browse( const QString& ) ) );
346 346
347 347
348 mAddressBookService = new KAddressBookService( this ); 348 mAddressBookService = new KAddressBookService( this );
349 349
350#endif //KAB_EMBEDDED 350#endif //KAB_EMBEDDED
351 351
352 mMessageTimer = new QTimer( this ); 352 mMessageTimer = new QTimer( this );
353 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 353 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
354 mEditorDialog = 0; 354 mEditorDialog = 0;
355 createAddresseeEditorDialog( this ); 355 createAddresseeEditorDialog( this );
356 setModified( false ); 356 setModified( false );
357 mBRdisabled = false; 357 mBRdisabled = false;
358#ifndef DESKTOP_VERSION 358#ifndef DESKTOP_VERSION
359 infrared = 0; 359 infrared = 0;
360#endif 360#endif
361 //toggleBeamReceive( ); 361 //toggleBeamReceive( );
362 362
363 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 363 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
364 QTimer::singleShot( 1000, this , SLOT ( updateToolBar())); 364 QTimer::singleShot( 10000, this , SLOT ( updateToolBar()));
365} 365}
366 366
367void KABCore::updateToolBar() 367void KABCore::updateToolBar()
368{ 368{
369 mMainWindow->toolBar()->repaint(); 369 mMainWindow->toolBar()->update();
370} 370}
371KABCore::~KABCore() 371KABCore::~KABCore()
372{ 372{
373 // save(); 373 // save();
374 //saveSettings(); 374 //saveSettings();
375 //KABPrefs::instance()->writeConfig(); 375 //KABPrefs::instance()->writeConfig();
376 delete AddresseeConfig::instance(); 376 delete AddresseeConfig::instance();
377 mAddressBook = 0; 377 mAddressBook = 0;
378 KABC::StdAddressBook::close(); 378 KABC::StdAddressBook::close();
379 379
380 delete syncManager; 380 delete syncManager;
381#ifndef DESKTOP_VERSION 381#ifndef DESKTOP_VERSION
382 if ( infrared ) 382 if ( infrared )
383 delete infrared; 383 delete infrared;
384#endif 384#endif
385} 385}
386void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 386void KABCore::receive( const QCString& cmsg, const QByteArray& data )
387{ 387{
388 qDebug("KA: QCOP message received: %s ", cmsg.data() ); 388 qDebug("KA: QCOP message received: %s ", cmsg.data() );
389 if ( cmsg == "setDocument(QString)" ) { 389 if ( cmsg == "setDocument(QString)" ) {
390 QDataStream stream( data, IO_ReadOnly ); 390 QDataStream stream( data, IO_ReadOnly );
391 QString fileName; 391 QString fileName;
392 stream >> fileName; 392 stream >> fileName;
393 recieve( fileName ); 393 recieve( fileName );
394 return; 394 return;
395 } 395 }
396} 396}
397void KABCore::toggleBeamReceive( ) 397void KABCore::toggleBeamReceive( )
398{ 398{
399 if ( mBRdisabled ) 399 if ( mBRdisabled )
400 return; 400 return;
401#ifndef DESKTOP_VERSION 401#ifndef DESKTOP_VERSION
402 if ( infrared ) { 402 if ( infrared ) {
403 qDebug("AB disable BeamReceive "); 403 qDebug("AB disable BeamReceive ");
404 delete infrared; 404 delete infrared;
405 infrared = 0; 405 infrared = 0;
406 mActionBR->setChecked(false); 406 mActionBR->setChecked(false);
407 return; 407 return;
408 } 408 }
409 qDebug("AB enable BeamReceive "); 409 qDebug("AB enable BeamReceive ");
410 mActionBR->setChecked(true); 410 mActionBR->setChecked(true);
411 411
412 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 412 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
413 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 413 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
414#endif 414#endif
415} 415}
416 416
417 417
418void KABCore::disableBR(bool b) 418void KABCore::disableBR(bool b)
419{ 419{
420#ifndef DESKTOP_VERSION 420#ifndef DESKTOP_VERSION
421 if ( b ) { 421 if ( b ) {
422 if ( infrared ) { 422 if ( infrared ) {
423 toggleBeamReceive( ); 423 toggleBeamReceive( );
424 } 424 }
425 mBRdisabled = true; 425 mBRdisabled = true;
426 } else { 426 } else {
427 if ( mBRdisabled ) { 427 if ( mBRdisabled ) {
428 mBRdisabled = false; 428 mBRdisabled = false;
429 //toggleBeamReceive( ); 429 //toggleBeamReceive( );
430 } 430 }
431 } 431 }
432#endif 432#endif
433 433
434} 434}
435void KABCore::recieve( QString fn ) 435void KABCore::recieve( QString fn )
436{ 436{
437 //qDebug("KABCore::recieve "); 437 //qDebug("KABCore::recieve ");
438 int count = mAddressBook->importFromFile( fn, true ); 438 int count = mAddressBook->importFromFile( fn, true );
439 if ( count ) 439 if ( count )
440 setModified( true ); 440 setModified( true );
441 mViewManager->refreshView(); 441 mViewManager->refreshView();
442 message(i18n("%1 contact(s) received!").arg( count )); 442 message(i18n("%1 contact(s) received!").arg( count ));
443 topLevelWidget()->showMaximized(); 443 topLevelWidget()->showMaximized();
444 topLevelWidget()->raise(); 444 topLevelWidget()->raise();
445} 445}
446void KABCore::restoreSettings() 446void KABCore::restoreSettings()
447{ 447{
448 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 448 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
449 449
450 bool state; 450 bool state;
451 451
452 if (mMultipleViewsAtOnce) 452 if (mMultipleViewsAtOnce)
453 state = KABPrefs::instance()->mDetailsPageVisible; 453 state = KABPrefs::instance()->mDetailsPageVisible;
454 else 454 else
455 state = false; 455 state = false;
456 456
457 mActionDetails->setChecked( state ); 457 mActionDetails->setChecked( state );
458 setDetailsVisible( state ); 458 setDetailsVisible( state );
459 459
460 state = KABPrefs::instance()->mJumpButtonBarVisible; 460 state = KABPrefs::instance()->mJumpButtonBarVisible;
461 461
462 mActionJumpBar->setChecked( state ); 462 mActionJumpBar->setChecked( state );
463 setJumpButtonBarVisible( state ); 463 setJumpButtonBarVisible( state );
464/*US 464/*US
465 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 465 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
466 if ( splitterSize.count() == 0 ) { 466 if ( splitterSize.count() == 0 ) {
467 splitterSize.append( width() / 2 ); 467 splitterSize.append( width() / 2 );
468 splitterSize.append( width() / 2 ); 468 splitterSize.append( width() / 2 );
469 } 469 }
470 mMiniSplitter->setSizes( splitterSize ); 470 mMiniSplitter->setSizes( splitterSize );
471 if ( mExtensionBarSplitter ) { 471 if ( mExtensionBarSplitter ) {
472 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 472 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
473 if ( splitterSize.count() == 0 ) { 473 if ( splitterSize.count() == 0 ) {
474 splitterSize.append( width() / 2 ); 474 splitterSize.append( width() / 2 );
475 splitterSize.append( width() / 2 ); 475 splitterSize.append( width() / 2 );
476 } 476 }
477 mExtensionBarSplitter->setSizes( splitterSize ); 477 mExtensionBarSplitter->setSizes( splitterSize );
478 478
479 } 479 }
480*/ 480*/
481 mViewManager->restoreSettings(); 481 mViewManager->restoreSettings();
482 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 482 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
483 mExtensionManager->restoreSettings(); 483 mExtensionManager->restoreSettings();
484#ifdef DESKTOP_VERSION 484#ifdef DESKTOP_VERSION
485 int wid = width(); 485 int wid = width();
486 if ( wid < 10 ) 486 if ( wid < 10 )
487 wid = 400; 487 wid = 400;
488#else 488#else
489 int wid = QApplication::desktop()->width(); 489 int wid = QApplication::desktop()->width();
490 if ( wid < 640 ) 490 if ( wid < 640 )
491 wid = QApplication::desktop()->height(); 491 wid = QApplication::desktop()->height();
492#endif 492#endif
493 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 493 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
494 if ( true /*splitterSize.count() == 0*/ ) { 494 if ( true /*splitterSize.count() == 0*/ ) {
495 splitterSize.append( wid / 2 ); 495 splitterSize.append( wid / 2 );
496 splitterSize.append( wid / 2 ); 496 splitterSize.append( wid / 2 );
497 } 497 }
498 mMiniSplitter->setSizes( splitterSize ); 498 mMiniSplitter->setSizes( splitterSize );
499 if ( mExtensionBarSplitter ) { 499 if ( mExtensionBarSplitter ) {
500 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 500 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
501 if ( true /*splitterSize.count() == 0*/ ) { 501 if ( true /*splitterSize.count() == 0*/ ) {
502 splitterSize.append( wid / 2 ); 502 splitterSize.append( wid / 2 );
503 splitterSize.append( wid / 2 ); 503 splitterSize.append( wid / 2 );
504 } 504 }
505 mExtensionBarSplitter->setSizes( splitterSize ); 505 mExtensionBarSplitter->setSizes( splitterSize );
506 506
507 } 507 }
508 508
509 509
510} 510}
511 511
512void KABCore::saveSettings() 512void KABCore::saveSettings()
513{ 513{
514 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 514 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
515 if ( mExtensionBarSplitter ) 515 if ( mExtensionBarSplitter )
516 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 516 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
517 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 517 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
518 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 518 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
519#ifndef KAB_EMBEDDED 519#ifndef KAB_EMBEDDED
520 520
521 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 521 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
522 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 522 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
523#endif //KAB_EMBEDDED 523#endif //KAB_EMBEDDED
524 mExtensionManager->saveSettings(); 524 mExtensionManager->saveSettings();
525 mViewManager->saveSettings(); 525 mViewManager->saveSettings();
526 526
527 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 527 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
528} 528}
529 529
530KABC::AddressBook *KABCore::addressBook() const 530KABC::AddressBook *KABCore::addressBook() const
531{ 531{
532 return mAddressBook; 532 return mAddressBook;
533} 533}
534 534
535KConfig *KABCore::config() 535KConfig *KABCore::config()
536{ 536{
537#ifndef KAB_EMBEDDED 537#ifndef KAB_EMBEDDED
538 return KABPrefs::instance()->config(); 538 return KABPrefs::instance()->config();
539#else //KAB_EMBEDDED 539#else //KAB_EMBEDDED
540 return KABPrefs::instance()->getConfig(); 540 return KABPrefs::instance()->getConfig();
541#endif //KAB_EMBEDDED 541#endif //KAB_EMBEDDED
542} 542}
543 543
544KActionCollection *KABCore::actionCollection() const 544KActionCollection *KABCore::actionCollection() const
545{ 545{
546 return mGUIClient->actionCollection(); 546 return mGUIClient->actionCollection();
547} 547}
548 548
549KABC::Field *KABCore::currentSearchField() const 549KABC::Field *KABCore::currentSearchField() const
550{ 550{
551 if (mIncSearchWidget) 551 if (mIncSearchWidget)
552 return mIncSearchWidget->currentField(); 552 return mIncSearchWidget->currentField();
553 else 553 else
554 return 0; 554 return 0;
555} 555}
556 556
557QStringList KABCore::selectedUIDs() const 557QStringList KABCore::selectedUIDs() const
558{ 558{
559 return mViewManager->selectedUids(); 559 return mViewManager->selectedUids();
560} 560}
561 561
562KABC::Resource *KABCore::requestResource( QWidget *parent ) 562KABC::Resource *KABCore::requestResource( QWidget *parent )
563{ 563{
564 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 564 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
565 565
566 QPtrList<KRES::Resource> kresResources; 566 QPtrList<KRES::Resource> kresResources;
567 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 567 QPtrListIterator<KABC::Resource> resIt( kabcResources );
568 KABC::Resource *resource; 568 KABC::Resource *resource;
569 while ( ( resource = resIt.current() ) != 0 ) { 569 while ( ( resource = resIt.current() ) != 0 ) {
570 ++resIt; 570 ++resIt;
571 if ( !resource->readOnly() ) { 571 if ( !resource->readOnly() ) {
572 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 572 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
573 if ( res ) 573 if ( res )
574 kresResources.append( res ); 574 kresResources.append( res );
575 } 575 }
576 } 576 }
577 577
578 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 578 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
579 return static_cast<KABC::Resource*>( res ); 579 return static_cast<KABC::Resource*>( res );
580} 580}
581 581
582#ifndef KAB_EMBEDDED 582#ifndef KAB_EMBEDDED
583KAboutData *KABCore::createAboutData() 583KAboutData *KABCore::createAboutData()
584#else //KAB_EMBEDDED 584#else //KAB_EMBEDDED
585void KABCore::createAboutData() 585void KABCore::createAboutData()
586#endif //KAB_EMBEDDED 586#endif //KAB_EMBEDDED
587{ 587{
588#ifndef KAB_EMBEDDED 588#ifndef KAB_EMBEDDED
589 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 589 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
590 "3.1", I18N_NOOP( "The KDE Address Book" ), 590 "3.1", I18N_NOOP( "The KDE Address Book" ),
591 KAboutData::License_GPL_V2, 591 KAboutData::License_GPL_V2,
592 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 592 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
593 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 593 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
594 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 594 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
595 about->addAuthor( "Cornelius Schumacher", 595 about->addAuthor( "Cornelius Schumacher",
596 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 596 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
597 "schumacher@kde.org" ); 597 "schumacher@kde.org" );
598 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 598 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
599 "mpilone@slac.com" ); 599 "mpilone@slac.com" );
600 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 600 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
601 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 601 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
602 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 602 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
603 "michel@klaralvdalens-datakonsult.se" ); 603 "michel@klaralvdalens-datakonsult.se" );
604 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 604 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
605 "hansen@kde.org" ); 605 "hansen@kde.org" );
606 606
607 return about; 607 return about;
608#endif //KAB_EMBEDDED 608#endif //KAB_EMBEDDED
609 609
610 QString version; 610 QString version;
611#include <../version> 611#include <../version>
612 QMessageBox::about( this, "About KAddressbook/Pi", 612 QMessageBox::about( this, "About KAddressbook/Pi",
613 "KAddressbook/Platform-independent\n" 613 "KAddressbook/Platform-independent\n"
614 "(KA/Pi) " +version + " - " + 614 "(KA/Pi) " +version + " - " +
615#ifdef DESKTOP_VERSION 615#ifdef DESKTOP_VERSION
616 "Desktop Edition\n" 616 "Desktop Edition\n"
617#else 617#else
618 "PDA-Edition\n" 618 "PDA-Edition\n"
619 "for: Zaurus 5500 / 7x0 / 8x0\n" 619 "for: Zaurus 5500 / 7x0 / 8x0\n"
620#endif 620#endif
621 621
622 "(c) 2004 Ulf Schenk\n" 622 "(c) 2004 Ulf Schenk\n"
623 "(c) 2004 Lutz Rogowski\n" 623 "(c) 2004 Lutz Rogowski\n"
624 "(c) 1997-2003, The KDE PIM Team\n" 624 "(c) 1997-2003, The KDE PIM Team\n"
625 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 625 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
626 "Don Sanders Original author\n" 626 "Don Sanders Original author\n"
627 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 627 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
628 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 628 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
629 "Greg Stern DCOP interface\n" 629 "Greg Stern DCOP interface\n"
630 "Mark Westcot Contact pinning\n" 630 "Mark Westcot Contact pinning\n"
631 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 631 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
632 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 632 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
633#ifdef _WIN32_ 633#ifdef _WIN32_
634 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 634 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
635#endif 635#endif
636 ); 636 );
637} 637}
638 638
639void KABCore::setContactSelected( const QString &uid ) 639void KABCore::setContactSelected( const QString &uid )
640{ 640{
641 KABC::Addressee addr = mAddressBook->findByUid( uid ); 641 KABC::Addressee addr = mAddressBook->findByUid( uid );
642 if ( !mDetails->isHidden() ) 642 if ( !mDetails->isHidden() )
643 mDetails->setAddressee( addr ); 643 mDetails->setAddressee( addr );
644 644
645 if ( !addr.isEmpty() ) { 645 if ( !addr.isEmpty() ) {
646 emit contactSelected( addr.formattedName() ); 646 emit contactSelected( addr.formattedName() );
647 KABC::Picture pic = addr.photo(); 647 KABC::Picture pic = addr.photo();
648 if ( pic.isIntern() ) { 648 if ( pic.isIntern() ) {
649//US emit contactSelected( pic.data() ); 649//US emit contactSelected( pic.data() );
650//US instead use: 650//US instead use:
651 QPixmap px; 651 QPixmap px;
652 if (pic.data().isNull() != true) 652 if (pic.data().isNull() != true)
653 { 653 {
654 px.convertFromImage(pic.data()); 654 px.convertFromImage(pic.data());
655 } 655 }
656 656
657 emit contactSelected( px ); 657 emit contactSelected( px );
658 } 658 }
659 } 659 }
660 660
661 661
662 mExtensionManager->setSelectionChanged(); 662 mExtensionManager->setSelectionChanged();
663 663
664 // update the actions 664 // update the actions
665 bool selected = !uid.isEmpty(); 665 bool selected = !uid.isEmpty();
666 666
667 if ( mReadWrite ) { 667 if ( mReadWrite ) {
668 mActionCut->setEnabled( selected ); 668 mActionCut->setEnabled( selected );
669 mActionPaste->setEnabled( selected ); 669 mActionPaste->setEnabled( selected );
670 } 670 }
671 671
672 mActionCopy->setEnabled( selected ); 672 mActionCopy->setEnabled( selected );
673 mActionDelete->setEnabled( selected ); 673 mActionDelete->setEnabled( selected );
674 mActionEditAddressee->setEnabled( selected ); 674 mActionEditAddressee->setEnabled( selected );
675 mActionMail->setEnabled( selected ); 675 mActionMail->setEnabled( selected );
676 mActionMailVCard->setEnabled( selected ); 676 mActionMailVCard->setEnabled( selected );
677 //if (mActionBeam) 677 //if (mActionBeam)
678 //mActionBeam->setEnabled( selected ); 678 //mActionBeam->setEnabled( selected );
679 679
680 if (mActionBeamVCard) 680 if (mActionBeamVCard)
681 mActionBeamVCard->setEnabled( selected ); 681 mActionBeamVCard->setEnabled( selected );
682 682
683 mActionWhoAmI->setEnabled( selected ); 683 mActionWhoAmI->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}
780void KABCore::updateMainWindow()
781{
782
783 mMainWindow->showMaximized();
784 mMainWindow->update();
785}
780void KABCore::resizeEvent(QResizeEvent* e ) 786void KABCore::resizeEvent(QResizeEvent* e )
781{ 787{
782 if ( !mMiniSplitter ) 788 if ( !mMiniSplitter )
783 return; 789 return;
784 if ( QApplication::desktop()->width() >= 480 ) { 790 if ( QApplication::desktop()->width() >= 480 ) {
785 int fac = QApplication::desktop()->width()/QApplication::desktop()->height(); 791 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
786 if ( fac > 0 ) { // e.g. 640x480
787 if ( mMiniSplitter->orientation() == Qt::Vertical ) { 792 if ( mMiniSplitter->orientation() == Qt::Vertical ) {
788 mMiniSplitter->setOrientation( Qt::Horizontal); 793 mMiniSplitter->setOrientation( Qt::Horizontal);
789 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 794 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
790 if ( QApplication::desktop()->width() <= 640 ) 795 if ( QApplication::desktop()->width() <= 640 ) {
791 topLevelWidget()->showMaximized(); 796 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
797 mViewManager->getFilterAction()->setComboWidth( 150 );
798 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
799 }
792 } 800 }
793 } else {// e.g. 480x640 801 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
794 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { 802 if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
795 mMiniSplitter->setOrientation( Qt::Vertical ); 803 mMiniSplitter->setOrientation( Qt::Vertical );
796 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 804 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
797 if ( QApplication::desktop()->width() <= 640 ) 805 if ( QApplication::desktop()->width() <= 640 ) {
798 topLevelWidget()->showMaximized(); 806 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
807 mMainWindow->showMinimized();
808 mViewManager->getFilterAction()->setComboWidth( 0 );
809 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
810 }
799 } 811 }
800 } 812 }
801 } 813 }
802 814
803} 815}
804void KABCore::export2phone() 816void KABCore::export2phone()
805{ 817{
806 818
807 QStringList uids; 819 QStringList uids;
808 XXPortSelectDialog dlg( this, false, this ); 820 XXPortSelectDialog dlg( this, false, this );
809 if ( dlg.exec() ) 821 if ( dlg.exec() )
810 uids = dlg.uids(); 822 uids = dlg.uids();
811 else 823 else
812 return; 824 return;
813 if ( uids.isEmpty() ) 825 if ( uids.isEmpty() )
814 return; 826 return;
815 // qDebug("count %d ", uids.count()); 827 // qDebug("count %d ", uids.count());
816 828
817 KAex2phonePrefs ex2phone; 829 KAex2phonePrefs ex2phone;
818 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 830 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
819 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 831 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
820 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 832 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
821 833
822 if ( !ex2phone.exec() ) { 834 if ( !ex2phone.exec() ) {
823 return; 835 return;
824 } 836 }
825 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 837 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
826 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 838 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
827 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 839 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
828 840
829 841
830 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 842 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
831 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 843 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
832 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 844 KPimGlobalPrefs::instance()->mEx2PhoneModel );
833 845
834 QString fileName = getPhoneFile(); 846 QString fileName = getPhoneFile();
835 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 847 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
836 return; 848 return;
837 849
838 message(i18n("Exporting to phone...")); 850 message(i18n("Exporting to phone..."));
839 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 851 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
840 852
841} 853}
842QString KABCore::getPhoneFile() 854QString KABCore::getPhoneFile()
843{ 855{
844#ifdef DESKTOP_VERSION 856#ifdef DESKTOP_VERSION
845 return locateLocal("tmp", "phonefile.vcf"); 857 return locateLocal("tmp", "phonefile.vcf");
846#else 858#else
847 return "/tmp/phonefile.vcf"; 859 return "/tmp/phonefile.vcf";
848#endif 860#endif
849 861
850} 862}
851void KABCore::writeToPhone( ) 863void KABCore::writeToPhone( )
852{ 864{
853 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 865 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
854 message(i18n("Export to phone finished!")); 866 message(i18n("Export to phone finished!"));
855 else 867 else
856 qDebug(i18n("Error exporting to phone")); 868 qDebug(i18n("Error exporting to phone"));
857} 869}
858void KABCore::beamVCard() 870void KABCore::beamVCard()
859{ 871{
860 QStringList uids = mViewManager->selectedUids(); 872 QStringList uids = mViewManager->selectedUids();
861 if ( !uids.isEmpty() ) 873 if ( !uids.isEmpty() )
862 beamVCard( uids ); 874 beamVCard( uids );
863} 875}
864 876
865 877
866void KABCore::beamVCard(const QStringList& uids) 878void KABCore::beamVCard(const QStringList& uids)
867{ 879{
868 880
869 // LR: we should use the /tmp dir on the Zaurus, 881 // LR: we should use the /tmp dir on the Zaurus,
870 // because: /tmp = RAM, (HOME)/kdepim = flash memory 882 // because: /tmp = RAM, (HOME)/kdepim = flash memory
871 883
872#ifdef DESKTOP_VERSION 884#ifdef DESKTOP_VERSION
873 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 885 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
874#else 886#else
875 QString fileName = "/tmp/kapibeamfile.vcf"; 887 QString fileName = "/tmp/kapibeamfile.vcf";
876#endif 888#endif
877 889
878 KABC::VCardConverter converter; 890 KABC::VCardConverter converter;
879 QString description; 891 QString description;
880 QString datastream; 892 QString datastream;
881 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 893 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
882 KABC::Addressee a = mAddressBook->findByUid( *it ); 894 KABC::Addressee a = mAddressBook->findByUid( *it );
883 895
884 if ( a.isEmpty() ) 896 if ( a.isEmpty() )
885 continue; 897 continue;
886 898
887 if (description.isEmpty()) 899 if (description.isEmpty())
888 description = a.formattedName(); 900 description = a.formattedName();
889 901
890 QString vcard; 902 QString vcard;
891 converter.addresseeToVCard( a, vcard ); 903 converter.addresseeToVCard( a, vcard );
892 int start = 0; 904 int start = 0;
893 int next; 905 int next;
894 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 906 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
895 int semi = vcard.find(";", next); 907 int semi = vcard.find(";", next);
896 int dopp = vcard.find(":", next); 908 int dopp = vcard.find(":", next);
897 int sep; 909 int sep;
898 if ( semi < dopp && semi >= 0 ) 910 if ( semi < dopp && semi >= 0 )
899 sep = semi ; 911 sep = semi ;
900 else 912 else
901 sep = dopp; 913 sep = dopp;
902 datastream +=vcard.mid( start, next - start); 914 datastream +=vcard.mid( start, next - start);
903 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 915 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
904 start = sep; 916 start = sep;
905 } 917 }
906 datastream += vcard.mid( start,vcard.length() ); 918 datastream += vcard.mid( start,vcard.length() );
907 } 919 }
908#ifndef DESKTOP_VERSION 920#ifndef DESKTOP_VERSION
909 QFile outFile(fileName); 921 QFile outFile(fileName);
910 if ( outFile.open(IO_WriteOnly) ) { 922 if ( outFile.open(IO_WriteOnly) ) {
911 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 923 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
912 QTextStream t( &outFile ); // use a text stream 924 QTextStream t( &outFile ); // use a text stream
913 //t.setEncoding( QTextStream::UnicodeUTF8 ); 925 //t.setEncoding( QTextStream::UnicodeUTF8 );
914 t.setEncoding( QTextStream::Latin1 ); 926 t.setEncoding( QTextStream::Latin1 );
915 t <<datastream.latin1(); 927 t <<datastream.latin1();
916 outFile.close(); 928 outFile.close();
917 Ir *ir = new Ir( this ); 929 Ir *ir = new Ir( this );
918 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 930 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
919 ir->send( fileName, description, "text/x-vCard" ); 931 ir->send( fileName, description, "text/x-vCard" );
920 } else { 932 } else {
921 qDebug("Error open temp beam file "); 933 qDebug("Error open temp beam file ");
922 return; 934 return;
923 } 935 }
924#endif 936#endif
925 937
926} 938}
927 939
928void KABCore::beamDone( Ir *ir ) 940void KABCore::beamDone( Ir *ir )
929{ 941{
930#ifndef DESKTOP_VERSION 942#ifndef DESKTOP_VERSION
931 delete ir; 943 delete ir;
932#endif 944#endif
933 topLevelWidget()->raise(); 945 topLevelWidget()->raise();
934 message( i18n("Beaming finished!") ); 946 message( i18n("Beaming finished!") );
935} 947}
936 948
937 949
938void KABCore::browse( const QString& url ) 950void KABCore::browse( const QString& url )
939{ 951{
940#ifndef KAB_EMBEDDED 952#ifndef KAB_EMBEDDED
941 kapp->invokeBrowser( url ); 953 kapp->invokeBrowser( url );
942#else //KAB_EMBEDDED 954#else //KAB_EMBEDDED
943 qDebug("KABCore::browse must be fixed"); 955 qDebug("KABCore::browse must be fixed");
944#endif //KAB_EMBEDDED 956#endif //KAB_EMBEDDED
945} 957}
946 958
947void KABCore::selectAllContacts() 959void KABCore::selectAllContacts()
948{ 960{
949 mViewManager->setSelected( QString::null, true ); 961 mViewManager->setSelected( QString::null, true );
950} 962}
951 963
952void KABCore::deleteContacts() 964void KABCore::deleteContacts()
953{ 965{
954 QStringList uidList = mViewManager->selectedUids(); 966 QStringList uidList = mViewManager->selectedUids();
955 deleteContacts( uidList ); 967 deleteContacts( uidList );
956} 968}
957 969
958void KABCore::deleteContacts( const QStringList &uids ) 970void KABCore::deleteContacts( const QStringList &uids )
959{ 971{
960 if ( uids.count() > 0 ) { 972 if ( uids.count() > 0 ) {
961 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 973 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
962 UndoStack::instance()->push( command ); 974 UndoStack::instance()->push( command );
963 RedoStack::instance()->clear(); 975 RedoStack::instance()->clear();
964 976
965 // now if we deleted anything, refresh 977 // now if we deleted anything, refresh
966 setContactSelected( QString::null ); 978 setContactSelected( QString::null );
967 setModified( true ); 979 setModified( true );
968 } 980 }
969} 981}
970 982
971void KABCore::copyContacts() 983void KABCore::copyContacts()
972{ 984{
973 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 985 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
974 986
975 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 987 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
976 988
977 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 989 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
978 990
979 QClipboard *cb = QApplication::clipboard(); 991 QClipboard *cb = QApplication::clipboard();
980 cb->setText( clipText ); 992 cb->setText( clipText );
981} 993}
982 994
983void KABCore::cutContacts() 995void KABCore::cutContacts()
984{ 996{
985 QStringList uidList = mViewManager->selectedUids(); 997 QStringList uidList = mViewManager->selectedUids();
986 998
987//US if ( uidList.size() > 0 ) { 999//US if ( uidList.size() > 0 ) {
988 if ( uidList.count() > 0 ) { 1000 if ( uidList.count() > 0 ) {
989 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 1001 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
990 UndoStack::instance()->push( command ); 1002 UndoStack::instance()->push( command );
991 RedoStack::instance()->clear(); 1003 RedoStack::instance()->clear();
992 1004
993 setModified( true ); 1005 setModified( true );
994 } 1006 }
995} 1007}
996 1008
997void KABCore::pasteContacts() 1009void KABCore::pasteContacts()
998{ 1010{
999 QClipboard *cb = QApplication::clipboard(); 1011 QClipboard *cb = QApplication::clipboard();
1000 1012
1001 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 1013 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
1002 1014
1003 pasteContacts( list ); 1015 pasteContacts( list );
1004} 1016}
1005 1017
1006void KABCore::pasteContacts( KABC::Addressee::List &list ) 1018void KABCore::pasteContacts( KABC::Addressee::List &list )
1007{ 1019{
1008 KABC::Resource *resource = requestResource( this ); 1020 KABC::Resource *resource = requestResource( this );
1009 KABC::Addressee::List::Iterator it; 1021 KABC::Addressee::List::Iterator it;
1010 for ( it = list.begin(); it != list.end(); ++it ) 1022 for ( it = list.begin(); it != list.end(); ++it )
1011 (*it).setResource( resource ); 1023 (*it).setResource( resource );
1012 1024
1013 PwPasteCommand *command = new PwPasteCommand( this, list ); 1025 PwPasteCommand *command = new PwPasteCommand( this, list );
1014 UndoStack::instance()->push( command ); 1026 UndoStack::instance()->push( command );
1015 RedoStack::instance()->clear(); 1027 RedoStack::instance()->clear();
1016 1028
1017 setModified( true ); 1029 setModified( true );
1018} 1030}
1019 1031
1020void KABCore::setWhoAmI() 1032void KABCore::setWhoAmI()
1021{ 1033{
1022 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1034 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1023 1035
1024 if ( addrList.count() > 1 ) { 1036 if ( addrList.count() > 1 ) {
1025 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 1037 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
1026 return; 1038 return;
1027 } 1039 }
1028 1040
1029 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 1041 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
1030 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 1042 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
1031 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 1043 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
1032} 1044}
1033void KABCore::editCategories() 1045void KABCore::editCategories()
1034{ 1046{
1035 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); 1047 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1036 dlg.exec(); 1048 dlg.exec();
1037} 1049}
1038void KABCore::setCategories() 1050void KABCore::setCategories()
1039{ 1051{
1040 1052
1041 QStringList uids; 1053 QStringList uids;
1042 XXPortSelectDialog dlgx( this, false, this ); 1054 XXPortSelectDialog dlgx( this, false, this );
1043 if ( dlgx.exec() ) 1055 if ( dlgx.exec() )
1044 uids = dlgx.uids(); 1056 uids = dlgx.uids();
1045 else 1057 else
1046 return; 1058 return;
1047 if ( uids.isEmpty() ) 1059 if ( uids.isEmpty() )
1048 return; 1060 return;
1049 // qDebug("count %d ", uids.count()); 1061 // qDebug("count %d ", uids.count());
1050 1062
1051 1063
1052 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1064 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
1053 if ( !dlg.exec() ) { 1065 if ( !dlg.exec() ) {
1054 message( i18n("Setting categories cancelled") ); 1066 message( i18n("Setting categories cancelled") );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index fe2d3a2..88e83f0 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -108,407 +108,408 @@ class KABCore : public QWidget, public KSyncInterface
108 /** 108 /**
109 Returns a pointer to the KConfig object of the application. 109 Returns a pointer to the KConfig object of the application.
110 */ 110 */
111 static KConfig *config(); 111 static KConfig *config();
112 112
113 /** 113 /**
114 Returns a pointer to the global KActionCollection object. So 114 Returns a pointer to the global KActionCollection object. So
115 other classes can register their actions easily. 115 other classes can register their actions easily.
116 */ 116 */
117 KActionCollection *actionCollection() const; 117 KActionCollection *actionCollection() const;
118 118
119 /** 119 /**
120 Returns the current search field of the Incremental Search Widget. 120 Returns the current search field of the Incremental Search Widget.
121 */ 121 */
122 KABC::Field *currentSearchField() const; 122 KABC::Field *currentSearchField() const;
123 123
124 /** 124 /**
125 Returns the uid list of the currently selected contacts. 125 Returns the uid list of the currently selected contacts.
126 */ 126 */
127 QStringList selectedUIDs() const; 127 QStringList selectedUIDs() const;
128 128
129 /** 129 /**
130 Displays the ResourceSelectDialog and returns the selected 130 Displays the ResourceSelectDialog and returns the selected
131 resource or a null pointer if no resource was selected by 131 resource or a null pointer if no resource was selected by
132 the user. 132 the user.
133 */ 133 */
134 KABC::Resource *requestResource( QWidget *parent ); 134 KABC::Resource *requestResource( QWidget *parent );
135 135
136#ifndef KAB_EMBEDDED 136#ifndef KAB_EMBEDDED
137 static KAboutData *createAboutData(); 137 static KAboutData *createAboutData();
138#endif //KAB_EMBEDDED 138#endif //KAB_EMBEDDED
139 139
140#ifdef KAB_EMBEDDED 140#ifdef KAB_EMBEDDED
141 inline QPopupMenu* getImportMenu() { return ImportMenu;} 141 inline QPopupMenu* getImportMenu() { return ImportMenu;}
142 inline QPopupMenu* getExportMenu() { return ExportMenu;} 142 inline QPopupMenu* getExportMenu() { return ExportMenu;}
143#endif //KAB_EMBEDDED 143#endif //KAB_EMBEDDED
144 144
145 public slots: 145 public slots:
146#ifdef KAB_EMBEDDED 146#ifdef KAB_EMBEDDED
147 void createAboutData(); 147 void createAboutData();
148#endif //KAB_EMBEDDED 148#endif //KAB_EMBEDDED
149 void setDetailsToggle(); 149 void setDetailsToggle();
150 150
151 void showLicence(); 151 void showLicence();
152 void faq(); 152 void faq();
153 void whatsnew() ; 153 void whatsnew() ;
154 void synchowto() ; 154 void synchowto() ;
155 void multisynchowto() ; 155 void multisynchowto() ;
156 void kdesynchowto() ; 156 void kdesynchowto() ;
157 void writeToPhone(); 157 void writeToPhone();
158 158
159 /** 159 /**
160 Is called whenever a contact is selected in the view. 160 Is called whenever a contact is selected in the view.
161 */ 161 */
162 void setContactSelected( const QString &uid ); 162 void setContactSelected( const QString &uid );
163 163
164 /** 164 /**
165 Opens the preferred mail composer with all selected contacts as 165 Opens the preferred mail composer with all selected contacts as
166 arguments. 166 arguments.
167 */ 167 */
168 void sendMail(); 168 void sendMail();
169 169
170 /** 170 /**
171 Opens the preferred mail composer with the given contacts as 171 Opens the preferred mail composer with the given contacts as
172 arguments. 172 arguments.
173 */ 173 */
174 void sendMail( const QString& email ); 174 void sendMail( const QString& email );
175 175
176 176
177 void mailVCard(); 177 void mailVCard();
178 void mailVCard(const QStringList& uids); 178 void mailVCard(const QStringList& uids);
179 179
180 /** 180 /**
181 Beams the "WhoAmI contact. 181 Beams the "WhoAmI contact.
182 */ 182 */
183 void beamMySelf(); 183 void beamMySelf();
184 184
185 void beamVCard(); 185 void beamVCard();
186 void export2phone(); 186 void export2phone();
187 void beamVCard(const QStringList& uids); 187 void beamVCard(const QStringList& uids);
188 void beamDone( Ir *ir ); 188 void beamDone( Ir *ir );
189 189
190 190
191 /** 191 /**
192 Starts the preferred web browser with the given URL as argument. 192 Starts the preferred web browser with the given URL as argument.
193 */ 193 */
194 void browse( const QString& url ); 194 void browse( const QString& url );
195 195
196 /** 196 /**
197 Select all contacts in the view. 197 Select all contacts in the view.
198 */ 198 */
199 void selectAllContacts(); 199 void selectAllContacts();
200 200
201 /** 201 /**
202 Deletes all selected contacts from the address book. 202 Deletes all selected contacts from the address book.
203 */ 203 */
204 void deleteContacts(); 204 void deleteContacts();
205 205
206 /** 206 /**
207 Deletes given contacts from the address book. 207 Deletes given contacts from the address book.
208 208
209 @param uids The uids of the contacts, which shall be deleted. 209 @param uids The uids of the contacts, which shall be deleted.
210 */ 210 */
211 void deleteContacts( const QStringList &uids ); 211 void deleteContacts( const QStringList &uids );
212 212
213 /** 213 /**
214 Copys the selected contacts into clipboard for later pasting. 214 Copys the selected contacts into clipboard for later pasting.
215 */ 215 */
216 void copyContacts(); 216 void copyContacts();
217 217
218 /** 218 /**
219 Cuts the selected contacts and stores them for later pasting. 219 Cuts the selected contacts and stores them for later pasting.
220 */ 220 */
221 void cutContacts(); 221 void cutContacts();
222 222
223 /** 223 /**
224 Paste contacts from clipboard into the address book. 224 Paste contacts from clipboard into the address book.
225 */ 225 */
226 void pasteContacts(); 226 void pasteContacts();
227 227
228 /** 228 /**
229 Paste given contacts into the address book. 229 Paste given contacts into the address book.
230 230
231 @param list The list of addressee, which shall be pasted. 231 @param list The list of addressee, which shall be pasted.
232 */ 232 */
233 void pasteContacts( KABC::Addressee::List &list ); 233 void pasteContacts( KABC::Addressee::List &list );
234 234
235 /** 235 /**
236 Sets the whoAmI contact, that is used by many other programs to 236 Sets the whoAmI contact, that is used by many other programs to
237 get personal information about the current user. 237 get personal information about the current user.
238 */ 238 */
239 void setWhoAmI(); 239 void setWhoAmI();
240 240
241 /** 241 /**
242 Displays the category dialog and applies the result to all 242 Displays the category dialog and applies the result to all
243 selected contacts. 243 selected contacts.
244 */ 244 */
245 void setCategories(); 245 void setCategories();
246 void manageCategories(); 246 void manageCategories();
247 void editCategories(); 247 void editCategories();
248 248
249 /** 249 /**
250 Sets the field list of the Incremental Search Widget. 250 Sets the field list of the Incremental Search Widget.
251 */ 251 */
252 void setSearchFields( const KABC::Field::List &fields ); 252 void setSearchFields( const KABC::Field::List &fields );
253 253
254 /** 254 /**
255 Search with the current search field for a contact, that matches 255 Search with the current search field for a contact, that matches
256 the given text, and selects it in the view. 256 the given text, and selects it in the view.
257 */ 257 */
258 void incrementalSearch( const QString& text ); 258 void incrementalSearch( const QString& text );
259 259
260 /** 260 /**
261 Marks the address book as modified. 261 Marks the address book as modified.
262 */ 262 */
263 void setModified(); 263 void setModified();
264 /** 264 /**
265 Marks the address book as modified without refreshing the view. 265 Marks the address book as modified without refreshing the view.
266 */ 266 */
267 void setModifiedWOrefresh(); 267 void setModifiedWOrefresh();
268 268
269 /** 269 /**
270 Marks the address book as modified concerning the argument. 270 Marks the address book as modified concerning the argument.
271 */ 271 */
272 void setModified( bool modified ); 272 void setModified( bool modified );
273 273
274 /** 274 /**
275 Returns whether the address book is modified. 275 Returns whether the address book is modified.
276 */ 276 */
277 bool modified() const; 277 bool modified() const;
278 278
279 /** 279 /**
280 Called whenever an contact is modified in the contact editor 280 Called whenever an contact is modified in the contact editor
281 dialog or the quick edit. 281 dialog or the quick edit.
282 */ 282 */
283 void contactModified( const KABC::Addressee &addr ); 283 void contactModified( const KABC::Addressee &addr );
284 284
285 /** 285 /**
286 DCOP METHODS. 286 DCOP METHODS.
287 */ 287 */
288 void addEmail( QString addr ); 288 void addEmail( QString addr );
289 void importVCard( const KURL& url, bool showPreview ); 289 void importVCard( const KURL& url, bool showPreview );
290 void importVCard( const QString& vCard, bool showPreview ); 290 void importVCard( const QString& vCard, bool showPreview );
291 void newContact(); 291 void newContact();
292 QString getNameByPhone( const QString& phone ); 292 QString getNameByPhone( const QString& phone );
293 /** 293 /**
294 END DCOP METHODS 294 END DCOP METHODS
295 */ 295 */
296 296
297 /** 297 /**
298 Saves the contents of the AddressBook back to disk. 298 Saves the contents of the AddressBook back to disk.
299 */ 299 */
300 void save(); 300 void save();
301 301
302 /** 302 /**
303 Undos the last command using the undo stack. 303 Undos the last command using the undo stack.
304 */ 304 */
305 void undo(); 305 void undo();
306 306
307 /** 307 /**
308 Redos the last command that was undone, using the redo stack. 308 Redos the last command that was undone, using the redo stack.
309 */ 309 */
310 void redo(); 310 void redo();
311 311
312 /** 312 /**
313 Shows the edit dialog for the given uid. If the uid is QString::null, 313 Shows the edit dialog for the given uid. If the uid is QString::null,
314 the method will try to find a selected addressee in the view. 314 the method will try to find a selected addressee in the view.
315 */ 315 */
316 void editContact( const QString &uid /*US = QString::null*/ ); 316 void editContact( const QString &uid /*US = QString::null*/ );
317//US added a second method without defaultparameter 317//US added a second method without defaultparameter
318 void editContact2(); 318 void editContact2();
319 319
320 /** 320 /**
321 Shows or edits the detail view for the given uid. If the uid is QString::null, 321 Shows or edits the detail view for the given uid. If the uid is QString::null,
322 the method will try to find a selected addressee in the view. 322 the method will try to find a selected addressee in the view.
323 */ 323 */
324 void executeContact( const QString &uid /*US = QString::null*/ ); 324 void executeContact( const QString &uid /*US = QString::null*/ );
325 325
326 /** 326 /**
327 Launches the configuration dialog. 327 Launches the configuration dialog.
328 */ 328 */
329 void openConfigDialog(); 329 void openConfigDialog();
330 330
331 /** 331 /**
332 Launches the ldap search dialog. 332 Launches the ldap search dialog.
333 */ 333 */
334 void openLDAPDialog(); 334 void openLDAPDialog();
335 335
336 /** 336 /**
337 Creates a KAddressBookPrinter, which will display the print 337 Creates a KAddressBookPrinter, which will display the print
338 dialog and do the printing. 338 dialog and do the printing.
339 */ 339 */
340 void print(); 340 void print();
341 341
342 /** 342 /**
343 Registers a new GUI client, so plugins can register its actions. 343 Registers a new GUI client, so plugins can register its actions.
344 */ 344 */
345 void addGUIClient( KXMLGUIClient *client ); 345 void addGUIClient( KXMLGUIClient *client );
346 346
347 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 347 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
348 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 348 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
349 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 349 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
350 350
351 351
352 signals: 352 signals:
353 void contactSelected( const QString &name ); 353 void contactSelected( const QString &name );
354 void contactSelected( const QPixmap &pixmap ); 354 void contactSelected( const QPixmap &pixmap );
355 public slots: 355 public slots:
356 void recieve(QString cmsg ); 356 void recieve(QString cmsg );
357 void getFile( bool success ); 357 void getFile( bool success );
358 void syncFileRequest(); 358 void syncFileRequest();
359 void setDetailsVisible( bool visible ); 359 void setDetailsVisible( bool visible );
360 void setDetailsToState(); 360 void setDetailsToState();
361 // void slotSyncMenu( int ); 361 // void slotSyncMenu( int );
362 private slots: 362 private slots:
363 void updateToolBar(); 363 void updateToolBar();
364 void updateMainWindow();
364 void receive( const QCString& cmsg, const QByteArray& data ); 365 void receive( const QCString& cmsg, const QByteArray& data );
365 void toggleBeamReceive( ); 366 void toggleBeamReceive( );
366 void disableBR(bool); 367 void disableBR(bool);
367 void setJumpButtonBarVisible( bool visible ); 368 void setJumpButtonBarVisible( bool visible );
368 void setCaptionBack(); 369 void setCaptionBack();
369 void importFromOL(); 370 void importFromOL();
370 void extensionModified( const KABC::Addressee::List &list ); 371 void extensionModified( const KABC::Addressee::List &list );
371 void extensionChanged( int id ); 372 void extensionChanged( int id );
372 void clipboardDataChanged(); 373 void clipboardDataChanged();
373 void updateActionMenu(); 374 void updateActionMenu();
374 void configureKeyBindings(); 375 void configureKeyBindings();
375 void removeVoice(); 376 void removeVoice();
376#ifdef KAB_EMBEDDED 377#ifdef KAB_EMBEDDED
377 void configureResources(); 378 void configureResources();
378#endif //KAB_EMBEDDED 379#endif //KAB_EMBEDDED
379 380
380 void slotEditorDestroyed( const QString &uid ); 381 void slotEditorDestroyed( const QString &uid );
381 void configurationChanged(); 382 void configurationChanged();
382 void addressBookChanged(); 383 void addressBookChanged();
383 384
384 private: 385 private:
385 void resizeEvent(QResizeEvent* e ); 386 void resizeEvent(QResizeEvent* e );
386 bool mBRdisabled; 387 bool mBRdisabled;
387#ifndef DESKTOP_VERSION 388#ifndef DESKTOP_VERSION
388 QCopChannel* infrared; 389 QCopChannel* infrared;
389#endif 390#endif
390 QTimer *mMessageTimer; 391 QTimer *mMessageTimer;
391 void initGUI(); 392 void initGUI();
392 void initActions(); 393 void initActions();
393 QString getPhoneFile(); 394 QString getPhoneFile();
394 395
395 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 396 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
396 const char *name = 0 ); 397 const char *name = 0 );
397 398
398 KXMLGUIClient *mGUIClient; 399 KXMLGUIClient *mGUIClient;
399 400
400 KABC::AddressBook *mAddressBook; 401 KABC::AddressBook *mAddressBook;
401 402
402 ViewManager *mViewManager; 403 ViewManager *mViewManager;
403 // QSplitter *mDetailsSplitter; 404 // QSplitter *mDetailsSplitter;
404 KDGanttMinimizeSplitter *mExtensionBarSplitter; 405 KDGanttMinimizeSplitter *mExtensionBarSplitter;
405 ViewContainer *mDetails; 406 ViewContainer *mDetails;
406 KDGanttMinimizeSplitter* mMiniSplitter; 407 KDGanttMinimizeSplitter* mMiniSplitter;
407 XXPortManager *mXXPortManager; 408 XXPortManager *mXXPortManager;
408 JumpButtonBar *mJumpButtonBar; 409 JumpButtonBar *mJumpButtonBar;
409 IncSearchWidget *mIncSearchWidget; 410 IncSearchWidget *mIncSearchWidget;
410 ExtensionManager *mExtensionManager; 411 ExtensionManager *mExtensionManager;
411 412
412 KCMultiDialog *mConfigureDialog; 413 KCMultiDialog *mConfigureDialog;
413 414
414#ifndef KAB_EMBEDDED 415#ifndef KAB_EMBEDDED
415 LDAPSearchDialog *mLdapSearchDialog; 416 LDAPSearchDialog *mLdapSearchDialog;
416#endif //KAB_EMBEDDED 417#endif //KAB_EMBEDDED
417 // QDict<AddresseeEditorDialog> mEditorDict; 418 // QDict<AddresseeEditorDialog> mEditorDict;
418 AddresseeEditorDialog *mEditorDialog; 419 AddresseeEditorDialog *mEditorDialog;
419 bool mReadWrite; 420 bool mReadWrite;
420 bool mModified; 421 bool mModified;
421 bool mIsPart; 422 bool mIsPart;
422 bool mMultipleViewsAtOnce; 423 bool mMultipleViewsAtOnce;
423 424
424 425
425 //US file menu 426 //US file menu
426 KAction *mActionMail; 427 KAction *mActionMail;
427 KAction *mActionBeam; 428 KAction *mActionBeam;
428 KToggleAction *mActionBR; 429 KToggleAction *mActionBR;
429 KAction *mActionExport2phone; 430 KAction *mActionExport2phone;
430 KAction* mActionPrint; 431 KAction* mActionPrint;
431 KAction* mActionNewContact; 432 KAction* mActionNewContact;
432 KAction *mActionSave; 433 KAction *mActionSave;
433 KAction *mActionEditAddressee; 434 KAction *mActionEditAddressee;
434 KAction *mActionMailVCard; 435 KAction *mActionMailVCard;
435 KAction *mActionBeamVCard; 436 KAction *mActionBeamVCard;
436 437
437 KAction *mActionQuit; 438 KAction *mActionQuit;
438 439
439 //US edit menu 440 //US edit menu
440 KAction *mActionCopy; 441 KAction *mActionCopy;
441 KAction *mActionCut; 442 KAction *mActionCut;
442 KAction *mActionPaste; 443 KAction *mActionPaste;
443 KAction *mActionSelectAll; 444 KAction *mActionSelectAll;
444 KAction *mActionUndo; 445 KAction *mActionUndo;
445 KAction *mActionRedo; 446 KAction *mActionRedo;
446 KAction *mActionDelete; 447 KAction *mActionDelete;
447 448
448 //US settings menu 449 //US settings menu
449 KAction *mActionConfigResources; 450 KAction *mActionConfigResources;
450 KAction *mActionConfigKAddressbook; 451 KAction *mActionConfigKAddressbook;
451 KAction *mActionConfigShortcuts; 452 KAction *mActionConfigShortcuts;
452 KAction *mActionConfigureToolbars; 453 KAction *mActionConfigureToolbars;
453 KAction *mActionKeyBindings; 454 KAction *mActionKeyBindings;
454 KToggleAction *mActionJumpBar; 455 KToggleAction *mActionJumpBar;
455 KToggleAction *mActionDetails; 456 KToggleAction *mActionDetails;
456 KAction *mActionWhoAmI; 457 KAction *mActionWhoAmI;
457 KAction *mActionCategories; 458 KAction *mActionCategories;
458 KAction *mActionEditCategories; 459 KAction *mActionEditCategories;
459 KAction *mActionManageCategories; 460 KAction *mActionManageCategories;
460 KAction *mActionAboutKAddressbook; 461 KAction *mActionAboutKAddressbook;
461 KAction *mActionLicence; 462 KAction *mActionLicence;
462 KAction *mActionFaq; 463 KAction *mActionFaq;
463 KAction *mActionWN; 464 KAction *mActionWN;
464 KAction *mActionSyncHowto; 465 KAction *mActionSyncHowto;
465 KAction *mActionKdeSyncHowto; 466 KAction *mActionKdeSyncHowto;
466 KAction *mActionMultiSyncHowto; 467 KAction *mActionMultiSyncHowto;
467 468
468 KAction *mActionDeleteView; 469 KAction *mActionDeleteView;
469 470
470 QPopupMenu *viewMenu; 471 QPopupMenu *viewMenu;
471 QPopupMenu *filterMenu; 472 QPopupMenu *filterMenu;
472 QPopupMenu *settingsMenu; 473 QPopupMenu *settingsMenu;
473 QPopupMenu *changeMenu; 474 QPopupMenu *changeMenu;
474//US QAction *mActionSave; 475//US QAction *mActionSave;
475 QPopupMenu *ImportMenu; 476 QPopupMenu *ImportMenu;
476 QPopupMenu *ExportMenu; 477 QPopupMenu *ExportMenu;
477 //LR additional methods 478 //LR additional methods
478 KAction *mActionRemoveVoice; 479 KAction *mActionRemoveVoice;
479 KAction * mActionImportOL; 480 KAction * mActionImportOL;
480 481
481#ifndef KAB_EMBEDDED 482#ifndef KAB_EMBEDDED
482 KAddressBookService *mAddressBookService; 483 KAddressBookService *mAddressBookService;
483#endif //KAB_EMBEDDED 484#endif //KAB_EMBEDDED
484 485
485 class KABCorePrivate; 486 class KABCorePrivate;
486 KABCorePrivate *d; 487 KABCorePrivate *d;
487 //US bool mBlockSaveFlag; 488 //US bool mBlockSaveFlag;
488 489
489#ifdef KAB_EMBEDDED 490#ifdef KAB_EMBEDDED
490 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 491 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
491#endif //KAB_EMBEDDED 492#endif //KAB_EMBEDDED
492 493
493 //this are the overwritten callbackmethods from the syncinterface 494 //this are the overwritten callbackmethods from the syncinterface
494 virtual bool sync(KSyncManager* manager, QString filename, int mode); 495 virtual bool sync(KSyncManager* manager, QString filename, int mode);
495 virtual bool syncExternal(KSyncManager* manager, QString resource); 496 virtual bool syncExternal(KSyncManager* manager, QString resource);
496 virtual void removeSyncInfo( QString syncProfile); 497 virtual void removeSyncInfo( QString syncProfile);
497 bool syncPhone(); 498 bool syncPhone();
498 void message( QString m ); 499 void message( QString m );
499 500
500 // LR ******************************* 501 // LR *******************************
501 // sync stuff! 502 // sync stuff!
502 QString sentSyncFile(); 503 QString sentSyncFile();
503 QPopupMenu *syncMenu; 504 QPopupMenu *syncMenu;
504 KSyncManager* syncManager; 505 KSyncManager* syncManager;
505 int mGlobalSyncMode; 506 int mGlobalSyncMode;
506 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 507 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
507 KABC::Addressee getLastSyncAddressee(); 508 KABC::Addressee getLastSyncAddressee();
508 QDateTime mLastAddressbookSync; 509 QDateTime mLastAddressbookSync;
509 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 510 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
510 // ********************* 511 // *********************
511 512
512}; 513};
513 514
514#endif 515#endif