author | zautrix <zautrix> | 2005-04-03 04:33:19 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-03 04:33:19 (UTC) |
commit | f6c8249db564c1276d4c7ed5ad88c6fbac361b8d (patch) (unidiff) | |
tree | 8e5b6e2d6f9a7bc00326f7c0115bf2af53ae9ce8 /kabc | |
parent | 40e5edc1ab153144f0e824ad2d3a0ab37357e408 (diff) | |
download | kdepimpi-f6c8249db564c1276d4c7ed5ad88c6fbac361b8d.zip kdepimpi-f6c8249db564c1276d4c7ed5ad88c6fbac361b8d.tar.gz kdepimpi-f6c8249db564c1276d4c7ed5ad88c6fbac361b8d.tar.bz2 |
fixes
-rw-r--r-- | kabc/addresseedialog.cpp | 80 |
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 | |||
@@ -105,51 +105,52 @@ AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : | |||
105 | new QLabel ( i18n("Selected:"), selectedGroup ); | 105 | new QLabel ( i18n("Selected:"), selectedGroup ); |
106 | //selectedLayout->addWidget( selectedGroup ); | 106 | //selectedLayout->addWidget( selectedGroup ); |
107 | 107 | ||
108 | mSelectedList = new KListView( selectedGroup ); | 108 | mSelectedList = new KListView( selectedGroup ); |
109 | mSelectedList->addColumn( i18n("Name") ); | 109 | mSelectedList->addColumn( i18n("Name") ); |
110 | mSelectedList->addColumn( i18n("Email") ); | 110 | mSelectedList->addColumn( i18n("Email") ); |
111 | mSelectedList->setAllColumnsShowFocus( true ); | 111 | mSelectedList->setAllColumnsShowFocus( true ); |
112 | mSelectedList->setFullWidth( true ); | 112 | mSelectedList->setFullWidth( true ); |
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 | ||
139 | AddresseeDialog::~AddresseeDialog() | 140 | AddresseeDialog::~AddresseeDialog() |
140 | { | 141 | { |
141 | qDebug("DELETE AddresseeDialog "); | 142 | qDebug("DELETE AddresseeDialog "); |
142 | } | 143 | } |
143 | 144 | ||
144 | void AddresseeDialog::loadAddressBook() | 145 | void AddresseeDialog::loadAddressBook() |
145 | { | 146 | { |
146 | mAddresseeList->clear(); | 147 | mAddresseeList->clear(); |
147 | mItemDict.clear(); | 148 | mItemDict.clear(); |
148 | if ( mAddresseeEdit->text().isEmpty() ) { | 149 | if ( mAddresseeEdit->text().isEmpty() ) { |
149 | AddressBook::Iterator it; | 150 | AddressBook::Iterator it; |
150 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 151 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
151 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 152 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
152 | continue; | 153 | continue; |
153 | new AddresseeItem( mAddresseeList, (*it) ); | 154 | new AddresseeItem( mAddresseeList, (*it) ); |
154 | } | 155 | } |
155 | return; | 156 | return; |
@@ -257,55 +258,96 @@ Addressee AddresseeDialog::addressee() | |||
257 | Addressee::List AddresseeDialog::addressees() | 258 | Addressee::List AddresseeDialog::addressees() |
258 | { | 259 | { |
259 | Addressee::List al; | 260 | Addressee::List al; |
260 | AddresseeItem *aItem = 0; | 261 | AddresseeItem *aItem = 0; |
261 | 262 | ||
262 | if ( mMultiple ) { | 263 | if ( mMultiple ) { |
263 | QListViewItem *item = mSelectedList->firstChild(); | 264 | QListViewItem *item = mSelectedList->firstChild(); |
264 | while( item ) { | 265 | while( item ) { |
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 | ||
279 | Addressee AddresseeDialog::getAddressee( QWidget *parent ) | 280 | Addressee 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 | ||
293 | Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) | 315 | Addressee::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 | ||
308 | void AddresseeDialog::addressBookChanged() | 350 | void AddresseeDialog::addressBookChanged() |
309 | { | 351 | { |
310 | loadAddressBook(); | 352 | loadAddressBook(); |
311 | } | 353 | } |