summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index e009d52..a1ce5a0 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -260,192 +260,198 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
260 isLoading = false; 260 isLoading = false;
261} 261}
262 262
263 263
264void AddressbookWindow::slotConfig() 264void AddressbookWindow::slotConfig()
265{ 265{
266 ConfigDlg* dlg = new ConfigDlg( this, "Config" ); 266 ConfigDlg* dlg = new ConfigDlg( this, "Config" );
267 dlg -> setConfig( m_config ); 267 dlg -> setConfig( m_config );
268 dlg -> showMaximized(); 268 dlg -> showMaximized();
269 if ( dlg -> exec() ) { 269 if ( dlg -> exec() ) {
270 qWarning ("Config Dialog accepted !"); 270 qWarning ("Config Dialog accepted !");
271 m_config = dlg -> getConfig(); 271 m_config = dlg -> getConfig();
272 if ( m_curFontSize != m_config.fontSize() ){ 272 if ( m_curFontSize != m_config.fontSize() ){
273 qWarning("Font was changed!"); 273 qWarning("Font was changed!");
274 m_curFontSize = m_config.fontSize(); 274 m_curFontSize = m_config.fontSize();
275 emit slotSetFont( m_curFontSize ); 275 emit slotSetFont( m_curFontSize );
276 } 276 }
277 m_abView -> setListOrder( m_config.orderList() ); 277 m_abView -> setListOrder( m_config.orderList() );
278 } 278 }
279 279
280 delete dlg; 280 delete dlg;
281} 281}
282 282
283 283
284void AddressbookWindow::slotSetFont( int size ) 284void AddressbookWindow::slotSetFont( int size )
285{ 285{
286 qWarning("void AddressbookWindow::slotSetFont( %d )", size); 286 qWarning("void AddressbookWindow::slotSetFont( %d )", size);
287 287
288 if (size > 2 || size < 0) 288 if (size > 2 || size < 0)
289 size = 1; 289 size = 1;
290 290
291 m_config.setFontSize( size ); 291 m_config.setFontSize( size );
292 292
293 QFont *currentFont; 293 QFont *currentFont;
294 294
295 switch (size) { 295 switch (size) {
296 case 0: 296 case 0:
297 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); 297 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) );
298 currentFont = new QFont (m_abView->font()); 298 currentFont = new QFont (m_abView->font());
299 // abList->resizeRows(currentFont->pixelSize() + 7); :SX 299 // abList->resizeRows(currentFont->pixelSize() + 7); :SX
300 // abList->resizeRows(); 300 // abList->resizeRows();
301 break; 301 break;
302 case 1: 302 case 1:
303 m_abView->setFont( *defaultFont ); 303 m_abView->setFont( *defaultFont );
304 currentFont = new QFont (m_abView->font()); 304 currentFont = new QFont (m_abView->font());
305 // // abList->resizeRows(currentFont->pixelSize() + 7); 305 // // abList->resizeRows(currentFont->pixelSize() + 7);
306 // abList->resizeRows(); 306 // abList->resizeRows();
307 break; 307 break;
308 case 2: 308 case 2:
309 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); 309 m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) );
310 currentFont = new QFont (m_abView->font()); 310 currentFont = new QFont (m_abView->font());
311 // //abList->resizeRows(currentFont->pixelSize() + 7); 311 // //abList->resizeRows(currentFont->pixelSize() + 7);
312 // abList->resizeRows(); 312 // abList->resizeRows();
313 break; 313 break;
314 } 314 }
315} 315}
316 316
317 317
318 318
319void AddressbookWindow::importvCard() { 319void AddressbookWindow::importvCard() {
320 QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); 320 QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this );
321 if(!str.isEmpty() ){ 321 if(!str.isEmpty() ){
322 setDocument((const QString&) str ); 322 setDocument((const QString&) str );
323 } 323 }
324 324
325} 325}
326 326
327void AddressbookWindow::setDocument( const QString &filename ) 327void AddressbookWindow::setDocument( const QString &filename )
328{ 328{
329 qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); 329 qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() );
330 330
331 if ( filename.find(".vcf") != int(filename.length()) - 4 ){ 331 if ( filename.find(".vcf") != int(filename.length()) - 4 ){
332 332
333 333
334 334
335 switch( QMessageBox::information( this, tr ( "Right file type ?" ), 335 switch( QMessageBox::information( this, tr ( "Right file type ?" ),
336 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), 336 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ),
337 tr( "&Yes" ), tr( "&No" ), QString::null, 337 tr( "&Yes" ), tr( "&No" ), QString::null,
338 0, // Enter == button 0 338 0, // Enter == button 0
339 2 ) ) { // Escape == button 2 339 2 ) ) { // Escape == button 2
340 case 0: 340 case 0:
341 qWarning("YES clicked"); 341 qWarning("YES clicked");
342 break; 342 break;
343 case 1: 343 case 1:
344 qWarning("NO clicked"); 344 qWarning("NO clicked");
345 return; 345 return;
346 break; 346 break;
347 } 347 }
348 } 348 }
349 349
350 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 350 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
351 filename ); 351 filename );
352 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 352 OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
353 OContactAccess::List allList = access->allRecords(); 353 OContactAccess::List allList = access->allRecords();
354 qWarning( "Found number of contacts in File: %d", allList.count() ); 354 qWarning( "Found number of contacts in File: %d", allList.count() );
355 355
356 if ( !allList.count() ) {
357 QMessageBox::information( this, "Import VCard",
358 "It was impossible to import the VCard.\n"
359 "The VCard may be corrupted !" );
360 }
361
356 bool doAsk = true; 362 bool doAsk = true;
357 OContactAccess::List::Iterator it; 363 OContactAccess::List::Iterator it;
358 for ( it = allList.begin(); it != allList.end(); ++it ){ 364 for ( it = allList.begin(); it != allList.end(); ++it ){
359 qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); 365 qWarning("Adding Contact from: %s", (*it).fullName().latin1() );
360 if ( doAsk ){ 366 if ( doAsk ){
361 switch( QMessageBox::information( this, tr ( "Add Contact ?" ), 367 switch( QMessageBox::information( this, tr ( "Add Contact ?" ),
362 tr( "Do you really want add contact for \n%1 ?" ) 368 tr( "Do you really want add contact for \n%1 ?" )
363 .arg( (*it).fullName().latin1() ), 369 .arg( (*it).fullName().latin1() ),
364 tr( "&Yes" ), tr( "&No" ), tr( "&AllYes"), 370 tr( "&Yes" ), tr( "&No" ), tr( "&AllYes"),
365 0, // Enter == button 0 371 0, // Enter == button 0
366 2 ) ) { // Escape == button 2 372 2 ) ) { // Escape == button 2
367 case 0: 373 case 0:
368 qWarning("YES clicked"); 374 qWarning("YES clicked");
369 m_abView->addEntry( *it ); 375 m_abView->addEntry( *it );
370 break; 376 break;
371 case 1: 377 case 1:
372 qWarning("NO clicked"); 378 qWarning("NO clicked");
373 break; 379 break;
374 case 2: 380 case 2:
375 qWarning("YesAll clicked"); 381 qWarning("YesAll clicked");
376 doAsk = false; 382 doAsk = false;
377 break; 383 break;
378 } 384 }
379 }else 385 }else
380 m_abView->addEntry( *it ); 386 m_abView->addEntry( *it );
381 387
382 } 388 }
383 389
384 delete access; 390 delete access;
385} 391}
386 392
387void AddressbookWindow::resizeEvent( QResizeEvent *e ) 393void AddressbookWindow::resizeEvent( QResizeEvent *e )
388{ 394{
389 QMainWindow::resizeEvent( e ); 395 QMainWindow::resizeEvent( e );
390 396
391 397
392} 398}
393 399
394AddressbookWindow::~AddressbookWindow() 400AddressbookWindow::~AddressbookWindow()
395{ 401{
396 ToolBarDock dock; 402 ToolBarDock dock;
397 int dummy; 403 int dummy;
398 bool bDummy; 404 bool bDummy;
399 getLocation ( listTools, dock, dummy, bDummy, dummy ); 405 getLocation ( listTools, dock, dummy, bDummy, dummy );
400 m_config.setToolBarDock( dock ); 406 m_config.setToolBarDock( dock );
401 m_config.save(); 407 m_config.save();
402} 408}
403 409
404void AddressbookWindow::slotUpdateToolbar() 410void AddressbookWindow::slotUpdateToolbar()
405{ 411{
406 OContact ce = m_abView->currentEntry(); 412 OContact ce = m_abView->currentEntry();
407 actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); 413 actionMail->setEnabled( !ce.defaultEmail().isEmpty() );
408} 414}
409 415
410void AddressbookWindow::slotListNew() 416void AddressbookWindow::slotListNew()
411{ 417{
412 OContact cnt; 418 OContact cnt;
413 if( !syncing ) { 419 if( !syncing ) {
414 editEntry( NewEntry ); 420 editEntry( NewEntry );
415 } else { 421 } else {
416 QMessageBox::warning(this, tr("OContacts"), 422 QMessageBox::warning(this, tr("OContacts"),
417 tr("Can not edit data, currently syncing")); 423 tr("Can not edit data, currently syncing"));
418 } 424 }
419} 425}
420 426
421// void AddressbookWindow::slotListView() 427// void AddressbookWindow::slotListView()
422// { 428// {
423 // m_abView -> init( abList->currentEntry() ); 429 // m_abView -> init( abList->currentEntry() );
424 // // :SX mView->sync(); 430 // // :SX mView->sync();
425 // //:SXshowView(); 431 // //:SXshowView();
426// } 432// }
427 433
428void AddressbookWindow::slotListDelete() 434void AddressbookWindow::slotListDelete()
429{ 435{
430 if(!syncing) { 436 if(!syncing) {
431 OContact tmpEntry = m_abView ->currentEntry(); 437 OContact tmpEntry = m_abView ->currentEntry();
432 438
433 // get a name, do the best we can... 439 // get a name, do the best we can...
434 QString strName = tmpEntry.fullName(); 440 QString strName = tmpEntry.fullName();
435 if ( strName.isEmpty() ) { 441 if ( strName.isEmpty() ) {
436 strName = tmpEntry.company(); 442 strName = tmpEntry.company();
437 if ( strName.isEmpty() ) 443 if ( strName.isEmpty() )
438 strName = "No Name"; 444 strName = "No Name";
439 } 445 }
440 446
441 447
442 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), 448 if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ),
443 strName ) ) { 449 strName ) ) {
444 m_abView->removeEntry( tmpEntry.uid() ); 450 m_abView->removeEntry( tmpEntry.uid() );
445 } 451 }
446 } else { 452 } else {
447 QMessageBox::warning( this, tr("Contacts"), 453 QMessageBox::warning( this, tr("Contacts"),
448 tr("Can not edit data, currently syncing") ); 454 tr("Can not edit data, currently syncing") );
449 } 455 }
450} 456}
451 457