author | zautrix <zautrix> | 2005-04-08 22:05:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-08 22:05:03 (UTC) |
commit | 9667e6f2589d5b2080cca928814f382761f8dda6 (patch) (unidiff) | |
tree | 438bcb5c041de0804284cf457cbc97a367dadf37 /kaddressbook | |
parent | c0f1d38e29ee0d0a1d1dcb5bda08089923926b41 (diff) | |
download | kdepimpi-9667e6f2589d5b2080cca928814f382761f8dda6.zip kdepimpi-9667e6f2589d5b2080cca928814f382761f8dda6.tar.gz kdepimpi-9667e6f2589d5b2080cca928814f382761f8dda6.tar.bz2 |
utf8 kapi import fix
-rw-r--r-- | kaddressbook/views/cardview.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/kaddressbook/views/cardview.cpp b/kaddressbook/views/cardview.cpp index 84d3116..b6e053f 100644 --- a/kaddressbook/views/cardview.cpp +++ b/kaddressbook/views/cardview.cpp | |||
@@ -891,114 +891,113 @@ CardViewItem *CardView::selectedItem() const | |||
891 | CardViewItem *CardView::firstItem() const | 891 | CardViewItem *CardView::firstItem() const |
892 | { | 892 | { |
893 | return d->mItemList.first(); | 893 | return d->mItemList.first(); |
894 | } | 894 | } |
895 | 895 | ||
896 | int CardView::childCount() const | 896 | int CardView::childCount() const |
897 | { | 897 | { |
898 | return d->mItemList.count(); | 898 | return d->mItemList.count(); |
899 | } | 899 | } |
900 | /*US | 900 | /*US |
901 | CardViewItem *CardView::findItem(const QString &text, const QString &label, | 901 | CardViewItem *CardView::findItem(const QString &text, const QString &label, |
902 | Qt::StringComparisonMode compare) | 902 | Qt::StringComparisonMode compare) |
903 | { | 903 | { |
904 | // IF the text is empty, we will return null, since empty text will | 904 | // IF the text is empty, we will return null, since empty text will |
905 | // match anything! | 905 | // match anything! |
906 | if (text.isEmpty()) | 906 | if (text.isEmpty()) |
907 | return 0; | 907 | return 0; |
908 | 908 | ||
909 | QPtrListIterator<CardViewItem> iter(d->mItemList); | 909 | QPtrListIterator<CardViewItem> iter(d->mItemList); |
910 | if (compare & Qt::BeginsWith) | 910 | if (compare & Qt::BeginsWith) |
911 | { | 911 | { |
912 | QString value; | 912 | QString value; |
913 | for (iter.toFirst(); iter.current(); ++iter) | 913 | for (iter.toFirst(); iter.current(); ++iter) |
914 | { | 914 | { |
915 | value = (*iter)->fieldValue(label).upper(); | 915 | value = (*iter)->fieldValue(label).upper(); |
916 | if (value.startsWith(text.upper())) | 916 | if (value.startsWith(text.upper())) |
917 | return *iter; | 917 | return *iter; |
918 | } | 918 | } |
919 | } | 919 | } |
920 | else | 920 | else |
921 | { | 921 | { |
922 | kdDebug(5720) << "CardView::findItem: search method not implemented" << endl; | 922 | kdDebug(5720) << "CardView::findItem: search method not implemented" << endl; |
923 | } | 923 | } |
924 | 924 | ||
925 | return 0; | 925 | return 0; |
926 | } | 926 | } |
927 | */ | 927 | */ |
928 | 928 | ||
929 | uint CardView::columnWidth() | 929 | uint CardView::columnWidth() |
930 | { | 930 | { |
931 | return d->mDrawSeparators ? | 931 | return d->mDrawSeparators ? |
932 | d->mItemWidth + ( 2 * d->mItemSpacing ) + d->mSepWidth : | 932 | d->mItemWidth + ( 2 * d->mItemSpacing ) + d->mSepWidth : |
933 | d->mItemWidth + d->mItemSpacing; | 933 | d->mItemWidth + d->mItemSpacing; |
934 | } | 934 | } |
935 | 935 | ||
936 | void CardView::drawContents(QPainter *p, int clipx, int clipy, | 936 | void CardView::drawContents(QPainter *p, int clipx, int clipy, |
937 | int clipw, int cliph) | 937 | int clipw, int cliph) |
938 | { | 938 | { |
939 | QScrollView::drawContents(p, clipx, clipy, clipw, cliph); | 939 | //QScrollView::drawContents(p, clipx, clipy, clipw, cliph); |
940 | |||
941 | if (d->mLayoutDirty) | 940 | if (d->mLayoutDirty) |
942 | calcLayout(); | 941 | calcLayout(); |
943 | 942 | ||
944 | //kdDebug() << "CardView::drawContents: " << clipx << ", " << clipy | 943 | //kdDebug() << "CardView::drawContents: " << clipx << ", " << clipy |
945 | // << ", " << clipw << ", " << cliph << endl; | 944 | // << ", " << clipw << ", " << cliph << endl; |
946 | 945 | ||
947 | QColorGroup cg = viewport()->palette().active(); // allow setting costum colors in the viewport pale | 946 | QColorGroup cg = viewport()->palette().active(); // allow setting costum colors in the viewport pale |
948 | 947 | int cX, cY; | |
948 | contentsToViewport ( clipx, clipy, cX, cY ); | ||
949 | QRect clipRect(clipx, clipy, clipw, cliph); | 949 | QRect clipRect(clipx, clipy, clipw, cliph); |
950 | QRect cardRect; | 950 | QRect cardRect; |
951 | QRect sepRect; | 951 | QRect sepRect; |
952 | CardViewItem *item; | 952 | CardViewItem *item; |
953 | CardViewSeparator *sep; | 953 | CardViewSeparator *sep; |
954 | |||
955 | // make sure the viewport is a pure background | 954 | // make sure the viewport is a pure background |
956 | viewport()->erase(clipRect); | 955 | viewport()->erase( QRect ( cX, cY , clipw, cliph ) ); |
957 | 956 | ||
958 | // Now tell the cards to draw, if they are in the clip region | 957 | // Now tell the cards to draw, if they are in the clip region |
959 | QPtrListIterator<CardViewItem> iter(d->mItemList); | 958 | QPtrListIterator<CardViewItem> iter(d->mItemList); |
960 | for (iter.toFirst(); iter.current(); ++iter) | 959 | for (iter.toFirst(); iter.current(); ++iter) |
961 | { | 960 | { |
962 | item = *iter; | 961 | item = *iter; |
963 | cardRect.setRect( item->d->x, item->d->y, d->mItemWidth, item->height() ); | 962 | cardRect.setRect( item->d->x, item->d->y, d->mItemWidth, item->height() ); |
964 | 963 | ||
965 | if (clipRect.intersects(cardRect) || clipRect.contains(cardRect)) | 964 | if (clipRect.intersects(cardRect) || clipRect.contains(cardRect)) |
966 | { | 965 | { |
967 | //kdDebug() << "\trepainting card at: " << cardRect.x() << ", " | 966 | //kdDebug() << "\trepainting card at: " << cardRect.x() << ", " |
968 | // << cardRect.y() << endl; | 967 | // << cardRect.y() << endl; |
969 | 968 | ||
970 | // Tell the card to paint | 969 | // Tell the card to paint |
971 | p->save(); | 970 | p->save(); |
972 | p->translate(cardRect.x(), cardRect.y()); | 971 | p->translate(cardRect.x(), cardRect.y()); |
973 | item->paintCard(p, cg); | 972 | item->paintCard(p, cg); |
974 | p->restore(); | 973 | p->restore(); |
975 | } | 974 | } |
976 | } | 975 | } |
977 | 976 | ||
978 | // Followed by the separators if they are in the clip region | 977 | // Followed by the separators if they are in the clip region |
979 | QPtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList); | 978 | QPtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList); |
980 | for (sepIter.toFirst(); sepIter.current(); ++sepIter) | 979 | for (sepIter.toFirst(); sepIter.current(); ++sepIter) |
981 | { | 980 | { |
982 | sep = *sepIter; | 981 | sep = *sepIter; |
983 | sepRect = sep->mRect; | 982 | sepRect = sep->mRect; |
984 | 983 | ||
985 | if (clipRect.intersects(sepRect) || clipRect.contains(sepRect)) | 984 | if (clipRect.intersects(sepRect) || clipRect.contains(sepRect)) |
986 | { | 985 | { |
987 | p->save(); | 986 | p->save(); |
988 | p->translate(sepRect.x(), sepRect.y()); | 987 | p->translate(sepRect.x(), sepRect.y()); |
989 | sep->paintSeparator(p, cg); | 988 | sep->paintSeparator(p, cg); |
990 | p->restore(); | 989 | p->restore(); |
991 | } | 990 | } |
992 | } | 991 | } |
993 | } | 992 | } |
994 | 993 | ||
995 | void CardView::resizeEvent(QResizeEvent *e) | 994 | void CardView::resizeEvent(QResizeEvent *e) |
996 | { | 995 | { |
997 | QScrollView::resizeEvent(e); | 996 | QScrollView::resizeEvent(e); |
998 | 997 | ||
999 | setLayoutDirty(true); | 998 | setLayoutDirty(true); |
1000 | } | 999 | } |
1001 | 1000 | ||
1002 | void CardView::calcLayout() | 1001 | void CardView::calcLayout() |
1003 | { | 1002 | { |
1004 | //kdDebug() << "CardView::calcLayout:" << endl; | 1003 | //kdDebug() << "CardView::calcLayout:" << endl; |