summaryrefslogtreecommitdiffabout
path: root/kabc/addresseedialog.cpp
Unidiff
Diffstat (limited to 'kabc/addresseedialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseedialog.cpp80
1 files changed, 61 insertions, 19 deletions
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp
index 648e780..19b52bb 100644
--- a/kabc/addresseedialog.cpp
+++ b/kabc/addresseedialog.cpp
@@ -113,35 +113,36 @@ AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) :
113 connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ), 113 connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ),
114 SLOT( removeSelected() ) ); 114 SLOT( removeSelected() ) );
115 115
116 QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup ); 116 QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup );
117 connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) ); 117 connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) );
118 118
119 connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ), 119 connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ),
120 SLOT( addSelected( QListViewItem * ) ) ); 120 SLOT( addSelected( QListViewItem * ) ) );
121 connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ), 121 connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ),
122 SLOT( selectNextItem( QListViewItem * ) ) ); 122 SLOT( selectNextItem( QListViewItem * ) ) );
123 123
124 } 124 }
125 125
126 mAddressBook = StdAddressBook::self( true ); 126 mAddressBook = StdAddressBook::self( true );
127 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ), 127 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ),
128 SLOT( addressBookChanged() ) ); 128 SLOT( addressBookChanged() ) );
129#if 0
129 connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ), 130 connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ),
130 SLOT( addressBookChanged() ) ); 131 SLOT( addressBookChanged() ) );
131 132#endif
132 loadAddressBook(); 133 loadAddressBook();
133 QValueList<int> splitterSize; 134 QValueList<int> splitterSize;
134 splitterSize.append( ( width() / 5 ) * 3 ); 135 splitterSize.append( ( width() / 5 ) * 3 );
135 splitterSize.append( ( width() / 5 ) *2 ); 136 splitterSize.append( ( width() / 5 ) *2 );
136 mMiniSplitter->setSizes( splitterSize ); 137 mMiniSplitter->setSizes( splitterSize );
137} 138}
138 139
139AddresseeDialog::~AddresseeDialog() 140AddresseeDialog::~AddresseeDialog()
140{ 141{
141 qDebug("DELETE AddresseeDialog "); 142 qDebug("DELETE AddresseeDialog ");
142} 143}
143 144
144void AddresseeDialog::loadAddressBook() 145void AddresseeDialog::loadAddressBook()
145{ 146{
146 mAddresseeList->clear(); 147 mAddresseeList->clear();
147 mItemDict.clear(); 148 mItemDict.clear();
@@ -265,47 +266,88 @@ Addressee::List AddresseeDialog::addressees()
265 aItem = (AddresseeItem *)( item ); 266 aItem = (AddresseeItem *)( item );
266 if ( aItem ) al.append( aItem->addressee() ); 267 if ( aItem ) al.append( aItem->addressee() );
267 item = item->nextSibling(); 268 item = item->nextSibling();
268 } 269 }
269 } 270 }
270 else 271 else
271 { 272 {
272 aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); 273 aItem = (AddresseeItem *)( mAddresseeList->selectedItem() );
273 if (aItem) al.append( aItem->addressee() ); 274 if (aItem) al.append( aItem->addressee() );
274 } 275 }
275 276
276 return al; 277 return al;
277} 278}
278 279
279Addressee AddresseeDialog::getAddressee( QWidget *parent ) 280Addressee AddresseeDialog::getAddressee( QWidget *parent )
280{ 281{
281 AddresseeDialog *dlg = new AddresseeDialog( parent ); 282 AddresseeDialog *dlg = new AddresseeDialog( parent );
282 Addressee addressee; 283 Addressee addressee;
283 int result = dlg->exec(); 284#ifdef DESKTOP_VERSION
285 static int geoX = 0;
286 static int geoY = 0;
287 static int geoW = 0;
288 static int geoH = 0;
289 if ( !geoX && ! geoY && !geoW &&!geoH ) {
290 geoX = dlg->geometry().x();
291 geoY = dlg->geometry().y();
292 geoW = dlg->width();
293 geoH = dlg->height();
294 } else {
295 dlg->show();
296 dlg->setGeometry(geoX , geoY,geoW , geoH );
284 297
285 if ( result == QDialog::Accepted ) { 298 }
286 addressee = dlg->addressee(); 299#endif
287 } 300 int result = dlg->exec();
301#ifdef DESKTOP_VERSION
302 geoX = dlg->geometry().x();
303 geoY = dlg->geometry().y();
304 geoW = dlg->width();
305 geoH = dlg->height();
306#endif
307 if ( result == QDialog::Accepted ) {
308 addressee = dlg->addressee();
309 }
288 310
289 delete dlg; 311 delete dlg;
290 return addressee; 312 return addressee;
291} 313}
292 314
293Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) 315Addressee::List AddresseeDialog::getAddressees( QWidget *parent )
294{ 316{
295 AddresseeDialog *dlg = new AddresseeDialog( parent, true ); 317 AddresseeDialog *dlg = new AddresseeDialog( parent, true );
296 Addressee::List addressees; 318 Addressee::List addressees;
297 if ( QApplication::desktop()->width() <= 640 ) 319 static int geoX = 0;
298 dlg->showMaximized(); 320 static int geoY = 0;
299 int result = dlg->exec(); 321 static int geoW = 0;
300 if ( result == QDialog::Accepted ) { 322 static int geoH = 0;
301 addressees = dlg->addressees(); 323 if ( QApplication::desktop()->width() <= 640 )
302 } 324 dlg->showMaximized();
325 else {
326 if ( !geoX && ! geoY && !geoW &&!geoH ) {
327 geoX = dlg->geometry().x();
328 geoY = dlg->geometry().y();
329 geoW = dlg->width();
330 geoH = dlg->height();
331 } else {
332 dlg->show();
333 dlg->setGeometry(geoX , geoY,geoW , geoH );
334
335 }
336 }
337 int result = dlg->exec();
338 geoX = dlg->geometry().x();
339 geoY = dlg->geometry().y();
340 geoW = dlg->width();
341 geoH = dlg->height();
342 if ( result == QDialog::Accepted ) {
343 addressees = dlg->addressees();
344 }
303 345
304 delete dlg; 346 delete dlg;
305 return addressees; 347 return addressees;
306} 348}
307 349
308void AddresseeDialog::addressBookChanged() 350void AddresseeDialog::addressBookChanged()
309{ 351{
310 loadAddressBook(); 352 loadAddressBook();
311} 353}