author | zautrix <zautrix> | 2005-06-28 21:26:55 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-28 21:26:55 (UTC) |
commit | f226b4cd2ce06a6948811fe04d80fe3ffa44f695 (patch) (unidiff) | |
tree | 32fc124bf593d6d854b1bf368b18f8db2aa6ff4b /kabc/addresseedialog.cpp | |
parent | 29fbaa763b39011bb1d19b1f5f705cab53ac0d7a (diff) | |
download | kdepimpi-f226b4cd2ce06a6948811fe04d80fe3ffa44f695.zip kdepimpi-f226b4cd2ce06a6948811fe04d80fe3ffa44f695.tar.gz kdepimpi-f226b4cd2ce06a6948811fe04d80fe3ffa44f695.tar.bz2 |
fixxx
-rw-r--r-- | kabc/addresseedialog.cpp | 65 |
1 files changed, 24 insertions, 41 deletions
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp index 0cf75a0..671787e 100644 --- a/kabc/addresseedialog.cpp +++ b/kabc/addresseedialog.cpp | |||
@@ -55,73 +55,56 @@ QString AddresseeItem::key( int column, bool ) const | |||
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 | ||
61 | AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : | 61 | AddresseeDialog::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 | ||
67 | QWidget *topWidget = plainPage(); | ||
68 | 67 | ||
69 | QBoxLayout *topLayout = new QHBoxLayout( topWidget ); | 68 | KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this ); |
70 | |||
71 | |||
72 | KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, topWidget); | ||
73 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 69 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
74 | 70 | setMainWidget( mMiniSplitter ); | |
75 | topLayout->addWidget(mMiniSplitter ); | ||
76 | 71 | ||
77 | QWidget *listWidget = new QWidget( mMiniSplitter ); | 72 | QWidget *listWidget = new QWidget( mMiniSplitter ); |
78 | 73 | ||
79 | QVBoxLayout *listLayout = new QVBoxLayout (listWidget) ; | 74 | QVBoxLayout *listLayout = new QVBoxLayout (listWidget) ; |
80 | //topLayout->addLayout( listLayout ); | 75 | //topLayout->addLayout( listLayout ); |
81 | 76 | ||
82 | mAddresseeList = new KListView( listWidget ); | 77 | mAddresseeList = new KListView( listWidget ); |
83 | mAddresseeList->addColumn( i18n("Name") ); | 78 | mAddresseeList->addColumn( i18n("Name") ); |
84 | mAddresseeList->addColumn( i18n("Email") ); | 79 | mAddresseeList->addColumn( i18n("Email") ); |
85 | mAddresseeList->addColumn( i18n("Category") ); | 80 | mAddresseeList->addColumn( i18n("Category") ); |
86 | mAddresseeList->setAllColumnsShowFocus( true ); | 81 | mAddresseeList->setAllColumnsShowFocus( true ); |
87 | mAddresseeList->setFullWidth( true ); | 82 | mAddresseeList->setFullWidth( true ); |
88 | listLayout->addWidget( mAddresseeList ); | 83 | listLayout->addWidget( mAddresseeList ); |
89 | connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ), | 84 | connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ), |
90 | SLOT( slotOk() ) ); | 85 | SLOT( slotOk() ) ); |
91 | |||
92 | //QHBox* searchBox = new QHBox ( listWidget ); | 86 | //QHBox* searchBox = new QHBox ( listWidget ); |
93 | mAddresseeEdit = new QLineEdit( listWidget ); | 87 | QHBox * hb = new QHBox ( listWidget ); |
88 | listLayout->addWidget ( hb ); | ||
89 | mAddresseeEdit = new QLineEdit( hb ); | ||
94 | connect( mAddresseeEdit, SIGNAL( returnPressed() ), | 90 | connect( mAddresseeEdit, SIGNAL( returnPressed() ), |
95 | SLOT( loadAddressBook() ) ); | 91 | SLOT( loadAddressBook() ) ); |
96 | mAddresseeEdit->setFocus(); | 92 | mAddresseeEdit->setFocus(); |
97 | QPushButton *searchButton = new QPushButton( i18n("Search!"), listWidget ); | 93 | QPushButton *searchButton = new QPushButton( i18n("Search!"), hb ); |
98 | connect ( searchButton, SIGNAL( clicked() ), SLOT( loadAddressBook() ) ); | 94 | connect ( searchButton, SIGNAL( clicked() ), SLOT( loadAddressBook() ) ); |
99 | 95 | if ( mMultiple ) { | |
100 | QHBoxLayout *searchLayout = new QHBoxLayout (listLayout) ; | 96 | |
101 | searchLayout->addWidget( mAddresseeEdit ); | 97 | mSelectedList = new KListView( mMiniSplitter ); |
102 | searchLayout->addWidget( searchButton ); | 98 | mSelectedList->addColumn( i18n("Selected Name") ); |
103 | //listLayout->addWidget( searchBox ); | ||
104 | |||
105 | if ( mMultiple ) { | ||
106 | //QBoxLayout *selectedLayout = new QVBoxLayout; | ||
107 | //topLayout->addLayout( selectedLayout ); | ||
108 | //topLayout->setSpacing( spacingHint() ); | ||
109 | |||
110 | QVBox *selectedGroup = new QVBox( mMiniSplitter ); | ||
111 | new QLabel ( i18n("Selected:"), selectedGroup ); | ||
112 | //selectedLayout->addWidget( selectedGroup ); | ||
113 | |||
114 | mSelectedList = new KListView( selectedGroup ); | ||
115 | mSelectedList->addColumn( i18n("Name") ); | ||
116 | mSelectedList->addColumn( i18n("Email") ); | 99 | mSelectedList->addColumn( i18n("Email") ); |
117 | mSelectedList->setAllColumnsShowFocus( true ); | 100 | mSelectedList->setAllColumnsShowFocus( true ); |
118 | mSelectedList->setFullWidth( true ); | 101 | mSelectedList->setFullWidth( true ); |
119 | //connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ), | 102 | //connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ), |
120 | // SLOT( removeSelected() ) ); | 103 | // SLOT( removeSelected() ) ); |
121 | connect( mSelectedList, SIGNAL( clicked( QListViewItem * ) ), | 104 | connect( mSelectedList, SIGNAL( clicked( QListViewItem * ) ), |
122 | SLOT( removeSelected() ) ); | 105 | SLOT( removeSelected() ) ); |
123 | connect( mSelectedList, SIGNAL( returnPressed( QListViewItem *) ), | 106 | connect( mSelectedList, SIGNAL( returnPressed( QListViewItem *) ), |
124 | SLOT( removeSelected() ) ); | 107 | SLOT( removeSelected() ) ); |
125 | 108 | ||
126 | #if 0 | 109 | #if 0 |
127 | QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup ); | 110 | QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup ); |
@@ -321,47 +304,47 @@ Addressee AddresseeDialog::getAddressee( QWidget *parent ) | |||
321 | 304 | ||
322 | delete dlg; | 305 | delete dlg; |
323 | return addressee; | 306 | return addressee; |
324 | } | 307 | } |
325 | 308 | ||
326 | Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) | 309 | Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) |
327 | { | 310 | { |
328 | Addressee::List addressees; | 311 | Addressee::List addressees; |
329 | static bool running = false; | 312 | static bool running = false; |
330 | if ( running ) return addressees; | 313 | if ( running ) return addressees; |
331 | running = true; | 314 | running = true; |
332 | AddresseeDialog *dlg = new AddresseeDialog( parent, true ); | 315 | AddresseeDialog *dlg = new AddresseeDialog( parent, true ); |
316 | #ifdef DESKTOP_VERSION | ||
333 | static int geoX = 0; | 317 | static int geoX = 0; |
334 | static int geoY = 0; | 318 | static int geoY = 0; |
335 | static int geoW = 0; | 319 | static int geoW = 0; |
336 | static int geoH = 0; | 320 | static int geoH = 0; |
337 | if ( QApplication::desktop()->width() <= 640 ) | 321 | if ( !geoX && ! geoY && !geoW &&!geoH ) { |
338 | dlg->showMaximized(); | 322 | geoX = dlg->geometry().x(); |
339 | else { | 323 | geoY = dlg->geometry().y(); |
340 | if ( !geoX && ! geoY && !geoW &&!geoH ) { | 324 | geoW = dlg->width(); |
341 | geoX = dlg->geometry().x(); | 325 | geoH = dlg->height(); |
342 | geoY = dlg->geometry().y(); | 326 | } |
343 | geoW = dlg->width(); | 327 | dlg->show(); |
344 | geoH = dlg->height(); | 328 | dlg->setGeometry(geoX , geoY,geoW , geoH ); |
345 | } else { | 329 | #else |
346 | dlg->show(); | 330 | dlg->showMaximized(); |
347 | dlg->setGeometry(geoX , geoY,geoW , geoH ); | 331 | #endif |
348 | |||
349 | } | ||
350 | } | ||
351 | int result = dlg->exec(); | 332 | int result = dlg->exec(); |
333 | #ifdef DESKTOP_VERSION | ||
352 | geoX = dlg->geometry().x(); | 334 | geoX = dlg->geometry().x(); |
353 | geoY = dlg->geometry().y(); | 335 | geoY = dlg->geometry().y(); |
354 | geoW = dlg->width(); | 336 | geoW = dlg->width(); |
355 | geoH = dlg->height(); | 337 | geoH = dlg->height(); |
338 | #endif | ||
356 | if ( result == QDialog::Accepted ) { | 339 | if ( result == QDialog::Accepted ) { |
357 | addressees = dlg->addressees(); | 340 | addressees = dlg->addressees(); |
358 | } | 341 | } |
359 | 342 | ||
360 | delete dlg; | 343 | delete dlg; |
361 | running = false; | 344 | running = false; |
362 | return addressees; | 345 | return addressees; |
363 | } | 346 | } |
364 | 347 | ||
365 | void AddresseeDialog::addressBookChanged() | 348 | void AddresseeDialog::addressBookChanged() |
366 | { | 349 | { |
367 | loadAddressBook(); | 350 | loadAddressBook(); |