summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/incsearchwidget.cpp7
-rw-r--r--kaddressbook/kabcore.cpp1
2 files changed, 6 insertions, 2 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp
index b1ffe04..5f8b83d 100644
--- a/kaddressbook/incsearchwidget.cpp
+++ b/kaddressbook/incsearchwidget.cpp
@@ -1,178 +1,181 @@
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 <qapplication.h> 27#include <qapplication.h>
28#include <qcombobox.h> 28#include <qcombobox.h>
29 29
30#include <kdialog.h> 30#include <kdialog.h>
31#include <klineedit.h> 31#include <klineedit.h>
32#include <klocale.h> 32#include <klocale.h>
33#include <kglobal.h> 33#include <kglobal.h>
34#include <kglobal.h> 34#include <kglobal.h>
35#include "kabprefs.h" 35#include "kabprefs.h"
36 36
37#include "incsearchwidget.h" 37#include "incsearchwidget.h"
38 38
39IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) 39IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name )
40 : QWidget( parent, name ) 40 : QWidget( parent, name )
41{ 41{
42#ifndef KAB_EMBEDDED 42#ifndef KAB_EMBEDDED
43//US setCaption( i18n( "Incremental Search" ) ); 43//US setCaption( i18n( "Incremental Search" ) );
44#endif //KAB_EMBEDDED 44#endif //KAB_EMBEDDED
45 45
46 QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() ); 46 QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() );
47 47
48#ifdef DESKTOP_VERSION 48#ifdef DESKTOP_VERSION
49 QLabel *label = new QLabel( i18n( "Search:" ), this ); 49 QLabel *label = new QLabel( i18n( "Search:" ), this );
50 label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight ); 50 label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight );
51 layout->addWidget( label ); 51 layout->addWidget( label );
52#endif //KAB_EMBEDDED 52#endif //KAB_EMBEDDED
53 53
54 mSearchText = new KLineEdit( this ); 54 mSearchText = new KLineEdit( this );
55 layout->addWidget( mSearchText ); 55 layout->addWidget( mSearchText );
56// #ifdef KAB_EMBEDDED 56// #ifdef KAB_EMBEDDED
57// if (KGlobal::getOrientation() == KGlobal::Portrait) 57// if (KGlobal::getOrientation() == KGlobal::Portrait)
58// mSearchText->setMaximumWidth(30); 58// mSearchText->setMaximumWidth(30);
59// #endif //KAB_EMBEDDED 59// #endif //KAB_EMBEDDED
60 //mSearchText->setMaximumWidth(60); 60 //mSearchText->setMaximumWidth(60);
61 61
62 62
63 mFieldCombo = new QComboBox( false, this ); 63 mFieldCombo = new QComboBox( false, this );
64 layout->addWidget( mFieldCombo ); 64 layout->addWidget( mFieldCombo );
65 mFieldCombo->setMaximumHeight( 34 ); 65 mFieldCombo->setMaximumHeight( 34 );
66 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); 66 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) );
67 67
68// #ifndef KAB_EMBEDDED 68// #ifndef KAB_EMBEDDED
69// resize( QSize(420, 50).expandedTo( sizeHint() ) ); 69// resize( QSize(420, 50).expandedTo( sizeHint() ) );
70// #else //KAB_EMBEDDED 70// #else //KAB_EMBEDDED
71// resize( QSize(30, 10).expandedTo( sizeHint() ) ); 71// resize( QSize(30, 10).expandedTo( sizeHint() ) );
72// #endif //KAB_EMBEDDED 72// #endif //KAB_EMBEDDED
73 73
74 74
75 // for performance reasons, we do a search on the pda only after return is pressed 75 // for performance reasons, we do a search on the pda only after return is pressed
76 connect( mSearchText, SIGNAL( textChanged( const QString& ) ), 76 connect( mSearchText, SIGNAL( textChanged( const QString& ) ),
77 SLOT( announceDoSearch2() ) ); 77 SLOT( announceDoSearch2() ) );
78 connect( mFieldCombo, SIGNAL( activated( const QString& ) ), 78 connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
79 SLOT( announceDoSearch2() ) ); 79 SLOT( announceDoSearch2() ) );
80 80
81 connect( mSearchText, SIGNAL( returnPressed() ), 81 connect( mSearchText, SIGNAL( returnPressed() ),
82 SLOT( announceDoSearch() ) ); 82 SLOT( announceDoSearch() ) );
83 connect( mFieldCombo, SIGNAL( activated( const QString& ) ), 83 connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
84 SLOT( announceFieldChanged() ) ); 84 SLOT( announceFieldChanged() ) );
85 85
86 86
87 87
88 connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() )); 88 connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() ));
89 connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() )); 89 connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() ));
90 90
91 91
92 setFocusProxy( mSearchText ); 92 setFocusProxy( mSearchText );
93} 93}
94 94
95IncSearchWidget::~IncSearchWidget() 95IncSearchWidget::~IncSearchWidget()
96{ 96{
97 97
98} 98}
99void IncSearchWidget::announceDoSearch2() 99void IncSearchWidget::announceDoSearch2()
100{ 100{
101 if ( KABPrefs::instance()->mSearchWithReturn ) 101 if ( KABPrefs::instance()->mSearchWithReturn )
102 return; 102 return;
103 emit doSearch( mSearchText->text() ); 103 emit doSearch( mSearchText->text() );
104 //qDebug("emit dosreach "); 104 //qDebug("emit dosreach ");
105} 105}
106 106
107void IncSearchWidget::announceDoSearch() 107void IncSearchWidget::announceDoSearch()
108{ 108{
109 109
110 emit doSearch( mSearchText->text() ); 110 emit doSearch( mSearchText->text() );
111 // qDebug("emit dosreach "); 111 // qDebug("emit dosreach ");
112} 112}
113 113
114void IncSearchWidget::announceFieldChanged() 114void IncSearchWidget::announceFieldChanged()
115{ 115{
116 emit fieldChanged(); 116 emit fieldChanged();
117} 117}
118void IncSearchWidget::setSize() 118void IncSearchWidget::setSize()
119{ 119{
120 if ( KABPrefs::instance()->mHideSearchOnSwitch && QApplication::desktop()->width() == 480) { 120 if ( KABPrefs::instance()->mHideSearchOnSwitch && QApplication::desktop()->width() == 480) {
121 mFieldCombo->setMaximumWidth( 40 ); 121 setCurrentItem( 0 );
122 mSearchText->setMaximumWidth( 30 ); 122 //mFieldCombo->setMaximumWidth( 0 );
123 mFieldCombo->hide();
124 mSearchText->setMaximumWidth( 200 );
123 } else { 125 } else {
126 mFieldCombo->show();
124 QFontMetrics fm ( mFieldCombo->font() ); 127 QFontMetrics fm ( mFieldCombo->font() );
125 int wid = fm.width(i18n( "All Fields" ) ); 128 int wid = fm.width(i18n( "All Fields" ) );
126#ifdef DESKTOP_VERSION 129#ifdef DESKTOP_VERSION
127 mFieldCombo->setMinimumWidth( wid+60 ); 130 mFieldCombo->setMinimumWidth( wid+60 );
128 wid = wid * 2; 131 wid = wid * 2;
129#endif 132#endif
130 mFieldCombo->setMaximumWidth( wid+60 ); 133 mFieldCombo->setMaximumWidth( wid+60 );
131 mSearchText->setMaximumWidth( 1024 ); 134 mSearchText->setMaximumWidth( 1024 );
132 } 135 }
133} 136}
134void IncSearchWidget::setFields( const KABC::Field::List &list ) 137void IncSearchWidget::setFields( const KABC::Field::List &list )
135{ 138{
136 139
137 mFieldCombo->clear(); 140 mFieldCombo->clear();
138 mFieldCombo->insertItem( i18n( "All Fields" ) ); 141 mFieldCombo->insertItem( i18n( "All Fields" ) );
139 142
140 KABC::Field::List::ConstIterator it; 143 KABC::Field::List::ConstIterator it;
141 for ( it = list.begin(); it != list.end(); ++it ) { 144 for ( it = list.begin(); it != list.end(); ++it ) {
142 mFieldCombo->insertItem( (*it)->label() ); 145 mFieldCombo->insertItem( (*it)->label() );
143 } 146 }
144 147
145 mFieldList = list; 148 mFieldList = list;
146 149
147 announceDoSearch(); 150 announceDoSearch();
148 announceFieldChanged(); 151 announceFieldChanged();
149 setSize(); 152 setSize();
150} 153}
151 154
152KABC::Field::List IncSearchWidget::fields() const 155KABC::Field::List IncSearchWidget::fields() const
153{ 156{
154 return mFieldList; 157 return mFieldList;
155} 158}
156 159
157KABC::Field *IncSearchWidget::currentField()const 160KABC::Field *IncSearchWidget::currentField()const
158{ 161{
159 if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 ) 162 if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 )
160 return 0; // for error or 'use all fields' 163 return 0; // for error or 'use all fields'
161 else 164 else
162 return mFieldList[ mFieldCombo->currentItem() - 1 ]; 165 return mFieldList[ mFieldCombo->currentItem() - 1 ];
163} 166}
164 167
165void IncSearchWidget::setCurrentItem( int pos ) 168void IncSearchWidget::setCurrentItem( int pos )
166{ 169{
167 mFieldCombo->setCurrentItem( pos ); 170 mFieldCombo->setCurrentItem( pos );
168 announceFieldChanged(); 171 announceFieldChanged();
169} 172}
170 173
171int IncSearchWidget::currentItem() const 174int IncSearchWidget::currentItem() const
172{ 175{
173 176
174 return mFieldCombo->currentItem(); 177 return mFieldCombo->currentItem();
175} 178}
176#ifndef KAB_EMBEDDED 179#ifndef KAB_EMBEDDED
177#include "incsearchwidget.moc" 180#include "incsearchwidget.moc"
178#endif //KAB_EMBEDDED 181#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 046cb63..b4e0b07 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -63,1536 +63,1537 @@ $Id$
63#include <kkeydialog.h> 63#include <kkeydialog.h>
64#include <kmessagebox.h> 64#include <kmessagebox.h>
65#include <kprinter.h> 65#include <kprinter.h>
66#include <kprotocolinfo.h> 66#include <kprotocolinfo.h>
67#include <kresources/selectdialog.h> 67#include <kresources/selectdialog.h>
68#include <kstandarddirs.h> 68#include <kstandarddirs.h>
69#include <ktempfile.h> 69#include <ktempfile.h>
70#include <kxmlguiclient.h> 70#include <kxmlguiclient.h>
71#include <kaboutdata.h> 71#include <kaboutdata.h>
72#include <libkdepim/categoryselectdialog.h> 72#include <libkdepim/categoryselectdialog.h>
73 73
74#include "addresseeutil.h" 74#include "addresseeutil.h"
75#include "addresseeeditordialog.h" 75#include "addresseeeditordialog.h"
76#include "extensionmanager.h" 76#include "extensionmanager.h"
77#include "kstdaction.h" 77#include "kstdaction.h"
78#include "kaddressbookservice.h" 78#include "kaddressbookservice.h"
79#include "ldapsearchdialog.h" 79#include "ldapsearchdialog.h"
80#include "printing/printingwizard.h" 80#include "printing/printingwizard.h"
81#else // KAB_EMBEDDED 81#else // KAB_EMBEDDED
82 82
83#include <kapplication.h> 83#include <kapplication.h>
84#include "KDGanttMinimizeSplitter.h" 84#include "KDGanttMinimizeSplitter.h"
85#include "kaddressbookmain.h" 85#include "kaddressbookmain.h"
86#include "kactioncollection.h" 86#include "kactioncollection.h"
87#include "addresseedialog.h" 87#include "addresseedialog.h"
88//US 88//US
89#include <addresseeview.h> 89#include <addresseeview.h>
90 90
91#include <qapp.h> 91#include <qapp.h>
92#include <qmenubar.h> 92#include <qmenubar.h>
93//#include <qtoolbar.h> 93//#include <qtoolbar.h>
94#include <qmessagebox.h> 94#include <qmessagebox.h>
95#include <kdebug.h> 95#include <kdebug.h>
96#include <kiconloader.h> // needed for SmallIcon 96#include <kiconloader.h> // needed for SmallIcon
97#include <kresources/kcmkresources.h> 97#include <kresources/kcmkresources.h>
98#include <ktoolbar.h> 98#include <ktoolbar.h>
99#include <kprefsdialog.h> 99#include <kprefsdialog.h>
100 100
101 101
102//#include <qlabel.h> 102//#include <qlabel.h>
103 103
104 104
105#ifndef DESKTOP_VERSION 105#ifndef DESKTOP_VERSION
106#include <qpe/ir.h> 106#include <qpe/ir.h>
107#include <qpe/qpemenubar.h> 107#include <qpe/qpemenubar.h>
108#include <qtopia/qcopenvelope_qws.h> 108#include <qtopia/qcopenvelope_qws.h>
109#else 109#else
110 110
111#include <qmenubar.h> 111#include <qmenubar.h>
112#endif 112#endif
113 113
114#endif // KAB_EMBEDDED 114#endif // KAB_EMBEDDED
115#include "kcmconfigs/kcmkabconfig.h" 115#include "kcmconfigs/kcmkabconfig.h"
116#include "kcmconfigs/kcmkdepimconfig.h" 116#include "kcmconfigs/kcmkdepimconfig.h"
117#include "kpimglobalprefs.h" 117#include "kpimglobalprefs.h"
118#include "externalapphandler.h" 118#include "externalapphandler.h"
119#include "xxportselectdialog.h" 119#include "xxportselectdialog.h"
120 120
121 121
122#include <kresources/selectdialog.h> 122#include <kresources/selectdialog.h>
123#include <kmessagebox.h> 123#include <kmessagebox.h>
124 124
125#include <picture.h> 125#include <picture.h>
126#include <resource.h> 126#include <resource.h>
127 127
128//US#include <qsplitter.h> 128//US#include <qsplitter.h>
129#include <qmap.h> 129#include <qmap.h>
130#include <qdir.h> 130#include <qdir.h>
131#include <qfile.h> 131#include <qfile.h>
132#include <qvbox.h> 132#include <qvbox.h>
133#include <qlayout.h> 133#include <qlayout.h>
134#include <qclipboard.h> 134#include <qclipboard.h>
135#include <qtextstream.h> 135#include <qtextstream.h>
136#include <qradiobutton.h> 136#include <qradiobutton.h>
137#include <qbuttongroup.h> 137#include <qbuttongroup.h>
138 138
139#include <libkdepim/categoryselectdialog.h> 139#include <libkdepim/categoryselectdialog.h>
140#include <libkdepim/categoryeditdialog.h> 140#include <libkdepim/categoryeditdialog.h>
141#include <kabc/vcardconverter.h> 141#include <kabc/vcardconverter.h>
142 142
143 143
144#include "addresseeutil.h" 144#include "addresseeutil.h"
145#include "undocmds.h" 145#include "undocmds.h"
146#include "addresseeeditordialog.h" 146#include "addresseeeditordialog.h"
147#include "viewmanager.h" 147#include "viewmanager.h"
148#include "details/detailsviewcontainer.h" 148#include "details/detailsviewcontainer.h"
149#include "kabprefs.h" 149#include "kabprefs.h"
150#include "xxportmanager.h" 150#include "xxportmanager.h"
151#include "incsearchwidget.h" 151#include "incsearchwidget.h"
152#include "jumpbuttonbar.h" 152#include "jumpbuttonbar.h"
153#include "extensionmanager.h" 153#include "extensionmanager.h"
154#include "addresseeconfig.h" 154#include "addresseeconfig.h"
155#include "nameeditdialog.h" 155#include "nameeditdialog.h"
156#include <kcmultidialog.h> 156#include <kcmultidialog.h>
157 157
158#ifdef _WIN32_ 158#ifdef _WIN32_
159#ifdef _OL_IMPORT_ 159#ifdef _OL_IMPORT_
160#include "kaimportoldialog.h" 160#include "kaimportoldialog.h"
161#endif 161#endif
162#else 162#else
163#include <unistd.h> 163#include <unistd.h>
164#endif 164#endif
165// sync includes 165// sync includes
166#include <libkdepim/ksyncprofile.h> 166#include <libkdepim/ksyncprofile.h>
167#include <libkdepim/ksyncprefsdialog.h> 167#include <libkdepim/ksyncprefsdialog.h>
168 168
169 169
170class KABCatPrefs : public QDialog 170class KABCatPrefs : public QDialog
171{ 171{
172 public: 172 public:
173 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 173 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
174 QDialog( parent, name, true ) 174 QDialog( parent, name, true )
175 { 175 {
176 setCaption( i18n("Manage new Categories") ); 176 setCaption( i18n("Manage new Categories") );
177 QVBoxLayout* lay = new QVBoxLayout( this ); 177 QVBoxLayout* lay = new QVBoxLayout( this );
178 lay->setSpacing( 3 ); 178 lay->setSpacing( 3 );
179 lay->setMargin( 3 ); 179 lay->setMargin( 3 );
180 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 ); 180 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 );
181 lay->addWidget( lab ); 181 lay->addWidget( lab );
182 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 182 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
183 lay->addWidget( format ); 183 lay->addWidget( format );
184 format->setExclusive ( true ) ; 184 format->setExclusive ( true ) ;
185 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 185 addCatBut = new QRadioButton(i18n("Add to category list"), format );
186 new QRadioButton(i18n("Remove from addressees"), format ); 186 new QRadioButton(i18n("Remove from addressees"), format );
187 addCatBut->setChecked( true ); 187 addCatBut->setChecked( true );
188 QPushButton * ok = new QPushButton( i18n("OK"), this ); 188 QPushButton * ok = new QPushButton( i18n("OK"), this );
189 lay->addWidget( ok ); 189 lay->addWidget( ok );
190 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 190 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
191 lay->addWidget( cancel ); 191 lay->addWidget( cancel );
192 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 192 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
193 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 193 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
194 resize( 200, 200 ); 194 resize( 200, 200 );
195 } 195 }
196 196
197 bool addCat() { return addCatBut->isChecked(); } 197 bool addCat() { return addCatBut->isChecked(); }
198private: 198private:
199 QRadioButton* addCatBut; 199 QRadioButton* addCatBut;
200}; 200};
201 201
202class KABFormatPrefs : public QDialog 202class KABFormatPrefs : public QDialog
203{ 203{
204 public: 204 public:
205 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : 205 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) :
206 QDialog( parent, name, true ) 206 QDialog( parent, name, true )
207 { 207 {
208 setCaption( i18n("Set formatted name") ); 208 setCaption( i18n("Set formatted name") );
209 QVBoxLayout* lay = new QVBoxLayout( this ); 209 QVBoxLayout* lay = new QVBoxLayout( this );
210 lay->setSpacing( 3 ); 210 lay->setSpacing( 3 );
211 lay->setMargin( 3 ); 211 lay->setMargin( 3 );
212 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); 212 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this );
213 lay->addWidget( lab ); 213 lay->addWidget( lab );
214 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); 214 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this );
215 lay->addWidget( format ); 215 lay->addWidget( format );
216 format->setExclusive ( true ) ; 216 format->setExclusive ( true ) ;
217 simple = new QRadioButton(i18n("Simple: James Bond"), format ); 217 simple = new QRadioButton(i18n("Simple: James Bond"), format );
218 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); 218 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format );
219 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); 219 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
220 company = new QRadioButton(i18n("Organization: MI6"), format ); 220 company = new QRadioButton(i18n("Organization: MI6"), format );
221 simple->setChecked( true ); 221 simple->setChecked( true );
222 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); 222 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
223 lay->addWidget( setCompany ); 223 lay->addWidget( setCompany );
224 QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); 224 QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
225 lay->addWidget( ok ); 225 lay->addWidget( ok );
226 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 226 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
227 lay->addWidget( cancel ); 227 lay->addWidget( cancel );
228 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 228 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
229 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 229 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
230 //resize( 200, 200 ); 230 //resize( 200, 200 );
231 231
232 } 232 }
233public: 233public:
234 QRadioButton* simple, *full, *reverse, *company; 234 QRadioButton* simple, *full, *reverse, *company;
235 QCheckBox* setCompany; 235 QCheckBox* setCompany;
236}; 236};
237 237
238 238
239 239
240class KAex2phonePrefs : public QDialog 240class KAex2phonePrefs : public QDialog
241{ 241{
242 public: 242 public:
243 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 243 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
244 QDialog( parent, name, true ) 244 QDialog( parent, name, true )
245 { 245 {
246 setCaption( i18n("Export to phone options") ); 246 setCaption( i18n("Export to phone options") );
247 QVBoxLayout* lay = new QVBoxLayout( this ); 247 QVBoxLayout* lay = new QVBoxLayout( this );
248 lay->setSpacing( 3 ); 248 lay->setSpacing( 3 );
249 lay->setMargin( 3 ); 249 lay->setMargin( 3 );
250 QLabel *lab; 250 QLabel *lab;
251 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 251 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
252 lab->setAlignment (AlignHCenter ); 252 lab->setAlignment (AlignHCenter );
253 QHBox* temphb; 253 QHBox* temphb;
254 temphb = new QHBox( this ); 254 temphb = new QHBox( this );
255 new QLabel( i18n("I/O device: "), temphb ); 255 new QLabel( i18n("I/O device: "), temphb );
256 mPhoneDevice = new QLineEdit( temphb); 256 mPhoneDevice = new QLineEdit( temphb);
257 lay->addWidget( temphb ); 257 lay->addWidget( temphb );
258 temphb = new QHBox( this ); 258 temphb = new QHBox( this );
259 new QLabel( i18n("Connection: "), temphb ); 259 new QLabel( i18n("Connection: "), temphb );
260 mPhoneConnection = new QLineEdit( temphb); 260 mPhoneConnection = new QLineEdit( temphb);
261 lay->addWidget( temphb ); 261 lay->addWidget( temphb );
262 temphb = new QHBox( this ); 262 temphb = new QHBox( this );
263 new QLabel( i18n("Model(opt.): "), temphb ); 263 new QLabel( i18n("Model(opt.): "), temphb );
264 mPhoneModel = new QLineEdit( temphb); 264 mPhoneModel = new QLineEdit( temphb);
265 lay->addWidget( temphb ); 265 lay->addWidget( temphb );
266 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 266 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
267 // lay->addWidget( mWriteToSim ); 267 // lay->addWidget( mWriteToSim );
268 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 268 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
269 lab->setAlignment (AlignHCenter); 269 lab->setAlignment (AlignHCenter);
270 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 270 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
271 lay->addWidget( ok ); 271 lay->addWidget( ok );
272 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 272 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
273 lay->addWidget( cancel ); 273 lay->addWidget( cancel );
274 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 274 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
275 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 275 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
276 resize( 220, 240 ); 276 resize( 220, 240 );
277 277
278 } 278 }
279 279
280public: 280public:
281 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 281 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
282 QCheckBox* mWriteToSim; 282 QCheckBox* mWriteToSim;
283}; 283};
284 284
285 285
286bool pasteWithNewUid = true; 286bool pasteWithNewUid = true;
287 287
288#ifdef KAB_EMBEDDED 288#ifdef KAB_EMBEDDED
289KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 289KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
290 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 290 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
291 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 291 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
292 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 292 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
293#else //KAB_EMBEDDED 293#else //KAB_EMBEDDED
294KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 294KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
295 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 295 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
296 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 296 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
297 mReadWrite( readWrite ), mModified( false ) 297 mReadWrite( readWrite ), mModified( false )
298#endif //KAB_EMBEDDED 298#endif //KAB_EMBEDDED
299{ 299{
300 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 300 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
301 // syncManager->setBlockSave(false); 301 // syncManager->setBlockSave(false);
302 mIncSearchWidget = 0; 302 mIncSearchWidget = 0;
303 mMiniSplitter = 0; 303 mMiniSplitter = 0;
304 mExtensionBarSplitter = 0; 304 mExtensionBarSplitter = 0;
305 mIsPart = !parent->inherits( "KAddressBookMain" ); 305 mIsPart = !parent->inherits( "KAddressBookMain" );
306 mAddressBook = KABC::StdAddressBook::self(); 306 mAddressBook = KABC::StdAddressBook::self();
307 KABC::StdAddressBook::setAutomaticSave( false ); 307 KABC::StdAddressBook::setAutomaticSave( false );
308 308
309#ifndef KAB_EMBEDDED 309#ifndef KAB_EMBEDDED
310 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 310 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
311#endif //KAB_EMBEDDED 311#endif //KAB_EMBEDDED
312 312
313 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 313 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
314 SLOT( addressBookChanged() ) ); 314 SLOT( addressBookChanged() ) );
315 315
316#if 0 316#if 0
317 // LR moved to addressbook init method 317 // LR moved to addressbook init method
318 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 318 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
319 "X-Department", "KADDRESSBOOK" ); 319 "X-Department", "KADDRESSBOOK" );
320 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 320 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
321 "X-Profession", "KADDRESSBOOK" ); 321 "X-Profession", "KADDRESSBOOK" );
322 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 322 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
323 "X-AssistantsName", "KADDRESSBOOK" ); 323 "X-AssistantsName", "KADDRESSBOOK" );
324 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 324 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
325 "X-ManagersName", "KADDRESSBOOK" ); 325 "X-ManagersName", "KADDRESSBOOK" );
326 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 326 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
327 "X-SpousesName", "KADDRESSBOOK" ); 327 "X-SpousesName", "KADDRESSBOOK" );
328 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 328 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
329 "X-Office", "KADDRESSBOOK" ); 329 "X-Office", "KADDRESSBOOK" );
330 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 330 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
331 "X-IMAddress", "KADDRESSBOOK" ); 331 "X-IMAddress", "KADDRESSBOOK" );
332 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 332 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
333 "X-Anniversary", "KADDRESSBOOK" ); 333 "X-Anniversary", "KADDRESSBOOK" );
334 334
335 //US added this field to become compatible with Opie/qtopia addressbook 335 //US added this field to become compatible with Opie/qtopia addressbook
336 // values can be "female" or "male" or "". An empty field represents undefined. 336 // values can be "female" or "male" or "". An empty field represents undefined.
337 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 337 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
338 "X-Gender", "KADDRESSBOOK" ); 338 "X-Gender", "KADDRESSBOOK" );
339 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 339 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
340 "X-Children", "KADDRESSBOOK" ); 340 "X-Children", "KADDRESSBOOK" );
341 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 341 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
342 "X-FreeBusyUrl", "KADDRESSBOOK" ); 342 "X-FreeBusyUrl", "KADDRESSBOOK" );
343#endif 343#endif
344 initGUI(); 344 initGUI();
345 345
346 mIncSearchWidget->setFocus(); 346 mIncSearchWidget->setFocus();
347 347
348 348
349 connect( mViewManager, SIGNAL( selected( const QString& ) ), 349 connect( mViewManager, SIGNAL( selected( const QString& ) ),
350 SLOT( setContactSelected( const QString& ) ) ); 350 SLOT( setContactSelected( const QString& ) ) );
351 connect( mViewManager, SIGNAL( executed( const QString& ) ), 351 connect( mViewManager, SIGNAL( executed( const QString& ) ),
352 SLOT( executeContact( const QString& ) ) ); 352 SLOT( executeContact( const QString& ) ) );
353 353
354 connect( mViewManager, SIGNAL( deleteRequest( ) ), 354 connect( mViewManager, SIGNAL( deleteRequest( ) ),
355 SLOT( deleteContacts( ) ) ); 355 SLOT( deleteContacts( ) ) );
356 connect( mViewManager, SIGNAL( modified() ), 356 connect( mViewManager, SIGNAL( modified() ),
357 SLOT( setModified() ) ); 357 SLOT( setModified() ) );
358 358
359 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 359 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
360 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 360 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
361 361
362 connect( mXXPortManager, SIGNAL( modified() ), 362 connect( mXXPortManager, SIGNAL( modified() ),
363 SLOT( setModified() ) ); 363 SLOT( setModified() ) );
364 364
365 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 365 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
366 SLOT( incrementalSearchJump( const QString& ) ) ); 366 SLOT( incrementalSearchJump( const QString& ) ) );
367 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 367 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
368 mJumpButtonBar, SLOT( recreateButtons() ) ); 368 mJumpButtonBar, SLOT( recreateButtons() ) );
369 369
370 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 370 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
371 SLOT( sendMail( const QString& ) ) ); 371 SLOT( sendMail( const QString& ) ) );
372 372
373 373
374 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 374 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
375 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&))); 375 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&)));
376 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 376 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
377 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 377 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
378 connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync())); 378 connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync()));
379 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); 379 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog()));
380 380
381 381
382#ifndef KAB_EMBEDDED 382#ifndef KAB_EMBEDDED
383 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 383 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
384 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 384 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
385 385
386 connect( mDetails, SIGNAL( browse( const QString& ) ), 386 connect( mDetails, SIGNAL( browse( const QString& ) ),
387 SLOT( browse( const QString& ) ) ); 387 SLOT( browse( const QString& ) ) );
388 388
389 389
390 mAddressBookService = new KAddressBookService( this ); 390 mAddressBookService = new KAddressBookService( this );
391 391
392#endif //KAB_EMBEDDED 392#endif //KAB_EMBEDDED
393 393
394 mMessageTimer = new QTimer( this ); 394 mMessageTimer = new QTimer( this );
395 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 395 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
396 mEditorDialog = 0; 396 mEditorDialog = 0;
397 createAddresseeEditorDialog( this ); 397 createAddresseeEditorDialog( this );
398 setModified( false ); 398 setModified( false );
399 mBRdisabled = false; 399 mBRdisabled = false;
400#ifndef DESKTOP_VERSION 400#ifndef DESKTOP_VERSION
401 infrared = 0; 401 infrared = 0;
402#endif 402#endif
403 //toggleBeamReceive( ); 403 //toggleBeamReceive( );
404 mMainWindow->toolBar()->show(); 404 mMainWindow->toolBar()->show();
405 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 405 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
406 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 406 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
407} 407}
408 408
409void KABCore::updateToolBar() 409void KABCore::updateToolBar()
410{ 410{
411 static int iii = 0; 411 static int iii = 0;
412 ++iii; 412 ++iii;
413 mMainWindow->toolBar()->repaintMe(); 413 mMainWindow->toolBar()->repaintMe();
414 if ( iii < 4 ) 414 if ( iii < 4 )
415 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); 415 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar()));
416} 416}
417KABCore::~KABCore() 417KABCore::~KABCore()
418{ 418{
419 // save(); 419 // save();
420 //saveSettings(); 420 //saveSettings();
421 //KABPrefs::instance()->writeConfig(); 421 //KABPrefs::instance()->writeConfig();
422 delete AddresseeConfig::instance(); 422 delete AddresseeConfig::instance();
423 mAddressBook = 0; 423 mAddressBook = 0;
424 KABC::StdAddressBook::close(); 424 KABC::StdAddressBook::close();
425 425
426 delete syncManager; 426 delete syncManager;
427#ifndef DESKTOP_VERSION 427#ifndef DESKTOP_VERSION
428 if ( infrared ) 428 if ( infrared )
429 delete infrared; 429 delete infrared;
430#endif 430#endif
431} 431}
432void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 432void KABCore::receive( const QCString& cmsg, const QByteArray& data )
433{ 433{
434 //qDebug("KA: QCOP message received: %s ", cmsg.data() ); 434 //qDebug("KA: QCOP message received: %s ", cmsg.data() );
435 if ( cmsg == "setDocument(QString)" ) { 435 if ( cmsg == "setDocument(QString)" ) {
436 QDataStream stream( data, IO_ReadOnly ); 436 QDataStream stream( data, IO_ReadOnly );
437 QString fileName; 437 QString fileName;
438 stream >> fileName; 438 stream >> fileName;
439 recieve( fileName ); 439 recieve( fileName );
440 return; 440 return;
441 } 441 }
442} 442}
443void KABCore::toggleBeamReceive( ) 443void KABCore::toggleBeamReceive( )
444{ 444{
445 if ( mBRdisabled ) 445 if ( mBRdisabled )
446 return; 446 return;
447#ifndef DESKTOP_VERSION 447#ifndef DESKTOP_VERSION
448 if ( infrared ) { 448 if ( infrared ) {
449 qDebug("KA: AB disable BeamReceive "); 449 qDebug("KA: AB disable BeamReceive ");
450 delete infrared; 450 delete infrared;
451 infrared = 0; 451 infrared = 0;
452 mActionBR->setChecked(false); 452 mActionBR->setChecked(false);
453 return; 453 return;
454 } 454 }
455 qDebug("KA: AB enable BeamReceive "); 455 qDebug("KA: AB enable BeamReceive ");
456 mActionBR->setChecked(true); 456 mActionBR->setChecked(true);
457 457
458 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 458 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
459 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 459 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
460#endif 460#endif
461} 461}
462 462
463 463
464void KABCore::disableBR(bool b) 464void KABCore::disableBR(bool b)
465{ 465{
466#ifndef DESKTOP_VERSION 466#ifndef DESKTOP_VERSION
467 if ( b ) { 467 if ( b ) {
468 if ( infrared ) { 468 if ( infrared ) {
469 toggleBeamReceive( ); 469 toggleBeamReceive( );
470 } 470 }
471 mBRdisabled = true; 471 mBRdisabled = true;
472 } else { 472 } else {
473 if ( mBRdisabled ) { 473 if ( mBRdisabled ) {
474 mBRdisabled = false; 474 mBRdisabled = false;
475 //toggleBeamReceive( ); 475 //toggleBeamReceive( );
476 } 476 }
477 } 477 }
478#endif 478#endif
479 479
480} 480}
481void KABCore::recieve( QString fn ) 481void KABCore::recieve( QString fn )
482{ 482{
483 //qDebug("KABCore::recieve "); 483 //qDebug("KABCore::recieve ");
484 int count = mAddressBook->importFromFile( fn, true ); 484 int count = mAddressBook->importFromFile( fn, true );
485 if ( count ) 485 if ( count )
486 setModified( true ); 486 setModified( true );
487 mViewManager->refreshView(); 487 mViewManager->refreshView();
488 message(i18n("%1 contact(s) received!").arg( count )); 488 message(i18n("%1 contact(s) received!").arg( count ));
489 topLevelWidget()->showMaximized(); 489 topLevelWidget()->showMaximized();
490 topLevelWidget()->raise(); 490 topLevelWidget()->raise();
491} 491}
492void KABCore::restoreSettings() 492void KABCore::restoreSettings()
493{ 493{
494 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 494 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
495 495
496 bool state; 496 bool state;
497 497
498 if (mMultipleViewsAtOnce) 498 if (mMultipleViewsAtOnce)
499 state = KABPrefs::instance()->mDetailsPageVisible; 499 state = KABPrefs::instance()->mDetailsPageVisible;
500 else 500 else
501 state = false; 501 state = false;
502 502
503 mActionDetails->setChecked( state ); 503 mActionDetails->setChecked( state );
504 setDetailsVisible( state ); 504 setDetailsVisible( state );
505 505
506 state = KABPrefs::instance()->mJumpButtonBarVisible; 506 state = KABPrefs::instance()->mJumpButtonBarVisible;
507 507
508 mActionJumpBar->setChecked( state ); 508 mActionJumpBar->setChecked( state );
509 setJumpButtonBarVisible( state ); 509 setJumpButtonBarVisible( state );
510/*US 510/*US
511 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 511 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
512 if ( splitterSize.count() == 0 ) { 512 if ( splitterSize.count() == 0 ) {
513 splitterSize.append( width() / 2 ); 513 splitterSize.append( width() / 2 );
514 splitterSize.append( width() / 2 ); 514 splitterSize.append( width() / 2 );
515 } 515 }
516 mMiniSplitter->setSizes( splitterSize ); 516 mMiniSplitter->setSizes( splitterSize );
517 if ( mExtensionBarSplitter ) { 517 if ( mExtensionBarSplitter ) {
518 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 518 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
519 if ( splitterSize.count() == 0 ) { 519 if ( splitterSize.count() == 0 ) {
520 splitterSize.append( width() / 2 ); 520 splitterSize.append( width() / 2 );
521 splitterSize.append( width() / 2 ); 521 splitterSize.append( width() / 2 );
522 } 522 }
523 mExtensionBarSplitter->setSizes( splitterSize ); 523 mExtensionBarSplitter->setSizes( splitterSize );
524 524
525 } 525 }
526*/ 526*/
527 mViewManager->restoreSettings(); 527 mViewManager->restoreSettings();
528 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 528 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
529 mExtensionManager->restoreSettings(); 529 mExtensionManager->restoreSettings();
530#ifdef DESKTOP_VERSION 530#ifdef DESKTOP_VERSION
531 int wid = width(); 531 int wid = width();
532 if ( wid < 10 ) 532 if ( wid < 10 )
533 wid = 400; 533 wid = 400;
534#else 534#else
535 int wid = QApplication::desktop()->width(); 535 int wid = QApplication::desktop()->width();
536 if ( wid < 640 ) 536 if ( wid < 640 )
537 wid = QApplication::desktop()->height(); 537 wid = QApplication::desktop()->height();
538#endif 538#endif
539 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 539 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
540 if ( true /*splitterSize.count() == 0*/ ) { 540 if ( true /*splitterSize.count() == 0*/ ) {
541 splitterSize.append( wid / 2 ); 541 splitterSize.append( wid / 2 );
542 splitterSize.append( wid / 2 ); 542 splitterSize.append( wid / 2 );
543 } 543 }
544 mMiniSplitter->setSizes( splitterSize ); 544 mMiniSplitter->setSizes( splitterSize );
545 if ( mExtensionBarSplitter ) { 545 if ( mExtensionBarSplitter ) {
546 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 546 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
547 if ( true /*splitterSize.count() == 0*/ ) { 547 if ( true /*splitterSize.count() == 0*/ ) {
548 splitterSize.append( wid / 2 ); 548 splitterSize.append( wid / 2 );
549 splitterSize.append( wid / 2 ); 549 splitterSize.append( wid / 2 );
550 } 550 }
551 mExtensionBarSplitter->setSizes( splitterSize ); 551 mExtensionBarSplitter->setSizes( splitterSize );
552 552
553 } 553 }
554#ifdef DESKTOP_VERSION 554#ifdef DESKTOP_VERSION
555 KConfig *config = KABPrefs::instance()->getConfig(); 555 KConfig *config = KABPrefs::instance()->getConfig();
556 config->setGroup("WidgetLayout"); 556 config->setGroup("WidgetLayout");
557 QStringList list; 557 QStringList list;
558 list = config->readListEntry("MainLayout"); 558 list = config->readListEntry("MainLayout");
559 int x,y,w,h; 559 int x,y,w,h;
560 if ( ! list.isEmpty() ) { 560 if ( ! list.isEmpty() ) {
561 x = list[0].toInt(); 561 x = list[0].toInt();
562 y = list[1].toInt(); 562 y = list[1].toInt();
563 w = list[2].toInt(); 563 w = list[2].toInt();
564 h = list[3].toInt(); 564 h = list[3].toInt();
565 KApplication::testCoords( &x,&y,&w,&h ); 565 KApplication::testCoords( &x,&y,&w,&h );
566 topLevelWidget()->setGeometry(x,y,w,h); 566 topLevelWidget()->setGeometry(x,y,w,h);
567 567
568 } else { 568 } else {
569 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 569 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
570 } 570 }
571#endif 571#endif
572} 572}
573 573
574void KABCore::saveSettings() 574void KABCore::saveSettings()
575{ 575{
576 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 576 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
577 if ( mExtensionBarSplitter ) 577 if ( mExtensionBarSplitter )
578 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 578 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
579 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 579 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
580 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 580 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
581#ifndef KAB_EMBEDDED 581#ifndef KAB_EMBEDDED
582 582
583 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 583 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
584 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 584 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
585#endif //KAB_EMBEDDED 585#endif //KAB_EMBEDDED
586 mExtensionManager->saveSettings(); 586 mExtensionManager->saveSettings();
587 mViewManager->saveSettings(); 587 mViewManager->saveSettings();
588 588
589 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 589 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
590 590
591 KABPrefs::instance()->writeConfig(); 591 KABPrefs::instance()->writeConfig();
592 qDebug("KA: KABCore::saveSettings() "); 592 qDebug("KA: KABCore::saveSettings() ");
593} 593}
594 594
595KABC::AddressBook *KABCore::addressBook() const 595KABC::AddressBook *KABCore::addressBook() const
596{ 596{
597 return mAddressBook; 597 return mAddressBook;
598} 598}
599 599
600KConfig *KABCore::config() 600KConfig *KABCore::config()
601{ 601{
602#ifndef KAB_EMBEDDED 602#ifndef KAB_EMBEDDED
603 return KABPrefs::instance()->config(); 603 return KABPrefs::instance()->config();
604#else //KAB_EMBEDDED 604#else //KAB_EMBEDDED
605 return KABPrefs::instance()->getConfig(); 605 return KABPrefs::instance()->getConfig();
606#endif //KAB_EMBEDDED 606#endif //KAB_EMBEDDED
607} 607}
608 608
609KActionCollection *KABCore::actionCollection() const 609KActionCollection *KABCore::actionCollection() const
610{ 610{
611 return mGUIClient->actionCollection(); 611 return mGUIClient->actionCollection();
612} 612}
613 613
614KABC::Field *KABCore::currentSearchField() const 614KABC::Field *KABCore::currentSearchField() const
615{ 615{
616 if (mIncSearchWidget) 616 if (mIncSearchWidget)
617 return mIncSearchWidget->currentField(); 617 return mIncSearchWidget->currentField();
618 else 618 else
619 return 0; 619 return 0;
620} 620}
621 621
622QStringList KABCore::selectedUIDs() const 622QStringList KABCore::selectedUIDs() const
623{ 623{
624 return mViewManager->selectedUids(); 624 return mViewManager->selectedUids();
625} 625}
626 626
627KABC::Resource *KABCore::requestResource( QWidget *parent ) 627KABC::Resource *KABCore::requestResource( QWidget *parent )
628{ 628{
629 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 629 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
630 630
631 QPtrList<KRES::Resource> kresResources; 631 QPtrList<KRES::Resource> kresResources;
632 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 632 QPtrListIterator<KABC::Resource> resIt( kabcResources );
633 KABC::Resource *resource; 633 KABC::Resource *resource;
634 while ( ( resource = resIt.current() ) != 0 ) { 634 while ( ( resource = resIt.current() ) != 0 ) {
635 ++resIt; 635 ++resIt;
636 if ( !resource->readOnly() ) { 636 if ( !resource->readOnly() ) {
637 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 637 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
638 if ( res ) 638 if ( res )
639 kresResources.append( res ); 639 kresResources.append( res );
640 } 640 }
641 } 641 }
642 642
643 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 643 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
644 return static_cast<KABC::Resource*>( res ); 644 return static_cast<KABC::Resource*>( res );
645} 645}
646 646
647#ifndef KAB_EMBEDDED 647#ifndef KAB_EMBEDDED
648KAboutData *KABCore::createAboutData() 648KAboutData *KABCore::createAboutData()
649#else //KAB_EMBEDDED 649#else //KAB_EMBEDDED
650void KABCore::createAboutData() 650void KABCore::createAboutData()
651#endif //KAB_EMBEDDED 651#endif //KAB_EMBEDDED
652{ 652{
653 653
654 654
655 QString version; 655 QString version;
656#include <../version> 656#include <../version>
657 QMessageBox::about( this, "About KAddressbook/Pi", 657 QMessageBox::about( this, "About KAddressbook/Pi",
658 "KAddressbook/Platform-independent\n" 658 "KAddressbook/Platform-independent\n"
659 "(KA/Pi) " +version + " - " + 659 "(KA/Pi) " +version + " - " +
660#ifdef DESKTOP_VERSION 660#ifdef DESKTOP_VERSION
661 "Desktop Edition\n" 661 "Desktop Edition\n"
662#else 662#else
663 "PDA-Edition\n" 663 "PDA-Edition\n"
664 "for: Zaurus 5500 / 7x0 / 8x0\n" 664 "for: Zaurus 5500 / 7x0 / 8x0\n"
665#endif 665#endif
666 666
667 "(c) 2004 Ulf Schenk\n" 667 "(c) 2004 Ulf Schenk\n"
668 "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n" 668 "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n"
669 "(c) 1997-2003, The KDE PIM Team\n" 669 "(c) 1997-2003, The KDE PIM Team\n"
670 "Tobias Koenig Maintainer\n" 670 "Tobias Koenig Maintainer\n"
671 "Don Sanders Original author\n" 671 "Don Sanders Original author\n"
672 "Cornelius Schumacher Co-maintainer\n" 672 "Cornelius Schumacher Co-maintainer\n"
673 "Mike Pilone GUI and framework redesign\n" 673 "Mike Pilone GUI and framework redesign\n"
674 "Greg Stern DCOP interface\n" 674 "Greg Stern DCOP interface\n"
675 "Mark Westcot Contact pinning\n" 675 "Mark Westcot Contact pinning\n"
676 "Michel Boyer de la Giroday LDAP Lookup\n" 676 "Michel Boyer de la Giroday LDAP Lookup\n"
677 "Steffen Hansen LDAP Lookup" 677 "Steffen Hansen LDAP Lookup"
678#ifdef _WIN32_ 678#ifdef _WIN32_
679 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 679 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
680#endif 680#endif
681 ); 681 );
682} 682}
683 683
684void KABCore::setContactSelected( const QString &uid ) 684void KABCore::setContactSelected( const QString &uid )
685{ 685{
686 KABC::Addressee addr = mAddressBook->findByUid( uid ); 686 KABC::Addressee addr = mAddressBook->findByUid( uid );
687 if ( !mDetails->isHidden() ) 687 if ( !mDetails->isHidden() )
688 mDetails->setAddressee( addr ); 688 mDetails->setAddressee( addr );
689 689
690 if ( !addr.isEmpty() ) { 690 if ( !addr.isEmpty() ) {
691 emit contactSelected( addr.formattedName() ); 691 emit contactSelected( addr.formattedName() );
692 KABC::Picture pic = addr.photo(); 692 KABC::Picture pic = addr.photo();
693 if ( pic.isIntern() ) { 693 if ( pic.isIntern() ) {
694//US emit contactSelected( pic.data() ); 694//US emit contactSelected( pic.data() );
695//US instead use: 695//US instead use:
696 QPixmap px; 696 QPixmap px;
697 if (pic.data().isNull() != true) 697 if (pic.data().isNull() != true)
698 { 698 {
699 px.convertFromImage(pic.data()); 699 px.convertFromImage(pic.data());
700 } 700 }
701 701
702 emit contactSelected( px ); 702 emit contactSelected( px );
703 } 703 }
704 } 704 }
705 705
706 706
707 mExtensionManager->setSelectionChanged(); 707 mExtensionManager->setSelectionChanged();
708 708
709 // update the actions 709 // update the actions
710 bool selected = !uid.isEmpty(); 710 bool selected = !uid.isEmpty();
711 711
712 if ( mReadWrite ) { 712 if ( mReadWrite ) {
713 mActionCut->setEnabled( selected ); 713 mActionCut->setEnabled( selected );
714 mActionPaste->setEnabled( selected ); 714 mActionPaste->setEnabled( selected );
715 } 715 }
716 716
717 mActionCopy->setEnabled( selected ); 717 mActionCopy->setEnabled( selected );
718 mActionDelete->setEnabled( selected ); 718 mActionDelete->setEnabled( selected );
719 mActionEditAddressee->setEnabled( selected ); 719 mActionEditAddressee->setEnabled( selected );
720 mActionMail->setEnabled( selected ); 720 mActionMail->setEnabled( selected );
721 mActionMailVCard->setEnabled( selected ); 721 mActionMailVCard->setEnabled( selected );
722 //if (mActionBeam) 722 //if (mActionBeam)
723 //mActionBeam->setEnabled( selected ); 723 //mActionBeam->setEnabled( selected );
724 mActionWhoAmI->setEnabled( selected ); 724 mActionWhoAmI->setEnabled( selected );
725} 725}
726 726
727void KABCore::sendMail() 727void KABCore::sendMail()
728{ 728{
729 sendMail( mViewManager->selectedEmails().join( ", " ) ); 729 sendMail( mViewManager->selectedEmails().join( ", " ) );
730} 730}
731 731
732void KABCore::sendMail( const QString& emaillist ) 732void KABCore::sendMail( const QString& emaillist )
733{ 733{
734 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 734 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
735 if (emaillist.contains(",") > 0) 735 if (emaillist.contains(",") > 0)
736 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 736 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
737 else 737 else
738 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 738 ExternalAppHandler::instance()->mailToOneContact( emaillist );
739} 739}
740 740
741 741
742 742
743void KABCore::mailVCard() 743void KABCore::mailVCard()
744{ 744{
745 QStringList uids = mViewManager->selectedUids(); 745 QStringList uids = mViewManager->selectedUids();
746 if ( !uids.isEmpty() ) 746 if ( !uids.isEmpty() )
747 mailVCard( uids ); 747 mailVCard( uids );
748} 748}
749 749
750void KABCore::mailVCard( const QStringList& uids ) 750void KABCore::mailVCard( const QStringList& uids )
751{ 751{
752 QStringList urls; 752 QStringList urls;
753 753
754// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 754// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
755 755
756 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 756 QString dirName = "/tmp/" + KApplication::randomString( 8 );
757 757
758 758
759 759
760 QDir().mkdir( dirName, true ); 760 QDir().mkdir( dirName, true );
761 761
762 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 762 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
763 KABC::Addressee a = mAddressBook->findByUid( *it ); 763 KABC::Addressee a = mAddressBook->findByUid( *it );
764 764
765 if ( a.isEmpty() ) 765 if ( a.isEmpty() )
766 continue; 766 continue;
767 767
768 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 768 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
769 769
770 QString fileName = dirName + "/" + name; 770 QString fileName = dirName + "/" + name;
771 771
772 QFile outFile(fileName); 772 QFile outFile(fileName);
773 773
774 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 774 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
775 KABC::VCardConverter converter; 775 KABC::VCardConverter converter;
776 QString vcard; 776 QString vcard;
777 777
778 converter.addresseeToVCard( a, vcard ); 778 converter.addresseeToVCard( a, vcard );
779 779
780 QTextStream t( &outFile ); // use a text stream 780 QTextStream t( &outFile ); // use a text stream
781 t.setEncoding( QTextStream::UnicodeUTF8 ); 781 t.setEncoding( QTextStream::UnicodeUTF8 );
782 t << vcard; 782 t << vcard;
783 783
784 outFile.close(); 784 outFile.close();
785 785
786 urls.append( fileName ); 786 urls.append( fileName );
787 } 787 }
788 } 788 }
789 789
790 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 790 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
791 791
792 792
793/*US 793/*US
794 kapp->invokeMailer( QString::null, QString::null, QString::null, 794 kapp->invokeMailer( QString::null, QString::null, QString::null,
795 QString::null, // subject 795 QString::null, // subject
796 QString::null, // body 796 QString::null, // body
797 QString::null, 797 QString::null,
798 urls ); // attachments 798 urls ); // attachments
799*/ 799*/
800 800
801} 801}
802 802
803/** 803/**
804 Beams the "WhoAmI contact. 804 Beams the "WhoAmI contact.
805*/ 805*/
806void KABCore::beamMySelf() 806void KABCore::beamMySelf()
807{ 807{
808 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 808 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
809 if (!a.isEmpty()) 809 if (!a.isEmpty())
810 { 810 {
811 QStringList uids; 811 QStringList uids;
812 uids << a.uid(); 812 uids << a.uid();
813 813
814 beamVCard(uids); 814 beamVCard(uids);
815 } else { 815 } else {
816 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 816 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
817 817
818 818
819 } 819 }
820} 820}
821void KABCore::updateMainWindow() 821void KABCore::updateMainWindow()
822{ 822{
823 mMainWindow->showMaximized(); 823 mMainWindow->showMaximized();
824 mMainWindow->update(); 824 mMainWindow->update();
825} 825}
826void KABCore::resizeEvent(QResizeEvent* e ) 826void KABCore::resizeEvent(QResizeEvent* e )
827{ 827{
828 if ( !mMiniSplitter ) 828 if ( !mMiniSplitter )
829 return; 829 return;
830 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); 830 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) ");
831 if ( e->oldSize().width() != e->size().width() )
831 if ( QApplication::desktop()->width() >= 480 ) { 832 if ( QApplication::desktop()->width() >= 480 ) {
832 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 833 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
833 if ( mMiniSplitter->orientation() == Qt::Vertical ) { 834 if ( mMiniSplitter->orientation() == Qt::Vertical ) {
834 mMiniSplitter->setOrientation( Qt::Horizontal); 835 mMiniSplitter->setOrientation( Qt::Horizontal);
835 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 836 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
836 } 837 }
837 if ( QApplication::desktop()->width() <= 640 ) { 838 if ( QApplication::desktop()->width() <= 640 ) {
838 mMainWindow->showMinimized(); 839 mMainWindow->showMinimized();
839 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 840 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
840 mViewManager->getFilterAction()->setComboWidth( 150 ); 841 mViewManager->getFilterAction()->setComboWidth( 150 );
841 if ( mIncSearchWidget ) 842 if ( mIncSearchWidget )
842 mIncSearchWidget->setSize(); 843 mIncSearchWidget->setSize();
843 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 844 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
844 } 845 }
845 846
846 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 847 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
847 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { 848 if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
848 mMiniSplitter->setOrientation( Qt::Vertical ); 849 mMiniSplitter->setOrientation( Qt::Vertical );
849 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 850 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
850 } 851 }
851 if ( QApplication::desktop()->width() <= 640 ) { 852 if ( QApplication::desktop()->width() <= 640 ) {
852 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 853 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
853 mMainWindow->showMinimized(); 854 mMainWindow->showMinimized();
854 if ( KABPrefs::instance()->mHideSearchOnSwitch ) { 855 if ( KABPrefs::instance()->mHideSearchOnSwitch ) {
855 if ( mIncSearchWidget ) { 856 if ( mIncSearchWidget ) {
856 mIncSearchWidget->setSize(); 857 mIncSearchWidget->setSize();
857 } 858 }
858 } else { 859 } else {
859 mViewManager->getFilterAction()->setComboWidth( 0 ); 860 mViewManager->getFilterAction()->setComboWidth( 0 );
860 } 861 }
861 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 862 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
862 } 863 }
863 } 864 }
864 } 865 }
865 QWidget::resizeEvent( e ); 866 QWidget::resizeEvent( e );
866 867
867} 868}
868void KABCore::export2phone() 869void KABCore::export2phone()
869{ 870{
870 871
871 QStringList uids; 872 QStringList uids;
872 XXPortSelectDialog dlg( this, false, this ); 873 XXPortSelectDialog dlg( this, false, this );
873 if ( dlg.exec() ) 874 if ( dlg.exec() )
874 uids = dlg.uids(); 875 uids = dlg.uids();
875 else 876 else
876 return; 877 return;
877 if ( uids.isEmpty() ) 878 if ( uids.isEmpty() )
878 return; 879 return;
879 // qDebug("count %d ", uids.count()); 880 // qDebug("count %d ", uids.count());
880 881
881 KAex2phonePrefs ex2phone; 882 KAex2phonePrefs ex2phone;
882 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 883 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
883 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 884 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
884 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 885 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
885 886
886 if ( !ex2phone.exec() ) { 887 if ( !ex2phone.exec() ) {
887 return; 888 return;
888 } 889 }
889 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 890 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
890 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 891 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
891 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 892 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
892 893
893 894
894 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 895 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
895 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 896 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
896 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 897 KPimGlobalPrefs::instance()->mEx2PhoneModel );
897 898
898 QString fileName = getPhoneFile(); 899 QString fileName = getPhoneFile();
899 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 900 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
900 return; 901 return;
901 902
902 message(i18n("Exporting to phone...")); 903 message(i18n("Exporting to phone..."));
903 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 904 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
904 905
905} 906}
906QString KABCore::getPhoneFile() 907QString KABCore::getPhoneFile()
907{ 908{
908#ifdef DESKTOP_VERSION 909#ifdef DESKTOP_VERSION
909 return locateLocal("tmp", "phonefile.vcf"); 910 return locateLocal("tmp", "phonefile.vcf");
910#else 911#else
911 return "/tmp/phonefile.vcf"; 912 return "/tmp/phonefile.vcf";
912#endif 913#endif
913 914
914} 915}
915void KABCore::writeToPhone( ) 916void KABCore::writeToPhone( )
916{ 917{
917 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 918 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
918 message(i18n("Export to phone finished!")); 919 message(i18n("Export to phone finished!"));
919 else 920 else
920 qDebug(i18n("KA: Error exporting to phone")); 921 qDebug(i18n("KA: Error exporting to phone"));
921} 922}
922void KABCore::beamVCard() 923void KABCore::beamVCard()
923{ 924{
924 QStringList uids; 925 QStringList uids;
925 XXPortSelectDialog dlg( this, false, this ); 926 XXPortSelectDialog dlg( this, false, this );
926 if ( dlg.exec() ) 927 if ( dlg.exec() )
927 uids = dlg.uids(); 928 uids = dlg.uids();
928 else 929 else
929 return; 930 return;
930 if ( uids.isEmpty() ) 931 if ( uids.isEmpty() )
931 return; 932 return;
932 beamVCard( uids ); 933 beamVCard( uids );
933} 934}
934 935
935 936
936void KABCore::beamVCard(const QStringList& uids) 937void KABCore::beamVCard(const QStringList& uids)
937{ 938{
938 939
939 // LR: we should use the /tmp dir on the Zaurus, 940 // LR: we should use the /tmp dir on the Zaurus,
940 // because: /tmp = RAM, (HOME)/kdepim = flash memory 941 // because: /tmp = RAM, (HOME)/kdepim = flash memory
941 942
942#ifdef DESKTOP_VERSION 943#ifdef DESKTOP_VERSION
943 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 944 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
944#else 945#else
945 QString fileName = "/tmp/kapibeamfile.vcf"; 946 QString fileName = "/tmp/kapibeamfile.vcf";
946#endif 947#endif
947 948
948 KABC::VCardConverter converter; 949 KABC::VCardConverter converter;
949 QString description; 950 QString description;
950 QString datastream; 951 QString datastream;
951 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 952 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
952 KABC::Addressee a = mAddressBook->findByUid( *it ); 953 KABC::Addressee a = mAddressBook->findByUid( *it );
953 954
954 if ( a.isEmpty() ) 955 if ( a.isEmpty() )
955 continue; 956 continue;
956 957
957 if (description.isEmpty()) 958 if (description.isEmpty())
958 description = a.formattedName(); 959 description = a.formattedName();
959 960
960 QString vcard; 961 QString vcard;
961 converter.addresseeToVCard( a, vcard ); 962 converter.addresseeToVCard( a, vcard );
962 int start = 0; 963 int start = 0;
963 int next; 964 int next;
964 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 965 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
965 int semi = vcard.find(";", next); 966 int semi = vcard.find(";", next);
966 int dopp = vcard.find(":", next); 967 int dopp = vcard.find(":", next);
967 int sep; 968 int sep;
968 if ( semi < dopp && semi >= 0 ) 969 if ( semi < dopp && semi >= 0 )
969 sep = semi ; 970 sep = semi ;
970 else 971 else
971 sep = dopp; 972 sep = dopp;
972 datastream +=vcard.mid( start, next - start); 973 datastream +=vcard.mid( start, next - start);
973 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 974 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
974 start = sep; 975 start = sep;
975 } 976 }
976 datastream += vcard.mid( start,vcard.length() ); 977 datastream += vcard.mid( start,vcard.length() );
977 } 978 }
978#ifndef DESKTOP_VERSION 979#ifndef DESKTOP_VERSION
979 QFile outFile(fileName); 980 QFile outFile(fileName);
980 if ( outFile.open(IO_WriteOnly) ) { 981 if ( outFile.open(IO_WriteOnly) ) {
981 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 982 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
982 QTextStream t( &outFile ); // use a text stream 983 QTextStream t( &outFile ); // use a text stream
983 //t.setEncoding( QTextStream::UnicodeUTF8 ); 984 //t.setEncoding( QTextStream::UnicodeUTF8 );
984 t.setEncoding( QTextStream::Latin1 ); 985 t.setEncoding( QTextStream::Latin1 );
985 t <<datastream.latin1(); 986 t <<datastream.latin1();
986 outFile.close(); 987 outFile.close();
987 Ir *ir = new Ir( this ); 988 Ir *ir = new Ir( this );
988 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 989 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
989 ir->send( fileName, description, "text/x-vCard" ); 990 ir->send( fileName, description, "text/x-vCard" );
990 } else { 991 } else {
991 qDebug("KA: Error open temp beam file "); 992 qDebug("KA: Error open temp beam file ");
992 return; 993 return;
993 } 994 }
994#endif 995#endif
995 996
996} 997}
997 998
998void KABCore::beamDone( Ir *ir ) 999void KABCore::beamDone( Ir *ir )
999{ 1000{
1000#ifndef DESKTOP_VERSION 1001#ifndef DESKTOP_VERSION
1001 delete ir; 1002 delete ir;
1002#endif 1003#endif
1003 topLevelWidget()->raise(); 1004 topLevelWidget()->raise();
1004 message( i18n("Beaming finished!") ); 1005 message( i18n("Beaming finished!") );
1005} 1006}
1006 1007
1007 1008
1008void KABCore::browse( const QString& url ) 1009void KABCore::browse( const QString& url )
1009{ 1010{
1010#ifndef KAB_EMBEDDED 1011#ifndef KAB_EMBEDDED
1011 kapp->invokeBrowser( url ); 1012 kapp->invokeBrowser( url );
1012#else //KAB_EMBEDDED 1013#else //KAB_EMBEDDED
1013 qDebug("KABCore::browse must be fixed"); 1014 qDebug("KABCore::browse must be fixed");
1014#endif //KAB_EMBEDDED 1015#endif //KAB_EMBEDDED
1015} 1016}
1016 1017
1017void KABCore::selectAllContacts() 1018void KABCore::selectAllContacts()
1018{ 1019{
1019 mViewManager->setSelected( QString::null, true ); 1020 mViewManager->setSelected( QString::null, true );
1020} 1021}
1021 1022
1022void KABCore::deleteContacts() 1023void KABCore::deleteContacts()
1023{ 1024{
1024 QStringList uidList = mViewManager->selectedUids(); 1025 QStringList uidList = mViewManager->selectedUids();
1025 deleteContacts( uidList ); 1026 deleteContacts( uidList );
1026} 1027}
1027 1028
1028void KABCore::deleteContacts( const QStringList &uids ) 1029void KABCore::deleteContacts( const QStringList &uids )
1029{ 1030{
1030 if ( uids.count() > 0 ) { 1031 if ( uids.count() > 0 ) {
1031 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 1032 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
1032 UndoStack::instance()->push( command ); 1033 UndoStack::instance()->push( command );
1033 RedoStack::instance()->clear(); 1034 RedoStack::instance()->clear();
1034 1035
1035 // now if we deleted anything, refresh 1036 // now if we deleted anything, refresh
1036 setContactSelected( QString::null ); 1037 setContactSelected( QString::null );
1037 setModified( true ); 1038 setModified( true );
1038 } 1039 }
1039} 1040}
1040 1041
1041void KABCore::copyContacts() 1042void KABCore::copyContacts()
1042{ 1043{
1043 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1044 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1044 1045
1045 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 1046 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
1046 1047
1047 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 1048 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
1048 1049
1049 QClipboard *cb = QApplication::clipboard(); 1050 QClipboard *cb = QApplication::clipboard();
1050 cb->setText( clipText ); 1051 cb->setText( clipText );
1051} 1052}
1052 1053
1053void KABCore::cutContacts() 1054void KABCore::cutContacts()
1054{ 1055{
1055 QStringList uidList = mViewManager->selectedUids(); 1056 QStringList uidList = mViewManager->selectedUids();
1056 1057
1057//US if ( uidList.size() > 0 ) { 1058//US if ( uidList.size() > 0 ) {
1058 if ( uidList.count() > 0 ) { 1059 if ( uidList.count() > 0 ) {
1059 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 1060 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
1060 UndoStack::instance()->push( command ); 1061 UndoStack::instance()->push( command );
1061 RedoStack::instance()->clear(); 1062 RedoStack::instance()->clear();
1062 1063
1063 setModified( true ); 1064 setModified( true );
1064 } 1065 }
1065} 1066}
1066 1067
1067void KABCore::pasteContacts() 1068void KABCore::pasteContacts()
1068{ 1069{
1069 QClipboard *cb = QApplication::clipboard(); 1070 QClipboard *cb = QApplication::clipboard();
1070 1071
1071 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 1072 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
1072 1073
1073 pasteContacts( list ); 1074 pasteContacts( list );
1074} 1075}
1075 1076
1076void KABCore::pasteContacts( KABC::Addressee::List &list ) 1077void KABCore::pasteContacts( KABC::Addressee::List &list )
1077{ 1078{
1078 KABC::Resource *resource = requestResource( this ); 1079 KABC::Resource *resource = requestResource( this );
1079 KABC::Addressee::List::Iterator it; 1080 KABC::Addressee::List::Iterator it;
1080 for ( it = list.begin(); it != list.end(); ++it ) 1081 for ( it = list.begin(); it != list.end(); ++it )
1081 (*it).setResource( resource ); 1082 (*it).setResource( resource );
1082 1083
1083 PwPasteCommand *command = new PwPasteCommand( this, list ); 1084 PwPasteCommand *command = new PwPasteCommand( this, list );
1084 UndoStack::instance()->push( command ); 1085 UndoStack::instance()->push( command );
1085 RedoStack::instance()->clear(); 1086 RedoStack::instance()->clear();
1086 1087
1087 setModified( true ); 1088 setModified( true );
1088} 1089}
1089 1090
1090void KABCore::setWhoAmI() 1091void KABCore::setWhoAmI()
1091{ 1092{
1092 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1093 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1093 1094
1094 if ( addrList.count() > 1 ) { 1095 if ( addrList.count() > 1 ) {
1095 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 1096 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
1096 return; 1097 return;
1097 } 1098 }
1098 1099
1099 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 1100 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
1100 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 1101 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
1101 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 1102 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
1102} 1103}
1103void KABCore::editCategories() 1104void KABCore::editCategories()
1104{ 1105{
1105 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); 1106 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1106 dlg.exec(); 1107 dlg.exec();
1107} 1108}
1108void KABCore::setCategories() 1109void KABCore::setCategories()
1109{ 1110{
1110 1111
1111 QStringList uids; 1112 QStringList uids;
1112 XXPortSelectDialog dlgx( this, false, this ); 1113 XXPortSelectDialog dlgx( this, false, this );
1113 if ( dlgx.exec() ) 1114 if ( dlgx.exec() )
1114 uids = dlgx.uids(); 1115 uids = dlgx.uids();
1115 else 1116 else
1116 return; 1117 return;
1117 if ( uids.isEmpty() ) 1118 if ( uids.isEmpty() )
1118 return; 1119 return;
1119 // qDebug("count %d ", uids.count()); 1120 // qDebug("count %d ", uids.count());
1120 1121
1121 1122
1122 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1123 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
1123 if ( !dlg.exec() ) { 1124 if ( !dlg.exec() ) {
1124 message( i18n("Setting categories cancelled") ); 1125 message( i18n("Setting categories cancelled") );
1125 return; 1126 return;
1126 } 1127 }
1127 bool merge = false; 1128 bool merge = false;
1128 QString msg = i18n( "Merge with existing categories?" ); 1129 QString msg = i18n( "Merge with existing categories?" );
1129 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 1130 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
1130 merge = true; 1131 merge = true;
1131 1132
1132 message( i18n("Setting categories ... please wait!") ); 1133 message( i18n("Setting categories ... please wait!") );
1133 QStringList categories = dlg.selectedCategories(); 1134 QStringList categories = dlg.selectedCategories();
1134 1135
1135 //QStringList uids = mViewManager->selectedUids(); 1136 //QStringList uids = mViewManager->selectedUids();
1136 QStringList::Iterator it; 1137 QStringList::Iterator it;
1137 for ( it = uids.begin(); it != uids.end(); ++it ) { 1138 for ( it = uids.begin(); it != uids.end(); ++it ) {
1138 KABC::Addressee addr = mAddressBook->findByUid( *it ); 1139 KABC::Addressee addr = mAddressBook->findByUid( *it );
1139 if ( !addr.isEmpty() ) { 1140 if ( !addr.isEmpty() ) {
1140 if ( !merge ) 1141 if ( !merge )
1141 addr.setCategories( categories ); 1142 addr.setCategories( categories );
1142 else { 1143 else {
1143 QStringList addrCategories = addr.categories(); 1144 QStringList addrCategories = addr.categories();
1144 QStringList::Iterator catIt; 1145 QStringList::Iterator catIt;
1145 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 1146 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
1146 if ( !addrCategories.contains( *catIt ) ) 1147 if ( !addrCategories.contains( *catIt ) )
1147 addrCategories.append( *catIt ); 1148 addrCategories.append( *catIt );
1148 } 1149 }
1149 addr.setCategories( addrCategories ); 1150 addr.setCategories( addrCategories );
1150 } 1151 }
1151 mAddressBook->insertAddressee( addr ); 1152 mAddressBook->insertAddressee( addr );
1152 } 1153 }
1153 } 1154 }
1154 1155
1155 if ( uids.count() > 0 ) 1156 if ( uids.count() > 0 )
1156 setModified( true ); 1157 setModified( true );
1157 message( i18n("Setting categories completed!") ); 1158 message( i18n("Setting categories completed!") );
1158} 1159}
1159 1160
1160void KABCore::setSearchFields( const KABC::Field::List &fields ) 1161void KABCore::setSearchFields( const KABC::Field::List &fields )
1161{ 1162{
1162 mIncSearchWidget->setFields( fields ); 1163 mIncSearchWidget->setFields( fields );
1163} 1164}
1164 1165
1165void KABCore::incrementalSearch( const QString& text ) 1166void KABCore::incrementalSearch( const QString& text )
1166{ 1167{
1167 QString stext; 1168 QString stext;
1168 if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { 1169 if ( KABPrefs::instance()->mAutoSearchWithWildcard ) {
1169 stext = "*" + text; 1170 stext = "*" + text;
1170 } else { 1171 } else {
1171 stext = text; 1172 stext = text;
1172 } 1173 }
1173 mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); 1174 mViewManager->doSearch( stext, mIncSearchWidget->currentField() );
1174} 1175}
1175void KABCore::incrementalSearchJump( const QString& text ) 1176void KABCore::incrementalSearchJump( const QString& text )
1176{ 1177{
1177 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1178 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1178} 1179}
1179 1180
1180void KABCore::setModified() 1181void KABCore::setModified()
1181{ 1182{
1182 setModified( true ); 1183 setModified( true );
1183} 1184}
1184 1185
1185void KABCore::setModifiedWOrefresh() 1186void KABCore::setModifiedWOrefresh()
1186{ 1187{
1187 // qDebug("KABCore::setModifiedWOrefresh() "); 1188 // qDebug("KABCore::setModifiedWOrefresh() ");
1188 mModified = true; 1189 mModified = true;
1189 mActionSave->setEnabled( mModified ); 1190 mActionSave->setEnabled( mModified );
1190 1191
1191 1192
1192} 1193}
1193void KABCore::setModified( bool modified ) 1194void KABCore::setModified( bool modified )
1194{ 1195{
1195 mModified = modified; 1196 mModified = modified;
1196 mActionSave->setEnabled( mModified ); 1197 mActionSave->setEnabled( mModified );
1197 1198
1198 if ( modified ) 1199 if ( modified )
1199 mJumpButtonBar->recreateButtons(); 1200 mJumpButtonBar->recreateButtons();
1200 1201
1201 mViewManager->refreshView(); 1202 mViewManager->refreshView();
1202 1203
1203} 1204}
1204 1205
1205bool KABCore::modified() const 1206bool KABCore::modified() const
1206{ 1207{
1207 return mModified; 1208 return mModified;
1208} 1209}
1209 1210
1210void KABCore::contactModified( const KABC::Addressee &addr ) 1211void KABCore::contactModified( const KABC::Addressee &addr )
1211{ 1212{
1212 addrModified( addr ); 1213 addrModified( addr );
1213#if 0 // debug only 1214#if 0 // debug only
1214 KABC::Addressee ad = addr; 1215 KABC::Addressee ad = addr;
1215 ad.computeCsum( "123"); 1216 ad.computeCsum( "123");
1216#endif 1217#endif
1217} 1218}
1218 1219
1219void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) 1220void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails )
1220{ 1221{
1221 1222
1222 Command *command = 0; 1223 Command *command = 0;
1223 QString uid; 1224 QString uid;
1224 1225
1225 // check if it exists already 1226 // check if it exists already
1226 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1227 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1227 if ( origAddr.isEmpty() ) 1228 if ( origAddr.isEmpty() )
1228 command = new PwNewCommand( mAddressBook, addr ); 1229 command = new PwNewCommand( mAddressBook, addr );
1229 else { 1230 else {
1230 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1231 command = new PwEditCommand( mAddressBook, origAddr, addr );
1231 uid = addr.uid(); 1232 uid = addr.uid();
1232 } 1233 }
1233 1234
1234 UndoStack::instance()->push( command ); 1235 UndoStack::instance()->push( command );
1235 RedoStack::instance()->clear(); 1236 RedoStack::instance()->clear();
1236 if ( updateDetails ) 1237 if ( updateDetails )
1237 mDetails->setAddressee( addr ); 1238 mDetails->setAddressee( addr );
1238 setModified( true ); 1239 setModified( true );
1239} 1240}
1240 1241
1241void KABCore::newContact() 1242void KABCore::newContact()
1242{ 1243{
1243 1244
1244 1245
1245 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1246 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1246 1247
1247 QPtrList<KRES::Resource> kresResources; 1248 QPtrList<KRES::Resource> kresResources;
1248 QPtrListIterator<KABC::Resource> it( kabcResources ); 1249 QPtrListIterator<KABC::Resource> it( kabcResources );
1249 KABC::Resource *resource; 1250 KABC::Resource *resource;
1250 while ( ( resource = it.current() ) != 0 ) { 1251 while ( ( resource = it.current() ) != 0 ) {
1251 ++it; 1252 ++it;
1252 if ( !resource->readOnly() ) { 1253 if ( !resource->readOnly() ) {
1253 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1254 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1254 if ( res ) 1255 if ( res )
1255 kresResources.append( res ); 1256 kresResources.append( res );
1256 } 1257 }
1257 } 1258 }
1258 1259
1259 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1260 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1260 resource = static_cast<KABC::Resource*>( res ); 1261 resource = static_cast<KABC::Resource*>( res );
1261 1262
1262 if ( resource ) { 1263 if ( resource ) {
1263 KABC::Addressee addr; 1264 KABC::Addressee addr;
1264 addr.setResource( resource ); 1265 addr.setResource( resource );
1265 mEditorDialog->setAddressee( addr ); 1266 mEditorDialog->setAddressee( addr );
1266 mEditorDialog->setCaption( i18n("Edit new contact")); 1267 mEditorDialog->setCaption( i18n("Edit new contact"));
1267 KApplication::execDialog ( mEditorDialog ); 1268 KApplication::execDialog ( mEditorDialog );
1268 1269
1269 } else 1270 } else
1270 return; 1271 return;
1271 1272
1272 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1273 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1273 1274
1274 1275
1275} 1276}
1276 1277
1277void KABCore::addEmail( QString aStr ) 1278void KABCore::addEmail( QString aStr )
1278{ 1279{
1279#ifndef KAB_EMBEDDED 1280#ifndef KAB_EMBEDDED
1280 QString fullName, email; 1281 QString fullName, email;
1281 1282
1282 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1283 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1283 1284
1284 // Try to lookup the addressee matching the email address 1285 // Try to lookup the addressee matching the email address
1285 bool found = false; 1286 bool found = false;
1286 QStringList emailList; 1287 QStringList emailList;
1287 KABC::AddressBook::Iterator it; 1288 KABC::AddressBook::Iterator it;
1288 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1289 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1289 emailList = (*it).emails(); 1290 emailList = (*it).emails();
1290 if ( emailList.contains( email ) > 0 ) { 1291 if ( emailList.contains( email ) > 0 ) {
1291 found = true; 1292 found = true;
1292 (*it).setNameFromString( fullName ); 1293 (*it).setNameFromString( fullName );
1293 editContact( (*it).uid() ); 1294 editContact( (*it).uid() );
1294 } 1295 }
1295 } 1296 }
1296 1297
1297 if ( !found ) { 1298 if ( !found ) {
1298 KABC::Addressee addr; 1299 KABC::Addressee addr;
1299 addr.setNameFromString( fullName ); 1300 addr.setNameFromString( fullName );
1300 addr.insertEmail( email, true ); 1301 addr.insertEmail( email, true );
1301 1302
1302 mAddressBook->insertAddressee( addr ); 1303 mAddressBook->insertAddressee( addr );
1303 mViewManager->refreshView( addr.uid() ); 1304 mViewManager->refreshView( addr.uid() );
1304 editContact( addr.uid() ); 1305 editContact( addr.uid() );
1305 } 1306 }
1306#else //KAB_EMBEDDED 1307#else //KAB_EMBEDDED
1307 qDebug("KABCore::addEmail finsih method"); 1308 qDebug("KABCore::addEmail finsih method");
1308#endif //KAB_EMBEDDED 1309#endif //KAB_EMBEDDED
1309} 1310}
1310 1311
1311void KABCore::importVCard( const KURL &url, bool showPreview ) 1312void KABCore::importVCard( const KURL &url, bool showPreview )
1312{ 1313{
1313 mXXPortManager->importVCard( url, showPreview ); 1314 mXXPortManager->importVCard( url, showPreview );
1314} 1315}
1315void KABCore::importFromOL() 1316void KABCore::importFromOL()
1316{ 1317{
1317#ifdef _OL_IMPORT_ 1318#ifdef _OL_IMPORT_
1318 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1319 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1319 idgl->exec(); 1320 idgl->exec();
1320 KABC::Addressee::List list = idgl->getAddressList(); 1321 KABC::Addressee::List list = idgl->getAddressList();
1321 if ( list.count() > 0 ) { 1322 if ( list.count() > 0 ) {
1322 KABC::Addressee::List listNew; 1323 KABC::Addressee::List listNew;
1323 KABC::Addressee::List listExisting; 1324 KABC::Addressee::List listExisting;
1324 KABC::Addressee::List::Iterator it; 1325 KABC::Addressee::List::Iterator it;
1325 KABC::AddressBook::Iterator iter; 1326 KABC::AddressBook::Iterator iter;
1326 for ( it = list.begin(); it != list.end(); ++it ) { 1327 for ( it = list.begin(); it != list.end(); ++it ) {
1327 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1328 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1328 listNew.append( (*it) ); 1329 listNew.append( (*it) );
1329 else 1330 else
1330 listExisting.append( (*it) ); 1331 listExisting.append( (*it) );
1331 } 1332 }
1332 if ( listExisting.count() > 0 ) 1333 if ( listExisting.count() > 0 )
1333 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1334 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1334 if ( listNew.count() > 0 ) { 1335 if ( listNew.count() > 0 ) {
1335 pasteWithNewUid = false; 1336 pasteWithNewUid = false;
1336 pasteContacts( listNew ); 1337 pasteContacts( listNew );
1337 pasteWithNewUid = true; 1338 pasteWithNewUid = true;
1338 } 1339 }
1339 } 1340 }
1340 delete idgl; 1341 delete idgl;
1341#endif 1342#endif
1342} 1343}
1343 1344
1344void KABCore::importVCard( const QString &vCard, bool showPreview ) 1345void KABCore::importVCard( const QString &vCard, bool showPreview )
1345{ 1346{
1346 mXXPortManager->importVCard( vCard, showPreview ); 1347 mXXPortManager->importVCard( vCard, showPreview );
1347} 1348}
1348 1349
1349//US added a second method without defaultparameter 1350//US added a second method without defaultparameter
1350void KABCore::editContact2() { 1351void KABCore::editContact2() {
1351 editContact( QString::null ); 1352 editContact( QString::null );
1352} 1353}
1353 1354
1354void KABCore::editContact( const QString &uid ) 1355void KABCore::editContact( const QString &uid )
1355{ 1356{
1356 1357
1357 if ( mExtensionManager->isQuickEditVisible() ) 1358 if ( mExtensionManager->isQuickEditVisible() )
1358 return; 1359 return;
1359 1360
1360 // First, locate the contact entry 1361 // First, locate the contact entry
1361 QString localUID = uid; 1362 QString localUID = uid;
1362 if ( localUID.isNull() ) { 1363 if ( localUID.isNull() ) {
1363 QStringList uidList = mViewManager->selectedUids(); 1364 QStringList uidList = mViewManager->selectedUids();
1364 if ( uidList.count() > 0 ) 1365 if ( uidList.count() > 0 )
1365 localUID = *( uidList.at( 0 ) ); 1366 localUID = *( uidList.at( 0 ) );
1366 } 1367 }
1367 1368
1368 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1369 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1369 if ( !addr.isEmpty() ) { 1370 if ( !addr.isEmpty() ) {
1370 mEditorDialog->setAddressee( addr ); 1371 mEditorDialog->setAddressee( addr );
1371 KApplication::execDialog ( mEditorDialog ); 1372 KApplication::execDialog ( mEditorDialog );
1372 } 1373 }
1373} 1374}
1374 1375
1375/** 1376/**
1376 Shows or edits the detail view for the given uid. If the uid is QString::null, 1377 Shows or edits the detail view for the given uid. If the uid is QString::null,
1377 the method will try to find a selected addressee in the view. 1378 the method will try to find a selected addressee in the view.
1378 */ 1379 */
1379void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1380void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1380{ 1381{
1381 if ( mMultipleViewsAtOnce ) 1382 if ( mMultipleViewsAtOnce )
1382 { 1383 {
1383 editContact( uid ); 1384 editContact( uid );
1384 } 1385 }
1385 else 1386 else
1386 { 1387 {
1387 setDetailsVisible( true ); 1388 setDetailsVisible( true );
1388 mActionDetails->setChecked(true); 1389 mActionDetails->setChecked(true);
1389 } 1390 }
1390 1391
1391} 1392}
1392 1393
1393void KABCore::save() 1394void KABCore::save()
1394{ 1395{
1395 if (syncManager->blockSave()) 1396 if (syncManager->blockSave())
1396 return; 1397 return;
1397 if ( !mModified ) 1398 if ( !mModified )
1398 return; 1399 return;
1399 1400
1400 syncManager->setBlockSave(true); 1401 syncManager->setBlockSave(true);
1401 QString text = i18n( "There was an error while attempting to save\n the " 1402 QString text = i18n( "There was an error while attempting to save\n the "
1402 "address book. Please check that some \nother application is " 1403 "address book. Please check that some \nother application is "
1403 "not using it. " ); 1404 "not using it. " );
1404 message(i18n("Saving ... please wait! "), false); 1405 message(i18n("Saving ... please wait! "), false);
1405 //qApp->processEvents(); 1406 //qApp->processEvents();
1406#ifndef KAB_EMBEDDED 1407#ifndef KAB_EMBEDDED
1407 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1408 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1408 if ( !b || !b->save() ) { 1409 if ( !b || !b->save() ) {
1409 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1410 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1410 } 1411 }
1411#else //KAB_EMBEDDED 1412#else //KAB_EMBEDDED
1412 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1413 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1413 if ( !b || !b->save() ) { 1414 if ( !b || !b->save() ) {
1414 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1415 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1415 } 1416 }
1416#endif //KAB_EMBEDDED 1417#endif //KAB_EMBEDDED
1417 1418
1418 message(i18n("Addressbook saved!")); 1419 message(i18n("Addressbook saved!"));
1419 setModified( false ); 1420 setModified( false );
1420 syncManager->setBlockSave(false); 1421 syncManager->setBlockSave(false);
1421} 1422}
1422 1423
1423 1424
1424void KABCore::undo() 1425void KABCore::undo()
1425{ 1426{
1426 UndoStack::instance()->undo(); 1427 UndoStack::instance()->undo();
1427 1428
1428 // Refresh the view 1429 // Refresh the view
1429 mViewManager->refreshView(); 1430 mViewManager->refreshView();
1430} 1431}
1431 1432
1432void KABCore::redo() 1433void KABCore::redo()
1433{ 1434{
1434 RedoStack::instance()->redo(); 1435 RedoStack::instance()->redo();
1435 1436
1436 // Refresh the view 1437 // Refresh the view
1437 mViewManager->refreshView(); 1438 mViewManager->refreshView();
1438} 1439}
1439void KABCore::setJumpButtonBar( bool visible ) 1440void KABCore::setJumpButtonBar( bool visible )
1440{ 1441{
1441 setJumpButtonBarVisible(visible ); 1442 setJumpButtonBarVisible(visible );
1442 saveSettings(); 1443 saveSettings();
1443} 1444}
1444void KABCore::setJumpButtonBarVisible( bool visible ) 1445void KABCore::setJumpButtonBarVisible( bool visible )
1445{ 1446{
1446 if (mMultipleViewsAtOnce) 1447 if (mMultipleViewsAtOnce)
1447 { 1448 {
1448 if ( visible ) 1449 if ( visible )
1449 mJumpButtonBar->show(); 1450 mJumpButtonBar->show();
1450 else 1451 else
1451 mJumpButtonBar->hide(); 1452 mJumpButtonBar->hide();
1452 } 1453 }
1453 else 1454 else
1454 { 1455 {
1455 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1456 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1456 if (mViewManager->isVisible()) 1457 if (mViewManager->isVisible())
1457 { 1458 {
1458 if ( visible ) 1459 if ( visible )
1459 mJumpButtonBar->show(); 1460 mJumpButtonBar->show();
1460 else 1461 else
1461 mJumpButtonBar->hide(); 1462 mJumpButtonBar->hide();
1462 } 1463 }
1463 else 1464 else
1464 { 1465 {
1465 mJumpButtonBar->hide(); 1466 mJumpButtonBar->hide();
1466 } 1467 }
1467 } 1468 }
1468 if ( visible ) { 1469 if ( visible ) {
1469 if ( mIncSearchWidget->currentItem() == 0 ) { 1470 if ( mIncSearchWidget->currentItem() == 0 ) {
1470 message( i18n("Change search field enable jump bar") ); 1471 message( i18n("Change search field enable jump bar") );
1471 } 1472 }
1472 } 1473 }
1473} 1474}
1474 1475
1475 1476
1476void KABCore::setDetailsToState() 1477void KABCore::setDetailsToState()
1477{ 1478{
1478 setDetailsVisible( mActionDetails->isChecked() ); 1479 setDetailsVisible( mActionDetails->isChecked() );
1479} 1480}
1480void KABCore::setDetailsToggle() 1481void KABCore::setDetailsToggle()
1481{ 1482{
1482 mActionDetails->setChecked( !mActionDetails->isChecked() ); 1483 mActionDetails->setChecked( !mActionDetails->isChecked() );
1483 setDetailsToState(); 1484 setDetailsToState();
1484} 1485}
1485 1486
1486 1487
1487 1488
1488void KABCore::setDetailsVisible( bool visible ) 1489void KABCore::setDetailsVisible( bool visible )
1489{ 1490{
1490 if (visible && mDetails->isHidden()) 1491 if (visible && mDetails->isHidden())
1491 { 1492 {
1492 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1493 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1493 if ( addrList.count() > 0 ) 1494 if ( addrList.count() > 0 )
1494 mDetails->setAddressee( addrList[ 0 ] ); 1495 mDetails->setAddressee( addrList[ 0 ] );
1495 } 1496 }
1496 1497
1497 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1498 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1498 // the listview and the detailview. We do that by changing the splitbar size. 1499 // the listview and the detailview. We do that by changing the splitbar size.
1499 if (mMultipleViewsAtOnce) 1500 if (mMultipleViewsAtOnce)
1500 { 1501 {
1501 if ( visible ) 1502 if ( visible )
1502 mDetails->show(); 1503 mDetails->show();
1503 else 1504 else
1504 mDetails->hide(); 1505 mDetails->hide();
1505 } 1506 }
1506 else 1507 else
1507 { 1508 {
1508 if ( visible ) { 1509 if ( visible ) {
1509 mViewManager->hide(); 1510 mViewManager->hide();
1510 mDetails->show(); 1511 mDetails->show();
1511 mIncSearchWidget->setFocus(); 1512 mIncSearchWidget->setFocus();
1512 } 1513 }
1513 else { 1514 else {
1514 mViewManager->show(); 1515 mViewManager->show();
1515 mDetails->hide(); 1516 mDetails->hide();
1516 mViewManager->setFocusAV(); 1517 mViewManager->setFocusAV();
1517 } 1518 }
1518 setJumpButtonBarVisible( !visible ); 1519 setJumpButtonBarVisible( !visible );
1519 } 1520 }
1520 1521
1521} 1522}
1522 1523
1523void KABCore::extensionChanged( int id ) 1524void KABCore::extensionChanged( int id )
1524{ 1525{
1525 //change the details view only for non desktop systems 1526 //change the details view only for non desktop systems
1526#ifndef DESKTOP_VERSION 1527#ifndef DESKTOP_VERSION
1527 1528
1528 if (id == 0) 1529 if (id == 0)
1529 { 1530 {
1530 //the user disabled the extension. 1531 //the user disabled the extension.
1531 1532
1532 if (mMultipleViewsAtOnce) 1533 if (mMultipleViewsAtOnce)
1533 { // enable detailsview again 1534 { // enable detailsview again
1534 setDetailsVisible( true ); 1535 setDetailsVisible( true );
1535 mActionDetails->setChecked( true ); 1536 mActionDetails->setChecked( true );
1536 } 1537 }
1537 else 1538 else
1538 { //go back to the listview 1539 { //go back to the listview
1539 setDetailsVisible( false ); 1540 setDetailsVisible( false );
1540 mActionDetails->setChecked( false ); 1541 mActionDetails->setChecked( false );
1541 mActionDetails->setEnabled(true); 1542 mActionDetails->setEnabled(true);
1542 } 1543 }
1543 1544
1544 } 1545 }
1545 else 1546 else
1546 { 1547 {
1547 //the user enabled the extension. 1548 //the user enabled the extension.
1548 setDetailsVisible( false ); 1549 setDetailsVisible( false );
1549 mActionDetails->setChecked( false ); 1550 mActionDetails->setChecked( false );
1550 1551
1551 if (!mMultipleViewsAtOnce) 1552 if (!mMultipleViewsAtOnce)
1552 { 1553 {
1553 mActionDetails->setEnabled(false); 1554 mActionDetails->setEnabled(false);
1554 } 1555 }
1555 1556
1556 mExtensionManager->setSelectionChanged(); 1557 mExtensionManager->setSelectionChanged();
1557 1558
1558 } 1559 }
1559 1560
1560#endif// DESKTOP_VERSION 1561#endif// DESKTOP_VERSION
1561 1562
1562} 1563}
1563 1564
1564 1565
1565void KABCore::extensionModified( const KABC::Addressee::List &list ) 1566void KABCore::extensionModified( const KABC::Addressee::List &list )
1566{ 1567{
1567 1568
1568 if ( list.count() != 0 ) { 1569 if ( list.count() != 0 ) {
1569 KABC::Addressee::List::ConstIterator it; 1570 KABC::Addressee::List::ConstIterator it;
1570 for ( it = list.begin(); it != list.end(); ++it ) 1571 for ( it = list.begin(); it != list.end(); ++it )
1571 mAddressBook->insertAddressee( *it ); 1572 mAddressBook->insertAddressee( *it );
1572 if ( list.count() > 1 ) 1573 if ( list.count() > 1 )
1573 setModified(); 1574 setModified();
1574 else 1575 else
1575 setModifiedWOrefresh(); 1576 setModifiedWOrefresh();
1576 } 1577 }
1577 if ( list.count() == 0 ) 1578 if ( list.count() == 0 )
1578 mViewManager->refreshView(); 1579 mViewManager->refreshView();
1579 else 1580 else
1580 mViewManager->refreshView( list[ 0 ].uid() ); 1581 mViewManager->refreshView( list[ 0 ].uid() );
1581 1582
1582 1583
1583 1584
1584} 1585}
1585 1586
1586QString KABCore::getNameByPhone( const QString &phone ) 1587QString KABCore::getNameByPhone( const QString &phone )
1587{ 1588{
1588#ifndef KAB_EMBEDDED 1589#ifndef KAB_EMBEDDED
1589 QRegExp r( "[/*/-/ ]" ); 1590 QRegExp r( "[/*/-/ ]" );
1590 QString localPhone( phone ); 1591 QString localPhone( phone );
1591 1592
1592 bool found = false; 1593 bool found = false;
1593 QString ownerName = ""; 1594 QString ownerName = "";
1594 KABC::AddressBook::Iterator iter; 1595 KABC::AddressBook::Iterator iter;
1595 KABC::PhoneNumber::List::Iterator phoneIter; 1596 KABC::PhoneNumber::List::Iterator phoneIter;
1596 KABC::PhoneNumber::List phoneList; 1597 KABC::PhoneNumber::List phoneList;
1597 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1598 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1598 phoneList = (*iter).phoneNumbers(); 1599 phoneList = (*iter).phoneNumbers();