summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/incsearchwidget.cpp1
-rw-r--r--kaddressbook/kabcore.cpp30
-rw-r--r--kaddressbook/kabcore.h1
3 files changed, 23 insertions, 9 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp
index 78eaf65..dd2121a 100644
--- a/kaddressbook/incsearchwidget.cpp
+++ b/kaddressbook/incsearchwidget.cpp
@@ -1,167 +1,168 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qtooltip.h> 26#include <qtooltip.h>
27#include <qcombobox.h> 27#include <qcombobox.h>
28 28
29#include <kdialog.h> 29#include <kdialog.h>
30#include <klineedit.h> 30#include <klineedit.h>
31#include <klocale.h> 31#include <klocale.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <kglobal.h> 33#include <kglobal.h>
34#include "kabprefs.h" 34#include "kabprefs.h"
35 35
36#include "incsearchwidget.h" 36#include "incsearchwidget.h"
37 37
38IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) 38IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name )
39 : QWidget( parent, name ) 39 : QWidget( parent, name )
40{ 40{
41#ifndef KAB_EMBEDDED 41#ifndef KAB_EMBEDDED
42//US setCaption( i18n( "Incremental Search" ) ); 42//US setCaption( i18n( "Incremental Search" ) );
43#endif //KAB_EMBEDDED 43#endif //KAB_EMBEDDED
44 44
45 QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() ); 45 QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() );
46 46
47#ifdef DESKTOP_VERSION 47#ifdef DESKTOP_VERSION
48 QLabel *label = new QLabel( i18n( "Search:" ), this ); 48 QLabel *label = new QLabel( i18n( "Search:" ), this );
49 label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight ); 49 label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight );
50 layout->addWidget( label ); 50 layout->addWidget( label );
51#endif //KAB_EMBEDDED 51#endif //KAB_EMBEDDED
52 52
53 mSearchText = new KLineEdit( this ); 53 mSearchText = new KLineEdit( this );
54 layout->addWidget( mSearchText ); 54 layout->addWidget( mSearchText );
55// #ifdef KAB_EMBEDDED 55// #ifdef KAB_EMBEDDED
56// if (KGlobal::getOrientation() == KGlobal::Portrait) 56// if (KGlobal::getOrientation() == KGlobal::Portrait)
57// mSearchText->setMaximumWidth(30); 57// mSearchText->setMaximumWidth(30);
58// #endif //KAB_EMBEDDED 58// #endif //KAB_EMBEDDED
59 //mSearchText->setMaximumWidth(60);
59 60
60 61
61 mFieldCombo = new QComboBox( false, this ); 62 mFieldCombo = new QComboBox( false, this );
62 layout->addWidget( mFieldCombo ); 63 layout->addWidget( mFieldCombo );
63 mFieldCombo->setMaximumHeight( 34 ); 64 mFieldCombo->setMaximumHeight( 34 );
64 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); 65 QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) );
65 66
66// #ifndef KAB_EMBEDDED 67// #ifndef KAB_EMBEDDED
67// resize( QSize(420, 50).expandedTo( sizeHint() ) ); 68// resize( QSize(420, 50).expandedTo( sizeHint() ) );
68// #else //KAB_EMBEDDED 69// #else //KAB_EMBEDDED
69// resize( QSize(30, 10).expandedTo( sizeHint() ) ); 70// resize( QSize(30, 10).expandedTo( sizeHint() ) );
70// #endif //KAB_EMBEDDED 71// #endif //KAB_EMBEDDED
71 72
72 73
73 // for performance reasons, we do a search on the pda only after return is pressed 74 // for performance reasons, we do a search on the pda only after return is pressed
74 connect( mSearchText, SIGNAL( textChanged( const QString& ) ), 75 connect( mSearchText, SIGNAL( textChanged( const QString& ) ),
75 SLOT( announceDoSearch2() ) ); 76 SLOT( announceDoSearch2() ) );
76 connect( mFieldCombo, SIGNAL( activated( const QString& ) ), 77 connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
77 SLOT( announceDoSearch2() ) ); 78 SLOT( announceDoSearch2() ) );
78 79
79 connect( mSearchText, SIGNAL( returnPressed() ), 80 connect( mSearchText, SIGNAL( returnPressed() ),
80 SLOT( announceDoSearch() ) ); 81 SLOT( announceDoSearch() ) );
81 connect( mFieldCombo, SIGNAL( activated( const QString& ) ), 82 connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
82 SLOT( announceFieldChanged() ) ); 83 SLOT( announceFieldChanged() ) );
83 84
84 85
85 86
86 connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() )); 87 connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() ));
87 connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() )); 88 connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() ));
88 89
89 90
90 setFocusProxy( mSearchText ); 91 setFocusProxy( mSearchText );
91} 92}
92 93
93IncSearchWidget::~IncSearchWidget() 94IncSearchWidget::~IncSearchWidget()
94{ 95{
95 96
96} 97}
97void IncSearchWidget::announceDoSearch2() 98void IncSearchWidget::announceDoSearch2()
98{ 99{
99 if ( KABPrefs::instance()->mSearchWithReturn ) 100 if ( KABPrefs::instance()->mSearchWithReturn )
100 return; 101 return;
101 emit doSearch( mSearchText->text() ); 102 emit doSearch( mSearchText->text() );
102 //qDebug("emit dosreach "); 103 //qDebug("emit dosreach ");
103} 104}
104 105
105void IncSearchWidget::announceDoSearch() 106void IncSearchWidget::announceDoSearch()
106{ 107{
107 108
108 emit doSearch( mSearchText->text() ); 109 emit doSearch( mSearchText->text() );
109 // qDebug("emit dosreach "); 110 // qDebug("emit dosreach ");
110} 111}
111 112
112void IncSearchWidget::announceFieldChanged() 113void IncSearchWidget::announceFieldChanged()
113{ 114{
114 emit fieldChanged(); 115 emit fieldChanged();
115} 116}
116 117
117void IncSearchWidget::setFields( const KABC::Field::List &list ) 118void IncSearchWidget::setFields( const KABC::Field::List &list )
118{ 119{
119 120
120 mFieldCombo->clear(); 121 mFieldCombo->clear();
121 mFieldCombo->insertItem( i18n( "All Fields" ) ); 122 mFieldCombo->insertItem( i18n( "All Fields" ) );
122 QFontMetrics fm ( mFieldCombo->font() ); 123 QFontMetrics fm ( mFieldCombo->font() );
123 int wid = fm.width(i18n( "All Fields" ) ); 124 int wid = fm.width(i18n( "All Fields" ) );
124 int max = wid; 125 int max = wid;
125 126
126 KABC::Field::List::ConstIterator it; 127 KABC::Field::List::ConstIterator it;
127 for ( it = list.begin(); it != list.end(); ++it ) { 128 for ( it = list.begin(); it != list.end(); ++it ) {
128 mFieldCombo->insertItem( (*it)->label() ); 129 mFieldCombo->insertItem( (*it)->label() );
129 // wid = fm.width((*it)->label() ); 130 // wid = fm.width((*it)->label() );
130 //if ( wid > max ) 131 //if ( wid > max )
131 // max = wid; 132 // max = wid;
132 } 133 }
133 134
134 mFieldList = list; 135 mFieldList = list;
135 136
136 announceDoSearch(); 137 announceDoSearch();
137 announceFieldChanged(); 138 announceFieldChanged();
138 mFieldCombo->setMaximumWidth( wid+60 ); 139 mFieldCombo->setMaximumWidth( wid+60 );
139} 140}
140 141
141KABC::Field::List IncSearchWidget::fields() const 142KABC::Field::List IncSearchWidget::fields() const
142{ 143{
143 return mFieldList; 144 return mFieldList;
144} 145}
145 146
146KABC::Field *IncSearchWidget::currentField()const 147KABC::Field *IncSearchWidget::currentField()const
147{ 148{
148 if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 ) 149 if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 )
149 return 0; // for error or 'use all fields' 150 return 0; // for error or 'use all fields'
150 else 151 else
151 return mFieldList[ mFieldCombo->currentItem() - 1 ]; 152 return mFieldList[ mFieldCombo->currentItem() - 1 ];
152} 153}
153 154
154void IncSearchWidget::setCurrentItem( int pos ) 155void IncSearchWidget::setCurrentItem( int pos )
155{ 156{
156 mFieldCombo->setCurrentItem( pos ); 157 mFieldCombo->setCurrentItem( pos );
157 announceFieldChanged(); 158 announceFieldChanged();
158} 159}
159 160
160int IncSearchWidget::currentItem() const 161int IncSearchWidget::currentItem() const
161{ 162{
162 163
163 return mFieldCombo->currentItem(); 164 return mFieldCombo->currentItem();
164} 165}
165#ifndef KAB_EMBEDDED 166#ifndef KAB_EMBEDDED
166#include "incsearchwidget.moc" 167#include "incsearchwidget.moc"
167#endif //KAB_EMBEDDED 168#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 7acf1ee..a6fc677 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,3146 +1,3158 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/*s 24/*s
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include "kabcore.h" 31#include "kabcore.h"
32 32
33#include <stdaddressbook.h> 33#include <stdaddressbook.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kfiledialog.h> 35#include <kfiledialog.h>
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qlabel.h> 37#include <qlabel.h>
38#include <qregexp.h> 38#include <qregexp.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qcheckbox.h> 40#include <qcheckbox.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qprogressbar.h> 42#include <qprogressbar.h>
43#include <libkdepim/phoneaccess.h> 43#include <libkdepim/phoneaccess.h>
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46#include <qclipboard.h> 46#include <qclipboard.h>
47#include <qdir.h> 47#include <qdir.h>
48#include <qfile.h> 48#include <qfile.h>
49#include <qapplicaton.h> 49#include <qapplicaton.h>
50#include <qprogressbar.h> 50#include <qprogressbar.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qregexp.h> 52#include <qregexp.h>
53#include <qvbox.h> 53#include <qvbox.h>
54#include <kabc/addresseelist.h> 54#include <kabc/addresseelist.h>
55#include <kabc/errorhandler.h> 55#include <kabc/errorhandler.h>
56#include <kabc/resource.h> 56#include <kabc/resource.h>
57#include <kabc/vcardconverter.h> 57#include <kabc/vcardconverter.h>
58#include <kapplication.h> 58#include <kapplication.h>
59#include <kactionclasses.h> 59#include <kactionclasses.h>
60#include <kcmultidialog.h> 60#include <kcmultidialog.h>
61#include <kdebug.h> 61#include <kdebug.h>
62#include <kdeversion.h> 62#include <kdeversion.h>
63#include <kkeydialog.h> 63#include <kkeydialog.h>
64#include <kmessagebox.h> 64#include <kmessagebox.h>
65#include <kprinter.h> 65#include <kprinter.h>
66#include <kprotocolinfo.h> 66#include <kprotocolinfo.h>
67#include <kresources/selectdialog.h> 67#include <kresources/selectdialog.h>
68#include <kstandarddirs.h> 68#include <kstandarddirs.h>
69#include <ktempfile.h> 69#include <ktempfile.h>
70#include <kxmlguiclient.h> 70#include <kxmlguiclient.h>
71#include <kaboutdata.h> 71#include <kaboutdata.h>
72#include <libkdepim/categoryselectdialog.h> 72#include <libkdepim/categoryselectdialog.h>
73 73
74#include "addresseeutil.h" 74#include "addresseeutil.h"
75#include "addresseeeditordialog.h" 75#include "addresseeeditordialog.h"
76#include "extensionmanager.h" 76#include "extensionmanager.h"
77#include "kstdaction.h" 77#include "kstdaction.h"
78#include "kaddressbookservice.h" 78#include "kaddressbookservice.h"
79#include "ldapsearchdialog.h" 79#include "ldapsearchdialog.h"
80#include "printing/printingwizard.h" 80#include "printing/printingwizard.h"
81#else // KAB_EMBEDDED 81#else // KAB_EMBEDDED
82 82
83#include <kapplication.h> 83#include <kapplication.h>
84#include "KDGanttMinimizeSplitter.h" 84#include "KDGanttMinimizeSplitter.h"
85#include "kaddressbookmain.h" 85#include "kaddressbookmain.h"
86#include "kactioncollection.h" 86#include "kactioncollection.h"
87#include "addresseedialog.h" 87#include "addresseedialog.h"
88//US 88//US
89#include <addresseeview.h> 89#include <addresseeview.h>
90 90
91#include <qapp.h> 91#include <qapp.h>
92#include <qmenubar.h> 92#include <qmenubar.h>
93//#include <qtoolbar.h> 93//#include <qtoolbar.h>
94#include <qmessagebox.h> 94#include <qmessagebox.h>
95#include <kdebug.h> 95#include <kdebug.h>
96#include <kiconloader.h> // needed for SmallIcon 96#include <kiconloader.h> // needed for SmallIcon
97#include <kresources/kcmkresources.h> 97#include <kresources/kcmkresources.h>
98#include <ktoolbar.h> 98#include <ktoolbar.h>
99 99
100 100
101//#include <qlabel.h> 101//#include <qlabel.h>
102 102
103 103
104#ifndef DESKTOP_VERSION 104#ifndef DESKTOP_VERSION
105#include <qpe/ir.h> 105#include <qpe/ir.h>
106#include <qpe/qpemenubar.h> 106#include <qpe/qpemenubar.h>
107#include <qtopia/qcopenvelope_qws.h> 107#include <qtopia/qcopenvelope_qws.h>
108#else 108#else
109 109
110#include <qmenubar.h> 110#include <qmenubar.h>
111#endif 111#endif
112 112
113#endif // KAB_EMBEDDED 113#endif // KAB_EMBEDDED
114#include "kcmconfigs/kcmkabconfig.h" 114#include "kcmconfigs/kcmkabconfig.h"
115#include "kcmconfigs/kcmkdepimconfig.h" 115#include "kcmconfigs/kcmkdepimconfig.h"
116#include "kpimglobalprefs.h" 116#include "kpimglobalprefs.h"
117#include "externalapphandler.h" 117#include "externalapphandler.h"
118#include "xxportselectdialog.h" 118#include "xxportselectdialog.h"
119 119
120 120
121#include <kresources/selectdialog.h> 121#include <kresources/selectdialog.h>
122#include <kmessagebox.h> 122#include <kmessagebox.h>
123 123
124#include <picture.h> 124#include <picture.h>
125#include <resource.h> 125#include <resource.h>
126 126
127//US#include <qsplitter.h> 127//US#include <qsplitter.h>
128#include <qmap.h> 128#include <qmap.h>
129#include <qdir.h> 129#include <qdir.h>
130#include <qfile.h> 130#include <qfile.h>
131#include <qvbox.h> 131#include <qvbox.h>
132#include <qlayout.h> 132#include <qlayout.h>
133#include <qclipboard.h> 133#include <qclipboard.h>
134#include <qtextstream.h> 134#include <qtextstream.h>
135#include <qradiobutton.h> 135#include <qradiobutton.h>
136#include <qbuttongroup.h> 136#include <qbuttongroup.h>
137 137
138#include <libkdepim/categoryselectdialog.h> 138#include <libkdepim/categoryselectdialog.h>
139#include <libkdepim/categoryeditdialog.h> 139#include <libkdepim/categoryeditdialog.h>
140#include <kabc/vcardconverter.h> 140#include <kabc/vcardconverter.h>
141 141
142 142
143#include "addresseeutil.h" 143#include "addresseeutil.h"
144#include "undocmds.h" 144#include "undocmds.h"
145#include "addresseeeditordialog.h" 145#include "addresseeeditordialog.h"
146#include "viewmanager.h" 146#include "viewmanager.h"
147#include "details/detailsviewcontainer.h" 147#include "details/detailsviewcontainer.h"
148#include "kabprefs.h" 148#include "kabprefs.h"
149#include "xxportmanager.h" 149#include "xxportmanager.h"
150#include "incsearchwidget.h" 150#include "incsearchwidget.h"
151#include "jumpbuttonbar.h" 151#include "jumpbuttonbar.h"
152#include "extensionmanager.h" 152#include "extensionmanager.h"
153#include "addresseeconfig.h" 153#include "addresseeconfig.h"
154#include <kcmultidialog.h> 154#include <kcmultidialog.h>
155 155
156#ifdef _WIN32_ 156#ifdef _WIN32_
157 157
158#include "kaimportoldialog.h" 158#include "kaimportoldialog.h"
159#else 159#else
160#include <unistd.h> 160#include <unistd.h>
161#endif 161#endif
162// sync includes 162// sync includes
163#include <libkdepim/ksyncprofile.h> 163#include <libkdepim/ksyncprofile.h>
164#include <libkdepim/ksyncprefsdialog.h> 164#include <libkdepim/ksyncprefsdialog.h>
165 165
166 166
167class KABCatPrefs : public QDialog 167class KABCatPrefs : public QDialog
168{ 168{
169 public: 169 public:
170 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 170 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
171 QDialog( parent, name, true ) 171 QDialog( parent, name, true )
172 { 172 {
173 setCaption( i18n("Manage new Categories") ); 173 setCaption( i18n("Manage new Categories") );
174 QVBoxLayout* lay = new QVBoxLayout( this ); 174 QVBoxLayout* lay = new QVBoxLayout( this );
175 lay->setSpacing( 3 ); 175 lay->setSpacing( 3 );
176 lay->setMargin( 3 ); 176 lay->setMargin( 3 );
177 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 177 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
178 lay->addWidget( lab ); 178 lay->addWidget( lab );
179 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 179 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
180 lay->addWidget( format ); 180 lay->addWidget( format );
181 format->setExclusive ( true ) ; 181 format->setExclusive ( true ) ;
182 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 182 addCatBut = new QRadioButton(i18n("Add to category list"), format );
183 new QRadioButton(i18n("Remove from addressees"), format ); 183 new QRadioButton(i18n("Remove from addressees"), format );
184 addCatBut->setChecked( true ); 184 addCatBut->setChecked( true );
185 QPushButton * ok = new QPushButton( i18n("OK"), this ); 185 QPushButton * ok = new QPushButton( i18n("OK"), this );
186 lay->addWidget( ok ); 186 lay->addWidget( ok );
187 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 187 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
188 lay->addWidget( cancel ); 188 lay->addWidget( cancel );
189 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 189 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
190 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 190 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
191 resize( 200, 200 ); 191 resize( 200, 200 );
192 } 192 }
193 193
194 bool addCat() { return addCatBut->isChecked(); } 194 bool addCat() { return addCatBut->isChecked(); }
195private: 195private:
196 QRadioButton* addCatBut; 196 QRadioButton* addCatBut;
197}; 197};
198 198
199 199
200 200
201class KAex2phonePrefs : public QDialog 201class KAex2phonePrefs : public QDialog
202{ 202{
203 public: 203 public:
204 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 204 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
205 QDialog( parent, name, true ) 205 QDialog( parent, name, true )
206 { 206 {
207 setCaption( i18n("Export to phone options") ); 207 setCaption( i18n("Export to phone options") );
208 QVBoxLayout* lay = new QVBoxLayout( this ); 208 QVBoxLayout* lay = new QVBoxLayout( this );
209 lay->setSpacing( 3 ); 209 lay->setSpacing( 3 );
210 lay->setMargin( 3 ); 210 lay->setMargin( 3 );
211 QLabel *lab; 211 QLabel *lab;
212 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 212 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
213 lab->setAlignment (AlignHCenter ); 213 lab->setAlignment (AlignHCenter );
214 QHBox* temphb; 214 QHBox* temphb;
215 temphb = new QHBox( this ); 215 temphb = new QHBox( this );
216 new QLabel( i18n("I/O device: "), temphb ); 216 new QLabel( i18n("I/O device: "), temphb );
217 mPhoneDevice = new QLineEdit( temphb); 217 mPhoneDevice = new QLineEdit( temphb);
218 lay->addWidget( temphb ); 218 lay->addWidget( temphb );
219 temphb = new QHBox( this ); 219 temphb = new QHBox( this );
220 new QLabel( i18n("Connection: "), temphb ); 220 new QLabel( i18n("Connection: "), temphb );
221 mPhoneConnection = new QLineEdit( temphb); 221 mPhoneConnection = new QLineEdit( temphb);
222 lay->addWidget( temphb ); 222 lay->addWidget( temphb );
223 temphb = new QHBox( this ); 223 temphb = new QHBox( this );
224 new QLabel( i18n("Model(opt.): "), temphb ); 224 new QLabel( i18n("Model(opt.): "), temphb );
225 mPhoneModel = new QLineEdit( temphb); 225 mPhoneModel = new QLineEdit( temphb);
226 lay->addWidget( temphb ); 226 lay->addWidget( temphb );
227 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 227 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
228 // lay->addWidget( mWriteToSim ); 228 // lay->addWidget( mWriteToSim );
229 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 229 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
230 lab->setAlignment (AlignHCenter ); 230 lab->setAlignment (AlignHCenter );
231 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 231 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
232 lay->addWidget( ok ); 232 lay->addWidget( ok );
233 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 233 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
234 lay->addWidget( cancel ); 234 lay->addWidget( cancel );
235 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 235 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
236 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 236 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
237 resize( 220, 240 ); 237 resize( 220, 240 );
238 238
239 } 239 }
240 240
241public: 241public:
242 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 242 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
243 QCheckBox* mWriteToSim; 243 QCheckBox* mWriteToSim;
244}; 244};
245 245
246 246
247bool pasteWithNewUid = true; 247bool pasteWithNewUid = true;
248 248
249#ifdef KAB_EMBEDDED 249#ifdef KAB_EMBEDDED
250KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 250KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
251 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 251 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
252 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 252 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
253 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 253 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
254#else //KAB_EMBEDDED 254#else //KAB_EMBEDDED
255KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 255KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
256 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 256 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
257 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 257 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
258 mReadWrite( readWrite ), mModified( false ) 258 mReadWrite( readWrite ), mModified( false )
259#endif //KAB_EMBEDDED 259#endif //KAB_EMBEDDED
260{ 260{
261 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 261 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
262 // syncManager->setBlockSave(false); 262 // syncManager->setBlockSave(false);
263 mMiniSplitter = 0; 263 mMiniSplitter = 0;
264 mExtensionBarSplitter = 0; 264 mExtensionBarSplitter = 0;
265 mIsPart = !parent->inherits( "KAddressBookMain" ); 265 mIsPart = !parent->inherits( "KAddressBookMain" );
266 mAddressBook = KABC::StdAddressBook::self(); 266 mAddressBook = KABC::StdAddressBook::self();
267 KABC::StdAddressBook::setAutomaticSave( false ); 267 KABC::StdAddressBook::setAutomaticSave( false );
268 268
269#ifndef KAB_EMBEDDED 269#ifndef KAB_EMBEDDED
270 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 270 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
271#endif //KAB_EMBEDDED 271#endif //KAB_EMBEDDED
272 272
273 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 273 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
274 SLOT( addressBookChanged() ) ); 274 SLOT( addressBookChanged() ) );
275 275
276#if 0 276#if 0
277 // LP moved to addressbook init method 277 // LP moved to addressbook init method
278 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 278 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
279 "X-Department", "KADDRESSBOOK" ); 279 "X-Department", "KADDRESSBOOK" );
280 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 280 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
281 "X-Profession", "KADDRESSBOOK" ); 281 "X-Profession", "KADDRESSBOOK" );
282 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 282 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
283 "X-AssistantsName", "KADDRESSBOOK" ); 283 "X-AssistantsName", "KADDRESSBOOK" );
284 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 284 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
285 "X-ManagersName", "KADDRESSBOOK" ); 285 "X-ManagersName", "KADDRESSBOOK" );
286 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 286 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
287 "X-SpousesName", "KADDRESSBOOK" ); 287 "X-SpousesName", "KADDRESSBOOK" );
288 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 288 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
289 "X-Office", "KADDRESSBOOK" ); 289 "X-Office", "KADDRESSBOOK" );
290 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 290 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
291 "X-IMAddress", "KADDRESSBOOK" ); 291 "X-IMAddress", "KADDRESSBOOK" );
292 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 292 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
293 "X-Anniversary", "KADDRESSBOOK" ); 293 "X-Anniversary", "KADDRESSBOOK" );
294 294
295 //US added this field to become compatible with Opie/qtopia addressbook 295 //US added this field to become compatible with Opie/qtopia addressbook
296 // values can be "female" or "male" or "". An empty field represents undefined. 296 // values can be "female" or "male" or "". An empty field represents undefined.
297 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 297 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
298 "X-Gender", "KADDRESSBOOK" ); 298 "X-Gender", "KADDRESSBOOK" );
299 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 299 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
300 "X-Children", "KADDRESSBOOK" ); 300 "X-Children", "KADDRESSBOOK" );
301 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 301 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
302 "X-FreeBusyUrl", "KADDRESSBOOK" ); 302 "X-FreeBusyUrl", "KADDRESSBOOK" );
303#endif 303#endif
304 initGUI(); 304 initGUI();
305 305
306 mIncSearchWidget->setFocus(); 306 mIncSearchWidget->setFocus();
307 307
308 308
309 connect( mViewManager, SIGNAL( selected( const QString& ) ), 309 connect( mViewManager, SIGNAL( selected( const QString& ) ),
310 SLOT( setContactSelected( const QString& ) ) ); 310 SLOT( setContactSelected( const QString& ) ) );
311 connect( mViewManager, SIGNAL( executed( const QString& ) ), 311 connect( mViewManager, SIGNAL( executed( const QString& ) ),
312 SLOT( executeContact( const QString& ) ) ); 312 SLOT( executeContact( const QString& ) ) );
313 313
314 connect( mViewManager, SIGNAL( deleteRequest( ) ), 314 connect( mViewManager, SIGNAL( deleteRequest( ) ),
315 SLOT( deleteContacts( ) ) ); 315 SLOT( deleteContacts( ) ) );
316 connect( mViewManager, SIGNAL( modified() ), 316 connect( mViewManager, SIGNAL( modified() ),
317 SLOT( setModified() ) ); 317 SLOT( setModified() ) );
318 318
319 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 319 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
320 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 320 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
321 321
322 connect( mXXPortManager, SIGNAL( modified() ), 322 connect( mXXPortManager, SIGNAL( modified() ),
323 SLOT( setModified() ) ); 323 SLOT( setModified() ) );
324 324
325 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 325 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
326 SLOT( incrementalSearch( const QString& ) ) ); 326 SLOT( incrementalSearch( const QString& ) ) );
327 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 327 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
328 mJumpButtonBar, SLOT( recreateButtons() ) ); 328 mJumpButtonBar, SLOT( recreateButtons() ) );
329 329
330 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 330 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
331 SLOT( sendMail( const QString& ) ) ); 331 SLOT( sendMail( const QString& ) ) );
332 332
333 333
334 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 334 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
335 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 335 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
336 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 336 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
337 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 337 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
338 338
339 339
340#ifndef KAB_EMBEDDED 340#ifndef KAB_EMBEDDED
341 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 341 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
342 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 342 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
343 343
344 connect( mDetails, SIGNAL( browse( const QString& ) ), 344 connect( mDetails, SIGNAL( browse( const QString& ) ),
345 SLOT( browse( const QString& ) ) ); 345 SLOT( browse( const QString& ) ) );
346 346
347 347
348 mAddressBookService = new KAddressBookService( this ); 348 mAddressBookService = new KAddressBookService( this );
349 349
350#endif //KAB_EMBEDDED 350#endif //KAB_EMBEDDED
351 351
352 mMessageTimer = new QTimer( this ); 352 mMessageTimer = new QTimer( this );
353 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 353 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
354 mEditorDialog = 0; 354 mEditorDialog = 0;
355 createAddresseeEditorDialog( this ); 355 createAddresseeEditorDialog( this );
356 setModified( false ); 356 setModified( false );
357 mBRdisabled = false; 357 mBRdisabled = false;
358#ifndef DESKTOP_VERSION 358#ifndef DESKTOP_VERSION
359 infrared = 0; 359 infrared = 0;
360#endif 360#endif
361 //toggleBeamReceive( ); 361 //toggleBeamReceive( );
362 362
363 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 363 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
364 QTimer::singleShot( 1000, this , SLOT ( updateToolBar())); 364 QTimer::singleShot( 10000, this , SLOT ( updateToolBar()));
365} 365}
366 366
367void KABCore::updateToolBar() 367void KABCore::updateToolBar()
368{ 368{
369 mMainWindow->toolBar()->repaint(); 369 mMainWindow->toolBar()->update();
370} 370}
371KABCore::~KABCore() 371KABCore::~KABCore()
372{ 372{
373 // save(); 373 // save();
374 //saveSettings(); 374 //saveSettings();
375 //KABPrefs::instance()->writeConfig(); 375 //KABPrefs::instance()->writeConfig();
376 delete AddresseeConfig::instance(); 376 delete AddresseeConfig::instance();
377 mAddressBook = 0; 377 mAddressBook = 0;
378 KABC::StdAddressBook::close(); 378 KABC::StdAddressBook::close();
379 379
380 delete syncManager; 380 delete syncManager;
381#ifndef DESKTOP_VERSION 381#ifndef DESKTOP_VERSION
382 if ( infrared ) 382 if ( infrared )
383 delete infrared; 383 delete infrared;
384#endif 384#endif
385} 385}
386void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 386void KABCore::receive( const QCString& cmsg, const QByteArray& data )
387{ 387{
388 qDebug("KA: QCOP message received: %s ", cmsg.data() ); 388 qDebug("KA: QCOP message received: %s ", cmsg.data() );
389 if ( cmsg == "setDocument(QString)" ) { 389 if ( cmsg == "setDocument(QString)" ) {
390 QDataStream stream( data, IO_ReadOnly ); 390 QDataStream stream( data, IO_ReadOnly );
391 QString fileName; 391 QString fileName;
392 stream >> fileName; 392 stream >> fileName;
393 recieve( fileName ); 393 recieve( fileName );
394 return; 394 return;
395 } 395 }
396} 396}
397void KABCore::toggleBeamReceive( ) 397void KABCore::toggleBeamReceive( )
398{ 398{
399 if ( mBRdisabled ) 399 if ( mBRdisabled )
400 return; 400 return;
401#ifndef DESKTOP_VERSION 401#ifndef DESKTOP_VERSION
402 if ( infrared ) { 402 if ( infrared ) {
403 qDebug("AB disable BeamReceive "); 403 qDebug("AB disable BeamReceive ");
404 delete infrared; 404 delete infrared;
405 infrared = 0; 405 infrared = 0;
406 mActionBR->setChecked(false); 406 mActionBR->setChecked(false);
407 return; 407 return;
408 } 408 }
409 qDebug("AB enable BeamReceive "); 409 qDebug("AB enable BeamReceive ");
410 mActionBR->setChecked(true); 410 mActionBR->setChecked(true);
411 411
412 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 412 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
413 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 413 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
414#endif 414#endif
415} 415}
416 416
417 417
418void KABCore::disableBR(bool b) 418void KABCore::disableBR(bool b)
419{ 419{
420#ifndef DESKTOP_VERSION 420#ifndef DESKTOP_VERSION
421 if ( b ) { 421 if ( b ) {
422 if ( infrared ) { 422 if ( infrared ) {
423 toggleBeamReceive( ); 423 toggleBeamReceive( );
424 } 424 }
425 mBRdisabled = true; 425 mBRdisabled = true;
426 } else { 426 } else {
427 if ( mBRdisabled ) { 427 if ( mBRdisabled ) {
428 mBRdisabled = false; 428 mBRdisabled = false;
429 //toggleBeamReceive( ); 429 //toggleBeamReceive( );
430 } 430 }
431 } 431 }
432#endif 432#endif
433 433
434} 434}
435void KABCore::recieve( QString fn ) 435void KABCore::recieve( QString fn )
436{ 436{
437 //qDebug("KABCore::recieve "); 437 //qDebug("KABCore::recieve ");
438 int count = mAddressBook->importFromFile( fn, true ); 438 int count = mAddressBook->importFromFile( fn, true );
439 if ( count ) 439 if ( count )
440 setModified( true ); 440 setModified( true );
441 mViewManager->refreshView(); 441 mViewManager->refreshView();
442 message(i18n("%1 contact(s) received!").arg( count )); 442 message(i18n("%1 contact(s) received!").arg( count ));
443 topLevelWidget()->showMaximized(); 443 topLevelWidget()->showMaximized();
444 topLevelWidget()->raise(); 444 topLevelWidget()->raise();
445} 445}
446void KABCore::restoreSettings() 446void KABCore::restoreSettings()
447{ 447{
448 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 448 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
449 449
450 bool state; 450 bool state;
451 451
452 if (mMultipleViewsAtOnce) 452 if (mMultipleViewsAtOnce)
453 state = KABPrefs::instance()->mDetailsPageVisible; 453 state = KABPrefs::instance()->mDetailsPageVisible;
454 else 454 else
455 state = false; 455 state = false;
456 456
457 mActionDetails->setChecked( state ); 457 mActionDetails->setChecked( state );
458 setDetailsVisible( state ); 458 setDetailsVisible( state );
459 459
460 state = KABPrefs::instance()->mJumpButtonBarVisible; 460 state = KABPrefs::instance()->mJumpButtonBarVisible;
461 461
462 mActionJumpBar->setChecked( state ); 462 mActionJumpBar->setChecked( state );
463 setJumpButtonBarVisible( state ); 463 setJumpButtonBarVisible( state );
464/*US 464/*US
465 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 465 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
466 if ( splitterSize.count() == 0 ) { 466 if ( splitterSize.count() == 0 ) {
467 splitterSize.append( width() / 2 ); 467 splitterSize.append( width() / 2 );
468 splitterSize.append( width() / 2 ); 468 splitterSize.append( width() / 2 );
469 } 469 }
470 mMiniSplitter->setSizes( splitterSize ); 470 mMiniSplitter->setSizes( splitterSize );
471 if ( mExtensionBarSplitter ) { 471 if ( mExtensionBarSplitter ) {
472 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 472 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
473 if ( splitterSize.count() == 0 ) { 473 if ( splitterSize.count() == 0 ) {
474 splitterSize.append( width() / 2 ); 474 splitterSize.append( width() / 2 );
475 splitterSize.append( width() / 2 ); 475 splitterSize.append( width() / 2 );
476 } 476 }
477 mExtensionBarSplitter->setSizes( splitterSize ); 477 mExtensionBarSplitter->setSizes( splitterSize );
478 478
479 } 479 }
480*/ 480*/
481 mViewManager->restoreSettings(); 481 mViewManager->restoreSettings();
482 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 482 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
483 mExtensionManager->restoreSettings(); 483 mExtensionManager->restoreSettings();
484#ifdef DESKTOP_VERSION 484#ifdef DESKTOP_VERSION
485 int wid = width(); 485 int wid = width();
486 if ( wid < 10 ) 486 if ( wid < 10 )
487 wid = 400; 487 wid = 400;
488#else 488#else
489 int wid = QApplication::desktop()->width(); 489 int wid = QApplication::desktop()->width();
490 if ( wid < 640 ) 490 if ( wid < 640 )
491 wid = QApplication::desktop()->height(); 491 wid = QApplication::desktop()->height();
492#endif 492#endif
493 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 493 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
494 if ( true /*splitterSize.count() == 0*/ ) { 494 if ( true /*splitterSize.count() == 0*/ ) {
495 splitterSize.append( wid / 2 ); 495 splitterSize.append( wid / 2 );
496 splitterSize.append( wid / 2 ); 496 splitterSize.append( wid / 2 );
497 } 497 }
498 mMiniSplitter->setSizes( splitterSize ); 498 mMiniSplitter->setSizes( splitterSize );
499 if ( mExtensionBarSplitter ) { 499 if ( mExtensionBarSplitter ) {
500 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 500 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
501 if ( true /*splitterSize.count() == 0*/ ) { 501 if ( true /*splitterSize.count() == 0*/ ) {
502 splitterSize.append( wid / 2 ); 502 splitterSize.append( wid / 2 );
503 splitterSize.append( wid / 2 ); 503 splitterSize.append( wid / 2 );
504 } 504 }
505 mExtensionBarSplitter->setSizes( splitterSize ); 505 mExtensionBarSplitter->setSizes( splitterSize );
506 506
507 } 507 }
508 508
509 509
510} 510}
511 511
512void KABCore::saveSettings() 512void KABCore::saveSettings()
513{ 513{
514 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 514 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
515 if ( mExtensionBarSplitter ) 515 if ( mExtensionBarSplitter )
516 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 516 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
517 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 517 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
518 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 518 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
519#ifndef KAB_EMBEDDED 519#ifndef KAB_EMBEDDED
520 520
521 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 521 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
522 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 522 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
523#endif //KAB_EMBEDDED 523#endif //KAB_EMBEDDED
524 mExtensionManager->saveSettings(); 524 mExtensionManager->saveSettings();
525 mViewManager->saveSettings(); 525 mViewManager->saveSettings();
526 526
527 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 527 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
528} 528}
529 529
530KABC::AddressBook *KABCore::addressBook() const 530KABC::AddressBook *KABCore::addressBook() const
531{ 531{
532 return mAddressBook; 532 return mAddressBook;
533} 533}
534 534
535KConfig *KABCore::config() 535KConfig *KABCore::config()
536{ 536{
537#ifndef KAB_EMBEDDED 537#ifndef KAB_EMBEDDED
538 return KABPrefs::instance()->config(); 538 return KABPrefs::instance()->config();
539#else //KAB_EMBEDDED 539#else //KAB_EMBEDDED
540 return KABPrefs::instance()->getConfig(); 540 return KABPrefs::instance()->getConfig();
541#endif //KAB_EMBEDDED 541#endif //KAB_EMBEDDED
542} 542}
543 543
544KActionCollection *KABCore::actionCollection() const 544KActionCollection *KABCore::actionCollection() const
545{ 545{
546 return mGUIClient->actionCollection(); 546 return mGUIClient->actionCollection();
547} 547}
548 548
549KABC::Field *KABCore::currentSearchField() const 549KABC::Field *KABCore::currentSearchField() const
550{ 550{
551 if (mIncSearchWidget) 551 if (mIncSearchWidget)
552 return mIncSearchWidget->currentField(); 552 return mIncSearchWidget->currentField();
553 else 553 else
554 return 0; 554 return 0;
555} 555}
556 556
557QStringList KABCore::selectedUIDs() const 557QStringList KABCore::selectedUIDs() const
558{ 558{
559 return mViewManager->selectedUids(); 559 return mViewManager->selectedUids();
560} 560}
561 561
562KABC::Resource *KABCore::requestResource( QWidget *parent ) 562KABC::Resource *KABCore::requestResource( QWidget *parent )
563{ 563{
564 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 564 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
565 565
566 QPtrList<KRES::Resource> kresResources; 566 QPtrList<KRES::Resource> kresResources;
567 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 567 QPtrListIterator<KABC::Resource> resIt( kabcResources );
568 KABC::Resource *resource; 568 KABC::Resource *resource;
569 while ( ( resource = resIt.current() ) != 0 ) { 569 while ( ( resource = resIt.current() ) != 0 ) {
570 ++resIt; 570 ++resIt;
571 if ( !resource->readOnly() ) { 571 if ( !resource->readOnly() ) {
572 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 572 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
573 if ( res ) 573 if ( res )
574 kresResources.append( res ); 574 kresResources.append( res );
575 } 575 }
576 } 576 }
577 577
578 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 578 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
579 return static_cast<KABC::Resource*>( res ); 579 return static_cast<KABC::Resource*>( res );
580} 580}
581 581
582#ifndef KAB_EMBEDDED 582#ifndef KAB_EMBEDDED
583KAboutData *KABCore::createAboutData() 583KAboutData *KABCore::createAboutData()
584#else //KAB_EMBEDDED 584#else //KAB_EMBEDDED
585void KABCore::createAboutData() 585void KABCore::createAboutData()
586#endif //KAB_EMBEDDED 586#endif //KAB_EMBEDDED
587{ 587{
588#ifndef KAB_EMBEDDED 588#ifndef KAB_EMBEDDED
589 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 589 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
590 "3.1", I18N_NOOP( "The KDE Address Book" ), 590 "3.1", I18N_NOOP( "The KDE Address Book" ),
591 KAboutData::License_GPL_V2, 591 KAboutData::License_GPL_V2,
592 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 592 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
593 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 593 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
594 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 594 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
595 about->addAuthor( "Cornelius Schumacher", 595 about->addAuthor( "Cornelius Schumacher",
596 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 596 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
597 "schumacher@kde.org" ); 597 "schumacher@kde.org" );
598 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 598 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
599 "mpilone@slac.com" ); 599 "mpilone@slac.com" );
600 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 600 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
601 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 601 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
602 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 602 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
603 "michel@klaralvdalens-datakonsult.se" ); 603 "michel@klaralvdalens-datakonsult.se" );
604 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 604 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
605 "hansen@kde.org" ); 605 "hansen@kde.org" );
606 606
607 return about; 607 return about;
608#endif //KAB_EMBEDDED 608#endif //KAB_EMBEDDED
609 609
610 QString version; 610 QString version;
611#include <../version> 611#include <../version>
612 QMessageBox::about( this, "About KAddressbook/Pi", 612 QMessageBox::about( this, "About KAddressbook/Pi",
613 "KAddressbook/Platform-independent\n" 613 "KAddressbook/Platform-independent\n"
614 "(KA/Pi) " +version + " - " + 614 "(KA/Pi) " +version + " - " +
615#ifdef DESKTOP_VERSION 615#ifdef DESKTOP_VERSION
616 "Desktop Edition\n" 616 "Desktop Edition\n"
617#else 617#else
618 "PDA-Edition\n" 618 "PDA-Edition\n"
619 "for: Zaurus 5500 / 7x0 / 8x0\n" 619 "for: Zaurus 5500 / 7x0 / 8x0\n"
620#endif 620#endif
621 621
622 "(c) 2004 Ulf Schenk\n" 622 "(c) 2004 Ulf Schenk\n"
623 "(c) 2004 Lutz Rogowski\n" 623 "(c) 2004 Lutz Rogowski\n"
624 "(c) 1997-2003, The KDE PIM Team\n" 624 "(c) 1997-2003, The KDE PIM Team\n"
625 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 625 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
626 "Don Sanders Original author\n" 626 "Don Sanders Original author\n"
627 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 627 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
628 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 628 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
629 "Greg Stern DCOP interface\n" 629 "Greg Stern DCOP interface\n"
630 "Mark Westcot Contact pinning\n" 630 "Mark Westcot Contact pinning\n"
631 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 631 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
632 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 632 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
633#ifdef _WIN32_ 633#ifdef _WIN32_
634 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 634 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
635#endif 635#endif
636 ); 636 );
637} 637}
638 638
639void KABCore::setContactSelected( const QString &uid ) 639void KABCore::setContactSelected( const QString &uid )
640{ 640{
641 KABC::Addressee addr = mAddressBook->findByUid( uid ); 641 KABC::Addressee addr = mAddressBook->findByUid( uid );
642 if ( !mDetails->isHidden() ) 642 if ( !mDetails->isHidden() )
643 mDetails->setAddressee( addr ); 643 mDetails->setAddressee( addr );
644 644
645 if ( !addr.isEmpty() ) { 645 if ( !addr.isEmpty() ) {
646 emit contactSelected( addr.formattedName() ); 646 emit contactSelected( addr.formattedName() );
647 KABC::Picture pic = addr.photo(); 647 KABC::Picture pic = addr.photo();
648 if ( pic.isIntern() ) { 648 if ( pic.isIntern() ) {
649//US emit contactSelected( pic.data() ); 649//US emit contactSelected( pic.data() );
650//US instead use: 650//US instead use:
651 QPixmap px; 651 QPixmap px;
652 if (pic.data().isNull() != true) 652 if (pic.data().isNull() != true)
653 { 653 {
654 px.convertFromImage(pic.data()); 654 px.convertFromImage(pic.data());
655 } 655 }
656 656
657 emit contactSelected( px ); 657 emit contactSelected( px );
658 } 658 }
659 } 659 }
660 660
661 661
662 mExtensionManager->setSelectionChanged(); 662 mExtensionManager->setSelectionChanged();
663 663
664 // update the actions 664 // update the actions
665 bool selected = !uid.isEmpty(); 665 bool selected = !uid.isEmpty();
666 666
667 if ( mReadWrite ) { 667 if ( mReadWrite ) {
668 mActionCut->setEnabled( selected ); 668 mActionCut->setEnabled( selected );
669 mActionPaste->setEnabled( selected ); 669 mActionPaste->setEnabled( selected );
670 } 670 }
671 671
672 mActionCopy->setEnabled( selected ); 672 mActionCopy->setEnabled( selected );
673 mActionDelete->setEnabled( selected ); 673 mActionDelete->setEnabled( selected );
674 mActionEditAddressee->setEnabled( selected ); 674 mActionEditAddressee->setEnabled( selected );
675 mActionMail->setEnabled( selected ); 675 mActionMail->setEnabled( selected );
676 mActionMailVCard->setEnabled( selected ); 676 mActionMailVCard->setEnabled( selected );
677 //if (mActionBeam) 677 //if (mActionBeam)
678 //mActionBeam->setEnabled( selected ); 678 //mActionBeam->setEnabled( selected );
679 679
680 if (mActionBeamVCard) 680 if (mActionBeamVCard)
681 mActionBeamVCard->setEnabled( selected ); 681 mActionBeamVCard->setEnabled( selected );
682 682
683 mActionWhoAmI->setEnabled( selected ); 683 mActionWhoAmI->setEnabled( selected );
684} 684}
685 685
686void KABCore::sendMail() 686void KABCore::sendMail()
687{ 687{
688 sendMail( mViewManager->selectedEmails().join( ", " ) ); 688 sendMail( mViewManager->selectedEmails().join( ", " ) );
689} 689}
690 690
691void KABCore::sendMail( const QString& emaillist ) 691void KABCore::sendMail( const QString& emaillist )
692{ 692{
693 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 693 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
694 if (emaillist.contains(",") > 0) 694 if (emaillist.contains(",") > 0)
695 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 695 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
696 else 696 else
697 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 697 ExternalAppHandler::instance()->mailToOneContact( emaillist );
698} 698}
699 699
700 700
701 701
702void KABCore::mailVCard() 702void KABCore::mailVCard()
703{ 703{
704 QStringList uids = mViewManager->selectedUids(); 704 QStringList uids = mViewManager->selectedUids();
705 if ( !uids.isEmpty() ) 705 if ( !uids.isEmpty() )
706 mailVCard( uids ); 706 mailVCard( uids );
707} 707}
708 708
709void KABCore::mailVCard( const QStringList& uids ) 709void KABCore::mailVCard( const QStringList& uids )
710{ 710{
711 QStringList urls; 711 QStringList urls;
712 712
713// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 713// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
714 714
715 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 715 QString dirName = "/tmp/" + KApplication::randomString( 8 );
716 716
717 717
718 718
719 QDir().mkdir( dirName, true ); 719 QDir().mkdir( dirName, true );
720 720
721 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 721 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
722 KABC::Addressee a = mAddressBook->findByUid( *it ); 722 KABC::Addressee a = mAddressBook->findByUid( *it );
723 723
724 if ( a.isEmpty() ) 724 if ( a.isEmpty() )
725 continue; 725 continue;
726 726
727 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 727 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
728 728
729 QString fileName = dirName + "/" + name; 729 QString fileName = dirName + "/" + name;
730 730
731 QFile outFile(fileName); 731 QFile outFile(fileName);
732 732
733 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 733 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
734 KABC::VCardConverter converter; 734 KABC::VCardConverter converter;
735 QString vcard; 735 QString vcard;
736 736
737 converter.addresseeToVCard( a, vcard ); 737 converter.addresseeToVCard( a, vcard );
738 738
739 QTextStream t( &outFile ); // use a text stream 739 QTextStream t( &outFile ); // use a text stream
740 t.setEncoding( QTextStream::UnicodeUTF8 ); 740 t.setEncoding( QTextStream::UnicodeUTF8 );
741 t << vcard; 741 t << vcard;
742 742
743 outFile.close(); 743 outFile.close();
744 744
745 urls.append( fileName ); 745 urls.append( fileName );
746 } 746 }
747 } 747 }
748 748
749 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 749 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
750 750
751 751
752/*US 752/*US
753 kapp->invokeMailer( QString::null, QString::null, QString::null, 753 kapp->invokeMailer( QString::null, QString::null, QString::null,
754 QString::null, // subject 754 QString::null, // subject
755 QString::null, // body 755 QString::null, // body
756 QString::null, 756 QString::null,
757 urls ); // attachments 757 urls ); // attachments
758*/ 758*/
759 759
760} 760}
761 761
762/** 762/**
763 Beams the "WhoAmI contact. 763 Beams the "WhoAmI contact.
764*/ 764*/
765void KABCore::beamMySelf() 765void KABCore::beamMySelf()
766{ 766{
767 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 767 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
768 if (!a.isEmpty()) 768 if (!a.isEmpty())
769 { 769 {
770 QStringList uids; 770 QStringList uids;
771 uids << a.uid(); 771 uids << a.uid();
772 772
773 beamVCard(uids); 773 beamVCard(uids);
774 } else { 774 } else {
775 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 775 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
776 776
777 777
778 } 778 }
779} 779}
780void KABCore::updateMainWindow()
781{
782
783 mMainWindow->showMaximized();
784 mMainWindow->update();
785}
780void KABCore::resizeEvent(QResizeEvent* e ) 786void KABCore::resizeEvent(QResizeEvent* e )
781{ 787{
782 if ( !mMiniSplitter ) 788 if ( !mMiniSplitter )
783 return; 789 return;
784 if ( QApplication::desktop()->width() >= 480 ) { 790 if ( QApplication::desktop()->width() >= 480 ) {
785 int fac = QApplication::desktop()->width()/QApplication::desktop()->height(); 791 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
786 if ( fac > 0 ) { // e.g. 640x480
787 if ( mMiniSplitter->orientation() == Qt::Vertical ) { 792 if ( mMiniSplitter->orientation() == Qt::Vertical ) {
788 mMiniSplitter->setOrientation( Qt::Horizontal); 793 mMiniSplitter->setOrientation( Qt::Horizontal);
789 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 794 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
790 if ( QApplication::desktop()->width() <= 640 ) 795 if ( QApplication::desktop()->width() <= 640 ) {
791 topLevelWidget()->showMaximized(); 796 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
797 mViewManager->getFilterAction()->setComboWidth( 150 );
798 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
799 }
792 } 800 }
793 } else {// e.g. 480x640 801 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
794 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { 802 if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
795 mMiniSplitter->setOrientation( Qt::Vertical ); 803 mMiniSplitter->setOrientation( Qt::Vertical );
796 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 804 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
797 if ( QApplication::desktop()->width() <= 640 ) 805 if ( QApplication::desktop()->width() <= 640 ) {
798 topLevelWidget()->showMaximized(); 806 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
807 mMainWindow->showMinimized();
808 mViewManager->getFilterAction()->setComboWidth( 0 );
809 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
810 }
799 } 811 }
800 } 812 }
801 } 813 }
802 814
803} 815}
804void KABCore::export2phone() 816void KABCore::export2phone()
805{ 817{
806 818
807 QStringList uids; 819 QStringList uids;
808 XXPortSelectDialog dlg( this, false, this ); 820 XXPortSelectDialog dlg( this, false, this );
809 if ( dlg.exec() ) 821 if ( dlg.exec() )
810 uids = dlg.uids(); 822 uids = dlg.uids();
811 else 823 else
812 return; 824 return;
813 if ( uids.isEmpty() ) 825 if ( uids.isEmpty() )
814 return; 826 return;
815 // qDebug("count %d ", uids.count()); 827 // qDebug("count %d ", uids.count());
816 828
817 KAex2phonePrefs ex2phone; 829 KAex2phonePrefs ex2phone;
818 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 830 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
819 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 831 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
820 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 832 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
821 833
822 if ( !ex2phone.exec() ) { 834 if ( !ex2phone.exec() ) {
823 return; 835 return;
824 } 836 }
825 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 837 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
826 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 838 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
827 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 839 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
828 840
829 841
830 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 842 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
831 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 843 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
832 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 844 KPimGlobalPrefs::instance()->mEx2PhoneModel );
833 845
834 QString fileName = getPhoneFile(); 846 QString fileName = getPhoneFile();
835 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 847 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
836 return; 848 return;
837 849
838 message(i18n("Exporting to phone...")); 850 message(i18n("Exporting to phone..."));
839 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 851 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
840 852
841} 853}
842QString KABCore::getPhoneFile() 854QString KABCore::getPhoneFile()
843{ 855{
844#ifdef DESKTOP_VERSION 856#ifdef DESKTOP_VERSION
845 return locateLocal("tmp", "phonefile.vcf"); 857 return locateLocal("tmp", "phonefile.vcf");
846#else 858#else
847 return "/tmp/phonefile.vcf"; 859 return "/tmp/phonefile.vcf";
848#endif 860#endif
849 861
850} 862}
851void KABCore::writeToPhone( ) 863void KABCore::writeToPhone( )
852{ 864{
853 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 865 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
854 message(i18n("Export to phone finished!")); 866 message(i18n("Export to phone finished!"));
855 else 867 else
856 qDebug(i18n("Error exporting to phone")); 868 qDebug(i18n("Error exporting to phone"));
857} 869}
858void KABCore::beamVCard() 870void KABCore::beamVCard()
859{ 871{
860 QStringList uids = mViewManager->selectedUids(); 872 QStringList uids = mViewManager->selectedUids();
861 if ( !uids.isEmpty() ) 873 if ( !uids.isEmpty() )
862 beamVCard( uids ); 874 beamVCard( uids );
863} 875}
864 876
865 877
866void KABCore::beamVCard(const QStringList& uids) 878void KABCore::beamVCard(const QStringList& uids)
867{ 879{
868 880
869 // LR: we should use the /tmp dir on the Zaurus, 881 // LR: we should use the /tmp dir on the Zaurus,
870 // because: /tmp = RAM, (HOME)/kdepim = flash memory 882 // because: /tmp = RAM, (HOME)/kdepim = flash memory
871 883
872#ifdef DESKTOP_VERSION 884#ifdef DESKTOP_VERSION
873 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 885 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
874#else 886#else
875 QString fileName = "/tmp/kapibeamfile.vcf"; 887 QString fileName = "/tmp/kapibeamfile.vcf";
876#endif 888#endif
877 889
878 KABC::VCardConverter converter; 890 KABC::VCardConverter converter;
879 QString description; 891 QString description;
880 QString datastream; 892 QString datastream;
881 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 893 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
882 KABC::Addressee a = mAddressBook->findByUid( *it ); 894 KABC::Addressee a = mAddressBook->findByUid( *it );
883 895
884 if ( a.isEmpty() ) 896 if ( a.isEmpty() )
885 continue; 897 continue;
886 898
887 if (description.isEmpty()) 899 if (description.isEmpty())
888 description = a.formattedName(); 900 description = a.formattedName();
889 901
890 QString vcard; 902 QString vcard;
891 converter.addresseeToVCard( a, vcard ); 903 converter.addresseeToVCard( a, vcard );
892 int start = 0; 904 int start = 0;
893 int next; 905 int next;
894 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 906 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
895 int semi = vcard.find(";", next); 907 int semi = vcard.find(";", next);
896 int dopp = vcard.find(":", next); 908 int dopp = vcard.find(":", next);
897 int sep; 909 int sep;
898 if ( semi < dopp && semi >= 0 ) 910 if ( semi < dopp && semi >= 0 )
899 sep = semi ; 911 sep = semi ;
900 else 912 else
901 sep = dopp; 913 sep = dopp;
902 datastream +=vcard.mid( start, next - start); 914 datastream +=vcard.mid( start, next - start);
903 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 915 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
904 start = sep; 916 start = sep;
905 } 917 }
906 datastream += vcard.mid( start,vcard.length() ); 918 datastream += vcard.mid( start,vcard.length() );
907 } 919 }
908#ifndef DESKTOP_VERSION 920#ifndef DESKTOP_VERSION
909 QFile outFile(fileName); 921 QFile outFile(fileName);
910 if ( outFile.open(IO_WriteOnly) ) { 922 if ( outFile.open(IO_WriteOnly) ) {
911 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 923 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
912 QTextStream t( &outFile ); // use a text stream 924 QTextStream t( &outFile ); // use a text stream
913 //t.setEncoding( QTextStream::UnicodeUTF8 ); 925 //t.setEncoding( QTextStream::UnicodeUTF8 );
914 t.setEncoding( QTextStream::Latin1 ); 926 t.setEncoding( QTextStream::Latin1 );
915 t <<datastream.latin1(); 927 t <<datastream.latin1();
916 outFile.close(); 928 outFile.close();
917 Ir *ir = new Ir( this ); 929 Ir *ir = new Ir( this );
918 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 930 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
919 ir->send( fileName, description, "text/x-vCard" ); 931 ir->send( fileName, description, "text/x-vCard" );
920 } else { 932 } else {
921 qDebug("Error open temp beam file "); 933 qDebug("Error open temp beam file ");
922 return; 934 return;
923 } 935 }
924#endif 936#endif
925 937
926} 938}
927 939
928void KABCore::beamDone( Ir *ir ) 940void KABCore::beamDone( Ir *ir )
929{ 941{
930#ifndef DESKTOP_VERSION 942#ifndef DESKTOP_VERSION
931 delete ir; 943 delete ir;
932#endif 944#endif
933 topLevelWidget()->raise(); 945 topLevelWidget()->raise();
934 message( i18n("Beaming finished!") ); 946 message( i18n("Beaming finished!") );
935} 947}
936 948
937 949
938void KABCore::browse( const QString& url ) 950void KABCore::browse( const QString& url )
939{ 951{
940#ifndef KAB_EMBEDDED 952#ifndef KAB_EMBEDDED
941 kapp->invokeBrowser( url ); 953 kapp->invokeBrowser( url );
942#else //KAB_EMBEDDED 954#else //KAB_EMBEDDED
943 qDebug("KABCore::browse must be fixed"); 955 qDebug("KABCore::browse must be fixed");
944#endif //KAB_EMBEDDED 956#endif //KAB_EMBEDDED
945} 957}
946 958
947void KABCore::selectAllContacts() 959void KABCore::selectAllContacts()
948{ 960{
949 mViewManager->setSelected( QString::null, true ); 961 mViewManager->setSelected( QString::null, true );
950} 962}
951 963
952void KABCore::deleteContacts() 964void KABCore::deleteContacts()
953{ 965{
954 QStringList uidList = mViewManager->selectedUids(); 966 QStringList uidList = mViewManager->selectedUids();
955 deleteContacts( uidList ); 967 deleteContacts( uidList );
956} 968}
957 969
958void KABCore::deleteContacts( const QStringList &uids ) 970void KABCore::deleteContacts( const QStringList &uids )
959{ 971{
960 if ( uids.count() > 0 ) { 972 if ( uids.count() > 0 ) {
961 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 973 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
962 UndoStack::instance()->push( command ); 974 UndoStack::instance()->push( command );
963 RedoStack::instance()->clear(); 975 RedoStack::instance()->clear();
964 976
965 // now if we deleted anything, refresh 977 // now if we deleted anything, refresh
966 setContactSelected( QString::null ); 978 setContactSelected( QString::null );
967 setModified( true ); 979 setModified( true );
968 } 980 }
969} 981}
970 982
971void KABCore::copyContacts() 983void KABCore::copyContacts()
972{ 984{
973 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 985 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
974 986
975 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 987 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
976 988
977 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 989 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
978 990
979 QClipboard *cb = QApplication::clipboard(); 991 QClipboard *cb = QApplication::clipboard();
980 cb->setText( clipText ); 992 cb->setText( clipText );
981} 993}
982 994
983void KABCore::cutContacts() 995void KABCore::cutContacts()
984{ 996{
985 QStringList uidList = mViewManager->selectedUids(); 997 QStringList uidList = mViewManager->selectedUids();
986 998
987//US if ( uidList.size() > 0 ) { 999//US if ( uidList.size() > 0 ) {
988 if ( uidList.count() > 0 ) { 1000 if ( uidList.count() > 0 ) {
989 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 1001 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
990 UndoStack::instance()->push( command ); 1002 UndoStack::instance()->push( command );
991 RedoStack::instance()->clear(); 1003 RedoStack::instance()->clear();
992 1004
993 setModified( true ); 1005 setModified( true );
994 } 1006 }
995} 1007}
996 1008
997void KABCore::pasteContacts() 1009void KABCore::pasteContacts()
998{ 1010{
999 QClipboard *cb = QApplication::clipboard(); 1011 QClipboard *cb = QApplication::clipboard();
1000 1012
1001 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 1013 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
1002 1014
1003 pasteContacts( list ); 1015 pasteContacts( list );
1004} 1016}
1005 1017
1006void KABCore::pasteContacts( KABC::Addressee::List &list ) 1018void KABCore::pasteContacts( KABC::Addressee::List &list )
1007{ 1019{
1008 KABC::Resource *resource = requestResource( this ); 1020 KABC::Resource *resource = requestResource( this );
1009 KABC::Addressee::List::Iterator it; 1021 KABC::Addressee::List::Iterator it;
1010 for ( it = list.begin(); it != list.end(); ++it ) 1022 for ( it = list.begin(); it != list.end(); ++it )
1011 (*it).setResource( resource ); 1023 (*it).setResource( resource );
1012 1024
1013 PwPasteCommand *command = new PwPasteCommand( this, list ); 1025 PwPasteCommand *command = new PwPasteCommand( this, list );
1014 UndoStack::instance()->push( command ); 1026 UndoStack::instance()->push( command );
1015 RedoStack::instance()->clear(); 1027 RedoStack::instance()->clear();
1016 1028
1017 setModified( true ); 1029 setModified( true );
1018} 1030}
1019 1031
1020void KABCore::setWhoAmI() 1032void KABCore::setWhoAmI()
1021{ 1033{
1022 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1034 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1023 1035
1024 if ( addrList.count() > 1 ) { 1036 if ( addrList.count() > 1 ) {
1025 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 1037 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
1026 return; 1038 return;
1027 } 1039 }
1028 1040
1029 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 1041 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
1030 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 1042 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
1031 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 1043 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
1032} 1044}
1033void KABCore::editCategories() 1045void KABCore::editCategories()
1034{ 1046{
1035 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); 1047 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1036 dlg.exec(); 1048 dlg.exec();
1037} 1049}
1038void KABCore::setCategories() 1050void KABCore::setCategories()
1039{ 1051{
1040 1052
1041 QStringList uids; 1053 QStringList uids;
1042 XXPortSelectDialog dlgx( this, false, this ); 1054 XXPortSelectDialog dlgx( this, false, this );
1043 if ( dlgx.exec() ) 1055 if ( dlgx.exec() )
1044 uids = dlgx.uids(); 1056 uids = dlgx.uids();
1045 else 1057 else
1046 return; 1058 return;
1047 if ( uids.isEmpty() ) 1059 if ( uids.isEmpty() )
1048 return; 1060 return;
1049 // qDebug("count %d ", uids.count()); 1061 // qDebug("count %d ", uids.count());
1050 1062
1051 1063
1052 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1064 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
1053 if ( !dlg.exec() ) { 1065 if ( !dlg.exec() ) {
1054 message( i18n("Setting categories cancelled") ); 1066 message( i18n("Setting categories cancelled") );
1055 return; 1067 return;
1056 } 1068 }
1057 bool merge = false; 1069 bool merge = false;
1058 QString msg = i18n( "Merge with existing categories?" ); 1070 QString msg = i18n( "Merge with existing categories?" );
1059 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 1071 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
1060 merge = true; 1072 merge = true;
1061 1073
1062 message( i18n("Setting categories ... please wait!") ); 1074 message( i18n("Setting categories ... please wait!") );
1063 QStringList categories = dlg.selectedCategories(); 1075 QStringList categories = dlg.selectedCategories();
1064 1076
1065 //QStringList uids = mViewManager->selectedUids(); 1077 //QStringList uids = mViewManager->selectedUids();
1066 QStringList::Iterator it; 1078 QStringList::Iterator it;
1067 for ( it = uids.begin(); it != uids.end(); ++it ) { 1079 for ( it = uids.begin(); it != uids.end(); ++it ) {
1068 KABC::Addressee addr = mAddressBook->findByUid( *it ); 1080 KABC::Addressee addr = mAddressBook->findByUid( *it );
1069 if ( !addr.isEmpty() ) { 1081 if ( !addr.isEmpty() ) {
1070 if ( !merge ) 1082 if ( !merge )
1071 addr.setCategories( categories ); 1083 addr.setCategories( categories );
1072 else { 1084 else {
1073 QStringList addrCategories = addr.categories(); 1085 QStringList addrCategories = addr.categories();
1074 QStringList::Iterator catIt; 1086 QStringList::Iterator catIt;
1075 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 1087 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
1076 if ( !addrCategories.contains( *catIt ) ) 1088 if ( !addrCategories.contains( *catIt ) )
1077 addrCategories.append( *catIt ); 1089 addrCategories.append( *catIt );
1078 } 1090 }
1079 addr.setCategories( addrCategories ); 1091 addr.setCategories( addrCategories );
1080 } 1092 }
1081 mAddressBook->insertAddressee( addr ); 1093 mAddressBook->insertAddressee( addr );
1082 } 1094 }
1083 } 1095 }
1084 1096
1085 if ( uids.count() > 0 ) 1097 if ( uids.count() > 0 )
1086 setModified( true ); 1098 setModified( true );
1087 message( i18n("Setting categories completed!") ); 1099 message( i18n("Setting categories completed!") );
1088} 1100}
1089 1101
1090void KABCore::setSearchFields( const KABC::Field::List &fields ) 1102void KABCore::setSearchFields( const KABC::Field::List &fields )
1091{ 1103{
1092 mIncSearchWidget->setFields( fields ); 1104 mIncSearchWidget->setFields( fields );
1093} 1105}
1094 1106
1095void KABCore::incrementalSearch( const QString& text ) 1107void KABCore::incrementalSearch( const QString& text )
1096{ 1108{
1097 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1109 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1098} 1110}
1099 1111
1100void KABCore::setModified() 1112void KABCore::setModified()
1101{ 1113{
1102 setModified( true ); 1114 setModified( true );
1103} 1115}
1104 1116
1105void KABCore::setModifiedWOrefresh() 1117void KABCore::setModifiedWOrefresh()
1106{ 1118{
1107 // qDebug("KABCore::setModifiedWOrefresh() "); 1119 // qDebug("KABCore::setModifiedWOrefresh() ");
1108 mModified = true; 1120 mModified = true;
1109 mActionSave->setEnabled( mModified ); 1121 mActionSave->setEnabled( mModified );
1110#ifdef DESKTOP_VERSION 1122#ifdef DESKTOP_VERSION
1111 mDetails->refreshView(); 1123 mDetails->refreshView();
1112#endif 1124#endif
1113 1125
1114} 1126}
1115void KABCore::setModified( bool modified ) 1127void KABCore::setModified( bool modified )
1116{ 1128{
1117 mModified = modified; 1129 mModified = modified;
1118 mActionSave->setEnabled( mModified ); 1130 mActionSave->setEnabled( mModified );
1119 1131
1120 if ( modified ) 1132 if ( modified )
1121 mJumpButtonBar->recreateButtons(); 1133 mJumpButtonBar->recreateButtons();
1122 1134
1123 mViewManager->refreshView(); 1135 mViewManager->refreshView();
1124 mDetails->refreshView(); 1136 mDetails->refreshView();
1125 1137
1126} 1138}
1127 1139
1128bool KABCore::modified() const 1140bool KABCore::modified() const
1129{ 1141{
1130 return mModified; 1142 return mModified;
1131} 1143}
1132 1144
1133void KABCore::contactModified( const KABC::Addressee &addr ) 1145void KABCore::contactModified( const KABC::Addressee &addr )
1134{ 1146{
1135 1147
1136 Command *command = 0; 1148 Command *command = 0;
1137 QString uid; 1149 QString uid;
1138 1150
1139 // check if it exists already 1151 // check if it exists already
1140 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1152 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1141 if ( origAddr.isEmpty() ) 1153 if ( origAddr.isEmpty() )
1142 command = new PwNewCommand( mAddressBook, addr ); 1154 command = new PwNewCommand( mAddressBook, addr );
1143 else { 1155 else {
1144 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1156 command = new PwEditCommand( mAddressBook, origAddr, addr );
1145 uid = addr.uid(); 1157 uid = addr.uid();
1146 } 1158 }
1147 1159
1148 UndoStack::instance()->push( command ); 1160 UndoStack::instance()->push( command );
1149 RedoStack::instance()->clear(); 1161 RedoStack::instance()->clear();
1150 1162
1151 setModified( true ); 1163 setModified( true );
1152} 1164}
1153 1165
1154void KABCore::newContact() 1166void KABCore::newContact()
1155{ 1167{
1156 1168
1157 1169
1158 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1170 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1159 1171
1160 QPtrList<KRES::Resource> kresResources; 1172 QPtrList<KRES::Resource> kresResources;
1161 QPtrListIterator<KABC::Resource> it( kabcResources ); 1173 QPtrListIterator<KABC::Resource> it( kabcResources );
1162 KABC::Resource *resource; 1174 KABC::Resource *resource;
1163 while ( ( resource = it.current() ) != 0 ) { 1175 while ( ( resource = it.current() ) != 0 ) {
1164 ++it; 1176 ++it;
1165 if ( !resource->readOnly() ) { 1177 if ( !resource->readOnly() ) {
1166 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1178 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1167 if ( res ) 1179 if ( res )
1168 kresResources.append( res ); 1180 kresResources.append( res );
1169 } 1181 }
1170 } 1182 }
1171 1183
1172 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1184 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1173 resource = static_cast<KABC::Resource*>( res ); 1185 resource = static_cast<KABC::Resource*>( res );
1174 1186
1175 if ( resource ) { 1187 if ( resource ) {
1176 KABC::Addressee addr; 1188 KABC::Addressee addr;
1177 addr.setResource( resource ); 1189 addr.setResource( resource );
1178 mEditorDialog->setAddressee( addr ); 1190 mEditorDialog->setAddressee( addr );
1179 KApplication::execDialog ( mEditorDialog ); 1191 KApplication::execDialog ( mEditorDialog );
1180 1192
1181 } else 1193 } else
1182 return; 1194 return;
1183 1195
1184 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1196 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1185 1197
1186 1198
1187} 1199}
1188 1200
1189void KABCore::addEmail( QString aStr ) 1201void KABCore::addEmail( QString aStr )
1190{ 1202{
1191#ifndef KAB_EMBEDDED 1203#ifndef KAB_EMBEDDED
1192 QString fullName, email; 1204 QString fullName, email;
1193 1205
1194 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1206 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1195 1207
1196 // Try to lookup the addressee matching the email address 1208 // Try to lookup the addressee matching the email address
1197 bool found = false; 1209 bool found = false;
1198 QStringList emailList; 1210 QStringList emailList;
1199 KABC::AddressBook::Iterator it; 1211 KABC::AddressBook::Iterator it;
1200 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1212 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1201 emailList = (*it).emails(); 1213 emailList = (*it).emails();
1202 if ( emailList.contains( email ) > 0 ) { 1214 if ( emailList.contains( email ) > 0 ) {
1203 found = true; 1215 found = true;
1204 (*it).setNameFromString( fullName ); 1216 (*it).setNameFromString( fullName );
1205 editContact( (*it).uid() ); 1217 editContact( (*it).uid() );
1206 } 1218 }
1207 } 1219 }
1208 1220
1209 if ( !found ) { 1221 if ( !found ) {
1210 KABC::Addressee addr; 1222 KABC::Addressee addr;
1211 addr.setNameFromString( fullName ); 1223 addr.setNameFromString( fullName );
1212 addr.insertEmail( email, true ); 1224 addr.insertEmail( email, true );
1213 1225
1214 mAddressBook->insertAddressee( addr ); 1226 mAddressBook->insertAddressee( addr );
1215 mViewManager->refreshView( addr.uid() ); 1227 mViewManager->refreshView( addr.uid() );
1216 editContact( addr.uid() ); 1228 editContact( addr.uid() );
1217 } 1229 }
1218#else //KAB_EMBEDDED 1230#else //KAB_EMBEDDED
1219 qDebug("KABCore::addEmail finsih method"); 1231 qDebug("KABCore::addEmail finsih method");
1220#endif //KAB_EMBEDDED 1232#endif //KAB_EMBEDDED
1221} 1233}
1222 1234
1223void KABCore::importVCard( const KURL &url, bool showPreview ) 1235void KABCore::importVCard( const KURL &url, bool showPreview )
1224{ 1236{
1225 mXXPortManager->importVCard( url, showPreview ); 1237 mXXPortManager->importVCard( url, showPreview );
1226} 1238}
1227void KABCore::importFromOL() 1239void KABCore::importFromOL()
1228{ 1240{
1229#ifdef _WIN32_ 1241#ifdef _WIN32_
1230 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1242 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1231 idgl->exec(); 1243 idgl->exec();
1232 KABC::Addressee::List list = idgl->getAddressList(); 1244 KABC::Addressee::List list = idgl->getAddressList();
1233 if ( list.count() > 0 ) { 1245 if ( list.count() > 0 ) {
1234 KABC::Addressee::List listNew; 1246 KABC::Addressee::List listNew;
1235 KABC::Addressee::List listExisting; 1247 KABC::Addressee::List listExisting;
1236 KABC::Addressee::List::Iterator it; 1248 KABC::Addressee::List::Iterator it;
1237 KABC::AddressBook::Iterator iter; 1249 KABC::AddressBook::Iterator iter;
1238 for ( it = list.begin(); it != list.end(); ++it ) { 1250 for ( it = list.begin(); it != list.end(); ++it ) {
1239 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1251 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1240 listNew.append( (*it) ); 1252 listNew.append( (*it) );
1241 else 1253 else
1242 listExisting.append( (*it) ); 1254 listExisting.append( (*it) );
1243 } 1255 }
1244 if ( listExisting.count() > 0 ) 1256 if ( listExisting.count() > 0 )
1245 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1257 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1246 if ( listNew.count() > 0 ) { 1258 if ( listNew.count() > 0 ) {
1247 pasteWithNewUid = false; 1259 pasteWithNewUid = false;
1248 pasteContacts( listNew ); 1260 pasteContacts( listNew );
1249 pasteWithNewUid = true; 1261 pasteWithNewUid = true;
1250 } 1262 }
1251 } 1263 }
1252 delete idgl; 1264 delete idgl;
1253#endif 1265#endif
1254} 1266}
1255 1267
1256void KABCore::importVCard( const QString &vCard, bool showPreview ) 1268void KABCore::importVCard( const QString &vCard, bool showPreview )
1257{ 1269{
1258 mXXPortManager->importVCard( vCard, showPreview ); 1270 mXXPortManager->importVCard( vCard, showPreview );
1259} 1271}
1260 1272
1261//US added a second method without defaultparameter 1273//US added a second method without defaultparameter
1262void KABCore::editContact2() { 1274void KABCore::editContact2() {
1263 editContact( QString::null ); 1275 editContact( QString::null );
1264} 1276}
1265 1277
1266void KABCore::editContact( const QString &uid ) 1278void KABCore::editContact( const QString &uid )
1267{ 1279{
1268 1280
1269 if ( mExtensionManager->isQuickEditVisible() ) 1281 if ( mExtensionManager->isQuickEditVisible() )
1270 return; 1282 return;
1271 1283
1272 // First, locate the contact entry 1284 // First, locate the contact entry
1273 QString localUID = uid; 1285 QString localUID = uid;
1274 if ( localUID.isNull() ) { 1286 if ( localUID.isNull() ) {
1275 QStringList uidList = mViewManager->selectedUids(); 1287 QStringList uidList = mViewManager->selectedUids();
1276 if ( uidList.count() > 0 ) 1288 if ( uidList.count() > 0 )
1277 localUID = *( uidList.at( 0 ) ); 1289 localUID = *( uidList.at( 0 ) );
1278 } 1290 }
1279 1291
1280 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1292 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1281 if ( !addr.isEmpty() ) { 1293 if ( !addr.isEmpty() ) {
1282 mEditorDialog->setAddressee( addr ); 1294 mEditorDialog->setAddressee( addr );
1283 KApplication::execDialog ( mEditorDialog ); 1295 KApplication::execDialog ( mEditorDialog );
1284 } 1296 }
1285} 1297}
1286 1298
1287/** 1299/**
1288 Shows or edits the detail view for the given uid. If the uid is QString::null, 1300 Shows or edits the detail view for the given uid. If the uid is QString::null,
1289 the method will try to find a selected addressee in the view. 1301 the method will try to find a selected addressee in the view.
1290 */ 1302 */
1291void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1303void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1292{ 1304{
1293 if ( mMultipleViewsAtOnce ) 1305 if ( mMultipleViewsAtOnce )
1294 { 1306 {
1295 editContact( uid ); 1307 editContact( uid );
1296 } 1308 }
1297 else 1309 else
1298 { 1310 {
1299 setDetailsVisible( true ); 1311 setDetailsVisible( true );
1300 mActionDetails->setChecked(true); 1312 mActionDetails->setChecked(true);
1301 } 1313 }
1302 1314
1303} 1315}
1304 1316
1305void KABCore::save() 1317void KABCore::save()
1306{ 1318{
1307 if (syncManager->blockSave()) 1319 if (syncManager->blockSave())
1308 return; 1320 return;
1309 if ( !mModified ) 1321 if ( !mModified )
1310 return; 1322 return;
1311 1323
1312 syncManager->setBlockSave(true); 1324 syncManager->setBlockSave(true);
1313 QString text = i18n( "There was an error while attempting to save\n the " 1325 QString text = i18n( "There was an error while attempting to save\n the "
1314 "address book. Please check that some \nother application is " 1326 "address book. Please check that some \nother application is "
1315 "not using it. " ); 1327 "not using it. " );
1316 message(i18n("Saving addressbook ... ")); 1328 message(i18n("Saving addressbook ... "));
1317#ifndef KAB_EMBEDDED 1329#ifndef KAB_EMBEDDED
1318 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1330 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1319 if ( !b || !b->save() ) { 1331 if ( !b || !b->save() ) {
1320 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1332 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1321 } 1333 }
1322#else //KAB_EMBEDDED 1334#else //KAB_EMBEDDED
1323 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1335 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1324 if ( !b || !b->save() ) { 1336 if ( !b || !b->save() ) {
1325 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1337 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1326 } 1338 }
1327#endif //KAB_EMBEDDED 1339#endif //KAB_EMBEDDED
1328 1340
1329 message(i18n("Addressbook saved!")); 1341 message(i18n("Addressbook saved!"));
1330 setModified( false ); 1342 setModified( false );
1331 syncManager->setBlockSave(false); 1343 syncManager->setBlockSave(false);
1332} 1344}
1333 1345
1334 1346
1335void KABCore::undo() 1347void KABCore::undo()
1336{ 1348{
1337 UndoStack::instance()->undo(); 1349 UndoStack::instance()->undo();
1338 1350
1339 // Refresh the view 1351 // Refresh the view
1340 mViewManager->refreshView(); 1352 mViewManager->refreshView();
1341} 1353}
1342 1354
1343void KABCore::redo() 1355void KABCore::redo()
1344{ 1356{
1345 RedoStack::instance()->redo(); 1357 RedoStack::instance()->redo();
1346 1358
1347 // Refresh the view 1359 // Refresh the view
1348 mViewManager->refreshView(); 1360 mViewManager->refreshView();
1349} 1361}
1350 1362
1351void KABCore::setJumpButtonBarVisible( bool visible ) 1363void KABCore::setJumpButtonBarVisible( bool visible )
1352{ 1364{
1353 if (mMultipleViewsAtOnce) 1365 if (mMultipleViewsAtOnce)
1354 { 1366 {
1355 if ( visible ) 1367 if ( visible )
1356 mJumpButtonBar->show(); 1368 mJumpButtonBar->show();
1357 else 1369 else
1358 mJumpButtonBar->hide(); 1370 mJumpButtonBar->hide();
1359 } 1371 }
1360 else 1372 else
1361 { 1373 {
1362 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1374 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1363 if (mViewManager->isVisible()) 1375 if (mViewManager->isVisible())
1364 { 1376 {
1365 if ( visible ) 1377 if ( visible )
1366 mJumpButtonBar->show(); 1378 mJumpButtonBar->show();
1367 else 1379 else
1368 mJumpButtonBar->hide(); 1380 mJumpButtonBar->hide();
1369 } 1381 }
1370 else 1382 else
1371 { 1383 {
1372 mJumpButtonBar->hide(); 1384 mJumpButtonBar->hide();
1373 } 1385 }
1374 } 1386 }
1375} 1387}
1376 1388
1377 1389
1378void KABCore::setDetailsToState() 1390void KABCore::setDetailsToState()
1379{ 1391{
1380 setDetailsVisible( mActionDetails->isChecked() ); 1392 setDetailsVisible( mActionDetails->isChecked() );
1381} 1393}
1382void KABCore::setDetailsToggle() 1394void KABCore::setDetailsToggle()
1383{ 1395{
1384 mActionDetails->setChecked( !mActionDetails->isChecked() ); 1396 mActionDetails->setChecked( !mActionDetails->isChecked() );
1385 setDetailsToState(); 1397 setDetailsToState();
1386} 1398}
1387 1399
1388 1400
1389 1401
1390void KABCore::setDetailsVisible( bool visible ) 1402void KABCore::setDetailsVisible( bool visible )
1391{ 1403{
1392 if (visible && mDetails->isHidden()) 1404 if (visible && mDetails->isHidden())
1393 { 1405 {
1394 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1406 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1395 if ( addrList.count() > 0 ) 1407 if ( addrList.count() > 0 )
1396 mDetails->setAddressee( addrList[ 0 ] ); 1408 mDetails->setAddressee( addrList[ 0 ] );
1397 } 1409 }
1398 1410
1399 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1411 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1400 // the listview and the detailview. We do that by changing the splitbar size. 1412 // the listview and the detailview. We do that by changing the splitbar size.
1401 if (mMultipleViewsAtOnce) 1413 if (mMultipleViewsAtOnce)
1402 { 1414 {
1403 if ( visible ) 1415 if ( visible )
1404 mDetails->show(); 1416 mDetails->show();
1405 else 1417 else
1406 mDetails->hide(); 1418 mDetails->hide();
1407 } 1419 }
1408 else 1420 else
1409 { 1421 {
1410 if ( visible ) { 1422 if ( visible ) {
1411 mViewManager->hide(); 1423 mViewManager->hide();
1412 mDetails->show(); 1424 mDetails->show();
1413 mIncSearchWidget->setFocus(); 1425 mIncSearchWidget->setFocus();
1414 } 1426 }
1415 else { 1427 else {
1416 mViewManager->show(); 1428 mViewManager->show();
1417 mDetails->hide(); 1429 mDetails->hide();
1418 mViewManager->setFocusAV(); 1430 mViewManager->setFocusAV();
1419 } 1431 }
1420 setJumpButtonBarVisible( !visible ); 1432 setJumpButtonBarVisible( !visible );
1421 } 1433 }
1422 1434
1423} 1435}
1424 1436
1425void KABCore::extensionChanged( int id ) 1437void KABCore::extensionChanged( int id )
1426{ 1438{
1427 //change the details view only for non desktop systems 1439 //change the details view only for non desktop systems
1428#ifndef DESKTOP_VERSION 1440#ifndef DESKTOP_VERSION
1429 1441
1430 if (id == 0) 1442 if (id == 0)
1431 { 1443 {
1432 //the user disabled the extension. 1444 //the user disabled the extension.
1433 1445
1434 if (mMultipleViewsAtOnce) 1446 if (mMultipleViewsAtOnce)
1435 { // enable detailsview again 1447 { // enable detailsview again
1436 setDetailsVisible( true ); 1448 setDetailsVisible( true );
1437 mActionDetails->setChecked( true ); 1449 mActionDetails->setChecked( true );
1438 } 1450 }
1439 else 1451 else
1440 { //go back to the listview 1452 { //go back to the listview
1441 setDetailsVisible( false ); 1453 setDetailsVisible( false );
1442 mActionDetails->setChecked( false ); 1454 mActionDetails->setChecked( false );
1443 mActionDetails->setEnabled(true); 1455 mActionDetails->setEnabled(true);
1444 } 1456 }
1445 1457
1446 } 1458 }
1447 else 1459 else
1448 { 1460 {
1449 //the user enabled the extension. 1461 //the user enabled the extension.
1450 setDetailsVisible( false ); 1462 setDetailsVisible( false );
1451 mActionDetails->setChecked( false ); 1463 mActionDetails->setChecked( false );
1452 1464
1453 if (!mMultipleViewsAtOnce) 1465 if (!mMultipleViewsAtOnce)
1454 { 1466 {
1455 mActionDetails->setEnabled(false); 1467 mActionDetails->setEnabled(false);
1456 } 1468 }
1457 1469
1458 mExtensionManager->setSelectionChanged(); 1470 mExtensionManager->setSelectionChanged();
1459 1471
1460 } 1472 }
1461 1473
1462#endif// DESKTOP_VERSION 1474#endif// DESKTOP_VERSION
1463 1475
1464} 1476}
1465 1477
1466 1478
1467void KABCore::extensionModified( const KABC::Addressee::List &list ) 1479void KABCore::extensionModified( const KABC::Addressee::List &list )
1468{ 1480{
1469 1481
1470 if ( list.count() != 0 ) { 1482 if ( list.count() != 0 ) {
1471 KABC::Addressee::List::ConstIterator it; 1483 KABC::Addressee::List::ConstIterator it;
1472 for ( it = list.begin(); it != list.end(); ++it ) 1484 for ( it = list.begin(); it != list.end(); ++it )
1473 mAddressBook->insertAddressee( *it ); 1485 mAddressBook->insertAddressee( *it );
1474 if ( list.count() > 1 ) 1486 if ( list.count() > 1 )
1475 setModified(); 1487 setModified();
1476 else 1488 else
1477 setModifiedWOrefresh(); 1489 setModifiedWOrefresh();
1478 } 1490 }
1479 if ( list.count() == 0 ) 1491 if ( list.count() == 0 )
1480 mViewManager->refreshView(); 1492 mViewManager->refreshView();
1481 else 1493 else
1482 mViewManager->refreshView( list[ 0 ].uid() ); 1494 mViewManager->refreshView( list[ 0 ].uid() );
1483 1495
1484 1496
1485 1497
1486} 1498}
1487 1499
1488QString KABCore::getNameByPhone( const QString &phone ) 1500QString KABCore::getNameByPhone( const QString &phone )
1489{ 1501{
1490#ifndef KAB_EMBEDDED 1502#ifndef KAB_EMBEDDED
1491 QRegExp r( "[/*/-/ ]" ); 1503 QRegExp r( "[/*/-/ ]" );
1492 QString localPhone( phone ); 1504 QString localPhone( phone );
1493 1505
1494 bool found = false; 1506 bool found = false;
1495 QString ownerName = ""; 1507 QString ownerName = "";
1496 KABC::AddressBook::Iterator iter; 1508 KABC::AddressBook::Iterator iter;
1497 KABC::PhoneNumber::List::Iterator phoneIter; 1509 KABC::PhoneNumber::List::Iterator phoneIter;
1498 KABC::PhoneNumber::List phoneList; 1510 KABC::PhoneNumber::List phoneList;
1499 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1511 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1500 phoneList = (*iter).phoneNumbers(); 1512 phoneList = (*iter).phoneNumbers();
1501 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1513 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1502 ++phoneIter) { 1514 ++phoneIter) {
1503 // Get rid of separator chars so just the numbers are compared. 1515 // Get rid of separator chars so just the numbers are compared.
1504 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1516 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1505 ownerName = (*iter).formattedName(); 1517 ownerName = (*iter).formattedName();
1506 found = true; 1518 found = true;
1507 } 1519 }
1508 } 1520 }
1509 } 1521 }
1510 1522
1511 return ownerName; 1523 return ownerName;
1512#else //KAB_EMBEDDED 1524#else //KAB_EMBEDDED
1513 qDebug("KABCore::getNameByPhone finsih method"); 1525 qDebug("KABCore::getNameByPhone finsih method");
1514 return ""; 1526 return "";
1515#endif //KAB_EMBEDDED 1527#endif //KAB_EMBEDDED
1516 1528
1517} 1529}
1518 1530
1519void KABCore::openConfigDialog() 1531void KABCore::openConfigDialog()
1520{ 1532{
1521 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1533 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1522 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1534 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1523 ConfigureDialog->addModule(kabcfg ); 1535 ConfigureDialog->addModule(kabcfg );
1524 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 1536 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1525 ConfigureDialog->addModule(kdelibcfg ); 1537 ConfigureDialog->addModule(kdelibcfg );
1526 1538
1527 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1539 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1528 this, SLOT( configurationChanged() ) ); 1540 this, SLOT( configurationChanged() ) );
1529 connect( ConfigureDialog, SIGNAL( okClicked() ), 1541 connect( ConfigureDialog, SIGNAL( okClicked() ),
1530 this, SLOT( configurationChanged() ) ); 1542 this, SLOT( configurationChanged() ) );
1531 saveSettings(); 1543 saveSettings();
1532#ifndef DESKTOP_VERSION 1544#ifndef DESKTOP_VERSION
1533 ConfigureDialog->showMaximized(); 1545 ConfigureDialog->showMaximized();
1534#endif 1546#endif
1535 if ( ConfigureDialog->exec() ) 1547 if ( ConfigureDialog->exec() )
1536 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 1548 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1537 delete ConfigureDialog; 1549 delete ConfigureDialog;
1538} 1550}
1539 1551
1540void KABCore::openLDAPDialog() 1552void KABCore::openLDAPDialog()
1541{ 1553{
1542#ifndef KAB_EMBEDDED 1554#ifndef KAB_EMBEDDED
1543 if ( !mLdapSearchDialog ) { 1555 if ( !mLdapSearchDialog ) {
1544 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1556 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1545 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1557 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1546 SLOT( refreshView() ) ); 1558 SLOT( refreshView() ) );
1547 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1559 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1548 SLOT( setModified() ) ); 1560 SLOT( setModified() ) );
1549 } else 1561 } else
1550 mLdapSearchDialog->restoreSettings(); 1562 mLdapSearchDialog->restoreSettings();
1551 1563
1552 if ( mLdapSearchDialog->isOK() ) 1564 if ( mLdapSearchDialog->isOK() )
1553 mLdapSearchDialog->exec(); 1565 mLdapSearchDialog->exec();
1554#else //KAB_EMBEDDED 1566#else //KAB_EMBEDDED
1555 qDebug("KABCore::openLDAPDialog() finsih method"); 1567 qDebug("KABCore::openLDAPDialog() finsih method");
1556#endif //KAB_EMBEDDED 1568#endif //KAB_EMBEDDED
1557} 1569}
1558 1570
1559void KABCore::print() 1571void KABCore::print()
1560{ 1572{
1561#ifndef KAB_EMBEDDED 1573#ifndef KAB_EMBEDDED
1562 KPrinter printer; 1574 KPrinter printer;
1563 if ( !printer.setup( this ) ) 1575 if ( !printer.setup( this ) )
1564 return; 1576 return;
1565 1577
1566 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1578 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1567 mViewManager->selectedUids(), this ); 1579 mViewManager->selectedUids(), this );
1568 1580
1569 wizard.exec(); 1581 wizard.exec();
1570#else //KAB_EMBEDDED 1582#else //KAB_EMBEDDED
1571 qDebug("KABCore::print() finsih method"); 1583 qDebug("KABCore::print() finsih method");
1572#endif //KAB_EMBEDDED 1584#endif //KAB_EMBEDDED
1573 1585
1574} 1586}
1575 1587
1576 1588
1577void KABCore::addGUIClient( KXMLGUIClient *client ) 1589void KABCore::addGUIClient( KXMLGUIClient *client )
1578{ 1590{
1579 if ( mGUIClient ) 1591 if ( mGUIClient )
1580 mGUIClient->insertChildClient( client ); 1592 mGUIClient->insertChildClient( client );
1581 else 1593 else
1582 KMessageBox::error( this, "no KXMLGUICLient"); 1594 KMessageBox::error( this, "no KXMLGUICLient");
1583} 1595}
1584 1596
1585 1597
1586void KABCore::configurationChanged() 1598void KABCore::configurationChanged()
1587{ 1599{
1588 mExtensionManager->reconfigure(); 1600 mExtensionManager->reconfigure();
1589} 1601}
1590 1602
1591void KABCore::addressBookChanged() 1603void KABCore::addressBookChanged()
1592{ 1604{
1593/*US 1605/*US
1594 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1606 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1595 while ( it.current() ) { 1607 while ( it.current() ) {
1596 if ( it.current()->dirty() ) { 1608 if ( it.current()->dirty() ) {
1597 QString text = i18n( "Data has been changed externally. Unsaved " 1609 QString text = i18n( "Data has been changed externally. Unsaved "
1598 "changes will be lost." ); 1610 "changes will be lost." );
1599 KMessageBox::information( this, text ); 1611 KMessageBox::information( this, text );
1600 } 1612 }
1601 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1613 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1602 ++it; 1614 ++it;
1603 } 1615 }
1604*/ 1616*/
1605 if (mEditorDialog) 1617 if (mEditorDialog)
1606 { 1618 {
1607 if (mEditorDialog->dirty()) 1619 if (mEditorDialog->dirty())
1608 { 1620 {
1609 QString text = i18n( "Data has been changed externally. Unsaved " 1621 QString text = i18n( "Data has been changed externally. Unsaved "
1610 "changes will be lost." ); 1622 "changes will be lost." );
1611 KMessageBox::information( this, text ); 1623 KMessageBox::information( this, text );
1612 } 1624 }
1613 QString currentuid = mEditorDialog->addressee().uid(); 1625 QString currentuid = mEditorDialog->addressee().uid();
1614 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1626 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1615 } 1627 }
1616 mViewManager->refreshView(); 1628 mViewManager->refreshView();
1617// mDetails->refreshView(); 1629// mDetails->refreshView();
1618 1630
1619 1631
1620} 1632}
1621 1633
1622AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1634AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1623 const char *name ) 1635 const char *name )
1624{ 1636{
1625 1637
1626 if ( mEditorDialog == 0 ) { 1638 if ( mEditorDialog == 0 ) {
1627 mEditorDialog = new AddresseeEditorDialog( this, parent, 1639 mEditorDialog = new AddresseeEditorDialog( this, parent,
1628 name ? name : "editorDialog" ); 1640 name ? name : "editorDialog" );
1629 1641
1630 1642
1631 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1643 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1632 SLOT( contactModified( const KABC::Addressee& ) ) ); 1644 SLOT( contactModified( const KABC::Addressee& ) ) );
1633 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1645 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1634 // SLOT( slotEditorDestroyed( const QString& ) ) ; 1646 // SLOT( slotEditorDestroyed( const QString& ) ) ;
1635 } 1647 }
1636 1648
1637 return mEditorDialog; 1649 return mEditorDialog;
1638} 1650}
1639 1651
1640void KABCore::slotEditorDestroyed( const QString &uid ) 1652void KABCore::slotEditorDestroyed( const QString &uid )
1641{ 1653{
1642 //mEditorDict.remove( uid ); 1654 //mEditorDict.remove( uid );
1643} 1655}
1644 1656
1645void KABCore::initGUI() 1657void KABCore::initGUI()
1646{ 1658{
1647#ifndef KAB_EMBEDDED 1659#ifndef KAB_EMBEDDED
1648 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1660 QHBoxLayout *topLayout = new QHBoxLayout( this );
1649 topLayout->setSpacing( KDialogBase::spacingHint() ); 1661 topLayout->setSpacing( KDialogBase::spacingHint() );
1650 1662
1651 mExtensionBarSplitter = new QSplitter( this ); 1663 mExtensionBarSplitter = new QSplitter( this );
1652 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1664 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1653 1665
1654 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1666 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1655 1667
1656 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1668 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1657 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1669 mIncSearchWidget = new IncSearchWidget( viewSpace );
1658 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1670 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1659 SLOT( incrementalSearch( const QString& ) ) ); 1671 SLOT( incrementalSearch( const QString& ) ) );
1660 1672
1661 mViewManager = new ViewManager( this, viewSpace ); 1673 mViewManager = new ViewManager( this, viewSpace );
1662 viewSpace->setStretchFactor( mViewManager, 1 ); 1674 viewSpace->setStretchFactor( mViewManager, 1 );
1663 1675
1664 mDetails = new ViewContainer( mDetailsSplitter ); 1676 mDetails = new ViewContainer( mDetailsSplitter );
1665 1677
1666 mJumpButtonBar = new JumpButtonBar( this, this ); 1678 mJumpButtonBar = new JumpButtonBar( this, this );
1667 1679
1668 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1680 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1669 1681
1670 topLayout->addWidget( mExtensionBarSplitter ); 1682 topLayout->addWidget( mExtensionBarSplitter );
1671 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1683 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1672 topLayout->addWidget( mJumpButtonBar ); 1684 topLayout->addWidget( mJumpButtonBar );
1673 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1685 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1674 1686
1675 mXXPortManager = new XXPortManager( this, this ); 1687 mXXPortManager = new XXPortManager( this, this );
1676 1688
1677#else //KAB_EMBEDDED 1689#else //KAB_EMBEDDED
1678 //US initialize viewMenu before settingup viewmanager. 1690 //US initialize viewMenu before settingup viewmanager.
1679 // Viewmanager needs this menu to plugin submenues. 1691 // Viewmanager needs this menu to plugin submenues.
1680 viewMenu = new QPopupMenu( this ); 1692 viewMenu = new QPopupMenu( this );
1681 settingsMenu = new QPopupMenu( this ); 1693 settingsMenu = new QPopupMenu( this );
1682 //filterMenu = new QPopupMenu( this ); 1694 //filterMenu = new QPopupMenu( this );
1683 ImportMenu = new QPopupMenu( this ); 1695 ImportMenu = new QPopupMenu( this );
1684 ExportMenu = new QPopupMenu( this ); 1696 ExportMenu = new QPopupMenu( this );
1685 syncMenu = new QPopupMenu( this ); 1697 syncMenu = new QPopupMenu( this );
1686 changeMenu= new QPopupMenu( this ); 1698 changeMenu= new QPopupMenu( this );
1687 1699
1688//US since we have no splitter for the embedded system, setup 1700//US since we have no splitter for the embedded system, setup
1689// a layout with two frames. One left and one right. 1701// a layout with two frames. One left and one right.
1690 1702
1691 QBoxLayout *topLayout; 1703 QBoxLayout *topLayout;
1692 1704
1693 // = new QHBoxLayout( this ); 1705 // = new QHBoxLayout( this );
1694// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1706// QBoxLayout *topLayout = (QBoxLayout*)layout();
1695 1707
1696// QWidget *mainBox = new QWidget( this ); 1708// QWidget *mainBox = new QWidget( this );
1697// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1709// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1698 1710
1699#ifdef DESKTOP_VERSION 1711#ifdef DESKTOP_VERSION
1700 topLayout = new QHBoxLayout( this ); 1712 topLayout = new QHBoxLayout( this );
1701 1713
1702 1714
1703 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1715 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1704 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1716 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1705 1717
1706 topLayout->addWidget(mMiniSplitter ); 1718 topLayout->addWidget(mMiniSplitter );
1707 1719
1708 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1720 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1709 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1721 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1710 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1722 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1711 mDetails = new ViewContainer( mMiniSplitter ); 1723 mDetails = new ViewContainer( mMiniSplitter );
1712 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1724 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1713#else 1725#else
1714 if ( QApplication::desktop()->width() > 480 ) { 1726 if ( QApplication::desktop()->width() > 480 ) {
1715 topLayout = new QHBoxLayout( this ); 1727 topLayout = new QHBoxLayout( this );
1716 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1728 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1717 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1729 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1718 } else { 1730 } else {
1719 1731
1720 topLayout = new QHBoxLayout( this ); 1732 topLayout = new QHBoxLayout( this );
1721 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1733 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1722 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1734 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1723 } 1735 }
1724 1736
1725 topLayout->addWidget(mMiniSplitter ); 1737 topLayout->addWidget(mMiniSplitter );
1726 mViewManager = new ViewManager( this, mMiniSplitter ); 1738 mViewManager = new ViewManager( this, mMiniSplitter );
1727 mDetails = new ViewContainer( mMiniSplitter ); 1739 mDetails = new ViewContainer( mMiniSplitter );
1728 1740
1729 1741
1730 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1742 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1731#endif 1743#endif
1732 //eh->hide(); 1744 //eh->hide();
1733 // topLayout->addWidget(mExtensionManager ); 1745 // topLayout->addWidget(mExtensionManager );
1734 1746
1735 1747
1736/*US 1748/*US
1737#ifndef KAB_NOSPLITTER 1749#ifndef KAB_NOSPLITTER
1738 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1750 QHBoxLayout *topLayout = new QHBoxLayout( this );
1739//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1751//US topLayout->setSpacing( KDialogBase::spacingHint() );
1740 topLayout->setSpacing( 10 ); 1752 topLayout->setSpacing( 10 );
1741 1753
1742 mDetailsSplitter = new QSplitter( this ); 1754 mDetailsSplitter = new QSplitter( this );
1743 1755
1744 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1756 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1745 1757
1746 mViewManager = new ViewManager( this, viewSpace ); 1758 mViewManager = new ViewManager( this, viewSpace );
1747 viewSpace->setStretchFactor( mViewManager, 1 ); 1759 viewSpace->setStretchFactor( mViewManager, 1 );
1748 1760
1749 mDetails = new ViewContainer( mDetailsSplitter ); 1761 mDetails = new ViewContainer( mDetailsSplitter );
1750 1762
1751 topLayout->addWidget( mDetailsSplitter ); 1763 topLayout->addWidget( mDetailsSplitter );
1752 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1764 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1753#else //KAB_NOSPLITTER 1765#else //KAB_NOSPLITTER
1754 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1766 QHBoxLayout *topLayout = new QHBoxLayout( this );
1755//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1767//US topLayout->setSpacing( KDialogBase::spacingHint() );
1756 topLayout->setSpacing( 10 ); 1768 topLayout->setSpacing( 10 );
1757 1769
1758// mDetailsSplitter = new QSplitter( this ); 1770// mDetailsSplitter = new QSplitter( this );
1759 1771
1760 QVBox *viewSpace = new QVBox( this ); 1772 QVBox *viewSpace = new QVBox( this );
1761 1773
1762 mViewManager = new ViewManager( this, viewSpace ); 1774 mViewManager = new ViewManager( this, viewSpace );
1763 viewSpace->setStretchFactor( mViewManager, 1 ); 1775 viewSpace->setStretchFactor( mViewManager, 1 );
1764 1776
1765 mDetails = new ViewContainer( this ); 1777 mDetails = new ViewContainer( this );
1766 1778
1767 topLayout->addWidget( viewSpace ); 1779 topLayout->addWidget( viewSpace );
1768// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1780// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1769 topLayout->addWidget( mDetails ); 1781 topLayout->addWidget( mDetails );
1770#endif //KAB_NOSPLITTER 1782#endif //KAB_NOSPLITTER
1771*/ 1783*/
1772 1784
1773 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1785 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1774 syncManager->setBlockSave(false); 1786 syncManager->setBlockSave(false);
1775 1787
1776 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1788 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1777 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1789 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1778 syncManager->setDefaultFileName( sentSyncFile()); 1790 syncManager->setDefaultFileName( sentSyncFile());
1779 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1791 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1780 1792
1781#endif //KAB_EMBEDDED 1793#endif //KAB_EMBEDDED
1782 initActions(); 1794 initActions();
1783 1795
1784#ifdef KAB_EMBEDDED 1796#ifdef KAB_EMBEDDED
1785 addActionsManually(); 1797 addActionsManually();
1786 //US make sure the export and import menues are initialized before creating the xxPortManager. 1798 //US make sure the export and import menues are initialized before creating the xxPortManager.
1787 mXXPortManager = new XXPortManager( this, this ); 1799 mXXPortManager = new XXPortManager( this, this );
1788 1800
1789 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1801 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1790 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1802 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1791 // mActionQuit->plug ( mMainWindow->toolBar()); 1803 // mActionQuit->plug ( mMainWindow->toolBar());
1792 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1804 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1793 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1805 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1794 // mIncSearchWidget->hide(); 1806 // mIncSearchWidget->hide();
1795 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1807 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1796 SLOT( incrementalSearch( const QString& ) ) ); 1808 SLOT( incrementalSearch( const QString& ) ) );
1797 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1809 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1798 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1810 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1799 1811
1800 mJumpButtonBar = new JumpButtonBar( this, this ); 1812 mJumpButtonBar = new JumpButtonBar( this, this );
1801 1813
1802 topLayout->addWidget( mJumpButtonBar ); 1814 topLayout->addWidget( mJumpButtonBar );
1803//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1815//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1804 1816
1805// mMainWindow->getIconToolBar()->raise(); 1817// mMainWindow->getIconToolBar()->raise();
1806 1818
1807#endif //KAB_EMBEDDED 1819#endif //KAB_EMBEDDED
1808 1820
1809} 1821}
1810void KABCore::initActions() 1822void KABCore::initActions()
1811{ 1823{
1812//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1824//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1813 1825
1814#ifndef KAB_EMBEDDED 1826#ifndef KAB_EMBEDDED
1815 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1827 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1816 SLOT( clipboardDataChanged() ) ); 1828 SLOT( clipboardDataChanged() ) );
1817#endif //KAB_EMBEDDED 1829#endif //KAB_EMBEDDED
1818 1830
1819 // file menu 1831 // file menu
1820 if ( mIsPart ) { 1832 if ( mIsPart ) {
1821 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1833 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1822 SLOT( sendMail() ), actionCollection(), 1834 SLOT( sendMail() ), actionCollection(),
1823 "kaddressbook_mail" ); 1835 "kaddressbook_mail" );
1824 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1836 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1825 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1837 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1826 1838
1827 } else { 1839 } else {
1828 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1840 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1829 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1841 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1830 } 1842 }
1831 1843
1832 1844
1833 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1845 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1834 SLOT( save() ), actionCollection(), "file_sync" ); 1846 SLOT( save() ), actionCollection(), "file_sync" );
1835 1847
1836 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1848 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1837 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1849 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1838 1850
1839 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1851 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1840 this, SLOT( mailVCard() ), 1852 this, SLOT( mailVCard() ),
1841 actionCollection(), "file_mail_vcard"); 1853 actionCollection(), "file_mail_vcard");
1842 1854
1843 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 1855 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
1844 SLOT( export2phone() ), actionCollection(), 1856 SLOT( export2phone() ), actionCollection(),
1845 "kaddressbook_ex2phone" ); 1857 "kaddressbook_ex2phone" );
1846 1858
1847 mActionBeamVCard = 0; 1859 mActionBeamVCard = 0;
1848 mActionBeam = 0; 1860 mActionBeam = 0;
1849 1861
1850#ifndef DESKTOP_VERSION 1862#ifndef DESKTOP_VERSION
1851 if ( Ir::supported() ) { 1863 if ( Ir::supported() ) {
1852 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1864 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1853 SLOT( beamVCard() ), actionCollection(), 1865 SLOT( beamVCard() ), actionCollection(),
1854 "kaddressbook_beam_vcard" ); 1866 "kaddressbook_beam_vcard" );
1855 1867
1856 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1868 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1857 SLOT( beamMySelf() ), actionCollection(), 1869 SLOT( beamMySelf() ), actionCollection(),
1858 "kaddressbook_beam_myself" ); 1870 "kaddressbook_beam_myself" );
1859 } 1871 }
1860#endif 1872#endif
1861 1873
1862 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1874 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1863 this, SLOT( editContact2() ), 1875 this, SLOT( editContact2() ),
1864 actionCollection(), "file_properties" ); 1876 actionCollection(), "file_properties" );
1865 1877
1866#ifdef KAB_EMBEDDED 1878#ifdef KAB_EMBEDDED
1867 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1879 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1868 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1880 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1869 mMainWindow, SLOT( exit() ), 1881 mMainWindow, SLOT( exit() ),
1870 actionCollection(), "quit" ); 1882 actionCollection(), "quit" );
1871#endif //KAB_EMBEDDED 1883#endif //KAB_EMBEDDED
1872 1884
1873 // edit menu 1885 // edit menu
1874 if ( mIsPart ) { 1886 if ( mIsPart ) {
1875 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1887 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1876 SLOT( copyContacts() ), actionCollection(), 1888 SLOT( copyContacts() ), actionCollection(),
1877 "kaddressbook_copy" ); 1889 "kaddressbook_copy" );
1878 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1890 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1879 SLOT( cutContacts() ), actionCollection(), 1891 SLOT( cutContacts() ), actionCollection(),
1880 "kaddressbook_cut" ); 1892 "kaddressbook_cut" );
1881 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1893 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1882 SLOT( pasteContacts() ), actionCollection(), 1894 SLOT( pasteContacts() ), actionCollection(),
1883 "kaddressbook_paste" ); 1895 "kaddressbook_paste" );
1884 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1896 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1885 SLOT( selectAllContacts() ), actionCollection(), 1897 SLOT( selectAllContacts() ), actionCollection(),
1886 "kaddressbook_select_all" ); 1898 "kaddressbook_select_all" );
1887 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1899 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1888 SLOT( undo() ), actionCollection(), 1900 SLOT( undo() ), actionCollection(),
1889 "kaddressbook_undo" ); 1901 "kaddressbook_undo" );
1890 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1902 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1891 this, SLOT( redo() ), actionCollection(), 1903 this, SLOT( redo() ), actionCollection(),
1892 "kaddressbook_redo" ); 1904 "kaddressbook_redo" );
1893 } else { 1905 } else {
1894 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1906 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1895 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1907 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1896 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1908 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1897 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1909 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1898 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1910 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1899 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1911 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1900 } 1912 }
1901 1913
1902 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1914 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1903 Key_Delete, this, SLOT( deleteContacts() ), 1915 Key_Delete, this, SLOT( deleteContacts() ),
1904 actionCollection(), "edit_delete" ); 1916 actionCollection(), "edit_delete" );
1905 1917
1906 mActionUndo->setEnabled( false ); 1918 mActionUndo->setEnabled( false );
1907 mActionRedo->setEnabled( false ); 1919 mActionRedo->setEnabled( false );
1908 1920
1909 // settings menu 1921 // settings menu
1910#ifdef KAB_EMBEDDED 1922#ifdef KAB_EMBEDDED
1911//US special menuentry to configure the addressbook resources. On KDE 1923//US special menuentry to configure the addressbook resources. On KDE
1912// you do that through the control center !!! 1924// you do that through the control center !!!
1913 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1925 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1914 SLOT( configureResources() ), actionCollection(), 1926 SLOT( configureResources() ), actionCollection(),
1915 "kaddressbook_configure_resources" ); 1927 "kaddressbook_configure_resources" );
1916#endif //KAB_EMBEDDED 1928#endif //KAB_EMBEDDED
1917 1929
1918 if ( mIsPart ) { 1930 if ( mIsPart ) {
1919 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1931 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1920 SLOT( openConfigDialog() ), actionCollection(), 1932 SLOT( openConfigDialog() ), actionCollection(),
1921 "kaddressbook_configure" ); 1933 "kaddressbook_configure" );
1922 1934
1923 //US not implemented yet 1935 //US not implemented yet
1924 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1936 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1925 // this, SLOT( configureKeyBindings() ), actionCollection(), 1937 // this, SLOT( configureKeyBindings() ), actionCollection(),
1926 // "kaddressbook_configure_shortcuts" ); 1938 // "kaddressbook_configure_shortcuts" );
1927#ifdef KAB_EMBEDDED 1939#ifdef KAB_EMBEDDED
1928 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1940 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1929 mActionConfigureToolbars->setEnabled( false ); 1941 mActionConfigureToolbars->setEnabled( false );
1930#endif //KAB_EMBEDDED 1942#endif //KAB_EMBEDDED
1931 1943
1932 } else { 1944 } else {
1933 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1945 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1934 1946
1935 //US not implemented yet 1947 //US not implemented yet
1936 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1948 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1937 } 1949 }
1938 1950
1939 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1951 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1940 actionCollection(), "options_show_jump_bar" ); 1952 actionCollection(), "options_show_jump_bar" );
1941 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1953 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1942 1954
1943 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1955 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1944 actionCollection(), "options_show_details" ); 1956 actionCollection(), "options_show_details" );
1945 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1957 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1946 1958
1947 1959
1948 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 1960 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
1949 SLOT( toggleBeamReceive() ), actionCollection(), 1961 SLOT( toggleBeamReceive() ), actionCollection(),
1950 "kaddressbook_beam_rec" ); 1962 "kaddressbook_beam_rec" );
1951 1963
1952 1964
1953 // misc 1965 // misc
1954 // only enable LDAP lookup if we can handle the protocol 1966 // only enable LDAP lookup if we can handle the protocol
1955#ifndef KAB_EMBEDDED 1967#ifndef KAB_EMBEDDED
1956 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1968 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1957 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1969 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1958 this, SLOT( openLDAPDialog() ), actionCollection(), 1970 this, SLOT( openLDAPDialog() ), actionCollection(),
1959 "ldap_lookup" ); 1971 "ldap_lookup" );
1960 } 1972 }
1961#else //KAB_EMBEDDED 1973#else //KAB_EMBEDDED
1962 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1974 //qDebug("KABCore::initActions() LDAP has to be implemented");
1963#endif //KAB_EMBEDDED 1975#endif //KAB_EMBEDDED
1964 1976
1965 1977
1966 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1978 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1967 SLOT( setWhoAmI() ), actionCollection(), 1979 SLOT( setWhoAmI() ), actionCollection(),
1968 "set_personal" ); 1980 "set_personal" );
1969 1981
1970 1982
1971 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1983 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1972 SLOT( setCategories() ), actionCollection(), 1984 SLOT( setCategories() ), actionCollection(),
1973 "edit_set_categories" ); 1985 "edit_set_categories" );
1974 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this, 1986 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this,
1975 SLOT( editCategories() ), actionCollection(), 1987 SLOT( editCategories() ), actionCollection(),
1976 "edit__categories" ); 1988 "edit__categories" );
1977 1989
1978 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1990 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1979 SLOT( removeVoice() ), actionCollection(), 1991 SLOT( removeVoice() ), actionCollection(),
1980 "remove_voice" ); 1992 "remove_voice" );
1981 1993
1982 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, 1994 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
1983 SLOT( manageCategories() ), actionCollection(), 1995 SLOT( manageCategories() ), actionCollection(),
1984 "remove_voice" ); 1996 "remove_voice" );
1985 1997
1986 1998
1987 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 1999 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
1988 SLOT( importFromOL() ), actionCollection(), 2000 SLOT( importFromOL() ), actionCollection(),
1989 "import_OL" ); 2001 "import_OL" );
1990#ifdef KAB_EMBEDDED 2002#ifdef KAB_EMBEDDED
1991 mActionLicence = new KAction( i18n( "Licence" ), 0, 2003 mActionLicence = new KAction( i18n( "Licence" ), 0,
1992 this, SLOT( showLicence() ), actionCollection(), 2004 this, SLOT( showLicence() ), actionCollection(),
1993 "licence_about_data" ); 2005 "licence_about_data" );
1994 mActionFaq = new KAction( i18n( "Faq" ), 0, 2006 mActionFaq = new KAction( i18n( "Faq" ), 0,
1995 this, SLOT( faq() ), actionCollection(), 2007 this, SLOT( faq() ), actionCollection(),
1996 "faq_about_data" ); 2008 "faq_about_data" );
1997 mActionWN = new KAction( i18n( "What's New?" ), 0, 2009 mActionWN = new KAction( i18n( "What's New?" ), 0,
1998 this, SLOT( whatsnew() ), actionCollection(), 2010 this, SLOT( whatsnew() ), actionCollection(),
1999 "wn" ); 2011 "wn" );
2000 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 2012 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
2001 this, SLOT( synchowto() ), actionCollection(), 2013 this, SLOT( synchowto() ), actionCollection(),
2002 "sync" ); 2014 "sync" );
2003 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 2015 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
2004 this, SLOT( kdesynchowto() ), actionCollection(), 2016 this, SLOT( kdesynchowto() ), actionCollection(),
2005 "kdesync" ); 2017 "kdesync" );
2006 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 2018 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
2007 this, SLOT( multisynchowto() ), actionCollection(), 2019 this, SLOT( multisynchowto() ), actionCollection(),
2008 "multisync" ); 2020 "multisync" );
2009 2021
2010 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 2022 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
2011 this, SLOT( createAboutData() ), actionCollection(), 2023 this, SLOT( createAboutData() ), actionCollection(),
2012 "kaddressbook_about_data" ); 2024 "kaddressbook_about_data" );
2013#endif //KAB_EMBEDDED 2025#endif //KAB_EMBEDDED
2014 2026
2015 clipboardDataChanged(); 2027 clipboardDataChanged();
2016 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2028 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2017 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2029 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2018} 2030}
2019 2031
2020//US we need this function, to plug all actions into the correct menues. 2032//US we need this function, to plug all actions into the correct menues.
2021// KDE uses a XML format to plug the actions, but we work her without this overhead. 2033// KDE uses a XML format to plug the actions, but we work her without this overhead.
2022void KABCore::addActionsManually() 2034void KABCore::addActionsManually()
2023{ 2035{
2024//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 2036//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
2025 2037
2026#ifdef KAB_EMBEDDED 2038#ifdef KAB_EMBEDDED
2027 QPopupMenu *fileMenu = new QPopupMenu( this ); 2039 QPopupMenu *fileMenu = new QPopupMenu( this );
2028 QPopupMenu *editMenu = new QPopupMenu( this ); 2040 QPopupMenu *editMenu = new QPopupMenu( this );
2029 QPopupMenu *helpMenu = new QPopupMenu( this ); 2041 QPopupMenu *helpMenu = new QPopupMenu( this );
2030 2042
2031 KToolBar* tb = mMainWindow->toolBar(); 2043 KToolBar* tb = mMainWindow->toolBar();
2032 2044
2033#ifndef DESKTOP_VERSION 2045#ifndef DESKTOP_VERSION
2034 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 2046 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
2035#endif 2047#endif
2036 QMenuBar* mb = mMainWindow->menuBar(); 2048 QMenuBar* mb = mMainWindow->menuBar();
2037 2049
2038 //US setup menubar. 2050 //US setup menubar.
2039 //Disable the following block if you do not want to have a menubar. 2051 //Disable the following block if you do not want to have a menubar.
2040 mb->insertItem( i18n("&File"), fileMenu ); 2052 mb->insertItem( i18n("&File"), fileMenu );
2041 mb->insertItem( i18n("&Edit"), editMenu ); 2053 mb->insertItem( i18n("&Edit"), editMenu );
2042 mb->insertItem( i18n("&View"), viewMenu ); 2054 mb->insertItem( i18n("&View"), viewMenu );
2043 mb->insertItem( i18n("&Settings"), settingsMenu ); 2055 mb->insertItem( i18n("&Settings"), settingsMenu );
2044 mb->insertItem( i18n("Synchronize"), syncMenu ); 2056 mb->insertItem( i18n("Synchronize"), syncMenu );
2045 //mb->insertItem( i18n("&Change"), changeMenu ); 2057 //mb->insertItem( i18n("&Change"), changeMenu );
2046 mb->insertItem( i18n("&Help"), helpMenu ); 2058 mb->insertItem( i18n("&Help"), helpMenu );
2047 mIncSearchWidget = new IncSearchWidget( tb ); 2059 mIncSearchWidget = new IncSearchWidget( tb );
2048 // tb->insertWidget(-1, 0, mIncSearchWidget); 2060 // tb->insertWidget(-1, 0, mIncSearchWidget);
2049#ifndef DESKTOP_VERSION 2061#ifndef DESKTOP_VERSION
2050 } else { 2062 } else {
2051 //US setup toolbar 2063 //US setup toolbar
2052 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2064 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2053 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2065 QPopupMenu *popupBarTB = new QPopupMenu( this );
2054 menuBarTB->insertItem( "ME", popupBarTB); 2066 menuBarTB->insertItem( "ME", popupBarTB);
2055 tb->insertWidget(-1, 0, menuBarTB); 2067 tb->insertWidget(-1, 0, menuBarTB);
2056 mIncSearchWidget = new IncSearchWidget( tb ); 2068 mIncSearchWidget = new IncSearchWidget( tb );
2057 2069
2058 tb->enableMoving(false); 2070 tb->enableMoving(false);
2059 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2071 popupBarTB->insertItem( i18n("&File"), fileMenu );
2060 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2072 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2061 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2073 popupBarTB->insertItem( i18n("&View"), viewMenu );
2062 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2074 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2063 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2075 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2064 mViewManager->getFilterAction()->plug ( popupBarTB); 2076 mViewManager->getFilterAction()->plug ( popupBarTB);
2065 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2077 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2066 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2078 popupBarTB->insertItem( i18n("&Help"), helpMenu );
2067 if (QApplication::desktop()->width() > 320 ) { 2079 if (QApplication::desktop()->width() > 320 ) {
2068 // mViewManager->getFilterAction()->plug ( tb); 2080 // mViewManager->getFilterAction()->plug ( tb);
2069 } 2081 }
2070 } 2082 }
2071#endif 2083#endif
2072 // mActionQuit->plug ( mMainWindow->toolBar()); 2084 // mActionQuit->plug ( mMainWindow->toolBar());
2073 2085
2074 2086
2075 2087
2076 //US Now connect the actions with the menue entries. 2088 //US Now connect the actions with the menue entries.
2077 mActionPrint->plug( fileMenu ); 2089 mActionPrint->plug( fileMenu );
2078 mActionMail->plug( fileMenu ); 2090 mActionMail->plug( fileMenu );
2079 fileMenu->insertSeparator(); 2091 fileMenu->insertSeparator();
2080 2092
2081 mActionNewContact->plug( fileMenu ); 2093 mActionNewContact->plug( fileMenu );
2082 mActionNewContact->plug( tb ); 2094 mActionNewContact->plug( tb );
2083 2095
2084 mActionEditAddressee->plug( fileMenu ); 2096 mActionEditAddressee->plug( fileMenu );
2085 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2097 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2086 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2098 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2087 mActionEditAddressee->plug( tb ); 2099 mActionEditAddressee->plug( tb );
2088 2100
2089 fileMenu->insertSeparator(); 2101 fileMenu->insertSeparator();
2090 mActionSave->plug( fileMenu ); 2102 mActionSave->plug( fileMenu );
2091 fileMenu->insertItem( "&Import", ImportMenu ); 2103 fileMenu->insertItem( "&Import", ImportMenu );
2092 fileMenu->insertItem( "&Export", ExportMenu ); 2104 fileMenu->insertItem( "&Export", ExportMenu );
2093 fileMenu->insertItem( i18n("&Change"), changeMenu ); 2105 fileMenu->insertItem( i18n("&Change"), changeMenu );
2094 fileMenu->insertSeparator(); 2106 fileMenu->insertSeparator();
2095 mActionMailVCard->plug( fileMenu ); 2107 mActionMailVCard->plug( fileMenu );
2096#ifndef DESKTOP_VERSION 2108#ifndef DESKTOP_VERSION
2097 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 2109 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
2098 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 2110 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
2099#endif 2111#endif
2100 fileMenu->insertSeparator(); 2112 fileMenu->insertSeparator();
2101 mActionQuit->plug( fileMenu ); 2113 mActionQuit->plug( fileMenu );
2102#ifdef _WIN32_ 2114#ifdef _WIN32_
2103 mActionImportOL->plug( ImportMenu ); 2115 mActionImportOL->plug( ImportMenu );
2104#endif 2116#endif
2105 // edit menu 2117 // edit menu
2106 mActionUndo->plug( editMenu ); 2118 mActionUndo->plug( editMenu );
2107 mActionRedo->plug( editMenu ); 2119 mActionRedo->plug( editMenu );
2108 editMenu->insertSeparator(); 2120 editMenu->insertSeparator();
2109 mActionCut->plug( editMenu ); 2121 mActionCut->plug( editMenu );
2110 mActionCopy->plug( editMenu ); 2122 mActionCopy->plug( editMenu );
2111 mActionPaste->plug( editMenu ); 2123 mActionPaste->plug( editMenu );
2112 mActionDelete->plug( editMenu ); 2124 mActionDelete->plug( editMenu );
2113 editMenu->insertSeparator(); 2125 editMenu->insertSeparator();
2114 mActionSelectAll->plug( editMenu ); 2126 mActionSelectAll->plug( editMenu );
2115 2127
2116 mActionRemoveVoice->plug( changeMenu ); 2128 mActionRemoveVoice->plug( changeMenu );
2117 // settings menu 2129 // settings menu
2118//US special menuentry to configure the addressbook resources. On KDE 2130//US special menuentry to configure the addressbook resources. On KDE
2119// you do that through the control center !!! 2131// you do that through the control center !!!
2120 mActionConfigResources->plug( settingsMenu ); 2132 mActionConfigResources->plug( settingsMenu );
2121 settingsMenu->insertSeparator(); 2133 settingsMenu->insertSeparator();
2122 2134
2123 mActionConfigKAddressbook->plug( settingsMenu ); 2135 mActionConfigKAddressbook->plug( settingsMenu );
2124 2136
2125 if ( mIsPart ) { 2137 if ( mIsPart ) {
2126 //US not implemented yet 2138 //US not implemented yet
2127 //mActionConfigShortcuts->plug( settingsMenu ); 2139 //mActionConfigShortcuts->plug( settingsMenu );
2128 //mActionConfigureToolbars->plug( settingsMenu ); 2140 //mActionConfigureToolbars->plug( settingsMenu );
2129 2141
2130 } else { 2142 } else {
2131 //US not implemented yet 2143 //US not implemented yet
2132 //mActionKeyBindings->plug( settingsMenu ); 2144 //mActionKeyBindings->plug( settingsMenu );
2133 } 2145 }
2134 2146
2135 settingsMenu->insertSeparator(); 2147 settingsMenu->insertSeparator();
2136 2148
2137 mActionJumpBar->plug( settingsMenu ); 2149 mActionJumpBar->plug( settingsMenu );
2138 mActionDetails->plug( settingsMenu ); 2150 mActionDetails->plug( settingsMenu );
2139 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2151 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2140 mActionDetails->plug( tb ); 2152 mActionDetails->plug( tb );
2141 settingsMenu->insertSeparator(); 2153 settingsMenu->insertSeparator();
2142 mActionBR->plug(settingsMenu ); 2154 mActionBR->plug(settingsMenu );
2143 settingsMenu->insertSeparator(); 2155 settingsMenu->insertSeparator();
2144 2156
2145 mActionWhoAmI->plug( settingsMenu ); 2157 mActionWhoAmI->plug( settingsMenu );
2146 mActionEditCategories->plug( settingsMenu ); 2158 mActionEditCategories->plug( settingsMenu );
2147 mActionEditCategories->plug( changeMenu ); 2159 mActionEditCategories->plug( changeMenu );
2148 mActionCategories->plug( changeMenu ); 2160 mActionCategories->plug( changeMenu );
2149 mActionManageCategories->plug( changeMenu ); 2161 mActionManageCategories->plug( changeMenu );
2150 2162
2151 mActionCategories->plug( settingsMenu ); 2163 mActionCategories->plug( settingsMenu );
2152 mActionManageCategories->plug( settingsMenu ); 2164 mActionManageCategories->plug( settingsMenu );
2153 2165
2154 2166
2155 mActionWN->plug( helpMenu ); 2167 mActionWN->plug( helpMenu );
2156 mActionSyncHowto->plug( helpMenu ); 2168 mActionSyncHowto->plug( helpMenu );
2157 mActionKdeSyncHowto->plug( helpMenu ); 2169 mActionKdeSyncHowto->plug( helpMenu );
2158 mActionMultiSyncHowto->plug( helpMenu ); 2170 mActionMultiSyncHowto->plug( helpMenu );
2159 mActionFaq->plug( helpMenu ); 2171 mActionFaq->plug( helpMenu );
2160 mActionLicence->plug( helpMenu ); 2172 mActionLicence->plug( helpMenu );
2161 mActionAboutKAddressbook->plug( helpMenu ); 2173 mActionAboutKAddressbook->plug( helpMenu );
2162 2174
2163 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2175 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2164 2176
2165 mActionSave->plug( tb ); 2177 mActionSave->plug( tb );
2166 mViewManager->getFilterAction()->plug ( tb); 2178 mViewManager->getFilterAction()->plug ( tb);
2167 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2179 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
2168 mActionUndo->plug( tb ); 2180 mActionUndo->plug( tb );
2169 mActionDelete->plug( tb ); 2181 mActionDelete->plug( tb );
2170 mActionRedo->plug( tb ); 2182 mActionRedo->plug( tb );
2171 } 2183 }
2172 } else { 2184 } else {
2173 mActionSave->plug( tb ); 2185 mActionSave->plug( tb );
2174 tb->enableMoving(false); 2186 tb->enableMoving(false);
2175 } 2187 }
2176 //mActionQuit->plug ( tb ); 2188 //mActionQuit->plug ( tb );
2177 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2189 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2178 2190
2179 //US link the searchwidget first to this. 2191 //US link the searchwidget first to this.
2180 // The real linkage to the toolbar happens later. 2192 // The real linkage to the toolbar happens later.
2181//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2193//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2182//US tb->insertItem( mIncSearchWidget ); 2194//US tb->insertItem( mIncSearchWidget );
2183/*US 2195/*US
2184 mIncSearchWidget = new IncSearchWidget( tb ); 2196 mIncSearchWidget = new IncSearchWidget( tb );
2185 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2197 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2186 SLOT( incrementalSearch( const QString& ) ) ); 2198 SLOT( incrementalSearch( const QString& ) ) );
2187 2199
2188 mJumpButtonBar = new JumpButtonBar( this, this ); 2200 mJumpButtonBar = new JumpButtonBar( this, this );
2189 2201
2190//US topLayout->addWidget( mJumpButtonBar ); 2202//US topLayout->addWidget( mJumpButtonBar );
2191 this->layout()->add( mJumpButtonBar ); 2203 this->layout()->add( mJumpButtonBar );
2192*/ 2204*/
2193 2205
2194#endif //KAB_EMBEDDED 2206#endif //KAB_EMBEDDED
2195 2207
2196 mActionExport2phone->plug( ExportMenu ); 2208 mActionExport2phone->plug( ExportMenu );
2197 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2209 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2198 syncManager->fillSyncMenu(); 2210 syncManager->fillSyncMenu();
2199 2211
2200} 2212}
2201void KABCore::showLicence() 2213void KABCore::showLicence()
2202{ 2214{
2203 KApplication::showLicence(); 2215 KApplication::showLicence();
2204} 2216}
2205 2217
2206void KABCore::manageCategories( ) 2218void KABCore::manageCategories( )
2207{ 2219{
2208 KABCatPrefs* cp = new KABCatPrefs(); 2220 KABCatPrefs* cp = new KABCatPrefs();
2209 cp->show(); 2221 cp->show();
2210 int w =cp->sizeHint().width() ; 2222 int w =cp->sizeHint().width() ;
2211 int h = cp->sizeHint().height() ; 2223 int h = cp->sizeHint().height() ;
2212 int dw = QApplication::desktop()->width(); 2224 int dw = QApplication::desktop()->width();
2213 int dh = QApplication::desktop()->height(); 2225 int dh = QApplication::desktop()->height();
2214 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2226 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2215 if ( !cp->exec() ) { 2227 if ( !cp->exec() ) {
2216 delete cp; 2228 delete cp;
2217 return; 2229 return;
2218 } 2230 }
2219 int count = 0; 2231 int count = 0;
2220 message( i18n("Please wait, processing categories...")); 2232 message( i18n("Please wait, processing categories..."));
2221 if ( cp->addCat() ) { 2233 if ( cp->addCat() ) {
2222 KABC::AddressBook::Iterator it; 2234 KABC::AddressBook::Iterator it;
2223 QStringList catList = KABPrefs::instance()->mCustomCategories; 2235 QStringList catList = KABPrefs::instance()->mCustomCategories;
2224 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2236 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2225 QStringList catIncList = (*it).categories(); 2237 QStringList catIncList = (*it).categories();
2226 int i; 2238 int i;
2227 for( i = 0; i< catIncList.count(); ++i ) { 2239 for( i = 0; i< catIncList.count(); ++i ) {
2228 if ( !catList.contains (catIncList[i])) { 2240 if ( !catList.contains (catIncList[i])) {
2229 catList.append( catIncList[i] ); 2241 catList.append( catIncList[i] );
2230 //qDebug("add cat %s ", catIncList[i].latin1()); 2242 //qDebug("add cat %s ", catIncList[i].latin1());
2231 ++count; 2243 ++count;
2232 } 2244 }
2233 } 2245 }
2234 } 2246 }
2235 catList.sort(); 2247 catList.sort();
2236 KABPrefs::instance()->mCustomCategories = catList; 2248 KABPrefs::instance()->mCustomCategories = catList;
2237 KABPrefs::instance()->writeConfig(); 2249 KABPrefs::instance()->writeConfig();
2238 message(QString::number( count )+ i18n(" categories added to list! ")); 2250 message(QString::number( count )+ i18n(" categories added to list! "));
2239 } else { 2251 } else {
2240 QStringList catList = KABPrefs::instance()->mCustomCategories; 2252 QStringList catList = KABPrefs::instance()->mCustomCategories;
2241 QStringList catIncList; 2253 QStringList catIncList;
2242 QStringList newCatList; 2254 QStringList newCatList;
2243 KABC::AddressBook::Iterator it; 2255 KABC::AddressBook::Iterator it;
2244 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2256 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2245 QStringList catIncList = (*it).categories(); 2257 QStringList catIncList = (*it).categories();
2246 int i; 2258 int i;
2247 if ( catIncList.count() ) { 2259 if ( catIncList.count() ) {
2248 newCatList.clear(); 2260 newCatList.clear();
2249 for( i = 0; i< catIncList.count(); ++i ) { 2261 for( i = 0; i< catIncList.count(); ++i ) {
2250 if ( catList.contains (catIncList[i])) { 2262 if ( catList.contains (catIncList[i])) {
2251 newCatList.append( catIncList[i] ); 2263 newCatList.append( catIncList[i] );
2252 } 2264 }
2253 } 2265 }
2254 newCatList.sort(); 2266 newCatList.sort();
2255 (*it).setCategories( newCatList ); 2267 (*it).setCategories( newCatList );
2256 mAddressBook->insertAddressee( (*it) ); 2268 mAddressBook->insertAddressee( (*it) );
2257 } 2269 }
2258 } 2270 }
2259 setModified( true ); 2271 setModified( true );
2260 mViewManager->refreshView(); 2272 mViewManager->refreshView();
2261 mDetails->refreshView(); 2273 mDetails->refreshView();
2262 message( i18n("Removing categories done!")); 2274 message( i18n("Removing categories done!"));
2263 } 2275 }
2264 delete cp; 2276 delete cp;
2265} 2277}
2266void KABCore::removeVoice() 2278void KABCore::removeVoice()
2267{ 2279{
2268 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2280 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2269 return; 2281 return;
2270 KABC::Addressee::List list; 2282 KABC::Addressee::List list;
2271 XXPortSelectDialog dlg( this, false, this ); 2283 XXPortSelectDialog dlg( this, false, this );
2272 if ( dlg.exec() ) 2284 if ( dlg.exec() )
2273 list = dlg.contacts(); 2285 list = dlg.contacts();
2274 else 2286 else
2275 return; 2287 return;
2276 KABC::Addressee::List::Iterator it; 2288 KABC::Addressee::List::Iterator it;
2277 for ( it = list.begin(); it != list.end(); ++it ) { 2289 for ( it = list.begin(); it != list.end(); ++it ) {
2278 if ( (*it).removeVoice() ) 2290 if ( (*it).removeVoice() )
2279 contactModified((*it) ); 2291 contactModified((*it) );
2280 } 2292 }
2281} 2293}
2282 2294
2283 2295
2284 2296
2285void KABCore::clipboardDataChanged() 2297void KABCore::clipboardDataChanged()
2286{ 2298{
2287 2299
2288 if ( mReadWrite ) 2300 if ( mReadWrite )
2289 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2301 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2290 2302
2291} 2303}
2292 2304
2293void KABCore::updateActionMenu() 2305void KABCore::updateActionMenu()
2294{ 2306{
2295 UndoStack *undo = UndoStack::instance(); 2307 UndoStack *undo = UndoStack::instance();
2296 RedoStack *redo = RedoStack::instance(); 2308 RedoStack *redo = RedoStack::instance();
2297 2309
2298 if ( undo->isEmpty() ) 2310 if ( undo->isEmpty() )
2299 mActionUndo->setText( i18n( "Undo" ) ); 2311 mActionUndo->setText( i18n( "Undo" ) );
2300 else 2312 else
2301 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2313 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2302 2314
2303 mActionUndo->setEnabled( !undo->isEmpty() ); 2315 mActionUndo->setEnabled( !undo->isEmpty() );
2304 2316
2305 if ( !redo->top() ) 2317 if ( !redo->top() )
2306 mActionRedo->setText( i18n( "Redo" ) ); 2318 mActionRedo->setText( i18n( "Redo" ) );
2307 else 2319 else
2308 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2320 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2309 2321
2310 mActionRedo->setEnabled( !redo->isEmpty() ); 2322 mActionRedo->setEnabled( !redo->isEmpty() );
2311} 2323}
2312 2324
2313void KABCore::configureKeyBindings() 2325void KABCore::configureKeyBindings()
2314{ 2326{
2315#ifndef KAB_EMBEDDED 2327#ifndef KAB_EMBEDDED
2316 KKeyDialog::configure( actionCollection(), true ); 2328 KKeyDialog::configure( actionCollection(), true );
2317#else //KAB_EMBEDDED 2329#else //KAB_EMBEDDED
2318 qDebug("KABCore::configureKeyBindings() not implemented"); 2330 qDebug("KABCore::configureKeyBindings() not implemented");
2319#endif //KAB_EMBEDDED 2331#endif //KAB_EMBEDDED
2320} 2332}
2321 2333
2322#ifdef KAB_EMBEDDED 2334#ifdef KAB_EMBEDDED
2323void KABCore::configureResources() 2335void KABCore::configureResources()
2324{ 2336{
2325 KRES::KCMKResources dlg( this, "" , 0 ); 2337 KRES::KCMKResources dlg( this, "" , 0 );
2326 2338
2327 if ( !dlg.exec() ) 2339 if ( !dlg.exec() )
2328 return; 2340 return;
2329 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2341 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2330} 2342}
2331#endif //KAB_EMBEDDED 2343#endif //KAB_EMBEDDED
2332 2344
2333 2345
2334/* this method will be called through the QCop interface from Ko/Pi to select addresses 2346/* this method will be called through the QCop interface from Ko/Pi to select addresses
2335 * for the attendees list of an event. 2347 * for the attendees list of an event.
2336 */ 2348 */
2337void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2349void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2338{ 2350{
2339 QStringList nameList; 2351 QStringList nameList;
2340 QStringList emailList; 2352 QStringList emailList;
2341 QStringList uidList; 2353 QStringList uidList;
2342 2354
2343 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2355 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2344 uint i=0; 2356 uint i=0;
2345 for (i=0; i < list.count(); i++) 2357 for (i=0; i < list.count(); i++)
2346 { 2358 {
2347 nameList.append(list[i].realName()); 2359 nameList.append(list[i].realName());
2348 emailList.append(list[i].preferredEmail()); 2360 emailList.append(list[i].preferredEmail());
2349 uidList.append(list[i].uid()); 2361 uidList.append(list[i].uid());
2350 } 2362 }
2351 2363
2352 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2364 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2353 2365
2354} 2366}
2355 2367
2356/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2368/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2357 * to put them into the calendar. 2369 * to put them into the calendar.
2358 */ 2370 */
2359void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2371void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2360{ 2372{
2361 // qDebug("KABCore::requestForBirthdayList"); 2373 // qDebug("KABCore::requestForBirthdayList");
2362 QStringList birthdayList; 2374 QStringList birthdayList;
2363 QStringList anniversaryList; 2375 QStringList anniversaryList;
2364 QStringList realNameList; 2376 QStringList realNameList;
2365 QStringList preferredEmailList; 2377 QStringList preferredEmailList;
2366 QStringList assembledNameList; 2378 QStringList assembledNameList;
2367 QStringList uidList; 2379 QStringList uidList;
2368 2380
2369 KABC::AddressBook::Iterator it; 2381 KABC::AddressBook::Iterator it;
2370 2382
2371 int count = 0; 2383 int count = 0;
2372 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2384 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2373 ++count; 2385 ++count;
2374 } 2386 }
2375 QProgressBar bar(count,0 ); 2387 QProgressBar bar(count,0 );
2376 int w = 300; 2388 int w = 300;
2377 if ( QApplication::desktop()->width() < 320 ) 2389 if ( QApplication::desktop()->width() < 320 )
2378 w = 220; 2390 w = 220;
2379 int h = bar.sizeHint().height() ; 2391 int h = bar.sizeHint().height() ;
2380 int dw = QApplication::desktop()->width(); 2392 int dw = QApplication::desktop()->width();
2381 int dh = QApplication::desktop()->height(); 2393 int dh = QApplication::desktop()->height();
2382 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2394 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2383 bar.show(); 2395 bar.show();
2384 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2396 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2385 qApp->processEvents(); 2397 qApp->processEvents();
2386 2398
2387 QDate bday; 2399 QDate bday;
2388 QString anni; 2400 QString anni;
2389 QString formattedbday; 2401 QString formattedbday;
2390 2402
2391 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2403 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2392 { 2404 {
2393 if ( ! bar.isVisible() ) 2405 if ( ! bar.isVisible() )
2394 return; 2406 return;
2395 bar.setProgress( count++ ); 2407 bar.setProgress( count++ );
2396 qApp->processEvents(); 2408 qApp->processEvents();
2397 bday = (*it).birthday().date(); 2409 bday = (*it).birthday().date();
2398 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2410 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2399 2411
2400 if ( bday.isValid() || !anni.isEmpty()) 2412 if ( bday.isValid() || !anni.isEmpty())
2401 { 2413 {
2402 if (bday.isValid()) 2414 if (bday.isValid())
2403 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2415 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2404 else 2416 else
2405 formattedbday = "NOTVALID"; 2417 formattedbday = "NOTVALID";
2406 if (anni.isEmpty()) 2418 if (anni.isEmpty())
2407 anni = "INVALID"; 2419 anni = "INVALID";
2408 2420
2409 birthdayList.append(formattedbday); 2421 birthdayList.append(formattedbday);
2410 anniversaryList.append(anni); //should be ISODate 2422 anniversaryList.append(anni); //should be ISODate
2411 realNameList.append((*it).realName()); 2423 realNameList.append((*it).realName());
2412 preferredEmailList.append((*it).preferredEmail()); 2424 preferredEmailList.append((*it).preferredEmail());
2413 assembledNameList.append((*it).assembledName()); 2425 assembledNameList.append((*it).assembledName());
2414 uidList.append((*it).uid()); 2426 uidList.append((*it).uid());
2415 2427
2416 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); 2428 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() );
2417 } 2429 }
2418 } 2430 }
2419 2431
2420 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2432 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2421 2433
2422} 2434}
2423 2435
2424/* this method will be called through the QCop interface from other apps to show details of a contact. 2436/* this method will be called through the QCop interface from other apps to show details of a contact.
2425 */ 2437 */
2426void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2438void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2427{ 2439{
2428 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2440 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2429 2441
2430 QString foundUid = QString::null; 2442 QString foundUid = QString::null;
2431 if ( ! uid.isEmpty() ) { 2443 if ( ! uid.isEmpty() ) {
2432 Addressee adrr = mAddressBook->findByUid( uid ); 2444 Addressee adrr = mAddressBook->findByUid( uid );
2433 if ( !adrr.isEmpty() ) { 2445 if ( !adrr.isEmpty() ) {
2434 foundUid = uid; 2446 foundUid = uid;
2435 } 2447 }
2436 if ( email == "sendbacklist" ) { 2448 if ( email == "sendbacklist" ) {
2437 //qDebug("ssssssssssssssssssssssend "); 2449 //qDebug("ssssssssssssssssssssssend ");
2438 QStringList nameList; 2450 QStringList nameList;
2439 QStringList emailList; 2451 QStringList emailList;
2440 QStringList uidList; 2452 QStringList uidList;
2441 nameList.append(adrr.realName()); 2453 nameList.append(adrr.realName());
2442 emailList = adrr.emails(); 2454 emailList = adrr.emails();
2443 uidList.append( adrr.preferredEmail()); 2455 uidList.append( adrr.preferredEmail());
2444 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2456 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2445 return; 2457 return;
2446 } 2458 }
2447 2459
2448 } 2460 }
2449 2461
2450 if ( email == "sendbacklist" ) 2462 if ( email == "sendbacklist" )
2451 return; 2463 return;
2452 if (foundUid.isEmpty()) 2464 if (foundUid.isEmpty())
2453 { 2465 {
2454 //find the uid of the person first 2466 //find the uid of the person first
2455 Addressee::List namelist; 2467 Addressee::List namelist;
2456 Addressee::List emaillist; 2468 Addressee::List emaillist;
2457 2469
2458 if (!name.isEmpty()) 2470 if (!name.isEmpty())
2459 namelist = mAddressBook->findByName( name ); 2471 namelist = mAddressBook->findByName( name );
2460 2472
2461 if (!email.isEmpty()) 2473 if (!email.isEmpty())
2462 emaillist = mAddressBook->findByEmail( email ); 2474 emaillist = mAddressBook->findByEmail( email );
2463 //qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2475 //qDebug("count %d %d ", namelist.count(),emaillist.count() );
2464 //check if we have a match in Namelist and Emaillist 2476 //check if we have a match in Namelist and Emaillist
2465 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2477 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2466 foundUid = emaillist[0].uid(); 2478 foundUid = emaillist[0].uid();
2467 } 2479 }
2468 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2480 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2469 foundUid = namelist[0].uid(); 2481 foundUid = namelist[0].uid();
2470 else 2482 else
2471 { 2483 {
2472 for (int i = 0; i < namelist.count(); i++) 2484 for (int i = 0; i < namelist.count(); i++)
2473 { 2485 {
2474 for (int j = 0; j < emaillist.count(); j++) 2486 for (int j = 0; j < emaillist.count(); j++)
2475 { 2487 {
2476 if (namelist[i] == emaillist[j]) 2488 if (namelist[i] == emaillist[j])
2477 { 2489 {
2478 foundUid = namelist[i].uid(); 2490 foundUid = namelist[i].uid();
2479 } 2491 }
2480 } 2492 }
2481 } 2493 }
2482 } 2494 }
2483 } 2495 }
2484 else 2496 else
2485 { 2497 {
2486 foundUid = uid; 2498 foundUid = uid;
2487 } 2499 }
2488 2500
2489 if (!foundUid.isEmpty()) 2501 if (!foundUid.isEmpty())
2490 { 2502 {
2491 2503
2492 // raise Ka/Pi if it is in the background 2504 // raise Ka/Pi if it is in the background
2493#ifndef DESKTOP_VERSION 2505#ifndef DESKTOP_VERSION
2494#ifndef KORG_NODCOP 2506#ifndef KORG_NODCOP
2495 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2507 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2496#endif 2508#endif
2497#endif 2509#endif
2498 2510
2499 mMainWindow->showMaximized(); 2511 mMainWindow->showMaximized();
2500 mMainWindow-> raise(); 2512 mMainWindow-> raise();
2501 2513
2502 mViewManager->setSelected( "", false); 2514 mViewManager->setSelected( "", false);
2503 mViewManager->refreshView( "" ); 2515 mViewManager->refreshView( "" );
2504 mViewManager->setSelected( foundUid, true ); 2516 mViewManager->setSelected( foundUid, true );
2505 mViewManager->refreshView( foundUid ); 2517 mViewManager->refreshView( foundUid );
2506 2518
2507 if ( !mMultipleViewsAtOnce ) 2519 if ( !mMultipleViewsAtOnce )
2508 { 2520 {
2509 setDetailsVisible( true ); 2521 setDetailsVisible( true );
2510 mActionDetails->setChecked(true); 2522 mActionDetails->setChecked(true);
2511 } 2523 }
2512 } 2524 }
2513} 2525}
2514 2526
2515void KABCore::whatsnew() 2527void KABCore::whatsnew()
2516{ 2528{
2517 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 2529 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2518} 2530}
2519void KABCore::synchowto() 2531void KABCore::synchowto()
2520{ 2532{
2521 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 2533 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2522} 2534}
2523void KABCore::kdesynchowto() 2535void KABCore::kdesynchowto()
2524{ 2536{
2525 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 2537 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
2526} 2538}
2527void KABCore::multisynchowto() 2539void KABCore::multisynchowto()
2528{ 2540{
2529 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 2541 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
2530} 2542}
2531void KABCore::faq() 2543void KABCore::faq()
2532{ 2544{
2533 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2545 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2534} 2546}
2535 2547
2536#include <libkcal/syncdefines.h> 2548#include <libkcal/syncdefines.h>
2537 2549
2538KABC::Addressee KABCore::getLastSyncAddressee() 2550KABC::Addressee KABCore::getLastSyncAddressee()
2539{ 2551{
2540 Addressee lse; 2552 Addressee lse;
2541 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2553 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2542 2554
2543 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2555 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2544 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2556 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2545 if (lse.isEmpty()) { 2557 if (lse.isEmpty()) {
2546 qDebug("Creating new last-syncAddressee "); 2558 qDebug("Creating new last-syncAddressee ");
2547 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2559 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
2548 QString sum = ""; 2560 QString sum = "";
2549 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 2561 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2550 sum = "E: "; 2562 sum = "E: ";
2551 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2563 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2552 lse.setRevision( mLastAddressbookSync ); 2564 lse.setRevision( mLastAddressbookSync );
2553 lse.setCategories( i18n("SyncEvent") ); 2565 lse.setCategories( i18n("SyncEvent") );
2554 mAddressBook->insertAddressee( lse ); 2566 mAddressBook->insertAddressee( lse );
2555 } 2567 }
2556 return lse; 2568 return lse;
2557} 2569}
2558int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2570int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2559{ 2571{
2560 2572
2561 //void setZaurusId(int id); 2573 //void setZaurusId(int id);
2562 // int zaurusId() const; 2574 // int zaurusId() const;
2563 // void setZaurusUid(int id); 2575 // void setZaurusUid(int id);
2564 // int zaurusUid() const; 2576 // int zaurusUid() const;
2565 // void setZaurusStat(int id); 2577 // void setZaurusStat(int id);
2566 // int zaurusStat() const; 2578 // int zaurusStat() const;
2567 // 0 equal 2579 // 0 equal
2568 // 1 take local 2580 // 1 take local
2569 // 2 take remote 2581 // 2 take remote
2570 // 3 cancel 2582 // 3 cancel
2571 QDateTime lastSync = mLastAddressbookSync; 2583 QDateTime lastSync = mLastAddressbookSync;
2572 QDateTime localMod = local->revision(); 2584 QDateTime localMod = local->revision();
2573 QDateTime remoteMod = remote->revision(); 2585 QDateTime remoteMod = remote->revision();
2574 2586
2575 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2587 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2576 2588
2577 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2589 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2578 bool remCh, locCh; 2590 bool remCh, locCh;
2579 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2591 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2580 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2592 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2581 locCh = ( localMod > mLastAddressbookSync ); 2593 locCh = ( localMod > mLastAddressbookSync );
2582 if ( !remCh && ! locCh ) { 2594 if ( !remCh && ! locCh ) {
2583 //qDebug("both not changed "); 2595 //qDebug("both not changed ");
2584 lastSync = localMod.addDays(1); 2596 lastSync = localMod.addDays(1);
2585 if ( mode <= SYNC_PREF_ASK ) 2597 if ( mode <= SYNC_PREF_ASK )
2586 return 0; 2598 return 0;
2587 } else { 2599 } else {
2588 if ( locCh ) { 2600 if ( locCh ) {
2589 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); 2601 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2590 lastSync = localMod.addDays( -1 ); 2602 lastSync = localMod.addDays( -1 );
2591 if ( !remCh ) 2603 if ( !remCh )
2592 remoteMod =( lastSync.addDays( -1 ) ); 2604 remoteMod =( lastSync.addDays( -1 ) );
2593 } else { 2605 } else {
2594 //qDebug(" not loc changed "); 2606 //qDebug(" not loc changed ");
2595 lastSync = localMod.addDays( 1 ); 2607 lastSync = localMod.addDays( 1 );
2596 if ( remCh ) { 2608 if ( remCh ) {
2597 //qDebug("rem changed "); 2609 //qDebug("rem changed ");
2598 remoteMod =( lastSync.addDays( 1 ) ); 2610 remoteMod =( lastSync.addDays( 1 ) );
2599 } 2611 }
2600 2612
2601 } 2613 }
2602 } 2614 }
2603 full = true; 2615 full = true;
2604 if ( mode < SYNC_PREF_ASK ) 2616 if ( mode < SYNC_PREF_ASK )
2605 mode = SYNC_PREF_ASK; 2617 mode = SYNC_PREF_ASK;
2606 } else { 2618 } else {
2607 if ( localMod == remoteMod ) 2619 if ( localMod == remoteMod )
2608 return 0; 2620 return 0;
2609 2621
2610 } 2622 }
2611 //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); 2623 //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec());
2612 //qDebug("lastsync %s ", lastSync.toString().latin1() ); 2624 //qDebug("lastsync %s ", lastSync.toString().latin1() );
2613 //full = true; //debug only 2625 //full = true; //debug only
2614 if ( full ) { 2626 if ( full ) {
2615 bool equ = ( (*local) == (*remote) ); 2627 bool equ = ( (*local) == (*remote) );
2616 if ( equ ) { 2628 if ( equ ) {
2617 //qDebug("equal "); 2629 //qDebug("equal ");
2618 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2630 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2619 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 2631 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
2620 } 2632 }
2621 if ( mode < SYNC_PREF_FORCE_LOCAL ) 2633 if ( mode < SYNC_PREF_FORCE_LOCAL )
2622 return 0; 2634 return 0;
2623 2635
2624 }//else //debug only 2636 }//else //debug only
2625 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 2637 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
2626 } 2638 }
2627 int result; 2639 int result;
2628 bool localIsNew; 2640 bool localIsNew;
2629 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); 2641 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() );
2630 2642
2631 if ( full && mode < SYNC_PREF_NEWEST ) 2643 if ( full && mode < SYNC_PREF_NEWEST )
2632 mode = SYNC_PREF_ASK; 2644 mode = SYNC_PREF_ASK;
2633 2645
2634 switch( mode ) { 2646 switch( mode ) {
2635 case SYNC_PREF_LOCAL: 2647 case SYNC_PREF_LOCAL:
2636 if ( lastSync > remoteMod ) 2648 if ( lastSync > remoteMod )
2637 return 1; 2649 return 1;
2638 if ( lastSync > localMod ) 2650 if ( lastSync > localMod )
2639 return 2; 2651 return 2;
2640 return 1; 2652 return 1;
2641 break; 2653 break;
2642 case SYNC_PREF_REMOTE: 2654 case SYNC_PREF_REMOTE:
2643 if ( lastSync > remoteMod ) 2655 if ( lastSync > remoteMod )
2644 return 1; 2656 return 1;
2645 if ( lastSync > localMod ) 2657 if ( lastSync > localMod )
2646 return 2; 2658 return 2;
2647 return 2; 2659 return 2;
2648 break; 2660 break;
2649 case SYNC_PREF_NEWEST: 2661 case SYNC_PREF_NEWEST:
2650 if ( localMod > remoteMod ) 2662 if ( localMod > remoteMod )
2651 return 1; 2663 return 1;
2652 else 2664 else
2653 return 2; 2665 return 2;
2654 break; 2666 break;
2655 case SYNC_PREF_ASK: 2667 case SYNC_PREF_ASK:
2656 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 2668 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2657 if ( lastSync > remoteMod ) 2669 if ( lastSync > remoteMod )
2658 return 1; 2670 return 1;
2659 if ( lastSync > localMod ) 2671 if ( lastSync > localMod )
2660 return 2; 2672 return 2;
2661 localIsNew = localMod >= remoteMod; 2673 localIsNew = localMod >= remoteMod;
2662 //qDebug("conflict! ************************************** "); 2674 //qDebug("conflict! ************************************** ");
2663 { 2675 {
2664 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); 2676 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this );
2665 result = acd.executeD(localIsNew); 2677 result = acd.executeD(localIsNew);
2666 return result; 2678 return result;
2667 } 2679 }
2668 break; 2680 break;
2669 case SYNC_PREF_FORCE_LOCAL: 2681 case SYNC_PREF_FORCE_LOCAL:
2670 return 1; 2682 return 1;
2671 break; 2683 break;
2672 case SYNC_PREF_FORCE_REMOTE: 2684 case SYNC_PREF_FORCE_REMOTE:
2673 return 2; 2685 return 2;
2674 break; 2686 break;
2675 2687
2676 default: 2688 default:
2677 // SYNC_PREF_TAKE_BOTH not implemented 2689 // SYNC_PREF_TAKE_BOTH not implemented
2678 break; 2690 break;
2679 } 2691 }
2680 return 0; 2692 return 0;
2681} 2693}
2682 2694
2683 2695
2684bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) 2696bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
2685{ 2697{
2686 bool syncOK = true; 2698 bool syncOK = true;
2687 int addedAddressee = 0; 2699 int addedAddressee = 0;
2688 int addedAddresseeR = 0; 2700 int addedAddresseeR = 0;
2689 int deletedAddresseeR = 0; 2701 int deletedAddresseeR = 0;
2690 int deletedAddresseeL = 0; 2702 int deletedAddresseeL = 0;
2691 int changedLocal = 0; 2703 int changedLocal = 0;
2692 int changedRemote = 0; 2704 int changedRemote = 0;
2693 2705
2694 QString mCurrentSyncName = syncManager->getCurrentSyncName(); 2706 QString mCurrentSyncName = syncManager->getCurrentSyncName();
2695 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2707 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2696 2708
2697 //QPtrList<Addressee> el = local->rawAddressees(); 2709 //QPtrList<Addressee> el = local->rawAddressees();
2698 Addressee addresseeR; 2710 Addressee addresseeR;
2699 QString uid; 2711 QString uid;
2700 int take; 2712 int take;
2701 Addressee addresseeL; 2713 Addressee addresseeL;
2702 Addressee addresseeRSync; 2714 Addressee addresseeRSync;
2703 Addressee addresseeLSync; 2715 Addressee addresseeLSync;
2704 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); 2716 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees();
2705 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); 2717 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees();
2706 bool fullDateRange = false; 2718 bool fullDateRange = false;
2707 local->resetTempSyncStat(); 2719 local->resetTempSyncStat();
2708 mLastAddressbookSync = QDateTime::currentDateTime(); 2720 mLastAddressbookSync = QDateTime::currentDateTime();
2709 if ( syncManager->syncWithDesktop() ) { 2721 if ( syncManager->syncWithDesktop() ) {
2710 // remote->removeSyncInfo( QString());//remove all info 2722 // remote->removeSyncInfo( QString());//remove all info
2711 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 2723 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
2712 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; 2724 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent;
2713 qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); 2725 qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() );
2714 } else { 2726 } else {
2715 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 2727 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
2716 } 2728 }
2717 } 2729 }
2718 QDateTime modifiedCalendar = mLastAddressbookSync; 2730 QDateTime modifiedCalendar = mLastAddressbookSync;
2719 addresseeLSync = getLastSyncAddressee(); 2731 addresseeLSync = getLastSyncAddressee();
2720 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); 2732 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1());
2721 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); 2733 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName );
2722 if ( !addresseeR.isEmpty() ) { 2734 if ( !addresseeR.isEmpty() ) {
2723 addresseeRSync = addresseeR; 2735 addresseeRSync = addresseeR;
2724 remote->removeAddressee(addresseeR ); 2736 remote->removeAddressee(addresseeR );
2725 2737
2726 } else { 2738 } else {
2727 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2739 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2728 addresseeRSync = addresseeLSync ; 2740 addresseeRSync = addresseeLSync ;
2729 } else { 2741 } else {
2730 //qDebug("FULLDATE 1"); 2742 //qDebug("FULLDATE 1");
2731 fullDateRange = true; 2743 fullDateRange = true;
2732 Addressee newAdd; 2744 Addressee newAdd;
2733 addresseeRSync = newAdd; 2745 addresseeRSync = newAdd;
2734 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); 2746 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
2735 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); 2747 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
2736 addresseeRSync.setRevision( mLastAddressbookSync ); 2748 addresseeRSync.setRevision( mLastAddressbookSync );
2737 addresseeRSync.setCategories( i18n("SyncAddressee") ); 2749 addresseeRSync.setCategories( i18n("SyncAddressee") );
2738 } 2750 }
2739 } 2751 }
2740 if ( addresseeLSync.revision() == mLastAddressbookSync ) { 2752 if ( addresseeLSync.revision() == mLastAddressbookSync ) {
2741 // qDebug("FULLDATE 2"); 2753 // qDebug("FULLDATE 2");
2742 fullDateRange = true; 2754 fullDateRange = true;
2743 } 2755 }
2744 if ( ! fullDateRange ) { 2756 if ( ! fullDateRange ) {
2745 if ( addresseeLSync.revision() != addresseeRSync.revision() ) { 2757 if ( addresseeLSync.revision() != addresseeRSync.revision() ) {
2746 2758
2747 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); 2759 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
2748 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); 2760 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
2749 fullDateRange = true; 2761 fullDateRange = true;
2750 //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); 2762 //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() );
2751 } 2763 }
2752 } 2764 }
2753 // fullDateRange = true; // debug only! 2765 // fullDateRange = true; // debug only!
2754 if ( fullDateRange ) 2766 if ( fullDateRange )
2755 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); 2767 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365);
2756 else 2768 else
2757 mLastAddressbookSync = addresseeLSync.revision(); 2769 mLastAddressbookSync = addresseeLSync.revision();
2758 // for resyncing if own file has changed 2770 // for resyncing if own file has changed
2759 // PENDING fixme later when implemented 2771 // PENDING fixme later when implemented
2760#if 0 2772#if 0
2761 if ( mCurrentSyncDevice == "deleteaftersync" ) { 2773 if ( mCurrentSyncDevice == "deleteaftersync" ) {
2762 mLastAddressbookSync = loadedFileVersion; 2774 mLastAddressbookSync = loadedFileVersion;
2763 qDebug("setting mLastAddressbookSync "); 2775 qDebug("setting mLastAddressbookSync ");
2764 } 2776 }
2765#endif 2777#endif
2766 2778
2767 //qDebug("*************************** "); 2779 //qDebug("*************************** ");
2768 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); 2780 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
2769 QStringList er = remote->uidList(); 2781 QStringList er = remote->uidList();
2770 Addressee inR ;//= er.first(); 2782 Addressee inR ;//= er.first();
2771 Addressee inL; 2783 Addressee inL;
2772 2784
2773 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); 2785 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count());
2774 2786
2775 int modulo = (er.count()/10)+1; 2787 int modulo = (er.count()/10)+1;
2776 int incCounter = 0; 2788 int incCounter = 0;
2777 while ( incCounter < er.count()) { 2789 while ( incCounter < er.count()) {
2778 if (syncManager->isProgressBarCanceled()) 2790 if (syncManager->isProgressBarCanceled())
2779 return false; 2791 return false;
2780 if ( incCounter % modulo == 0 ) 2792 if ( incCounter % modulo == 0 )
2781 syncManager->showProgressBar(incCounter); 2793 syncManager->showProgressBar(incCounter);
2782 2794
2783 uid = er[ incCounter ]; 2795 uid = er[ incCounter ];
2784 bool skipIncidence = false; 2796 bool skipIncidence = false;
2785 if ( uid.left(19) == QString("last-syncAddressee-") ) 2797 if ( uid.left(19) == QString("last-syncAddressee-") )
2786 skipIncidence = true; 2798 skipIncidence = true;
2787 QString idS,OidS; 2799 QString idS,OidS;
2788 qApp->processEvents(); 2800 qApp->processEvents();
2789 if ( !skipIncidence ) { 2801 if ( !skipIncidence ) {
2790 inL = local->findByUid( uid ); 2802 inL = local->findByUid( uid );
2791 inR = remote->findByUid( uid ); 2803 inR = remote->findByUid( uid );
2792 //inL.setResource( 0 ); 2804 //inL.setResource( 0 );
2793 //inR.setResource( 0 ); 2805 //inR.setResource( 0 );
2794 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars 2806 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars
2795 if ( !inL.resource() || inL.resource()->includeInSync() ) { 2807 if ( !inL.resource() || inL.resource()->includeInSync() ) {
2796 if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) { 2808 if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) {
2797 //qDebug("take %d %s ", take, inL.summary().latin1()); 2809 //qDebug("take %d %s ", take, inL.summary().latin1());
2798 if ( take == 3 ) 2810 if ( take == 3 )
2799 return false; 2811 return false;
2800 if ( take == 1 ) {// take local ********************** 2812 if ( take == 1 ) {// take local **********************
2801 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2813 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2802 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2814 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2803 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2815 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2804 local->insertAddressee( inL, false ); 2816 local->insertAddressee( inL, false );
2805 idS = inR.externalUID(); 2817 idS = inR.externalUID();
2806 OidS = inR.originalExternalUID(); 2818 OidS = inR.originalExternalUID();
2807 } 2819 }
2808 else 2820 else
2809 idS = inR.IDStr(); 2821 idS = inR.IDStr();
2810 remote->removeAddressee( inR ); 2822 remote->removeAddressee( inR );
2811 inR = inL; 2823 inR = inL;
2812 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 2824 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
2813 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2825 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2814 inR.setOriginalExternalUID( OidS ); 2826 inR.setOriginalExternalUID( OidS );
2815 inR.setExternalUID( idS ); 2827 inR.setExternalUID( idS );
2816 if ( syncManager->syncWithDesktop() ) { 2828 if ( syncManager->syncWithDesktop() ) {
2817 inR.setIDStr("changed" ); 2829 inR.setIDStr("changed" );
2818 } 2830 }
2819 //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); 2831 //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" );
2820 } else { 2832 } else {
2821 inR.setIDStr( idS ); 2833 inR.setIDStr( idS );
2822 } 2834 }
2823 inR.setResource( 0 ); 2835 inR.setResource( 0 );
2824 remote->insertAddressee( inR , false); 2836 remote->insertAddressee( inR , false);
2825 ++changedRemote; 2837 ++changedRemote;
2826 } else { // take == 2 take remote ********************** 2838 } else { // take == 2 take remote **********************
2827 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2839 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2828 if ( inR.revision().date().year() < 2004 ) 2840 if ( inR.revision().date().year() < 2004 )
2829 inR.setRevision( modifiedCalendar ); 2841 inR.setRevision( modifiedCalendar );
2830 } 2842 }
2831 idS = inL.IDStr(); 2843 idS = inL.IDStr();
2832 local->removeAddressee( inL ); 2844 local->removeAddressee( inL );
2833 inL = inR; 2845 inL = inR;
2834 inL.setIDStr( idS ); 2846 inL.setIDStr( idS );
2835 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2847 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2836 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2848 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2837 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2849 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2838 } 2850 }
2839 inL.setResource( 0 ); 2851 inL.setResource( 0 );
2840 local->insertAddressee( inL , false ); 2852 local->insertAddressee( inL , false );
2841 ++changedLocal; 2853 ++changedLocal;
2842 } 2854 }
2843 } 2855 }
2844 } 2856 }
2845 } else { // no conflict ********** add or delete remote 2857 } else { // no conflict ********** add or delete remote
2846 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2858 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2847 QString des = addresseeLSync.note(); 2859 QString des = addresseeLSync.note();
2848 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 2860 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
2849 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 2861 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE );
2850 remote->insertAddressee( inR, false ); 2862 remote->insertAddressee( inR, false );
2851 ++deletedAddresseeR; 2863 ++deletedAddresseeR;
2852 } else { 2864 } else {
2853 inR.setRevision( modifiedCalendar ); 2865 inR.setRevision( modifiedCalendar );
2854 remote->insertAddressee( inR, false ); 2866 remote->insertAddressee( inR, false );
2855 inL = inR; 2867 inL = inR;
2856 inL.setIDStr( ":" ); 2868 inL.setIDStr( ":" );
2857 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2869 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2858 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2870 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2859 inL.setResource( 0 ); 2871 inL.setResource( 0 );
2860 local->insertAddressee( inL , false); 2872 local->insertAddressee( inL , false);
2861 ++addedAddressee; 2873 ++addedAddressee;
2862 } 2874 }
2863 } else { 2875 } else {
2864 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { 2876 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) {
2865 inR.setRevision( modifiedCalendar ); 2877 inR.setRevision( modifiedCalendar );
2866 remote->insertAddressee( inR, false ); 2878 remote->insertAddressee( inR, false );
2867 inR.setResource( 0 ); 2879 inR.setResource( 0 );
2868 local->insertAddressee( inR, false ); 2880 local->insertAddressee( inR, false );
2869 ++addedAddressee; 2881 ++addedAddressee;
2870 } else { 2882 } else {
2871 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); 2883 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR);
2872 remote->removeAddressee( inR ); 2884 remote->removeAddressee( inR );
2873 ++deletedAddresseeR; 2885 ++deletedAddresseeR;
2874 } 2886 }
2875 } 2887 }
2876 } 2888 }
2877 } 2889 }
2878 ++incCounter; 2890 ++incCounter;
2879 } 2891 }
2880 er.clear(); 2892 er.clear();
2881 QStringList el = local->uidList(); 2893 QStringList el = local->uidList();
2882 modulo = (el.count()/10)+1; 2894 modulo = (el.count()/10)+1;
2883 2895
2884 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); 2896 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count());
2885 incCounter = 0; 2897 incCounter = 0;
2886 while ( incCounter < el.count()) { 2898 while ( incCounter < el.count()) {
2887 qApp->processEvents(); 2899 qApp->processEvents();
2888 if (syncManager->isProgressBarCanceled()) 2900 if (syncManager->isProgressBarCanceled())
2889 return false; 2901 return false;
2890 if ( incCounter % modulo == 0 ) 2902 if ( incCounter % modulo == 0 )
2891 syncManager->showProgressBar(incCounter); 2903 syncManager->showProgressBar(incCounter);
2892 uid = el[ incCounter ]; 2904 uid = el[ incCounter ];
2893 bool skipIncidence = false; 2905 bool skipIncidence = false;
2894 if ( uid.left(19) == QString("last-syncAddressee-") ) 2906 if ( uid.left(19) == QString("last-syncAddressee-") )
2895 skipIncidence = true; 2907 skipIncidence = true;
2896 if ( !skipIncidence ) { 2908 if ( !skipIncidence ) {
2897 inL = local->findByUid( uid ); 2909 inL = local->findByUid( uid );
2898 if ( !inL.resource() || inL.resource()->includeInSync() ) { 2910 if ( !inL.resource() || inL.resource()->includeInSync() ) {
2899 inR = remote->findByUid( uid ); 2911 inR = remote->findByUid( uid );
2900 if ( inR.isEmpty() ) { // no conflict ********** add or delete local 2912 if ( inR.isEmpty() ) { // no conflict ********** add or delete local
2901 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2913 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2902 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 2914 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
2903 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2915 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2904 local->removeAddressee( inL ); 2916 local->removeAddressee( inL );
2905 ++deletedAddresseeL; 2917 ++deletedAddresseeL;
2906 } else { 2918 } else {
2907 if ( ! syncManager->mWriteBackExistingOnly ) { 2919 if ( ! syncManager->mWriteBackExistingOnly ) {
2908 inL.removeID(mCurrentSyncDevice ); 2920 inL.removeID(mCurrentSyncDevice );
2909 ++addedAddresseeR; 2921 ++addedAddresseeR;
2910 inL.setRevision( modifiedCalendar ); 2922 inL.setRevision( modifiedCalendar );
2911 local->insertAddressee( inL, false ); 2923 local->insertAddressee( inL, false );
2912 inR = inL; 2924 inR = inL;
2913 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); 2925 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
2914 inR.setResource( 0 ); 2926 inR.setResource( 0 );
2915 remote->insertAddressee( inR, false ); 2927 remote->insertAddressee( inR, false );
2916 } 2928 }
2917 } 2929 }
2918 } else { 2930 } else {
2919 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { 2931 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
2920 //qDebug("data %s ", inL.revision().toString().latin1()); 2932 //qDebug("data %s ", inL.revision().toString().latin1());
2921 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2933 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2922 local->removeAddressee( inL ); 2934 local->removeAddressee( inL );
2923 ++deletedAddresseeL; 2935 ++deletedAddresseeL;
2924 } else { 2936 } else {
2925 if ( ! syncManager->mWriteBackExistingOnly ) { 2937 if ( ! syncManager->mWriteBackExistingOnly ) {
2926 ++addedAddresseeR; 2938 ++addedAddresseeR;
2927 inL.setRevision( modifiedCalendar ); 2939 inL.setRevision( modifiedCalendar );
2928 local->insertAddressee( inL, false ); 2940 local->insertAddressee( inL, false );
2929 inR = inL; 2941 inR = inL;
2930 inR.setIDStr( ":" ); 2942 inR.setIDStr( ":" );
2931 inR.setResource( 0 ); 2943 inR.setResource( 0 );
2932 remote->insertAddressee( inR, false ); 2944 remote->insertAddressee( inR, false );
2933 } 2945 }
2934 } 2946 }
2935 } 2947 }
2936 } 2948 }
2937 } 2949 }
2938 } 2950 }
2939 ++incCounter; 2951 ++incCounter;
2940 } 2952 }
2941 el.clear(); 2953 el.clear();
2942 syncManager->hideProgressBar(); 2954 syncManager->hideProgressBar();
2943 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 2955 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
2944 // get rid of micro seconds 2956 // get rid of micro seconds
2945 QTime t = mLastAddressbookSync.time(); 2957 QTime t = mLastAddressbookSync.time();
2946 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 2958 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
2947 addresseeLSync.setRevision( mLastAddressbookSync ); 2959 addresseeLSync.setRevision( mLastAddressbookSync );
2948 addresseeRSync.setRevision( mLastAddressbookSync ); 2960 addresseeRSync.setRevision( mLastAddressbookSync );
2949 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 2961 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
2950 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 2962 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
2951 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 2963 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
2952 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 2964 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
2953 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 2965 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
2954 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2966 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2955 addresseeRSync.setNote( "" ) ; 2967 addresseeRSync.setNote( "" ) ;
2956 addresseeLSync.setNote( "" ); 2968 addresseeLSync.setNote( "" );
2957 2969
2958 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 2970 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
2959 remote->insertAddressee( addresseeRSync, false ); 2971 remote->insertAddressee( addresseeRSync, false );
2960 local->insertAddressee( addresseeLSync, false ); 2972 local->insertAddressee( addresseeLSync, false );
2961 QString mes; 2973 QString mes;
2962 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); 2974 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR );
2963 qDebug( mes ); 2975 qDebug( mes );
2964 mes = i18n("Local addressbook changed!\n") +mes; 2976 mes = i18n("Local addressbook changed!\n") +mes;
2965 if ( syncManager->mShowSyncSummary ) { 2977 if ( syncManager->mShowSyncSummary ) {
2966 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 2978 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
2967 i18n("KA/Pi Synchronization"),i18n("Write back"))) { 2979 i18n("KA/Pi Synchronization"),i18n("Write back"))) {
2968 qDebug("cancelled "); 2980 qDebug("cancelled ");
2969 return false; 2981 return false;
2970 } 2982 }
2971 } 2983 }
2972 return syncOK; 2984 return syncOK;
2973} 2985}
2974 2986
2975 2987
2976//this is a overwritten callbackmethods from the syncinterface 2988//this is a overwritten callbackmethods from the syncinterface
2977bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 2989bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2978{ 2990{
2979 2991
2980 //pending prepare addresseeview for output 2992 //pending prepare addresseeview for output
2981 //pending detect, if remote file has REV field. if not switch to external sync 2993 //pending detect, if remote file has REV field. if not switch to external sync
2982 mGlobalSyncMode = SYNC_MODE_NORMAL; 2994 mGlobalSyncMode = SYNC_MODE_NORMAL;
2983 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2995 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2984 2996
2985 AddressBook abLocal(filename,"syncContact"); 2997 AddressBook abLocal(filename,"syncContact");
2986 bool syncOK = false; 2998 bool syncOK = false;
2987 if ( abLocal.load() ) { 2999 if ( abLocal.load() ) {
2988 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); 3000 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
2989 bool external = false; 3001 bool external = false;
2990 bool isXML = false; 3002 bool isXML = false;
2991 if ( filename.right(4) == ".xml") { 3003 if ( filename.right(4) == ".xml") {
2992 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3004 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2993 isXML = true; 3005 isXML = true;
2994 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 3006 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
2995 } else { 3007 } else {
2996 external = !manager->mIsKapiFile; 3008 external = !manager->mIsKapiFile;
2997 if ( external ) { 3009 if ( external ) {
2998 qDebug("Setting vcf mode to external "); 3010 qDebug("Setting vcf mode to external ");
2999 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3011 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3000 AddressBook::Iterator it; 3012 AddressBook::Iterator it;
3001 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 3013 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
3002 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 3014 (*it).setID( mCurrentSyncDevice, (*it).uid() );
3003 (*it).computeCsum( mCurrentSyncDevice ); 3015 (*it).computeCsum( mCurrentSyncDevice );
3004 } 3016 }
3005 } 3017 }
3006 } 3018 }
3007 //AddressBook::Iterator it; 3019 //AddressBook::Iterator it;
3008 //QStringList vcards; 3020 //QStringList vcards;
3009 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 3021 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
3010 // qDebug("Name %s ", (*it).familyName().latin1()); 3022 // qDebug("Name %s ", (*it).familyName().latin1());
3011 //} 3023 //}
3012 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 3024 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
3013 if ( syncOK ) { 3025 if ( syncOK ) {
3014 if ( syncManager->mWriteBackFile ) 3026 if ( syncManager->mWriteBackFile )
3015 { 3027 {
3016 if ( external ) 3028 if ( external )
3017 abLocal.removeSyncAddressees( !isXML); 3029 abLocal.removeSyncAddressees( !isXML);
3018 qDebug("Saving remote AB "); 3030 qDebug("Saving remote AB ");
3019 if ( ! abLocal.saveAB()) 3031 if ( ! abLocal.saveAB())
3020 qDebug("Error writing back AB to file "); 3032 qDebug("Error writing back AB to file ");
3021 if ( external ) { 3033 if ( external ) {
3022 // afterwrite processing 3034 // afterwrite processing
3023 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); 3035 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML);
3024 } 3036 }
3025 } 3037 }
3026 } 3038 }
3027 setModified(); 3039 setModified();
3028 3040
3029 } 3041 }
3030 abLocal.removeResources(); 3042 abLocal.removeResources();
3031 if ( syncOK ) 3043 if ( syncOK )
3032 mViewManager->refreshView(); 3044 mViewManager->refreshView();
3033 return syncOK; 3045 return syncOK;
3034 3046
3035} 3047}
3036void KABCore::removeSyncInfo( QString syncProfile) 3048void KABCore::removeSyncInfo( QString syncProfile)
3037{ 3049{
3038 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); 3050 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1());
3039 mAddressBook->removeSyncInfo( syncProfile ); 3051 mAddressBook->removeSyncInfo( syncProfile );
3040 setModified(); 3052 setModified();
3041} 3053}
3042 3054
3043 3055
3044//this is a overwritten callbackmethods from the syncinterface 3056//this is a overwritten callbackmethods from the syncinterface
3045bool KABCore::syncExternal(KSyncManager* manager, QString resource) 3057bool KABCore::syncExternal(KSyncManager* manager, QString resource)
3046{ 3058{
3047 if ( resource == "phone" ) 3059 if ( resource == "phone" )
3048 return syncPhone(); 3060 return syncPhone();
3049 disableBR( true ); 3061 disableBR( true );
3050 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3062 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3051 3063
3052 AddressBook abLocal( resource,"syncContact"); 3064 AddressBook abLocal( resource,"syncContact");
3053 bool syncOK = false; 3065 bool syncOK = false;
3054 if ( abLocal.load() ) { 3066 if ( abLocal.load() ) {
3055 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3067 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
3056 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3068 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3057 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 3069 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
3058 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3070 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3059 if ( syncOK ) { 3071 if ( syncOK ) {
3060 if ( syncManager->mWriteBackFile ) { 3072 if ( syncManager->mWriteBackFile ) {
3061 abLocal.removeSyncAddressees( false ); 3073 abLocal.removeSyncAddressees( false );
3062 abLocal.saveAB(); 3074 abLocal.saveAB();
3063 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3075 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3064 } 3076 }
3065 } else 3077 } else
3066 message( i18n("Sync cancelled or failed.") ); 3078 message( i18n("Sync cancelled or failed.") );
3067 setModified(); 3079 setModified();
3068 } 3080 }
3069 abLocal.removeResources(); 3081 abLocal.removeResources();
3070 if ( syncOK ) 3082 if ( syncOK )
3071 mViewManager->refreshView(); 3083 mViewManager->refreshView();
3072 disableBR( false ); 3084 disableBR( false );
3073 return syncOK; 3085 return syncOK;
3074 3086
3075} 3087}
3076void KABCore::message( QString m ) 3088void KABCore::message( QString m )
3077{ 3089{
3078 topLevelWidget()->setCaption( m ); 3090 topLevelWidget()->setCaption( m );
3079 mMessageTimer->start( 15000, true ); 3091 mMessageTimer->start( 15000, true );
3080} 3092}
3081bool KABCore::syncPhone() 3093bool KABCore::syncPhone()
3082{ 3094{
3083 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 3095 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
3084 QString fileName = getPhoneFile(); 3096 QString fileName = getPhoneFile();
3085 if ( !PhoneAccess::readFromPhone( fileName) ) { 3097 if ( !PhoneAccess::readFromPhone( fileName) ) {
3086 message(i18n("Phone access failed!")); 3098 message(i18n("Phone access failed!"));
3087 return false; 3099 return false;
3088 } 3100 }
3089 AddressBook abLocal( fileName,"syncContact"); 3101 AddressBook abLocal( fileName,"syncContact");
3090 bool syncOK = false; 3102 bool syncOK = false;
3091 { 3103 {
3092 abLocal.importFromFile( fileName ); 3104 abLocal.importFromFile( fileName );
3093 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3105 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
3094 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3106 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3095 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 3107 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
3096 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 3108 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
3097 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3109 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3098 if ( syncOK ) { 3110 if ( syncOK ) {
3099 if ( syncManager->mWriteBackFile ) { 3111 if ( syncManager->mWriteBackFile ) {
3100 abLocal.removeSyncAddressees( true ); 3112 abLocal.removeSyncAddressees( true );
3101 abLocal.saveABphone( fileName ); 3113 abLocal.saveABphone( fileName );
3102 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 3114 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
3103 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 3115 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
3104 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3116 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3105 } 3117 }
3106 } 3118 }
3107 setModified(); 3119 setModified();
3108 } 3120 }
3109 abLocal.removeResources(); 3121 abLocal.removeResources();
3110 if ( syncOK ) 3122 if ( syncOK )
3111 mViewManager->refreshView(); 3123 mViewManager->refreshView();
3112 return syncOK; 3124 return syncOK;
3113} 3125}
3114void KABCore::getFile( bool success ) 3126void KABCore::getFile( bool success )
3115{ 3127{
3116 if ( ! success ) { 3128 if ( ! success ) {
3117 message( i18n("Error receiving file. Nothing changed!") ); 3129 message( i18n("Error receiving file. Nothing changed!") );
3118 return; 3130 return;
3119 } 3131 }
3120 int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); 3132 int count = mAddressBook->importFromFile( sentSyncFile() , false, true );
3121 if ( count ) 3133 if ( count )
3122 setModified( true ); 3134 setModified( true );
3123 message( i18n("Pi-Sync successful!") ); 3135 message( i18n("Pi-Sync successful!") );
3124 mViewManager->refreshView(); 3136 mViewManager->refreshView();
3125} 3137}
3126void KABCore::syncFileRequest() 3138void KABCore::syncFileRequest()
3127{ 3139{
3128 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { 3140 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) {
3129 syncManager->slotSyncMenu( 999 ); 3141 syncManager->slotSyncMenu( 999 );
3130 } 3142 }
3131 mAddressBook->export2File( sentSyncFile() ); 3143 mAddressBook->export2File( sentSyncFile() );
3132} 3144}
3133QString KABCore::sentSyncFile() 3145QString KABCore::sentSyncFile()
3134{ 3146{
3135#ifdef DESKTOP_VERSION 3147#ifdef DESKTOP_VERSION
3136 return locateLocal( "tmp", "copysyncab.vcf" ); 3148 return locateLocal( "tmp", "copysyncab.vcf" );
3137#else 3149#else
3138 return QString( "/tmp/copysyncab.vcf" ); 3150 return QString( "/tmp/copysyncab.vcf" );
3139#endif 3151#endif
3140} 3152}
3141 3153
3142void KABCore::setCaptionBack() 3154void KABCore::setCaptionBack()
3143{ 3155{
3144 mMessageTimer->stop(); 3156 mMessageTimer->stop();
3145 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 3157 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
3146} 3158}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index fe2d3a2..88e83f0 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,514 +1,515 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KABCORE_H 24#ifndef KABCORE_H
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32#include <qtimer.h> 32#include <qtimer.h>
33 33
34#include <qwidget.h> 34#include <qwidget.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <ksyncmanager.h> 36#include <ksyncmanager.h>
37#ifndef DESKTOP_VERSION 37#ifndef DESKTOP_VERSION
38#include <qcopchannel_qws.h> 38#include <qcopchannel_qws.h>
39#endif 39#endif
40 40
41namespace KABC { 41namespace KABC {
42class AddressBook; 42class AddressBook;
43} 43}
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46class KAboutData; 46class KAboutData;
47class KConfig; 47class KConfig;
48 48
49class KAddressBookService; 49class KAddressBookService;
50class LDAPSearchDialog; 50class LDAPSearchDialog;
51#else //KAB_EMBEDDED 51#else //KAB_EMBEDDED
52class KAddressBookMain; 52class KAddressBookMain;
53//US class QAction; 53//US class QAction;
54#endif //KAB_EMBEDDED 54#endif //KAB_EMBEDDED
55class KCMultiDialog; 55class KCMultiDialog;
56class KXMLGUIClient; 56class KXMLGUIClient;
57class ExtensionManager; 57class ExtensionManager;
58class XXPortManager; 58class XXPortManager;
59class JumpButtonBar; 59class JumpButtonBar;
60class IncSearchWidget; 60class IncSearchWidget;
61class KDGanttMinimizeSplitter; 61class KDGanttMinimizeSplitter;
62class KAction; 62class KAction;
63class KActionCollection; 63class KActionCollection;
64class KToggleAction; 64class KToggleAction;
65class KSyncProfile; 65class KSyncProfile;
66 66
67class QAction; 67class QAction;
68class QMenuBar; 68class QMenuBar;
69class QSplitter; 69class QSplitter;
70class ViewContainer; 70class ViewContainer;
71class ViewManager; 71class ViewManager;
72class AddresseeEditorDialog; 72class AddresseeEditorDialog;
73class Ir; 73class Ir;
74 74
75class KABCore : public QWidget, public KSyncInterface 75class KABCore : public QWidget, public KSyncInterface
76{ 76{
77 Q_OBJECT 77 Q_OBJECT
78 78
79 public: 79 public:
80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
81 81
82 82
83 ~KABCore(); 83 ~KABCore();
84 84
85 85
86#ifdef KAB_EMBEDDED 86#ifdef KAB_EMBEDDED
87 //US added functionality 87 //US added functionality
88 QPopupMenu* getViewMenu() {return viewMenu;} 88 QPopupMenu* getViewMenu() {return viewMenu;}
89 QPopupMenu* getFilterMenu() {return filterMenu;} 89 QPopupMenu* getFilterMenu() {return filterMenu;}
90 QPopupMenu* getSettingsMenu() {return settingsMenu;} 90 QPopupMenu* getSettingsMenu() {return settingsMenu;}
91 void addActionsManually(); 91 void addActionsManually();
92#endif //KAB_EMBEDDED 92#endif //KAB_EMBEDDED
93 /** 93 /**
94 Restores the global settings. 94 Restores the global settings.
95 */ 95 */
96 void restoreSettings(); 96 void restoreSettings();
97 97
98 /** 98 /**
99 Saves the global settings. 99 Saves the global settings.
100 */ 100 */
101 void saveSettings(); 101 void saveSettings();
102 102
103 /** 103 /**
104 Returns a pointer to the StdAddressBook of the application. 104 Returns a pointer to the StdAddressBook of the application.
105 */ 105 */
106 KABC::AddressBook *addressBook() const; 106 KABC::AddressBook *addressBook() const;
107 107
108 /** 108 /**
109 Returns a pointer to the KConfig object of the application. 109 Returns a pointer to the KConfig object of the application.
110 */ 110 */
111 static KConfig *config(); 111 static KConfig *config();
112 112
113 /** 113 /**
114 Returns a pointer to the global KActionCollection object. So 114 Returns a pointer to the global KActionCollection object. So
115 other classes can register their actions easily. 115 other classes can register their actions easily.
116 */ 116 */
117 KActionCollection *actionCollection() const; 117 KActionCollection *actionCollection() const;
118 118
119 /** 119 /**
120 Returns the current search field of the Incremental Search Widget. 120 Returns the current search field of the Incremental Search Widget.
121 */ 121 */
122 KABC::Field *currentSearchField() const; 122 KABC::Field *currentSearchField() const;
123 123
124 /** 124 /**
125 Returns the uid list of the currently selected contacts. 125 Returns the uid list of the currently selected contacts.
126 */ 126 */
127 QStringList selectedUIDs() const; 127 QStringList selectedUIDs() const;
128 128
129 /** 129 /**
130 Displays the ResourceSelectDialog and returns the selected 130 Displays the ResourceSelectDialog and returns the selected
131 resource or a null pointer if no resource was selected by 131 resource or a null pointer if no resource was selected by
132 the user. 132 the user.
133 */ 133 */
134 KABC::Resource *requestResource( QWidget *parent ); 134 KABC::Resource *requestResource( QWidget *parent );
135 135
136#ifndef KAB_EMBEDDED 136#ifndef KAB_EMBEDDED
137 static KAboutData *createAboutData(); 137 static KAboutData *createAboutData();
138#endif //KAB_EMBEDDED 138#endif //KAB_EMBEDDED
139 139
140#ifdef KAB_EMBEDDED 140#ifdef KAB_EMBEDDED
141 inline QPopupMenu* getImportMenu() { return ImportMenu;} 141 inline QPopupMenu* getImportMenu() { return ImportMenu;}
142 inline QPopupMenu* getExportMenu() { return ExportMenu;} 142 inline QPopupMenu* getExportMenu() { return ExportMenu;}
143#endif //KAB_EMBEDDED 143#endif //KAB_EMBEDDED
144 144
145 public slots: 145 public slots:
146#ifdef KAB_EMBEDDED 146#ifdef KAB_EMBEDDED
147 void createAboutData(); 147 void createAboutData();
148#endif //KAB_EMBEDDED 148#endif //KAB_EMBEDDED
149 void setDetailsToggle(); 149 void setDetailsToggle();
150 150
151 void showLicence(); 151 void showLicence();
152 void faq(); 152 void faq();
153 void whatsnew() ; 153 void whatsnew() ;
154 void synchowto() ; 154 void synchowto() ;
155 void multisynchowto() ; 155 void multisynchowto() ;
156 void kdesynchowto() ; 156 void kdesynchowto() ;
157 void writeToPhone(); 157 void writeToPhone();
158 158
159 /** 159 /**
160 Is called whenever a contact is selected in the view. 160 Is called whenever a contact is selected in the view.
161 */ 161 */
162 void setContactSelected( const QString &uid ); 162 void setContactSelected( const QString &uid );
163 163
164 /** 164 /**
165 Opens the preferred mail composer with all selected contacts as 165 Opens the preferred mail composer with all selected contacts as
166 arguments. 166 arguments.
167 */ 167 */
168 void sendMail(); 168 void sendMail();
169 169
170 /** 170 /**
171 Opens the preferred mail composer with the given contacts as 171 Opens the preferred mail composer with the given contacts as
172 arguments. 172 arguments.
173 */ 173 */
174 void sendMail( const QString& email ); 174 void sendMail( const QString& email );
175 175
176 176
177 void mailVCard(); 177 void mailVCard();
178 void mailVCard(const QStringList& uids); 178 void mailVCard(const QStringList& uids);
179 179
180 /** 180 /**
181 Beams the "WhoAmI contact. 181 Beams the "WhoAmI contact.
182 */ 182 */
183 void beamMySelf(); 183 void beamMySelf();
184 184
185 void beamVCard(); 185 void beamVCard();
186 void export2phone(); 186 void export2phone();
187 void beamVCard(const QStringList& uids); 187 void beamVCard(const QStringList& uids);
188 void beamDone( Ir *ir ); 188 void beamDone( Ir *ir );
189 189
190 190
191 /** 191 /**
192 Starts the preferred web browser with the given URL as argument. 192 Starts the preferred web browser with the given URL as argument.
193 */ 193 */
194 void browse( const QString& url ); 194 void browse( const QString& url );
195 195
196 /** 196 /**
197 Select all contacts in the view. 197 Select all contacts in the view.
198 */ 198 */
199 void selectAllContacts(); 199 void selectAllContacts();
200 200
201 /** 201 /**
202 Deletes all selected contacts from the address book. 202 Deletes all selected contacts from the address book.
203 */ 203 */
204 void deleteContacts(); 204 void deleteContacts();
205 205
206 /** 206 /**
207 Deletes given contacts from the address book. 207 Deletes given contacts from the address book.
208 208
209 @param uids The uids of the contacts, which shall be deleted. 209 @param uids The uids of the contacts, which shall be deleted.
210 */ 210 */
211 void deleteContacts( const QStringList &uids ); 211 void deleteContacts( const QStringList &uids );
212 212
213 /** 213 /**
214 Copys the selected contacts into clipboard for later pasting. 214 Copys the selected contacts into clipboard for later pasting.
215 */ 215 */
216 void copyContacts(); 216 void copyContacts();
217 217
218 /** 218 /**
219 Cuts the selected contacts and stores them for later pasting. 219 Cuts the selected contacts and stores them for later pasting.
220 */ 220 */
221 void cutContacts(); 221 void cutContacts();
222 222
223 /** 223 /**
224 Paste contacts from clipboard into the address book. 224 Paste contacts from clipboard into the address book.
225 */ 225 */
226 void pasteContacts(); 226 void pasteContacts();
227 227
228 /** 228 /**
229 Paste given contacts into the address book. 229 Paste given contacts into the address book.
230 230
231 @param list The list of addressee, which shall be pasted. 231 @param list The list of addressee, which shall be pasted.
232 */ 232 */
233 void pasteContacts( KABC::Addressee::List &list ); 233 void pasteContacts( KABC::Addressee::List &list );
234 234
235 /** 235 /**
236 Sets the whoAmI contact, that is used by many other programs to 236 Sets the whoAmI contact, that is used by many other programs to
237 get personal information about the current user. 237 get personal information about the current user.
238 */ 238 */
239 void setWhoAmI(); 239 void setWhoAmI();
240 240
241 /** 241 /**
242 Displays the category dialog and applies the result to all 242 Displays the category dialog and applies the result to all
243 selected contacts. 243 selected contacts.
244 */ 244 */
245 void setCategories(); 245 void setCategories();
246 void manageCategories(); 246 void manageCategories();
247 void editCategories(); 247 void editCategories();
248 248
249 /** 249 /**
250 Sets the field list of the Incremental Search Widget. 250 Sets the field list of the Incremental Search Widget.
251 */ 251 */
252 void setSearchFields( const KABC::Field::List &fields ); 252 void setSearchFields( const KABC::Field::List &fields );
253 253
254 /** 254 /**
255 Search with the current search field for a contact, that matches 255 Search with the current search field for a contact, that matches
256 the given text, and selects it in the view. 256 the given text, and selects it in the view.
257 */ 257 */
258 void incrementalSearch( const QString& text ); 258 void incrementalSearch( const QString& text );
259 259
260 /** 260 /**
261 Marks the address book as modified. 261 Marks the address book as modified.
262 */ 262 */
263 void setModified(); 263 void setModified();
264 /** 264 /**
265 Marks the address book as modified without refreshing the view. 265 Marks the address book as modified without refreshing the view.
266 */ 266 */
267 void setModifiedWOrefresh(); 267 void setModifiedWOrefresh();
268 268
269 /** 269 /**
270 Marks the address book as modified concerning the argument. 270 Marks the address book as modified concerning the argument.
271 */ 271 */
272 void setModified( bool modified ); 272 void setModified( bool modified );
273 273
274 /** 274 /**
275 Returns whether the address book is modified. 275 Returns whether the address book is modified.
276 */ 276 */
277 bool modified() const; 277 bool modified() const;
278 278
279 /** 279 /**
280 Called whenever an contact is modified in the contact editor 280 Called whenever an contact is modified in the contact editor
281 dialog or the quick edit. 281 dialog or the quick edit.
282 */ 282 */
283 void contactModified( const KABC::Addressee &addr ); 283 void contactModified( const KABC::Addressee &addr );
284 284
285 /** 285 /**
286 DCOP METHODS. 286 DCOP METHODS.
287 */ 287 */
288 void addEmail( QString addr ); 288 void addEmail( QString addr );
289 void importVCard( const KURL& url, bool showPreview ); 289 void importVCard( const KURL& url, bool showPreview );
290 void importVCard( const QString& vCard, bool showPreview ); 290 void importVCard( const QString& vCard, bool showPreview );
291 void newContact(); 291 void newContact();
292 QString getNameByPhone( const QString& phone ); 292 QString getNameByPhone( const QString& phone );
293 /** 293 /**
294 END DCOP METHODS 294 END DCOP METHODS
295 */ 295 */
296 296
297 /** 297 /**
298 Saves the contents of the AddressBook back to disk. 298 Saves the contents of the AddressBook back to disk.
299 */ 299 */
300 void save(); 300 void save();
301 301
302 /** 302 /**
303 Undos the last command using the undo stack. 303 Undos the last command using the undo stack.
304 */ 304 */
305 void undo(); 305 void undo();
306 306
307 /** 307 /**
308 Redos the last command that was undone, using the redo stack. 308 Redos the last command that was undone, using the redo stack.
309 */ 309 */
310 void redo(); 310 void redo();
311 311
312 /** 312 /**
313 Shows the edit dialog for the given uid. If the uid is QString::null, 313 Shows the edit dialog for the given uid. If the uid is QString::null,
314 the method will try to find a selected addressee in the view. 314 the method will try to find a selected addressee in the view.
315 */ 315 */
316 void editContact( const QString &uid /*US = QString::null*/ ); 316 void editContact( const QString &uid /*US = QString::null*/ );
317//US added a second method without defaultparameter 317//US added a second method without defaultparameter
318 void editContact2(); 318 void editContact2();
319 319
320 /** 320 /**
321 Shows or edits the detail view for the given uid. If the uid is QString::null, 321 Shows or edits the detail view for the given uid. If the uid is QString::null,
322 the method will try to find a selected addressee in the view. 322 the method will try to find a selected addressee in the view.
323 */ 323 */
324 void executeContact( const QString &uid /*US = QString::null*/ ); 324 void executeContact( const QString &uid /*US = QString::null*/ );
325 325
326 /** 326 /**
327 Launches the configuration dialog. 327 Launches the configuration dialog.
328 */ 328 */
329 void openConfigDialog(); 329 void openConfigDialog();
330 330
331 /** 331 /**
332 Launches the ldap search dialog. 332 Launches the ldap search dialog.
333 */ 333 */
334 void openLDAPDialog(); 334 void openLDAPDialog();
335 335
336 /** 336 /**
337 Creates a KAddressBookPrinter, which will display the print 337 Creates a KAddressBookPrinter, which will display the print
338 dialog and do the printing. 338 dialog and do the printing.
339 */ 339 */
340 void print(); 340 void print();
341 341
342 /** 342 /**
343 Registers a new GUI client, so plugins can register its actions. 343 Registers a new GUI client, so plugins can register its actions.
344 */ 344 */
345 void addGUIClient( KXMLGUIClient *client ); 345 void addGUIClient( KXMLGUIClient *client );
346 346
347 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 347 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
348 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 348 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
349 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 349 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
350 350
351 351
352 signals: 352 signals:
353 void contactSelected( const QString &name ); 353 void contactSelected( const QString &name );
354 void contactSelected( const QPixmap &pixmap ); 354 void contactSelected( const QPixmap &pixmap );
355 public slots: 355 public slots:
356 void recieve(QString cmsg ); 356 void recieve(QString cmsg );
357 void getFile( bool success ); 357 void getFile( bool success );
358 void syncFileRequest(); 358 void syncFileRequest();
359 void setDetailsVisible( bool visible ); 359 void setDetailsVisible( bool visible );
360 void setDetailsToState(); 360 void setDetailsToState();
361 // void slotSyncMenu( int ); 361 // void slotSyncMenu( int );
362 private slots: 362 private slots:
363 void updateToolBar(); 363 void updateToolBar();
364 void updateMainWindow();
364 void receive( const QCString& cmsg, const QByteArray& data ); 365 void receive( const QCString& cmsg, const QByteArray& data );
365 void toggleBeamReceive( ); 366 void toggleBeamReceive( );
366 void disableBR(bool); 367 void disableBR(bool);
367 void setJumpButtonBarVisible( bool visible ); 368 void setJumpButtonBarVisible( bool visible );
368 void setCaptionBack(); 369 void setCaptionBack();
369 void importFromOL(); 370 void importFromOL();
370 void extensionModified( const KABC::Addressee::List &list ); 371 void extensionModified( const KABC::Addressee::List &list );
371 void extensionChanged( int id ); 372 void extensionChanged( int id );
372 void clipboardDataChanged(); 373 void clipboardDataChanged();
373 void updateActionMenu(); 374 void updateActionMenu();
374 void configureKeyBindings(); 375 void configureKeyBindings();
375 void removeVoice(); 376 void removeVoice();
376#ifdef KAB_EMBEDDED 377#ifdef KAB_EMBEDDED
377 void configureResources(); 378 void configureResources();
378#endif //KAB_EMBEDDED 379#endif //KAB_EMBEDDED
379 380
380 void slotEditorDestroyed( const QString &uid ); 381 void slotEditorDestroyed( const QString &uid );
381 void configurationChanged(); 382 void configurationChanged();
382 void addressBookChanged(); 383 void addressBookChanged();
383 384
384 private: 385 private:
385 void resizeEvent(QResizeEvent* e ); 386 void resizeEvent(QResizeEvent* e );
386 bool mBRdisabled; 387 bool mBRdisabled;
387#ifndef DESKTOP_VERSION 388#ifndef DESKTOP_VERSION
388 QCopChannel* infrared; 389 QCopChannel* infrared;
389#endif 390#endif
390 QTimer *mMessageTimer; 391 QTimer *mMessageTimer;
391 void initGUI(); 392 void initGUI();
392 void initActions(); 393 void initActions();
393 QString getPhoneFile(); 394 QString getPhoneFile();
394 395
395 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 396 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
396 const char *name = 0 ); 397 const char *name = 0 );
397 398
398 KXMLGUIClient *mGUIClient; 399 KXMLGUIClient *mGUIClient;
399 400
400 KABC::AddressBook *mAddressBook; 401 KABC::AddressBook *mAddressBook;
401 402
402 ViewManager *mViewManager; 403 ViewManager *mViewManager;
403 // QSplitter *mDetailsSplitter; 404 // QSplitter *mDetailsSplitter;
404 KDGanttMinimizeSplitter *mExtensionBarSplitter; 405 KDGanttMinimizeSplitter *mExtensionBarSplitter;
405 ViewContainer *mDetails; 406 ViewContainer *mDetails;
406 KDGanttMinimizeSplitter* mMiniSplitter; 407 KDGanttMinimizeSplitter* mMiniSplitter;
407 XXPortManager *mXXPortManager; 408 XXPortManager *mXXPortManager;
408 JumpButtonBar *mJumpButtonBar; 409 JumpButtonBar *mJumpButtonBar;
409 IncSearchWidget *mIncSearchWidget; 410 IncSearchWidget *mIncSearchWidget;
410 ExtensionManager *mExtensionManager; 411 ExtensionManager *mExtensionManager;
411 412
412 KCMultiDialog *mConfigureDialog; 413 KCMultiDialog *mConfigureDialog;
413 414
414#ifndef KAB_EMBEDDED 415#ifndef KAB_EMBEDDED
415 LDAPSearchDialog *mLdapSearchDialog; 416 LDAPSearchDialog *mLdapSearchDialog;
416#endif //KAB_EMBEDDED 417#endif //KAB_EMBEDDED
417 // QDict<AddresseeEditorDialog> mEditorDict; 418 // QDict<AddresseeEditorDialog> mEditorDict;
418 AddresseeEditorDialog *mEditorDialog; 419 AddresseeEditorDialog *mEditorDialog;
419 bool mReadWrite; 420 bool mReadWrite;
420 bool mModified; 421 bool mModified;
421 bool mIsPart; 422 bool mIsPart;
422 bool mMultipleViewsAtOnce; 423 bool mMultipleViewsAtOnce;
423 424
424 425
425 //US file menu 426 //US file menu
426 KAction *mActionMail; 427 KAction *mActionMail;
427 KAction *mActionBeam; 428 KAction *mActionBeam;
428 KToggleAction *mActionBR; 429 KToggleAction *mActionBR;
429 KAction *mActionExport2phone; 430 KAction *mActionExport2phone;
430 KAction* mActionPrint; 431 KAction* mActionPrint;
431 KAction* mActionNewContact; 432 KAction* mActionNewContact;
432 KAction *mActionSave; 433 KAction *mActionSave;
433 KAction *mActionEditAddressee; 434 KAction *mActionEditAddressee;
434 KAction *mActionMailVCard; 435 KAction *mActionMailVCard;
435 KAction *mActionBeamVCard; 436 KAction *mActionBeamVCard;
436 437
437 KAction *mActionQuit; 438 KAction *mActionQuit;
438 439
439 //US edit menu 440 //US edit menu
440 KAction *mActionCopy; 441 KAction *mActionCopy;
441 KAction *mActionCut; 442 KAction *mActionCut;
442 KAction *mActionPaste; 443 KAction *mActionPaste;
443 KAction *mActionSelectAll; 444 KAction *mActionSelectAll;
444 KAction *mActionUndo; 445 KAction *mActionUndo;
445 KAction *mActionRedo; 446 KAction *mActionRedo;
446 KAction *mActionDelete; 447 KAction *mActionDelete;
447 448
448 //US settings menu 449 //US settings menu
449 KAction *mActionConfigResources; 450 KAction *mActionConfigResources;
450 KAction *mActionConfigKAddressbook; 451 KAction *mActionConfigKAddressbook;
451 KAction *mActionConfigShortcuts; 452 KAction *mActionConfigShortcuts;
452 KAction *mActionConfigureToolbars; 453 KAction *mActionConfigureToolbars;
453 KAction *mActionKeyBindings; 454 KAction *mActionKeyBindings;
454 KToggleAction *mActionJumpBar; 455 KToggleAction *mActionJumpBar;
455 KToggleAction *mActionDetails; 456 KToggleAction *mActionDetails;
456 KAction *mActionWhoAmI; 457 KAction *mActionWhoAmI;
457 KAction *mActionCategories; 458 KAction *mActionCategories;
458 KAction *mActionEditCategories; 459 KAction *mActionEditCategories;
459 KAction *mActionManageCategories; 460 KAction *mActionManageCategories;
460 KAction *mActionAboutKAddressbook; 461 KAction *mActionAboutKAddressbook;
461 KAction *mActionLicence; 462 KAction *mActionLicence;
462 KAction *mActionFaq; 463 KAction *mActionFaq;
463 KAction *mActionWN; 464 KAction *mActionWN;
464 KAction *mActionSyncHowto; 465 KAction *mActionSyncHowto;
465 KAction *mActionKdeSyncHowto; 466 KAction *mActionKdeSyncHowto;
466 KAction *mActionMultiSyncHowto; 467 KAction *mActionMultiSyncHowto;
467 468
468 KAction *mActionDeleteView; 469 KAction *mActionDeleteView;
469 470
470 QPopupMenu *viewMenu; 471 QPopupMenu *viewMenu;
471 QPopupMenu *filterMenu; 472 QPopupMenu *filterMenu;
472 QPopupMenu *settingsMenu; 473 QPopupMenu *settingsMenu;
473 QPopupMenu *changeMenu; 474 QPopupMenu *changeMenu;
474//US QAction *mActionSave; 475//US QAction *mActionSave;
475 QPopupMenu *ImportMenu; 476 QPopupMenu *ImportMenu;
476 QPopupMenu *ExportMenu; 477 QPopupMenu *ExportMenu;
477 //LR additional methods 478 //LR additional methods
478 KAction *mActionRemoveVoice; 479 KAction *mActionRemoveVoice;
479 KAction * mActionImportOL; 480 KAction * mActionImportOL;
480 481
481#ifndef KAB_EMBEDDED 482#ifndef KAB_EMBEDDED
482 KAddressBookService *mAddressBookService; 483 KAddressBookService *mAddressBookService;
483#endif //KAB_EMBEDDED 484#endif //KAB_EMBEDDED
484 485
485 class KABCorePrivate; 486 class KABCorePrivate;
486 KABCorePrivate *d; 487 KABCorePrivate *d;
487 //US bool mBlockSaveFlag; 488 //US bool mBlockSaveFlag;
488 489
489#ifdef KAB_EMBEDDED 490#ifdef KAB_EMBEDDED
490 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 491 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
491#endif //KAB_EMBEDDED 492#endif //KAB_EMBEDDED
492 493
493 //this are the overwritten callbackmethods from the syncinterface 494 //this are the overwritten callbackmethods from the syncinterface
494 virtual bool sync(KSyncManager* manager, QString filename, int mode); 495 virtual bool sync(KSyncManager* manager, QString filename, int mode);
495 virtual bool syncExternal(KSyncManager* manager, QString resource); 496 virtual bool syncExternal(KSyncManager* manager, QString resource);
496 virtual void removeSyncInfo( QString syncProfile); 497 virtual void removeSyncInfo( QString syncProfile);
497 bool syncPhone(); 498 bool syncPhone();
498 void message( QString m ); 499 void message( QString m );
499 500
500 // LR ******************************* 501 // LR *******************************
501 // sync stuff! 502 // sync stuff!
502 QString sentSyncFile(); 503 QString sentSyncFile();
503 QPopupMenu *syncMenu; 504 QPopupMenu *syncMenu;
504 KSyncManager* syncManager; 505 KSyncManager* syncManager;
505 int mGlobalSyncMode; 506 int mGlobalSyncMode;
506 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 507 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
507 KABC::Addressee getLastSyncAddressee(); 508 KABC::Addressee getLastSyncAddressee();
508 QDateTime mLastAddressbookSync; 509 QDateTime mLastAddressbookSync;
509 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 510 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
510 // ********************* 511 // *********************
511 512
512}; 513};
513 514
514#endif 515#endif