-rw-r--r-- | kaddressbook/views/cardview.cpp | 114 | ||||
-rw-r--r-- | kaddressbook/views/cardview.h | 14 | ||||
-rw-r--r-- | kaddressbook/views/colorlistbox.cpp | 25 | ||||
-rw-r--r-- | kaddressbook/views/colorlistbox.h | 15 | ||||
-rw-r--r-- | kaddressbook/views/configurecardviewdialog.cpp | 57 | ||||
-rw-r--r-- | kaddressbook/views/configurecardviewdialog.h | 6 | ||||
-rw-r--r-- | kaddressbook/views/configuretableviewdialog.cpp | 35 | ||||
-rw-r--r-- | kaddressbook/views/configuretableviewdialog.h | 6 | ||||
-rw-r--r-- | kaddressbook/views/contactlistview.cpp | 32 | ||||
-rw-r--r-- | kaddressbook/views/contactlistview.h | 6 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 19 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.h | 3 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 60 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.h | 29 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 56 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.h | 18 |
16 files changed, 283 insertions, 212 deletions
diff --git a/kaddressbook/views/cardview.cpp b/kaddressbook/views/cardview.cpp index b6e053f..1a29f41 100644 --- a/kaddressbook/views/cardview.cpp +++ b/kaddressbook/views/cardview.cpp | |||
@@ -31,12 +31,20 @@ | |||
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qlabel.h> | 32 | #include <qlabel.h> |
33 | #include <qstyle.h> | 33 | #include <qstyle.h> |
34 | #include <qcursor.h> | 34 | #include <qcursor.h> |
35 | #include <qtooltip.h> | 35 | #include <qtooltip.h> |
36 | #include <qapplication.h> | 36 | #include <qapplication.h> |
37 | //Added by qt3to4: | ||
38 | #include <QKeyEvent> | ||
39 | #include <Q3PtrList> | ||
40 | #include <QResizeEvent> | ||
41 | #include <QFocusEvent> | ||
42 | #include <QMouseEvent> | ||
43 | #include <QEvent> | ||
44 | #include <QWheelEvent> | ||
37 | 45 | ||
38 | #include "kabprefs.h" | 46 | #include "kabprefs.h" |
39 | #include <kdebug.h> | 47 | #include <kdebug.h> |
40 | #include <kglobalsettings.h> | 48 | #include <kglobalsettings.h> |
41 | //END includes | 49 | //END includes |
42 | 50 | ||
@@ -68,17 +76,17 @@ class CardViewTip : public QLabel { | |||
68 | 76 | ||
69 | 77 | ||
70 | // | 78 | // |
71 | // Warning: make sure you use findRef() instead of find() to find an | 79 | // Warning: make sure you use findRef() instead of find() to find an |
72 | // item! Only the pointer value is unique in the list. | 80 | // item! Only the pointer value is unique in the list. |
73 | // | 81 | // |
74 | class CardViewItemList : public QPtrList<CardViewItem> | 82 | class CardViewItemList : public Q3PtrList<CardViewItem> |
75 | { | 83 | { |
76 | protected: | 84 | protected: |
77 | virtual int compareItems(QPtrCollection::Item item1, | 85 | virtual int compareItems(Q3PtrCollection::Item item1, |
78 | QPtrCollection::Item item2) | 86 | Q3PtrCollection::Item item2) |
79 | { | 87 | { |
80 | CardViewItem *cItem1 = (CardViewItem*)item1; | 88 | CardViewItem *cItem1 = (CardViewItem*)item1; |
81 | CardViewItem *cItem2 = (CardViewItem*)item2; | 89 | CardViewItem *cItem2 = (CardViewItem*)item2; |
82 | 90 | ||
83 | if ( cItem1 == cItem2 ) | 91 | if ( cItem1 == cItem2 ) |
84 | return 0; | 92 | return 0; |
@@ -158,13 +166,13 @@ class CardViewPrivate | |||
158 | mResizeAnchor(0), | 166 | mResizeAnchor(0), |
159 | mRubberBandAnchor( 0 ), | 167 | mRubberBandAnchor( 0 ), |
160 | mCompText( QString::null ) | 168 | mCompText( QString::null ) |
161 | {}; | 169 | {}; |
162 | 170 | ||
163 | CardViewItemList mItemList; | 171 | CardViewItemList mItemList; |
164 | QPtrList<CardViewSeparator> mSeparatorList; | 172 | Q3PtrList<CardViewSeparator> mSeparatorList; |
165 | QFontMetrics *mFm; | 173 | QFontMetrics *mFm; |
166 | QFontMetrics *mBFm; // bold font | 174 | QFontMetrics *mBFm; // bold font |
167 | QFont mHeaderFont; // custom header font | 175 | QFont mHeaderFont; // custom header font |
168 | CardView::SelectionMode mSelectionMode; | 176 | CardView::SelectionMode mSelectionMode; |
169 | bool mDrawCardBorder; | 177 | bool mDrawCardBorder; |
170 | bool mDrawFieldLabels; | 178 | bool mDrawFieldLabels; |
@@ -205,13 +213,13 @@ class CardViewItemPrivate | |||
205 | mSelected( false ), | 213 | mSelected( false ), |
206 | x( 0 ), | 214 | x( 0 ), |
207 | y( 0 ){}; | 215 | y( 0 ){}; |
208 | 216 | ||
209 | 217 | ||
210 | QString mCaption; | 218 | QString mCaption; |
211 | QPtrList< CardViewItem::Field > mFieldList; | 219 | Q3PtrList< CardViewItem::Field > mFieldList; |
212 | bool mSelected; | 220 | bool mSelected; |
213 | int x; // horizontal position, set by the view | 221 | int x; // horizontal position, set by the view |
214 | int y; // vertical position, set by the view | 222 | int y; // vertical position, set by the view |
215 | int maxLabelWidth; // the width of the widest label, according to the view font. | 223 | int maxLabelWidth; // the width of the widest label, according to the view font. |
216 | int hcache; // height cache | 224 | int hcache; // height cache |
217 | }; | 225 | }; |
@@ -310,13 +318,13 @@ void CardViewItem::paintCard(QPainter *p, QColorGroup &cg) | |||
310 | else | 318 | else |
311 | p->setPen(cg.buttonText()); | 319 | p->setPen(cg.buttonText()); |
312 | p->drawText(2+mg, 2+mg + bFm.ascent()/*bFm.height()*//*-bFm.descent()*//*-bFm.leading()*/, trimString(d->mCaption, w-4, bFm)); | 320 | p->drawText(2+mg, 2+mg + bFm.ascent()/*bFm.height()*//*-bFm.descent()*//*-bFm.leading()*/, trimString(d->mCaption, w-4, bFm)); |
313 | p->restore(); | 321 | p->restore(); |
314 | 322 | ||
315 | // Go through the fields and draw them | 323 | // Go through the fields and draw them |
316 | QPtrListIterator< CardViewItem::Field > iter(d->mFieldList); | 324 | Q3PtrListIterator< CardViewItem::Field > iter(d->mFieldList); |
317 | QString label, value; | 325 | QString label, value; |
318 | int yPos = mg + 4 + bFm.height()/* + 1*/ + fm.height(); // why the + 1 ??? (anders) | 326 | int yPos = mg + 4 + bFm.height()/* + 1*/ + fm.height(); // why the + 1 ??? (anders) |
319 | p->setPen(cg.text()); | 327 | p->setPen(cg.text()); |
320 | 328 | ||
321 | int fh = fm.height(); | 329 | int fh = fm.height(); |
322 | int cln( 0 ); | 330 | int cln( 0 ); |
@@ -405,18 +413,18 @@ int CardViewItem::height( bool allowCache ) const | |||
405 | bool sef = mView->showEmptyFields(); | 413 | bool sef = mView->showEmptyFields(); |
406 | int fh = mView->d->mFm->height();//lineSpacing(); // font height | 414 | int fh = mView->d->mFm->height();//lineSpacing(); // font height |
407 | //int sp = QMAX( 0, 2- mView->d->mFm->leading() ); // field spacing NOTE make a property | 415 | //int sp = QMAX( 0, 2- mView->d->mFm->leading() ); // field spacing NOTE make a property |
408 | int fieldHeight = 0; | 416 | int fieldHeight = 0; |
409 | int lines; | 417 | int lines; |
410 | int maxLines( mView->maxFieldLines() ); | 418 | int maxLines( mView->maxFieldLines() ); |
411 | QPtrListIterator< CardViewItem::Field > iter(d->mFieldList); | 419 | Q3PtrListIterator< CardViewItem::Field > iter(d->mFieldList); |
412 | for (iter.toFirst(); iter.current(); ++iter) | 420 | for (iter.toFirst(); iter.current(); ++iter) |
413 | { | 421 | { |
414 | if ( !sef && (*iter)->second.isEmpty() ) | 422 | if ( !sef && (*iter)->second.isEmpty() ) |
415 | continue; | 423 | continue; |
416 | lines = QMIN( (*iter)->second.contains('\n') + 1, maxLines ); | 424 | lines = QMIN( (*iter)->second.count('\n') + 1, maxLines ); |
417 | fieldHeight += ( lines * fh ) + 2;//sp; | 425 | fieldHeight += ( lines * fh ) + 2;//sp; |
418 | } | 426 | } |
419 | 427 | ||
420 | // height of caption font (bold) | 428 | // height of caption font (bold) |
421 | fieldHeight += mView->d->mBFm->height(); | 429 | fieldHeight += mView->d->mBFm->height(); |
422 | d->hcache = baseHeight + fieldHeight; | 430 | d->hcache = baseHeight + fieldHeight; |
@@ -447,13 +455,13 @@ void CardViewItem::insertField(const QString &label, const QString &value) | |||
447 | } | 455 | } |
448 | 456 | ||
449 | void CardViewItem::removeField(const QString &label) | 457 | void CardViewItem::removeField(const QString &label) |
450 | { | 458 | { |
451 | CardViewItem::Field *f; | 459 | CardViewItem::Field *f; |
452 | 460 | ||
453 | QPtrListIterator< CardViewItem::Field > iter(d->mFieldList); | 461 | Q3PtrListIterator< CardViewItem::Field > iter(d->mFieldList); |
454 | for (iter.toFirst(); iter.current(); ++iter) | 462 | for (iter.toFirst(); iter.current(); ++iter) |
455 | { | 463 | { |
456 | f = *iter; | 464 | f = *iter; |
457 | if (f->first == label) | 465 | if (f->first == label) |
458 | break; | 466 | break; |
459 | } | 467 | } |
@@ -520,13 +528,13 @@ void CardViewItem::setCaption(const QString &caption) | |||
520 | d->mCaption = caption; | 528 | d->mCaption = caption; |
521 | repaintCard(); | 529 | repaintCard(); |
522 | } | 530 | } |
523 | 531 | ||
524 | QString CardViewItem::fieldValue(const QString &label) | 532 | QString CardViewItem::fieldValue(const QString &label) |
525 | { | 533 | { |
526 | QPtrListIterator< CardViewItem::Field > iter(d->mFieldList); | 534 | Q3PtrListIterator< CardViewItem::Field > iter(d->mFieldList); |
527 | for (iter.toFirst(); iter.current(); ++iter) | 535 | for (iter.toFirst(); iter.current(); ++iter) |
528 | if ((*iter)->first == label) | 536 | if ((*iter)->first == label) |
529 | return (*iter)->second; | 537 | return (*iter)->second; |
530 | 538 | ||
531 | return QString(); | 539 | return QString(); |
532 | } | 540 | } |
@@ -566,13 +574,13 @@ void CardViewItem::showFullString( const QPoint &itempos, CardViewTip *tip ) | |||
566 | bool se = mView->showEmptyFields(); | 574 | bool se = mView->showEmptyFields(); |
567 | int fh = mView->d->mFm->height(); | 575 | int fh = mView->d->mFm->height(); |
568 | // { | 576 | // { |
569 | Field *_f; | 577 | Field *_f; |
570 | for (_f = d->mFieldList.first(); _f != f; _f = d->mFieldList.next()) | 578 | for (_f = d->mFieldList.first(); _f != f; _f = d->mFieldList.next()) |
571 | if ( se || ! _f->second.isEmpty() ) | 579 | if ( se || ! _f->second.isEmpty() ) |
572 | y += ( QMIN(_f->second.contains('\n')+1, maxLines) * fh ) + 2; | 580 | y += ( QMIN(_f->second.count('\n')+1, maxLines) * fh ) + 2; |
573 | // } | 581 | // } |
574 | if ( isLabel && itempos.y() > y + fh ) | 582 | if ( isLabel && itempos.y() > y + fh ) |
575 | return; | 583 | return; |
576 | // label or data? | 584 | // label or data? |
577 | s = isLabel ? f->first : f->second; | 585 | s = isLabel ? f->first : f->second; |
578 | // trimmed? | 586 | // trimmed? |
@@ -583,13 +591,13 @@ void CardViewItem::showFullString( const QPoint &itempos, CardViewTip *tip ) | |||
583 | int mw = isLabel ? lw - colonWidth : w - lw - (mrg*2); // max width for string | 591 | int mw = isLabel ? lw - colonWidth : w - lw - (mrg*2); // max width for string |
584 | if ( isLabel ) | 592 | if ( isLabel ) |
585 | { | 593 | { |
586 | trimmed = mView->d->mFm->width( s ) > mw - colonWidth; | 594 | trimmed = mView->d->mFm->width( s ) > mw - colonWidth; |
587 | } else { | 595 | } else { |
588 | QRect r( mView->d->mFm->boundingRect( 0, 0, INT_MAX, INT_MAX, Qt::AlignTop|Qt::AlignLeft, s ) ); | 596 | QRect r( mView->d->mFm->boundingRect( 0, 0, INT_MAX, INT_MAX, Qt::AlignTop|Qt::AlignLeft, s ) ); |
589 | trimmed = r.width() > mw || r.height()/fh > QMIN(s.contains('\n') + 1, maxLines); | 597 | trimmed = r.width() > mw || r.height()/fh > QMIN(s.count('\n') + 1, maxLines); |
590 | } | 598 | } |
591 | } | 599 | } |
592 | if ( trimmed ) | 600 | if ( trimmed ) |
593 | { | 601 | { |
594 | tip->setFont( (isLabel && !lw) ? mView->headerFont() : mView->font() ); // if condition is true, a header | 602 | tip->setFont( (isLabel && !lw) ? mView->headerFont() : mView->font() ); // if condition is true, a header |
595 | tip->setText( s ); | 603 | tip->setText( s ); |
@@ -623,24 +631,24 @@ CardViewItem::Field *CardViewItem::fieldAt( const QPoint & itempos ) const | |||
623 | int fh = mView->d->mFm->height(); | 631 | int fh = mView->d->mFm->height(); |
624 | int maxLines = mView->maxFieldLines(); | 632 | int maxLines = mView->maxFieldLines(); |
625 | Field *f; | 633 | Field *f; |
626 | for ( f = d->mFieldList.first(); f; f = d->mFieldList.next() ) | 634 | for ( f = d->mFieldList.first(); f; f = d->mFieldList.next() ) |
627 | { | 635 | { |
628 | if ( showEmpty || !f->second.isEmpty() ) | 636 | if ( showEmpty || !f->second.isEmpty() ) |
629 | ypos += ( QMIN( f->second.contains('\n')+1, maxLines ) *fh)+2; | 637 | ypos += ( QMIN( f->second.count('\n')+1, maxLines ) *fh)+2; |
630 | if ( iy <= ypos ) | 638 | if ( iy <= ypos ) |
631 | break; | 639 | break; |
632 | } | 640 | } |
633 | return f ? f : 0; | 641 | return f ? f : 0; |
634 | } | 642 | } |
635 | //END CardViewItem | 643 | //END CardViewItem |
636 | 644 | ||
637 | //BEGIN CardView | 645 | //BEGIN CardView |
638 | 646 | ||
639 | CardView::CardView(QWidget *parent, const char *name) | 647 | CardView::CardView(QWidget *parent, const char *name) |
640 | : QScrollView(parent, name), | 648 | : Q3ScrollView(parent, name), |
641 | d(new CardViewPrivate()) | 649 | d(new CardViewPrivate()) |
642 | { | 650 | { |
643 | mFlagKeyPressed = false; | 651 | mFlagKeyPressed = false; |
644 | mFlagBlockKeyPressed = false; | 652 | mFlagBlockKeyPressed = false; |
645 | d->mItemList.setAutoDelete(true); | 653 | d->mItemList.setAutoDelete(true); |
646 | d->mSeparatorList.setAutoDelete(true); | 654 | d->mSeparatorList.setAutoDelete(true); |
@@ -653,19 +661,19 @@ CardView::CardView(QWidget *parent, const char *name) | |||
653 | d->mTip = ( new CardViewTip( viewport() ) ), | 661 | d->mTip = ( new CardViewTip( viewport() ) ), |
654 | d->mTip->hide(); | 662 | d->mTip->hide(); |
655 | d->mTimer = ( new QTimer(this, "mouseTimer") ), | 663 | d->mTimer = ( new QTimer(this, "mouseTimer") ), |
656 | 664 | ||
657 | viewport()->setMouseTracking( true ); | 665 | viewport()->setMouseTracking( true ); |
658 | viewport()->setFocusProxy(this); | 666 | viewport()->setFocusProxy(this); |
659 | viewport()->setFocusPolicy(WheelFocus); | 667 | viewport()->setFocusPolicy(Qt::WheelFocus); |
660 | viewport()->setBackgroundMode(PaletteBase); | 668 | viewport()->setBackgroundMode(Qt::PaletteBase); |
661 | 669 | ||
662 | connect( d->mTimer, SIGNAL(timeout()), this, SLOT(tryShowFullText()) ); | 670 | connect( d->mTimer, SIGNAL(timeout()), this, SLOT(tryShowFullText()) ); |
663 | 671 | ||
664 | //US setBackgroundMode(PaletteBackground, PaletteBase); | 672 | //US setBackgroundMode(PaletteBackground, PaletteBase); |
665 | setBackgroundMode(PaletteBackground); | 673 | setBackgroundMode(Qt::PaletteBackground); |
666 | 674 | ||
667 | // no reason for a vertical scrollbar | 675 | // no reason for a vertical scrollbar |
668 | setVScrollBarMode(AlwaysOff); | 676 | setVScrollBarMode(AlwaysOff); |
669 | } | 677 | } |
670 | 678 | ||
671 | CardView::~CardView() | 679 | CardView::~CardView() |
@@ -736,13 +744,13 @@ void CardView::setCurrentItem( CardViewItem *item ) | |||
736 | emit currentChanged( item ); | 744 | emit currentChanged( item ); |
737 | } | 745 | } |
738 | 746 | ||
739 | CardViewItem *CardView::itemAt(const QPoint &viewPos) | 747 | CardViewItem *CardView::itemAt(const QPoint &viewPos) |
740 | { | 748 | { |
741 | CardViewItem *item = 0; | 749 | CardViewItem *item = 0; |
742 | QPtrListIterator<CardViewItem> iter(d->mItemList); | 750 | Q3PtrListIterator<CardViewItem> iter(d->mItemList); |
743 | bool found = false; | 751 | bool found = false; |
744 | for (iter.toFirst(); iter.current() && !found; ++iter) | 752 | for (iter.toFirst(); iter.current() && !found; ++iter) |
745 | { | 753 | { |
746 | item = *iter; | 754 | item = *iter; |
747 | //if (item->d->mRect.contains(viewPos)) | 755 | //if (item->d->mRect.contains(viewPos)) |
748 | if (QRect(item->d->x, item->d->y, d->mItemWidth, item->height()).contains(viewPos)) | 756 | if (QRect(item->d->x, item->d->y, d->mItemWidth, item->height()).contains(viewPos)) |
@@ -784,13 +792,13 @@ CardView::SelectionMode CardView::selectionMode() const | |||
784 | { | 792 | { |
785 | return d->mSelectionMode; | 793 | return d->mSelectionMode; |
786 | } | 794 | } |
787 | 795 | ||
788 | void CardView::selectAll(bool state) | 796 | void CardView::selectAll(bool state) |
789 | { | 797 | { |
790 | QPtrListIterator<CardViewItem> iter(d->mItemList); | 798 | Q3PtrListIterator<CardViewItem> iter(d->mItemList); |
791 | if (!state) | 799 | if (!state) |
792 | { | 800 | { |
793 | for (iter.toFirst(); iter.current(); ++iter) | 801 | for (iter.toFirst(); iter.current(); ++iter) |
794 | { | 802 | { |
795 | if ((*iter)->isSelected()) | 803 | if ((*iter)->isSelected()) |
796 | { | 804 | { |
@@ -875,13 +883,13 @@ bool CardView::isSelected(CardViewItem *item) const | |||
875 | return (item && item->isSelected()); | 883 | return (item && item->isSelected()); |
876 | } | 884 | } |
877 | 885 | ||
878 | CardViewItem *CardView::selectedItem() const | 886 | CardViewItem *CardView::selectedItem() const |
879 | { | 887 | { |
880 | // find the first selected item | 888 | // find the first selected item |
881 | QPtrListIterator<CardViewItem> iter(d->mItemList); | 889 | Q3PtrListIterator<CardViewItem> iter(d->mItemList); |
882 | for (iter.toFirst(); iter.current(); ++iter) | 890 | for (iter.toFirst(); iter.current(); ++iter) |
883 | { | 891 | { |
884 | if ((*iter)->isSelected()) | 892 | if ((*iter)->isSelected()) |
885 | return *iter; | 893 | return *iter; |
886 | } | 894 | } |
887 | 895 | ||
@@ -952,13 +960,13 @@ void CardView::drawContents(QPainter *p, int clipx, int clipy, | |||
952 | CardViewItem *item; | 960 | CardViewItem *item; |
953 | CardViewSeparator *sep; | 961 | CardViewSeparator *sep; |
954 | // make sure the viewport is a pure background | 962 | // make sure the viewport is a pure background |
955 | viewport()->erase( QRect ( cX, cY , clipw, cliph ) ); | 963 | viewport()->erase( QRect ( cX, cY , clipw, cliph ) ); |
956 | 964 | ||
957 | // Now tell the cards to draw, if they are in the clip region | 965 | // Now tell the cards to draw, if they are in the clip region |
958 | QPtrListIterator<CardViewItem> iter(d->mItemList); | 966 | Q3PtrListIterator<CardViewItem> iter(d->mItemList); |
959 | for (iter.toFirst(); iter.current(); ++iter) | 967 | for (iter.toFirst(); iter.current(); ++iter) |
960 | { | 968 | { |
961 | item = *iter; | 969 | item = *iter; |
962 | cardRect.setRect( item->d->x, item->d->y, d->mItemWidth, item->height() ); | 970 | cardRect.setRect( item->d->x, item->d->y, d->mItemWidth, item->height() ); |
963 | 971 | ||
964 | if (clipRect.intersects(cardRect) || clipRect.contains(cardRect)) | 972 | if (clipRect.intersects(cardRect) || clipRect.contains(cardRect)) |
@@ -972,13 +980,13 @@ void CardView::drawContents(QPainter *p, int clipx, int clipy, | |||
972 | item->paintCard(p, cg); | 980 | item->paintCard(p, cg); |
973 | p->restore(); | 981 | p->restore(); |
974 | } | 982 | } |
975 | } | 983 | } |
976 | 984 | ||
977 | // Followed by the separators if they are in the clip region | 985 | // Followed by the separators if they are in the clip region |
978 | QPtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList); | 986 | Q3PtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList); |
979 | for (sepIter.toFirst(); sepIter.current(); ++sepIter) | 987 | for (sepIter.toFirst(); sepIter.current(); ++sepIter) |
980 | { | 988 | { |
981 | sep = *sepIter; | 989 | sep = *sepIter; |
982 | sepRect = sep->mRect; | 990 | sepRect = sep->mRect; |
983 | 991 | ||
984 | if (clipRect.intersects(sepRect) || clipRect.contains(sepRect)) | 992 | if (clipRect.intersects(sepRect) || clipRect.contains(sepRect)) |
@@ -990,13 +998,13 @@ void CardView::drawContents(QPainter *p, int clipx, int clipy, | |||
990 | } | 998 | } |
991 | } | 999 | } |
992 | } | 1000 | } |
993 | 1001 | ||
994 | void CardView::resizeEvent(QResizeEvent *e) | 1002 | void CardView::resizeEvent(QResizeEvent *e) |
995 | { | 1003 | { |
996 | QScrollView::resizeEvent(e); | 1004 | Q3ScrollView::resizeEvent(e); |
997 | 1005 | ||
998 | setLayoutDirty(true); | 1006 | setLayoutDirty(true); |
999 | } | 1007 | } |
1000 | 1008 | ||
1001 | void CardView::calcLayout() | 1009 | void CardView::calcLayout() |
1002 | { | 1010 | { |
@@ -1010,13 +1018,13 @@ void CardView::calcLayout() | |||
1010 | int yPos = 0; | 1018 | int yPos = 0; |
1011 | int cardSpacing = d->mItemSpacing; | 1019 | int cardSpacing = d->mItemSpacing; |
1012 | 1020 | ||
1013 | // delete the old separators | 1021 | // delete the old separators |
1014 | d->mSeparatorList.clear(); | 1022 | d->mSeparatorList.clear(); |
1015 | 1023 | ||
1016 | QPtrListIterator<CardViewItem> iter(d->mItemList); | 1024 | Q3PtrListIterator<CardViewItem> iter(d->mItemList); |
1017 | CardViewItem *item = 0; | 1025 | CardViewItem *item = 0; |
1018 | CardViewSeparator *sep = 0; | 1026 | CardViewSeparator *sep = 0; |
1019 | xPos += cardSpacing; | 1027 | xPos += cardSpacing; |
1020 | 1028 | ||
1021 | for (iter.toFirst(); iter.current(); ++iter) | 1029 | for (iter.toFirst(); iter.current(); ++iter) |
1022 | { | 1030 | { |
@@ -1053,13 +1061,13 @@ void CardView::calcLayout() | |||
1053 | 1061 | ||
1054 | xPos += maxWidth; | 1062 | xPos += maxWidth; |
1055 | resizeContents( xPos + cardSpacing, maxHeight ); | 1063 | resizeContents( xPos + cardSpacing, maxHeight ); |
1056 | 1064 | ||
1057 | // Update the height of all the separators now that we know the | 1065 | // Update the height of all the separators now that we know the |
1058 | // max height of a column | 1066 | // max height of a column |
1059 | QPtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList); | 1067 | Q3PtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList); |
1060 | for (sepIter.toFirst(); sepIter.current(); ++sepIter) | 1068 | for (sepIter.toFirst(); sepIter.current(); ++sepIter) |
1061 | { | 1069 | { |
1062 | (*sepIter)->mRect.setHeight(maxHeight - 2*cardSpacing - 2*d->mItemMargin); | 1070 | (*sepIter)->mRect.setHeight(maxHeight - 2*cardSpacing - 2*d->mItemMargin); |
1063 | } | 1071 | } |
1064 | 1072 | ||
1065 | d->mLayoutDirty = false; | 1073 | d->mLayoutDirty = false; |
@@ -1098,13 +1106,13 @@ void CardView::setItemSpacing( uint spacing ) | |||
1098 | d->mItemSpacing = spacing; | 1106 | d->mItemSpacing = spacing; |
1099 | setLayoutDirty( true ); | 1107 | setLayoutDirty( true ); |
1100 | } | 1108 | } |
1101 | 1109 | ||
1102 | void CardView::contentsMousePressEvent(QMouseEvent *e) | 1110 | void CardView::contentsMousePressEvent(QMouseEvent *e) |
1103 | { | 1111 | { |
1104 | QScrollView::contentsMousePressEvent(e); | 1112 | Q3ScrollView::contentsMousePressEvent(e); |
1105 | 1113 | ||
1106 | QPoint pos = e->pos(); | 1114 | QPoint pos = e->pos(); |
1107 | d->mLastClickPos = pos; | 1115 | d->mLastClickPos = pos; |
1108 | 1116 | ||
1109 | CardViewItem *item = itemAt(pos); | 1117 | CardViewItem *item = itemAt(pos); |
1110 | 1118 | ||
@@ -1168,13 +1176,13 @@ void CardView::contentsMousePressEvent(QMouseEvent *e) | |||
1168 | (e->state() & Qt::ShiftButton)) | 1176 | (e->state() & Qt::ShiftButton)) |
1169 | { | 1177 | { |
1170 | if ( item == other ) return; | 1178 | if ( item == other ) return; |
1171 | 1179 | ||
1172 | bool s = ! item->isSelected(); | 1180 | bool s = ! item->isSelected(); |
1173 | 1181 | ||
1174 | if ( s && ! (e->state() & ControlButton) ) | 1182 | if ( s && ! (e->state() & Qt::ControlButton) ) |
1175 | { | 1183 | { |
1176 | bool b = signalsBlocked(); | 1184 | bool b = signalsBlocked(); |
1177 | blockSignals(true); | 1185 | blockSignals(true); |
1178 | selectAll(false); | 1186 | selectAll(false); |
1179 | blockSignals(b); | 1187 | blockSignals(b); |
1180 | } | 1188 | } |
@@ -1216,13 +1224,13 @@ void CardView::contentsMousePressEvent(QMouseEvent *e) | |||
1216 | } | 1224 | } |
1217 | 1225 | ||
1218 | } | 1226 | } |
1219 | 1227 | ||
1220 | void CardView::contentsMouseReleaseEvent(QMouseEvent *e) | 1228 | void CardView::contentsMouseReleaseEvent(QMouseEvent *e) |
1221 | { | 1229 | { |
1222 | QScrollView::contentsMouseReleaseEvent(e); | 1230 | Q3ScrollView::contentsMouseReleaseEvent(e); |
1223 | 1231 | ||
1224 | if ( d->mResizeAnchor ) | 1232 | if ( d->mResizeAnchor ) |
1225 | { | 1233 | { |
1226 | // finish the resizing: | 1234 | // finish the resizing: |
1227 | unsetCursor(); | 1235 | unsetCursor(); |
1228 | // hide rubber bands | 1236 | // hide rubber bands |
@@ -1254,13 +1262,13 @@ void CardView::contentsMouseReleaseEvent(QMouseEvent *e) | |||
1254 | emit executed(item); | 1262 | emit executed(item); |
1255 | } | 1263 | } |
1256 | } | 1264 | } |
1257 | 1265 | ||
1258 | void CardView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1266 | void CardView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1259 | { | 1267 | { |
1260 | QScrollView::contentsMouseDoubleClickEvent(e); | 1268 | Q3ScrollView::contentsMouseDoubleClickEvent(e); |
1261 | 1269 | ||
1262 | CardViewItem *item = itemAt(e->pos()); | 1270 | CardViewItem *item = itemAt(e->pos()); |
1263 | 1271 | ||
1264 | if (item) | 1272 | if (item) |
1265 | { | 1273 | { |
1266 | d->mCurrentItem = item; | 1274 | d->mCurrentItem = item; |
@@ -1299,18 +1307,18 @@ void CardView::contentsMouseMoveEvent( QMouseEvent *e ) | |||
1299 | { | 1307 | { |
1300 | int colcontentw = d->mItemWidth + (2*d->mItemSpacing); | 1308 | int colcontentw = d->mItemWidth + (2*d->mItemSpacing); |
1301 | int colw = colcontentw + d->mSepWidth; | 1309 | int colw = colcontentw + d->mSepWidth; |
1302 | int m = e->x()%colw; | 1310 | int m = e->x()%colw; |
1303 | if ( m >= colcontentw && m > 0 ) | 1311 | if ( m >= colcontentw && m > 0 ) |
1304 | { | 1312 | { |
1305 | setCursor( SplitVCursor ); // Why does this fail sometimes? | 1313 | setCursor( Qt::SplitVCursor ); // Why does this fail sometimes? |
1306 | d->mOnSeparator = true; | 1314 | d->mOnSeparator = true; |
1307 | } | 1315 | } |
1308 | else | 1316 | else |
1309 | { | 1317 | { |
1310 | setCursor( ArrowCursor ); | 1318 | setCursor( Qt::ArrowCursor ); |
1311 | d->mOnSeparator = false; | 1319 | d->mOnSeparator = false; |
1312 | } | 1320 | } |
1313 | } | 1321 | } |
1314 | } | 1322 | } |
1315 | 1323 | ||
1316 | void CardView::enterEvent( QEvent * ) | 1324 | void CardView::enterEvent( QEvent * ) |
@@ -1321,13 +1329,13 @@ void CardView::enterEvent( QEvent * ) | |||
1321 | void CardView::leaveEvent( QEvent * ) | 1329 | void CardView::leaveEvent( QEvent * ) |
1322 | { | 1330 | { |
1323 | d->mTimer->stop(); | 1331 | d->mTimer->stop(); |
1324 | if (d->mOnSeparator) | 1332 | if (d->mOnSeparator) |
1325 | { | 1333 | { |
1326 | d->mOnSeparator = false; | 1334 | d->mOnSeparator = false; |
1327 | setCursor( ArrowCursor ); | 1335 | setCursor( Qt::ArrowCursor ); |
1328 | } | 1336 | } |
1329 | } | 1337 | } |
1330 | 1338 | ||
1331 | void CardView::focusInEvent( QFocusEvent * ) | 1339 | void CardView::focusInEvent( QFocusEvent * ) |
1332 | { | 1340 | { |
1333 | if (!d->mCurrentItem && d->mItemList.count() ) | 1341 | if (!d->mCurrentItem && d->mItemList.count() ) |
@@ -1365,27 +1373,27 @@ void CardView::keyPressEvent( QKeyEvent *e ) | |||
1365 | uint pos = d->mItemList.findRef( d->mCurrentItem ); | 1373 | uint pos = d->mItemList.findRef( d->mCurrentItem ); |
1366 | CardViewItem *aItem = 0L; // item that gets the focus | 1374 | CardViewItem *aItem = 0L; // item that gets the focus |
1367 | CardViewItem *old = d->mCurrentItem; | 1375 | CardViewItem *old = d->mCurrentItem; |
1368 | 1376 | ||
1369 | switch ( e->key() ) | 1377 | switch ( e->key() ) |
1370 | { | 1378 | { |
1371 | case Key_Up: | 1379 | case Qt::Key_Up: |
1372 | if ( pos > 0 ) | 1380 | if ( pos > 0 ) |
1373 | { | 1381 | { |
1374 | aItem = d->mItemList.at( pos - 1 ); | 1382 | aItem = d->mItemList.at( pos - 1 ); |
1375 | setCurrentItem( aItem ); | 1383 | setCurrentItem( aItem ); |
1376 | } | 1384 | } |
1377 | break; | 1385 | break; |
1378 | case Key_Down: | 1386 | case Qt::Key_Down: |
1379 | if ( pos < d->mItemList.count() - 1 ) | 1387 | if ( pos < d->mItemList.count() - 1 ) |
1380 | { | 1388 | { |
1381 | aItem = d->mItemList.at( pos + 1 ); | 1389 | aItem = d->mItemList.at( pos + 1 ); |
1382 | setCurrentItem( aItem ); | 1390 | setCurrentItem( aItem ); |
1383 | } | 1391 | } |
1384 | break; | 1392 | break; |
1385 | case Key_Left: | 1393 | case Qt::Key_Left: |
1386 | { | 1394 | { |
1387 | // look for an item in the previous/next column, starting from | 1395 | // look for an item in the previous/next column, starting from |
1388 | // the vertical middle of the current item. | 1396 | // the vertical middle of the current item. |
1389 | // FIXME use nice calculatd measures!!! | 1397 | // FIXME use nice calculatd measures!!! |
1390 | QPoint aPoint( d->mCurrentItem->d->x, d->mCurrentItem->d->y ); | 1398 | QPoint aPoint( d->mCurrentItem->d->x, d->mCurrentItem->d->y ); |
1391 | aPoint -= QPoint( 30,-(d->mCurrentItem->height()/2) ); | 1399 | aPoint -= QPoint( 30,-(d->mCurrentItem->height()/2) ); |
@@ -1397,13 +1405,13 @@ void CardView::keyPressEvent( QKeyEvent *e ) | |||
1397 | aItem = itemAt( aPoint ); | 1405 | aItem = itemAt( aPoint ); |
1398 | } | 1406 | } |
1399 | if ( aItem ) | 1407 | if ( aItem ) |
1400 | setCurrentItem( aItem ); | 1408 | setCurrentItem( aItem ); |
1401 | } | 1409 | } |
1402 | break; | 1410 | break; |
1403 | case Key_Right: | 1411 | case Qt::Key_Right: |
1404 | { | 1412 | { |
1405 | // FIXME use nice calculated measures!!! | 1413 | // FIXME use nice calculated measures!!! |
1406 | QPoint aPoint( d->mCurrentItem->d->x + d->mItemWidth, d->mCurrentItem->d->y ); | 1414 | QPoint aPoint( d->mCurrentItem->d->x + d->mItemWidth, d->mCurrentItem->d->y ); |
1407 | aPoint += QPoint( 30,(d->mCurrentItem->height()/2) ); | 1415 | aPoint += QPoint( 30,(d->mCurrentItem->height()/2) ); |
1408 | aItem = itemAt( aPoint ); | 1416 | aItem = itemAt( aPoint ); |
1409 | while ( !aItem && aPoint.y() > 27 ) | 1417 | while ( !aItem && aPoint.y() > 27 ) |
@@ -1412,34 +1420,34 @@ void CardView::keyPressEvent( QKeyEvent *e ) | |||
1412 | aItem = itemAt( aPoint ); | 1420 | aItem = itemAt( aPoint ); |
1413 | } | 1421 | } |
1414 | if ( aItem ) | 1422 | if ( aItem ) |
1415 | setCurrentItem( aItem ); | 1423 | setCurrentItem( aItem ); |
1416 | } | 1424 | } |
1417 | break; | 1425 | break; |
1418 | case Key_Home: | 1426 | case Qt::Key_Home: |
1419 | aItem = d->mItemList.first(); | 1427 | aItem = d->mItemList.first(); |
1420 | setCurrentItem( aItem ); | 1428 | setCurrentItem( aItem ); |
1421 | break; | 1429 | break; |
1422 | case Key_End: | 1430 | case Qt::Key_End: |
1423 | aItem = d->mItemList.last(); | 1431 | aItem = d->mItemList.last(); |
1424 | setCurrentItem( aItem ); | 1432 | setCurrentItem( aItem ); |
1425 | break; | 1433 | break; |
1426 | case Key_Prior: // PageUp | 1434 | case Qt::Key_Prior: // PageUp |
1427 | { | 1435 | { |
1428 | // QListView: "Make the item above the top visible and current" | 1436 | // QListView: "Make the item above the top visible and current" |
1429 | // TODO if contentsY(), pick the top item of the leftmost visible column | 1437 | // TODO if contentsY(), pick the top item of the leftmost visible column |
1430 | if ( contentsX() <= 0 ) | 1438 | if ( contentsX() <= 0 ) |
1431 | return; | 1439 | return; |
1432 | int cw = columnWidth(); | 1440 | int cw = columnWidth(); |
1433 | int theCol = ( QMAX( 0, ( contentsX()/cw) * cw ) ) + d->mItemSpacing; | 1441 | int theCol = ( QMAX( 0, ( contentsX()/cw) * cw ) ) + d->mItemSpacing; |
1434 | aItem = itemAt( QPoint( theCol + 1, d->mItemSpacing + 1 ) ); | 1442 | aItem = itemAt( QPoint( theCol + 1, d->mItemSpacing + 1 ) ); |
1435 | if ( aItem ) | 1443 | if ( aItem ) |
1436 | setCurrentItem( aItem ); | 1444 | setCurrentItem( aItem ); |
1437 | } | 1445 | } |
1438 | break; | 1446 | break; |
1439 | case Key_Next: // PageDown | 1447 | case Qt::Key_Next: // PageDown |
1440 | { | 1448 | { |
1441 | // QListView: "Make the item below the bottom visible and current" | 1449 | // QListView: "Make the item below the bottom visible and current" |
1442 | // find the first not fully visible column. | 1450 | // find the first not fully visible column. |
1443 | // TODO: consider if a partly visible (or even hidden) item at the | 1451 | // TODO: consider if a partly visible (or even hidden) item at the |
1444 | // bottom of the rightmost column exists | 1452 | // bottom of the rightmost column exists |
1445 | int cw = columnWidth(); | 1453 | int cw = columnWidth(); |
@@ -1455,25 +1463,25 @@ void CardView::keyPressEvent( QKeyEvent *e ) | |||
1455 | aItem = itemAt( QPoint( theCol, d->mItemSpacing + 1 ) ); | 1463 | aItem = itemAt( QPoint( theCol, d->mItemSpacing + 1 ) ); |
1456 | 1464 | ||
1457 | if ( aItem ) | 1465 | if ( aItem ) |
1458 | setCurrentItem( aItem ); | 1466 | setCurrentItem( aItem ); |
1459 | } | 1467 | } |
1460 | break; | 1468 | break; |
1461 | case Key_Space: | 1469 | case Qt::Key_Space: |
1462 | setSelected( d->mCurrentItem, !d->mCurrentItem->isSelected() ); | 1470 | setSelected( d->mCurrentItem, !d->mCurrentItem->isSelected() ); |
1463 | emit selectionChanged(); | 1471 | emit selectionChanged(); |
1464 | break; | 1472 | break; |
1465 | case Key_Return: | 1473 | case Qt::Key_Return: |
1466 | case Key_Enter: | 1474 | case Qt::Key_Enter: |
1467 | { | 1475 | { |
1468 | emit returnPressed( d->mCurrentItem ); | 1476 | emit returnPressed( d->mCurrentItem ); |
1469 | emit executed( d->mCurrentItem ); | 1477 | emit executed( d->mCurrentItem ); |
1470 | } | 1478 | } |
1471 | break; | 1479 | break; |
1472 | default: | 1480 | default: |
1473 | if ( (e->state() & ControlButton) && e->key() == Key_A ) | 1481 | if ( (e->state() & Qt::ControlButton) && e->key() == Qt::Key_A ) |
1474 | { | 1482 | { |
1475 | // select all | 1483 | // select all |
1476 | selectAll( true ); | 1484 | selectAll( true ); |
1477 | break; | 1485 | break; |
1478 | } | 1486 | } |
1479 | // if we have a string, do autosearch | 1487 | // if we have a string, do autosearch |
@@ -1485,13 +1493,13 @@ void CardView::keyPressEvent( QKeyEvent *e ) | |||
1485 | } | 1493 | } |
1486 | // handle selection | 1494 | // handle selection |
1487 | if ( aItem ) | 1495 | if ( aItem ) |
1488 | { | 1496 | { |
1489 | if ( d->mSelectionMode == CardView::Extended ) | 1497 | if ( d->mSelectionMode == CardView::Extended ) |
1490 | { | 1498 | { |
1491 | if ( (e->state() & ShiftButton) ) | 1499 | if ( (e->state() & Qt::ShiftButton) ) |
1492 | { | 1500 | { |
1493 | // shift button: toggle range | 1501 | // shift button: toggle range |
1494 | // if control button is pressed, leave all items | 1502 | // if control button is pressed, leave all items |
1495 | // and toggle selection current->old current | 1503 | // and toggle selection current->old current |
1496 | // otherwise, ?????? | 1504 | // otherwise, ?????? |
1497 | bool s = ! aItem->isSelected(); | 1505 | bool s = ! aItem->isSelected(); |
@@ -1516,13 +1524,13 @@ void CardView::keyPressEvent( QKeyEvent *e ) | |||
1516 | item = d->mItemList.at( from ); | 1524 | item = d->mItemList.at( from ); |
1517 | item->setSelected( s ); | 1525 | item->setSelected( s ); |
1518 | repaintItem( item ); | 1526 | repaintItem( item ); |
1519 | } | 1527 | } |
1520 | emit selectionChanged(); | 1528 | emit selectionChanged(); |
1521 | } | 1529 | } |
1522 | else if ( (e->state() & ControlButton) ) | 1530 | else if ( (e->state() & Qt::ControlButton) ) |
1523 | { | 1531 | { |
1524 | // control button: do nothing | 1532 | // control button: do nothing |
1525 | } | 1533 | } |
1526 | else | 1534 | else |
1527 | { | 1535 | { |
1528 | // no button: move selection to this item | 1536 | // no button: move selection to this item |
@@ -1635,15 +1643,15 @@ void CardView::drawRubberBands( int pos ) | |||
1635 | 1643 | ||
1636 | int tmpcw = (d->mRubberBandAnchor-d->firstX)/d->span; | 1644 | int tmpcw = (d->mRubberBandAnchor-d->firstX)/d->span; |
1637 | int x = d->firstX + tmpcw - d->mSepWidth - contentsX(); | 1645 | int x = d->firstX + tmpcw - d->mSepWidth - contentsX(); |
1638 | int h = visibleHeight(); | 1646 | int h = visibleHeight(); |
1639 | 1647 | ||
1640 | QPainter p( viewport() ); | 1648 | QPainter p( viewport() ); |
1641 | p.setRasterOp( XorROP ); | 1649 | p.setCompositionMode( QPainter::CompositionMode_Xor ); |
1642 | p.setPen( gray ); | 1650 | p.setPen( Qt::gray ); |
1643 | p.setBrush( gray ); | 1651 | p.setBrush( Qt::gray ); |
1644 | uint n = d->first; | 1652 | uint n = d->first; |
1645 | // erase | 1653 | // erase |
1646 | if ( d->mRubberBandAnchor ) | 1654 | if ( d->mRubberBandAnchor ) |
1647 | do { | 1655 | do { |
1648 | p.drawRect( x, 0, 2, h ); | 1656 | p.drawRect( x, 0, 2, h ); |
1649 | x += tmpcw; | 1657 | x += tmpcw; |
@@ -1696,13 +1704,13 @@ QFont CardView::headerFont() const | |||
1696 | { | 1704 | { |
1697 | return d->mHeaderFont; | 1705 | return d->mHeaderFont; |
1698 | } | 1706 | } |
1699 | 1707 | ||
1700 | void CardView::setFont( const QFont &fnt ) | 1708 | void CardView::setFont( const QFont &fnt ) |
1701 | { | 1709 | { |
1702 | QScrollView::setFont( fnt ); | 1710 | Q3ScrollView::setFont( fnt ); |
1703 | delete d->mFm; | 1711 | delete d->mFm; |
1704 | d->mFm = new QFontMetrics( fnt ); | 1712 | d->mFm = new QFontMetrics( fnt ); |
1705 | } | 1713 | } |
1706 | 1714 | ||
1707 | int CardView::separatorWidth() | 1715 | int CardView::separatorWidth() |
1708 | { | 1716 | { |
@@ -1733,18 +1741,18 @@ void CardView::keyReleaseEvent ( QKeyEvent * e ) | |||
1733 | if ( !e->isAutoRepeat() ) { | 1741 | if ( !e->isAutoRepeat() ) { |
1734 | mFlagBlockKeyPressed = true; | 1742 | mFlagBlockKeyPressed = true; |
1735 | qApp->processEvents(); | 1743 | qApp->processEvents(); |
1736 | mFlagBlockKeyPressed = false; | 1744 | mFlagBlockKeyPressed = false; |
1737 | mFlagKeyPressed = false; | 1745 | mFlagKeyPressed = false; |
1738 | } | 1746 | } |
1739 | QScrollView::keyReleaseEvent ( e ); | 1747 | Q3ScrollView::keyReleaseEvent ( e ); |
1740 | } | 1748 | } |
1741 | 1749 | ||
1742 | 1750 | ||
1743 | 1751 | ||
1744 | 1752 | ||
1745 | 1753 | ||
1746 | //END Cardview | 1754 | //END Cardview |
1747 | 1755 | ||
1748 | #ifndef KAB_EMBEDDED | 1756 | #ifndef KAB_EMBEDDED_ |
1749 | #include "cardview.moc" | 1757 | #include "moc_cardview.cpp" |
1750 | #endif //KAB_EMBEDDED | 1758 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/cardview.h b/kaddressbook/views/cardview.h index 2ea3771..9c245ea 100644 --- a/kaddressbook/views/cardview.h +++ b/kaddressbook/views/cardview.h | |||
@@ -1,15 +1,23 @@ | |||
1 | #ifndef CARDVIEW_H | 1 | #ifndef CARDVIEW_H |
2 | #define CARDVIEW_H | 2 | #define CARDVIEW_H |
3 | 3 | ||
4 | #include <qscrollview.h> | 4 | #include <q3scrollview.h> |
5 | #include <qptrlist.h> | 5 | #include <q3ptrlist.h> |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <qrect.h> | 7 | #include <qrect.h> |
8 | #include <qpair.h> | 8 | #include <qpair.h> |
9 | #include <qpoint.h> | 9 | #include <qpoint.h> |
10 | //Added by qt3to4: | ||
11 | #include <QWheelEvent> | ||
12 | #include <QResizeEvent> | ||
13 | #include <QFocusEvent> | ||
14 | #include <QLabel> | ||
15 | #include <QMouseEvent> | ||
16 | #include <QKeyEvent> | ||
17 | #include <QEvent> | ||
10 | 18 | ||
11 | class QLabel; | 19 | class QLabel; |
12 | class QPainter; | 20 | class QPainter; |
13 | class QResizeEvent; | 21 | class QResizeEvent; |
14 | class QMouseEvent; | 22 | class QMouseEvent; |
15 | class CardView; | 23 | class CardView; |
@@ -145,13 +153,13 @@ class CardViewItem | |||
145 | * | 153 | * |
146 | * The CardView class is designed to mirror the API of the QListView or | 154 | * The CardView class is designed to mirror the API of the QListView or |
147 | * QIconView. The CardView is also completely independant of KAddressBook and | 155 | * QIconView. The CardView is also completely independant of KAddressBook and |
148 | * can be used elsewhere. With the exception of a few simple config checks, | 156 | * can be used elsewhere. With the exception of a few simple config checks, |
149 | * the CardView is also 100% independant of KDE. | 157 | * the CardView is also 100% independant of KDE. |
150 | */ | 158 | */ |
151 | class CardView : public QScrollView | 159 | class CardView : public Q3ScrollView |
152 | { | 160 | { |
153 | friend class CardViewItem; | 161 | friend class CardViewItem; |
154 | 162 | ||
155 | Q_OBJECT | 163 | Q_OBJECT |
156 | 164 | ||
157 | public: | 165 | public: |
diff --git a/kaddressbook/views/colorlistbox.cpp b/kaddressbook/views/colorlistbox.cpp index 2bddca6..46a59a1 100644 --- a/kaddressbook/views/colorlistbox.cpp +++ b/kaddressbook/views/colorlistbox.cpp | |||
@@ -16,41 +16,46 @@ | |||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qpainter.h> | 21 | #include <qpainter.h> |
22 | //Added by qt3to4: | ||
23 | #include <QDragEnterEvent> | ||
24 | #include <QDropEvent> | ||
25 | #include <QDragMoveEvent> | ||
26 | #include <QDragLeaveEvent> | ||
22 | 27 | ||
23 | #include <kcolordialog.h> | 28 | #include <kcolordialog.h> |
24 | 29 | ||
25 | #ifndef KAB_EMBEDDED | 30 | #ifndef KAB_EMBEDDED |
26 | #include <kcolordrag.h> | 31 | #include <kcolordrag.h> |
27 | #endif //KAB_EMBEDDED | 32 | #endif //KAB_EMBEDDED |
28 | 33 | ||
29 | #include "colorlistbox.h" | 34 | #include "colorlistbox.h" |
30 | #ifdef DESKTOP_VERSION | 35 | #ifdef DESKTOP_VERSION |
31 | #include <qcolordialog.h> | 36 | #include <qcolordialog.h> |
32 | #endif | 37 | #endif |
33 | 38 | ||
34 | ColorListBox::ColorListBox( QWidget *parent, const char *name, WFlags f ) | 39 | ColorListBox::ColorListBox( QWidget *parent, const char *name, Qt::WFlags f ) |
35 | :KListBox( parent, name, f ), mCurrentOnDragEnter(-1) | 40 | :KListBox( parent, name, f ), mCurrentOnDragEnter(-1) |
36 | { | 41 | { |
37 | connect( this, SIGNAL(selected(int)), this, SLOT(newColor(int)) ); | 42 | connect( this, SIGNAL(selected(int)), this, SLOT(newColor(int)) ); |
38 | connect( this, SIGNAL(clicked(QListBoxItem *)), this, SLOT(slotNewColor(QListBoxItem *)) ); | 43 | connect( this, SIGNAL(clicked(Q3ListBoxItem *)), this, SLOT(slotNewColor(Q3ListBoxItem *)) ); |
39 | setAcceptDrops( true); | 44 | setAcceptDrops( true); |
40 | } | 45 | } |
41 | 46 | ||
42 | 47 | ||
43 | void ColorListBox::setEnabled( bool state ) | 48 | void ColorListBox::setEnabled( bool state ) |
44 | { | 49 | { |
45 | if( state == isEnabled() ) | 50 | if( state == isEnabled() ) |
46 | { | 51 | { |
47 | return; | 52 | return; |
48 | } | 53 | } |
49 | 54 | ||
50 | QListBox::setEnabled( state ); | 55 | Q3ListBox::setEnabled( state ); |
51 | for( uint i=0; i<count(); i++ ) | 56 | for( uint i=0; i<count(); i++ ) |
52 | { | 57 | { |
53 | updateItem( i ); | 58 | updateItem( i ); |
54 | } | 59 | } |
55 | } | 60 | } |
56 | 61 | ||
@@ -72,16 +77,16 @@ QColor ColorListBox::color( uint index ) const | |||
72 | { | 77 | { |
73 | ColorListItem *colorItem = (ColorListItem*)item(index); | 78 | ColorListItem *colorItem = (ColorListItem*)item(index); |
74 | return( colorItem->color() ); | 79 | return( colorItem->color() ); |
75 | } | 80 | } |
76 | else | 81 | else |
77 | { | 82 | { |
78 | return( black ); | 83 | return( Qt::black ); |
79 | } | 84 | } |
80 | } | 85 | } |
81 | void ColorListBox::slotNewColor(QListBoxItem * i) | 86 | void ColorListBox::slotNewColor(Q3ListBoxItem * i) |
82 | { | 87 | { |
83 | if ( i ) | 88 | if ( i ) |
84 | newColor( index( i ) ); | 89 | newColor( index( i ) ); |
85 | } | 90 | } |
86 | 91 | ||
87 | void ColorListBox::newColor( int index ) | 92 | void ColorListBox::newColor( int index ) |
@@ -195,13 +200,13 @@ qDebug("ColorListBox::dropEvent drag&drop currently not supported"); | |||
195 | 200 | ||
196 | } | 201 | } |
197 | 202 | ||
198 | 203 | ||
199 | 204 | ||
200 | ColorListItem::ColorListItem( const QString &text, const QColor &color ) | 205 | ColorListItem::ColorListItem( const QString &text, const QColor &color ) |
201 | : QListBoxItem(), mColor( color ), mBoxWidth( 30 ) | 206 | : Q3ListBoxItem(), mColor( color ), mBoxWidth( 30 ) |
202 | { | 207 | { |
203 | setText( text ); | 208 | setText( text ); |
204 | } | 209 | } |
205 | 210 | ||
206 | 211 | ||
207 | const QColor &ColorListItem::color( void ) | 212 | const QColor &ColorListItem::color( void ) |
@@ -226,20 +231,20 @@ void ColorListItem::paint( QPainter *p ) | |||
226 | p->setPen( Qt::black ); | 231 | p->setPen( Qt::black ); |
227 | p->drawRect( 3, 1, mBoxWidth, h-1 ); | 232 | p->drawRect( 3, 1, mBoxWidth, h-1 ); |
228 | p->fillRect( 4, 2, mBoxWidth-2, h-3, mColor ); | 233 | p->fillRect( 4, 2, mBoxWidth-2, h-3, mColor ); |
229 | } | 234 | } |
230 | 235 | ||
231 | 236 | ||
232 | int ColorListItem::height(const QListBox *lb ) const | 237 | int ColorListItem::height(const Q3ListBox *lb ) const |
233 | { | 238 | { |
234 | return( lb->fontMetrics().lineSpacing()+1 ); | 239 | return( lb->fontMetrics().lineSpacing()+1 ); |
235 | } | 240 | } |
236 | 241 | ||
237 | 242 | ||
238 | int ColorListItem::width(const QListBox *lb ) const | 243 | int ColorListItem::width(const Q3ListBox *lb ) const |
239 | { | 244 | { |
240 | return( mBoxWidth + lb->fontMetrics().width( text() ) + 6 ); | 245 | return( mBoxWidth + lb->fontMetrics().width( text() ) + 6 ); |
241 | } | 246 | } |
242 | 247 | ||
243 | #ifndef KAB_EMBEDDED | 248 | #ifndef KAB_EMBEDDED_ |
244 | #include "colorlistbox.moc" | 249 | #include "moc_colorlistbox.cpp" |
245 | #endif //KAB_EMBEDDED | 250 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/colorlistbox.h b/kaddressbook/views/colorlistbox.h index bb91484..31a8085 100644 --- a/kaddressbook/views/colorlistbox.h +++ b/kaddressbook/views/colorlistbox.h | |||
@@ -19,24 +19,29 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef _COLOR_LISTBOX_H_ | 21 | #ifndef _COLOR_LISTBOX_H_ |
22 | #define _COLOR_LISTBOX_H_ | 22 | #define _COLOR_LISTBOX_H_ |
23 | 23 | ||
24 | #include <klistbox.h> | 24 | #include <klistbox.h> |
25 | //Added by qt3to4: | ||
26 | #include <QDragMoveEvent> | ||
27 | #include <QDragLeaveEvent> | ||
28 | #include <QDropEvent> | ||
29 | #include <QDragEnterEvent> | ||
25 | 30 | ||
26 | class QDragEnterEvent; | 31 | class QDragEnterEvent; |
27 | class QDragLeaveEvent; | 32 | class QDragLeaveEvent; |
28 | class QDragMoveEvent; | 33 | class QDragMoveEvent; |
29 | class QDropEvent; | 34 | class QDropEvent; |
30 | 35 | ||
31 | class ColorListBox : public KListBox | 36 | class ColorListBox : public KListBox |
32 | { | 37 | { |
33 | Q_OBJECT | 38 | Q_OBJECT |
34 | 39 | ||
35 | public: | 40 | public: |
36 | ColorListBox( QWidget *parent=0, const char * name=0, WFlags f=0 ); | 41 | ColorListBox( QWidget *parent=0, const char * name=0, Qt::WFlags f=0 ); |
37 | void setColor( uint index, const QColor &color ); | 42 | void setColor( uint index, const QColor &color ); |
38 | QColor color( uint index ) const; | 43 | QColor color( uint index ) const; |
39 | 44 | ||
40 | public slots: | 45 | public slots: |
41 | virtual void setEnabled( bool state ); | 46 | virtual void setEnabled( bool state ); |
42 | 47 | ||
@@ -45,31 +50,31 @@ class ColorListBox : public KListBox | |||
45 | void dragLeaveEvent( QDragLeaveEvent *e ); | 50 | void dragLeaveEvent( QDragLeaveEvent *e ); |
46 | void dragMoveEvent( QDragMoveEvent *e ); | 51 | void dragMoveEvent( QDragMoveEvent *e ); |
47 | void dropEvent( QDropEvent *e ); | 52 | void dropEvent( QDropEvent *e ); |
48 | 53 | ||
49 | private slots: | 54 | private slots: |
50 | void newColor( int index ); | 55 | void newColor( int index ); |
51 | void slotNewColor(QListBoxItem * i); | 56 | void slotNewColor(Q3ListBoxItem * i); |
52 | 57 | ||
53 | private: | 58 | private: |
54 | int mCurrentOnDragEnter; | 59 | int mCurrentOnDragEnter; |
55 | 60 | ||
56 | }; | 61 | }; |
57 | 62 | ||
58 | 63 | ||
59 | class ColorListItem : public QListBoxItem | 64 | class ColorListItem : public Q3ListBoxItem |
60 | { | 65 | { |
61 | public: | 66 | public: |
62 | ColorListItem( const QString &text, const QColor &color=Qt::black ); | 67 | ColorListItem( const QString &text, const QColor &color=Qt::black ); |
63 | const QColor &color( void ); | 68 | const QColor &color( void ); |
64 | void setColor( const QColor &color ); | 69 | void setColor( const QColor &color ); |
65 | 70 | ||
66 | protected: | 71 | protected: |
67 | virtual void paint( QPainter * ); | 72 | virtual void paint( QPainter * ); |
68 | virtual int height( const QListBox * ) const; | 73 | virtual int height( const Q3ListBox * ) const; |
69 | virtual int width( const QListBox * ) const; | 74 | virtual int width( const Q3ListBox * ) const; |
70 | 75 | ||
71 | private: | 76 | private: |
72 | QColor mColor; | 77 | QColor mColor; |
73 | int mBoxWidth; | 78 | int mBoxWidth; |
74 | }; | 79 | }; |
75 | 80 | ||
diff --git a/kaddressbook/views/configurecardviewdialog.cpp b/kaddressbook/views/configurecardviewdialog.cpp index e0fbd21..b6327fe 100644 --- a/kaddressbook/views/configurecardviewdialog.cpp +++ b/kaddressbook/views/configurecardviewdialog.cpp | |||
@@ -22,17 +22,20 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qcheckbox.h> | 27 | #include <qcheckbox.h> |
28 | #include <qvbox.h> | 28 | #include <q3vbox.h> |
29 | #include <qgroupbox.h> | 29 | #include <q3groupbox.h> |
30 | #include <qspinbox.h> | 30 | #include <qspinbox.h> |
31 | #include <qtabwidget.h> | 31 | #include <qtabwidget.h> |
32 | #include <qwhatsthis.h> | 32 | #include <q3whatsthis.h> |
33 | //Added by qt3to4: | ||
34 | #include <Q3GridLayout> | ||
35 | #include <Q3Frame> | ||
33 | 36 | ||
34 | #include <kdebug.h> | 37 | #include <kdebug.h> |
35 | #include <kglobal.h> | 38 | #include <kglobal.h> |
36 | #include <kglobalsettings.h> | 39 | #include <kglobalsettings.h> |
37 | #include <klocale.h> | 40 | #include <klocale.h> |
38 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
@@ -86,13 +89,13 @@ void ConfigureCardViewWidget::saveSettings( KConfig *config ) | |||
86 | mAdvancedPage->saveSettings( config ); | 89 | mAdvancedPage->saveSettings( config ); |
87 | } | 90 | } |
88 | 91 | ||
89 | //////////////////////// | 92 | //////////////////////// |
90 | // CardViewLookNFeelPage | 93 | // CardViewLookNFeelPage |
91 | CardViewLookNFeelPage::CardViewLookNFeelPage( QWidget *parent, const char *name ) | 94 | CardViewLookNFeelPage::CardViewLookNFeelPage( QWidget *parent, const char *name ) |
92 | : QVBox( parent, name ) | 95 | : Q3VBox( parent, name ) |
93 | { | 96 | { |
94 | initGUI(); | 97 | initGUI(); |
95 | } | 98 | } |
96 | 99 | ||
97 | CardViewLookNFeelPage::~CardViewLookNFeelPage() | 100 | CardViewLookNFeelPage::~CardViewLookNFeelPage() |
98 | { | 101 | { |
@@ -231,124 +234,124 @@ void CardViewLookNFeelPage::initGUI() | |||
231 | int spacing = KDialog::spacingHint(); | 234 | int spacing = KDialog::spacingHint(); |
232 | int margin = KDialog::marginHint(); | 235 | int margin = KDialog::marginHint(); |
233 | 236 | ||
234 | QTabWidget *tabs = new QTabWidget( this ); | 237 | QTabWidget *tabs = new QTabWidget( this ); |
235 | 238 | ||
236 | // Layout | 239 | // Layout |
237 | QVBox *loTab = new QVBox( this, "layouttab" ); | 240 | Q3VBox *loTab = new Q3VBox( this, "layouttab" ); |
238 | 241 | ||
239 | loTab->setSpacing( spacing ); | 242 | loTab->setSpacing( spacing ); |
240 | loTab->setMargin( margin ); | 243 | loTab->setMargin( margin ); |
241 | 244 | ||
242 | QGroupBox *gbGeneral = new QGroupBox( 1, Qt::Horizontal, i18n("General"), loTab ); | 245 | Q3GroupBox *gbGeneral = new Q3GroupBox( 1, Qt::Horizontal, i18n("General"), loTab ); |
243 | 246 | ||
244 | cbDrawSeps = new QCheckBox( i18n("Draw &separators"), gbGeneral ); | 247 | cbDrawSeps = new QCheckBox( i18n("Draw &separators"), gbGeneral ); |
245 | 248 | ||
246 | QHBox *hbSW = new QHBox( gbGeneral ); | 249 | Q3HBox *hbSW = new Q3HBox( gbGeneral ); |
247 | QLabel *lSW = new QLabel( i18n("Separator &width:"), hbSW ); | 250 | QLabel *lSW = new QLabel( i18n("Separator &width:"), hbSW ); |
248 | sbSepWidth = new QSpinBox( 1, 50, 1, hbSW ); | 251 | sbSepWidth = new QSpinBox( 1, 50, 1, hbSW ); |
249 | lSW->setBuddy( sbSepWidth); | 252 | lSW->setBuddy( sbSepWidth); |
250 | 253 | ||
251 | QHBox *hbPadding = new QHBox( gbGeneral ); | 254 | Q3HBox *hbPadding = new Q3HBox( gbGeneral ); |
252 | QLabel *lSpacing = new QLabel( i18n("&Padding:"), hbPadding ); | 255 | QLabel *lSpacing = new QLabel( i18n("&Padding:"), hbPadding ); |
253 | sbSpacing = new QSpinBox( 0, 100, 1, hbPadding ); | 256 | sbSpacing = new QSpinBox( 0, 100, 1, hbPadding ); |
254 | lSpacing->setBuddy( sbSpacing ); | 257 | lSpacing->setBuddy( sbSpacing ); |
255 | 258 | ||
256 | QGroupBox *gbCards = new QGroupBox( 1, Qt::Horizontal, i18n("Cards"), loTab ); | 259 | Q3GroupBox *gbCards = new Q3GroupBox( 1, Qt::Horizontal, i18n("Cards"), loTab ); |
257 | 260 | ||
258 | QHBox *hbMargin = new QHBox( gbCards ); | 261 | Q3HBox *hbMargin = new Q3HBox( gbCards ); |
259 | QLabel *lMargin = new QLabel( i18n("&Margin:"), hbMargin ); | 262 | QLabel *lMargin = new QLabel( i18n("&Margin:"), hbMargin ); |
260 | sbMargin = new QSpinBox( 0, 100, 1, hbMargin ); | 263 | sbMargin = new QSpinBox( 0, 100, 1, hbMargin ); |
261 | lMargin->setBuddy( sbMargin ); | 264 | lMargin->setBuddy( sbMargin ); |
262 | 265 | ||
263 | cbDrawBorders = new QCheckBox( i18n("Draw &borders"), gbCards ); | 266 | cbDrawBorders = new QCheckBox( i18n("Draw &borders"), gbCards ); |
264 | 267 | ||
265 | loTab->setStretchFactor( new QWidget( loTab ), 1 ); | 268 | loTab->setStretchFactor( new QWidget( loTab ), 1 ); |
266 | 269 | ||
267 | QWhatsThis::add( sbMargin, i18n( | 270 | Q3WhatsThis::add( sbMargin, i18n( |
268 | "The item margin is the distance (in pixels) between the item edge and the item data. Most noticeably, " | 271 | "The item margin is the distance (in pixels) between the item edge and the item data. Most noticeably, " |
269 | "incrementing the item margin will add space between the focus rectangle and the item data." | 272 | "incrementing the item margin will add space between the focus rectangle and the item data." |
270 | ) ); | 273 | ) ); |
271 | QWhatsThis::add( lMargin, QWhatsThis::textFor( sbMargin ) ); | 274 | /* TODO:hacker: Q3WhatsThis::add( lMargin, Q3WhatsThis::textFor( sbMargin ) ); */ |
272 | QWhatsThis::add( sbSpacing, i18n( | 275 | Q3WhatsThis::add( sbSpacing, i18n( |
273 | "The Item Spacing decides the distance (in pixels) between the items and anything else: the view " | 276 | "The Item Spacing decides the distance (in pixels) between the items and anything else: the view " |
274 | "borders, other items or column separators." | 277 | "borders, other items or column separators." |
275 | ) ); | 278 | ) ); |
276 | QWhatsThis::add( lSpacing, QWhatsThis::textFor( sbSpacing ) ); | 279 | /* TODO:hacker: Q3WhatsThis::add( lSpacing, Q3WhatsThis::textFor( sbSpacing ) ); */ |
277 | QWhatsThis::add( sbSepWidth, i18n("Sets the width of column separators") ); | 280 | Q3WhatsThis::add( sbSepWidth, i18n("Sets the width of column separators") ); |
278 | QWhatsThis::add( lSW, QWhatsThis::textFor( sbSepWidth ) ); | 281 | /* TODO:hacker: Q3WhatsThis::add( lSW, Q3WhatsThis::textFor( sbSepWidth ) ); */ |
279 | 282 | ||
280 | tabs->addTab( loTab, i18n("&Layout") ); | 283 | tabs->addTab( loTab, i18n("&Layout") ); |
281 | 284 | ||
282 | // Colors | 285 | // Colors |
283 | QVBox *colorTab = new QVBox( this, "colortab" ); | 286 | Q3VBox *colorTab = new Q3VBox( this, "colortab" ); |
284 | colorTab->setSpacing( spacing ); | 287 | colorTab->setSpacing( spacing ); |
285 | colorTab->setMargin( spacing ); | 288 | colorTab->setMargin( spacing ); |
286 | cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); | 289 | cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); |
287 | connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); | 290 | connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); |
288 | lbColors = new ColorListBox( colorTab ); | 291 | lbColors = new ColorListBox( colorTab ); |
289 | tabs->addTab( colorTab, i18n("&Colors") ); | 292 | tabs->addTab( colorTab, i18n("&Colors") ); |
290 | 293 | ||
291 | QWhatsThis::add( cbEnableCustomColors, i18n( | 294 | Q3WhatsThis::add( cbEnableCustomColors, i18n( |
292 | "If custom colors are enabled, you may choose the colors for the view below. " | 295 | "If custom colors are enabled, you may choose the colors for the view below. " |
293 | "Otherwise colors from your current KDE color scheme are used." | 296 | "Otherwise colors from your current KDE color scheme are used." |
294 | ) ); | 297 | ) ); |
295 | QWhatsThis::add( lbColors, i18n( | 298 | Q3WhatsThis::add( lbColors, i18n( |
296 | "Double click or press RETURN on a item to select a color for the related strings in the view." | 299 | "Double click or press RETURN on a item to select a color for the related strings in the view." |
297 | ) ); | 300 | ) ); |
298 | 301 | ||
299 | // Fonts | 302 | // Fonts |
300 | QVBox *fntTab = new QVBox( this, "fonttab" ); | 303 | Q3VBox *fntTab = new Q3VBox( this, "fonttab" ); |
301 | 304 | ||
302 | fntTab->setSpacing( spacing ); | 305 | fntTab->setSpacing( spacing ); |
303 | fntTab->setMargin( spacing ); | 306 | fntTab->setMargin( spacing ); |
304 | 307 | ||
305 | cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); | 308 | cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); |
306 | connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); | 309 | connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); |
307 | 310 | ||
308 | vbFonts = new QWidget( fntTab ); | 311 | vbFonts = new QWidget( fntTab ); |
309 | QGridLayout *gFnts = new QGridLayout( vbFonts, 2, 3 ); | 312 | Q3GridLayout *gFnts = new Q3GridLayout( vbFonts, 2, 3 ); |
310 | gFnts->setSpacing( spacing ); | 313 | gFnts->setSpacing( spacing ); |
311 | gFnts->setAutoAdd( true ); | 314 | gFnts->setAutoAdd( true ); |
312 | gFnts->setColStretch( 1, 1 ); | 315 | gFnts->setColStretch( 1, 1 ); |
313 | QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); | 316 | QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); |
314 | lTextFont = new QLabel( vbFonts ); | 317 | lTextFont = new QLabel( vbFonts ); |
315 | lTextFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); | 318 | lTextFont->setFrameStyle( Q3Frame::Panel|Q3Frame::Sunken ); |
316 | #ifndef KAB_EMBEDDED | 319 | #ifndef KAB_EMBEDDED |
317 | btnFont = new KPushButton( i18n("Choose..."), vbFonts ); | 320 | btnFont = new KPushButton( i18n("Choose..."), vbFonts ); |
318 | #else //KAB_EMBEDDED | 321 | #else //KAB_EMBEDDED |
319 | btnFont = new QPushButton( i18n("Choose..."), vbFonts ); | 322 | btnFont = new QPushButton( i18n("Choose..."), vbFonts ); |
320 | #endif //KAB_EMBEDDED | 323 | #endif //KAB_EMBEDDED |
321 | 324 | ||
322 | lTFnt->setBuddy( btnFont ); | 325 | lTFnt->setBuddy( btnFont ); |
323 | 326 | ||
324 | connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) ); | 327 | connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) ); |
325 | 328 | ||
326 | QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts ); | 329 | QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts ); |
327 | lHeaderFont = new QLabel( vbFonts ); | 330 | lHeaderFont = new QLabel( vbFonts ); |
328 | lHeaderFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); | 331 | lHeaderFont->setFrameStyle( Q3Frame::Panel|Q3Frame::Sunken ); |
329 | #ifndef KAB_EMBEDDED | 332 | #ifndef KAB_EMBEDDED |
330 | btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts ); | 333 | btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts ); |
331 | #else //KAB_EMBEDDED | 334 | #else //KAB_EMBEDDED |
332 | btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts ); | 335 | btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts ); |
333 | #endif //KAB_EMBEDDED | 336 | #endif //KAB_EMBEDDED |
334 | lHFnt->setBuddy( btnHeaderFont ); | 337 | lHFnt->setBuddy( btnHeaderFont ); |
335 | connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) ); | 338 | connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) ); |
336 | 339 | ||
337 | fntTab->setStretchFactor( new QWidget( fntTab ), 1 ); | 340 | fntTab->setStretchFactor( new QWidget( fntTab ), 1 ); |
338 | 341 | ||
339 | QWhatsThis::add( cbEnableCustomFonts, i18n( | 342 | Q3WhatsThis::add( cbEnableCustomFonts, i18n( |
340 | "If custom fonts are enabled, you may choose which fonts to use for this view below. " | 343 | "If custom fonts are enabled, you may choose which fonts to use for this view below. " |
341 | "Otherwise the default KDE font will be used, in bold style for the header and " | 344 | "Otherwise the default KDE font will be used, in bold style for the header and " |
342 | "normal style for the data." | 345 | "normal style for the data." |
343 | ) ); | 346 | ) ); |
344 | 347 | ||
345 | tabs->addTab( fntTab, i18n("&Fonts") ); | 348 | tabs->addTab( fntTab, i18n("&Fonts") ); |
346 | 349 | ||
347 | // Behaviour | 350 | // Behaviour |
348 | QVBox *behaviourTab = new QVBox( this ); | 351 | Q3VBox *behaviourTab = new Q3VBox( this ); |
349 | behaviourTab->setMargin( margin ); | 352 | behaviourTab->setMargin( margin ); |
350 | behaviourTab->setSpacing( spacing ); | 353 | behaviourTab->setSpacing( spacing ); |
351 | 354 | ||
352 | cbShowEmptyFields = new QCheckBox( i18n("Show &empty fields"), behaviourTab ); | 355 | cbShowEmptyFields = new QCheckBox( i18n("Show &empty fields"), behaviourTab ); |
353 | cbShowFieldLabels = new QCheckBox( i18n("Show field &labels"), behaviourTab ); | 356 | cbShowFieldLabels = new QCheckBox( i18n("Show field &labels"), behaviourTab ); |
354 | 357 | ||
@@ -361,9 +364,9 @@ void CardViewLookNFeelPage::initGUI() | |||
361 | void CardViewLookNFeelPage::updateFontLabel( QFont fnt, QLabel *l ) | 364 | void CardViewLookNFeelPage::updateFontLabel( QFont fnt, QLabel *l ) |
362 | { | 365 | { |
363 | l->setFont( fnt ); | 366 | l->setFont( fnt ); |
364 | l->setText( QString( fnt.family() + " %1" ).arg( fnt.pointSize() ) ); | 367 | l->setText( QString( fnt.family() + " %1" ).arg( fnt.pointSize() ) ); |
365 | } | 368 | } |
366 | 369 | ||
367 | #ifndef KAB_EMBEDDED | 370 | #ifndef KAB_EMBEDDED_ |
368 | #include "configurecardviewdialog.moc" | 371 | #include "moc_configurecardviewdialog.cpp" |
369 | #endif //KAB_EMBEDDED | 372 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/configurecardviewdialog.h b/kaddressbook/views/configurecardviewdialog.h index 7a62226..4af475d 100644 --- a/kaddressbook/views/configurecardviewdialog.h +++ b/kaddressbook/views/configurecardviewdialog.h | |||
@@ -23,15 +23,17 @@ | |||
23 | 23 | ||
24 | #ifndef CONFIGURECARDVIEWDIALOG_H | 24 | #ifndef CONFIGURECARDVIEWDIALOG_H |
25 | #define CONFIGURECARDVIEWDIALOG_H | 25 | #define CONFIGURECARDVIEWDIALOG_H |
26 | 26 | ||
27 | #include "viewconfigurewidget.h" | 27 | #include "viewconfigurewidget.h" |
28 | 28 | ||
29 | #include <qvbox.h> | 29 | #include <q3vbox.h> |
30 | #include <qwidget.h> | 30 | #include <qwidget.h> |
31 | #include <qfont.h> | 31 | #include <qfont.h> |
32 | //Added by qt3to4: | ||
33 | #include <QLabel> | ||
32 | 34 | ||
33 | class QString; | 35 | class QString; |
34 | class QWidget; | 36 | class QWidget; |
35 | class QCheckBox; | 37 | class QCheckBox; |
36 | class QLabel; | 38 | class QLabel; |
37 | class KConfig; | 39 | class KConfig; |
@@ -74,13 +76,13 @@ class ConfigureCardViewWidget : public ViewConfigureWidget | |||
74 | 76 | ||
75 | Layout | 77 | Layout |
76 | * item margin | 78 | * item margin |
77 | * item spacing | 79 | * item spacing |
78 | */ | 80 | */ |
79 | 81 | ||
80 | class CardViewLookNFeelPage : public QVBox { | 82 | class CardViewLookNFeelPage : public Q3VBox { |
81 | 83 | ||
82 | Q_OBJECT | 84 | Q_OBJECT |
83 | 85 | ||
84 | public: | 86 | public: |
85 | CardViewLookNFeelPage( QWidget *parent=0, const char *name=0 ); | 87 | CardViewLookNFeelPage( QWidget *parent=0, const char *name=0 ); |
86 | ~CardViewLookNFeelPage(); | 88 | ~CardViewLookNFeelPage(); |
diff --git a/kaddressbook/views/configuretableviewdialog.cpp b/kaddressbook/views/configuretableviewdialog.cpp index c329cd9..7ed897a 100644 --- a/kaddressbook/views/configuretableviewdialog.cpp +++ b/kaddressbook/views/configuretableviewdialog.cpp | |||
@@ -24,17 +24,20 @@ | |||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qwidget.h> | 25 | #include <qwidget.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qradiobutton.h> | 28 | #include <qradiobutton.h> |
29 | #include <qcheckbox.h> | 29 | #include <qcheckbox.h> |
30 | #include <qvbox.h> | 30 | #include <q3vbox.h> |
31 | #include <qbuttongroup.h> | 31 | #include <q3buttongroup.h> |
32 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
33 | #include <qwhatsthis.h> | 33 | #include <q3whatsthis.h> |
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | //Added by qt3to4: | ||
36 | #include <Q3GridLayout> | ||
37 | #include <Q3Frame> | ||
35 | 38 | ||
36 | #include <kglobal.h> | 39 | #include <kglobal.h> |
37 | #include <klocale.h> | 40 | #include <klocale.h> |
38 | #include <klineedit.h> | 41 | #include <klineedit.h> |
39 | #include <kurlrequester.h> | 42 | #include <kurlrequester.h> |
40 | #include <kiconloader.h> | 43 | #include <kiconloader.h> |
@@ -81,13 +84,13 @@ void ConfigureTableViewWidget::saveSettings( KConfig *config ) | |||
81 | mPage->saveSettings( config ); | 84 | mPage->saveSettings( config ); |
82 | } | 85 | } |
83 | 86 | ||
84 | 87 | ||
85 | 88 | ||
86 | LookAndFeelPage::LookAndFeelPage(QWidget *parent, const char *name) | 89 | LookAndFeelPage::LookAndFeelPage(QWidget *parent, const char *name) |
87 | : QVBox(parent, name) | 90 | : Q3VBox(parent, name) |
88 | { | 91 | { |
89 | initGUI(); | 92 | initGUI(); |
90 | 93 | ||
91 | // Set initial state | 94 | // Set initial state |
92 | enableBackgroundToggled(mBackgroundBox->isChecked()); | 95 | enableBackgroundToggled(mBackgroundBox->isChecked()); |
93 | } | 96 | } |
@@ -226,18 +229,18 @@ void LookAndFeelPage::initGUI() | |||
226 | int spacing = KDialog::spacingHint(); | 229 | int spacing = KDialog::spacingHint(); |
227 | int margin = KDialog::marginHint(); | 230 | int margin = KDialog::marginHint(); |
228 | 231 | ||
229 | QTabWidget *tabs = new QTabWidget( this ); | 232 | QTabWidget *tabs = new QTabWidget( this ); |
230 | 233 | ||
231 | // General | 234 | // General |
232 | QVBox *generalTab = new QVBox( this, "generaltab" ); | 235 | Q3VBox *generalTab = new Q3VBox( this, "generaltab" ); |
233 | 236 | ||
234 | generalTab->setSpacing( spacing ); | 237 | generalTab->setSpacing( spacing ); |
235 | generalTab->setMargin( margin ); | 238 | generalTab->setMargin( margin ); |
236 | 239 | ||
237 | QButtonGroup *group = new QButtonGroup(1, Qt::Horizontal, | 240 | Q3ButtonGroup *group = new Q3ButtonGroup(1, Qt::Horizontal, |
238 | i18n("Row Separator"), generalTab); | 241 | i18n("Row Separator"), generalTab); |
239 | 242 | ||
240 | mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"), | 243 | mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"), |
241 | group, "mAlternateButton"); | 244 | group, "mAlternateButton"); |
242 | mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton"); | 245 | mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton"); |
243 | mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton"); | 246 | mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton"); |
@@ -259,69 +262,69 @@ void LookAndFeelPage::initGUI() | |||
259 | mToolTipBox = new QCheckBox(i18n("Enable contact tooltips"), generalTab, | 262 | mToolTipBox = new QCheckBox(i18n("Enable contact tooltips"), generalTab, |
260 | "mToolTipBox"); | 263 | "mToolTipBox"); |
261 | 264 | ||
262 | tabs->addTab( generalTab, i18n("&General") ); | 265 | tabs->addTab( generalTab, i18n("&General") ); |
263 | 266 | ||
264 | // Colors | 267 | // Colors |
265 | QVBox *colorTab = new QVBox( this, "colortab" ); | 268 | Q3VBox *colorTab = new Q3VBox( this, "colortab" ); |
266 | colorTab->setSpacing( spacing ); | 269 | colorTab->setSpacing( spacing ); |
267 | colorTab->setMargin( spacing ); | 270 | colorTab->setMargin( spacing ); |
268 | cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); | 271 | cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab ); |
269 | connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); | 272 | connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) ); |
270 | lbColors = new ColorListBox( colorTab ); | 273 | lbColors = new ColorListBox( colorTab ); |
271 | tabs->addTab( colorTab, i18n("&Colors") ); | 274 | tabs->addTab( colorTab, i18n("&Colors") ); |
272 | 275 | ||
273 | QWhatsThis::add( cbEnableCustomColors, i18n( | 276 | Q3WhatsThis::add( cbEnableCustomColors, i18n( |
274 | "If custom colors are enabled, you may choose the colors for the view below. " | 277 | "If custom colors are enabled, you may choose the colors for the view below. " |
275 | "Otherwise colors from your current KDE color scheme are used." | 278 | "Otherwise colors from your current KDE color scheme are used." |
276 | ) ); | 279 | ) ); |
277 | QWhatsThis::add( lbColors, i18n( | 280 | Q3WhatsThis::add( lbColors, i18n( |
278 | "Double click or press RETURN on a item to select a color for the related strings in the view." | 281 | "Double click or press RETURN on a item to select a color for the related strings in the view." |
279 | ) ); | 282 | ) ); |
280 | 283 | ||
281 | // Fonts | 284 | // Fonts |
282 | QVBox *fntTab = new QVBox( this, "fonttab" ); | 285 | Q3VBox *fntTab = new Q3VBox( this, "fonttab" ); |
283 | 286 | ||
284 | fntTab->setSpacing( spacing ); | 287 | fntTab->setSpacing( spacing ); |
285 | fntTab->setMargin( spacing ); | 288 | fntTab->setMargin( spacing ); |
286 | 289 | ||
287 | cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); | 290 | cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab ); |
288 | connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); | 291 | connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) ); |
289 | 292 | ||
290 | vbFonts = new QWidget( fntTab ); | 293 | vbFonts = new QWidget( fntTab ); |
291 | QGridLayout *gFnts = new QGridLayout( vbFonts, 2, 3 ); | 294 | Q3GridLayout *gFnts = new Q3GridLayout( vbFonts, 2, 3 ); |
292 | gFnts->setSpacing( spacing ); | 295 | gFnts->setSpacing( spacing ); |
293 | gFnts->setAutoAdd( true ); | 296 | gFnts->setAutoAdd( true ); |
294 | gFnts->setColStretch( 1, 1 ); | 297 | gFnts->setColStretch( 1, 1 ); |
295 | QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); | 298 | QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts ); |
296 | lTextFont = new QLabel( vbFonts ); | 299 | lTextFont = new QLabel( vbFonts ); |
297 | lTextFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); | 300 | lTextFont->setFrameStyle( Q3Frame::Panel|Q3Frame::Sunken ); |
298 | #ifndef KAB_EMBEDDED | 301 | #ifndef KAB_EMBEDDED |
299 | btnFont = new KPushButton( i18n("Choose..."), vbFonts ); | 302 | btnFont = new KPushButton( i18n("Choose..."), vbFonts ); |
300 | #else //KAB_EMBEDDED | 303 | #else //KAB_EMBEDDED |
301 | btnFont = new QPushButton( i18n("Choose..."), vbFonts ); | 304 | btnFont = new QPushButton( i18n("Choose..."), vbFonts ); |
302 | #endif //KAB_EMBEDDED | 305 | #endif //KAB_EMBEDDED |
303 | 306 | ||
304 | lTFnt->setBuddy( btnFont ); | 307 | lTFnt->setBuddy( btnFont ); |
305 | 308 | ||
306 | connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) ); | 309 | connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) ); |
307 | 310 | ||
308 | QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts ); | 311 | QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts ); |
309 | lHeaderFont = new QLabel( vbFonts ); | 312 | lHeaderFont = new QLabel( vbFonts ); |
310 | lHeaderFont->setFrameStyle( QFrame::Panel|QFrame::Sunken ); | 313 | lHeaderFont->setFrameStyle( Q3Frame::Panel|Q3Frame::Sunken ); |
311 | #ifndef KAB_EMBEDDED | 314 | #ifndef KAB_EMBEDDED |
312 | btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts ); | 315 | btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts ); |
313 | #else //KAB_EMBEDDED | 316 | #else //KAB_EMBEDDED |
314 | btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts ); | 317 | btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts ); |
315 | #endif //KAB_EMBEDDED | 318 | #endif //KAB_EMBEDDED |
316 | lHFnt->setBuddy( btnHeaderFont ); | 319 | lHFnt->setBuddy( btnHeaderFont ); |
317 | connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) ); | 320 | connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) ); |
318 | 321 | ||
319 | fntTab->setStretchFactor( new QWidget( fntTab ), 1 ); | 322 | fntTab->setStretchFactor( new QWidget( fntTab ), 1 ); |
320 | 323 | ||
321 | QWhatsThis::add( cbEnableCustomFonts, i18n( | 324 | Q3WhatsThis::add( cbEnableCustomFonts, i18n( |
322 | "If custom fonts are enabled, you may choose which fonts to use for this view below. " | 325 | "If custom fonts are enabled, you may choose which fonts to use for this view below. " |
323 | "Otherwise the default KDE font will be used, in bold style for the header and " | 326 | "Otherwise the default KDE font will be used, in bold style for the header and " |
324 | "normal style for the data." | 327 | "normal style for the data." |
325 | ) ); | 328 | ) ); |
326 | 329 | ||
327 | tabs->addTab( fntTab, i18n("&Fonts") ); | 330 | tabs->addTab( fntTab, i18n("&Fonts") ); |
@@ -337,9 +340,9 @@ void LookAndFeelPage::enableBackgroundToggled(bool enabled) | |||
337 | void LookAndFeelPage::updateFontLabel( QFont fnt, QLabel *l ) | 340 | void LookAndFeelPage::updateFontLabel( QFont fnt, QLabel *l ) |
338 | { | 341 | { |
339 | l->setFont( fnt ); | 342 | l->setFont( fnt ); |
340 | l->setText( QString( fnt.family() + " %1" ).arg( fnt.pointSize() ) ); | 343 | l->setText( QString( fnt.family() + " %1" ).arg( fnt.pointSize() ) ); |
341 | } | 344 | } |
342 | 345 | ||
343 | #ifndef KAB_EMBEDDED | 346 | #ifndef KAB_EMBEDDED_ |
344 | #include "configuretableviewdialog.moc" | 347 | #include "moc_configuretableviewdialog.cpp" |
345 | #endif //KAB_EMBEDDED | 348 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/configuretableviewdialog.h b/kaddressbook/views/configuretableviewdialog.h index 003ccf8..8125fc9 100644 --- a/kaddressbook/views/configuretableviewdialog.h +++ b/kaddressbook/views/configuretableviewdialog.h | |||
@@ -23,13 +23,15 @@ | |||
23 | 23 | ||
24 | #ifndef CONFIGURETABLEVIEWDIALOG_H | 24 | #ifndef CONFIGURETABLEVIEWDIALOG_H |
25 | #define CONFIGURETABLEVIEWDIALOG_H | 25 | #define CONFIGURETABLEVIEWDIALOG_H |
26 | 26 | ||
27 | #include "viewconfigurewidget.h" | 27 | #include "viewconfigurewidget.h" |
28 | 28 | ||
29 | #include <qvbox.h> | 29 | #include <q3vbox.h> |
30 | //Added by qt3to4: | ||
31 | #include <QLabel> | ||
30 | 32 | ||
31 | class QString; | 33 | class QString; |
32 | class QWidget; | 34 | class QWidget; |
33 | class QRadioButton; | 35 | class QRadioButton; |
34 | class QCheckBox; | 36 | class QCheckBox; |
35 | class KURLRequester; | 37 | class KURLRequester; |
@@ -60,13 +62,13 @@ class ConfigureTableViewWidget : public ViewConfigureWidget | |||
60 | LookAndFeelPage *mPage; | 62 | LookAndFeelPage *mPage; |
61 | }; | 63 | }; |
62 | 64 | ||
63 | /** | 65 | /** |
64 | Internal class. It is only defined here for moc | 66 | Internal class. It is only defined here for moc |
65 | */ | 67 | */ |
66 | class LookAndFeelPage : public QVBox | 68 | class LookAndFeelPage : public Q3VBox |
67 | { | 69 | { |
68 | Q_OBJECT | 70 | Q_OBJECT |
69 | 71 | ||
70 | public: | 72 | public: |
71 | LookAndFeelPage( QWidget *parent, const char *name = 0 ); | 73 | LookAndFeelPage( QWidget *parent, const char *name = 0 ); |
72 | ~LookAndFeelPage() {} | 74 | ~LookAndFeelPage() {} |
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp index 9accf78..227645d 100644 --- a/kaddressbook/views/contactlistview.cpp +++ b/kaddressbook/views/contactlistview.cpp | |||
@@ -18,21 +18,26 @@ | |||
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qheader.h> | 24 | #include <q3header.h> |
25 | #include <qiconset.h> | 25 | #include <qicon.h> |
26 | #include <qimage.h> | 26 | #include <qimage.h> |
27 | #include <qdragobject.h> | 27 | #include <q3dragobject.h> |
28 | #include <qcombobox.h> | 28 | #include <qcombobox.h> |
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qbrush.h> | 30 | #include <qbrush.h> |
31 | #include <qevent.h> | 31 | #include <qevent.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | //Added by qt3to4: | ||
34 | #include <QDropEvent> | ||
35 | #include <QPixmap> | ||
36 | #include <QMouseEvent> | ||
37 | #include <QKeyEvent> | ||
33 | 38 | ||
34 | #include <klocale.h> | 39 | #include <klocale.h> |
35 | #include <kglobalsettings.h> | 40 | #include <kglobalsettings.h> |
36 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
37 | #include <kdebug.h> | 42 | #include <kdebug.h> |
38 | #include <kconfig.h> | 43 | #include <kconfig.h> |
@@ -44,29 +49,30 @@ | |||
44 | #include "contactlistview.h" | 49 | #include "contactlistview.h" |
45 | 50 | ||
46 | ///////////////////////////////// | 51 | ///////////////////////////////// |
47 | // DynamicTip Methods | 52 | // DynamicTip Methods |
48 | 53 | ||
49 | DynamicTip::DynamicTip( ContactListView *parent) | 54 | DynamicTip::DynamicTip( ContactListView *parent) |
50 | : QToolTip( parent ) | 55 | /* TODO:hacker:: QToolTip( parent ) */ |
51 | { | 56 | { |
52 | } | 57 | } |
53 | 58 | ||
54 | void DynamicTip::maybeTip( const QPoint &pos ) | 59 | void DynamicTip::maybeTip( const QPoint &pos ) |
55 | { | 60 | { |
61 | /* TODO:hacker: | ||
56 | static bool ishidden = true; | 62 | static bool ishidden = true; |
57 | if (!parentWidget()->inherits( "ContactListView" )) | 63 | if (!parentWidget()->inherits( "ContactListView" )) |
58 | return; | 64 | return; |
59 | 65 | ||
60 | ContactListView *plv = (ContactListView*)parentWidget(); | 66 | ContactListView *plv = (ContactListView*)parentWidget(); |
61 | if (!plv->tooltips()) | 67 | if (!plv->tooltips()) |
62 | return; | 68 | return; |
63 | 69 | ||
64 | QPoint posVp = plv->viewport()->pos(); | 70 | QPoint posVp = plv->viewport()->pos(); |
65 | 71 | ||
66 | QListViewItem *lvi = plv->itemAt( pos - posVp ); | 72 | Q3ListViewItem *lvi = plv->itemAt( pos - posVp ); |
67 | if (!lvi) | 73 | if (!lvi) |
68 | return; | 74 | return; |
69 | 75 | ||
70 | #ifndef KAB_EMBEDDED | 76 | #ifndef KAB_EMBEDDED |
71 | ContactListViewItem *plvi = dynamic_cast< ContactListViewItem* >(lvi); | 77 | ContactListViewItem *plvi = dynamic_cast< ContactListViewItem* >(lvi); |
72 | #else //KAB_EMBEDDED | 78 | #else //KAB_EMBEDDED |
@@ -148,13 +154,13 @@ void DynamicTip::maybeTip( const QPoint &pos ) | |||
148 | 154 | ||
149 | tip( r, s ); | 155 | tip( r, s ); |
150 | } | 156 | } |
151 | else | 157 | else |
152 | hide(); | 158 | hide(); |
153 | ishidden = !ishidden; | 159 | ishidden = !ishidden; |
154 | 160 | */ | |
155 | } | 161 | } |
156 | 162 | ||
157 | /////////////////////////// | 163 | /////////////////////////// |
158 | // ContactListViewItem Methods | 164 | // ContactListViewItem Methods |
159 | 165 | ||
160 | ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, | 166 | ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, |
@@ -170,13 +176,13 @@ ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, | |||
170 | QString ContactListViewItem::key(int column, bool ascending) const | 176 | QString ContactListViewItem::key(int column, bool ascending) const |
171 | { | 177 | { |
172 | #ifndef DESKTOP_VERSION | 178 | #ifndef DESKTOP_VERSION |
173 | int lan = KGlobal::locale()->language(); | 179 | int lan = KGlobal::locale()->language(); |
174 | //qDebug("language %d ", lan); | 180 | //qDebug("language %d ", lan); |
175 | if ( lan == 1 ) { //GERMAN | 181 | if ( lan == 1 ) { //GERMAN |
176 | QString ret = QListViewItem::key(column, ascending).lower().utf8(); | 182 | QString ret = Q3ListViewItem::key(column, ascending).lower().utf8(); |
177 | int start = -1; | 183 | int start = -1; |
178 | while ( (start = ret.find( 'ä', start+1)) > 0 ) { | 184 | while ( (start = ret.find( 'ä', start+1)) > 0 ) { |
179 | ret.at(start-1) = 'a'; | 185 | ret.at(start-1) = 'a'; |
180 | } | 186 | } |
181 | start = -1; | 187 | start = -1; |
182 | while ( (start = ret.find( 'ö', start+1)) > 0 ) { | 188 | while ( (start = ret.find( 'ö', start+1)) > 0 ) { |
@@ -194,13 +200,13 @@ QString ContactListViewItem::key(int column, bool ascending) const | |||
194 | 200 | ||
195 | return ret; | 201 | return ret; |
196 | 202 | ||
197 | } | 203 | } |
198 | else | 204 | else |
199 | #endif | 205 | #endif |
200 | return QListViewItem::key(column, ascending).lower(); | 206 | return Q3ListViewItem::key(column, ascending).lower(); |
201 | } | 207 | } |
202 | 208 | ||
203 | void ContactListViewItem::paintCell(QPainter * p, | 209 | void ContactListViewItem::paintCell(QPainter * p, |
204 | const QColorGroup & cg, | 210 | const QColorGroup & cg, |
205 | int column, | 211 | int column, |
206 | int width, | 212 | int width, |
@@ -285,13 +291,13 @@ void ContactListView::printMe() | |||
285 | #ifdef DESKTOP_VERSION | 291 | #ifdef DESKTOP_VERSION |
286 | QPrinter printer; | 292 | QPrinter printer; |
287 | if (!printer.setup() ) | 293 | if (!printer.setup() ) |
288 | return; | 294 | return; |
289 | QPainter p; | 295 | QPainter p; |
290 | p.begin ( &printer ); | 296 | p.begin ( &printer ); |
291 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 297 | Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer ); |
292 | float dx, dy; | 298 | float dx, dy; |
293 | int wid = (m.width() * 9)/10; | 299 | int wid = (m.width() * 9)/10; |
294 | dx = (float) wid/(float)contentsWidth (); | 300 | dx = (float) wid/(float)contentsWidth (); |
295 | dy = (float)(m.height()) / (float)contentsHeight (); | 301 | dy = (float)(m.height()) / (float)contentsHeight (); |
296 | float scale; | 302 | float scale; |
297 | // scale to fit the width or height of the paper | 303 | // scale to fit the width or height of the paper |
@@ -340,23 +346,23 @@ void ContactListView::contentsMousePressEvent(QMouseEvent* e) | |||
340 | } | 346 | } |
341 | 347 | ||
342 | 348 | ||
343 | // To initiate a drag operation | 349 | // To initiate a drag operation |
344 | void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) | 350 | void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) |
345 | { | 351 | { |
346 | if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { | 352 | if ((e->state() & Qt::LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { |
347 | emit startAddresseeDrag(); | 353 | emit startAddresseeDrag(); |
348 | } | 354 | } |
349 | else | 355 | else |
350 | KListView::contentsMouseMoveEvent( e ); | 356 | KListView::contentsMouseMoveEvent( e ); |
351 | } | 357 | } |
352 | 358 | ||
353 | bool ContactListView::acceptDrag(QDropEvent *e) const | 359 | bool ContactListView::acceptDrag(QDropEvent *e) const |
354 | { | 360 | { |
355 | #ifndef KAB_EMBEDDED | 361 | #ifndef KAB_EMBEDDED |
356 | return QTextDrag::canDecode(e); | 362 | return Q3TextDrag::canDecode(e); |
357 | #else //KAB_EMBEDDED | 363 | #else //KAB_EMBEDDED |
358 | qDebug("ContactListView::acceptDrag has to be fixed"); | 364 | qDebug("ContactListView::acceptDrag has to be fixed"); |
359 | return false; | 365 | return false; |
360 | #endif //KAB_EMBEDDED | 366 | #endif //KAB_EMBEDDED |
361 | } | 367 | } |
362 | 368 | ||
@@ -421,9 +427,9 @@ void ContactListView::keyReleaseEvent ( QKeyEvent * e ) | |||
421 | qApp->processEvents(); | 427 | qApp->processEvents(); |
422 | mFlagBlockKeyPressed = false; | 428 | mFlagBlockKeyPressed = false; |
423 | mFlagKeyPressed = false; | 429 | mFlagKeyPressed = false; |
424 | } | 430 | } |
425 | KListView::keyReleaseEvent ( e ); | 431 | KListView::keyReleaseEvent ( e ); |
426 | } | 432 | } |
427 | #ifndef KAB_EMBEDDED | 433 | #ifndef KAB_EMBEDDED_ |
428 | #include "contactlistview.moc" | 434 | #include "moc_contactlistview.cpp" |
429 | #endif //KAB_EMBEDDED | 435 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/contactlistview.h b/kaddressbook/views/contactlistview.h index 46477e1..c92b002 100644 --- a/kaddressbook/views/contactlistview.h +++ b/kaddressbook/views/contactlistview.h | |||
@@ -2,12 +2,16 @@ | |||
2 | #define CONTACTLISTVIEW_H | 2 | #define CONTACTLISTVIEW_H |
3 | 3 | ||
4 | #include <qcolor.h> | 4 | #include <qcolor.h> |
5 | #include <qpixmap.h> | 5 | #include <qpixmap.h> |
6 | #include <qtooltip.h> | 6 | #include <qtooltip.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | //Added by qt3to4: | ||
9 | #include <QDropEvent> | ||
10 | #include <QMouseEvent> | ||
11 | #include <QKeyEvent> | ||
8 | 12 | ||
9 | #include <klistview.h> | 13 | #include <klistview.h> |
10 | 14 | ||
11 | #include <kabc/field.h> | 15 | #include <kabc/field.h> |
12 | #include <kabc/addressee.h> | 16 | #include <kabc/addressee.h> |
13 | #include <kabc/addressbook.h> | 17 | #include <kabc/addressbook.h> |
@@ -17,13 +21,13 @@ class QDropEvent; | |||
17 | class KAddressBookTableView; | 21 | class KAddressBookTableView; |
18 | class ContactListView; | 22 | class ContactListView; |
19 | 23 | ||
20 | /** The whole tooltip design needs a lot of work. Currently it is | 24 | /** The whole tooltip design needs a lot of work. Currently it is |
21 | * hacked together to function. | 25 | * hacked together to function. |
22 | */ | 26 | */ |
23 | class DynamicTip : public QToolTip | 27 | class DynamicTip /* TODO:hacker: : public QToolTip */ |
24 | { | 28 | { |
25 | public: | 29 | public: |
26 | DynamicTip( ContactListView * parent ); | 30 | DynamicTip( ContactListView * parent ); |
27 | 31 | ||
28 | protected: | 32 | protected: |
29 | void maybeTip( const QPoint & ); | 33 | void maybeTip( const QPoint & ); |
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index b503652..1e5a556 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -18,19 +18,24 @@ | |||
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qdragobject.h> | 24 | #include <q3dragobject.h> |
25 | #include <qevent.h> | 25 | #include <qevent.h> |
26 | #include <qiconview.h> | 26 | #include <q3iconview.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | //Added by qt3to4: | ||
32 | #include <QDropEvent> | ||
33 | #include <QKeyEvent> | ||
34 | #include <Q3VBoxLayout> | ||
35 | #include <QDragEnterEvent> | ||
31 | 36 | ||
32 | #include <kabc/addressbook.h> | 37 | #include <kabc/addressbook.h> |
33 | #include <kabc/addressee.h> | 38 | #include <kabc/addressee.h> |
34 | #include <kconfig.h> | 39 | #include <kconfig.h> |
35 | #include <kdebug.h> | 40 | #include <kdebug.h> |
36 | #include <klocale.h> | 41 | #include <klocale.h> |
@@ -122,13 +127,13 @@ void AddresseeCardView::printMe() | |||
122 | #ifdef DESKTOP_VERSION | 127 | #ifdef DESKTOP_VERSION |
123 | QPrinter printer; | 128 | QPrinter printer; |
124 | if (!printer.setup() ) | 129 | if (!printer.setup() ) |
125 | return; | 130 | return; |
126 | QPainter p; | 131 | QPainter p; |
127 | p.begin ( &printer ); | 132 | p.begin ( &printer ); |
128 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 133 | Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer ); |
129 | float dx, dy; | 134 | float dx, dy; |
130 | int wid = (m.width() * 9)/10; | 135 | int wid = (m.width() * 9)/10; |
131 | dx = (float) wid/(float)contentsWidth (); | 136 | dx = (float) wid/(float)contentsWidth (); |
132 | dy = (float)(m.height()) / (float)contentsHeight (); | 137 | dy = (float)(m.height()) / (float)contentsHeight (); |
133 | float scale; | 138 | float scale; |
134 | // scale to fit the width or height of the paper | 139 | // scale to fit the width or height of the paper |
@@ -145,13 +150,13 @@ void AddresseeCardView::printMe() | |||
145 | } | 150 | } |
146 | 151 | ||
147 | 152 | ||
148 | void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e) | 153 | void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e) |
149 | { | 154 | { |
150 | #ifndef KAB_EMBEDDED | 155 | #ifndef KAB_EMBEDDED |
151 | if (QTextDrag::canDecode(e)) | 156 | if (Q3TextDrag::canDecode(e)) |
152 | e->accept(); | 157 | e->accept(); |
153 | #else //KAB_EMBEDDED | 158 | #else //KAB_EMBEDDED |
154 | qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented"); | 159 | qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented"); |
155 | #endif //KAB_EMBEDDED | 160 | #endif //KAB_EMBEDDED |
156 | } | 161 | } |
157 | 162 | ||
@@ -173,13 +178,13 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, | |||
173 | QWidget *parent, const char *name ) | 178 | QWidget *parent, const char *name ) |
174 | : KAddressBookView( ab, parent, name ) | 179 | : KAddressBookView( ab, parent, name ) |
175 | { | 180 | { |
176 | mShowEmptyFields = false; | 181 | mShowEmptyFields = false; |
177 | 182 | ||
178 | // Init the GUI | 183 | // Init the GUI |
179 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); | 184 | Q3VBoxLayout *layout = new Q3VBoxLayout(viewWidget()); |
180 | 185 | ||
181 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); | 186 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); |
182 | mCardView->setSelectionMode(CardView::Extended); | 187 | mCardView->setSelectionMode(CardView::Extended); |
183 | layout->addWidget(mCardView); | 188 | layout->addWidget(mCardView); |
184 | 189 | ||
185 | // Connect up the signals | 190 | // Connect up the signals |
@@ -517,9 +522,9 @@ void KAddressBookCardView::addresseeSelected() | |||
517 | } | 522 | } |
518 | 523 | ||
519 | if (!found) | 524 | if (!found) |
520 | emit selected(QString::null); | 525 | emit selected(QString::null); |
521 | 526 | ||
522 | } | 527 | } |
523 | #ifndef KAB_EMBEDDED | 528 | #ifndef KAB_EMBEDDED_ |
524 | #include "kaddressbookcardview.moc" | 529 | #include "moc_kaddressbookcardview.cpp" |
525 | #endif //KAB_EMBEDDED | 530 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/kaddressbookcardview.h b/kaddressbook/views/kaddressbookcardview.h index 2a71f7e..8f8e48b 100644 --- a/kaddressbook/views/kaddressbookcardview.h +++ b/kaddressbook/views/kaddressbookcardview.h | |||
@@ -22,12 +22,15 @@ | |||
22 | As a special exception, permission is given to link this program | 22 | As a special exception, permission is given to link this program |
23 | with any edition of Qt, and distribute the resulting executable, | 23 | with any edition of Qt, and distribute the resulting executable, |
24 | without including the source code for Qt in the source distribution. | 24 | without including the source code for Qt in the source distribution. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | //Added by qt3to4: | ||
29 | #include <QDragEnterEvent> | ||
30 | #include <QDropEvent> | ||
28 | #ifndef KAB_EMBEDDED | 31 | #ifndef KAB_EMBEDDED |
29 | #include <kiconview.h> | 32 | #include <kiconview.h> |
30 | #else //KAB_EMBEDDED | 33 | #else //KAB_EMBEDDED |
31 | #include <klocale.h> | 34 | #include <klocale.h> |
32 | #endif //KAB_EMBEDDED | 35 | #endif //KAB_EMBEDDED |
33 | 36 | ||
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index d6ddec3..3a41a4b 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp | |||
@@ -19,25 +19,33 @@ | |||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KAB_EMBEDDED | 24 | #ifndef KAB_EMBEDDED |
25 | #include <qiconview.h> | 25 | #include <q3iconview.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | 27 | ||
28 | #include <kabc/addressee.h> | 28 | #include <kabc/addressee.h> |
29 | #include <kconfig.h> | 29 | #include <kconfig.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kiconloader.h> | 32 | #include <kiconloader.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | 34 | ||
35 | #else //KAB_EMBEDDED | 35 | #else //KAB_EMBEDDED |
36 | #endif //KAB_EMBEDDED | 36 | #endif //KAB_EMBEDDED |
37 | 37 | ||
38 | //Added by qt3to4: | ||
39 | #include <QDropEvent> | ||
40 | #include <Q3ValueList> | ||
41 | #include <QPixmap> | ||
42 | #include <QKeyEvent> | ||
43 | #include <QEvent> | ||
44 | #include <Q3VBoxLayout> | ||
45 | |||
38 | #include <kabc/addressbook.h> | 46 | #include <kabc/addressbook.h> |
39 | #include "kabprefs.h" | 47 | #include "kabprefs.h" |
40 | #include "viewmanager.h" | 48 | #include "viewmanager.h" |
41 | #include "kaddressbookiconview.h" | 49 | #include "kaddressbookiconview.h" |
42 | #include <qlayout.h> | 50 | #include <qlayout.h> |
43 | #include <qregexp.h> | 51 | #include <qregexp.h> |
@@ -70,70 +78,70 @@ extern "C" { | |||
70 | // AddresseeIconView (internal class) | 78 | // AddresseeIconView (internal class) |
71 | #ifndef KAB_EMBEDDED | 79 | #ifndef KAB_EMBEDDED |
72 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) | 80 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) |
73 | : KIconView(parent, name) | 81 | : KIconView(parent, name) |
74 | #else //KAB_EMBEDDED | 82 | #else //KAB_EMBEDDED |
75 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) | 83 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) |
76 | : QIconView(parent, name) | 84 | : Q3IconView(parent, name) |
77 | #endif //KAB_EMBEDDED | 85 | #endif //KAB_EMBEDDED |
78 | 86 | ||
79 | { | 87 | { |
80 | setSelectionMode( QIconView::Extended ); | 88 | setSelectionMode( Q3IconView::Extended ); |
81 | setResizeMode( QIconView::Adjust ); | 89 | setResizeMode( Q3IconView::Adjust ); |
82 | setWordWrapIconText( true ); | 90 | setWordWrapIconText( true ); |
83 | setGridX( 100 ); | 91 | setGridX( 100 ); |
84 | setItemsMovable(false); | 92 | setItemsMovable(false); |
85 | setSorting(true, true); | 93 | setSorting(true, true); |
86 | 94 | ||
87 | 95 | ||
88 | //US ??? setMode( KIconView::Select ); | 96 | //US ??? setMode( KIconView::Select ); |
89 | 97 | ||
90 | #ifndef KAB_EMBEDDED | 98 | #ifndef KAB_EMBEDDED |
91 | 99 | ||
92 | connect(this, SIGNAL(dropped(QDropEvent*, const QValueList<QIconDragItem>&)), | 100 | connect(this, SIGNAL(dropped(QDropEvent*, const Q3ValueList<Q3IconDragItem>&)), |
93 | this, SLOT(itemDropped(QDropEvent*, const QValueList<QIconDragItem>&))); | 101 | this, SLOT(itemDropped(QDropEvent*, const Q3ValueList<Q3IconDragItem>&))); |
94 | #endif //KAB_EMBEDDED | 102 | #endif //KAB_EMBEDDED |
95 | } | 103 | } |
96 | 104 | ||
97 | AddresseeIconView::~AddresseeIconView() | 105 | AddresseeIconView::~AddresseeIconView() |
98 | { | 106 | { |
99 | } | 107 | } |
100 | 108 | ||
101 | 109 | ||
102 | void AddresseeIconView::itemDropped(QDropEvent *e, | 110 | void AddresseeIconView::itemDropped(QDropEvent *e, |
103 | const QValueList<QIconDragItem> &) | 111 | const Q3ValueList<Q3IconDragItem> &) |
104 | { | 112 | { |
105 | emit addresseeDropped(e); | 113 | emit addresseeDropped(e); |
106 | } | 114 | } |
107 | 115 | ||
108 | QDragObject *AddresseeIconView::dragObject() | 116 | Q3DragObject *AddresseeIconView::dragObject() |
109 | { | 117 | { |
110 | emit startAddresseeDrag(); | 118 | emit startAddresseeDrag(); |
111 | 119 | ||
112 | // We never want IconView to start the drag | 120 | // We never want IconView to start the drag |
113 | return 0; | 121 | return 0; |
114 | } | 122 | } |
115 | //////////////////////////////// | 123 | //////////////////////////////// |
116 | // AddresseeIconViewItem (internal class) | 124 | // AddresseeIconViewItem (internal class) |
117 | #ifndef KAB_EMBEDDED | 125 | #ifndef KAB_EMBEDDED |
118 | class AddresseeIconViewItem : public KIconViewItem | 126 | class AddresseeIconViewItem : public KIconViewItem |
119 | #else //KAB_EMBEDDED | 127 | #else //KAB_EMBEDDED |
120 | class AddresseeIconViewItem : public QIconViewItem | 128 | class AddresseeIconViewItem : public Q3IconViewItem |
121 | #endif //KAB_EMBEDDED | 129 | #endif //KAB_EMBEDDED |
122 | { | 130 | { |
123 | public: | 131 | public: |
124 | #ifndef KAB_EMBEDDED | 132 | #ifndef KAB_EMBEDDED |
125 | AddresseeIconViewItem(const KABC::Field::List &fields, | 133 | AddresseeIconViewItem(const KABC::Field::List &fields, |
126 | KABC::AddressBook *doc, const KABC::Addressee &a, | 134 | KABC::AddressBook *doc, const KABC::Addressee &a, |
127 | QIconView *parent) | 135 | Q3IconView *parent) |
128 | : KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) | 136 | : KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) |
129 | #else //KAB_EMBEDDED | 137 | #else //KAB_EMBEDDED |
130 | AddresseeIconViewItem(const KABC::Field::List &fields, | 138 | AddresseeIconViewItem(const KABC::Field::List &fields, |
131 | KABC::AddressBook *doc, const KABC::Addressee &a, | 139 | KABC::AddressBook *doc, const KABC::Addressee &a, |
132 | QIconView *parent) | 140 | Q3IconView *parent) |
133 | : QIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) | 141 | : Q3IconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) |
134 | #endif //KAB_EMBEDDED | 142 | #endif //KAB_EMBEDDED |
135 | { | 143 | { |
136 | if ( mFields.isEmpty() ) { | 144 | if ( mFields.isEmpty() ) { |
137 | mFields = KABC::Field::defaultFields(); | 145 | mFields = KABC::Field::defaultFields(); |
138 | } | 146 | } |
139 | refresh(); | 147 | refresh(); |
@@ -197,24 +205,24 @@ class AddresseeIconViewItem : public QIconViewItem | |||
197 | 205 | ||
198 | KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, | 206 | KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, |
199 | QWidget *parent, const char *name) | 207 | QWidget *parent, const char *name) |
200 | : KAddressBookView( ab, parent, name ) | 208 | : KAddressBookView( ab, parent, name ) |
201 | { | 209 | { |
202 | // Init the GUI | 210 | // Init the GUI |
203 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); | 211 | Q3VBoxLayout *layout = new Q3VBoxLayout(viewWidget()); |
204 | 212 | ||
205 | mIconView = new AddresseeIconView(viewWidget(), "mIconView"); | 213 | mIconView = new AddresseeIconView(viewWidget(), "mIconView"); |
206 | layout->addWidget(mIconView); | 214 | layout->addWidget(mIconView); |
207 | 215 | ||
208 | // Connect up the signals | 216 | // Connect up the signals |
209 | 217 | ||
210 | //US method executed is part of KIconView | 218 | //US method executed is part of KIconView |
211 | //US connect(mIconView, SIGNAL(executed(QIconViewItem *)), | 219 | //US connect(mIconView, SIGNAL(executed(QIconViewItem *)), |
212 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 220 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
213 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 221 | connect(mIconView, SIGNAL(selectionChanged(Q3IconViewItem *)), |
214 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 222 | this, SLOT(addresseeExecuted(Q3IconViewItem *))); |
215 | 223 | ||
216 | connect(mIconView, SIGNAL(selectionChanged()), | 224 | connect(mIconView, SIGNAL(selectionChanged()), |
217 | this, SLOT(addresseeSelected())); | 225 | this, SLOT(addresseeSelected())); |
218 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), | 226 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), |
219 | this, SIGNAL(dropped(QDropEvent*))); | 227 | this, SIGNAL(dropped(QDropEvent*))); |
220 | connect(mIconView, SIGNAL(startAddresseeDrag()), | 228 | connect(mIconView, SIGNAL(startAddresseeDrag()), |
@@ -245,26 +253,26 @@ void KAddressBookIconView::readConfig(KConfig *config) | |||
245 | { | 253 | { |
246 | KAddressBookView::readConfig(config); | 254 | KAddressBookView::readConfig(config); |
247 | 255 | ||
248 | //US method executed is part of KIconView | 256 | //US method executed is part of KIconView |
249 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), | 257 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), |
250 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 258 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
251 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 259 | disconnect(mIconView, SIGNAL(selectionChanged(Q3IconViewItem *)), |
252 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 260 | this, SLOT(addresseeExecuted(Q3IconViewItem *))); |
253 | 261 | ||
254 | //US method executed is part of KIconView. Use selectionChanged instead | 262 | //US method executed is part of KIconView. Use selectionChanged instead |
255 | /*US | 263 | /*US |
256 | if (KABPrefs::instance()->mHonorSingleClick) | 264 | if (KABPrefs::instance()->mHonorSingleClick) |
257 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), | 265 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), |
258 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 266 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
259 | else | 267 | else |
260 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), | 268 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), |
261 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 269 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
262 | */ | 270 | */ |
263 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 271 | connect(mIconView, SIGNAL(selectionChanged(Q3IconViewItem *)), |
264 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 272 | this, SLOT(addresseeExecuted(Q3IconViewItem *))); |
265 | 273 | ||
266 | } | 274 | } |
267 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | 275 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) |
268 | { | 276 | { |
269 | mIconView->clear(); | 277 | mIconView->clear(); |
270 | mIconList.clear(); | 278 | mIconList.clear(); |
@@ -333,13 +341,13 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | |||
333 | else | 341 | else |
334 | emit selected(QString::null); | 342 | emit selected(QString::null); |
335 | } | 343 | } |
336 | QStringList KAddressBookIconView::selectedUids() | 344 | QStringList KAddressBookIconView::selectedUids() |
337 | { | 345 | { |
338 | QStringList uidList; | 346 | QStringList uidList; |
339 | QIconViewItem *item; | 347 | Q3IconViewItem *item; |
340 | AddresseeIconViewItem *aItem; | 348 | AddresseeIconViewItem *aItem; |
341 | 349 | ||
342 | for (item = mIconView->firstItem(); item; item = item->nextItem()) | 350 | for (item = mIconView->firstItem(); item; item = item->nextItem()) |
343 | { | 351 | { |
344 | if (item->isSelected()) | 352 | if (item->isSelected()) |
345 | { | 353 | { |
@@ -355,13 +363,13 @@ QStringList KAddressBookIconView::selectedUids() | |||
355 | 363 | ||
356 | return uidList; | 364 | return uidList; |
357 | } | 365 | } |
358 | 366 | ||
359 | void KAddressBookIconView::refresh(QString uid) | 367 | void KAddressBookIconView::refresh(QString uid) |
360 | { | 368 | { |
361 | QIconViewItem *item; | 369 | Q3IconViewItem *item; |
362 | AddresseeIconViewItem *aItem; | 370 | AddresseeIconViewItem *aItem; |
363 | 371 | ||
364 | if ( uid.isNull() ) { | 372 | if ( uid.isNull() ) { |
365 | // Rebuild the view | 373 | // Rebuild the view |
366 | mIconView->clear(); | 374 | mIconView->clear(); |
367 | mIconList.clear(); | 375 | mIconList.clear(); |
@@ -403,13 +411,13 @@ void KAddressBookIconView::refresh(QString uid) | |||
403 | refresh( QString::null ); | 411 | refresh( QString::null ); |
404 | } | 412 | } |
405 | } | 413 | } |
406 | 414 | ||
407 | void KAddressBookIconView::setSelected(QString uid, bool selected) | 415 | void KAddressBookIconView::setSelected(QString uid, bool selected) |
408 | { | 416 | { |
409 | QIconViewItem *item; | 417 | Q3IconViewItem *item; |
410 | AddresseeIconViewItem *aItem; | 418 | AddresseeIconViewItem *aItem; |
411 | 419 | ||
412 | if (uid.isNull()) | 420 | if (uid.isNull()) |
413 | { | 421 | { |
414 | mIconView->selectAll(selected); | 422 | mIconView->selectAll(selected); |
415 | } | 423 | } |
@@ -432,13 +440,13 @@ void KAddressBookIconView::setSelected(QString uid, bool selected) | |||
432 | found = true; | 440 | found = true; |
433 | } | 441 | } |
434 | } | 442 | } |
435 | } | 443 | } |
436 | } | 444 | } |
437 | 445 | ||
438 | void KAddressBookIconView::addresseeExecuted(QIconViewItem *item) | 446 | void KAddressBookIconView::addresseeExecuted(Q3IconViewItem *item) |
439 | { | 447 | { |
440 | #ifndef KAB_EMBEDDED | 448 | #ifndef KAB_EMBEDDED |
441 | AddresseeIconViewItem *aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 449 | AddresseeIconViewItem *aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
442 | #else //KAB_EMBEDDED | 450 | #else //KAB_EMBEDDED |
443 | AddresseeIconViewItem *aItem = (AddresseeIconViewItem*)(item); | 451 | AddresseeIconViewItem *aItem = (AddresseeIconViewItem*)(item); |
444 | #endif //KAB_EMBEDDED | 452 | #endif //KAB_EMBEDDED |
@@ -447,13 +455,13 @@ void KAddressBookIconView::addresseeExecuted(QIconViewItem *item) | |||
447 | emit executed(aItem->addressee().uid()); | 455 | emit executed(aItem->addressee().uid()); |
448 | } | 456 | } |
449 | } | 457 | } |
450 | 458 | ||
451 | void KAddressBookIconView::addresseeSelected() | 459 | void KAddressBookIconView::addresseeSelected() |
452 | { | 460 | { |
453 | QIconViewItem *item; | 461 | Q3IconViewItem *item; |
454 | AddresseeIconViewItem *aItem; | 462 | AddresseeIconViewItem *aItem; |
455 | 463 | ||
456 | bool found = false; | 464 | bool found = false; |
457 | for (item = mIconView->firstItem(); item && !found; | 465 | for (item = mIconView->firstItem(); item && !found; |
458 | item = item->nextItem()) | 466 | item = item->nextItem()) |
459 | { | 467 | { |
@@ -473,9 +481,9 @@ void KAddressBookIconView::addresseeSelected() | |||
473 | } | 481 | } |
474 | 482 | ||
475 | if (!found) | 483 | if (!found) |
476 | emit selected(QString::null); | 484 | emit selected(QString::null); |
477 | } | 485 | } |
478 | 486 | ||
479 | #ifndef KAB_EMBEDDED | 487 | #ifndef KAB_EMBEDDED_ |
480 | #include "kaddressbookiconview.moc" | 488 | #include "moc_kaddressbookiconview.cpp" |
481 | #endif //KAB_EMBEDDED | 489 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/kaddressbookiconview.h b/kaddressbook/views/kaddressbookiconview.h index b0b9fea..6fad4c6 100644 --- a/kaddressbook/views/kaddressbookiconview.h +++ b/kaddressbook/views/kaddressbookiconview.h | |||
@@ -22,26 +22,29 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KADDRESSBOOKICONVIEW_H | 24 | #ifndef KADDRESSBOOKICONVIEW_H |
25 | #define KADDRESSBOOKICONVIEW_H | 25 | #define KADDRESSBOOKICONVIEW_H |
26 | 26 | ||
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3ValueList> | ||
30 | #include <QDropEvent> | ||
28 | #ifndef KAB_EMBEDDED | 31 | #ifndef KAB_EMBEDDED |
29 | #include <kiconview.h> | 32 | #include <kiconview.h> |
30 | #else //KAB_EMBEDDED | 33 | #else //KAB_EMBEDDED |
31 | #include <qiconview.h> | 34 | #include <q3iconview.h> |
32 | #include <qptrlist.h> | 35 | #include <q3ptrlist.h> |
33 | #include <klocale.h> | 36 | #include <klocale.h> |
34 | #endif //KAB_EMBEDDED | 37 | #endif //KAB_EMBEDDED |
35 | #include "kaddressbookview.h" | 38 | #include "kaddressbookview.h" |
36 | 39 | ||
37 | class QIconViewItem; | 40 | class Q3IconViewItem; |
38 | class KConfig; | 41 | class KConfig; |
39 | class AddresseeIconView; | 42 | class AddresseeIconView; |
40 | class AddresseeIconViewItem; | 43 | class AddresseeIconViewItem; |
41 | class QIconDragItem; | 44 | class Q3IconDragItem; |
42 | class KAddressBookIconView; | 45 | class KAddressBookIconView; |
43 | 46 | ||
44 | namespace KABC { class AddressBook; } | 47 | namespace KABC { class AddressBook; } |
45 | 48 | ||
46 | /** This is an example kaddressbook view that is implemented using | 49 | /** This is an example kaddressbook view that is implemented using |
47 | * KIconView. This view is not the most useful view, but it displays | 50 | * KIconView. This view is not the most useful view, but it displays |
@@ -65,36 +68,36 @@ class KAddressBookIconView : public KAddressBookView | |||
65 | virtual void scrollDOWN(); | 68 | virtual void scrollDOWN(); |
66 | virtual void setFocusAV(); | 69 | virtual void setFocusAV(); |
67 | 70 | ||
68 | public slots: | 71 | public slots: |
69 | void refresh(QString uid = QString::null); | 72 | void refresh(QString uid = QString::null); |
70 | #ifndef KAB_EMBEDDED | 73 | #ifndef KAB_EMBEDDED |
71 | //MOC_SKIP_BEGIN | 74 | #ifndef Q_MOC_RUN |
72 | void setSelected(QString uid = QString::null, bool selected = true); | 75 | void setSelected(QString uid = QString::null, bool selected = true); |
73 | //MOC_SKIP_END | 76 | #endif |
74 | #else //KAB_EMBEDDED | 77 | #else //KAB_EMBEDDED |
75 | //US my MOC do not like default parameters ??? | 78 | //US my MOC do not like default parameters ??? |
76 | void setSelected(QString uid, bool selected); | 79 | void setSelected(QString uid, bool selected); |
77 | #endif //KAB_EMBEDDED | 80 | #endif //KAB_EMBEDDED |
78 | 81 | ||
79 | protected slots: | 82 | protected slots: |
80 | void addresseeExecuted(QIconViewItem *item); | 83 | void addresseeExecuted(Q3IconViewItem *item); |
81 | void addresseeSelected(); | 84 | void addresseeSelected(); |
82 | 85 | ||
83 | private: | 86 | private: |
84 | AddresseeIconView *mIconView; | 87 | AddresseeIconView *mIconView; |
85 | QPtrList<AddresseeIconViewItem> mIconList; | 88 | Q3PtrList<AddresseeIconViewItem> mIconList; |
86 | }; | 89 | }; |
87 | 90 | ||
88 | 91 | ||
89 | #ifndef KAB_EMBEDDED | 92 | #ifndef KAB_EMBEDDED |
90 | //MOC_SKIP_BEGIN | 93 | #ifndef Q_MOC_RUN |
91 | class AddresseeIconView : public KIconView | 94 | class AddresseeIconView : public KIconView |
92 | //MOC_SKIP_END | 95 | #endif |
93 | #else //KAB_EMBEDDED | 96 | #else //KAB_EMBEDDED |
94 | class AddresseeIconView : public QIconView | 97 | class AddresseeIconView : public Q3IconView |
95 | #endif //KAB_EMBEDDED | 98 | #endif //KAB_EMBEDDED |
96 | { | 99 | { |
97 | Q_OBJECT | 100 | Q_OBJECT |
98 | 101 | ||
99 | public: | 102 | public: |
100 | AddresseeIconView(QWidget *parent, const char *name); | 103 | AddresseeIconView(QWidget *parent, const char *name); |
@@ -102,16 +105,16 @@ class AddresseeIconView : public QIconView | |||
102 | 105 | ||
103 | signals: | 106 | signals: |
104 | void addresseeDropped(QDropEvent *); | 107 | void addresseeDropped(QDropEvent *); |
105 | void startAddresseeDrag(); | 108 | void startAddresseeDrag(); |
106 | 109 | ||
107 | protected: | 110 | protected: |
108 | virtual QDragObject *dragObject(); | 111 | virtual Q3DragObject *dragObject(); |
109 | 112 | ||
110 | protected slots: | 113 | protected slots: |
111 | void itemDropped(QDropEvent *, const QValueList<QIconDragItem> &); | 114 | void itemDropped(QDropEvent *, const Q3ValueList<Q3IconDragItem> &); |
112 | }; | 115 | }; |
113 | 116 | ||
114 | class IconViewFactory : public ViewFactory | 117 | class IconViewFactory : public ViewFactory |
115 | { | 118 | { |
116 | public: | 119 | public: |
117 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) | 120 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) |
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,19 +1,23 @@ | |||
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> |
18 | #include <kcolorbutton.h> | 22 | #include <kcolorbutton.h> |
19 | #include <kdebug.h> | 23 | #include <kdebug.h> |
@@ -29,23 +33,23 @@ | |||
29 | #include "contactlistview.h" | 33 | #include "contactlistview.h" |
30 | #include "kabprefs.h" | 34 | #include "kabprefs.h" |
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 | ||
40 | 44 | ||
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 | } |
50 | 54 | ||
51 | KAddressBookTableView::~KAddressBookTableView() | 55 | KAddressBookTableView::~KAddressBookTableView() |
@@ -74,20 +78,20 @@ void KAddressBookTableView::scrollDOWN() | |||
74 | void KAddressBookTableView::reconstructListView() | 78 | void KAddressBookTableView::reconstructListView() |
75 | { | 79 | { |
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; |
92 | } | 96 | } |
93 | 97 | ||
@@ -102,13 +106,13 @@ void KAddressBookTableView::reconstructListView() | |||
102 | KABC::Field::List fieldList = fields(); | 106 | KABC::Field::List fieldList = fields(); |
103 | KABC::Field::List::ConstIterator it; | 107 | KABC::Field::List::ConstIterator it; |
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 | ||
113 | connect(mListView, SIGNAL(selectionChanged()), | 117 | connect(mListView, SIGNAL(selectionChanged()), |
114 | this, SLOT(addresseeSelected())); | 118 | this, SLOT(addresseeSelected())); |
@@ -116,21 +120,21 @@ void KAddressBookTableView::reconstructListView() | |||
116 | SIGNAL(startDrag())); | 120 | SIGNAL(startDrag())); |
117 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 121 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
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 |
135 | //US refresh(); | 139 | //US refresh(); |
136 | 140 | ||
@@ -341,13 +345,13 @@ void KAddressBookTableView::refresh(QString uid) | |||
341 | mListView->ensureItemVisible( currentItem ); | 345 | mListView->ensureItemVisible( currentItem ); |
342 | mListView->setSelected( currentItem, true ); | 346 | mListView->setSelected( currentItem, true ); |
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 |
352 | ceItem = (ContactListViewItem*)( it.current() ); | 356 | ceItem = (ContactListViewItem*)( it.current() ); |
353 | #endif //KAB_EMBEDDED | 357 | #endif //KAB_EMBEDDED |
@@ -363,13 +367,13 @@ void KAddressBookTableView::refresh(QString uid) | |||
363 | } | 367 | } |
364 | } | 368 | } |
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 | { |
374 | if (mListView->isSelected( item )) | 378 | if (mListView->isSelected( item )) |
375 | { | 379 | { |
@@ -391,13 +395,13 @@ QStringList KAddressBookTableView::selectedUids() | |||
391 | 395 | ||
392 | return uidList; | 396 | return uidList; |
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 | { |
402 | mListView->selectAll(selected); | 406 | mListView->selectAll(selected); |
403 | } | 407 | } |
@@ -426,13 +430,13 @@ void KAddressBookTableView::setSelected(QString uid, bool selected) | |||
426 | void KAddressBookTableView::addresseeSelected() | 430 | void KAddressBookTableView::addresseeSelected() |
427 | { | 431 | { |
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 | { |
437 | if (item->isSelected()) | 441 | if (item->isSelected()) |
438 | { | 442 | { |
@@ -450,13 +454,13 @@ void KAddressBookTableView::addresseeSelected() | |||
450 | } | 454 | } |
451 | 455 | ||
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 |
461 | ContactListViewItem *ceItem | 465 | ContactListViewItem *ceItem |
462 | = dynamic_cast<ContactListViewItem*>(item); | 466 | = dynamic_cast<ContactListViewItem*>(item); |
@@ -484,9 +488,9 @@ void KAddressBookTableView::addresseeDeleted() | |||
484 | } | 488 | } |
485 | 489 | ||
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 |
diff --git a/kaddressbook/views/kaddressbooktableview.h b/kaddressbook/views/kaddressbooktableview.h index 38db7b4..c3cb038 100644 --- a/kaddressbook/views/kaddressbooktableview.h +++ b/kaddressbook/views/kaddressbooktableview.h | |||
@@ -7,31 +7,33 @@ | |||
7 | 7 | ||
8 | #ifdef HAVE_CONFIG_H | 8 | #ifdef HAVE_CONFIG_H |
9 | #include <config.h> | 9 | #include <config.h> |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | #include <qwidget.h> | 12 | #include <qwidget.h> |
13 | #include <qlistview.h> | 13 | #include <q3listview.h> |
14 | #include <qstring.h> | 14 | #include <qstring.h> |
15 | #include <qdialog.h> | 15 | #include <qdialog.h> |
16 | #include <qtabdialog.h> | 16 | #include <q3tabdialog.h> |
17 | #include <qstringlist.h> | 17 | #include <qstringlist.h> |
18 | #include <qvaluelist.h> | 18 | #include <q3valuelist.h> |
19 | 19 | ||
20 | #include "undo.h" | 20 | #include "undo.h" |
21 | 21 | ||
22 | #else //KAB_EMBEDDED | 22 | #else //KAB_EMBEDDED |
23 | #include "views/configuretableviewdialog.h" | 23 | #include "views/configuretableviewdialog.h" |
24 | #endif //KAB_EMBEDDED | 24 | #endif //KAB_EMBEDDED |
25 | 25 | ||
26 | #include "klocale.h" | 26 | #include "klocale.h" |
27 | #include "kaddressbookview.h" | 27 | #include "kaddressbookview.h" |
28 | //Added by qt3to4: | ||
29 | #include <Q3VBoxLayout> | ||
28 | 30 | ||
29 | class QListViewItem; | 31 | class Q3ListViewItem; |
30 | class QListBox; | 32 | class Q3ListBox; |
31 | class QVBoxLayout; | 33 | class Q3VBoxLayout; |
32 | class KConfig; | 34 | class KConfig; |
33 | 35 | ||
34 | class ContactListViewItem; | 36 | class ContactListViewItem; |
35 | class ContactListView; | 37 | class ContactListView; |
36 | 38 | ||
37 | 39 | ||
@@ -76,16 +78,16 @@ friend class ContactListView; | |||
76 | void addresseeSelected(); | 78 | void addresseeSelected(); |
77 | void addresseeDeleted(); | 79 | void addresseeDeleted(); |
78 | 80 | ||
79 | /** Called whenever the user executes an addressee. In terms of the | 81 | /** Called whenever the user executes an addressee. In terms of the |
80 | * list view, this is probably a double click | 82 | * list view, this is probably a double click |
81 | */ | 83 | */ |
82 | void addresseeExecuted(QListViewItem*); | 84 | void addresseeExecuted(Q3ListViewItem*); |
83 | 85 | ||
84 | private: | 86 | private: |
85 | QVBoxLayout *mainLayout; | 87 | Q3VBoxLayout *mainLayout; |
86 | ContactListView *mListView; | 88 | ContactListView *mListView; |
87 | }; | 89 | }; |
88 | 90 | ||
89 | 91 | ||
90 | class TableViewFactory : public ViewFactory | 92 | class TableViewFactory : public ViewFactory |
91 | { | 93 | { |