summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-17 19:45:31 (UTC)
committer zautrix <zautrix>2004-09-17 19:45:31 (UTC)
commitdf03bd8c7ff6a738dd386001679542ae4b493a07 (patch) (unidiff)
treef785901b1edbd1fd3075660ab2b556e3692b79b2
parent603ad0a623dc72b8ccb9535f9907e0f2aa536328 (diff)
downloadkdepimpi-df03bd8c7ff6a738dd386001679542ae4b493a07.zip
kdepimpi-df03bd8c7ff6a738dd386001679542ae4b493a07.tar.gz
kdepimpi-df03bd8c7ff6a738dd386001679542ae4b493a07.tar.bz2
first sync stuff in kaddressbook
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp460
-rw-r--r--kaddressbook/kabcore.h24
-rw-r--r--kaddressbook/kabprefs.h18
3 files changed, 496 insertions, 6 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 32dd43a..49c3b19 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,289 +1,296 @@
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/* 24/*
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 36
36#ifndef KAB_EMBEDDED 37#ifndef KAB_EMBEDDED
37#include <qclipboard.h> 38#include <qclipboard.h>
38#include <qdir.h> 39#include <qdir.h>
39#include <qfile.h> 40#include <qfile.h>
40#include <qapplicaton.h> 41#include <qapplicaton.h>
41#include <qlayout.h> 42#include <qlayout.h>
42#include <qregexp.h> 43#include <qregexp.h>
43#include <qvbox.h> 44#include <qvbox.h>
44#include <kabc/addresseelist.h> 45#include <kabc/addresseelist.h>
45#include <kabc/errorhandler.h> 46#include <kabc/errorhandler.h>
46#include <kabc/resource.h> 47#include <kabc/resource.h>
47#include <kabc/vcardconverter.h> 48#include <kabc/vcardconverter.h>
48#include <kapplication.h> 49#include <kapplication.h>
49#include <kactionclasses.h> 50#include <kactionclasses.h>
50#include <kcmultidialog.h> 51#include <kcmultidialog.h>
51#include <kdebug.h> 52#include <kdebug.h>
52#include <kdeversion.h> 53#include <kdeversion.h>
53#include <kkeydialog.h> 54#include <kkeydialog.h>
54#include <kmessagebox.h> 55#include <kmessagebox.h>
55#include <kprinter.h> 56#include <kprinter.h>
56#include <kprotocolinfo.h> 57#include <kprotocolinfo.h>
57#include <kresources/selectdialog.h> 58#include <kresources/selectdialog.h>
58#include <kstandarddirs.h> 59#include <kstandarddirs.h>
59#include <ktempfile.h> 60#include <ktempfile.h>
60#include <kxmlguiclient.h> 61#include <kxmlguiclient.h>
61#include <kaboutdata.h> 62#include <kaboutdata.h>
62#include <libkdepim/categoryselectdialog.h> 63#include <libkdepim/categoryselectdialog.h>
63 64
64#include "addresseeutil.h" 65#include "addresseeutil.h"
65#include "addresseeeditordialog.h" 66#include "addresseeeditordialog.h"
66#include "extensionmanager.h" 67#include "extensionmanager.h"
67#include "kstdaction.h" 68#include "kstdaction.h"
68#include "kaddressbookservice.h" 69#include "kaddressbookservice.h"
69#include "ldapsearchdialog.h" 70#include "ldapsearchdialog.h"
70#include "printing/printingwizard.h" 71#include "printing/printingwizard.h"
71#else // KAB_EMBEDDED 72#else // KAB_EMBEDDED
72 73
73#include <kapplication.h> 74#include <kapplication.h>
74#include "KDGanttMinimizeSplitter.h" 75#include "KDGanttMinimizeSplitter.h"
75#include "kaddressbookmain.h" 76#include "kaddressbookmain.h"
76#include "kactioncollection.h" 77#include "kactioncollection.h"
77#include "addresseedialog.h" 78#include "addresseedialog.h"
78//US 79//US
79#include <addresseeview.h> 80#include <addresseeview.h>
80 81
81#include <qapp.h> 82#include <qapp.h>
82#include <qmenubar.h> 83#include <qmenubar.h>
83//#include <qtoolbar.h> 84//#include <qtoolbar.h>
84#include <qmessagebox.h> 85#include <qmessagebox.h>
85#include <kdebug.h> 86#include <kdebug.h>
86#include <kiconloader.h> // needed for SmallIcon 87#include <kiconloader.h> // needed for SmallIcon
87#include <kresources/kcmkresources.h> 88#include <kresources/kcmkresources.h>
88#include <ktoolbar.h> 89#include <ktoolbar.h>
89 90
90 91
91//#include <qlabel.h> 92//#include <qlabel.h>
92 93
93 94
94#ifndef DESKTOP_VERSION 95#ifndef DESKTOP_VERSION
95#include <qpe/ir.h> 96#include <qpe/ir.h>
96#include <qpe/qpemenubar.h> 97#include <qpe/qpemenubar.h>
97#include <qtopia/qcopenvelope_qws.h> 98#include <qtopia/qcopenvelope_qws.h>
98#else 99#else
99 100
100#include <qmenubar.h> 101#include <qmenubar.h>
101#endif 102#endif
102 103
103#endif // KAB_EMBEDDED 104#endif // KAB_EMBEDDED
104#include "kcmconfigs/kcmkabconfig.h" 105#include "kcmconfigs/kcmkabconfig.h"
105#include "kcmconfigs/kcmkdepimconfig.h" 106#include "kcmconfigs/kcmkdepimconfig.h"
106#include "kpimglobalprefs.h" 107#include "kpimglobalprefs.h"
107#include "externalapphandler.h" 108#include "externalapphandler.h"
108 109
109 110
110#include <kresources/selectdialog.h> 111#include <kresources/selectdialog.h>
111#include <kmessagebox.h> 112#include <kmessagebox.h>
112 113
113#include <picture.h> 114#include <picture.h>
114#include <resource.h> 115#include <resource.h>
115 116
116//US#include <qsplitter.h> 117//US#include <qsplitter.h>
117#include <qmap.h> 118#include <qmap.h>
118#include <qdir.h> 119#include <qdir.h>
119#include <qfile.h> 120#include <qfile.h>
120#include <qvbox.h> 121#include <qvbox.h>
121#include <qlayout.h> 122#include <qlayout.h>
122#include <qclipboard.h> 123#include <qclipboard.h>
123#include <qtextstream.h> 124#include <qtextstream.h>
124 125
125#include <libkdepim/categoryselectdialog.h> 126#include <libkdepim/categoryselectdialog.h>
126#include <kabc/vcardconverter.h> 127#include <kabc/vcardconverter.h>
127 128
128 129
129#include "addresseeutil.h" 130#include "addresseeutil.h"
130#include "undocmds.h" 131#include "undocmds.h"
131#include "addresseeeditordialog.h" 132#include "addresseeeditordialog.h"
132#include "viewmanager.h" 133#include "viewmanager.h"
133#include "details/detailsviewcontainer.h" 134#include "details/detailsviewcontainer.h"
134#include "kabprefs.h" 135#include "kabprefs.h"
135#include "xxportmanager.h" 136#include "xxportmanager.h"
136#include "incsearchwidget.h" 137#include "incsearchwidget.h"
137#include "jumpbuttonbar.h" 138#include "jumpbuttonbar.h"
138#include "extensionmanager.h" 139#include "extensionmanager.h"
139#include "addresseeconfig.h" 140#include "addresseeconfig.h"
140#include <kcmultidialog.h> 141#include <kcmultidialog.h>
141 142
142#ifdef _WIN32_ 143#ifdef _WIN32_
143 144
144#include "kaimportoldialog.h" 145#include "kaimportoldialog.h"
146#else
147#include <unistd.h>
145#endif 148#endif
149// sync includes
150#include <libkdepim/ksyncprofile.h>
151
146 152
147bool pasteWithNewUid = true; 153bool pasteWithNewUid = true;
148 154
149#ifdef KAB_EMBEDDED 155#ifdef KAB_EMBEDDED
150KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 156KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
151 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 157 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
152 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 158 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
153 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 159 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
154#else //KAB_EMBEDDED 160#else //KAB_EMBEDDED
155KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 161KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
156 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 162 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
157 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 163 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
158 mReadWrite( readWrite ), mModified( false ) 164 mReadWrite( readWrite ), mModified( false )
159#endif //KAB_EMBEDDED 165#endif //KAB_EMBEDDED
160{ 166{
161 167
168 mBlockSaveFlag = false;
162 mExtensionBarSplitter = 0; 169 mExtensionBarSplitter = 0;
163 mIsPart = !parent->inherits( "KAddressBookMain" ); 170 mIsPart = !parent->inherits( "KAddressBookMain" );
164 171
165 mAddressBook = KABC::StdAddressBook::self(); 172 mAddressBook = KABC::StdAddressBook::self();
166 KABC::StdAddressBook::setAutomaticSave( false ); 173 KABC::StdAddressBook::setAutomaticSave( false );
167 174
168#ifndef KAB_EMBEDDED 175#ifndef KAB_EMBEDDED
169 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 176 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
170#endif //KAB_EMBEDDED 177#endif //KAB_EMBEDDED
171 178
172 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 179 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
173 SLOT( addressBookChanged() ) ); 180 SLOT( addressBookChanged() ) );
174 181
175 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 182 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
176 "X-Department", "KADDRESSBOOK" ); 183 "X-Department", "KADDRESSBOOK" );
177 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 184 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
178 "X-Profession", "KADDRESSBOOK" ); 185 "X-Profession", "KADDRESSBOOK" );
179 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 186 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
180 "X-AssistantsName", "KADDRESSBOOK" ); 187 "X-AssistantsName", "KADDRESSBOOK" );
181 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 188 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
182 "X-ManagersName", "KADDRESSBOOK" ); 189 "X-ManagersName", "KADDRESSBOOK" );
183 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 190 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
184 "X-SpousesName", "KADDRESSBOOK" ); 191 "X-SpousesName", "KADDRESSBOOK" );
185 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 192 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
186 "X-Office", "KADDRESSBOOK" ); 193 "X-Office", "KADDRESSBOOK" );
187 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 194 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
188 "X-IMAddress", "KADDRESSBOOK" ); 195 "X-IMAddress", "KADDRESSBOOK" );
189 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 196 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
190 "X-Anniversary", "KADDRESSBOOK" ); 197 "X-Anniversary", "KADDRESSBOOK" );
191 198
192 //US added this field to become compatible with Opie/qtopia addressbook 199 //US added this field to become compatible with Opie/qtopia addressbook
193 // values can be "female" or "male" or "". An empty field represents undefined. 200 // values can be "female" or "male" or "". An empty field represents undefined.
194 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 201 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
195 "X-Gender", "KADDRESSBOOK" ); 202 "X-Gender", "KADDRESSBOOK" );
196 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 203 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
197 "X-Children", "KADDRESSBOOK" ); 204 "X-Children", "KADDRESSBOOK" );
198 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 205 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
199 "X-FreeBusyUrl", "KADDRESSBOOK" ); 206 "X-FreeBusyUrl", "KADDRESSBOOK" );
200 207
201 initGUI(); 208 initGUI();
202 209
203 mIncSearchWidget->setFocus(); 210 mIncSearchWidget->setFocus();
204 211
205 212
206 connect( mViewManager, SIGNAL( selected( const QString& ) ), 213 connect( mViewManager, SIGNAL( selected( const QString& ) ),
207 SLOT( setContactSelected( const QString& ) ) ); 214 SLOT( setContactSelected( const QString& ) ) );
208 connect( mViewManager, SIGNAL( executed( const QString& ) ), 215 connect( mViewManager, SIGNAL( executed( const QString& ) ),
209 SLOT( executeContact( const QString& ) ) ); 216 SLOT( executeContact( const QString& ) ) );
210 217
211 connect( mViewManager, SIGNAL( deleteRequest( ) ), 218 connect( mViewManager, SIGNAL( deleteRequest( ) ),
212 SLOT( deleteContacts( ) ) ); 219 SLOT( deleteContacts( ) ) );
213 connect( mViewManager, SIGNAL( modified() ), 220 connect( mViewManager, SIGNAL( modified() ),
214 SLOT( setModified() ) ); 221 SLOT( setModified() ) );
215 222
216 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 223 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
217 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 224 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
218 225
219 connect( mXXPortManager, SIGNAL( modified() ), 226 connect( mXXPortManager, SIGNAL( modified() ),
220 SLOT( setModified() ) ); 227 SLOT( setModified() ) );
221 228
222 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 229 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
223 SLOT( incrementalSearch( const QString& ) ) ); 230 SLOT( incrementalSearch( const QString& ) ) );
224 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 231 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
225 mJumpButtonBar, SLOT( recreateButtons() ) ); 232 mJumpButtonBar, SLOT( recreateButtons() ) );
226 233
227 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 234 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
228 SLOT( sendMail( const QString& ) ) ); 235 SLOT( sendMail( const QString& ) ) );
229 236
230 237
231 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 238 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
232 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&))); 239 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&)));
233 240
234 241
235#ifndef KAB_EMBEDDED 242#ifndef KAB_EMBEDDED
236 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 243 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
237 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 244 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
238 245
239 connect( mDetails, SIGNAL( browse( const QString& ) ), 246 connect( mDetails, SIGNAL( browse( const QString& ) ),
240 SLOT( browse( const QString& ) ) ); 247 SLOT( browse( const QString& ) ) );
241 248
242 249
243 mAddressBookService = new KAddressBookService( this ); 250 mAddressBookService = new KAddressBookService( this );
244 251
245#endif //KAB_EMBEDDED 252#endif //KAB_EMBEDDED
246 mEditorDialog = 0; 253 mEditorDialog = 0;
247 createAddresseeEditorDialog( this ); 254 createAddresseeEditorDialog( this );
248 setModified( false ); 255 setModified( false );
249} 256}
250 257
251KABCore::~KABCore() 258KABCore::~KABCore()
252{ 259{
253 // save(); 260 // save();
254 //saveSettings(); 261 //saveSettings();
255 //KABPrefs::instance()->writeConfig(); 262 //KABPrefs::instance()->writeConfig();
256 delete AddresseeConfig::instance(); 263 delete AddresseeConfig::instance();
257 mAddressBook = 0; 264 mAddressBook = 0;
258 KABC::StdAddressBook::close(); 265 KABC::StdAddressBook::close();
259} 266}
260 267
261void KABCore::restoreSettings() 268void KABCore::restoreSettings()
262{ 269{
263 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 270 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
264 271
265 bool state; 272 bool state;
266 273
267 if (mMultipleViewsAtOnce) 274 if (mMultipleViewsAtOnce)
268 state = KABPrefs::instance()->mDetailsPageVisible; 275 state = KABPrefs::instance()->mDetailsPageVisible;
269 else 276 else
270 state = false; 277 state = false;
271 278
272 mActionDetails->setChecked( state ); 279 mActionDetails->setChecked( state );
273 setDetailsVisible( state ); 280 setDetailsVisible( state );
274 281
275 state = KABPrefs::instance()->mJumpButtonBarVisible; 282 state = KABPrefs::instance()->mJumpButtonBarVisible;
276 283
277 mActionJumpBar->setChecked( state ); 284 mActionJumpBar->setChecked( state );
278 setJumpButtonBarVisible( state ); 285 setJumpButtonBarVisible( state );
279/*US 286/*US
280 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 287 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
281 if ( splitterSize.count() == 0 ) { 288 if ( splitterSize.count() == 0 ) {
282 splitterSize.append( width() / 2 ); 289 splitterSize.append( width() / 2 );
283 splitterSize.append( width() / 2 ); 290 splitterSize.append( width() / 2 );
284 } 291 }
285 mMiniSplitter->setSizes( splitterSize ); 292 mMiniSplitter->setSizes( splitterSize );
286 if ( mExtensionBarSplitter ) { 293 if ( mExtensionBarSplitter ) {
287 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 294 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
288 if ( splitterSize.count() == 0 ) { 295 if ( splitterSize.count() == 0 ) {
289 splitterSize.append( width() / 2 ); 296 splitterSize.append( width() / 2 );
@@ -936,276 +943,280 @@ void KABCore::newContact()
936 KApplication::execDialog ( mEditorDialog ); 943 KApplication::execDialog ( mEditorDialog );
937 944
938 } else 945 } else
939 return; 946 return;
940 947
941 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 948 // mEditorDict.insert( dialog->addressee().uid(), dialog );
942 949
943 950
944} 951}
945 952
946void KABCore::addEmail( QString aStr ) 953void KABCore::addEmail( QString aStr )
947{ 954{
948#ifndef KAB_EMBEDDED 955#ifndef KAB_EMBEDDED
949 QString fullName, email; 956 QString fullName, email;
950 957
951 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 958 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
952 959
953 // Try to lookup the addressee matching the email address 960 // Try to lookup the addressee matching the email address
954 bool found = false; 961 bool found = false;
955 QStringList emailList; 962 QStringList emailList;
956 KABC::AddressBook::Iterator it; 963 KABC::AddressBook::Iterator it;
957 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 964 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
958 emailList = (*it).emails(); 965 emailList = (*it).emails();
959 if ( emailList.contains( email ) > 0 ) { 966 if ( emailList.contains( email ) > 0 ) {
960 found = true; 967 found = true;
961 (*it).setNameFromString( fullName ); 968 (*it).setNameFromString( fullName );
962 editContact( (*it).uid() ); 969 editContact( (*it).uid() );
963 } 970 }
964 } 971 }
965 972
966 if ( !found ) { 973 if ( !found ) {
967 KABC::Addressee addr; 974 KABC::Addressee addr;
968 addr.setNameFromString( fullName ); 975 addr.setNameFromString( fullName );
969 addr.insertEmail( email, true ); 976 addr.insertEmail( email, true );
970 977
971 mAddressBook->insertAddressee( addr ); 978 mAddressBook->insertAddressee( addr );
972 mViewManager->refreshView( addr.uid() ); 979 mViewManager->refreshView( addr.uid() );
973 editContact( addr.uid() ); 980 editContact( addr.uid() );
974 } 981 }
975#else //KAB_EMBEDDED 982#else //KAB_EMBEDDED
976 qDebug("KABCore::addEmail finsih method"); 983 qDebug("KABCore::addEmail finsih method");
977#endif //KAB_EMBEDDED 984#endif //KAB_EMBEDDED
978} 985}
979 986
980void KABCore::importVCard( const KURL &url, bool showPreview ) 987void KABCore::importVCard( const KURL &url, bool showPreview )
981{ 988{
982 mXXPortManager->importVCard( url, showPreview ); 989 mXXPortManager->importVCard( url, showPreview );
983} 990}
984void KABCore::importFromOL() 991void KABCore::importFromOL()
985{ 992{
986#ifdef _WIN32_ 993#ifdef _WIN32_
987 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 994 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
988 idgl->exec(); 995 idgl->exec();
989 KABC::Addressee::List list = idgl->getAddressList(); 996 KABC::Addressee::List list = idgl->getAddressList();
990 if ( list.count() > 0 ) { 997 if ( list.count() > 0 ) {
991 KABC::Addressee::List listNew; 998 KABC::Addressee::List listNew;
992 KABC::Addressee::List listExisting; 999 KABC::Addressee::List listExisting;
993 KABC::Addressee::List::Iterator it; 1000 KABC::Addressee::List::Iterator it;
994 KABC::AddressBook::Iterator iter; 1001 KABC::AddressBook::Iterator iter;
995 for ( it = list.begin(); it != list.end(); ++it ) { 1002 for ( it = list.begin(); it != list.end(); ++it ) {
996 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1003 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
997 listNew.append( (*it) ); 1004 listNew.append( (*it) );
998 else 1005 else
999 listExisting.append( (*it) ); 1006 listExisting.append( (*it) );
1000 } 1007 }
1001 if ( listExisting.count() > 0 ) 1008 if ( listExisting.count() > 0 )
1002 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1009 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1003 if ( listNew.count() > 0 ) { 1010 if ( listNew.count() > 0 ) {
1004 pasteWithNewUid = false; 1011 pasteWithNewUid = false;
1005 pasteContacts( listNew ); 1012 pasteContacts( listNew );
1006 pasteWithNewUid = true; 1013 pasteWithNewUid = true;
1007 } 1014 }
1008 } 1015 }
1009 delete idgl; 1016 delete idgl;
1010#endif 1017#endif
1011} 1018}
1012 1019
1013void KABCore::importVCard( const QString &vCard, bool showPreview ) 1020void KABCore::importVCard( const QString &vCard, bool showPreview )
1014{ 1021{
1015 mXXPortManager->importVCard( vCard, showPreview ); 1022 mXXPortManager->importVCard( vCard, showPreview );
1016} 1023}
1017 1024
1018//US added a second method without defaultparameter 1025//US added a second method without defaultparameter
1019void KABCore::editContact2() { 1026void KABCore::editContact2() {
1020 editContact( QString::null ); 1027 editContact( QString::null );
1021} 1028}
1022 1029
1023void KABCore::editContact( const QString &uid ) 1030void KABCore::editContact( const QString &uid )
1024{ 1031{
1025 1032
1026 if ( mExtensionManager->isQuickEditVisible() ) 1033 if ( mExtensionManager->isQuickEditVisible() )
1027 return; 1034 return;
1028 1035
1029 // First, locate the contact entry 1036 // First, locate the contact entry
1030 QString localUID = uid; 1037 QString localUID = uid;
1031 if ( localUID.isNull() ) { 1038 if ( localUID.isNull() ) {
1032 QStringList uidList = mViewManager->selectedUids(); 1039 QStringList uidList = mViewManager->selectedUids();
1033 if ( uidList.count() > 0 ) 1040 if ( uidList.count() > 0 )
1034 localUID = *( uidList.at( 0 ) ); 1041 localUID = *( uidList.at( 0 ) );
1035 } 1042 }
1036 1043
1037 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1044 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1038 if ( !addr.isEmpty() ) { 1045 if ( !addr.isEmpty() ) {
1039 mEditorDialog->setAddressee( addr ); 1046 mEditorDialog->setAddressee( addr );
1040 KApplication::execDialog ( mEditorDialog ); 1047 KApplication::execDialog ( mEditorDialog );
1041 } 1048 }
1042} 1049}
1043 1050
1044/** 1051/**
1045 Shows or edits the detail view for the given uid. If the uid is QString::null, 1052 Shows or edits the detail view for the given uid. If the uid is QString::null,
1046 the method will try to find a selected addressee in the view. 1053 the method will try to find a selected addressee in the view.
1047 */ 1054 */
1048void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1055void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1049{ 1056{
1050 if ( mMultipleViewsAtOnce ) 1057 if ( mMultipleViewsAtOnce )
1051 { 1058 {
1052 editContact( uid ); 1059 editContact( uid );
1053 } 1060 }
1054 else 1061 else
1055 { 1062 {
1056 setDetailsVisible( true ); 1063 setDetailsVisible( true );
1057 mActionDetails->setChecked(true); 1064 mActionDetails->setChecked(true);
1058 } 1065 }
1059 1066
1060} 1067}
1061 1068
1062void KABCore::save() 1069void KABCore::save()
1063{ 1070{
1071 if (mBlockSaveFlag)
1072 return;
1073 mBlockSaveFlag = true;
1064 if ( !mModified ) 1074 if ( !mModified )
1065 return; 1075 return;
1066 QString text = i18n( "There was an error while attempting to save\n the " 1076 QString text = i18n( "There was an error while attempting to save\n the "
1067 "address book. Please check that some \nother application is " 1077 "address book. Please check that some \nother application is "
1068 "not using it. " ); 1078 "not using it. " );
1069 statusMessage(i18n("Saving addressbook ... ")); 1079 statusMessage(i18n("Saving addressbook ... "));
1070#ifndef KAB_EMBEDDED 1080#ifndef KAB_EMBEDDED
1071 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1081 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1072 if ( !b || !b->save() ) { 1082 if ( !b || !b->save() ) {
1073 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1083 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1074 } 1084 }
1075#else //KAB_EMBEDDED 1085#else //KAB_EMBEDDED
1076 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1086 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1077 if ( !b || !b->save() ) { 1087 if ( !b || !b->save() ) {
1078 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1088 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1079 } 1089 }
1080#endif //KAB_EMBEDDED 1090#endif //KAB_EMBEDDED
1081 1091
1082 statusMessage(i18n("Addressbook saved!")); 1092 statusMessage(i18n("Addressbook saved!"));
1083 setModified( false ); 1093 setModified( false );
1094 mBlockSaveFlag = false;
1084} 1095}
1085 1096
1086void KABCore::statusMessage(QString mess , int time ) 1097void KABCore::statusMessage(QString mess , int time )
1087{ 1098{
1088 //topLevelWidget()->setCaption( mess ); 1099 //topLevelWidget()->setCaption( mess );
1089 // pending setting timer to revome message 1100 // pending setting timer to revome message
1090} 1101}
1091void KABCore::undo() 1102void KABCore::undo()
1092{ 1103{
1093 UndoStack::instance()->undo(); 1104 UndoStack::instance()->undo();
1094 1105
1095 // Refresh the view 1106 // Refresh the view
1096 mViewManager->refreshView(); 1107 mViewManager->refreshView();
1097} 1108}
1098 1109
1099void KABCore::redo() 1110void KABCore::redo()
1100{ 1111{
1101 RedoStack::instance()->redo(); 1112 RedoStack::instance()->redo();
1102 1113
1103 // Refresh the view 1114 // Refresh the view
1104 mViewManager->refreshView(); 1115 mViewManager->refreshView();
1105} 1116}
1106 1117
1107void KABCore::setJumpButtonBarVisible( bool visible ) 1118void KABCore::setJumpButtonBarVisible( bool visible )
1108{ 1119{
1109 if (mMultipleViewsAtOnce) 1120 if (mMultipleViewsAtOnce)
1110 { 1121 {
1111 if ( visible ) 1122 if ( visible )
1112 mJumpButtonBar->show(); 1123 mJumpButtonBar->show();
1113 else 1124 else
1114 mJumpButtonBar->hide(); 1125 mJumpButtonBar->hide();
1115 } 1126 }
1116 else 1127 else
1117 { 1128 {
1118 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1129 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1119 if (mViewManager->isVisible()) 1130 if (mViewManager->isVisible())
1120 { 1131 {
1121 if ( visible ) 1132 if ( visible )
1122 mJumpButtonBar->show(); 1133 mJumpButtonBar->show();
1123 else 1134 else
1124 mJumpButtonBar->hide(); 1135 mJumpButtonBar->hide();
1125 } 1136 }
1126 else 1137 else
1127 { 1138 {
1128 mJumpButtonBar->hide(); 1139 mJumpButtonBar->hide();
1129 } 1140 }
1130 } 1141 }
1131} 1142}
1132 1143
1133 1144
1134void KABCore::setDetailsToState() 1145void KABCore::setDetailsToState()
1135{ 1146{
1136 setDetailsVisible( mActionDetails->isChecked() ); 1147 setDetailsVisible( mActionDetails->isChecked() );
1137} 1148}
1138 1149
1139 1150
1140 1151
1141void KABCore::setDetailsVisible( bool visible ) 1152void KABCore::setDetailsVisible( bool visible )
1142{ 1153{
1143 if (visible && mDetails->isHidden()) 1154 if (visible && mDetails->isHidden())
1144 { 1155 {
1145 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1156 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1146 if ( addrList.count() > 0 ) 1157 if ( addrList.count() > 0 )
1147 mDetails->setAddressee( addrList[ 0 ] ); 1158 mDetails->setAddressee( addrList[ 0 ] );
1148 } 1159 }
1149 1160
1150 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1161 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1151 // the listview and the detailview. We do that by changing the splitbar size. 1162 // the listview and the detailview. We do that by changing the splitbar size.
1152 if (mMultipleViewsAtOnce) 1163 if (mMultipleViewsAtOnce)
1153 { 1164 {
1154 if ( visible ) 1165 if ( visible )
1155 mDetails->show(); 1166 mDetails->show();
1156 else 1167 else
1157 mDetails->hide(); 1168 mDetails->hide();
1158 } 1169 }
1159 else 1170 else
1160 { 1171 {
1161 if ( visible ) { 1172 if ( visible ) {
1162 mViewManager->hide(); 1173 mViewManager->hide();
1163 mDetails->show(); 1174 mDetails->show();
1164 } 1175 }
1165 else { 1176 else {
1166 mViewManager->show(); 1177 mViewManager->show();
1167 mDetails->hide(); 1178 mDetails->hide();
1168 } 1179 }
1169 setJumpButtonBarVisible( !visible ); 1180 setJumpButtonBarVisible( !visible );
1170 } 1181 }
1171 1182
1172} 1183}
1173 1184
1174void KABCore::extensionChanged( int id ) 1185void KABCore::extensionChanged( int id )
1175{ 1186{
1176 //change the details view only for non desktop systems 1187 //change the details view only for non desktop systems
1177#ifndef DESKTOP_VERSION 1188#ifndef DESKTOP_VERSION
1178 1189
1179 if (id == 0) 1190 if (id == 0)
1180 { 1191 {
1181 //the user disabled the extension. 1192 //the user disabled the extension.
1182 1193
1183 if (mMultipleViewsAtOnce) 1194 if (mMultipleViewsAtOnce)
1184 { // enable detailsview again 1195 { // enable detailsview again
1185 setDetailsVisible( true ); 1196 setDetailsVisible( true );
1186 mActionDetails->setChecked( true ); 1197 mActionDetails->setChecked( true );
1187 } 1198 }
1188 else 1199 else
1189 { //go back to the listview 1200 { //go back to the listview
1190 setDetailsVisible( false ); 1201 setDetailsVisible( false );
1191 mActionDetails->setChecked( false ); 1202 mActionDetails->setChecked( false );
1192 mActionDetails->setEnabled(true); 1203 mActionDetails->setEnabled(true);
1193 } 1204 }
1194 1205
1195 } 1206 }
1196 else 1207 else
1197 { 1208 {
1198 //the user enabled the extension. 1209 //the user enabled the extension.
1199 setDetailsVisible( false ); 1210 setDetailsVisible( false );
1200 mActionDetails->setChecked( false ); 1211 mActionDetails->setChecked( false );
1201 1212
1202 if (!mMultipleViewsAtOnce) 1213 if (!mMultipleViewsAtOnce)
1203 { 1214 {
1204 mActionDetails->setEnabled(false); 1215 mActionDetails->setEnabled(false);
1205 } 1216 }
1206 1217
1207 mExtensionManager->setSelectionChanged(); 1218 mExtensionManager->setSelectionChanged();
1208 1219
1209 } 1220 }
1210 1221
1211#endif// DESKTOP_VERSION 1222#endif// DESKTOP_VERSION
@@ -1311,257 +1322,257 @@ void KABCore::openLDAPDialog()
1311} 1322}
1312 1323
1313void KABCore::print() 1324void KABCore::print()
1314{ 1325{
1315#ifndef KAB_EMBEDDED 1326#ifndef KAB_EMBEDDED
1316 KPrinter printer; 1327 KPrinter printer;
1317 if ( !printer.setup( this ) ) 1328 if ( !printer.setup( this ) )
1318 return; 1329 return;
1319 1330
1320 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1331 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1321 mViewManager->selectedUids(), this ); 1332 mViewManager->selectedUids(), this );
1322 1333
1323 wizard.exec(); 1334 wizard.exec();
1324#else //KAB_EMBEDDED 1335#else //KAB_EMBEDDED
1325 qDebug("KABCore::print() finsih method"); 1336 qDebug("KABCore::print() finsih method");
1326#endif //KAB_EMBEDDED 1337#endif //KAB_EMBEDDED
1327 1338
1328} 1339}
1329 1340
1330 1341
1331void KABCore::addGUIClient( KXMLGUIClient *client ) 1342void KABCore::addGUIClient( KXMLGUIClient *client )
1332{ 1343{
1333 if ( mGUIClient ) 1344 if ( mGUIClient )
1334 mGUIClient->insertChildClient( client ); 1345 mGUIClient->insertChildClient( client );
1335 else 1346 else
1336 KMessageBox::error( this, "no KXMLGUICLient"); 1347 KMessageBox::error( this, "no KXMLGUICLient");
1337} 1348}
1338 1349
1339 1350
1340void KABCore::configurationChanged() 1351void KABCore::configurationChanged()
1341{ 1352{
1342 mExtensionManager->reconfigure(); 1353 mExtensionManager->reconfigure();
1343} 1354}
1344 1355
1345void KABCore::addressBookChanged() 1356void KABCore::addressBookChanged()
1346{ 1357{
1347/*US 1358/*US
1348 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1359 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1349 while ( it.current() ) { 1360 while ( it.current() ) {
1350 if ( it.current()->dirty() ) { 1361 if ( it.current()->dirty() ) {
1351 QString text = i18n( "Data has been changed externally. Unsaved " 1362 QString text = i18n( "Data has been changed externally. Unsaved "
1352 "changes will be lost." ); 1363 "changes will be lost." );
1353 KMessageBox::information( this, text ); 1364 KMessageBox::information( this, text );
1354 } 1365 }
1355 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1366 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1356 ++it; 1367 ++it;
1357 } 1368 }
1358*/ 1369*/
1359 if (mEditorDialog) 1370 if (mEditorDialog)
1360 { 1371 {
1361 if (mEditorDialog->dirty()) 1372 if (mEditorDialog->dirty())
1362 { 1373 {
1363 QString text = i18n( "Data has been changed externally. Unsaved " 1374 QString text = i18n( "Data has been changed externally. Unsaved "
1364 "changes will be lost." ); 1375 "changes will be lost." );
1365 KMessageBox::information( this, text ); 1376 KMessageBox::information( this, text );
1366 } 1377 }
1367 QString currentuid = mEditorDialog->addressee().uid(); 1378 QString currentuid = mEditorDialog->addressee().uid();
1368 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1379 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1369 } 1380 }
1370 mViewManager->refreshView(); 1381 mViewManager->refreshView();
1371// mDetails->refreshView(); 1382// mDetails->refreshView();
1372 1383
1373 1384
1374} 1385}
1375 1386
1376AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1387AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1377 const char *name ) 1388 const char *name )
1378{ 1389{
1379 1390
1380 if ( mEditorDialog == 0 ) { 1391 if ( mEditorDialog == 0 ) {
1381 mEditorDialog = new AddresseeEditorDialog( this, parent, 1392 mEditorDialog = new AddresseeEditorDialog( this, parent,
1382 name ? name : "editorDialog" ); 1393 name ? name : "editorDialog" );
1383 1394
1384 1395
1385 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1396 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1386 SLOT( contactModified( const KABC::Addressee& ) ) ); 1397 SLOT( contactModified( const KABC::Addressee& ) ) );
1387 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1398 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1388 // SLOT( slotEditorDestroyed( const QString& ) ) ; 1399 // SLOT( slotEditorDestroyed( const QString& ) ) ;
1389 } 1400 }
1390 1401
1391 return mEditorDialog; 1402 return mEditorDialog;
1392} 1403}
1393 1404
1394void KABCore::slotEditorDestroyed( const QString &uid ) 1405void KABCore::slotEditorDestroyed( const QString &uid )
1395{ 1406{
1396 //mEditorDict.remove( uid ); 1407 //mEditorDict.remove( uid );
1397} 1408}
1398 1409
1399void KABCore::initGUI() 1410void KABCore::initGUI()
1400{ 1411{
1401#ifndef KAB_EMBEDDED 1412#ifndef KAB_EMBEDDED
1402 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1413 QHBoxLayout *topLayout = new QHBoxLayout( this );
1403 topLayout->setSpacing( KDialogBase::spacingHint() ); 1414 topLayout->setSpacing( KDialogBase::spacingHint() );
1404 1415
1405 mExtensionBarSplitter = new QSplitter( this ); 1416 mExtensionBarSplitter = new QSplitter( this );
1406 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1417 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1407 1418
1408 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1419 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1409 1420
1410 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1421 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1411 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1422 mIncSearchWidget = new IncSearchWidget( viewSpace );
1412 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1423 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1413 SLOT( incrementalSearch( const QString& ) ) ); 1424 SLOT( incrementalSearch( const QString& ) ) );
1414 1425
1415 mViewManager = new ViewManager( this, viewSpace ); 1426 mViewManager = new ViewManager( this, viewSpace );
1416 viewSpace->setStretchFactor( mViewManager, 1 ); 1427 viewSpace->setStretchFactor( mViewManager, 1 );
1417 1428
1418 mDetails = new ViewContainer( mDetailsSplitter ); 1429 mDetails = new ViewContainer( mDetailsSplitter );
1419 1430
1420 mJumpButtonBar = new JumpButtonBar( this, this ); 1431 mJumpButtonBar = new JumpButtonBar( this, this );
1421 1432
1422 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1433 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1423 1434
1424 topLayout->addWidget( mExtensionBarSplitter ); 1435 topLayout->addWidget( mExtensionBarSplitter );
1425 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1436 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1426 topLayout->addWidget( mJumpButtonBar ); 1437 topLayout->addWidget( mJumpButtonBar );
1427 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1438 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1428 1439
1429 mXXPortManager = new XXPortManager( this, this ); 1440 mXXPortManager = new XXPortManager( this, this );
1430 1441
1431#else //KAB_EMBEDDED 1442#else //KAB_EMBEDDED
1432 //US initialize viewMenu before settingup viewmanager. 1443 //US initialize viewMenu before settingup viewmanager.
1433 // Viewmanager needs this menu to plugin submenues. 1444 // Viewmanager needs this menu to plugin submenues.
1434 viewMenu = new QPopupMenu( this ); 1445 viewMenu = new QPopupMenu( this );
1435 settingsMenu = new QPopupMenu( this ); 1446 settingsMenu = new QPopupMenu( this );
1436 //filterMenu = new QPopupMenu( this ); 1447 //filterMenu = new QPopupMenu( this );
1437 ImportMenu = new QPopupMenu( this ); 1448 ImportMenu = new QPopupMenu( this );
1438 ExportMenu = new QPopupMenu( this ); 1449 ExportMenu = new QPopupMenu( this );
1439 1450 syncMenu = new QPopupMenu( this );
1440 changeMenu= new QPopupMenu( this ); 1451 changeMenu= new QPopupMenu( this );
1441 1452
1442//US since we have no splitter for the embedded system, setup 1453//US since we have no splitter for the embedded system, setup
1443// a layout with two frames. One left and one right. 1454// a layout with two frames. One left and one right.
1444 1455
1445 QBoxLayout *topLayout; 1456 QBoxLayout *topLayout;
1446 1457
1447 // = new QHBoxLayout( this ); 1458 // = new QHBoxLayout( this );
1448// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1459// QBoxLayout *topLayout = (QBoxLayout*)layout();
1449 1460
1450// QWidget *mainBox = new QWidget( this ); 1461// QWidget *mainBox = new QWidget( this );
1451// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1462// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1452 1463
1453#ifdef DESKTOP_VERSION 1464#ifdef DESKTOP_VERSION
1454 topLayout = new QHBoxLayout( this ); 1465 topLayout = new QHBoxLayout( this );
1455 1466
1456 1467
1457 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1468 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1458 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1469 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1459 1470
1460 topLayout->addWidget(mMiniSplitter ); 1471 topLayout->addWidget(mMiniSplitter );
1461 1472
1462 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1473 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1463 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1474 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1464 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1475 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1465 mDetails = new ViewContainer( mMiniSplitter ); 1476 mDetails = new ViewContainer( mMiniSplitter );
1466 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1477 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1467#else 1478#else
1468 if ( QApplication::desktop()->width() > 480 ) { 1479 if ( QApplication::desktop()->width() > 480 ) {
1469 topLayout = new QHBoxLayout( this ); 1480 topLayout = new QHBoxLayout( this );
1470 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1481 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1471 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1482 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1472 } else { 1483 } else {
1473 1484
1474 topLayout = new QHBoxLayout( this ); 1485 topLayout = new QHBoxLayout( this );
1475 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1486 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1476 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1487 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1477 } 1488 }
1478 1489
1479 topLayout->addWidget(mMiniSplitter ); 1490 topLayout->addWidget(mMiniSplitter );
1480 mViewManager = new ViewManager( this, mMiniSplitter ); 1491 mViewManager = new ViewManager( this, mMiniSplitter );
1481 mDetails = new ViewContainer( mMiniSplitter ); 1492 mDetails = new ViewContainer( mMiniSplitter );
1482 1493
1483 1494
1484 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1495 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1485#endif 1496#endif
1486 //eh->hide(); 1497 //eh->hide();
1487 // topLayout->addWidget(mExtensionManager ); 1498 // topLayout->addWidget(mExtensionManager );
1488 1499
1489 1500
1490/*US 1501/*US
1491#ifndef KAB_NOSPLITTER 1502#ifndef KAB_NOSPLITTER
1492 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1503 QHBoxLayout *topLayout = new QHBoxLayout( this );
1493//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1504//US topLayout->setSpacing( KDialogBase::spacingHint() );
1494 topLayout->setSpacing( 10 ); 1505 topLayout->setSpacing( 10 );
1495 1506
1496 mDetailsSplitter = new QSplitter( this ); 1507 mDetailsSplitter = new QSplitter( this );
1497 1508
1498 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1509 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1499 1510
1500 mViewManager = new ViewManager( this, viewSpace ); 1511 mViewManager = new ViewManager( this, viewSpace );
1501 viewSpace->setStretchFactor( mViewManager, 1 ); 1512 viewSpace->setStretchFactor( mViewManager, 1 );
1502 1513
1503 mDetails = new ViewContainer( mDetailsSplitter ); 1514 mDetails = new ViewContainer( mDetailsSplitter );
1504 1515
1505 topLayout->addWidget( mDetailsSplitter ); 1516 topLayout->addWidget( mDetailsSplitter );
1506 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1517 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1507#else //KAB_NOSPLITTER 1518#else //KAB_NOSPLITTER
1508 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1519 QHBoxLayout *topLayout = new QHBoxLayout( this );
1509//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1520//US topLayout->setSpacing( KDialogBase::spacingHint() );
1510 topLayout->setSpacing( 10 ); 1521 topLayout->setSpacing( 10 );
1511 1522
1512// mDetailsSplitter = new QSplitter( this ); 1523// mDetailsSplitter = new QSplitter( this );
1513 1524
1514 QVBox *viewSpace = new QVBox( this ); 1525 QVBox *viewSpace = new QVBox( this );
1515 1526
1516 mViewManager = new ViewManager( this, viewSpace ); 1527 mViewManager = new ViewManager( this, viewSpace );
1517 viewSpace->setStretchFactor( mViewManager, 1 ); 1528 viewSpace->setStretchFactor( mViewManager, 1 );
1518 1529
1519 mDetails = new ViewContainer( this ); 1530 mDetails = new ViewContainer( this );
1520 1531
1521 topLayout->addWidget( viewSpace ); 1532 topLayout->addWidget( viewSpace );
1522// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1533// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1523 topLayout->addWidget( mDetails ); 1534 topLayout->addWidget( mDetails );
1524#endif //KAB_NOSPLITTER 1535#endif //KAB_NOSPLITTER
1525*/ 1536*/
1526 1537
1527 1538
1528#endif //KAB_EMBEDDED 1539#endif //KAB_EMBEDDED
1529 initActions(); 1540 initActions();
1530 1541
1531#ifdef KAB_EMBEDDED 1542#ifdef KAB_EMBEDDED
1532 addActionsManually(); 1543 addActionsManually();
1533 //US make sure the export and import menues are initialized before creating the xxPortManager. 1544 //US make sure the export and import menues are initialized before creating the xxPortManager.
1534 mXXPortManager = new XXPortManager( this, this ); 1545 mXXPortManager = new XXPortManager( this, this );
1535 1546
1536 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1547 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1537 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1548 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1538 // mActionQuit->plug ( mMainWindow->toolBar()); 1549 // mActionQuit->plug ( mMainWindow->toolBar());
1539 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1550 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1540 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1551 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1541 // mIncSearchWidget->hide(); 1552 // mIncSearchWidget->hide();
1542 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1553 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1543 SLOT( incrementalSearch( const QString& ) ) ); 1554 SLOT( incrementalSearch( const QString& ) ) );
1544 1555
1545 1556
1546 mJumpButtonBar = new JumpButtonBar( this, this ); 1557 mJumpButtonBar = new JumpButtonBar( this, this );
1547 1558
1548 topLayout->addWidget( mJumpButtonBar ); 1559 topLayout->addWidget( mJumpButtonBar );
1549//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1560//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1550 1561
1551// mMainWindow->getIconToolBar()->raise(); 1562// mMainWindow->getIconToolBar()->raise();
1552 1563
1553#endif //KAB_EMBEDDED 1564#endif //KAB_EMBEDDED
1554 1565
1555} 1566}
1556void KABCore::initActions() 1567void KABCore::initActions()
1557{ 1568{
1558//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1569//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1559 1570
1560#ifndef KAB_EMBEDDED 1571#ifndef KAB_EMBEDDED
1561 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1572 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1562 SLOT( clipboardDataChanged() ) ); 1573 SLOT( clipboardDataChanged() ) );
1563#endif //KAB_EMBEDDED 1574#endif //KAB_EMBEDDED
1564 1575
1565 // file menu 1576 // file menu
1566 if ( mIsPart ) { 1577 if ( mIsPart ) {
1567 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1578 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
@@ -1629,463 +1640,904 @@ void KABCore::initActions()
1629 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1640 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1630 SLOT( undo() ), actionCollection(), 1641 SLOT( undo() ), actionCollection(),
1631 "kaddressbook_undo" ); 1642 "kaddressbook_undo" );
1632 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1643 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1633 this, SLOT( redo() ), actionCollection(), 1644 this, SLOT( redo() ), actionCollection(),
1634 "kaddressbook_redo" ); 1645 "kaddressbook_redo" );
1635 } else { 1646 } else {
1636 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1647 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1637 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1648 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1638 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1649 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1639 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1650 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1640 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1651 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1641 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1652 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1642 } 1653 }
1643 1654
1644 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1655 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1645 Key_Delete, this, SLOT( deleteContacts() ), 1656 Key_Delete, this, SLOT( deleteContacts() ),
1646 actionCollection(), "edit_delete" ); 1657 actionCollection(), "edit_delete" );
1647 1658
1648 mActionUndo->setEnabled( false ); 1659 mActionUndo->setEnabled( false );
1649 mActionRedo->setEnabled( false ); 1660 mActionRedo->setEnabled( false );
1650 1661
1651 // settings menu 1662 // settings menu
1652#ifdef KAB_EMBEDDED 1663#ifdef KAB_EMBEDDED
1653//US special menuentry to configure the addressbook resources. On KDE 1664//US special menuentry to configure the addressbook resources. On KDE
1654// you do that through the control center !!! 1665// you do that through the control center !!!
1655 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1666 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1656 SLOT( configureResources() ), actionCollection(), 1667 SLOT( configureResources() ), actionCollection(),
1657 "kaddressbook_configure_resources" ); 1668 "kaddressbook_configure_resources" );
1658#endif //KAB_EMBEDDED 1669#endif //KAB_EMBEDDED
1659 1670
1660 if ( mIsPart ) { 1671 if ( mIsPart ) {
1661 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1672 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1662 SLOT( openConfigDialog() ), actionCollection(), 1673 SLOT( openConfigDialog() ), actionCollection(),
1663 "kaddressbook_configure" ); 1674 "kaddressbook_configure" );
1664 1675
1665 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1676 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1666 this, SLOT( configureKeyBindings() ), actionCollection(), 1677 this, SLOT( configureKeyBindings() ), actionCollection(),
1667 "kaddressbook_configure_shortcuts" ); 1678 "kaddressbook_configure_shortcuts" );
1668#ifdef KAB_EMBEDDED 1679#ifdef KAB_EMBEDDED
1669 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1680 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1670 mActionConfigureToolbars->setEnabled( false ); 1681 mActionConfigureToolbars->setEnabled( false );
1671#endif //KAB_EMBEDDED 1682#endif //KAB_EMBEDDED
1672 1683
1673 } else { 1684 } else {
1674 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1685 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1675 1686
1676 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1687 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1677 } 1688 }
1678 1689
1679 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1690 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1680 actionCollection(), "options_show_jump_bar" ); 1691 actionCollection(), "options_show_jump_bar" );
1681 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1692 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1682 1693
1683 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1694 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1684 actionCollection(), "options_show_details" ); 1695 actionCollection(), "options_show_details" );
1685 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1696 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1686 1697
1687 // misc 1698 // misc
1688 // only enable LDAP lookup if we can handle the protocol 1699 // only enable LDAP lookup if we can handle the protocol
1689#ifndef KAB_EMBEDDED 1700#ifndef KAB_EMBEDDED
1690 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1701 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1691 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1702 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1692 this, SLOT( openLDAPDialog() ), actionCollection(), 1703 this, SLOT( openLDAPDialog() ), actionCollection(),
1693 "ldap_lookup" ); 1704 "ldap_lookup" );
1694 } 1705 }
1695#else //KAB_EMBEDDED 1706#else //KAB_EMBEDDED
1696 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1707 //qDebug("KABCore::initActions() LDAP has to be implemented");
1697#endif //KAB_EMBEDDED 1708#endif //KAB_EMBEDDED
1698 1709
1699 1710
1700 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1711 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1701 SLOT( setWhoAmI() ), actionCollection(), 1712 SLOT( setWhoAmI() ), actionCollection(),
1702 "set_personal" ); 1713 "set_personal" );
1703 1714
1704 1715
1705 1716
1706 1717
1707 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1718 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1708 SLOT( setCategories() ), actionCollection(), 1719 SLOT( setCategories() ), actionCollection(),
1709 "edit_set_categories" ); 1720 "edit_set_categories" );
1710 1721
1711 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1722 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1712 SLOT( removeVoice() ), actionCollection(), 1723 SLOT( removeVoice() ), actionCollection(),
1713 "remove_voice" ); 1724 "remove_voice" );
1714 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 1725 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
1715 SLOT( importFromOL() ), actionCollection(), 1726 SLOT( importFromOL() ), actionCollection(),
1716 "import_OL" ); 1727 "import_OL" );
1717#ifdef KAB_EMBEDDED 1728#ifdef KAB_EMBEDDED
1718 mActionLicence = new KAction( i18n( "Licence" ), 0, 1729 mActionLicence = new KAction( i18n( "Licence" ), 0,
1719 this, SLOT( showLicence() ), actionCollection(), 1730 this, SLOT( showLicence() ), actionCollection(),
1720 "licence_about_data" ); 1731 "licence_about_data" );
1721 mActionFaq = new KAction( i18n( "Faq" ), 0, 1732 mActionFaq = new KAction( i18n( "Faq" ), 0,
1722 this, SLOT( faq() ), actionCollection(), 1733 this, SLOT( faq() ), actionCollection(),
1723 "faq_about_data" ); 1734 "faq_about_data" );
1724 1735
1725 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1736 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1726 this, SLOT( createAboutData() ), actionCollection(), 1737 this, SLOT( createAboutData() ), actionCollection(),
1727 "kaddressbook_about_data" ); 1738 "kaddressbook_about_data" );
1728#endif //KAB_EMBEDDED 1739#endif //KAB_EMBEDDED
1729 1740
1730 clipboardDataChanged(); 1741 clipboardDataChanged();
1731 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1742 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1732 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1743 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1733} 1744}
1734 1745
1735//US we need this function, to plug all actions into the correct menues. 1746//US we need this function, to plug all actions into the correct menues.
1736// KDE uses a XML format to plug the actions, but we work her without this overhead. 1747// KDE uses a XML format to plug the actions, but we work her without this overhead.
1737void KABCore::addActionsManually() 1748void KABCore::addActionsManually()
1738{ 1749{
1739//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1750//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1740 1751
1741#ifdef KAB_EMBEDDED 1752#ifdef KAB_EMBEDDED
1742 QPopupMenu *fileMenu = new QPopupMenu( this ); 1753 QPopupMenu *fileMenu = new QPopupMenu( this );
1743 QPopupMenu *editMenu = new QPopupMenu( this ); 1754 QPopupMenu *editMenu = new QPopupMenu( this );
1744 QPopupMenu *helpMenu = new QPopupMenu( this ); 1755 QPopupMenu *helpMenu = new QPopupMenu( this );
1745 1756
1746 KToolBar* tb = mMainWindow->toolBar(); 1757 KToolBar* tb = mMainWindow->toolBar();
1747 1758
1748#ifdef DESKTOP_VERSION 1759#ifdef DESKTOP_VERSION
1749 QMenuBar* mb = mMainWindow->menuBar(); 1760 QMenuBar* mb = mMainWindow->menuBar();
1750 1761
1751 //US setup menubar. 1762 //US setup menubar.
1752 //Disable the following block if you do not want to have a menubar. 1763 //Disable the following block if you do not want to have a menubar.
1753 mb->insertItem( "&File", fileMenu ); 1764 mb->insertItem( "&File", fileMenu );
1754 mb->insertItem( "&Edit", editMenu ); 1765 mb->insertItem( "&Edit", editMenu );
1755 mb->insertItem( "&View", viewMenu ); 1766 mb->insertItem( "&View", viewMenu );
1756 mb->insertItem( "&Settings", settingsMenu ); 1767 mb->insertItem( "&Settings", settingsMenu );
1768 mb->insertItem( i18n("Synchronize"), syncMenu );
1757 mb->insertItem( "&Change selected", changeMenu ); 1769 mb->insertItem( "&Change selected", changeMenu );
1758 mb->insertItem( "&Help", helpMenu ); 1770 mb->insertItem( "&Help", helpMenu );
1759 mIncSearchWidget = new IncSearchWidget( tb ); 1771 mIncSearchWidget = new IncSearchWidget( tb );
1760 // tb->insertWidget(-1, 0, mIncSearchWidget); 1772 // tb->insertWidget(-1, 0, mIncSearchWidget);
1761 1773
1762#else 1774#else
1763 //US setup toolbar 1775 //US setup toolbar
1764 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 1776 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
1765 QPopupMenu *popupBarTB = new QPopupMenu( this ); 1777 QPopupMenu *popupBarTB = new QPopupMenu( this );
1766 menuBarTB->insertItem( "ME", popupBarTB); 1778 menuBarTB->insertItem( "ME", popupBarTB);
1767 tb->insertWidget(-1, 0, menuBarTB); 1779 tb->insertWidget(-1, 0, menuBarTB);
1768 mIncSearchWidget = new IncSearchWidget( tb ); 1780 mIncSearchWidget = new IncSearchWidget( tb );
1769 1781
1770 tb->enableMoving(false); 1782 tb->enableMoving(false);
1771 popupBarTB->insertItem( "&File", fileMenu ); 1783 popupBarTB->insertItem( "&File", fileMenu );
1772 popupBarTB->insertItem( "&Edit", editMenu ); 1784 popupBarTB->insertItem( "&Edit", editMenu );
1773 popupBarTB->insertItem( "&View", viewMenu ); 1785 popupBarTB->insertItem( "&View", viewMenu );
1774 popupBarTB->insertItem( "&Settings", settingsMenu ); 1786 popupBarTB->insertItem( "&Settings", settingsMenu );
1787 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
1775 mViewManager->getFilterAction()->plug ( popupBarTB); 1788 mViewManager->getFilterAction()->plug ( popupBarTB);
1776 popupBarTB->insertItem( "&Change selected", changeMenu ); 1789 popupBarTB->insertItem( "&Change selected", changeMenu );
1777 popupBarTB->insertItem( "&Help", helpMenu ); 1790 popupBarTB->insertItem( "&Help", helpMenu );
1778 if (QApplication::desktop()->width() > 320 ) { 1791 if (QApplication::desktop()->width() > 320 ) {
1779 // mViewManager->getFilterAction()->plug ( tb); 1792 // mViewManager->getFilterAction()->plug ( tb);
1780 } 1793 }
1781#endif 1794#endif
1782 // mActionQuit->plug ( mMainWindow->toolBar()); 1795 // mActionQuit->plug ( mMainWindow->toolBar());
1783 1796
1784 1797
1785 1798
1786 //US Now connect the actions with the menue entries. 1799 //US Now connect the actions with the menue entries.
1787 mActionPrint->plug( fileMenu ); 1800 mActionPrint->plug( fileMenu );
1788 mActionMail->plug( fileMenu ); 1801 mActionMail->plug( fileMenu );
1789 fileMenu->insertSeparator(); 1802 fileMenu->insertSeparator();
1790 1803
1791 mActionNewContact->plug( fileMenu ); 1804 mActionNewContact->plug( fileMenu );
1792 mActionNewContact->plug( tb ); 1805 mActionNewContact->plug( tb );
1793 1806
1794 mActionEditAddressee->plug( fileMenu ); 1807 mActionEditAddressee->plug( fileMenu );
1795 if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 1808 if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
1796 (!KABPrefs::instance()->mMultipleViewsAtOnce )) 1809 (!KABPrefs::instance()->mMultipleViewsAtOnce ))
1797 mActionEditAddressee->plug( tb ); 1810 mActionEditAddressee->plug( tb );
1798 1811
1799 fileMenu->insertSeparator(); 1812 fileMenu->insertSeparator();
1800 mActionSave->plug( fileMenu ); 1813 mActionSave->plug( fileMenu );
1801 fileMenu->insertItem( "&Import", ImportMenu ); 1814 fileMenu->insertItem( "&Import", ImportMenu );
1802 fileMenu->insertItem( "&Export", ExportMenu ); 1815 fileMenu->insertItem( "&Export", ExportMenu );
1803 fileMenu->insertSeparator(); 1816 fileMenu->insertSeparator();
1804 mActionMailVCard->plug( fileMenu ); 1817 mActionMailVCard->plug( fileMenu );
1805#ifndef DESKTOP_VERSION 1818#ifndef DESKTOP_VERSION
1806 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 1819 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1807 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 1820 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1808#endif 1821#endif
1809 fileMenu->insertSeparator(); 1822 fileMenu->insertSeparator();
1810 mActionQuit->plug( fileMenu ); 1823 mActionQuit->plug( fileMenu );
1811#ifdef _WIN32_ 1824#ifdef _WIN32_
1812 mActionImportOL->plug( ImportMenu ); 1825 mActionImportOL->plug( ImportMenu );
1813#endif 1826#endif
1814 // edit menu 1827 // edit menu
1815 mActionUndo->plug( editMenu ); 1828 mActionUndo->plug( editMenu );
1816 mActionRedo->plug( editMenu ); 1829 mActionRedo->plug( editMenu );
1817 editMenu->insertSeparator(); 1830 editMenu->insertSeparator();
1818 mActionCut->plug( editMenu ); 1831 mActionCut->plug( editMenu );
1819 mActionCopy->plug( editMenu ); 1832 mActionCopy->plug( editMenu );
1820 mActionPaste->plug( editMenu ); 1833 mActionPaste->plug( editMenu );
1821 mActionDelete->plug( editMenu ); 1834 mActionDelete->plug( editMenu );
1822 editMenu->insertSeparator(); 1835 editMenu->insertSeparator();
1823 mActionSelectAll->plug( editMenu ); 1836 mActionSelectAll->plug( editMenu );
1824 1837
1825 mActionRemoveVoice->plug( changeMenu ); 1838 mActionRemoveVoice->plug( changeMenu );
1826 // settings menu 1839 // settings menu
1827//US special menuentry to configure the addressbook resources. On KDE 1840//US special menuentry to configure the addressbook resources. On KDE
1828// you do that through the control center !!! 1841// you do that through the control center !!!
1829 mActionConfigResources->plug( settingsMenu ); 1842 mActionConfigResources->plug( settingsMenu );
1830 settingsMenu->insertSeparator(); 1843 settingsMenu->insertSeparator();
1831 1844
1832 mActionConfigKAddressbook->plug( settingsMenu ); 1845 mActionConfigKAddressbook->plug( settingsMenu );
1833 1846
1834 if ( mIsPart ) { 1847 if ( mIsPart ) {
1835 mActionConfigShortcuts->plug( settingsMenu ); 1848 mActionConfigShortcuts->plug( settingsMenu );
1836 mActionConfigureToolbars->plug( settingsMenu ); 1849 mActionConfigureToolbars->plug( settingsMenu );
1837 1850
1838 } else { 1851 } else {
1839 mActionKeyBindings->plug( settingsMenu ); 1852 mActionKeyBindings->plug( settingsMenu );
1840 } 1853 }
1841 1854
1842 settingsMenu->insertSeparator(); 1855 settingsMenu->insertSeparator();
1843 1856
1844 mActionJumpBar->plug( settingsMenu ); 1857 mActionJumpBar->plug( settingsMenu );
1845 mActionDetails->plug( settingsMenu ); 1858 mActionDetails->plug( settingsMenu );
1846 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 1859 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
1847 mActionDetails->plug( tb ); 1860 mActionDetails->plug( tb );
1848 settingsMenu->insertSeparator(); 1861 settingsMenu->insertSeparator();
1849 1862
1850 mActionWhoAmI->plug( settingsMenu ); 1863 mActionWhoAmI->plug( settingsMenu );
1851 mActionCategories->plug( settingsMenu ); 1864 mActionCategories->plug( settingsMenu );
1852 1865
1853 mActionLicence->plug( helpMenu ); 1866 mActionLicence->plug( helpMenu );
1854 mActionFaq->plug( helpMenu ); 1867 mActionFaq->plug( helpMenu );
1855 mActionAboutKAddressbook->plug( helpMenu ); 1868 mActionAboutKAddressbook->plug( helpMenu );
1856 1869
1857 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 1870 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1858 1871
1859 mActionSave->plug( tb ); 1872 mActionSave->plug( tb );
1860 mViewManager->getFilterAction()->plug ( tb); 1873 mViewManager->getFilterAction()->plug ( tb);
1861 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 1874 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
1862 mActionUndo->plug( tb ); 1875 mActionUndo->plug( tb );
1863 mActionDelete->plug( tb ); 1876 mActionDelete->plug( tb );
1864 mActionRedo->plug( tb ); 1877 mActionRedo->plug( tb );
1865 } 1878 }
1866 } 1879 }
1867 //mActionQuit->plug ( tb ); 1880 //mActionQuit->plug ( tb );
1868 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1881 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1869 1882
1870 //US link the searchwidget first to this. 1883 //US link the searchwidget first to this.
1871 // The real linkage to the toolbar happens later. 1884 // The real linkage to the toolbar happens later.
1872//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1885//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1873//US tb->insertItem( mIncSearchWidget ); 1886//US tb->insertItem( mIncSearchWidget );
1874/*US 1887/*US
1875 mIncSearchWidget = new IncSearchWidget( tb ); 1888 mIncSearchWidget = new IncSearchWidget( tb );
1876 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1889 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1877 SLOT( incrementalSearch( const QString& ) ) ); 1890 SLOT( incrementalSearch( const QString& ) ) );
1878 1891
1879 mJumpButtonBar = new JumpButtonBar( this, this ); 1892 mJumpButtonBar = new JumpButtonBar( this, this );
1880 1893
1881//US topLayout->addWidget( mJumpButtonBar ); 1894//US topLayout->addWidget( mJumpButtonBar );
1882 this->layout()->add( mJumpButtonBar ); 1895 this->layout()->add( mJumpButtonBar );
1883*/ 1896*/
1884 1897
1885#endif //KAB_EMBEDDED 1898#endif //KAB_EMBEDDED
1899
1900 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) );
1901 fillSyncMenu();
1902
1886} 1903}
1887void KABCore::showLicence() 1904void KABCore::showLicence()
1888{ 1905{
1889 KApplication::showLicence(); 1906 KApplication::showLicence();
1890} 1907}
1891void KABCore::removeVoice() 1908void KABCore::removeVoice()
1892{ 1909{
1893 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 ) 1910 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 )
1894 return; 1911 return;
1895 KABC::Addressee::List list = mViewManager->selectedAddressees(); 1912 KABC::Addressee::List list = mViewManager->selectedAddressees();
1896 KABC::Addressee::List::Iterator it; 1913 KABC::Addressee::List::Iterator it;
1897 for ( it = list.begin(); it != list.end(); ++it ) { 1914 for ( it = list.begin(); it != list.end(); ++it ) {
1898 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 1915 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1899 PhoneNumber::List::Iterator phoneIt; 1916 PhoneNumber::List::Iterator phoneIt;
1900 bool found = false; 1917 bool found = false;
1901 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { 1918 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1902 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 1919 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1903 if ((*phoneIt).type() - PhoneNumber::Voice ) { 1920 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1904 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 1921 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1905 (*it).insertPhoneNumber( (*phoneIt) ); 1922 (*it).insertPhoneNumber( (*phoneIt) );
1906 found = true; 1923 found = true;
1907 } 1924 }
1908 } 1925 }
1909 1926
1910 } 1927 }
1911 if ( found ) 1928 if ( found )
1912 contactModified((*it) ); 1929 contactModified((*it) );
1913 } 1930 }
1914} 1931}
1915 1932
1916 1933
1917 1934
1918void KABCore::clipboardDataChanged() 1935void KABCore::clipboardDataChanged()
1919{ 1936{
1920 1937
1921 if ( mReadWrite ) 1938 if ( mReadWrite )
1922 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 1939 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1923 1940
1924} 1941}
1925 1942
1926void KABCore::updateActionMenu() 1943void KABCore::updateActionMenu()
1927{ 1944{
1928 UndoStack *undo = UndoStack::instance(); 1945 UndoStack *undo = UndoStack::instance();
1929 RedoStack *redo = RedoStack::instance(); 1946 RedoStack *redo = RedoStack::instance();
1930 1947
1931 if ( undo->isEmpty() ) 1948 if ( undo->isEmpty() )
1932 mActionUndo->setText( i18n( "Undo" ) ); 1949 mActionUndo->setText( i18n( "Undo" ) );
1933 else 1950 else
1934 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 1951 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
1935 1952
1936 mActionUndo->setEnabled( !undo->isEmpty() ); 1953 mActionUndo->setEnabled( !undo->isEmpty() );
1937 1954
1938 if ( !redo->top() ) 1955 if ( !redo->top() )
1939 mActionRedo->setText( i18n( "Redo" ) ); 1956 mActionRedo->setText( i18n( "Redo" ) );
1940 else 1957 else
1941 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 1958 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
1942 1959
1943 mActionRedo->setEnabled( !redo->isEmpty() ); 1960 mActionRedo->setEnabled( !redo->isEmpty() );
1944} 1961}
1945 1962
1946void KABCore::configureKeyBindings() 1963void KABCore::configureKeyBindings()
1947{ 1964{
1948#ifndef KAB_EMBEDDED 1965#ifndef KAB_EMBEDDED
1949 KKeyDialog::configure( actionCollection(), true ); 1966 KKeyDialog::configure( actionCollection(), true );
1950#else //KAB_EMBEDDED 1967#else //KAB_EMBEDDED
1951 qDebug("KABCore::configureKeyBindings() not implemented"); 1968 qDebug("KABCore::configureKeyBindings() not implemented");
1952#endif //KAB_EMBEDDED 1969#endif //KAB_EMBEDDED
1953} 1970}
1954 1971
1955#ifdef KAB_EMBEDDED 1972#ifdef KAB_EMBEDDED
1956void KABCore::configureResources() 1973void KABCore::configureResources()
1957{ 1974{
1958 KRES::KCMKResources dlg( this, "" , 0 ); 1975 KRES::KCMKResources dlg( this, "" , 0 );
1959 1976
1960 if ( !dlg.exec() ) 1977 if ( !dlg.exec() )
1961 return; 1978 return;
1962 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 1979 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
1963} 1980}
1964#endif //KAB_EMBEDDED 1981#endif //KAB_EMBEDDED
1965 1982
1966 1983
1967/* this method will be called through the QCop interface from Ko/Pi to select addresses 1984/* this method will be called through the QCop interface from Ko/Pi to select addresses
1968 * for the attendees list of an event. 1985 * for the attendees list of an event.
1969 */ 1986 */
1970void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 1987void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
1971{ 1988{
1972 QStringList nameList; 1989 QStringList nameList;
1973 QStringList emailList; 1990 QStringList emailList;
1974 QStringList uidList; 1991 QStringList uidList;
1975 1992
1976 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 1993 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
1977 uint i=0; 1994 uint i=0;
1978 for (i=0; i < list.count(); i++) 1995 for (i=0; i < list.count(); i++)
1979 { 1996 {
1980 nameList.append(list[i].realName()); 1997 nameList.append(list[i].realName());
1981 emailList.append(list[i].preferredEmail()); 1998 emailList.append(list[i].preferredEmail());
1982 uidList.append(list[i].uid()); 1999 uidList.append(list[i].uid());
1983 } 2000 }
1984 2001
1985 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2002 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
1986 2003
1987} 2004}
1988 2005
1989/* this method will be called through the QCop interface from other apps to show details of a contact. 2006/* this method will be called through the QCop interface from other apps to show details of a contact.
1990 */ 2007 */
1991void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2008void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
1992{ 2009{
1993 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2010 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
1994 2011
1995 QString foundUid = QString::null; 2012 QString foundUid = QString::null;
1996 if ( ! uid.isEmpty() ) { 2013 if ( ! uid.isEmpty() ) {
1997 Addressee adrr = mAddressBook->findByUid( uid ); 2014 Addressee adrr = mAddressBook->findByUid( uid );
1998 if ( !adrr.isEmpty() ) { 2015 if ( !adrr.isEmpty() ) {
1999 foundUid = uid; 2016 foundUid = uid;
2000 } 2017 }
2001 if ( email == "sendbacklist" ) { 2018 if ( email == "sendbacklist" ) {
2002 //qDebug("ssssssssssssssssssssssend "); 2019 //qDebug("ssssssssssssssssssssssend ");
2003 QStringList nameList; 2020 QStringList nameList;
2004 QStringList emailList; 2021 QStringList emailList;
2005 QStringList uidList; 2022 QStringList uidList;
2006 nameList.append(adrr.realName()); 2023 nameList.append(adrr.realName());
2007 emailList = adrr.emails(); 2024 emailList = adrr.emails();
2008 uidList.append( adrr.preferredEmail()); 2025 uidList.append( adrr.preferredEmail());
2009 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2026 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2010 return; 2027 return;
2011 } 2028 }
2012 2029
2013 } 2030 }
2014 2031
2015 if ( email == "sendbacklist" ) 2032 if ( email == "sendbacklist" )
2016 return; 2033 return;
2017 if (foundUid.isEmpty()) 2034 if (foundUid.isEmpty())
2018 { 2035 {
2019 //find the uid of the person first 2036 //find the uid of the person first
2020 Addressee::List namelist; 2037 Addressee::List namelist;
2021 Addressee::List emaillist; 2038 Addressee::List emaillist;
2022 2039
2023 if (!name.isEmpty()) 2040 if (!name.isEmpty())
2024 namelist = mAddressBook->findByName( name ); 2041 namelist = mAddressBook->findByName( name );
2025 2042
2026 if (!email.isEmpty()) 2043 if (!email.isEmpty())
2027 emaillist = mAddressBook->findByEmail( email ); 2044 emaillist = mAddressBook->findByEmail( email );
2028 qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2045 qDebug("count %d %d ", namelist.count(),emaillist.count() );
2029 //check if we have a match in Namelist and Emaillist 2046 //check if we have a match in Namelist and Emaillist
2030 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2047 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2031 foundUid = emaillist[0].uid(); 2048 foundUid = emaillist[0].uid();
2032 } 2049 }
2033 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2050 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2034 foundUid = namelist[0].uid(); 2051 foundUid = namelist[0].uid();
2035 else 2052 else
2036 { 2053 {
2037 for (int i = 0; i < namelist.count(); i++) 2054 for (int i = 0; i < namelist.count(); i++)
2038 { 2055 {
2039 for (int j = 0; j < emaillist.count(); j++) 2056 for (int j = 0; j < emaillist.count(); j++)
2040 { 2057 {
2041 if (namelist[i] == emaillist[j]) 2058 if (namelist[i] == emaillist[j])
2042 { 2059 {
2043 foundUid = namelist[i].uid(); 2060 foundUid = namelist[i].uid();
2044 } 2061 }
2045 } 2062 }
2046 } 2063 }
2047 } 2064 }
2048 } 2065 }
2049 else 2066 else
2050 { 2067 {
2051 foundUid = uid; 2068 foundUid = uid;
2052 } 2069 }
2053 2070
2054 if (!foundUid.isEmpty()) 2071 if (!foundUid.isEmpty())
2055 { 2072 {
2056 2073
2057 // raise Ka/Pi if it is in the background 2074 // raise Ka/Pi if it is in the background
2058#ifndef DESKTOP_VERSION 2075#ifndef DESKTOP_VERSION
2059#ifndef KORG_NODCOP 2076#ifndef KORG_NODCOP
2060 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2077 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2061#endif 2078#endif
2062#endif 2079#endif
2063 2080
2064 mMainWindow->showMaximized(); 2081 mMainWindow->showMaximized();
2065 mMainWindow-> raise(); 2082 mMainWindow-> raise();
2066 2083
2067 mViewManager->setSelected( "", false); 2084 mViewManager->setSelected( "", false);
2068 mViewManager->refreshView( "" ); 2085 mViewManager->refreshView( "" );
2069 mViewManager->setSelected( foundUid, true ); 2086 mViewManager->setSelected( foundUid, true );
2070 mViewManager->refreshView( foundUid ); 2087 mViewManager->refreshView( foundUid );
2071 2088
2072 if ( !mMultipleViewsAtOnce ) 2089 if ( !mMultipleViewsAtOnce )
2073 { 2090 {
2074 setDetailsVisible( true ); 2091 setDetailsVisible( true );
2075 mActionDetails->setChecked(true); 2092 mActionDetails->setChecked(true);
2076 } 2093 }
2077 } 2094 }
2078} 2095}
2079 2096
2080 2097
2081void KABCore::faq() 2098void KABCore::faq()
2082{ 2099{
2083 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2100 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2084} 2101}
2085 2102
2086 2103
2104void KABCore::fillSyncMenu()
2105{
2106 if ( syncMenu->count() )
2107 syncMenu->clear();
2108 syncMenu->insertItem( i18n("Configure..."), 0 );
2109 syncMenu->insertSeparator();
2110 syncMenu->insertItem( i18n("Multiple sync"), 1 );
2111 syncMenu->insertSeparator();
2112 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
2113 config.setGroup("General");
2114 QStringList prof = config.readListEntry("SyncProfileNames");
2115 KABPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
2116 if ( prof.count() < 3 ) {
2117 prof.clear();
2118 prof << i18n("Sharp_DTM");
2119 prof << i18n("Local_file");
2120 prof << i18n("Last_file");
2121 KSyncProfile* temp = new KSyncProfile ();
2122 temp->setName( prof[0] );
2123 temp->writeConfig(&config);
2124 temp->setName( prof[1] );
2125 temp->writeConfig(&config);
2126 temp->setName( prof[2] );
2127 temp->writeConfig(&config);
2128 config.setGroup("General");
2129 config.writeEntry("SyncProfileNames",prof);
2130 config.writeEntry("ExternSyncProfiles","Sharp_DTM");
2131 config.sync();
2132 delete temp;
2133 }
2134 KABPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
2135 KABPrefs::instance()->mSyncProfileNames = prof;
2136 int i;
2137 for ( i = 0; i < prof.count(); ++i ) {
2138
2139 syncMenu->insertItem( prof[i], 1000+i );
2140 if ( i == 2 )
2141 syncMenu->insertSeparator();
2142 }
2143 QDir app_dir;
2144 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
2145 syncMenu->setItemEnabled( false , 1000 );
2146 }
2147 //probaly useless
2148 //mView->setupExternSyncProfiles();
2149}
2150void KABCore::slotSyncMenu( int action )
2151{
2152 //qDebug("syncaction %d ", action);
2153 if ( action == 0 ) {
2087 2154
2155 // seems to be a Qt2 event handling bug
2156 // syncmenu.clear causes a segfault at first time
2157 // when we call it after the main event loop, it is ok
2158 // same behaviour when calling OM/Pi via QCOP for the first time
2159 QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
2160 //confSync();
2088 2161
2089#ifndef KAB_EMBEDDED 2162 return;
2090#include "kabcore.moc" 2163 }
2091#endif //KAB_EMBEDDED 2164 if ( action == 1 ) {
2165 multiSync( true );
2166 return;
2167 }
2168
2169 if (mBlockSaveFlag)
2170 return;
2171 mBlockSaveFlag = true;
2172 mCurrentSyncProfile = action - 1000 ;
2173 mCurrentSyncDevice = KABPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ;
2174 mCurrentSyncName = KABPrefs::instance()->mLocalMachineName ;
2175 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
2176 KSyncProfile* temp = new KSyncProfile ();
2177 temp->setName(KABPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
2178 temp->readConfig(&config);
2179 KABPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
2180 KABPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
2181 KABPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
2182 KABPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
2183 KABPrefs::instance()->mWriteBackInFuture = 0;
2184 if ( temp->getWriteBackFuture() )
2185 KABPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
2186 KABPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
2187 if ( action == 1000 ) {
2188 syncSharp();
2189
2190 } else if ( action == 1001 ) {
2191 syncLocalFile();
2192
2193 } else if ( action == 1002 ) {
2194 quickSyncLocalFile();
2195
2196 } else if ( action >= 1003 ) {
2197 if ( temp->getIsLocalFileSync() ) {
2198 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
2199 KABPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
2200 } else {
2201 if ( temp->getIsPhoneSync() ) {
2202 KABPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
2203 KABPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
2204 KABPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
2205 syncPhone();
2206 } else
2207 syncRemote( temp );
2208
2209 }
2210 }
2211 delete temp;
2212 mBlockSaveFlag = false;
2213}
2214
2215void KABCore::syncLocalFile()
2216{
2217
2218 QString fn =KABPrefs::instance()->mLastSyncedLocalFile;
2219
2220 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
2221 if ( fn == "" )
2222 return;
2223 if ( syncWithFile( fn, false ) ) {
2224 qDebug("syncLocalFile() successful ");
2225 }
2226
2227}
2228bool KABCore::syncWithFile( QString fn , bool quick )
2229{
2230 bool ret = false;
2231 QFileInfo info;
2232 info.setFile( fn );
2233 QString mess;
2234 bool loadbup = true;
2235 if ( !info. exists() ) {
2236 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
2237 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2238 mess );
2239 return ret;
2240 }
2241 int result = 0;
2242 if ( !quick ) {
2243 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2244 result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2245 mess,
2246 i18n("Sync"), i18n("Cancel"), 0,
2247 0, 1 );
2248 if ( result )
2249 return false;
2250 }
2251 if ( KABPrefs::instance()->mAskForPreferences )
2252 edit_sync_options();
2253 if ( result == 0 ) {
2254 //qDebug("Now sycing ... ");
2255 if ( ret = syncAB( fn, KABPrefs::instance()->mSyncAlgoPrefs ) )
2256 setCaption( i18n("Synchronization successful") );
2257 else
2258 setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
2259 if ( ! quick )
2260 KABPrefs::instance()->mLastSyncedLocalFile = fn;
2261 setModified();
2262 }
2263 return ret;
2264}
2265void KABCore::quickSyncLocalFile()
2266{
2267
2268 if ( syncWithFile( KABPrefs::instance()->mLastSyncedLocalFile, false ) ) {
2269 qDebug("quick syncLocalFile() successful ");
2270
2271 }
2272}
2273void KABCore::multiSync( bool askforPrefs )
2274{
2275 if (mBlockSaveFlag)
2276 return;
2277 mBlockSaveFlag = true;
2278 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
2279 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
2280 question,
2281 i18n("Yes"), i18n("No"),
2282 0, 0 ) != 0 ) {
2283 mBlockSaveFlag = false;
2284 setCaption(i18n("Aborted! Nothing synced!"));
2285 return;
2286 }
2287 mCurrentSyncDevice = i18n("Multiple profiles") ;
2288 KABPrefs::instance()->mSyncAlgoPrefs = KABPrefs::instance()->mRingSyncAlgoPrefs;
2289 if ( askforPrefs ) {
2290 edit_sync_options();
2291 KABPrefs::instance()->mRingSyncAlgoPrefs = KABPrefs::instance()->mSyncAlgoPrefs;
2292 }
2293 setCaption(i18n("Multiple sync started.") );
2294 qApp->processEvents();
2295 int num = ringSync() ;
2296 if ( num > 1 )
2297 ringSync();
2298 mBlockSaveFlag = false;
2299 if ( num )
2300 save();
2301 if ( num )
2302 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
2303 else
2304 setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
2305 return;
2306}
2307int KABCore::ringSync()
2308{
2309 int syncedProfiles = 0;
2310 int i;
2311 QTime timer;
2312 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
2313 QStringList syncProfileNames = KABPrefs::instance()->mSyncProfileNames;
2314 KSyncProfile* temp = new KSyncProfile ();
2315 KABPrefs::instance()->mAskForPreferences = false;
2316 for ( i = 0; i < syncProfileNames.count(); ++i ) {
2317 mCurrentSyncProfile = i;
2318 temp->setName(syncProfileNames[mCurrentSyncProfile]);
2319 temp->readConfig(&config);
2320 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
2321 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
2322 ++syncedProfiles;
2323 // KABPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
2324 KABPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
2325 KABPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
2326 KABPrefs::instance()->mWriteBackInFuture = 0;
2327 if ( temp->getWriteBackFuture() )
2328 KABPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
2329 KABPrefs::instance()->mShowSyncSummary = false;
2330 mCurrentSyncDevice = syncProfileNames[i] ;
2331 mCurrentSyncName = KABPrefs::instance()->mLocalMachineName;
2332 if ( i == 0 ) {
2333 syncSharp();
2334 } else {
2335 if ( temp->getIsLocalFileSync() ) {
2336 if ( syncWithFile( temp->getRemoteFileName( ), true ) )
2337 KABPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
2338 } else {
2339 if ( temp->getIsPhoneSync() ) {
2340 KABPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
2341 KABPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
2342 KABPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
2343 syncPhone();
2344 } else
2345 syncRemote( temp, false );
2346
2347 }
2348 }
2349 timer.start();
2350 setCaption(i18n("Multiple sync in progress ... please wait!") );
2351 while ( timer.elapsed () < 2000 ) {
2352 qApp->processEvents();
2353#ifndef _WIN32_
2354 sleep (1);
2355#endif
2356 }
2357
2358 }
2359
2360 }
2361 delete temp;
2362 return syncedProfiles;
2363}
2364
2365void KABCore::syncRemote( KSyncProfile* prof, bool ask)
2366{
2367 QString question;
2368 if ( ask ) {
2369 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n";
2370 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
2371 question,
2372 i18n("Yes"), i18n("No"),
2373 0, 0 ) != 0 )
2374 return;
2375 }
2376 QString command = prof->getPreSyncCommand();
2377 int fi;
2378 if ( (fi = command.find("$PWD$")) > 0 ) {
2379 QString pwd = getPassword();
2380 command = command.left( fi )+ pwd + command.mid( fi+5 );
2381
2382 }
2383 int maxlen = 30;
2384 if ( QApplication::desktop()->width() > 320 )
2385 maxlen += 25;
2386 setCaption ( i18n( "Copy remote file to local machine..." ) );
2387 int fileSize = 0;
2388 int result = system ( command );
2389 // 0 : okay
2390 // 256: no such file or dir
2391 //
2392 qDebug("KO: Remote copy result(0 = okay): %d ",result );
2393 if ( result != 0 ) {
2394 int len = maxlen;
2395 while ( len < command.length() ) {
2396 command.insert( len , "\n" );
2397 len += maxlen +2;
2398 }
2399 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ;
2400 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
2401 question,
2402 i18n("Okay!")) ;
2403 setCaption ("KO/Pi");
2404 return;
2405 }
2406 setCaption ( i18n( "Copying succeed." ) );
2407 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
2408 if ( syncWithFile( prof->getLocalTempFile(), true ) ) {
2409// Event* e = mView->getLastSyncEvent();
2410// e->setReadOnly( false );
2411// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
2412// e->setReadOnly( true );
2413 if ( KABPrefs::instance()->mWriteBackFile ) {
2414 command = prof->getPostSyncCommand();
2415 int fi;
2416 if ( (fi = command.find("$PWD$")) > 0 ) {
2417 QString pwd = getPassword();
2418 command = command.left( fi )+ pwd + command.mid( fi+5 );
2419
2420 }
2421 setCaption ( i18n( "Writing back file ..." ) );
2422 result = system ( command );
2423 qDebug("KO: Writing back file result: %d ", result);
2424 if ( result != 0 ) {
2425 setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
2426 return;
2427 } else {
2428 setCaption ( i18n( "Syncronization sucessfully completed" ) );
2429 }
2430 }
2431 }
2432 return;
2433}
2434#include <qpushbutton.h>
2435#include <qradiobutton.h>
2436#include <qbuttongroup.h>
2437void KABCore::edit_sync_options()
2438{
2439 //mDialogManager->showSyncOptions();
2440 //KABPrefs::instance()->mSyncAlgoPrefs
2441 QDialog dia( this, "dia", true );
2442 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
2443 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
2444 QVBoxLayout lay ( &dia );
2445 lay.setSpacing( 2 );
2446 lay.setMargin( 3 );
2447 lay.addWidget(&gr);
2448 QRadioButton loc ( i18n("Take local entry on conflict"), &gr );
2449 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr );
2450 QRadioButton newest( i18n("Take newest entry on conflict"), &gr );
2451 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr );
2452 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr );
2453 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr );
2454 //QRadioButton both( i18n("Take both on conflict"), &gr );
2455 QPushButton pb ( "OK", &dia);
2456 lay.addWidget( &pb );
2457 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
2458 switch ( KABPrefs::instance()->mSyncAlgoPrefs ) {
2459 case 0:
2460 loc.setChecked( true);
2461 break;
2462 case 1:
2463 rem.setChecked( true );
2464 break;
2465 case 2:
2466 newest.setChecked( true);
2467 break;
2468 case 3:
2469 ask.setChecked( true);
2470 break;
2471 case 4:
2472 f_loc.setChecked( true);
2473 break;
2474 case 5:
2475 f_rem.setChecked( true);
2476 break;
2477 case 6:
2478 // both.setChecked( true);
2479 break;
2480 default:
2481 break;
2482 }
2483 if ( dia.exec() ) {
2484 KABPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
2485 }
2486
2487
2488}
2489QString KABCore::getPassword( )
2490{
2491 QString retfile = "";
2492 QDialog dia ( this, "input-dialog", true );
2493 QLineEdit lab ( &dia );
2494 lab.setEchoMode( QLineEdit::Password );
2495 QVBoxLayout lay( &dia );
2496 lay.setMargin(7);
2497 lay.setSpacing(7);
2498 lay.addWidget( &lab);
2499 dia.setFixedSize( 230,50 );
2500 dia.setCaption( i18n("Enter password") );
2501 QPushButton pb ( "OK", &dia);
2502 lay.addWidget( &pb );
2503 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
2504 dia.show();
2505 int res = dia.exec();
2506 if ( res )
2507 retfile = lab.text();
2508 dia.hide();
2509 qApp->processEvents();
2510 return retfile;
2511
2512}
2513
2514bool KABCore::syncAB(QString filename, int mode)
2515{
2516
2517}
2518
2519
2520void KABCore::confSync()
2521{
2522 //mView->confSync();
2523 qDebug("pending KABCore::confSync() ");
2524 fillSyncMenu();
2525}
2526void KABCore::syncSharp()
2527{
2528 if ( mModified )
2529 save();
2530 qDebug("pending syncSharp() ");
2531 //mView->syncSharp();
2532 mModified = true ;
2533
2534}
2535void KABCore::syncPhone()
2536{
2537 if ( mModified )
2538 save();
2539 qDebug("pending syncPhone(); ");
2540 //mView->syncPhone();
2541 setModified();
2542
2543}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 39d043f..10ce8f4 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,187 +1,188 @@
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 32
33#include <qwidget.h> 33#include <qwidget.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35 35
36namespace KABC { 36namespace KABC {
37class AddressBook; 37class AddressBook;
38} 38}
39 39
40#ifndef KAB_EMBEDDED 40#ifndef KAB_EMBEDDED
41class KAboutData; 41class KAboutData;
42class KConfig; 42class KConfig;
43 43
44class KAddressBookService; 44class KAddressBookService;
45class LDAPSearchDialog; 45class LDAPSearchDialog;
46#else //KAB_EMBEDDED 46#else //KAB_EMBEDDED
47class KAddressBookMain; 47class KAddressBookMain;
48//US class QAction; 48//US class QAction;
49#endif //KAB_EMBEDDED 49#endif //KAB_EMBEDDED
50class KCMultiDialog; 50class KCMultiDialog;
51class KXMLGUIClient; 51class KXMLGUIClient;
52class ExtensionManager; 52class ExtensionManager;
53class XXPortManager; 53class XXPortManager;
54class JumpButtonBar; 54class JumpButtonBar;
55class IncSearchWidget; 55class IncSearchWidget;
56class KDGanttMinimizeSplitter; 56class KDGanttMinimizeSplitter;
57class KAction; 57class KAction;
58class KActionCollection; 58class KActionCollection;
59class KToggleAction; 59class KToggleAction;
60class KSyncProfile;
60 61
61class QAction; 62class QAction;
62class QMenuBar; 63class QMenuBar;
63class QSplitter; 64class QSplitter;
64class ViewContainer; 65class ViewContainer;
65class ViewManager; 66class ViewManager;
66class AddresseeEditorDialog; 67class AddresseeEditorDialog;
67class Ir; 68class Ir;
68 69
69class KABCore : public QWidget 70class KABCore : public QWidget
70{ 71{
71 Q_OBJECT 72 Q_OBJECT
72 73
73 public: 74 public:
74 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 75 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
75 76
76 77
77 ~KABCore(); 78 ~KABCore();
78 79
79 80
80#ifdef KAB_EMBEDDED 81#ifdef KAB_EMBEDDED
81 //US added functionality 82 //US added functionality
82 QPopupMenu* getViewMenu() {return viewMenu;} 83 QPopupMenu* getViewMenu() {return viewMenu;}
83 QPopupMenu* getFilterMenu() {return filterMenu;} 84 QPopupMenu* getFilterMenu() {return filterMenu;}
84 QPopupMenu* getSettingsMenu() {return settingsMenu;} 85 QPopupMenu* getSettingsMenu() {return settingsMenu;}
85 void addActionsManually(); 86 void addActionsManually();
86#endif //KAB_EMBEDDED 87#endif //KAB_EMBEDDED
87 /** 88 /**
88 Restores the global settings. 89 Restores the global settings.
89 */ 90 */
90 void restoreSettings(); 91 void restoreSettings();
91 92
92 /** 93 /**
93 Saves the global settings. 94 Saves the global settings.
94 */ 95 */
95 void saveSettings(); 96 void saveSettings();
96 97
97 /** 98 /**
98 Returns a pointer to the StdAddressBook of the application. 99 Returns a pointer to the StdAddressBook of the application.
99 */ 100 */
100 KABC::AddressBook *addressBook() const; 101 KABC::AddressBook *addressBook() const;
101 102
102 /** 103 /**
103 Returns a pointer to the KConfig object of the application. 104 Returns a pointer to the KConfig object of the application.
104 */ 105 */
105 static KConfig *config(); 106 static KConfig *config();
106 107
107 /** 108 /**
108 Returns a pointer to the global KActionCollection object. So 109 Returns a pointer to the global KActionCollection object. So
109 other classes can register their actions easily. 110 other classes can register their actions easily.
110 */ 111 */
111 KActionCollection *actionCollection() const; 112 KActionCollection *actionCollection() const;
112 113
113 /** 114 /**
114 Returns the current search field of the Incremental Search Widget. 115 Returns the current search field of the Incremental Search Widget.
115 */ 116 */
116 KABC::Field *currentSearchField() const; 117 KABC::Field *currentSearchField() const;
117 118
118 /** 119 /**
119 Returns the uid list of the currently selected contacts. 120 Returns the uid list of the currently selected contacts.
120 */ 121 */
121 QStringList selectedUIDs() const; 122 QStringList selectedUIDs() const;
122 123
123 /** 124 /**
124 Displays the ResourceSelectDialog and returns the selected 125 Displays the ResourceSelectDialog and returns the selected
125 resource or a null pointer if no resource was selected by 126 resource or a null pointer if no resource was selected by
126 the user. 127 the user.
127 */ 128 */
128 KABC::Resource *requestResource( QWidget *parent ); 129 KABC::Resource *requestResource( QWidget *parent );
129 130
130#ifndef KAB_EMBEDDED 131#ifndef KAB_EMBEDDED
131 static KAboutData *createAboutData(); 132 static KAboutData *createAboutData();
132#endif //KAB_EMBEDDED 133#endif //KAB_EMBEDDED
133 134
134#ifdef KAB_EMBEDDED 135#ifdef KAB_EMBEDDED
135 inline QPopupMenu* getImportMenu() { return ImportMenu;} 136 inline QPopupMenu* getImportMenu() { return ImportMenu;}
136 inline QPopupMenu* getExportMenu() { return ExportMenu;} 137 inline QPopupMenu* getExportMenu() { return ExportMenu;}
137#endif //KAB_EMBEDDED 138#endif //KAB_EMBEDDED
138 139
139 public slots: 140 public slots:
140#ifdef KAB_EMBEDDED 141#ifdef KAB_EMBEDDED
141 void createAboutData(); 142 void createAboutData();
142#endif //KAB_EMBEDDED 143#endif //KAB_EMBEDDED
143 144
144 void statusMessage(QString, int time = 0 ); 145 void statusMessage(QString, int time = 0 );
145 void showLicence(); 146 void showLicence();
146 void faq(); 147 void faq();
147 148
148 /** 149 /**
149 Is called whenever a contact is selected in the view. 150 Is called whenever a contact is selected in the view.
150 */ 151 */
151 void setContactSelected( const QString &uid ); 152 void setContactSelected( const QString &uid );
152 153
153 /** 154 /**
154 Opens the preferred mail composer with all selected contacts as 155 Opens the preferred mail composer with all selected contacts as
155 arguments. 156 arguments.
156 */ 157 */
157 void sendMail(); 158 void sendMail();
158 159
159 /** 160 /**
160 Opens the preferred mail composer with the given contacts as 161 Opens the preferred mail composer with the given contacts as
161 arguments. 162 arguments.
162 */ 163 */
163 void sendMail( const QString& email ); 164 void sendMail( const QString& email );
164 165
165 166
166 void mailVCard(); 167 void mailVCard();
167 void mailVCard(const QStringList& uids); 168 void mailVCard(const QStringList& uids);
168 169
169 /** 170 /**
170 Beams the "WhoAmI contact. 171 Beams the "WhoAmI contact.
171 */ 172 */
172 void beamMySelf(); 173 void beamMySelf();
173 174
174 void beamVCard(); 175 void beamVCard();
175 void beamVCard(const QStringList& uids); 176 void beamVCard(const QStringList& uids);
176 void beamDone( Ir *ir ); 177 void beamDone( Ir *ir );
177 178
178 179
179 /** 180 /**
180 Starts the preferred web browser with the given URL as argument. 181 Starts the preferred web browser with the given URL as argument.
181 */ 182 */
182 void browse( const QString& url ); 183 void browse( const QString& url );
183 184
184 /** 185 /**
185 Select all contacts in the view. 186 Select all contacts in the view.
186 */ 187 */
187 void selectAllContacts(); 188 void selectAllContacts();
@@ -215,242 +216,263 @@ class KABCore : public QWidget
215 216
216 /** 217 /**
217 Paste given contacts into the address book. 218 Paste given contacts into the address book.
218 219
219 @param list The list of addressee, which shall be pasted. 220 @param list The list of addressee, which shall be pasted.
220 */ 221 */
221 void pasteContacts( KABC::Addressee::List &list ); 222 void pasteContacts( KABC::Addressee::List &list );
222 223
223 /** 224 /**
224 Sets the whoAmI contact, that is used by many other programs to 225 Sets the whoAmI contact, that is used by many other programs to
225 get personal information about the current user. 226 get personal information about the current user.
226 */ 227 */
227 void setWhoAmI(); 228 void setWhoAmI();
228 229
229 /** 230 /**
230 Displays the category dialog and applies the result to all 231 Displays the category dialog and applies the result to all
231 selected contacts. 232 selected contacts.
232 */ 233 */
233 void setCategories(); 234 void setCategories();
234 235
235 /** 236 /**
236 Sets the field list of the Incremental Search Widget. 237 Sets the field list of the Incremental Search Widget.
237 */ 238 */
238 void setSearchFields( const KABC::Field::List &fields ); 239 void setSearchFields( const KABC::Field::List &fields );
239 240
240 /** 241 /**
241 Search with the current search field for a contact, that matches 242 Search with the current search field for a contact, that matches
242 the given text, and selects it in the view. 243 the given text, and selects it in the view.
243 */ 244 */
244 void incrementalSearch( const QString& text ); 245 void incrementalSearch( const QString& text );
245 246
246 /** 247 /**
247 Marks the address book as modified. 248 Marks the address book as modified.
248 */ 249 */
249 void setModified(); 250 void setModified();
250 /** 251 /**
251 Marks the address book as modified without refreshing the view. 252 Marks the address book as modified without refreshing the view.
252 */ 253 */
253 void setModifiedWOrefresh(); 254 void setModifiedWOrefresh();
254 255
255 /** 256 /**
256 Marks the address book as modified concerning the argument. 257 Marks the address book as modified concerning the argument.
257 */ 258 */
258 void setModified( bool modified ); 259 void setModified( bool modified );
259 260
260 /** 261 /**
261 Returns whether the address book is modified. 262 Returns whether the address book is modified.
262 */ 263 */
263 bool modified() const; 264 bool modified() const;
264 265
265 /** 266 /**
266 Called whenever an contact is modified in the contact editor 267 Called whenever an contact is modified in the contact editor
267 dialog or the quick edit. 268 dialog or the quick edit.
268 */ 269 */
269 void contactModified( const KABC::Addressee &addr ); 270 void contactModified( const KABC::Addressee &addr );
270 271
271 /** 272 /**
272 DCOP METHODS. 273 DCOP METHODS.
273 */ 274 */
274 void addEmail( QString addr ); 275 void addEmail( QString addr );
275 void importVCard( const KURL& url, bool showPreview ); 276 void importVCard( const KURL& url, bool showPreview );
276 void importVCard( const QString& vCard, bool showPreview ); 277 void importVCard( const QString& vCard, bool showPreview );
277 void newContact(); 278 void newContact();
278 QString getNameByPhone( const QString& phone ); 279 QString getNameByPhone( const QString& phone );
279 /** 280 /**
280 END DCOP METHODS 281 END DCOP METHODS
281 */ 282 */
282 283
283 /** 284 /**
284 Saves the contents of the AddressBook back to disk. 285 Saves the contents of the AddressBook back to disk.
285 */ 286 */
286 void save(); 287 void save();
287 288
288 /** 289 /**
289 Undos the last command using the undo stack. 290 Undos the last command using the undo stack.
290 */ 291 */
291 void undo(); 292 void undo();
292 293
293 /** 294 /**
294 Redos the last command that was undone, using the redo stack. 295 Redos the last command that was undone, using the redo stack.
295 */ 296 */
296 void redo(); 297 void redo();
297 298
298 /** 299 /**
299 Shows the edit dialog for the given uid. If the uid is QString::null, 300 Shows the edit dialog for the given uid. If the uid is QString::null,
300 the method will try to find a selected addressee in the view. 301 the method will try to find a selected addressee in the view.
301 */ 302 */
302 void editContact( const QString &uid /*US = QString::null*/ ); 303 void editContact( const QString &uid /*US = QString::null*/ );
303//US added a second method without defaultparameter 304//US added a second method without defaultparameter
304 void editContact2(); 305 void editContact2();
305 306
306 /** 307 /**
307 Shows or edits the detail view for the given uid. If the uid is QString::null, 308 Shows or edits the detail view for the given uid. If the uid is QString::null,
308 the method will try to find a selected addressee in the view. 309 the method will try to find a selected addressee in the view.
309 */ 310 */
310 void executeContact( const QString &uid /*US = QString::null*/ ); 311 void executeContact( const QString &uid /*US = QString::null*/ );
311 312
312 /** 313 /**
313 Launches the configuration dialog. 314 Launches the configuration dialog.
314 */ 315 */
315 void openConfigDialog(); 316 void openConfigDialog();
316 317
317 /** 318 /**
318 Launches the ldap search dialog. 319 Launches the ldap search dialog.
319 */ 320 */
320 void openLDAPDialog(); 321 void openLDAPDialog();
321 322
322 /** 323 /**
323 Creates a KAddressBookPrinter, which will display the print 324 Creates a KAddressBookPrinter, which will display the print
324 dialog and do the printing. 325 dialog and do the printing.
325 */ 326 */
326 void print(); 327 void print();
327 328
328 /** 329 /**
329 Registers a new GUI client, so plugins can register its actions. 330 Registers a new GUI client, so plugins can register its actions.
330 */ 331 */
331 void addGUIClient( KXMLGUIClient *client ); 332 void addGUIClient( KXMLGUIClient *client );
332 333
333 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 334 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
334 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 335 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
335 336
336 337
337 signals: 338 signals:
338 void contactSelected( const QString &name ); 339 void contactSelected( const QString &name );
339 void contactSelected( const QPixmap &pixmap ); 340 void contactSelected( const QPixmap &pixmap );
340 public slots: 341 public slots:
341 void setDetailsVisible( bool visible ); 342 void setDetailsVisible( bool visible );
342 void setDetailsToState(); 343 void setDetailsToState();
344 void slotSyncMenu( int );
343 private slots: 345 private slots:
344 void setJumpButtonBarVisible( bool visible ); 346 void setJumpButtonBarVisible( bool visible );
345 void importFromOL(); 347 void importFromOL();
346 void extensionModified( const KABC::Addressee::List &list ); 348 void extensionModified( const KABC::Addressee::List &list );
347 void extensionChanged( int id ); 349 void extensionChanged( int id );
348 void clipboardDataChanged(); 350 void clipboardDataChanged();
349 void updateActionMenu(); 351 void updateActionMenu();
350 void configureKeyBindings(); 352 void configureKeyBindings();
351 void removeVoice(); 353 void removeVoice();
352#ifdef KAB_EMBEDDED 354#ifdef KAB_EMBEDDED
353 void configureResources(); 355 void configureResources();
354#endif //KAB_EMBEDDED 356#endif //KAB_EMBEDDED
355 357
356 void slotEditorDestroyed( const QString &uid ); 358 void slotEditorDestroyed( const QString &uid );
357 void configurationChanged(); 359 void configurationChanged();
358 void addressBookChanged(); 360 void addressBookChanged();
359 361
360 private: 362 private:
361 void initGUI(); 363 void initGUI();
362 void initActions(); 364 void initActions();
363 365
364 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 366 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
365 const char *name = 0 ); 367 const char *name = 0 );
366 368
367 KXMLGUIClient *mGUIClient; 369 KXMLGUIClient *mGUIClient;
368 370
369 KABC::AddressBook *mAddressBook; 371 KABC::AddressBook *mAddressBook;
370 372
371 ViewManager *mViewManager; 373 ViewManager *mViewManager;
372 // QSplitter *mDetailsSplitter; 374 // QSplitter *mDetailsSplitter;
373 KDGanttMinimizeSplitter *mExtensionBarSplitter; 375 KDGanttMinimizeSplitter *mExtensionBarSplitter;
374 ViewContainer *mDetails; 376 ViewContainer *mDetails;
375 KDGanttMinimizeSplitter* mMiniSplitter; 377 KDGanttMinimizeSplitter* mMiniSplitter;
376 XXPortManager *mXXPortManager; 378 XXPortManager *mXXPortManager;
377 JumpButtonBar *mJumpButtonBar; 379 JumpButtonBar *mJumpButtonBar;
378 IncSearchWidget *mIncSearchWidget; 380 IncSearchWidget *mIncSearchWidget;
379 ExtensionManager *mExtensionManager; 381 ExtensionManager *mExtensionManager;
380 382
381 KCMultiDialog *mConfigureDialog; 383 KCMultiDialog *mConfigureDialog;
382 384
383#ifndef KAB_EMBEDDED 385#ifndef KAB_EMBEDDED
384 LDAPSearchDialog *mLdapSearchDialog; 386 LDAPSearchDialog *mLdapSearchDialog;
385#endif //KAB_EMBEDDED 387#endif //KAB_EMBEDDED
386 // QDict<AddresseeEditorDialog> mEditorDict; 388 // QDict<AddresseeEditorDialog> mEditorDict;
387 AddresseeEditorDialog *mEditorDialog; 389 AddresseeEditorDialog *mEditorDialog;
388 bool mReadWrite; 390 bool mReadWrite;
389 bool mModified; 391 bool mModified;
390 bool mIsPart; 392 bool mIsPart;
391 bool mMultipleViewsAtOnce; 393 bool mMultipleViewsAtOnce;
392 394
393 395
394 //US file menu 396 //US file menu
395 KAction *mActionMail; 397 KAction *mActionMail;
396 KAction *mActionBeam; 398 KAction *mActionBeam;
397 KAction* mActionPrint; 399 KAction* mActionPrint;
398 KAction* mActionNewContact; 400 KAction* mActionNewContact;
399 KAction *mActionSave; 401 KAction *mActionSave;
400 KAction *mActionEditAddressee; 402 KAction *mActionEditAddressee;
401 KAction *mActionMailVCard; 403 KAction *mActionMailVCard;
402 KAction *mActionBeamVCard; 404 KAction *mActionBeamVCard;
403 405
404 KAction *mActionQuit; 406 KAction *mActionQuit;
405 407
406 //US edit menu 408 //US edit menu
407 KAction *mActionCopy; 409 KAction *mActionCopy;
408 KAction *mActionCut; 410 KAction *mActionCut;
409 KAction *mActionPaste; 411 KAction *mActionPaste;
410 KAction *mActionSelectAll; 412 KAction *mActionSelectAll;
411 KAction *mActionUndo; 413 KAction *mActionUndo;
412 KAction *mActionRedo; 414 KAction *mActionRedo;
413 KAction *mActionDelete; 415 KAction *mActionDelete;
414 416
415 //US settings menu 417 //US settings menu
416 KAction *mActionConfigResources; 418 KAction *mActionConfigResources;
417 KAction *mActionConfigKAddressbook; 419 KAction *mActionConfigKAddressbook;
418 KAction *mActionConfigShortcuts; 420 KAction *mActionConfigShortcuts;
419 KAction *mActionConfigureToolbars; 421 KAction *mActionConfigureToolbars;
420 KAction *mActionKeyBindings; 422 KAction *mActionKeyBindings;
421 KToggleAction *mActionJumpBar; 423 KToggleAction *mActionJumpBar;
422 KToggleAction *mActionDetails; 424 KToggleAction *mActionDetails;
423 KAction *mActionWhoAmI; 425 KAction *mActionWhoAmI;
424 KAction *mActionCategories; 426 KAction *mActionCategories;
425 KAction *mActionAboutKAddressbook; 427 KAction *mActionAboutKAddressbook;
426 KAction *mActionLicence; 428 KAction *mActionLicence;
427 KAction *mActionFaq; 429 KAction *mActionFaq;
428 430
429 KAction *mActionDeleteView; 431 KAction *mActionDeleteView;
430 432
431 QPopupMenu *viewMenu; 433 QPopupMenu *viewMenu;
432 QPopupMenu *filterMenu; 434 QPopupMenu *filterMenu;
433 QPopupMenu *settingsMenu; 435 QPopupMenu *settingsMenu;
434 QPopupMenu *changeMenu; 436 QPopupMenu *changeMenu;
435
436//US QAction *mActionSave; 437//US QAction *mActionSave;
437 QPopupMenu *ImportMenu; 438 QPopupMenu *ImportMenu;
438 QPopupMenu *ExportMenu; 439 QPopupMenu *ExportMenu;
439 //LR additional methods 440 //LR additional methods
440 KAction *mActionRemoveVoice; 441 KAction *mActionRemoveVoice;
441 KAction * mActionImportOL; 442 KAction * mActionImportOL;
442 443
443#ifndef KAB_EMBEDDED 444#ifndef KAB_EMBEDDED
444 KAddressBookService *mAddressBookService; 445 KAddressBookService *mAddressBookService;
445#endif //KAB_EMBEDDED 446#endif //KAB_EMBEDDED
446 447
447 class KABCorePrivate; 448 class KABCorePrivate;
448 KABCorePrivate *d; 449 KABCorePrivate *d;
450 bool mBlockSaveFlag;
449 451
450#ifdef KAB_EMBEDDED 452#ifdef KAB_EMBEDDED
451 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 453 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
452#endif //KAB_EMBEDDED 454#endif //KAB_EMBEDDED
455 // LR *******************************
456 // sync stuff!
457 QPopupMenu *syncMenu;
458 void fillSyncMenu();
459 void confSync();
460 QString mCurrentSyncDevice;
461 QString mCurrentSyncName;
462 void quickSyncLocalFile();
463 bool syncWithFile( QString fn , bool quick );
464 void KABCore::syncLocalFile();
465 void KABCore::syncPhone();
466 void KABCore::syncSharp();
467 void multiSync( bool askforPrefs );
468 int mCurrentSyncProfile ;
469 void syncRemote( KSyncProfile* prof, bool ask = true);
470 void edit_sync_options();
471 bool syncAB(QString filename, int mode);
472 int ringSync();
473 QString getPassword( );
474 // *********************
453 475
454}; 476};
455 477
456#endif 478#endif
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index e4f359c..9926aa0 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -1,92 +1,108 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
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 KABPREFS_H 24#ifndef KABPREFS_H
25#define KABPREFS_H 25#define KABPREFS_H
26 26
27#include <qstringlist.h> 27#include <qstringlist.h>
28 28
29#include <libkdepim/kpimprefs.h> 29#include <libkdepim/kpimprefs.h>
30 30
31class KConfig; 31class KConfig;
32 32
33class KABPrefs : public KPimPrefs 33class KABPrefs : public KPimPrefs
34{ 34{
35 public: 35 public:
36 virtual ~KABPrefs(); 36 virtual ~KABPrefs();
37 37
38 static KABPrefs *instance(); 38 static KABPrefs *instance();
39 39
40 // General 40 // General
41 bool mHonorSingleClick; 41 bool mHonorSingleClick;
42 bool mAutomaticNameParsing; 42 bool mAutomaticNameParsing;
43 int mCurrentIncSearchField; 43 int mCurrentIncSearchField;
44 44
45#ifdef KAB_EMBEDDED 45#ifdef KAB_EMBEDDED
46 // US introduce a nonconst way to return the config object. 46 // US introduce a nonconst way to return the config object.
47 KConfig* getConfig(); 47 KConfig* getConfig();
48 48
49 bool mToolBarHor; 49 bool mToolBarHor;
50 bool mToolBarUp; 50 bool mToolBarUp;
51 bool mAskForQuit; 51 bool mAskForQuit;
52 52
53 53
54 /** Set preferences to default values */ 54 /** Set preferences to default values */
55// void usrSetDefaults(); 55// void usrSetDefaults();
56 56
57 /** Read preferences from config file */ 57 /** Read preferences from config file */
58// void usrReadConfig(); 58// void usrReadConfig();
59 59
60 /** Write preferences to config file */ 60 /** Write preferences to config file */
61// void usrWriteConfig(); 61// void usrWriteConfig();
62#endif //KAB_EMBEDDED 62#endif //KAB_EMBEDDED
63 63
64 64
65 // GUI 65 // GUI
66 bool mJumpButtonBarVisible; 66 bool mJumpButtonBarVisible;
67 bool mDetailsPageVisible; 67 bool mDetailsPageVisible;
68 bool mMultipleViewsAtOnce; 68 bool mMultipleViewsAtOnce;
69 bool mSearchWithReturn; 69 bool mSearchWithReturn;
70 QValueList<int> mExtensionsSplitter; 70 QValueList<int> mExtensionsSplitter;
71 QValueList<int> mDetailsSplitter; 71 QValueList<int> mDetailsSplitter;
72 72
73 // Extensions stuff 73 // Extensions stuff
74 int mCurrentExtension; 74 int mCurrentExtension;
75 QStringList mActiveExtensions; 75 QStringList mActiveExtensions;
76 76
77 // Views stuff 77 // Views stuff
78 QString mCurrentView; 78 QString mCurrentView;
79 QStringList mViewNames; 79 QStringList mViewNames;
80 80
81 // Filter 81 // Filter
82 int mCurrentFilter; 82 int mCurrentFilter;
83 83
84 void setCategoryDefaults(); 84 void setCategoryDefaults();
85 85 // sync stuff
86 QString mLocalMachineName;
87 QStringList mExternSyncProfiles;
88 QStringList mSyncProfileNames;
89 bool mAskForPreferences;
90 bool mShowSyncSummary;
91 bool mShowSyncEvents;
92 bool mShowTodoInAgenda;
93 bool mWriteBackExistingOnly;
94 int mSyncAlgoPrefs;
95 int mRingSyncAlgoPrefs;
96 bool mWriteBackFile;
97 int mWriteBackInFuture;
98 QString mPhoneDevice;
99 QString mPhoneConnection;
100 QString mPhoneModel;
101 QString mLastSyncedLocalFile; // save!
86 private: 102 private:
87 KABPrefs(); 103 KABPrefs();
88 104
89 static KABPrefs *sInstance; 105 static KABPrefs *sInstance;
90}; 106};
91 107
92#endif 108#endif