summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-20 12:05:18 (UTC)
committer zautrix <zautrix>2004-10-20 12:05:18 (UTC)
commit5cf3c1bce58a6487af166e637e54571e98156fd0 (patch) (unidiff)
tree2e1ba14350aa322bb21729cf462b96e658fa6929
parente2a0df411042d986adb31b28f9e0a2f17395358c (diff)
downloadkdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.zip
kdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.tar.gz
kdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.tar.bz2
OL import fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp8
-rw-r--r--kaddressbook/kaimportoldialog.cpp46
-rw-r--r--korganizer/koimportoldialog.cpp3
-rw-r--r--korganizer/mainwindow.cpp8
4 files changed, 57 insertions, 8 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 980e436..1074a62 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -141,432 +141,436 @@ $Id$
141#include "addresseeeditordialog.h" 141#include "addresseeeditordialog.h"
142#include "viewmanager.h" 142#include "viewmanager.h"
143#include "details/detailsviewcontainer.h" 143#include "details/detailsviewcontainer.h"
144#include "kabprefs.h" 144#include "kabprefs.h"
145#include "xxportmanager.h" 145#include "xxportmanager.h"
146#include "incsearchwidget.h" 146#include "incsearchwidget.h"
147#include "jumpbuttonbar.h" 147#include "jumpbuttonbar.h"
148#include "extensionmanager.h" 148#include "extensionmanager.h"
149#include "addresseeconfig.h" 149#include "addresseeconfig.h"
150#include <kcmultidialog.h> 150#include <kcmultidialog.h>
151 151
152#ifdef _WIN32_ 152#ifdef _WIN32_
153 153
154#include "kaimportoldialog.h" 154#include "kaimportoldialog.h"
155#else 155#else
156#include <unistd.h> 156#include <unistd.h>
157#endif 157#endif
158// sync includes 158// sync includes
159#include <libkdepim/ksyncprofile.h> 159#include <libkdepim/ksyncprofile.h>
160#include <libkdepim/ksyncprefsdialog.h> 160#include <libkdepim/ksyncprefsdialog.h>
161 161
162class KAex2phonePrefs : public QDialog 162class KAex2phonePrefs : public QDialog
163{ 163{
164 public: 164 public:
165 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 165 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
166 QDialog( parent, name, true ) 166 QDialog( parent, name, true )
167 { 167 {
168 setCaption( i18n("Export to phone options") ); 168 setCaption( i18n("Export to phone options") );
169 QVBoxLayout* lay = new QVBoxLayout( this ); 169 QVBoxLayout* lay = new QVBoxLayout( this );
170 lay->setSpacing( 3 ); 170 lay->setSpacing( 3 );
171 lay->setMargin( 3 ); 171 lay->setMargin( 3 );
172 QLabel *lab; 172 QLabel *lab;
173 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 173 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
174 lab->setAlignment (AlignHCenter ); 174 lab->setAlignment (AlignHCenter );
175 QHBox* temphb; 175 QHBox* temphb;
176 temphb = new QHBox( this ); 176 temphb = new QHBox( this );
177 new QLabel( i18n("I/O device: "), temphb ); 177 new QLabel( i18n("I/O device: "), temphb );
178 mPhoneDevice = new QLineEdit( temphb); 178 mPhoneDevice = new QLineEdit( temphb);
179 lay->addWidget( temphb ); 179 lay->addWidget( temphb );
180 temphb = new QHBox( this ); 180 temphb = new QHBox( this );
181 new QLabel( i18n("Connection: "), temphb ); 181 new QLabel( i18n("Connection: "), temphb );
182 mPhoneConnection = new QLineEdit( temphb); 182 mPhoneConnection = new QLineEdit( temphb);
183 lay->addWidget( temphb ); 183 lay->addWidget( temphb );
184 temphb = new QHBox( this ); 184 temphb = new QHBox( this );
185 new QLabel( i18n("Model(opt.): "), temphb ); 185 new QLabel( i18n("Model(opt.): "), temphb );
186 mPhoneModel = new QLineEdit( temphb); 186 mPhoneModel = new QLineEdit( temphb);
187 lay->addWidget( temphb ); 187 lay->addWidget( temphb );
188 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 188 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
189 // lay->addWidget( mWriteToSim ); 189 // lay->addWidget( mWriteToSim );
190 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 190 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
191 lab->setAlignment (AlignHCenter ); 191 lab->setAlignment (AlignHCenter );
192 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 192 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
193 lay->addWidget( ok ); 193 lay->addWidget( ok );
194 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 194 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
195 lay->addWidget( cancel ); 195 lay->addWidget( cancel );
196 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 196 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
197 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 197 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
198 resize( 220, 240 ); 198 resize( 220, 240 );
199 199
200 } 200 }
201 201
202public: 202public:
203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
204 QCheckBox* mWriteToSim; 204 QCheckBox* mWriteToSim;
205}; 205};
206 206
207 207
208bool pasteWithNewUid = true; 208bool pasteWithNewUid = true;
209 209
210#ifdef KAB_EMBEDDED 210#ifdef KAB_EMBEDDED
211KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 211KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
212 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 212 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
213 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 213 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
214 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 214 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
215#else //KAB_EMBEDDED 215#else //KAB_EMBEDDED
216KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 216KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
217 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 217 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
218 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 218 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
219 mReadWrite( readWrite ), mModified( false ) 219 mReadWrite( readWrite ), mModified( false )
220#endif //KAB_EMBEDDED 220#endif //KAB_EMBEDDED
221{ 221{
222 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 222 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
223 // syncManager->setBlockSave(false); 223 // syncManager->setBlockSave(false);
224 mExtensionBarSplitter = 0; 224 mExtensionBarSplitter = 0;
225 mIsPart = !parent->inherits( "KAddressBookMain" ); 225 mIsPart = !parent->inherits( "KAddressBookMain" );
226 mAddressBook = KABC::StdAddressBook::self(); 226 mAddressBook = KABC::StdAddressBook::self();
227 KABC::StdAddressBook::setAutomaticSave( false ); 227 KABC::StdAddressBook::setAutomaticSave( false );
228 228
229#ifndef KAB_EMBEDDED 229#ifndef KAB_EMBEDDED
230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
231#endif //KAB_EMBEDDED 231#endif //KAB_EMBEDDED
232 232
233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
234 SLOT( addressBookChanged() ) ); 234 SLOT( addressBookChanged() ) );
235 235
236#if 0 236#if 0
237 // LP moved to addressbook init method 237 // LP moved to addressbook init method
238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
239 "X-Department", "KADDRESSBOOK" ); 239 "X-Department", "KADDRESSBOOK" );
240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
241 "X-Profession", "KADDRESSBOOK" ); 241 "X-Profession", "KADDRESSBOOK" );
242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
243 "X-AssistantsName", "KADDRESSBOOK" ); 243 "X-AssistantsName", "KADDRESSBOOK" );
244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
245 "X-ManagersName", "KADDRESSBOOK" ); 245 "X-ManagersName", "KADDRESSBOOK" );
246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
247 "X-SpousesName", "KADDRESSBOOK" ); 247 "X-SpousesName", "KADDRESSBOOK" );
248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
249 "X-Office", "KADDRESSBOOK" ); 249 "X-Office", "KADDRESSBOOK" );
250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
251 "X-IMAddress", "KADDRESSBOOK" ); 251 "X-IMAddress", "KADDRESSBOOK" );
252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
253 "X-Anniversary", "KADDRESSBOOK" ); 253 "X-Anniversary", "KADDRESSBOOK" );
254 254
255 //US added this field to become compatible with Opie/qtopia addressbook 255 //US added this field to become compatible with Opie/qtopia addressbook
256 // values can be "female" or "male" or "". An empty field represents undefined. 256 // values can be "female" or "male" or "". An empty field represents undefined.
257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
258 "X-Gender", "KADDRESSBOOK" ); 258 "X-Gender", "KADDRESSBOOK" );
259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
260 "X-Children", "KADDRESSBOOK" ); 260 "X-Children", "KADDRESSBOOK" );
261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
262 "X-FreeBusyUrl", "KADDRESSBOOK" ); 262 "X-FreeBusyUrl", "KADDRESSBOOK" );
263#endif 263#endif
264 initGUI(); 264 initGUI();
265 265
266 mIncSearchWidget->setFocus(); 266 mIncSearchWidget->setFocus();
267 267
268 268
269 connect( mViewManager, SIGNAL( selected( const QString& ) ), 269 connect( mViewManager, SIGNAL( selected( const QString& ) ),
270 SLOT( setContactSelected( const QString& ) ) ); 270 SLOT( setContactSelected( const QString& ) ) );
271 connect( mViewManager, SIGNAL( executed( const QString& ) ), 271 connect( mViewManager, SIGNAL( executed( const QString& ) ),
272 SLOT( executeContact( const QString& ) ) ); 272 SLOT( executeContact( const QString& ) ) );
273 273
274 connect( mViewManager, SIGNAL( deleteRequest( ) ), 274 connect( mViewManager, SIGNAL( deleteRequest( ) ),
275 SLOT( deleteContacts( ) ) ); 275 SLOT( deleteContacts( ) ) );
276 connect( mViewManager, SIGNAL( modified() ), 276 connect( mViewManager, SIGNAL( modified() ),
277 SLOT( setModified() ) ); 277 SLOT( setModified() ) );
278 278
279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
281 281
282 connect( mXXPortManager, SIGNAL( modified() ), 282 connect( mXXPortManager, SIGNAL( modified() ),
283 SLOT( setModified() ) ); 283 SLOT( setModified() ) );
284 284
285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
286 SLOT( incrementalSearch( const QString& ) ) ); 286 SLOT( incrementalSearch( const QString& ) ) );
287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
288 mJumpButtonBar, SLOT( recreateButtons() ) ); 288 mJumpButtonBar, SLOT( recreateButtons() ) );
289 289
290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
291 SLOT( sendMail( const QString& ) ) ); 291 SLOT( sendMail( const QString& ) ) );
292 292
293 293
294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
295 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&))); 295 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&)));
296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
297 297
298 298
299#ifndef KAB_EMBEDDED 299#ifndef KAB_EMBEDDED
300 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 300 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
301 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 301 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
302 302
303 connect( mDetails, SIGNAL( browse( const QString& ) ), 303 connect( mDetails, SIGNAL( browse( const QString& ) ),
304 SLOT( browse( const QString& ) ) ); 304 SLOT( browse( const QString& ) ) );
305 305
306 306
307 mAddressBookService = new KAddressBookService( this ); 307 mAddressBookService = new KAddressBookService( this );
308 308
309#endif //KAB_EMBEDDED 309#endif //KAB_EMBEDDED
310 310
311 mMessageTimer = new QTimer( this ); 311 mMessageTimer = new QTimer( this );
312 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 312 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
313 mEditorDialog = 0; 313 mEditorDialog = 0;
314 createAddresseeEditorDialog( this ); 314 createAddresseeEditorDialog( this );
315 setModified( false ); 315 setModified( false );
316 mBRdisabled = 0; 316 mBRdisabled = 0;
317#ifndef DESKTOP_VERSION 317#ifndef DESKTOP_VERSION
318 infrared = 0; 318 infrared = 0;
319#endif 319#endif
320 toggleBeamReceive( ); 320 toggleBeamReceive( );
321} 321}
322 322
323KABCore::~KABCore() 323KABCore::~KABCore()
324{ 324{
325 // save(); 325 // save();
326 //saveSettings(); 326 //saveSettings();
327 //KABPrefs::instance()->writeConfig(); 327 //KABPrefs::instance()->writeConfig();
328 delete AddresseeConfig::instance(); 328 delete AddresseeConfig::instance();
329 mAddressBook = 0; 329 mAddressBook = 0;
330 KABC::StdAddressBook::close(); 330 KABC::StdAddressBook::close();
331 331
332 delete syncManager; 332 delete syncManager;
333#ifndef DESKTOP_VERSION
333 if ( infrared ) 334 if ( infrared )
334 delete infrared; 335 delete infrared;
336#endif
335} 337}
336void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 338void KABCore::receive( const QCString& cmsg, const QByteArray& data )
337{ 339{
338 qDebug("KA: QCOP message received: %s ", cmsg.data() ); 340 qDebug("KA: QCOP message received: %s ", cmsg.data() );
339 if ( cmsg == "setDocument(QString)" ) { 341 if ( cmsg == "setDocument(QString)" ) {
340 QDataStream stream( data, IO_ReadOnly ); 342 QDataStream stream( data, IO_ReadOnly );
341 QString fileName; 343 QString fileName;
342 stream >> fileName; 344 stream >> fileName;
343 recieve( fileName ); 345 recieve( fileName );
344 return; 346 return;
345 } 347 }
346} 348}
347void KABCore::toggleBeamReceive( ) 349void KABCore::toggleBeamReceive( )
348{ 350{
349 if ( mBRdisabled ) 351 if ( mBRdisabled )
350 return; 352 return;
351#ifndef DESKTOP_VERSION 353#ifndef DESKTOP_VERSION
352 if ( infrared ) { 354 if ( infrared ) {
353 qDebug("AB disable BeamReceive "); 355 qDebug("AB disable BeamReceive ");
354 delete infrared; 356 delete infrared;
355 infrared = 0; 357 infrared = 0;
356 mActionBR->setChecked(false); 358 mActionBR->setChecked(false);
357 return; 359 return;
358 } 360 }
359 qDebug("AB enable BeamReceive "); 361 qDebug("AB enable BeamReceive ");
360 mActionBR->setChecked(true); 362 mActionBR->setChecked(true);
361 363
362 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 364 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
363 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 365 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
364#endif 366#endif
365} 367}
366 368
367 369
368void KABCore::disableBR(bool b) 370void KABCore::disableBR(bool b)
369{ 371{
372#ifndef DESKTOP_VERSION
370 if ( b ) { 373 if ( b ) {
371 if ( infrared ) { 374 if ( infrared ) {
372 toggleBeamReceive( ); 375 toggleBeamReceive( );
373 mBRdisabled = true;
374 } 376 }
377 mBRdisabled = true;
375 } else { 378 } else {
376 if ( mBRdisabled ) { 379 if ( mBRdisabled ) {
377 mBRdisabled = false; 380 mBRdisabled = false;
378 toggleBeamReceive( ); 381 //toggleBeamReceive( );
379 } 382 }
380 } 383 }
384#endif
381 385
382} 386}
383void KABCore::recieve( QString fn ) 387void KABCore::recieve( QString fn )
384{ 388{
385 //qDebug("KABCore::recieve "); 389 //qDebug("KABCore::recieve ");
386 int count = mAddressBook->importFromFile( fn, true ); 390 int count = mAddressBook->importFromFile( fn, true );
387 mViewManager->refreshView(); 391 mViewManager->refreshView();
388 message(i18n("%1 contact(s) received!").arg( count )); 392 message(i18n("%1 contact(s) received!").arg( count ));
389 topLevelWidget()->showMaximized(); 393 topLevelWidget()->showMaximized();
390 topLevelWidget()->raise(); 394 topLevelWidget()->raise();
391} 395}
392void KABCore::restoreSettings() 396void KABCore::restoreSettings()
393{ 397{
394 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 398 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
395 399
396 bool state; 400 bool state;
397 401
398 if (mMultipleViewsAtOnce) 402 if (mMultipleViewsAtOnce)
399 state = KABPrefs::instance()->mDetailsPageVisible; 403 state = KABPrefs::instance()->mDetailsPageVisible;
400 else 404 else
401 state = false; 405 state = false;
402 406
403 mActionDetails->setChecked( state ); 407 mActionDetails->setChecked( state );
404 setDetailsVisible( state ); 408 setDetailsVisible( state );
405 409
406 state = KABPrefs::instance()->mJumpButtonBarVisible; 410 state = KABPrefs::instance()->mJumpButtonBarVisible;
407 411
408 mActionJumpBar->setChecked( state ); 412 mActionJumpBar->setChecked( state );
409 setJumpButtonBarVisible( state ); 413 setJumpButtonBarVisible( state );
410/*US 414/*US
411 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 415 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
412 if ( splitterSize.count() == 0 ) { 416 if ( splitterSize.count() == 0 ) {
413 splitterSize.append( width() / 2 ); 417 splitterSize.append( width() / 2 );
414 splitterSize.append( width() / 2 ); 418 splitterSize.append( width() / 2 );
415 } 419 }
416 mMiniSplitter->setSizes( splitterSize ); 420 mMiniSplitter->setSizes( splitterSize );
417 if ( mExtensionBarSplitter ) { 421 if ( mExtensionBarSplitter ) {
418 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 422 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
419 if ( splitterSize.count() == 0 ) { 423 if ( splitterSize.count() == 0 ) {
420 splitterSize.append( width() / 2 ); 424 splitterSize.append( width() / 2 );
421 splitterSize.append( width() / 2 ); 425 splitterSize.append( width() / 2 );
422 } 426 }
423 mExtensionBarSplitter->setSizes( splitterSize ); 427 mExtensionBarSplitter->setSizes( splitterSize );
424 428
425 } 429 }
426*/ 430*/
427 mViewManager->restoreSettings(); 431 mViewManager->restoreSettings();
428 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 432 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
429 mExtensionManager->restoreSettings(); 433 mExtensionManager->restoreSettings();
430#ifdef DESKTOP_VERSION 434#ifdef DESKTOP_VERSION
431 int wid = width(); 435 int wid = width();
432 if ( wid < 10 ) 436 if ( wid < 10 )
433 wid = 400; 437 wid = 400;
434#else 438#else
435 int wid = QApplication::desktop()->width(); 439 int wid = QApplication::desktop()->width();
436 if ( wid < 640 ) 440 if ( wid < 640 )
437 wid = QApplication::desktop()->height(); 441 wid = QApplication::desktop()->height();
438#endif 442#endif
439 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 443 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
440 if ( true /*splitterSize.count() == 0*/ ) { 444 if ( true /*splitterSize.count() == 0*/ ) {
441 splitterSize.append( wid / 2 ); 445 splitterSize.append( wid / 2 );
442 splitterSize.append( wid / 2 ); 446 splitterSize.append( wid / 2 );
443 } 447 }
444 mMiniSplitter->setSizes( splitterSize ); 448 mMiniSplitter->setSizes( splitterSize );
445 if ( mExtensionBarSplitter ) { 449 if ( mExtensionBarSplitter ) {
446 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 450 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
447 if ( true /*splitterSize.count() == 0*/ ) { 451 if ( true /*splitterSize.count() == 0*/ ) {
448 splitterSize.append( wid / 2 ); 452 splitterSize.append( wid / 2 );
449 splitterSize.append( wid / 2 ); 453 splitterSize.append( wid / 2 );
450 } 454 }
451 mExtensionBarSplitter->setSizes( splitterSize ); 455 mExtensionBarSplitter->setSizes( splitterSize );
452 456
453 } 457 }
454 458
455 459
456} 460}
457 461
458void KABCore::saveSettings() 462void KABCore::saveSettings()
459{ 463{
460 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 464 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
461 if ( mExtensionBarSplitter ) 465 if ( mExtensionBarSplitter )
462 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 466 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
463 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 467 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
464 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 468 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
465#ifndef KAB_EMBEDDED 469#ifndef KAB_EMBEDDED
466 470
467 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 471 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
468 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 472 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
469#endif //KAB_EMBEDDED 473#endif //KAB_EMBEDDED
470 mExtensionManager->saveSettings(); 474 mExtensionManager->saveSettings();
471 mViewManager->saveSettings(); 475 mViewManager->saveSettings();
472 476
473 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 477 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
474} 478}
475 479
476KABC::AddressBook *KABCore::addressBook() const 480KABC::AddressBook *KABCore::addressBook() const
477{ 481{
478 return mAddressBook; 482 return mAddressBook;
479} 483}
480 484
481KConfig *KABCore::config() 485KConfig *KABCore::config()
482{ 486{
483#ifndef KAB_EMBEDDED 487#ifndef KAB_EMBEDDED
484 return KABPrefs::instance()->config(); 488 return KABPrefs::instance()->config();
485#else //KAB_EMBEDDED 489#else //KAB_EMBEDDED
486 return KABPrefs::instance()->getConfig(); 490 return KABPrefs::instance()->getConfig();
487#endif //KAB_EMBEDDED 491#endif //KAB_EMBEDDED
488} 492}
489 493
490KActionCollection *KABCore::actionCollection() const 494KActionCollection *KABCore::actionCollection() const
491{ 495{
492 return mGUIClient->actionCollection(); 496 return mGUIClient->actionCollection();
493} 497}
494 498
495KABC::Field *KABCore::currentSearchField() const 499KABC::Field *KABCore::currentSearchField() const
496{ 500{
497 if (mIncSearchWidget) 501 if (mIncSearchWidget)
498 return mIncSearchWidget->currentField(); 502 return mIncSearchWidget->currentField();
499 else 503 else
500 return 0; 504 return 0;
501} 505}
502 506
503QStringList KABCore::selectedUIDs() const 507QStringList KABCore::selectedUIDs() const
504{ 508{
505 return mViewManager->selectedUids(); 509 return mViewManager->selectedUids();
506} 510}
507 511
508KABC::Resource *KABCore::requestResource( QWidget *parent ) 512KABC::Resource *KABCore::requestResource( QWidget *parent )
509{ 513{
510 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 514 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
511 515
512 QPtrList<KRES::Resource> kresResources; 516 QPtrList<KRES::Resource> kresResources;
513 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 517 QPtrListIterator<KABC::Resource> resIt( kabcResources );
514 KABC::Resource *resource; 518 KABC::Resource *resource;
515 while ( ( resource = resIt.current() ) != 0 ) { 519 while ( ( resource = resIt.current() ) != 0 ) {
516 ++resIt; 520 ++resIt;
517 if ( !resource->readOnly() ) { 521 if ( !resource->readOnly() ) {
518 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 522 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
519 if ( res ) 523 if ( res )
520 kresResources.append( res ); 524 kresResources.append( res );
521 } 525 }
522 } 526 }
523 527
524 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 528 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
525 return static_cast<KABC::Resource*>( res ); 529 return static_cast<KABC::Resource*>( res );
526} 530}
527 531
528#ifndef KAB_EMBEDDED 532#ifndef KAB_EMBEDDED
529KAboutData *KABCore::createAboutData() 533KAboutData *KABCore::createAboutData()
530#else //KAB_EMBEDDED 534#else //KAB_EMBEDDED
531void KABCore::createAboutData() 535void KABCore::createAboutData()
532#endif //KAB_EMBEDDED 536#endif //KAB_EMBEDDED
533{ 537{
534#ifndef KAB_EMBEDDED 538#ifndef KAB_EMBEDDED
535 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 539 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
536 "3.1", I18N_NOOP( "The KDE Address Book" ), 540 "3.1", I18N_NOOP( "The KDE Address Book" ),
537 KAboutData::License_GPL_V2, 541 KAboutData::License_GPL_V2,
538 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 542 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
539 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 543 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
540 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 544 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
541 about->addAuthor( "Cornelius Schumacher", 545 about->addAuthor( "Cornelius Schumacher",
542 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 546 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
543 "schumacher@kde.org" ); 547 "schumacher@kde.org" );
544 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 548 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
545 "mpilone@slac.com" ); 549 "mpilone@slac.com" );
546 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 550 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
547 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 551 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
548 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 552 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
549 "michel@klaralvdalens-datakonsult.se" ); 553 "michel@klaralvdalens-datakonsult.se" );
550 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 554 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
551 "hansen@kde.org" ); 555 "hansen@kde.org" );
552 556
553 return about; 557 return about;
554#endif //KAB_EMBEDDED 558#endif //KAB_EMBEDDED
555 559
556 QString version; 560 QString version;
557#include <../version> 561#include <../version>
558 QMessageBox::about( this, "About KAddressbook/Pi", 562 QMessageBox::about( this, "About KAddressbook/Pi",
559 "KAddressbook/Platform-independent\n" 563 "KAddressbook/Platform-independent\n"
560 "(KA/Pi) " +version + " - " + 564 "(KA/Pi) " +version + " - " +
561#ifdef DESKTOP_VERSION 565#ifdef DESKTOP_VERSION
562 "Desktop Edition\n" 566 "Desktop Edition\n"
563#else 567#else
564 "PDA-Edition\n" 568 "PDA-Edition\n"
565 "for: Zaurus 5500 / 7x0 / 8x0\n" 569 "for: Zaurus 5500 / 7x0 / 8x0\n"
566#endif 570#endif
567 571
568 "(c) 2004 Ulf Schenk\n" 572 "(c) 2004 Ulf Schenk\n"
569 "(c) 2004 Lutz Rogowski\n" 573 "(c) 2004 Lutz Rogowski\n"
570 "(c) 1997-2003, The KDE PIM Team\n" 574 "(c) 1997-2003, The KDE PIM Team\n"
571 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 575 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
572 "Don Sanders Original author\n" 576 "Don Sanders Original author\n"
diff --git a/kaddressbook/kaimportoldialog.cpp b/kaddressbook/kaimportoldialog.cpp
index 10e3c76..848d8af 100644
--- a/kaddressbook/kaimportoldialog.cpp
+++ b/kaddressbook/kaimportoldialog.cpp
@@ -1,695 +1,733 @@
1/* 1/*
2 This file is part of KAddressbook/Pi. 2 This file is part of KAddressbook/Pi.
3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> 3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qprogressbar.h> 28#include <qprogressbar.h>
29#include <qwidgetstack.h> 29#include <qwidgetstack.h>
30#include <qdatetime.h> 30#include <qdatetime.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qregexp.h>
32#include <qapplication.h> 33#include <qapplication.h>
33#include <qhbox.h> 34#include <qhbox.h>
34#include <qheader.h> 35#include <qheader.h>
35#include <qdatetime.h> 36#include <qdatetime.h>
36#include <qlistview.h> 37#include <qlistview.h>
37 38
38#include <kdebug.h> 39#include <kdebug.h>
39#include <klocale.h> 40#include <klocale.h>
40#include <kstandarddirs.h> 41#include <kstandarddirs.h>
41#include <kmessagebox.h> 42#include <kmessagebox.h>
42#include <kfiledialog.h> 43#include <kfiledialog.h>
43 44
44#include <libkdepim/categoryselectdialog.h> 45#include <libkdepim/categoryselectdialog.h>
45#include <libkdepim/kinputdialog.h> 46#include <libkdepim/kinputdialog.h>
46 47
47#include <libkcal/calendarlocal.h> 48#include <libkcal/calendarlocal.h>
48#include <libkcal/icalformat.h> 49#include <libkcal/icalformat.h>
49 50
50#include <kabc/addresseelist.h> 51#include <kabc/addresseelist.h>
51#include <kabc/phonenumber.h> 52#include <kabc/phonenumber.h>
52 53
53#include "kaimportoldialog.h" 54#include "kaimportoldialog.h"
54 55
55#include "../outport/msoutl9.h" 56#include "../outport/msoutl9.h"
56#include <ole2.h> 57#include <ole2.h>
57#include <comutil.h> 58#include <comutil.h>
58_Application gOlAppAB; 59_Application gOlAppAB;
59 60
60QDateTime mDdate2Qdtr( DATE dt) 61QDateTime mDdate2Qdtr( DATE dt)
61{ 62{
62 COleDateTime odt; 63 COleDateTime odt;
63 SYSTEMTIME st; 64 SYSTEMTIME st;
64 odt = dt; 65 odt = dt;
65 if ( odt.GetStatus() != 0 ) 66 if ( odt.GetStatus() != 0 )
66 return QDateTime(); 67 return QDateTime();
67 odt.GetAsSystemTime(st); 68 odt.GetAsSystemTime(st);
68 if ( st.wYear > 4000 ) // this program as a year 4000 bug! 69 if ( st.wYear > 4000 ) // this program as a year 4000 bug!
69 return QDateTime(); 70 return QDateTime();
70 // it seems so, that 1.1.4501 indicates: DATE invalid 71 // it seems so, that 1.1.4501 indicates: DATE invalid
71 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); 72 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) );
72 return qdt; 73 return qdt;
73} 74}
74 75
75class OLEListViewItem : public QCheckListItem 76class OLEListViewItem : public QCheckListItem
76{ 77{
77 public: 78 public:
78 OLEListViewItem( QListView *parent, QString text ) : 79 OLEListViewItem( QListView *parent, QString text ) :
79 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; }; 80 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; };
80 OLEListViewItem( QListViewItem *after, QString text ) : 81 OLEListViewItem( QListViewItem *after, QString text ) :
81 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; }; 82 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; };
82 ~OLEListViewItem() {}; 83 ~OLEListViewItem() {};
83 void setData( DWORD data ) {mData= data; }; 84 void setData( DWORD data ) {mData= data; };
84 DWORD data() { return mData ;}; 85 DWORD data() { return mData ;};
85 private: 86 private:
86 DWORD mData; 87 DWORD mData;
87}; 88};
88 89
89KAImportOLdialog::KAImportOLdialog( const QString &caption, 90KAImportOLdialog::KAImportOLdialog( const QString &caption,
90 KABC::AddressBook * aBook, QWidget *parent ) : 91 KABC::AddressBook * aBook, QWidget *parent ) :
91 KDialogBase( Plain, caption, User1 | Close, Ok, 92 KDialogBase( Plain, caption, User1 | Close, Ok,
92 parent, caption, true, false, i18n("Import!") ) 93 parent, caption, true, false, i18n("Import!") )
93{ 94{
94 QHBox * mw = new QHBox( this ); 95 QHBox * mw = new QHBox( this );
95 setMainWidget( mw ); 96 setMainWidget( mw );
96 mListView = new QListView( mw ); 97 mListView = new QListView( mw );
97 mListView->addColumn(i18n("Select Folder to import")); 98 mListView->addColumn(i18n("Select Folder to import"));
98 mListView->addColumn(i18n("Content Type")); 99 mListView->addColumn(i18n("Content Type"));
99 mABook = aBook; 100 mABook = aBook;
100 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); 101 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply()));
101 setupFolderView(); 102 setupFolderView();
102 resize( sizeHint().width()+50, sizeHint().height()+50 ); 103 resize( sizeHint().width()+50, sizeHint().height()+50 );
103} 104}
104 105
105KAImportOLdialog::~KAImportOLdialog() 106KAImportOLdialog::~KAImportOLdialog()
106{ 107{
107 108
108} 109}
109 110
110KABC::Addressee::List KAImportOLdialog::getAddressList() 111KABC::Addressee::List KAImportOLdialog::getAddressList()
111{ 112{
112 return mAList; 113 return mAList;
113} 114}
114void KAImportOLdialog::setupFolderView() 115void KAImportOLdialog::setupFolderView()
115{ 116{
116 SCODE sc = ::OleInitialize(NULL); 117 SCODE sc = ::OleInitialize(NULL);
117 if ( FAILED ( sc ) ) { 118 if ( FAILED ( sc ) ) {
118 KMessageBox::information(this,"OLE initialisation failed"); 119 KMessageBox::information(this,"OLE initialisation failed");
119 return; 120 return;
120 } 121 }
121 122
122 if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){ 123 if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){
123 KMessageBox::information(this,"Sorry, cannot access Outlook"); 124 KMessageBox::information(this,"Sorry, cannot access Outlook");
124 return ; 125 return ;
125 } 126 }
126 MAPIFolder mfInbox; 127 MAPIFolder mfInbox;
127 MAPIFolder mfRoot; 128 MAPIFolder mfRoot;
128 CString szName; 129 CString szName;
129 _NameSpace olNS; 130 _NameSpace olNS;
130 olNS = gOlAppAB.GetNamespace(_T("MAPI")); 131 olNS = gOlAppAB.GetNamespace(_T("MAPI"));
131 mfInbox = olNS.GetDefaultFolder(6); 132 mfInbox = olNS.GetDefaultFolder(6);
132 mfRoot = mfInbox.GetParent(); 133 mfRoot = mfInbox.GetParent();
133 szName = mfRoot.GetName(); 134 szName = mfRoot.GetName();
134 long iType = mfRoot.GetDefaultItemType(); 135 long iType = mfRoot.GetDefaultItemType();
135 QString mes; 136 QString mes;
136 mes = QString::fromUcs2( szName.GetBuffer() ); 137 mes = QString::fromUcs2( szName.GetBuffer() );
137 OLEListViewItem * root = new OLEListViewItem( mListView, mes ); 138 OLEListViewItem * root = new OLEListViewItem( mListView, mes );
138 mfRoot.m_lpDispatch->AddRef(); 139 mfRoot.m_lpDispatch->AddRef();
139 addFolder( root, mfRoot.m_lpDispatch ); 140 addFolder( root, mfRoot.m_lpDispatch );
140 root->setOpen( true ); 141 root->setOpen( true );
141 mListView->setSortColumn( 0 ); 142 mListView->setSortColumn( 0 );
142 mListView->sort( ); 143 mListView->sort( );
143} 144}
144 145
145 146
146void KAImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent) 147void KAImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent)
147{ 148{
148 MAPIFolder mfParent(dispParent), mfChild; 149 MAPIFolder mfParent(dispParent), mfChild;
149 _Folders folders; 150 _Folders folders;
150 _variant_t fndx((long)0); 151 _variant_t fndx((long)0);
151 CString szName; 152 CString szName;
152 long iType; 153 long iType;
153 OLEListViewItem* hChild; 154 OLEListViewItem* hChild;
154 155
155 folders = mfParent.GetFolders(); 156 folders = mfParent.GetFolders();
156 for(int i=1; i <= folders.GetCount(); ++i) 157 for(int i=1; i <= folders.GetCount(); ++i)
157 { 158 {
158 fndx = (long)i; 159 fndx = (long)i;
159 mfChild = folders.Item(fndx.Detach()); 160 mfChild = folders.Item(fndx.Detach());
160 mfChild.m_lpDispatch->AddRef(); 161 mfChild.m_lpDispatch->AddRef();
161 szName = mfChild.GetName(); 162 szName = mfChild.GetName();
162 iType = mfChild.GetDefaultItemType(); 163 iType = mfChild.GetDefaultItemType();
163 hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) ); 164 hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) );
164 if ( iType != 2) 165 if ( iType != 2)
165 hChild->setEnabled( false ); 166 hChild->setEnabled( false );
166 QString ts; 167 QString ts;
167 switch( iType ) { 168 switch( iType ) {
168 case 0: 169 case 0:
169 ts = i18n("Mail"); 170 ts = i18n("Mail");
170 break; 171 break;
171 case 1: 172 case 1:
172 ts = i18n("Calendar"); 173 ts = i18n("Calendar");
173 break; 174 break;
174 case 2: 175 case 2:
175 ts = i18n("Contacts"); 176 ts = i18n("Contacts");
176 break; 177 break;
177 case 3: 178 case 3:
178 ts = i18n("Todos"); 179 ts = i18n("Todos");
179 break; 180 break;
180 case 4: 181 case 4:
181 ts = i18n("Journals"); 182 ts = i18n("Journals");
182 break; 183 break;
183 case 5: 184 case 5:
184 ts = i18n("Notes"); 185 ts = i18n("Notes");
185 break; 186 break;
186 default: 187 default:
187 ts = i18n("Unknown"); 188 ts = i18n("Unknown");
188 } 189 }
189 hChild->setText( 1,ts); 190 hChild->setText( 1,ts);
190 hChild->setData( (DWORD) mfChild.m_lpDispatch ); 191 hChild->setData( (DWORD) mfChild.m_lpDispatch );
191 mfChild.m_lpDispatch->AddRef(); 192 mfChild.m_lpDispatch->AddRef();
192 addFolder(hChild, mfChild.m_lpDispatch); 193 addFolder(hChild, mfChild.m_lpDispatch);
193 } 194 }
194} 195}
195 196
196void KAImportOLdialog::slotApply() 197void KAImportOLdialog::slotApply()
197{ 198{
198 importedItems = 0; 199 importedItems = 0;
199 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); 200 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild();
200 while ( child ) { 201 while ( child ) {
201 if ( child->isOn() ) 202 if ( child->isOn() )
202 readContactData( child->data() ); 203 readContactData( child->data() );
203 child = (OLEListViewItem*) child->itemBelow(); 204 child = (OLEListViewItem*) child->itemBelow();
204 } 205 }
205 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); 206 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems);
206 KMessageBox::information(this,mes); 207 KMessageBox::information(this,mes);
207} 208}
208void KAImportOLdialog::readContactData( DWORD folder ) 209void KAImportOLdialog::readContactData( DWORD folder )
209{ 210{
210 211
211 LPDISPATCH dispItem = (LPDISPATCH)folder; 212 LPDISPATCH dispItem = (LPDISPATCH)folder;
212 dispItem->AddRef(); 213 dispItem->AddRef();
213 MAPIFolder mf(dispItem); 214 MAPIFolder mf(dispItem);
214 mf.m_lpDispatch->AddRef(); 215 mf.m_lpDispatch->AddRef();
215 _Items folderItems; 216 _Items folderItems;
216 _variant_t indx((long)0); 217 _variant_t indx((long)0);
217 LPDISPATCH itm; 218 LPDISPATCH itm;
218 int i; 219 int i;
219 folderItems = mf.GetItems(); 220 folderItems = mf.GetItems();
220 QProgressBar bar( folderItems.GetCount(),0 ); 221 QProgressBar bar( folderItems.GetCount(),0 );
221 bar.setCaption (i18n("Importing - close to abort!") ); 222 bar.setCaption (i18n("Importing - close to abort!") );
222 int h = bar.sizeHint().height() ; 223 int h = bar.sizeHint().height() ;
223 int w = 300; 224 int w = 300;
224 int dw = QApplication::desktop()->width(); 225 int dw = QApplication::desktop()->width();
225 int dh = QApplication::desktop()->height(); 226 int dh = QApplication::desktop()->height();
226 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 227 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
227 bar.show(); 228 bar.show();
228 for(i=1; i <= folderItems.GetCount(); ++i) 229 for(i=1; i <= folderItems.GetCount(); ++i)
229 { 230 {
230 qApp->processEvents(); 231 qApp->processEvents();
231 if ( ! bar.isVisible() ) 232 if ( ! bar.isVisible() )
232 return ; 233 return ;
233 bar.setProgress( i ); 234 bar.setProgress( i );
234 indx = (long)i; 235 indx = (long)i;
235 itm = folderItems.Item(indx.Detach()); 236 itm = folderItems.Item(indx.Detach());
236 _ContactItem * pItem = (_ContactItem *)&itm; 237 _ContactItem * pItem = (_ContactItem *)&itm;
237 ol2kapiContact( pItem ); 238 ol2kapiContact( pItem );
238 itm->Release(); 239 itm->Release();
239 } 240 }
240} 241}
241void KAImportOLdialog::slotOk() 242void KAImportOLdialog::slotOk()
242{ 243{
243 QDialog::accept(); 244 QDialog::accept();
244} 245}
245 246
246void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem ) 247void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem )
247{ 248{
248 KABC::Addressee addressee; 249 KABC::Addressee addressee;
249 250
250 addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer())); 251 addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer()));
251 //GetLastModificationTime() 252 //GetLastModificationTime()
252 //addressee.setName( const QString &name ); 253 //addressee.setName( const QString &name );
253 //addressee.setFormattedName( const QString &formattedName ); 254 //addressee.setFormattedName( const QString &formattedName );
254 addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) ); 255 addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) );
255 addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) ); 256 addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) );
256 addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) ); 257 addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) );
257 addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) ); 258 addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) );
258 addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) ); 259 addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) );
259 addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) ); 260 addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) );
260 QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday()); 261 QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday());
261 if ( dtb.isValid() ) 262 if ( dtb.isValid() )
262 addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday())); 263 addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday()));
263 264
264 //QString::fromUcs2(aItem->.GetBuffer()) 265 //QString::fromUcs2(aItem->.GetBuffer())
265 //addressee.setMailer( const QString &mailer ); 266 //addressee.setMailer( const QString &mailer );
266 //addressee.setTimeZone( const TimeZone &timeZone ); 267 //addressee.setTimeZone( const TimeZone &timeZone );
267 //addressee.setGeo( const Geo &geo ); 268 //addressee.setGeo( const Geo &geo );
268 //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix 269 //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix
269 addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) ); 270 addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );
270 addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()) ); 271 addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()).replace( QRegExp("\\r"), "") );
271 QString notesStr = QString::fromUcs2(aItem->GetBody().GetBuffer()); 272 QString notesStr = QString::fromUcs2(aItem->GetBody().GetBuffer());
273 notesStr.replace( QRegExp("\\r"), "");
272 274
273 addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) ); 275 addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) );
274 //addressee.setRevision( const QDateTime &revision ); 276 //addressee.setRevision( const QDateTime &revision );
275 // addressee.setSortString( const QString &sortString ); 277 // addressee.setSortString( const QString &sortString );
276 addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) ); 278 addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) );
277 279
278 QString tempS; 280 QString tempS;
279 tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer())+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer()); 281 tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer())+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer());
280 if ( tempS.length() > 12 ) 282 if ( tempS.length() > 12 )
281 addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS ); 283 addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS );
282 tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer()); 284 tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer());
283 if ( !tempS.isEmpty() ) 285 if ( !tempS.isEmpty() )
284 addressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", tempS ); 286 addressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", tempS );
285 tempS = QString::fromUcs2(aItem->GetManagerName().GetBuffer()); 287 tempS = QString::fromUcs2(aItem->GetManagerName().GetBuffer());
286 if ( !tempS.isEmpty() ) 288 if ( !tempS.isEmpty() )
287 addressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", tempS ); 289 addressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", tempS );
288 tempS = QString::fromUcs2(aItem->GetAssistantName().GetBuffer()); 290 tempS = QString::fromUcs2(aItem->GetAssistantName().GetBuffer());
289 if ( !tempS.isEmpty() ) 291 if ( !tempS.isEmpty() )
290 addressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", tempS ); 292 addressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", tempS );
291 tempS = QString::fromUcs2(aItem->GetDepartment().GetBuffer()); 293 tempS = QString::fromUcs2(aItem->GetDepartment().GetBuffer());
292 if ( !tempS.isEmpty() ) 294 if ( !tempS.isEmpty() )
293 addressee.insertCustom( "KADDRESSBOOK", "X-Department", tempS ); 295 addressee.insertCustom( "KADDRESSBOOK", "X-Department", tempS );
294 tempS = QString::fromUcs2(aItem->GetOfficeLocation().GetBuffer()); 296 tempS = QString::fromUcs2(aItem->GetOfficeLocation().GetBuffer()).replace( QRegExp("\\r"), "");
295 if ( !tempS.isEmpty() ) 297 if ( !tempS.isEmpty() )
296 addressee.insertCustom( "KADDRESSBOOK", "X-Office",tempS ); 298 addressee.insertCustom( "KADDRESSBOOK", "X-Office",tempS );
297 tempS = QString::fromUcs2(aItem->GetProfession().GetBuffer()); 299 tempS = QString::fromUcs2(aItem->GetProfession().GetBuffer());
298 if ( !tempS.isEmpty() ) 300 if ( !tempS.isEmpty() )
299 addressee.insertCustom( "KADDRESSBOOK", "X-Profession", tempS ); 301 addressee.insertCustom( "KADDRESSBOOK", "X-Profession", tempS );
300 dtb = mDdate2Qdtr(aItem->GetAnniversary()); 302 dtb = mDdate2Qdtr(aItem->GetAnniversary());
301 if (dtb.isValid() ) { 303 if (dtb.isValid() ) {
302 QString dt = KGlobal::locale()->formatDate( dtb.date() , true, KLocale::ISODate); 304 QString dt = KGlobal::locale()->formatDate( dtb.date() , true, KLocale::ISODate);
303 addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 305 addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
304 } 306 }
305 int sec = aItem->GetSensitivity() ; 307 int sec = aItem->GetSensitivity() ;
306 if ( sec > 1 )// mapping pers -> private 308 if ( sec > 1 )// mapping pers -> private
307 --sec; 309 --sec;
308 addressee.setSecrecy( sec ); 310 addressee.setSecrecy( sec );
309 //addressee.setLogo( const Picture &logo ); 311 //addressee.setLogo( const Picture &logo );
310 //addressee.setPhoto( const Picture &photo ); 312 //addressee.setPhoto( const Picture &photo );
311 //addressee.setSound( const Sound &sound ); 313 //addressee.setSound( const Sound &sound );
312 //addressee.setAgent( const Agent &agent ); 314 //addressee.setAgent( const Agent &agent );
313 QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()); 315 QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()).replace( QRegExp("\\r"), "");
314 addressee.setCategories( QStringList::split( ";", cat )); 316 addressee.setCategories( QStringList::split( ";", cat ));
315 317
316 QString phoneS; 318 QString phoneS;
317 319
318 phoneS = QString::fromUcs2( aItem->GetAssistantTelephoneNumber().GetBuffer()); 320 phoneS = QString::fromUcs2( aItem->GetAssistantTelephoneNumber().GetBuffer());
319 if ( ! phoneS.isEmpty()) 321 if ( ! phoneS.isEmpty())
320 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Voice ) ); 322 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Voice ) );
321 phoneS = QString::fromUcs2( aItem->GetBusinessTelephoneNumber().GetBuffer()); 323 phoneS = QString::fromUcs2( aItem->GetBusinessTelephoneNumber().GetBuffer());
322 if ( ! phoneS.isEmpty()) 324 if ( ! phoneS.isEmpty())
323 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) ); 325 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) );
324 phoneS = QString::fromUcs2( aItem->GetBusiness2TelephoneNumber().GetBuffer()); 326 phoneS = QString::fromUcs2( aItem->GetBusiness2TelephoneNumber().GetBuffer());
325 if ( ! phoneS.isEmpty()) 327 if ( ! phoneS.isEmpty())
326 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) ); 328 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) );
327 phoneS = QString::fromUcs2( aItem->GetBusinessFaxNumber().GetBuffer()); 329 phoneS = QString::fromUcs2( aItem->GetBusinessFaxNumber().GetBuffer());
328 if ( ! phoneS.isEmpty()) 330 if ( ! phoneS.isEmpty())
329 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Fax ) ); 331 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Fax ) );
330 phoneS = QString::fromUcs2( aItem->GetCarTelephoneNumber().GetBuffer()); 332 phoneS = QString::fromUcs2( aItem->GetCarTelephoneNumber().GetBuffer());
331 if ( ! phoneS.isEmpty()) 333 if ( ! phoneS.isEmpty())
332 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Car ) ); 334 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Car ) );
333 phoneS = QString::fromUcs2( aItem->GetHomeTelephoneNumber().GetBuffer()); 335 phoneS = QString::fromUcs2( aItem->GetHomeTelephoneNumber().GetBuffer());
334 if ( ! phoneS.isEmpty()) 336 if ( ! phoneS.isEmpty())
335 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) ); 337 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) );
336 phoneS = QString::fromUcs2( aItem->GetHome2TelephoneNumber().GetBuffer()); 338 phoneS = QString::fromUcs2( aItem->GetHome2TelephoneNumber().GetBuffer());
337 if ( ! phoneS.isEmpty()) 339 if ( ! phoneS.isEmpty())
338 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) ); 340 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) );
339 phoneS = QString::fromUcs2( aItem->GetHomeFaxNumber().GetBuffer()); 341 phoneS = QString::fromUcs2( aItem->GetHomeFaxNumber().GetBuffer());
340 if ( ! phoneS.isEmpty()) 342 if ( ! phoneS.isEmpty())
341 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home + KABC::PhoneNumber::Fax ) ); 343 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home + KABC::PhoneNumber::Fax ) );
342 phoneS = QString::fromUcs2( aItem->GetISDNNumber().GetBuffer()); 344 phoneS = QString::fromUcs2( aItem->GetISDNNumber().GetBuffer());
343 if ( ! phoneS.isEmpty()) 345 if ( ! phoneS.isEmpty())
344 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Isdn ) ); 346 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Isdn ) );
345 phoneS = QString::fromUcs2( aItem->GetMobileTelephoneNumber().GetBuffer()); 347 phoneS = QString::fromUcs2( aItem->GetMobileTelephoneNumber().GetBuffer());
346 if ( ! phoneS.isEmpty()) 348 if ( ! phoneS.isEmpty())
347 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Cell ) ); 349 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Cell ) );
348 phoneS = QString::fromUcs2( aItem->GetOtherFaxNumber().GetBuffer()); 350 phoneS = QString::fromUcs2( aItem->GetOtherFaxNumber().GetBuffer());
349 if ( ! phoneS.isEmpty()) 351 if ( ! phoneS.isEmpty())
350 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax ) ); 352 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax ) );
351 phoneS = QString::fromUcs2( aItem->GetOtherTelephoneNumber().GetBuffer()); 353 phoneS = QString::fromUcs2( aItem->GetOtherTelephoneNumber().GetBuffer());
352 if ( ! phoneS.isEmpty()) 354 if ( ! phoneS.isEmpty())
353 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice ) ); 355 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice ) );
354 phoneS = QString::fromUcs2( aItem->GetPagerNumber().GetBuffer()); 356 phoneS = QString::fromUcs2( aItem->GetPagerNumber().GetBuffer());
355 if ( ! phoneS.isEmpty()) 357 if ( ! phoneS.isEmpty())
356 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pager ) ); 358 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pager ) );
357 phoneS = QString::fromUcs2( aItem->GetPrimaryTelephoneNumber().GetBuffer()); 359 phoneS = QString::fromUcs2( aItem->GetPrimaryTelephoneNumber().GetBuffer());
358 if ( ! phoneS.isEmpty()) 360 if ( ! phoneS.isEmpty())
359 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pref ) ); 361 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pref ) );
360 phoneS = QString::fromUcs2( aItem->GetTTYTDDTelephoneNumber().GetBuffer()); 362 phoneS = QString::fromUcs2( aItem->GetTTYTDDTelephoneNumber().GetBuffer());
361 if ( ! phoneS.isEmpty()) 363 if ( ! phoneS.isEmpty())
362 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Modem ) ); 364 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Modem ) );
363 phoneS = QString::fromUcs2( aItem->GetTelexNumber().GetBuffer()); 365 phoneS = QString::fromUcs2( aItem->GetTelexNumber().GetBuffer());
364 if ( ! phoneS.isEmpty()) 366 if ( ! phoneS.isEmpty())
365 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax + KABC::PhoneNumber::Bbs ) ); 367 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax + KABC::PhoneNumber::Bbs ) );
366 phoneS = QString::fromUcs2( aItem->GetCompanyMainTelephoneNumber().GetBuffer()); 368 phoneS = QString::fromUcs2( aItem->GetCompanyMainTelephoneNumber().GetBuffer());
367 if ( ! phoneS.isEmpty()) 369 if ( ! phoneS.isEmpty())
368 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Pref ) ); 370 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Pref ) );
369 phoneS = QString::fromUcs2( aItem->GetRadioTelephoneNumber().GetBuffer()); 371 phoneS = QString::fromUcs2( aItem->GetRadioTelephoneNumber().GetBuffer());
370 if ( ! phoneS.isEmpty()) 372 if ( ! phoneS.isEmpty())
371 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Video ) ); 373 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Video ) );
372 phoneS = QString::fromUcs2( aItem->GetCallbackTelephoneNumber().GetBuffer()); 374 phoneS = QString::fromUcs2( aItem->GetCallbackTelephoneNumber().GetBuffer());
373 if ( ! phoneS.isEmpty()) 375 if ( ! phoneS.isEmpty())
374 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice + KABC::PhoneNumber::Pref ) ); 376 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice + KABC::PhoneNumber::Pref ) );
375 377
376 bool preferred = true; 378 bool preferred = true;
377 phoneS = QString::fromUcs2( aItem->GetEmail1Address().GetBuffer()); 379 phoneS = QString::fromUcs2( aItem->GetEmail1Address().GetBuffer());
378 if ( ! phoneS.isEmpty()) { 380 if ( ! phoneS.isEmpty()) {
379 addressee.insertEmail(phoneS , preferred ); 381 addressee.insertEmail(phoneS , preferred );
380 preferred = false; 382 preferred = false;
381 } 383 }
382 phoneS = QString::fromUcs2( aItem->GetEmail2Address().GetBuffer()); 384 phoneS = QString::fromUcs2( aItem->GetEmail2Address().GetBuffer());
383 if ( ! phoneS.isEmpty()) { 385 if ( ! phoneS.isEmpty()) {
384 addressee.insertEmail(phoneS , preferred ); 386 addressee.insertEmail(phoneS , preferred );
385 preferred = false; 387 preferred = false;
386 } 388 }
387 phoneS = QString::fromUcs2( aItem->GetEmail3Address().GetBuffer()); 389 phoneS = QString::fromUcs2( aItem->GetEmail3Address().GetBuffer());
388 if ( ! phoneS.isEmpty()) { 390 if ( ! phoneS.isEmpty()) {
389 addressee.insertEmail(phoneS , preferred ); 391 addressee.insertEmail(phoneS , preferred );
390 preferred = false; 392 preferred = false;
391 } 393 }
392 // is this the number of the preferred email? 394 // is this the number of the preferred email?
393 //long GetSelectedMailingAddress();??? 395 //long GetSelectedMailingAddress();???
394 396
395 KABC::Address addressHome; 397 KABC::Address addressHome;
396 KABC::Address* addressAdd = &addressHome; 398 KABC::Address* addressAdd = &addressHome;
397 bool insert = false; 399 bool insert = false;
398 phoneS = QString::fromUcs2( aItem->GetHomeAddressCountry().GetBuffer()); 400 phoneS = QString::fromUcs2( aItem->GetHomeAddressCountry().GetBuffer());
401 phoneS.replace( QRegExp("\\r"), "");
399 if ( ! phoneS.isEmpty()) { 402 if ( ! phoneS.isEmpty()) {
400 addressAdd->setCountry(phoneS ); 403 addressAdd->setCountry(phoneS );
401 insert = true; 404 insert = true;
402 } 405 }
403 phoneS = QString::fromUcs2( aItem->GetHomeAddressState().GetBuffer()); 406 phoneS = QString::fromUcs2( aItem->GetHomeAddressState().GetBuffer());
407 phoneS.replace( QRegExp("\\r"), "");
404 if ( ! phoneS.isEmpty()) { 408 if ( ! phoneS.isEmpty()) {
405 addressAdd->setRegion(phoneS ); 409 addressAdd->setRegion(phoneS );
406 insert = true; 410 insert = true;
407 } 411 }
408 phoneS = QString::fromUcs2( aItem->GetHomeAddressCity().GetBuffer()); 412 phoneS = QString::fromUcs2( aItem->GetHomeAddressCity().GetBuffer());
413 phoneS.replace( QRegExp("\\r"), "");
409 if ( ! phoneS.isEmpty()) { 414 if ( ! phoneS.isEmpty()) {
410 addressAdd->setLocality(phoneS ); 415 addressAdd->setLocality(phoneS );
411 insert = true; 416 insert = true;
412 } 417 }
413 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostalCode().GetBuffer()); 418 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostalCode().GetBuffer());
419 phoneS.replace( QRegExp("\\r"), "");
414 if ( ! phoneS.isEmpty()) { 420 if ( ! phoneS.isEmpty()) {
415 addressAdd->setPostalCode(phoneS ); 421 addressAdd->setPostalCode(phoneS );
416 insert = true; 422 insert = true;
417 } 423 }
418 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostOfficeBox().GetBuffer()); 424 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostOfficeBox().GetBuffer());
425 phoneS.replace( QRegExp("\\r"), "");
419 if ( ! phoneS.isEmpty()) { 426 if ( ! phoneS.isEmpty()) {
420 addressAdd->setPostOfficeBox(phoneS ); 427 addressAdd->setPostOfficeBox(phoneS );
421 insert = true; 428 insert = true;
422 } 429 }
423 phoneS = QString::fromUcs2( aItem->GetHomeAddressStreet().GetBuffer()); 430 phoneS = QString::fromUcs2( aItem->GetHomeAddressStreet().GetBuffer());
431 phoneS.replace( QRegExp("\\r"), "");
424 if ( ! phoneS.isEmpty()) { 432 if ( ! phoneS.isEmpty()) {
425 addressAdd->setStreet(phoneS ); 433 addressAdd->setStreet(phoneS );
426 insert = true; 434 insert = true;
427 } 435 }
428 phoneS = QString::fromUcs2( aItem->GetHomeAddress().GetBuffer()); 436 phoneS = QString::fromUcs2( aItem->GetHomeAddress().GetBuffer());
437 phoneS.replace( QRegExp("\\r"), "");
429 if ( ! phoneS.isEmpty()) { 438 if ( ! phoneS.isEmpty()) {
430 // redundant !addressAdd->setExtended(phoneS ); 439 // redundant !addressAdd->setExtended(phoneS );
431 // insert = true; 440 // insert = true;
432 } 441 }
433 addressAdd->setType( KABC::Address::Home ); 442 addressAdd->setType( KABC::Address::Home );
434 if ( insert ) 443 if ( insert )
435 addressee.insertAddress( *addressAdd ); 444 addressee.insertAddress( *addressAdd );
436 // ++++++++++++++++++++++ end of address 445 // ++++++++++++++++++++++ end of address
437 446
438 KABC::Address addressWork; 447 KABC::Address addressWork;
439 addressAdd = &addressWork; 448 addressAdd = &addressWork;
440 insert = false; 449 insert = false;
441 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCountry().GetBuffer()); 450 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCountry().GetBuffer());
451 phoneS.replace( QRegExp("\\r"), "");
442 if ( ! phoneS.isEmpty()) { 452 if ( ! phoneS.isEmpty()) {
443 addressAdd->setCountry(phoneS ); 453 addressAdd->setCountry(phoneS );
444 insert = true; 454 insert = true;
445 } 455 }
446 phoneS = QString::fromUcs2( aItem->GetBusinessAddressState().GetBuffer()); 456 phoneS = QString::fromUcs2( aItem->GetBusinessAddressState().GetBuffer());
457 phoneS.replace( QRegExp("\\r"), "");
447 if ( ! phoneS.isEmpty()) { 458 if ( ! phoneS.isEmpty()) {
448 addressAdd->setRegion(phoneS ); 459 addressAdd->setRegion(phoneS );
449 insert = true; 460 insert = true;
450 } 461 }
451 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCity().GetBuffer()); 462 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCity().GetBuffer());
463 phoneS.replace( QRegExp("\\r"), "");
452 if ( ! phoneS.isEmpty()) { 464 if ( ! phoneS.isEmpty()) {
453 addressAdd->setLocality(phoneS ); 465 addressAdd->setLocality(phoneS );
454 insert = true; 466 insert = true;
455 } 467 }
456 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostalCode().GetBuffer()); 468 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostalCode().GetBuffer());
469 phoneS.replace( QRegExp("\\r"), "");
457 if ( ! phoneS.isEmpty()) { 470 if ( ! phoneS.isEmpty()) {
458 addressAdd->setPostalCode(phoneS ); 471 addressAdd->setPostalCode(phoneS );
459 insert = true; 472 insert = true;
460 } 473 }
461 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostOfficeBox().GetBuffer()); 474 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostOfficeBox().GetBuffer());
475 phoneS.replace( QRegExp("\\r"), "");
462 if ( ! phoneS.isEmpty()) { 476 if ( ! phoneS.isEmpty()) {
463 addressAdd->setPostOfficeBox(phoneS ); 477 addressAdd->setPostOfficeBox(phoneS );
464 insert = true; 478 insert = true;
465 } 479 }
466 phoneS = QString::fromUcs2( aItem->GetBusinessAddressStreet().GetBuffer()); 480 phoneS = QString::fromUcs2( aItem->GetBusinessAddressStreet().GetBuffer());
481 phoneS.replace( QRegExp("\\r"), "");
467 if ( ! phoneS.isEmpty()) { 482 if ( ! phoneS.isEmpty()) {
468 addressAdd->setStreet(phoneS ); 483 addressAdd->setStreet(phoneS );
469 insert = true; 484 insert = true;
470 } 485 }
471 phoneS = QString::fromUcs2( aItem->GetBusinessAddress().GetBuffer()); 486 phoneS = QString::fromUcs2( aItem->GetBusinessAddress().GetBuffer());
487 phoneS.replace( QRegExp("\\r"), "");
472 if ( ! phoneS.isEmpty()) { 488 if ( ! phoneS.isEmpty()) {
473 // redundant !addressAdd->setExtended(phoneS ); 489 // redundant !addressAdd->setExtended(phoneS );
474 // insert = true; 490 // insert = true;
475 } 491 }
476 addressAdd->setType( KABC::Address::Work ); 492 addressAdd->setType( KABC::Address::Work );
477 if ( insert ) 493 if ( insert )
478 addressee.insertAddress( *addressAdd ); 494 addressee.insertAddress( *addressAdd );
479 // ++++++++++++++++++++++ end of address 495 // ++++++++++++++++++++++ end of address
480 496
481 KABC::Address addressOther; 497 KABC::Address addressOther;
482 addressAdd = &addressOther; 498 addressAdd = &addressOther;
483 insert = false; 499 insert = false;
484 phoneS = QString::fromUcs2( aItem->GetOtherAddressCountry().GetBuffer()); 500 phoneS = QString::fromUcs2( aItem->GetOtherAddressCountry().GetBuffer());
501 phoneS.replace( QRegExp("\\r"), "");
485 if ( ! phoneS.isEmpty()) { 502 if ( ! phoneS.isEmpty()) {
486 addressAdd->setCountry(phoneS ); 503 addressAdd->setCountry(phoneS );
487 insert = true; 504 insert = true;
488 } 505 }
489 phoneS = QString::fromUcs2( aItem->GetOtherAddressState().GetBuffer()); 506 phoneS = QString::fromUcs2( aItem->GetOtherAddressState().GetBuffer());
507 phoneS.replace( QRegExp("\\r"), "");
490 if ( ! phoneS.isEmpty()) { 508 if ( ! phoneS.isEmpty()) {
491 addressAdd->setRegion(phoneS ); 509 addressAdd->setRegion(phoneS );
492 insert = true; 510 insert = true;
493 } 511 }
494 phoneS = QString::fromUcs2( aItem->GetOtherAddressCity().GetBuffer()); 512 phoneS = QString::fromUcs2( aItem->GetOtherAddressCity().GetBuffer());
513 phoneS.replace( QRegExp("\\r"), "");
495 if ( ! phoneS.isEmpty()) { 514 if ( ! phoneS.isEmpty()) {
496 addressAdd->setLocality(phoneS ); 515 addressAdd->setLocality(phoneS );
497 insert = true; 516 insert = true;
498 } 517 }
499 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostalCode().GetBuffer()); 518 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostalCode().GetBuffer());
519 phoneS.replace( QRegExp("\\r"), "");
500 if ( ! phoneS.isEmpty()) { 520 if ( ! phoneS.isEmpty()) {
501 addressAdd->setPostalCode(phoneS ); 521 addressAdd->setPostalCode(phoneS );
502 insert = true; 522 insert = true;
503 } 523 }
504 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostOfficeBox().GetBuffer()); 524 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostOfficeBox().GetBuffer());
525 phoneS.replace( QRegExp("\\r"), "");
505 if ( ! phoneS.isEmpty()) { 526 if ( ! phoneS.isEmpty()) {
506 addressAdd->setPostOfficeBox(phoneS ); 527 addressAdd->setPostOfficeBox(phoneS );
507 insert = true; 528 insert = true;
508 } 529 }
509 phoneS = QString::fromUcs2( aItem->GetOtherAddressStreet().GetBuffer()); 530 phoneS = QString::fromUcs2( aItem->GetOtherAddressStreet().GetBuffer());
531 phoneS.replace( QRegExp("\\r"), "");
510 if ( ! phoneS.isEmpty()) { 532 if ( ! phoneS.isEmpty()) {
511 addressAdd->setStreet(phoneS ); 533 addressAdd->setStreet(phoneS );
512 insert = true; 534 insert = true;
513 } 535 }
514 phoneS = QString::fromUcs2( aItem->GetOtherAddress().GetBuffer()); 536 phoneS = QString::fromUcs2( aItem->GetOtherAddress().GetBuffer());
515 if ( ! phoneS.isEmpty()) { 537 if ( ! phoneS.isEmpty()) {
516 // redundant !addressAdd->setExtended(phoneS ); 538 // redundant !addressAdd->setExtended(phoneS );
517 //insert = true; 539 //insert = true;
518 } 540 }
519 //addressAdd->setId( ); 541 //addressAdd->setId( );
520 if ( insert ) 542 if ( insert )
521 addressee.insertAddress( *addressAdd ); 543 addressee.insertAddress( *addressAdd );
522 // ++++++++++++++++++++++ end of address 544 // ++++++++++++++++++++++ end of address
523 KABC::Address addressMail; 545 KABC::Address addressMail;
524 addressAdd = &addressMail; 546 addressAdd = &addressMail;
525 insert = false; 547 insert = false;
526 phoneS = QString::fromUcs2( aItem->GetMailingAddressCountry().GetBuffer()); 548 phoneS = QString::fromUcs2( aItem->GetMailingAddressCountry().GetBuffer());
549 phoneS.replace( QRegExp("\\r"), "");
527 if ( ! phoneS.isEmpty()) { 550 if ( ! phoneS.isEmpty()) {
528 addressAdd->setCountry(phoneS ); 551 addressAdd->setCountry(phoneS );
529 insert = true; 552 insert = true;
530 } 553 }
531 phoneS = QString::fromUcs2( aItem->GetMailingAddressState().GetBuffer()); 554 phoneS = QString::fromUcs2( aItem->GetMailingAddressState().GetBuffer());
555 phoneS.replace( QRegExp("\\r"), "");
532 if ( ! phoneS.isEmpty()) { 556 if ( ! phoneS.isEmpty()) {
533 addressAdd->setRegion(phoneS ); 557 addressAdd->setRegion(phoneS );
534 insert = true; 558 insert = true;
535 } 559 }
536 phoneS = QString::fromUcs2( aItem->GetMailingAddressCity().GetBuffer()); 560 phoneS = QString::fromUcs2( aItem->GetMailingAddressCity().GetBuffer());
561 phoneS.replace( QRegExp("\\r"), "");
537 if ( ! phoneS.isEmpty()) { 562 if ( ! phoneS.isEmpty()) {
538 addressAdd->setLocality(phoneS ); 563 addressAdd->setLocality(phoneS );
539 insert = true; 564 insert = true;
540 } 565 }
541 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostalCode().GetBuffer()); 566 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostalCode().GetBuffer());
567 phoneS.replace( QRegExp("\\r"), "");
542 if ( ! phoneS.isEmpty()) { 568 if ( ! phoneS.isEmpty()) {
543 addressAdd->setPostalCode(phoneS ); 569 addressAdd->setPostalCode(phoneS );
544 insert = true; 570 insert = true;
545 } 571 }
546 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostOfficeBox().GetBuffer()); 572 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostOfficeBox().GetBuffer());
573 phoneS.replace( QRegExp("\\r"), "");
547 if ( ! phoneS.isEmpty()) { 574 if ( ! phoneS.isEmpty()) {
548 addressAdd->setPostOfficeBox(phoneS ); 575 addressAdd->setPostOfficeBox(phoneS );
549 insert = true; 576 insert = true;
550 } 577 }
551 phoneS = QString::fromUcs2( aItem->GetMailingAddressStreet().GetBuffer()); 578 phoneS = QString::fromUcs2( aItem->GetMailingAddressStreet().GetBuffer());
579 phoneS.replace( QRegExp("\\r"), "");
552 if ( ! phoneS.isEmpty()) { 580 if ( ! phoneS.isEmpty()) {
553 addressAdd->setStreet(phoneS ); 581 addressAdd->setStreet(phoneS );
554 insert = true; 582 insert = true;
555 } 583 }
556 phoneS = QString::fromUcs2( aItem->GetMailingAddress().GetBuffer()); 584 phoneS = QString::fromUcs2( aItem->GetMailingAddress().GetBuffer());
585 phoneS.replace( QRegExp("\\r"), "");
557 if ( ! phoneS.isEmpty()) { 586 if ( ! phoneS.isEmpty()) {
558 // redundant ! addressAdd->setExtended(phoneS ); 587 // redundant ! addressAdd->setExtended(phoneS );
559 // insert = true; 588 // insert = true;
560 } 589 }
561 addressAdd->setType( KABC::Address::Postal ); 590 addressAdd->setType( KABC::Address::Postal );
562 if ( insert ) { 591 if ( insert ) {
563 addressee.insertAddress( *addressAdd ); 592 addressee.insertAddress( *addressAdd );
564 } 593 }
565 // the following code is disabled 594 // the following code is disabled
566 // it does not seem to be useful 595 // it does not seem to be useful
567#if 0 596#if 0
568 if ( insert ) { 597 if ( insert ) {
569 addressAdd->setType( KABC::Address::Home ); 598 addressAdd->setType( KABC::Address::Home );
570 if ( addressMail == addressHome ) { 599 if ( addressMail == addressHome ) {
571 addressHome.setType( KABC::Address::Postal+ KABC::Address::Home ); 600 addressHome.setType( KABC::Address::Postal+ KABC::Address::Home );
572 addressee.insertAddress( addressHome ); 601 addressee.insertAddress( addressHome );
573 } else { 602 } else {
574 addressAdd->setType( KABC::Address::Work ); 603 addressAdd->setType( KABC::Address::Work );
575 if ( addressMail == addressWork ){ 604 if ( addressMail == addressWork ){
576 addressWork.setType( KABC::Address::Postal+ KABC::Address::Work ); 605 addressWork.setType( KABC::Address::Postal+ KABC::Address::Work );
577 addressee.insertAddress( addressWork ); 606 addressee.insertAddress( addressWork );
578 607
579 } else { 608 } else {
580 addressAdd->setType( 0 ); 609 addressAdd->setType( 0 );
581 if ( addressOther == addressMail ){ 610 if ( addressOther == addressMail ){
582 addressOther.setType( KABC::Address::Postal ); 611 addressOther.setType( KABC::Address::Postal );
583 addressee.insertAddress( addressOther ); 612 addressee.insertAddress( addressOther );
584 } else { 613 } else {
585 addressee.insertAddress( *addressAdd ); 614 addressee.insertAddress( *addressAdd );
586 } 615 }
587 } 616 }
588 } 617 }
589 } 618 }
590#endif 619#endif
591 // ++++++++++++++++++++++ end of ALL addresses 620 // ++++++++++++++++++++++ end of ALL addresses
592 //GetUserProperties(); 621 //GetUserProperties();
593 tempS = QString::fromUcs2(aItem->GetInternetFreeBusyAddress().GetBuffer()); 622 tempS = QString::fromUcs2(aItem->GetInternetFreeBusyAddress().GetBuffer());
623 phoneS.replace( QRegExp("\\r"), "");
594 if ( !tempS.isEmpty() ) 624 if ( !tempS.isEmpty() )
595 addressee.insertCustom( "KADDRESSBOOK", "X-FreeBusyUrl", tempS ); 625 addressee.insertCustom( "KADDRESSBOOK", "X-FreeBusyUrl", tempS );
596 tempS = QString::fromUcs2(aItem->GetChildren().GetBuffer()); 626 tempS = QString::fromUcs2(aItem->GetChildren().GetBuffer());
597 if ( !tempS.isEmpty() ) 627 if ( !tempS.isEmpty() )
598 addressee.insertCustom( "KADDRESSBOOK", "X-Children", tempS ); 628 addressee.insertCustom( "KADDRESSBOOK", "X-Children", tempS );
599 int gen = aItem->GetGender(); 629 int gen = aItem->GetGender();
600 if ( gen != 0 ) { // 0 undef - 1 female - 2 male 630 if ( gen != 0 ) { // 0 undef - 1 female - 2 male
601 if ( gen == 1 ) 631 if ( gen == 1 )
602 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female" ); 632 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female" );
603 else 633 else
604 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male" ); 634 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male" );
605 } 635 }
606 QString additionalInfo; 636 QString additionalInfo;
607 QString tempAdd; 637 QString tempAdd;
608 tempAdd = QString::fromUcs2(aItem->GetLanguage().GetBuffer()); 638 tempAdd = QString::fromUcs2(aItem->GetLanguage().GetBuffer());
609 if ( ! tempAdd.isEmpty() ) { 639 if ( ! tempAdd.isEmpty() ) {
610 additionalInfo += i18n("\nLanguage: "); 640 additionalInfo += i18n("\nLanguage: ");
611 additionalInfo += tempAdd; 641 additionalInfo += tempAdd;
612 } 642 }
613 tempAdd = QString::fromUcs2(aItem->GetHobby().GetBuffer()); 643 tempAdd = QString::fromUcs2(aItem->GetHobby().GetBuffer());
644 phoneS.replace( QRegExp("\\r"), "");
614 if ( ! tempAdd.isEmpty() ) { 645 if ( ! tempAdd.isEmpty() ) {
615 additionalInfo += i18n("\nHobby: "); 646 additionalInfo += i18n("\nHobby: ");
616 additionalInfo += tempAdd;; 647 additionalInfo += tempAdd;;
617 } 648 }
618 tempAdd =QString::fromUcs2(aItem->GetPersonalHomePage().GetBuffer()); 649 tempAdd =QString::fromUcs2(aItem->GetPersonalHomePage().GetBuffer());
650 phoneS.replace( QRegExp("\\r"), "");
619 if ( ! tempAdd.isEmpty() ) { 651 if ( ! tempAdd.isEmpty() ) {
620 additionalInfo += i18n("\nHomepage: "); 652 additionalInfo += i18n("\nHomepage: ");
621 additionalInfo += tempAdd;; 653 additionalInfo += tempAdd;;
622 } 654 }
623 tempAdd = QString::fromUcs2(aItem->GetBillingInformation().GetBuffer()); 655 tempAdd = QString::fromUcs2(aItem->GetBillingInformation().GetBuffer());
656 phoneS.replace( QRegExp("\\r"), "");
624 if ( ! tempAdd.isEmpty() ) { 657 if ( ! tempAdd.isEmpty() ) {
625 additionalInfo += i18n("\nBilling information: "); 658 additionalInfo += i18n("\nBilling information: ");
626 additionalInfo += tempAdd;; 659 additionalInfo += tempAdd;;
627 } 660 }
628 tempAdd = QString::fromUcs2(aItem->GetCustomerID().GetBuffer()); 661 tempAdd = QString::fromUcs2(aItem->GetCustomerID().GetBuffer());
662 phoneS.replace( QRegExp("\\r"), "");
629 if ( ! tempAdd.isEmpty() ) { 663 if ( ! tempAdd.isEmpty() ) {
630 additionalInfo += i18n("\nCustomer ID: "); 664 additionalInfo += i18n("\nCustomer ID: ");
631 additionalInfo += tempAdd;; 665 additionalInfo += tempAdd;;
632 } 666 }
633 tempAdd = QString::fromUcs2(aItem->GetUser1().GetBuffer()); 667 tempAdd = QString::fromUcs2(aItem->GetUser1().GetBuffer());
668 phoneS.replace( QRegExp("\\r"), "");
634 if ( ! tempAdd.isEmpty() ) { 669 if ( ! tempAdd.isEmpty() ) {
635 additionalInfo += i18n("\nUser1: "); 670 additionalInfo += i18n("\nUser1: ");
636 additionalInfo += tempAdd;; 671 additionalInfo += tempAdd;;
637 } 672 }
638 tempAdd = QString::fromUcs2(aItem->GetUser2().GetBuffer()); 673 tempAdd = QString::fromUcs2(aItem->GetUser2().GetBuffer());
674 phoneS.replace( QRegExp("\\r"), "");
639 if ( ! tempAdd.isEmpty() ) { 675 if ( ! tempAdd.isEmpty() ) {
640 additionalInfo += i18n("\nUser2: "); 676 additionalInfo += i18n("\nUser2: ");
641 additionalInfo += tempAdd;; 677 additionalInfo += tempAdd;;
642 } 678 }
643 tempAdd = QString::fromUcs2(aItem->GetUser3().GetBuffer()); 679 tempAdd = QString::fromUcs2(aItem->GetUser3().GetBuffer());
680 phoneS.replace( QRegExp("\\r"), "");
644 if ( ! tempAdd.isEmpty() ) { 681 if ( ! tempAdd.isEmpty() ) {
645 additionalInfo += i18n("\nUser3: "); 682 additionalInfo += i18n("\nUser3: ");
646 additionalInfo += tempAdd;; 683 additionalInfo += tempAdd;;
647 } 684 }
648 tempAdd = QString::fromUcs2(aItem->GetUser4().GetBuffer()); 685 tempAdd = QString::fromUcs2(aItem->GetUser4().GetBuffer());
686 phoneS.replace( QRegExp("\\r"), "");
649 if ( ! tempAdd.isEmpty() ) { 687 if ( ! tempAdd.isEmpty() ) {
650 additionalInfo += i18n("\nUser4: "); 688 additionalInfo += i18n("\nUser4: ");
651 additionalInfo += tempAdd;; 689 additionalInfo += tempAdd;;
652 } 690 }
653 if (!additionalInfo.isEmpty() ) { 691 if (!additionalInfo.isEmpty() ) {
654 tempAdd = notesStr; 692 tempAdd = notesStr;
655 notesStr = "+++++++++++++++++++++++++++\n"; 693 notesStr = "+++++++++++++++++++++++++++\n";
656 notesStr += i18n("Additonal fields created\nby KA/Pi Outlook import:"); 694 notesStr += i18n("Additonal fields created\nby KA/Pi Outlook import:");
657 notesStr += additionalInfo; 695 notesStr += additionalInfo;
658 notesStr += i18n("\nEnd additonal fields created\nby KA/Pi Outlook import!\n"); 696 notesStr += i18n("\nEnd additonal fields created\nby KA/Pi Outlook import!\n");
659 notesStr += "+++++++++++++++++++++++++++\n"; 697 notesStr += "+++++++++++++++++++++++++++\n";
660 notesStr += tempAdd; 698 notesStr += tempAdd;
661 } 699 }
662 addressee.setNote( notesStr ); 700 addressee.setNote( notesStr );
663#if 0 701#if 0
664 // pending 702 // pending
665 - IM address: no clue where to get info about the helper ID 703 - IM address: no clue where to get info about the helper ID
666 -custom fields: difficult to implement - not implemented 704 -custom fields: difficult to implement - not implemented
667 -keys: makes no sense 705 -keys: makes no sense
668#endif 706#endif
669 707
670 if ( addAddressee( addressee )) 708 if ( addAddressee( addressee ))
671 ++importedItems; 709 ++importedItems;
672} 710}
673void KAImportOLdialog::slotCancel() 711void KAImportOLdialog::slotCancel()
674{ 712{
675 reject(); 713 reject();
676} 714}
677 715
678bool KAImportOLdialog::addAddressee( KABC::Addressee a ) 716bool KAImportOLdialog::addAddressee( KABC::Addressee a )
679{ 717{
680 bool add = true; 718 bool add = true;
681 KABC::Addressee::List::Iterator it; 719 KABC::Addressee::List::Iterator it;
682 for ( it = mAList.begin(); it != mAList.end(); ++it ) { 720 for ( it = mAList.begin(); it != mAList.end(); ++it ) {
683 if ( (*it).uid() == a.uid() ) { 721 if ( (*it).uid() == a.uid() ) {
684 add = false; 722 add = false;
685 break; 723 break;
686 } 724 }
687 } 725 }
688 if ( add ) { 726 if ( add ) {
689 if ( mABook->findByUid(a.uid() ).isEmpty()) 727 if ( mABook->findByUid(a.uid() ).isEmpty())
690 mAList.append ( a ); 728 mAList.append ( a );
691 else 729 else
692 add = false; 730 add = false;
693 } 731 }
694 return add; 732 return add;
695} 733}
diff --git a/korganizer/koimportoldialog.cpp b/korganizer/koimportoldialog.cpp
index 0a3c2d5..c0bde0d 100644
--- a/korganizer/koimportoldialog.cpp
+++ b/korganizer/koimportoldialog.cpp
@@ -1,445 +1,446 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qprogressbar.h> 28#include <qprogressbar.h>
29#include <qwidgetstack.h> 29#include <qwidgetstack.h>
30#include <qdatetime.h> 30#include <qdatetime.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qapplication.h> 32#include <qapplication.h>
33#include <qhbox.h> 33#include <qhbox.h>
34#include <qregexp.h>
34#include <qheader.h> 35#include <qheader.h>
35#include <qdatetime.h> 36#include <qdatetime.h>
36#include <qlistview.h> 37#include <qlistview.h>
37 38
38#include <kdebug.h> 39#include <kdebug.h>
39#include <klocale.h> 40#include <klocale.h>
40#include <kstandarddirs.h> 41#include <kstandarddirs.h>
41#include <kmessagebox.h> 42#include <kmessagebox.h>
42#include <kfiledialog.h> 43#include <kfiledialog.h>
43 44
44#include <libkdepim/categoryselectdialog.h> 45#include <libkdepim/categoryselectdialog.h>
45#include <libkdepim/kinputdialog.h> 46#include <libkdepim/kinputdialog.h>
46 47
47#include <libkcal/calendarlocal.h> 48#include <libkcal/calendarlocal.h>
48#include <libkcal/icalformat.h> 49#include <libkcal/icalformat.h>
49#include <kabc/stdaddressbook.h> 50#include <kabc/stdaddressbook.h>
50 51
51#include "koprefs.h" 52#include "koprefs.h"
52#include "koglobals.h" 53#include "koglobals.h"
53 54
54#include "koimportoldialog.h" 55#include "koimportoldialog.h"
55 56
56#include "../outport/msoutl9.h" 57#include "../outport/msoutl9.h"
57#include <ole2.h> 58#include <ole2.h>
58#include <comutil.h> 59#include <comutil.h>
59_Application gOlApp; 60_Application gOlApp;
60 61
61QDateTime mDdate2Qdtr( DATE dt) 62QDateTime mDdate2Qdtr( DATE dt)
62{ 63{
63 COleDateTime odt; 64 COleDateTime odt;
64 SYSTEMTIME st; 65 SYSTEMTIME st;
65 odt = dt; 66 odt = dt;
66 odt.GetAsSystemTime(st); 67 odt.GetAsSystemTime(st);
67 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); 68 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) );
68 return qdt; 69 return qdt;
69} 70}
70 71
71class OLEListViewItem : public QCheckListItem 72class OLEListViewItem : public QCheckListItem
72{ 73{
73 public: 74 public:
74 OLEListViewItem( QListView *parent, QString text ) : 75 OLEListViewItem( QListView *parent, QString text ) :
75 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; }; 76 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; };
76 OLEListViewItem( QListViewItem *after, QString text ) : 77 OLEListViewItem( QListViewItem *after, QString text ) :
77 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; }; 78 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; };
78 ~OLEListViewItem() {}; 79 ~OLEListViewItem() {};
79 void setData( DWORD data ) {mData= data; }; 80 void setData( DWORD data ) {mData= data; };
80 DWORD data() { return mData ;}; 81 DWORD data() { return mData ;};
81 private: 82 private:
82 DWORD mData; 83 DWORD mData;
83}; 84};
84 85
85KOImportOLdialog::KOImportOLdialog( const QString &caption, 86KOImportOLdialog::KOImportOLdialog( const QString &caption,
86 Calendar *calendar, QWidget *parent ) : 87 Calendar *calendar, QWidget *parent ) :
87 KDialogBase( Plain, caption, User1 | Close, Ok, 88 KDialogBase( Plain, caption, User1 | Close, Ok,
88 parent, caption, true, false, i18n("Import!") ) 89 parent, caption, true, false, i18n("Import!") )
89{ 90{
90 QHBox * mw = new QHBox( this ); 91 QHBox * mw = new QHBox( this );
91 setMainWidget( mw ); 92 setMainWidget( mw );
92 mListView = new QListView( mw ); 93 mListView = new QListView( mw );
93 mListView->addColumn(i18n("Select Folder to import")); 94 mListView->addColumn(i18n("Select Folder to import"));
94 mListView->addColumn(i18n("Content Type")); 95 mListView->addColumn(i18n("Content Type"));
95 mCalendar = calendar; 96 mCalendar = calendar;
96 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); 97 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply()));
97 setupFolderView(); 98 setupFolderView();
98 resize( sizeHint().width()+50, sizeHint().height()+50 ); 99 resize( sizeHint().width()+50, sizeHint().height()+50 );
99} 100}
100 101
101KOImportOLdialog::~KOImportOLdialog() 102KOImportOLdialog::~KOImportOLdialog()
102{ 103{
103 104
104} 105}
105 106
106 107
107void KOImportOLdialog::setupFolderView() 108void KOImportOLdialog::setupFolderView()
108{ 109{
109 SCODE sc = ::OleInitialize(NULL); 110 SCODE sc = ::OleInitialize(NULL);
110 if ( FAILED ( sc ) ) { 111 if ( FAILED ( sc ) ) {
111 KMessageBox::information(this,"OLE initialisation failed"); 112 KMessageBox::information(this,"OLE initialisation failed");
112 return; 113 return;
113 } 114 }
114 115
115 if(!gOlApp.CreateDispatch(_T("Outlook.Application"),NULL)){ 116 if(!gOlApp.CreateDispatch(_T("Outlook.Application"),NULL)){
116 KMessageBox::information(this,"Sorry, cannot access Outlook"); 117 KMessageBox::information(this,"Sorry, cannot access Outlook");
117 return ; 118 return ;
118 } 119 }
119 MAPIFolder mfInbox; 120 MAPIFolder mfInbox;
120 MAPIFolder mfRoot; 121 MAPIFolder mfRoot;
121 CString szName; 122 CString szName;
122 _NameSpace olNS; 123 _NameSpace olNS;
123 olNS = gOlApp.GetNamespace(_T("MAPI")); 124 olNS = gOlApp.GetNamespace(_T("MAPI"));
124 mfInbox = olNS.GetDefaultFolder(6); 125 mfInbox = olNS.GetDefaultFolder(6);
125 mfRoot = mfInbox.GetParent(); 126 mfRoot = mfInbox.GetParent();
126 szName = mfRoot.GetName(); 127 szName = mfRoot.GetName();
127 long iType = mfRoot.GetDefaultItemType(); 128 long iType = mfRoot.GetDefaultItemType();
128 QString mes; 129 QString mes;
129 mes = QString::fromUcs2( szName.GetBuffer() ); 130 mes = QString::fromUcs2( szName.GetBuffer() );
130 OLEListViewItem * root = new OLEListViewItem( mListView, mes ); 131 OLEListViewItem * root = new OLEListViewItem( mListView, mes );
131 mfRoot.m_lpDispatch->AddRef(); 132 mfRoot.m_lpDispatch->AddRef();
132 addFolder( root, mfRoot.m_lpDispatch ); 133 addFolder( root, mfRoot.m_lpDispatch );
133 root->setOpen( true ); 134 root->setOpen( true );
134 mListView->setSortColumn( 0 ); 135 mListView->setSortColumn( 0 );
135 mListView->sort( ); 136 mListView->sort( );
136} 137}
137 138
138 139
139void KOImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent) 140void KOImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent)
140{ 141{
141 MAPIFolder mfParent(dispParent), mfChild; 142 MAPIFolder mfParent(dispParent), mfChild;
142 _Folders folders; 143 _Folders folders;
143 _variant_t fndx((long)0); 144 _variant_t fndx((long)0);
144 CString szName; 145 CString szName;
145 long iType; 146 long iType;
146 OLEListViewItem* hChild; 147 OLEListViewItem* hChild;
147 148
148 folders = mfParent.GetFolders(); 149 folders = mfParent.GetFolders();
149 for(int i=1; i <= folders.GetCount(); ++i) 150 for(int i=1; i <= folders.GetCount(); ++i)
150 { 151 {
151 fndx = (long)i; 152 fndx = (long)i;
152 mfChild = folders.Item(fndx.Detach()); 153 mfChild = folders.Item(fndx.Detach());
153 mfChild.m_lpDispatch->AddRef(); 154 mfChild.m_lpDispatch->AddRef();
154 szName = mfChild.GetName(); 155 szName = mfChild.GetName();
155 iType = mfChild.GetDefaultItemType(); 156 iType = mfChild.GetDefaultItemType();
156 hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) ); 157 hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) );
157 if ( iType != 1) 158 if ( iType != 1)
158 hChild->setEnabled( false ); 159 hChild->setEnabled( false );
159 QString ts; 160 QString ts;
160 switch( iType ) { 161 switch( iType ) {
161 case 0: 162 case 0:
162 ts = i18n("Mail"); 163 ts = i18n("Mail");
163 break; 164 break;
164 case 1: 165 case 1:
165 ts = i18n("Calendar"); 166 ts = i18n("Calendar");
166 break; 167 break;
167 case 2: 168 case 2:
168 ts = i18n("Contacts"); 169 ts = i18n("Contacts");
169 break; 170 break;
170 case 3: 171 case 3:
171 ts = i18n("Todos"); 172 ts = i18n("Todos");
172 break; 173 break;
173 case 4: 174 case 4:
174 ts = i18n("Journals"); 175 ts = i18n("Journals");
175 break; 176 break;
176 case 5: 177 case 5:
177 ts = i18n("Notes"); 178 ts = i18n("Notes");
178 break; 179 break;
179 default: 180 default:
180 ts = i18n("Unknown"); 181 ts = i18n("Unknown");
181 } 182 }
182 hChild->setText( 1,ts); 183 hChild->setText( 1,ts);
183 hChild->setData( (DWORD) mfChild.m_lpDispatch ); 184 hChild->setData( (DWORD) mfChild.m_lpDispatch );
184 mfChild.m_lpDispatch->AddRef(); 185 mfChild.m_lpDispatch->AddRef();
185 addFolder(hChild, mfChild.m_lpDispatch); 186 addFolder(hChild, mfChild.m_lpDispatch);
186 } 187 }
187} 188}
188 189
189void KOImportOLdialog::slotApply() 190void KOImportOLdialog::slotApply()
190{ 191{
191 importedItems = 0; 192 importedItems = 0;
192 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); 193 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild();
193 while ( child ) { 194 while ( child ) {
194 if ( child->isOn() ) 195 if ( child->isOn() )
195 readCalendarData( child->data() ); 196 readCalendarData( child->data() );
196 child = (OLEListViewItem*) child->itemBelow(); 197 child = (OLEListViewItem*) child->itemBelow();
197 } 198 }
198 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); 199 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems);
199 KMessageBox::information(this,mes); 200 KMessageBox::information(this,mes);
200} 201}
201void KOImportOLdialog::readCalendarData( DWORD folder ) 202void KOImportOLdialog::readCalendarData( DWORD folder )
202{ 203{
203 204
204 LPDISPATCH dispItem = (LPDISPATCH)folder; 205 LPDISPATCH dispItem = (LPDISPATCH)folder;
205 dispItem->AddRef(); 206 dispItem->AddRef();
206 MAPIFolder mf(dispItem); 207 MAPIFolder mf(dispItem);
207 mf.m_lpDispatch->AddRef(); 208 mf.m_lpDispatch->AddRef();
208 _Items folderItems; 209 _Items folderItems;
209 _variant_t indx((long)0); 210 _variant_t indx((long)0);
210 LPDISPATCH itm; 211 LPDISPATCH itm;
211 int i; 212 int i;
212 folderItems = mf.GetItems(); 213 folderItems = mf.GetItems();
213 QProgressBar bar( folderItems.GetCount(),0 ); 214 QProgressBar bar( folderItems.GetCount(),0 );
214 bar.setCaption (i18n("Importing - close to abort!") ); 215 bar.setCaption (i18n("Importing - close to abort!") );
215 int h = bar.sizeHint().height() ; 216 int h = bar.sizeHint().height() ;
216 int w = 300; 217 int w = 300;
217 int dw = QApplication::desktop()->width(); 218 int dw = QApplication::desktop()->width();
218 int dh = QApplication::desktop()->height(); 219 int dh = QApplication::desktop()->height();
219 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 220 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
220 bar.show(); 221 bar.show();
221 for(i=1; i <= folderItems.GetCount(); ++i) 222 for(i=1; i <= folderItems.GetCount(); ++i)
222 { 223 {
223 qApp->processEvents(); 224 qApp->processEvents();
224 if ( ! bar.isVisible() ) 225 if ( ! bar.isVisible() )
225 return ; 226 return ;
226 bar.setProgress( i ); 227 bar.setProgress( i );
227 indx = (long)i; 228 indx = (long)i;
228 itm = folderItems.Item(indx.Detach()); 229 itm = folderItems.Item(indx.Detach());
229 _AppointmentItem * pItem = (_AppointmentItem *)&itm; 230 _AppointmentItem * pItem = (_AppointmentItem *)&itm;
230 ol2kopiCalendar( pItem ); 231 ol2kopiCalendar( pItem );
231 itm->Release(); 232 itm->Release();
232 } 233 }
233} 234}
234void KOImportOLdialog::slotOk() 235void KOImportOLdialog::slotOk()
235{ 236{
236 QDialog::accept(); 237 QDialog::accept();
237} 238}
238 239
239void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRecurrence ) 240void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRecurrence )
240{ 241{
241 KCal::Event* event = new KCal::Event(); 242 KCal::Event* event = new KCal::Event();
242 if ( aItem->GetAllDayEvent() ){ 243 if ( aItem->GetAllDayEvent() ){
243 event->setDtStart( QDateTime( mDdate2Qdtr( aItem->GetStart()).date(),QTime(0,0,0 ) )); 244 event->setDtStart( QDateTime( mDdate2Qdtr( aItem->GetStart()).date(),QTime(0,0,0 ) ));
244 event->setDtEnd( QDateTime( mDdate2Qdtr( aItem->GetEnd()) .date(),QTime(0,0,0 )).addDays(-1)); 245 event->setDtEnd( QDateTime( mDdate2Qdtr( aItem->GetEnd()) .date(),QTime(0,0,0 )).addDays(-1));
245 event->setFloats( true ); 246 event->setFloats( true );
246 } else { 247 } else {
247 event->setDtStart( mDdate2Qdtr( aItem->GetStart()) ); 248 event->setDtStart( mDdate2Qdtr( aItem->GetStart()) );
248 event->setDtEnd( mDdate2Qdtr( aItem->GetEnd()) ); 249 event->setDtEnd( mDdate2Qdtr( aItem->GetEnd()) );
249 event->setFloats( false ); 250 event->setFloats( false );
250 } 251 }
251 event->setSummary( QString::fromUcs2( aItem->GetSubject().GetBuffer()) ); 252 event->setSummary( QString::fromUcs2( aItem->GetSubject().GetBuffer()) );
252 event->setLocation( QString::fromUcs2( aItem->GetLocation().GetBuffer()) ); 253 event->setLocation( QString::fromUcs2( aItem->GetLocation().GetBuffer()) );
253 event->setDescription( QString::fromUcs2( aItem->GetBody().GetBuffer()) ); 254 event->setDescription( QString::fromUcs2( aItem->GetBody().GetBuffer()).replace( QRegExp("\\r"), "") );
254 QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()); 255 QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer());
255 event->setCategories( QStringList::split( ";", cat )); 256 event->setCategories( QStringList::split( ";", cat ));
256 if ( aItem->GetReminderSet() ) { 257 if ( aItem->GetReminderSet() ) {
257 event->clearAlarms(); 258 event->clearAlarms();
258 Alarm* alarm = event->newAlarm(); 259 Alarm* alarm = event->newAlarm();
259 alarm->setStartOffset( -aItem->GetReminderMinutesBeforeStart()*60 ); 260 alarm->setStartOffset( -aItem->GetReminderMinutesBeforeStart()*60 );
260 alarm->setEnabled( true ); 261 alarm->setEnabled( true );
261 if ( aItem->GetReminderPlaySound() ) { 262 if ( aItem->GetReminderPlaySound() ) {
262 alarm->setType( Alarm::Audio ); 263 alarm->setType( Alarm::Audio );
263 alarm->setAudioFile( QString::fromUcs2( aItem->GetReminderSoundFile().GetBuffer())); 264 alarm->setAudioFile( QString::fromUcs2( aItem->GetReminderSoundFile().GetBuffer()));
264 } 265 }
265 else 266 else
266 alarm->setType( Alarm::Display ); 267 alarm->setType( Alarm::Display );
267 alarm->setRepeatCount( aItem->GetReplyTime() ); 268 alarm->setRepeatCount( aItem->GetReplyTime() );
268 } 269 }
269 // OL :pub 0 - pers 1 - priv 2 - conf 3 270 // OL :pub 0 - pers 1 - priv 2 - conf 3
270 // KO : pub 0 - priv 1 - conf 2 271 // KO : pub 0 - priv 1 - conf 2
271 int sec = aItem->GetSensitivity() ; 272 int sec = aItem->GetSensitivity() ;
272 if ( sec > 1 )// mapping pers -> private 273 if ( sec > 1 )// mapping pers -> private
273 --sec; 274 --sec;
274 event->setSecrecy( sec ); 275 event->setSecrecy( sec );
275 if ( aItem->GetBusyStatus() == 0 ) 276 if ( aItem->GetBusyStatus() == 0 )
276 event->setTransparency( Event::Transparent);// OL free 277 event->setTransparency( Event::Transparent);// OL free
277 else 278 else
278 event->setTransparency( Event::Opaque);//OL all other 279 event->setTransparency( Event::Opaque);//OL all other
279 280
280 if ( aItem->GetIsRecurring() && computeRecurrence ) { //recur 281 if ( aItem->GetIsRecurring() && computeRecurrence ) { //recur
281 282
282 RecurrencePattern recpat = aItem->GetRecurrencePattern(); 283 RecurrencePattern recpat = aItem->GetRecurrencePattern();
283 284
284 QDate startDate = mDdate2Qdtr(recpat.GetPatternStartDate()).date(); 285 QDate startDate = mDdate2Qdtr(recpat.GetPatternStartDate()).date();
285 int freq = recpat.GetInterval(); 286 int freq = recpat.GetInterval();
286 287
287 bool hasEndDate = !recpat.GetNoEndDate(); 288 bool hasEndDate = !recpat.GetNoEndDate();
288 QDate endDate = mDdate2Qdtr(recpat.GetPatternEndDate()).date(); 289 QDate endDate = mDdate2Qdtr(recpat.GetPatternEndDate()).date();
289 QBitArray weekDays( 7 ); 290 QBitArray weekDays( 7 );
290 weekDays.fill(false ); 291 weekDays.fill(false );
291 uint weekDaysNum = recpat.GetDayOfWeekMask(); 292 uint weekDaysNum = recpat.GetDayOfWeekMask();
292 int i; 293 int i;
293 int bb = 2; 294 int bb = 2;
294 for( i = 1; i <= 6; ++i ) { 295 for( i = 1; i <= 6; ++i ) {
295 weekDays.setBit( i - 1, ( bb & weekDaysNum )); 296 weekDays.setBit( i - 1, ( bb & weekDaysNum ));
296 bb = 4 << (i-1); 297 bb = 4 << (i-1);
297 //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); 298 //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) );
298 } 299 }
299 if ( 1 & weekDaysNum) 300 if ( 1 & weekDaysNum)
300 weekDays.setBit( 6 ); 301 weekDays.setBit( 6 );
301 // int pos = 1;// pending 302 // int pos = 1;// pending
302 303
303 Recurrence *r = event->recurrence(); 304 Recurrence *r = event->recurrence();
304 int rtype = recpat.GetRecurrenceType(); 305 int rtype = recpat.GetRecurrenceType();
305 //recurrence types are: 306 //recurrence types are:
306 /* 307 /*
307 olRecursDaily(0) 308 olRecursDaily(0)
308 olRecursWeekly(1) 309 olRecursWeekly(1)
309 olRecursMonthly(2) 310 olRecursMonthly(2)
310 olRecursMonthNth(3) 311 olRecursMonthNth(3)
311 olRecursYearly(5) 312 olRecursYearly(5)
312 olRecursYearNth(6) 313 olRecursYearNth(6)
313 */ 314 */
314 315
315 int duration = recpat.GetOccurrences(); 316 int duration = recpat.GetOccurrences();
316 if ( !hasEndDate ) 317 if ( !hasEndDate )
317 duration = -1; 318 duration = -1;
318 319
319 //LPDISPATCH RecurrencePattern::GetExceptions() 320 //LPDISPATCH RecurrencePattern::GetExceptions()
320 //long RecurrencePattern::GetMonthOfYear() 321 //long RecurrencePattern::GetMonthOfYear()
321 if ( rtype == 0 ) { 322 if ( rtype == 0 ) {
322 if ( hasEndDate ) r->setDaily( freq, endDate ); 323 if ( hasEndDate ) r->setDaily( freq, endDate );
323 else r->setDaily( freq, duration ); 324 else r->setDaily( freq, duration );
324 } else if ( rtype == 1 ) { 325 } else if ( rtype == 1 ) {
325 if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); 326 if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate );
326 else r->setWeekly( freq, weekDays, duration ); 327 else r->setWeekly( freq, weekDays, duration );
327 } else if ( rtype == 2 ) { 328 } else if ( rtype == 2 ) {
328 if ( hasEndDate ) 329 if ( hasEndDate )
329 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); 330 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );
330 else 331 else
331 r->setMonthly( Recurrence::rMonthlyDay, freq, duration ); 332 r->setMonthly( Recurrence::rMonthlyDay, freq, duration );
332 //r->addMonthlyDay( startDate.day() ); 333 //r->addMonthlyDay( startDate.day() );
333 r->addMonthlyDay( recpat.GetDayOfMonth() ); 334 r->addMonthlyDay( recpat.GetDayOfMonth() );
334 } else if ( rtype == 3 ) { 335 } else if ( rtype == 3 ) {
335 if ( hasEndDate ) 336 if ( hasEndDate )
336 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); 337 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
337 else 338 else
338 r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); 339 r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
339 QBitArray days( 7 ); 340 QBitArray days( 7 );
340 days.fill( false ); 341 days.fill( false );
341 days.setBit( startDate.dayOfWeek() - 1 ); 342 days.setBit( startDate.dayOfWeek() - 1 );
342 int pos = (startDate.day()/7)+1; 343 int pos = (startDate.day()/7)+1;
343 r->addMonthlyPos( pos, days ); 344 r->addMonthlyPos( pos, days );
344 //QString mes = i18n("Importing monthlypos.\n\npos: %1 , day: %2").arg( pos).arg( startDate.dayOfWeek() - 1); 345 //QString mes = i18n("Importing monthlypos.\n\npos: %1 , day: %2").arg( pos).arg( startDate.dayOfWeek() - 1);
345 //KMessageBox::information(this,mes); 346 //KMessageBox::information(this,mes);
346 } else if ( rtype == 5 ) { 347 } else if ( rtype == 5 ) {
347 freq = 1; 348 freq = 1;
348 if ( hasEndDate ) 349 if ( hasEndDate )
349 r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); 350 r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
350 else 351 else
351 r->setYearly( Recurrence::rYearlyMonth, freq, duration ); 352 r->setYearly( Recurrence::rYearlyMonth, freq, duration );
352 r->addYearlyNum( startDate.month() ); 353 r->addYearlyNum( startDate.month() );
353 } else if ( true /*rtype == 6*/ ) { 354 } else if ( true /*rtype == 6*/ ) {
354 // KOganizer cannot handle this in the GUI 355 // KOganizer cannot handle this in the GUI
355 // we are mapping this to monthly - every 12. month 356 // we are mapping this to monthly - every 12. month
356 freq = 12; 357 freq = 12;
357 if ( hasEndDate ) 358 if ( hasEndDate )
358 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); 359 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
359 else 360 else
360 r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); 361 r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
361 QBitArray days( 7 ); 362 QBitArray days( 7 );
362 days.fill( false ); 363 days.fill( false );
363 days.setBit( startDate.dayOfWeek() - 1 ); 364 days.setBit( startDate.dayOfWeek() - 1 );
364 int pos = (startDate.day()/7)+1; 365 int pos = (startDate.day()/7)+1;
365 r->addMonthlyPos( pos, days ); 366 r->addMonthlyPos( pos, days );
366 } 367 }
367 // recurrence exceptions 368 // recurrence exceptions
368 LPDISPATCH dispItem = recpat.GetExceptions(); 369 LPDISPATCH dispItem = recpat.GetExceptions();
369 dispItem->AddRef(); 370 dispItem->AddRef();
370 Exceptions ex(dispItem); 371 Exceptions ex(dispItem);
371 _variant_t indx((long)0); 372 _variant_t indx((long)0);
372 LPDISPATCH itm; 373 LPDISPATCH itm;
373 for(i=1; i <= ex.GetCount(); ++i) { 374 for(i=1; i <= ex.GetCount(); ++i) {
374 indx = (long)i; 375 indx = (long)i;
375 itm = ex.Item( indx.Detach() ); 376 itm = ex.Item( indx.Detach() );
376 ::Exception * pItem = (::Exception *)&itm; 377 ::Exception * pItem = (::Exception *)&itm;
377 event->addExDate( QDateTime( mDdate2Qdtr( pItem->GetOriginalDate())).date() ); 378 event->addExDate( QDateTime( mDdate2Qdtr( pItem->GetOriginalDate())).date() );
378 if ( !pItem->GetDeleted() ) { 379 if ( !pItem->GetDeleted() ) {
379 LPDISPATCH appIt = pItem->GetAppointmentItem(); 380 LPDISPATCH appIt = pItem->GetAppointmentItem();
380 _AppointmentItem * paItem = (_AppointmentItem *)&appIt; 381 _AppointmentItem * paItem = (_AppointmentItem *)&appIt;
381 ol2kopiCalendar( paItem, false ); 382 ol2kopiCalendar( paItem, false );
382 } 383 }
383 itm->Release(); 384 itm->Release();
384 } 385 }
385 } 386 }
386 // recurrence ENTE 387 // recurrence ENTE
387 event->setOrganizer( QString::fromUcs2( aItem->GetOrganizer().GetBuffer())); 388 event->setOrganizer( QString::fromUcs2( aItem->GetOrganizer().GetBuffer()));
388 389
389 //GetOptionalAttendees() 390 //GetOptionalAttendees()
390 //GetRequiredAttendees() 391 //GetRequiredAttendees()
391 LPDISPATCH dispItem = aItem->GetRecipients(); 392 LPDISPATCH dispItem = aItem->GetRecipients();
392 dispItem->AddRef(); 393 dispItem->AddRef();
393 _Folders mf(dispItem); 394 _Folders mf(dispItem);
394 mf.m_lpDispatch->AddRef(); 395 mf.m_lpDispatch->AddRef();
395 _variant_t indx((long)0); 396 _variant_t indx((long)0);
396 LPDISPATCH itm; 397 LPDISPATCH itm;
397 int i; 398 int i;
398 QString optAtt = QString::fromUcs2( aItem->GetOptionalAttendees().GetBuffer()); 399 QString optAtt = QString::fromUcs2( aItem->GetOptionalAttendees().GetBuffer());
399 QString reqAtt = QString::fromUcs2( aItem->GetRequiredAttendees().GetBuffer()); 400 QString reqAtt = QString::fromUcs2( aItem->GetRequiredAttendees().GetBuffer());
400 //GetRequiredAttendees() 401 //GetRequiredAttendees()
401 for(i=1; i <= mf.GetCount(); ++i) { 402 for(i=1; i <= mf.GetCount(); ++i) {
402 indx = (long)i; 403 indx = (long)i;
403 itm = mf.Item( indx.Detach() ); 404 itm = mf.Item( indx.Detach() );
404 Recipient * pItem = (Recipient *)&itm; 405 Recipient * pItem = (Recipient *)&itm;
405 406
406 //a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 407 //a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
407 QString name = QString::fromUcs2( pItem->GetName().GetBuffer()); 408 QString name = QString::fromUcs2( pItem->GetName().GetBuffer());
408 KCal::Attendee::PartStat stat; 409 KCal::Attendee::PartStat stat;
409 bool rsvp = false; 410 bool rsvp = false;
410 switch ( pItem->GetMeetingResponseStatus() ) { 411 switch ( pItem->GetMeetingResponseStatus() ) {
411 case 0: //not answered 412 case 0: //not answered
412 rsvp = true; 413 rsvp = true;
413 case 5: //not answered 414 case 5: //not answered
414 stat = Attendee::NeedsAction; 415 stat = Attendee::NeedsAction;
415 break; 416 break;
416 case 1: //organizer 417 case 1: //organizer
417 stat = Attendee::Delegated ; 418 stat = Attendee::Delegated ;
418 break; 419 break;
419 case 2: //tentative 420 case 2: //tentative
420 stat = Attendee::Tentative ; 421 stat = Attendee::Tentative ;
421 break; 422 break;
422 case 3: //accepted 423 case 3: //accepted
423 stat = Attendee::Accepted; 424 stat = Attendee::Accepted;
424 break; 425 break;
425 case 4: //declined 426 case 4: //declined
426 stat =Attendee::Declined ; 427 stat =Attendee::Declined ;
427 break; 428 break;
428 default: 429 default:
429 stat = Attendee::NeedsAction ; 430 stat = Attendee::NeedsAction ;
430 431
431 } 432 }
432 KCal::Attendee::Role role; 433 KCal::Attendee::Role role;
433 if ( event->organizer() == name ) 434 if ( event->organizer() == name )
434 role = KCal::Attendee::Chair; 435 role = KCal::Attendee::Chair;
435 else if ( reqAtt.find( name ) >= 0 ) 436 else if ( reqAtt.find( name ) >= 0 )
436 role = KCal::Attendee::ReqParticipant; 437 role = KCal::Attendee::ReqParticipant;
437 else if ( optAtt.find( name ) >= 0 ) 438 else if ( optAtt.find( name ) >= 0 )
438 role = KCal::Attendee::OptParticipant; 439 role = KCal::Attendee::OptParticipant;
439 else 440 else
440 role = KCal::Attendee::NonParticipant; 441 role = KCal::Attendee::NonParticipant;
441 QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer()); 442 QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer());
442 if( mail.isEmpty() && name.find("@") > 0 ) { 443 if( mail.isEmpty() && name.find("@") > 0 ) {
443 int kl = name.find("<"); 444 int kl = name.find("<");
444 int gr = name.find(">"); 445 int gr = name.find(">");
445 if ( kl >= 0 && gr >= 0) { 446 if ( kl >= 0 && gr >= 0) {
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 9e215b9..63484d6 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -99,403 +99,409 @@ class KOex2phonePrefs : public QDialog
99 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 99 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
100 mWriteBackFuture->setChecked( true ); 100 mWriteBackFuture->setChecked( true );
101 lay->addWidget( mWriteBackFuture ); 101 lay->addWidget( mWriteBackFuture );
102 temphb = new QHBox( this ); 102 temphb = new QHBox( this );
103 new QLabel( i18n("Max. weeks in future: ") , temphb ); 103 new QLabel( i18n("Max. weeks in future: ") , temphb );
104 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 104 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
105 mWriteBackFutureWeeks->setValue( 8 ); 105 mWriteBackFutureWeeks->setValue( 8 );
106 lay->addWidget( temphb ); 106 lay->addWidget( temphb );
107 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 107 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
108 lab->setAlignment (AlignHCenter ); 108 lab->setAlignment (AlignHCenter );
109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
110 lay->addWidget( ok ); 110 lay->addWidget( ok );
111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
112 lay->addWidget( cancel ); 112 lay->addWidget( cancel );
113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
115 resize( 220, 240 ); 115 resize( 220, 240 );
116 116
117 } 117 }
118 118
119public: 119public:
120 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 120 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
121 QCheckBox* mWriteBackFuture; 121 QCheckBox* mWriteBackFuture;
122 QSpinBox* mWriteBackFutureWeeks; 122 QSpinBox* mWriteBackFutureWeeks;
123}; 123};
124 124
125int globalFlagBlockStartup; 125int globalFlagBlockStartup;
126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
127 QMainWindow( parent, name ) 127 QMainWindow( parent, name )
128{ 128{
129 129
130#ifdef DESKTOP_VERSION 130#ifdef DESKTOP_VERSION
131 setFont( QFont("Arial"), 14 ); 131 setFont( QFont("Arial"), 14 );
132#endif 132#endif
133 mClosed = false; 133 mClosed = false;
134 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 134 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
135 QString confFile = locateLocal("config","korganizerrc"); 135 QString confFile = locateLocal("config","korganizerrc");
136 QFileInfo finf ( confFile ); 136 QFileInfo finf ( confFile );
137 bool showWarning = !finf.exists(); 137 bool showWarning = !finf.exists();
138 setIcon(SmallIcon( "ko24" ) ); 138 setIcon(SmallIcon( "ko24" ) );
139 mBlockAtStartup = true; 139 mBlockAtStartup = true;
140 mFlagKeyPressed = false; 140 mFlagKeyPressed = false;
141 setCaption("KOrganizer/Pi"); 141 setCaption("KOrganizer/Pi");
142 KOPrefs *p = KOPrefs::instance(); 142 KOPrefs *p = KOPrefs::instance();
143 KPimGlobalPrefs::instance()->setGlobalConfig(); 143 KPimGlobalPrefs::instance()->setGlobalConfig();
144 if ( p->mHourSize > 18 ) 144 if ( p->mHourSize > 18 )
145 p->mHourSize = 18; 145 p->mHourSize = 18;
146 QMainWindow::ToolBarDock tbd; 146 QMainWindow::ToolBarDock tbd;
147 if ( p->mToolBarHor ) { 147 if ( p->mToolBarHor ) {
148 if ( p->mToolBarUp ) 148 if ( p->mToolBarUp )
149 tbd = Bottom; 149 tbd = Bottom;
150 else 150 else
151 tbd = Top; 151 tbd = Top;
152 } 152 }
153 else { 153 else {
154 if ( p->mToolBarUp ) 154 if ( p->mToolBarUp )
155 tbd = Right; 155 tbd = Right;
156 else 156 else
157 tbd = Left; 157 tbd = Left;
158 } 158 }
159 if ( KOPrefs::instance()->mUseAppColors ) 159 if ( KOPrefs::instance()->mUseAppColors )
160 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 160 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
161 globalFlagBlockStartup = 1; 161 globalFlagBlockStartup = 1;
162 iconToolBar = new QPEToolBar( this ); 162 iconToolBar = new QPEToolBar( this );
163 addToolBar (iconToolBar , tbd ); 163 addToolBar (iconToolBar , tbd );
164 mCalendarModifiedFlag = false; 164 mCalendarModifiedFlag = false;
165 165
166 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 166 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
167 splash->setAlignment ( AlignCenter ); 167 splash->setAlignment ( AlignCenter );
168 setCentralWidget( splash ); 168 setCentralWidget( splash );
169#ifndef DESKTOP_VERSION 169#ifndef DESKTOP_VERSION
170 showMaximized(); 170 showMaximized();
171#endif 171#endif
172 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 172 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
173 setDefaultPreferences(); 173 setDefaultPreferences();
174 mCalendar = new CalendarLocal(); 174 mCalendar = new CalendarLocal();
175 mView = new CalendarView( mCalendar, this,"mCalendar " ); 175 mView = new CalendarView( mCalendar, this,"mCalendar " );
176 mView->hide(); 176 mView->hide();
177 //mView->resize(splash->size() ); 177 //mView->resize(splash->size() );
178 initActions(); 178 initActions();
179 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 179 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
180 mSyncManager->setBlockSave(false); 180 mSyncManager->setBlockSave(false);
181 mView->setSyncManager(mSyncManager); 181 mView->setSyncManager(mSyncManager);
182#ifndef DESKTOP_VERSION 182#ifndef DESKTOP_VERSION
183 iconToolBar->show(); 183 iconToolBar->show();
184 qApp->processEvents(); 184 qApp->processEvents();
185#endif 185#endif
186 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 186 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
187 int vh = height() ; 187 int vh = height() ;
188 int vw = width(); 188 int vw = width();
189 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 189 //qDebug("Toolbar hei %d ",iconToolBar->height() );
190 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 190 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
191 vh -= iconToolBar->height(); 191 vh -= iconToolBar->height();
192 } else { 192 } else {
193 vw -= iconToolBar->height(); 193 vw -= iconToolBar->height();
194 } 194 }
195 //mView->setMaximumSize( splash->size() ); 195 //mView->setMaximumSize( splash->size() );
196 //mView->resize( splash->size() ); 196 //mView->resize( splash->size() );
197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
198 mView->readSettings(); 198 mView->readSettings();
199 bool newFile = false; 199 bool newFile = false;
200 if( !QFile::exists( defaultFileName() ) ) { 200 if( !QFile::exists( defaultFileName() ) ) {
201 QFileInfo finfo ( defaultFileName() ); 201 QFileInfo finfo ( defaultFileName() );
202 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 202 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
203 qDebug("oldfile %s ", oldFile.latin1()); 203 qDebug("oldfile %s ", oldFile.latin1());
204 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 204 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
205 finfo.setFile( oldFile ); 205 finfo.setFile( oldFile );
206 if (finfo.exists() ) { 206 if (finfo.exists() ) {
207 KMessageBox::information( this, message); 207 KMessageBox::information( this, message);
208 mView->openCalendar( oldFile ); 208 mView->openCalendar( oldFile );
209 qApp->processEvents(); 209 qApp->processEvents();
210 } else { 210 } else {
211 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 211 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
212 finfo.setFile( oldFile ); 212 finfo.setFile( oldFile );
213 if (finfo.exists() ) { 213 if (finfo.exists() ) {
214 KMessageBox::information( this, message); 214 KMessageBox::information( this, message);
215 mView->openCalendar( oldFile ); 215 mView->openCalendar( oldFile );
216 qApp->processEvents(); 216 qApp->processEvents();
217 } 217 }
218 } 218 }
219 mView->saveCalendar( defaultFileName() ); 219 mView->saveCalendar( defaultFileName() );
220 newFile = true; 220 newFile = true;
221 } 221 }
222 222
223 QTime neededSaveTime = QDateTime::currentDateTime().time(); 223 QTime neededSaveTime = QDateTime::currentDateTime().time();
224 mView->openCalendar( defaultFileName() ); 224 mView->openCalendar( defaultFileName() );
225 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 225 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
226 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 226 qDebug("KO: Calendar loading time: %d ms",msNeeded );
227 227
228 if ( KOPrefs::instance()->mLanguageChanged ) { 228 if ( KOPrefs::instance()->mLanguageChanged ) {
229 KOPrefs::instance()->setCategoryDefaults(); 229 KOPrefs::instance()->setCategoryDefaults();
230 int count = mView->addCategories(); 230 int count = mView->addCategories();
231 KOPrefs::instance()->mLanguageChanged = false; 231 KOPrefs::instance()->mLanguageChanged = false;
232 } 232 }
233 processIncidenceSelection( 0 ); 233 processIncidenceSelection( 0 );
234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
235 SLOT( processIncidenceSelection( Incidence * ) ) ); 235 SLOT( processIncidenceSelection( Incidence * ) ) );
236 connect( mView, SIGNAL( modifiedChanged( bool ) ), 236 connect( mView, SIGNAL( modifiedChanged( bool ) ),
237 SLOT( slotModifiedChanged( bool ) ) ); 237 SLOT( slotModifiedChanged( bool ) ) );
238 238
239 239
240 connect( mView, SIGNAL( tempDisableBR(bool) ), 240 connect( mView, SIGNAL( tempDisableBR(bool) ),
241 SLOT( disableBR(bool) ) ); 241 SLOT( disableBR(bool) ) );
242 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 242 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
243 mView->setModified( false ); 243 mView->setModified( false );
244 mBlockAtStartup = false; 244 mBlockAtStartup = false;
245 mView->setModified( false ); 245 mView->setModified( false );
246 setCentralWidget( mView ); 246 setCentralWidget( mView );
247 globalFlagBlockStartup = 0; 247 globalFlagBlockStartup = 0;
248 mView->show(); 248 mView->show();
249 delete splash; 249 delete splash;
250 if ( newFile ) 250 if ( newFile )
251 mView->updateConfig(); 251 mView->updateConfig();
252 // qApp->processEvents(); 252 // qApp->processEvents();
253 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 253 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
254 //fillSyncMenu(); 254 //fillSyncMenu();
255 255
256 256
257 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 257 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
258 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 258 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
259 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 259 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
260 mSyncManager->setDefaultFileName( defaultFileName()); 260 mSyncManager->setDefaultFileName( defaultFileName());
261 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 261 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
262 mSyncManager->fillSyncMenu(); 262 mSyncManager->fillSyncMenu();
263 263
264 264
265 265
266 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 266 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
267 if ( showWarning ) { 267 if ( showWarning ) {
268 KMessageBox::information( this, 268 KMessageBox::information( this,
269 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 269 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
270 qApp->processEvents(); 270 qApp->processEvents();
271 mView->dialogManager()->showSyncOptions(); 271 mView->dialogManager()->showSyncOptions();
272 } 272 }
273 273
274 //US listen for result adressed from Ka/Pi 274 //US listen for result adressed from Ka/Pi
275#ifndef DESKTOP_VERSION 275#ifndef DESKTOP_VERSION
276 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 276 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
277#endif 277#endif
278#ifndef DESKTOP_VERSION 278#ifndef DESKTOP_VERSION
279 infrared = 0; 279 infrared = 0;
280#endif 280#endif
281 281
282 mBRdisabled = false; 282 mBRdisabled = false;
283 toggleBeamReceive(); 283 toggleBeamReceive();
284} 284}
285MainWindow::~MainWindow() 285MainWindow::~MainWindow()
286{ 286{
287 //qDebug("MainWindow::~MainWindow() "); 287 //qDebug("MainWindow::~MainWindow() ");
288 //save toolbar location 288 //save toolbar location
289 delete mCalendar; 289 delete mCalendar;
290 delete mSyncManager; 290 delete mSyncManager;
291#ifndef DESKTOP_VERSION
291 if ( infrared ) 292 if ( infrared )
292 delete infrared; 293 delete infrared;
294#endif
293 295
294 296
295} 297}
296 298
297void MainWindow::disableBR(bool b) 299void MainWindow::disableBR(bool b)
298{ 300{
301#ifndef DESKTOP_VERSION
299 if ( b ) { 302 if ( b ) {
300 if ( infrared ) { 303 if ( infrared ) {
301 toggleBeamReceive(); 304 toggleBeamReceive();
302 mBRdisabled = true; 305 mBRdisabled = true;
303 } 306 }
307 mBRdisabled = true;
304 } else { 308 } else {
305 if ( mBRdisabled ) { 309 if ( mBRdisabled ) {
306 mBRdisabled = false; 310 mBRdisabled = false;
307 toggleBeamReceive(); 311 //makes no sense,because other cal ap is probably running
312 // toggleBeamReceive();
308 } 313 }
309 } 314 }
315#endif
310 316
311} 317}
312bool MainWindow::beamReceiveEnabled() 318bool MainWindow::beamReceiveEnabled()
313{ 319{
314#ifndef DESKTOP_VERSION 320#ifndef DESKTOP_VERSION
315 return ( infrared != 0 ); 321 return ( infrared != 0 );
316#endif 322#endif
317 return false; 323 return false;
318} 324}
319 325
320void MainWindow::toggleBeamReceive() 326void MainWindow::toggleBeamReceive()
321{ 327{
322 if ( mBRdisabled ) 328 if ( mBRdisabled )
323 return; 329 return;
324#ifndef DESKTOP_VERSION 330#ifndef DESKTOP_VERSION
325 if ( infrared ) { 331 if ( infrared ) {
326 qDebug("disable BeamReceive "); 332 qDebug("disable BeamReceive ");
327 delete infrared; 333 delete infrared;
328 infrared = 0; 334 infrared = 0;
329 brAction->setOn(false); 335 brAction->setOn(false);
330 return; 336 return;
331 } 337 }
332 qDebug("enable BeamReceive "); 338 qDebug("enable BeamReceive ");
333 brAction->setOn(true); 339 brAction->setOn(true);
334 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 340 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
335 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 341 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
336#endif 342#endif
337} 343}
338void MainWindow::showMaximized () 344void MainWindow::showMaximized ()
339{ 345{
340#ifndef DESKTOP_VERSION 346#ifndef DESKTOP_VERSION
341 if ( ! globalFlagBlockStartup ) 347 if ( ! globalFlagBlockStartup )
342 if ( mClosed ) 348 if ( mClosed )
343 mView->goToday(); 349 mView->goToday();
344#endif 350#endif
345 QWidget::showMaximized () ; 351 QWidget::showMaximized () ;
346 mClosed = false; 352 mClosed = false;
347} 353}
348void MainWindow::closeEvent( QCloseEvent* ce ) 354void MainWindow::closeEvent( QCloseEvent* ce )
349{ 355{
350 356
351 357
352 358
353 if ( ! KOPrefs::instance()->mAskForQuit ) { 359 if ( ! KOPrefs::instance()->mAskForQuit ) {
354 saveOnClose(); 360 saveOnClose();
355 mClosed = true; 361 mClosed = true;
356 ce->accept(); 362 ce->accept();
357 return; 363 return;
358 364
359 } 365 }
360 366
361 switch( QMessageBox::information( this, "KO/Pi", 367 switch( QMessageBox::information( this, "KO/Pi",
362 i18n("Do you really want\nto close KO/Pi?"), 368 i18n("Do you really want\nto close KO/Pi?"),
363 i18n("Close"), i18n("No"), 369 i18n("Close"), i18n("No"),
364 0, 0 ) ) { 370 0, 0 ) ) {
365 case 0: 371 case 0:
366 saveOnClose(); 372 saveOnClose();
367 mClosed = true; 373 mClosed = true;
368 ce->accept(); 374 ce->accept();
369 break; 375 break;
370 case 1: 376 case 1:
371 ce->ignore(); 377 ce->ignore();
372 break; 378 break;
373 case 2: 379 case 2:
374 380
375 default: 381 default:
376 break; 382 break;
377 } 383 }
378 384
379 385
380} 386}
381 387
382void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 388void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
383{ 389{
384 QDataStream stream( data, IO_ReadOnly ); 390 QDataStream stream( data, IO_ReadOnly );
385 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 391 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
386 //QString datamess; 392 //QString datamess;
387 //qDebug("message "); 393 //qDebug("message ");
388 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 394 qDebug("KO: QCOP message received: %s ", cmsg.data() );
389 395
390 if ( cmsg == "setDocument(QString)" ) { 396 if ( cmsg == "setDocument(QString)" ) {
391 QDataStream stream( data, IO_ReadOnly ); 397 QDataStream stream( data, IO_ReadOnly );
392 QString fileName; 398 QString fileName;
393 stream >> fileName; 399 stream >> fileName;
394 //qDebug("filename %s ", fileName.latin1()); 400 //qDebug("filename %s ", fileName.latin1());
395 showMaximized(); 401 showMaximized();
396 raise(); 402 raise();
397 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 403 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
398 mSyncManager->slotSyncMenu( 1002 ); 404 mSyncManager->slotSyncMenu( 1002 );
399 return; 405 return;
400 } 406 }
401 407
402 if ( cmsg == "-writeFile" ) { 408 if ( cmsg == "-writeFile" ) {
403 // I made from the "-writeFile" an "-writeAlarm" 409 // I made from the "-writeFile" an "-writeAlarm"
404 mView->viewManager()->showWhatsNextView(); 410 mView->viewManager()->showWhatsNextView();
405 mCalendar->checkAlarmForIncidence( 0, true); 411 mCalendar->checkAlarmForIncidence( 0, true);
406 showMaximized(); 412 showMaximized();
407 raise(); 413 raise();
408 return; 414 return;
409 415
410 } 416 }
411 if ( cmsg == "-writeFileSilent" ) { 417 if ( cmsg == "-writeFileSilent" ) {
412 // I made from the "-writeFile" an "-writeAlarm" 418 // I made from the "-writeFile" an "-writeAlarm"
413 // mView->viewManager()->showWhatsNextView(); 419 // mView->viewManager()->showWhatsNextView();
414 mCalendar->checkAlarmForIncidence( 0, true); 420 mCalendar->checkAlarmForIncidence( 0, true);
415 //showMaximized(); 421 //showMaximized();
416 //raise(); 422 //raise();
417 hide(); 423 hide();
418 return; 424 return;
419 } 425 }
420 if ( cmsg == "-newCountdown" ) { 426 if ( cmsg == "-newCountdown" ) {
421 qDebug("newCountdown "); 427 qDebug("newCountdown ");
422 428
423 } 429 }
424 QString msg ; 430 QString msg ;
425 QString allmsg = cmsg; 431 QString allmsg = cmsg;
426 while ( allmsg.length() > 0 ) { 432 while ( allmsg.length() > 0 ) {
427 int nextC = allmsg.find( "-", 1 ); 433 int nextC = allmsg.find( "-", 1 );
428 if ( nextC == -1 ) { 434 if ( nextC == -1 ) {
429 msg = allmsg; 435 msg = allmsg;
430 allmsg = ""; 436 allmsg = "";
431 } else{ 437 } else{
432 msg = allmsg.left( nextC ); 438 msg = allmsg.left( nextC );
433 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 439 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
434 } 440 }
435 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 441 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
436 if ( msg == "-newEvent" ) { 442 if ( msg == "-newEvent" ) {
437 mView->newEvent(); 443 mView->newEvent();
438 } 444 }
439 if ( msg == "-newTodo" ) { 445 if ( msg == "-newTodo" ) {
440 mView->newTodo(); 446 mView->newTodo();
441 447
442 } 448 }
443 if ( msg == "-showWN" ) { 449 if ( msg == "-showWN" ) {
444 mView->viewManager()->showWhatsNextView(); 450 mView->viewManager()->showWhatsNextView();
445 } 451 }
446 if ( msg == "-showTodo" ) { 452 if ( msg == "-showTodo" ) {
447 mView->viewManager()->showTodoView(); 453 mView->viewManager()->showTodoView();
448 } 454 }
449 if ( msg == "-showList" ) { 455 if ( msg == "-showList" ) {
450 mView->viewManager()->showListView(); 456 mView->viewManager()->showListView();
451 } 457 }
452 else if ( msg == "-showDay" ) { 458 else if ( msg == "-showDay" ) {
453 mView->viewManager()->showDayView(); 459 mView->viewManager()->showDayView();
454 } 460 }
455 else if ( msg == "-showWWeek" ) { 461 else if ( msg == "-showWWeek" ) {
456 mView->viewManager()->showWorkWeekView(); 462 mView->viewManager()->showWorkWeekView();
457 } 463 }
458 else if ( msg == "-ringSync" ) { 464 else if ( msg == "-ringSync" ) {
459 mSyncManager->multiSync( false ); 465 mSyncManager->multiSync( false );
460 } 466 }
461 else if ( msg == "-showWeek" ) { 467 else if ( msg == "-showWeek" ) {
462 mView->viewManager()->showWeekView(); 468 mView->viewManager()->showWeekView();
463 } 469 }
464 else if ( msg == "-showTodo" ) { 470 else if ( msg == "-showTodo" ) {
465 mView->viewManager()->showTodoView(); 471 mView->viewManager()->showTodoView();
466 } 472 }
467 else if ( msg == "-showJournal" ) { 473 else if ( msg == "-showJournal" ) {
468 mView->dateNavigator()->selectDates( 1 ); 474 mView->dateNavigator()->selectDates( 1 );
469 mView->dateNavigator()->selectToday(); 475 mView->dateNavigator()->selectToday();
470 mView->viewManager()->showJournalView(); 476 mView->viewManager()->showJournalView();
471 } 477 }
472 else if ( msg == "-showKO" ) { 478 else if ( msg == "-showKO" ) {
473 mView->viewManager()->showNextXView(); 479 mView->viewManager()->showNextXView();
474 } 480 }
475 else if ( msg == "-showWNext" || msg == "nextView()" ) { 481 else if ( msg == "-showWNext" || msg == "nextView()" ) {
476 mView->viewManager()->showWhatsNextView(); 482 mView->viewManager()->showWhatsNextView();
477 } 483 }
478 else if ( msg == "-showNextXView" ) { 484 else if ( msg == "-showNextXView" ) {
479 mView->viewManager()->showNextXView(); 485 mView->viewManager()->showNextXView();
480 } 486 }
481 487
482 488
483 } 489 }
484 490
485 showMaximized(); 491 showMaximized();
486 raise(); 492 raise();
487} 493}
488 494
489QPixmap MainWindow::loadPixmap( QString name ) 495QPixmap MainWindow::loadPixmap( QString name )
490{ 496{
491 return SmallIcon( name ); 497 return SmallIcon( name );
492 498
493} 499}
494void MainWindow::initActions() 500void MainWindow::initActions()
495{ 501{
496 //KOPrefs::instance()->mShowFullMenu 502 //KOPrefs::instance()->mShowFullMenu
497 iconToolBar->clear(); 503 iconToolBar->clear();
498 KOPrefs *p = KOPrefs::instance(); 504 KOPrefs *p = KOPrefs::instance();
499 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 505 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
500 506
501 QPopupMenu *viewMenu = new QPopupMenu( this ); 507 QPopupMenu *viewMenu = new QPopupMenu( this );