author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/views/kaddressbooktableview.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'kaddressbook/views/kaddressbooktableview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 272f2eb..7efaaa9 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -1,17 +1,21 @@ | |||
1 | // $Id$ | 1 | // $Id$ |
2 | 2 | ||
3 | #include <qvbox.h> | 3 | #include <q3vbox.h> |
4 | #include <qlistbox.h> | 4 | #include <q3listbox.h> |
5 | #include <qwidget.h> | 5 | #include <qwidget.h> |
6 | #include <qfile.h> | 6 | #include <qfile.h> |
7 | #include <qimage.h> | 7 | #include <qimage.h> |
8 | #include <qcombobox.h> | 8 | #include <qcombobox.h> |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | #include <qdragobject.h> | 10 | #include <q3dragobject.h> |
11 | #include <qevent.h> | 11 | #include <qevent.h> |
12 | #include <qurl.h> | 12 | #include <q3url.h> |
13 | #include <qpixmap.h> | 13 | #include <qpixmap.h> |
14 | //Added by qt3to4: | ||
15 | #include <QDropEvent> | ||
16 | #include <QKeyEvent> | ||
17 | #include <Q3VBoxLayout> | ||
14 | 18 | ||
15 | #include <kabc/addressbook.h> | 19 | #include <kabc/addressbook.h> |
16 | #include <kapplication.h> | 20 | #include <kapplication.h> |
17 | #include <kconfig.h> | 21 | #include <kconfig.h> |
@@ -31,9 +35,9 @@ | |||
31 | #include "undocmds.h" | 35 | #include "undocmds.h" |
32 | #include "viewmanager.h" | 36 | #include "viewmanager.h" |
33 | 37 | ||
34 | #include <qlayout.h> | 38 | #include <qlayout.h> |
35 | #include <qheader.h> | 39 | #include <q3header.h> |
36 | #include <qregexp.h> | 40 | #include <qregexp.h> |
37 | 41 | ||
38 | #include "kaddressbooktableview.h" | 42 | #include "kaddressbooktableview.h" |
39 | 43 | ||
@@ -41,9 +45,9 @@ | |||
41 | KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, | 45 | KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, |
42 | QWidget *parent, const char *name ) | 46 | QWidget *parent, const char *name ) |
43 | : KAddressBookView( ab, parent, name ) | 47 | : KAddressBookView( ab, parent, name ) |
44 | { | 48 | { |
45 | mainLayout = new QVBoxLayout( viewWidget(), 2 ); | 49 | mainLayout = new Q3VBoxLayout( viewWidget(), 2 ); |
46 | 50 | ||
47 | // The list view will be created when the config is read. | 51 | // The list view will be created when the config is read. |
48 | mListView = 0; | 52 | mListView = 0; |
49 | } | 53 | } |
@@ -76,16 +80,16 @@ void KAddressBookTableView::reconstructListView() | |||
76 | if (mListView) | 80 | if (mListView) |
77 | { | 81 | { |
78 | disconnect(mListView, SIGNAL(selectionChanged()), | 82 | disconnect(mListView, SIGNAL(selectionChanged()), |
79 | this, SLOT(addresseeSelected())); | 83 | this, SLOT(addresseeSelected())); |
80 | disconnect(mListView, SIGNAL(executed(QListViewItem*)), | 84 | disconnect(mListView, SIGNAL(executed(Q3ListViewItem*)), |
81 | this, SLOT(addresseeExecuted(QListViewItem*))); | 85 | this, SLOT(addresseeExecuted(Q3ListViewItem*))); |
82 | disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), | 86 | disconnect(mListView, SIGNAL(doubleClicked(Q3ListViewItem*)), |
83 | this, SLOT(addresseeExecuted(QListViewItem*))); | 87 | this, SLOT(addresseeExecuted(Q3ListViewItem*))); |
84 | disconnect(mListView, SIGNAL(startAddresseeDrag()), this, | 88 | disconnect(mListView, SIGNAL(startAddresseeDrag()), this, |
85 | SIGNAL(startDrag())); | 89 | SIGNAL(startDrag())); |
86 | disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 90 | disconnect(mListView, SIGNAL(returnPressed(Q3ListViewItem*)), |
87 | this, SLOT(addresseeExecuted(QListViewItem*))); | 91 | this, SLOT(addresseeExecuted(Q3ListViewItem*))); |
88 | 92 | ||
89 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 93 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
90 | SIGNAL(dropped(QDropEvent*))); | 94 | SIGNAL(dropped(QDropEvent*))); |
91 | delete mListView; | 95 | delete mListView; |
@@ -104,9 +108,9 @@ void KAddressBookTableView::reconstructListView() | |||
104 | 108 | ||
105 | int c = 0; | 109 | int c = 0; |
106 | for( it = fieldList.begin(); it != fieldList.end(); ++it ) { | 110 | for( it = fieldList.begin(); it != fieldList.end(); ++it ) { |
107 | mListView->addColumn( (*it)->label() ); | 111 | mListView->addColumn( (*it)->label() ); |
108 | mListView->setColumnWidthMode(c++, QListView::Manual); | 112 | mListView->setColumnWidthMode(c++, Q3ListView::Manual); |
109 | //US | 113 | //US |
110 | // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); | 114 | // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); |
111 | } | 115 | } |
112 | 116 | ||
@@ -118,17 +122,17 @@ void KAddressBookTableView::reconstructListView() | |||
118 | SIGNAL(dropped(QDropEvent*))); | 122 | SIGNAL(dropped(QDropEvent*))); |
119 | 123 | ||
120 | if (KABPrefs::instance()->mHonorSingleClick) { | 124 | if (KABPrefs::instance()->mHonorSingleClick) { |
121 | // qDebug("KAddressBookTableView::reconstructListView single"); | 125 | // qDebug("KAddressBookTableView::reconstructListView single"); |
122 | connect(mListView, SIGNAL(executed(QListViewItem*)), | 126 | connect(mListView, SIGNAL(executed(Q3ListViewItem*)), |
123 | this, SLOT(addresseeExecuted(QListViewItem*))); | 127 | this, SLOT(addresseeExecuted(Q3ListViewItem*))); |
124 | } else { | 128 | } else { |
125 | // qDebug("KAddressBookTableView::reconstructListView double"); | 129 | // qDebug("KAddressBookTableView::reconstructListView double"); |
126 | connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), | 130 | connect(mListView, SIGNAL(doubleClicked(Q3ListViewItem*)), |
127 | this, SLOT(addresseeExecuted(QListViewItem*))); | 131 | this, SLOT(addresseeExecuted(Q3ListViewItem*))); |
128 | } | 132 | } |
129 | connect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 133 | connect(mListView, SIGNAL(returnPressed(Q3ListViewItem*)), |
130 | this, SLOT(addresseeExecuted(QListViewItem*))); | 134 | this, SLOT(addresseeExecuted(Q3ListViewItem*))); |
131 | connect(mListView, SIGNAL(signalDelete()), | 135 | connect(mListView, SIGNAL(signalDelete()), |
132 | this, SLOT(addresseeDeleted())); | 136 | this, SLOT(addresseeDeleted())); |
133 | 137 | ||
134 | //US performceimprovement. Refresh is done from the outside | 138 | //US performceimprovement. Refresh is done from the outside |
@@ -343,9 +347,9 @@ void KAddressBookTableView::refresh(QString uid) | |||
343 | } | 347 | } |
344 | } else { | 348 | } else { |
345 | // Only need to update on entry. Iterate through and try to find it | 349 | // Only need to update on entry. Iterate through and try to find it |
346 | ContactListViewItem *ceItem; | 350 | ContactListViewItem *ceItem; |
347 | QListViewItemIterator it( mListView ); | 351 | Q3ListViewItemIterator it( mListView ); |
348 | while ( it.current() ) { | 352 | while ( it.current() ) { |
349 | #ifndef KAB_EMBEDDED | 353 | #ifndef KAB_EMBEDDED |
350 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); | 354 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); |
351 | #else //KAB_EMBEDDED | 355 | #else //KAB_EMBEDDED |
@@ -365,9 +369,9 @@ void KAddressBookTableView::refresh(QString uid) | |||
365 | 369 | ||
366 | QStringList KAddressBookTableView::selectedUids() | 370 | QStringList KAddressBookTableView::selectedUids() |
367 | { | 371 | { |
368 | QStringList uidList; | 372 | QStringList uidList; |
369 | QListViewItem *item; | 373 | Q3ListViewItem *item; |
370 | ContactListViewItem *ceItem; | 374 | ContactListViewItem *ceItem; |
371 | 375 | ||
372 | for(item = mListView->firstChild(); item; item = item->itemBelow()) | 376 | for(item = mListView->firstChild(); item; item = item->itemBelow()) |
373 | { | 377 | { |
@@ -393,9 +397,9 @@ QStringList KAddressBookTableView::selectedUids() | |||
393 | } | 397 | } |
394 | 398 | ||
395 | void KAddressBookTableView::setSelected(QString uid, bool selected) | 399 | void KAddressBookTableView::setSelected(QString uid, bool selected) |
396 | { | 400 | { |
397 | QListViewItem *item; | 401 | Q3ListViewItem *item; |
398 | ContactListViewItem *ceItem; | 402 | ContactListViewItem *ceItem; |
399 | 403 | ||
400 | if (uid.isNull()) | 404 | if (uid.isNull()) |
401 | { | 405 | { |
@@ -428,9 +432,9 @@ void KAddressBookTableView::addresseeSelected() | |||
428 | // We need to try to find the first selected item. This might not be the | 432 | // We need to try to find the first selected item. This might not be the |
429 | // last selected item, but when QListView is in multiselection mode, | 433 | // last selected item, but when QListView is in multiselection mode, |
430 | // there is no way to figure out which one was | 434 | // there is no way to figure out which one was |
431 | // selected last. | 435 | // selected last. |
432 | QListViewItem *item; | 436 | Q3ListViewItem *item; |
433 | bool found =false; | 437 | bool found =false; |
434 | for (item = mListView->firstChild(); item && !found; | 438 | for (item = mListView->firstChild(); item && !found; |
435 | item = item->nextSibling()) | 439 | item = item->nextSibling()) |
436 | { | 440 | { |
@@ -452,9 +456,9 @@ void KAddressBookTableView::addresseeSelected() | |||
452 | if (!found) | 456 | if (!found) |
453 | emit selected(QString::null); | 457 | emit selected(QString::null); |
454 | } | 458 | } |
455 | 459 | ||
456 | void KAddressBookTableView::addresseeExecuted(QListViewItem *item) | 460 | void KAddressBookTableView::addresseeExecuted(Q3ListViewItem *item) |
457 | { | 461 | { |
458 | if (item) | 462 | if (item) |
459 | { | 463 | { |
460 | #ifndef KAB_EMBEDDED | 464 | #ifndef KAB_EMBEDDED |
@@ -486,7 +490,7 @@ void KAddressBookTableView::addresseeDeleted() | |||
486 | 490 | ||
487 | 491 | ||
488 | 492 | ||
489 | 493 | ||
490 | #ifndef KAB_EMBEDDED | 494 | #ifndef KAB_EMBEDDED_ |
491 | #include "kaddressbooktableview.moc" | 495 | #include "moc_kaddressbooktableview.cpp" |
492 | #endif //KAB_EMBEDDED | 496 | #endif //KAB_EMBEDDED |