summaryrefslogtreecommitdiffabout
path: root/kabc/addresseedialog.cpp
Unidiff
Diffstat (limited to 'kabc/addresseedialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseedialog.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp
index 9197850..0cf75a0 100644
--- a/kabc/addresseedialog.cpp
+++ b/kabc/addresseedialog.cpp
@@ -42,48 +42,49 @@ AddresseeItem::AddresseeItem( QListView *parent, const Addressee &addressee ) :
42 QListViewItem( parent ), 42 QListViewItem( parent ),
43 mAddressee( addressee ) 43 mAddressee( addressee )
44{ 44{
45 setText( Name,addressee.realName()); 45 setText( Name,addressee.realName());
46 setText( Email, addressee.preferredEmail() ); 46 setText( Email, addressee.preferredEmail() );
47 setText( Category, addressee.categories().join(";") ); 47 setText( Category, addressee.categories().join(";") );
48} 48}
49 49
50QString AddresseeItem::key( int column, bool ) const 50QString AddresseeItem::key( int column, bool ) const
51{ 51{
52 52
53 if (column == Email) { 53 if (column == Email) {
54 QString value = text(Email); 54 QString value = text(Email);
55 int val = value.findRev("@"); 55 int val = value.findRev("@");
56 return value.mid( val) + value.left( val ); 56 return value.mid( val) + value.left( val );
57 } 57 }
58 return text(column).lower(); 58 return text(column).lower();
59} 59}
60 60
61AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : 61AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) :
62 KDialogBase( KDialogBase::Plain, i18n("Select Addressee"), 62 KDialogBase( KDialogBase::Plain, i18n("Select Addressee"),
63 Ok|Cancel, No, parent ), mMultiple( multiple ) 63 Ok|Cancel, No, parent ), mMultiple( multiple )
64{ 64{
65 qDebug("NEW AddresseeDialog "); 65 qDebug("NEW AddresseeDialog ");
66
66 QWidget *topWidget = plainPage(); 67 QWidget *topWidget = plainPage();
67 68
68 QBoxLayout *topLayout = new QHBoxLayout( topWidget ); 69 QBoxLayout *topLayout = new QHBoxLayout( topWidget );
69 70
70 71
71 KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, topWidget); 72 KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, topWidget);
72 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 73 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
73 74
74 topLayout->addWidget(mMiniSplitter ); 75 topLayout->addWidget(mMiniSplitter );
75 76
76 QWidget *listWidget = new QWidget( mMiniSplitter ); 77 QWidget *listWidget = new QWidget( mMiniSplitter );
77 78
78 QVBoxLayout *listLayout = new QVBoxLayout (listWidget) ; 79 QVBoxLayout *listLayout = new QVBoxLayout (listWidget) ;
79 //topLayout->addLayout( listLayout ); 80 //topLayout->addLayout( listLayout );
80 81
81 mAddresseeList = new KListView( listWidget ); 82 mAddresseeList = new KListView( listWidget );
82 mAddresseeList->addColumn( i18n("Name") ); 83 mAddresseeList->addColumn( i18n("Name") );
83 mAddresseeList->addColumn( i18n("Email") ); 84 mAddresseeList->addColumn( i18n("Email") );
84 mAddresseeList->addColumn( i18n("Category") ); 85 mAddresseeList->addColumn( i18n("Category") );
85 mAddresseeList->setAllColumnsShowFocus( true ); 86 mAddresseeList->setAllColumnsShowFocus( true );
86 mAddresseeList->setFullWidth( true ); 87 mAddresseeList->setFullWidth( true );
87 listLayout->addWidget( mAddresseeList ); 88 listLayout->addWidget( mAddresseeList );
88 connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ), 89 connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ),
89 SLOT( slotOk() ) ); 90 SLOT( slotOk() ) );
@@ -303,61 +304,65 @@ Addressee AddresseeDialog::getAddressee( QWidget *parent )
303 geoH = dlg->height(); 304 geoH = dlg->height();
304 } else { 305 } else {
305 dlg->show(); 306 dlg->show();
306 dlg->setGeometry(geoX , geoY,geoW , geoH ); 307 dlg->setGeometry(geoX , geoY,geoW , geoH );
307 308
308 } 309 }
309#endif 310#endif
310 int result = dlg->exec(); 311 int result = dlg->exec();
311#ifdef DESKTOP_VERSION 312#ifdef DESKTOP_VERSION
312 geoX = dlg->geometry().x(); 313 geoX = dlg->geometry().x();
313 geoY = dlg->geometry().y(); 314 geoY = dlg->geometry().y();
314 geoW = dlg->width(); 315 geoW = dlg->width();
315 geoH = dlg->height(); 316 geoH = dlg->height();
316#endif 317#endif
317 if ( result == QDialog::Accepted ) { 318 if ( result == QDialog::Accepted ) {
318 addressee = dlg->addressee(); 319 addressee = dlg->addressee();
319 } 320 }
320 321
321 delete dlg; 322 delete dlg;
322 return addressee; 323 return addressee;
323} 324}
324 325
325Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) 326Addressee::List AddresseeDialog::getAddressees( QWidget *parent )
326{ 327{
327 AddresseeDialog *dlg = new AddresseeDialog( parent, true );
328 Addressee::List addressees; 328 Addressee::List addressees;
329 static bool running = false;
330 if ( running ) return addressees;
331 running = true;
332 AddresseeDialog *dlg = new AddresseeDialog( parent, true );
329 static int geoX = 0; 333 static int geoX = 0;
330 static int geoY = 0; 334 static int geoY = 0;
331 static int geoW = 0; 335 static int geoW = 0;
332 static int geoH = 0; 336 static int geoH = 0;
333 if ( QApplication::desktop()->width() <= 640 ) 337 if ( QApplication::desktop()->width() <= 640 )
334 dlg->showMaximized(); 338 dlg->showMaximized();
335 else { 339 else {
336 if ( !geoX && ! geoY && !geoW &&!geoH ) { 340 if ( !geoX && ! geoY && !geoW &&!geoH ) {
337 geoX = dlg->geometry().x(); 341 geoX = dlg->geometry().x();
338 geoY = dlg->geometry().y(); 342 geoY = dlg->geometry().y();
339 geoW = dlg->width(); 343 geoW = dlg->width();
340 geoH = dlg->height(); 344 geoH = dlg->height();
341 } else { 345 } else {
342 dlg->show(); 346 dlg->show();
343 dlg->setGeometry(geoX , geoY,geoW , geoH ); 347 dlg->setGeometry(geoX , geoY,geoW , geoH );
344 348
345 } 349 }
346 } 350 }
347 int result = dlg->exec(); 351 int result = dlg->exec();
348 geoX = dlg->geometry().x(); 352 geoX = dlg->geometry().x();
349 geoY = dlg->geometry().y(); 353 geoY = dlg->geometry().y();
350 geoW = dlg->width(); 354 geoW = dlg->width();
351 geoH = dlg->height(); 355 geoH = dlg->height();
352 if ( result == QDialog::Accepted ) { 356 if ( result == QDialog::Accepted ) {
353 addressees = dlg->addressees(); 357 addressees = dlg->addressees();
354 } 358 }
355 359
356 delete dlg; 360 delete dlg;
361 running = false;
357 return addressees; 362 return addressees;
358} 363}
359 364
360void AddresseeDialog::addressBookChanged() 365void AddresseeDialog::addressBookChanged()
361{ 366{
362 loadAddressBook(); 367 loadAddressBook();
363} 368}