summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views/contactlistview.cpp
Unidiff
Diffstat (limited to 'kaddressbook/views/contactlistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/contactlistview.cpp32
1 files changed, 19 insertions, 13 deletions
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
49DynamicTip::DynamicTip( ContactListView *parent) 54DynamicTip::DynamicTip( ContactListView *parent)
50 : QToolTip( parent ) 55 /* TODO:hacker:: QToolTip( parent ) */
51{ 56{
52} 57}
53 58
54void DynamicTip::maybeTip( const QPoint &pos ) 59void 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
160ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, 166ContactListViewItem::ContactListViewItem(const KABC::Addressee &a,
@@ -170,13 +176,13 @@ ContactListViewItem::ContactListViewItem(const KABC::Addressee &a,
170QString ContactListViewItem::key(int column, bool ascending) const 176QString 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
203void ContactListViewItem::paintCell(QPainter * p, 209void 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
344void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) 350void 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
353bool ContactListView::acceptDrag(QDropEvent *e) const 359bool 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
358qDebug("ContactListView::acceptDrag has to be fixed"); 364qDebug("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