author | zautrix <zautrix> | 2005-04-11 00:29:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-11 00:29:46 (UTC) |
commit | 93b536533e1c908085adb61553907615c31786c0 (patch) (side-by-side diff) | |
tree | 42b150b957c815416143c4ba82be4099d254ba37 /kaddressbook | |
parent | 726d9302b230f53cc058d2dbfd89c7a3c4f18fb2 (diff) | |
download | kdepimpi-93b536533e1c908085adb61553907615c31786c0.zip kdepimpi-93b536533e1c908085adb61553907615c31786c0.tar.gz kdepimpi-93b536533e1c908085adb61553907615c31786c0.tar.bz2 |
fixxxxxx
-rw-r--r-- | kaddressbook/views/contactlistview.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp index 09d9c03..9accf78 100644 --- a/kaddressbook/views/contactlistview.cpp +++ b/kaddressbook/views/contactlistview.cpp @@ -161,197 +161,197 @@ ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, ContactListView *parent, KABC::AddressBook *doc, const KABC::Field::List &fields ) : KListViewItem(parent), mAddressee(a), mFields( fields ), parentListView( parent ), mDocument(doc) { refresh(); } QString ContactListViewItem::key(int column, bool ascending) const { #ifndef DESKTOP_VERSION int lan = KGlobal::locale()->language(); //qDebug("language %d ", lan); if ( lan == 1 ) { //GERMAN QString ret = QListViewItem::key(column, ascending).lower().utf8(); int start = -1; while ( (start = ret.find( 'ä', start+1)) > 0 ) { ret.at(start-1) = 'a'; } start = -1; while ( (start = ret.find( 'ö', start+1)) > 0 ) { ret.at(start-1) = 'o'; } start = -1; while ( (start = ret.find( 'ü', start+1)) > 0 ) { ret.at(start-1) = 'o'; } start = -1; while ( (start = ret.find( 'ß', start+1)) > 0 ) { ret.at(start-1) = 's'; } //qDebug("conv string %s ", ret.latin1()); return ret; } else #endif return QListViewItem::key(column, ascending).lower(); } void ContactListViewItem::paintCell(QPainter * p, const QColorGroup & cg, int column, int width, int align) { KListViewItem::paintCell(p, cg, column, width, align); if ( !p ) return; if (parentListView->singleLine()) { p->setPen( parentListView->alternateColor() ); p->drawLine( 0, height() - 1, width, height() - 1 ); } } ContactListView *ContactListViewItem::parent() { return parentListView; } void ContactListViewItem::refresh() { // Update our addressee, since it may have changed else were mAddressee = mDocument->findByUid(mAddressee.uid()); if (mAddressee.isEmpty()) return; int i = 0; KABC::Field::List::ConstIterator it; for( it = mFields.begin(); it != mFields.end(); ++it ) { setText( i++, (*it)->value( mAddressee ) ); } } /////////////////////////////// // ContactListView ContactListView::ContactListView(KAddressBookTableView *view, KABC::AddressBook* /* doc */, QWidget *parent, const char *name ) : KListView( parent, name ), pabWidget( view ), oldColumn( 0 ) { mFlagBlockKeyPressed = false; mFlagKeyPressed = false; mABackground = true; mSingleLine = false; mToolTips = true; -#ifndef KAB_EMBEDDED + mAlternateColor = KGlobalSettings::alternateBackgroundColor(); -#else //KAB_EMBEDDED - mAlternateColor = QColor(240, 240, 240); -#endif //KAB_EMBEDDED + + + setAlternateBackgroundEnabled(mABackground); setAcceptDrops( true ); viewport()->setAcceptDrops( true ); setAllColumnsShowFocus( true ); setShowSortIndicator(true); setSelectionModeExt( KListView::Extended ); setDropVisualizer(false); // setFrameStyle(QFrame::NoFrame); //setLineWidth ( 0 ); //setMidLineWidth ( 0 ); //setMargin ( 0 ); #ifndef KAB_EMBEDDED connect(this, SIGNAL(dropped(QDropEvent*)), this, SLOT(itemDropped(QDropEvent*))); #endif //KAB_EMBEDDED new DynamicTip( this ); } void ContactListView::printMe() { #ifdef DESKTOP_VERSION QPrinter printer; if (!printer.setup() ) return; QPainter p; p.begin ( &printer ); QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); float dx, dy; int wid = (m.width() * 9)/10; dx = (float) wid/(float)contentsWidth (); dy = (float)(m.height()) / (float)contentsHeight (); float scale; // scale to fit the width or height of the paper if ( dx < dy ) scale = dx; else scale = dy; p.translate( m.width()/10,0 ); p.scale( scale, scale ); qDebug("scale %f ", scale); drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); p.end(); qDebug("Why does it not print??? "); #endif } void ContactListView::setAlternateColor(const QColor &m_AlternateColor) { mAlternateColor = m_AlternateColor; } void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) { QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); // Get the brush, which will have the background pixmap if there is one. if (b.pixmap()) { p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), *(b.pixmap()), rect.left() + contentsX(), rect.top() + contentsY() ); } else { // Do a normal paint KListView::paintEmptyArea(p, rect); } } void ContactListView::contentsMousePressEvent(QMouseEvent* e) { presspos = e->pos(); KListView::contentsMousePressEvent(e); } // To initiate a drag operation void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) { if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { emit startAddresseeDrag(); } else KListView::contentsMouseMoveEvent( e ); } bool ContactListView::acceptDrag(QDropEvent *e) const { #ifndef KAB_EMBEDDED return QTextDrag::canDecode(e); #else //KAB_EMBEDDED |