summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaitem.cpp
Unidiff
Diffstat (limited to 'korganizer/koagendaitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp70
1 files changed, 40 insertions, 30 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 407424d..0f9a38f 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -20,11 +20,21 @@
20#include <qlabel.h> 20#include <qlabel.h>
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qhbox.h> 22#include <q3hbox.h>
23#include <qvbox.h> 23#include <q3vbox.h>
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qwhatsthis.h> 25#include <q3whatsthis.h>
26#include <qdragobject.h> 26#include <q3dragobject.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qpainter.h> 28#include <qpainter.h>
29#include <QDesktopWidget>
30//Added by qt3to4:
31#include <Q3PtrList>
32#include <QPixmap>
33#include <QDragEnterEvent>
34#include <QDropEvent>
35#include <QResizeEvent>
36#include <QMouseEvent>
37#include <QEvent>
38#include <QPaintEvent>
29 39
30#include <kiconloader.h> 40#include <kiconloader.h>
@@ -58,8 +68,8 @@ QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
58//-------------------------------------------------------------------------- 68//--------------------------------------------------------------------------
59 69
60class KOAgendaItemWhatsThis :public QWhatsThis 70class KOAgendaItemWhatsThis :public Q3WhatsThis
61{ 71{
62public: 72public:
63 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; 73 KOAgendaItemWhatsThis( KOAgendaItem* view ) : Q3WhatsThis( view ),_view (view) { };
64 74
65protected: 75protected:
@@ -73,5 +83,5 @@ private:
73 83
74KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 84KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
75 const char *name,WFlags) : 85 const char *name,Qt::WFlags) :
76 QWidget(parent, name), mIncidence(incidence), mDate(qd) 86 QWidget(parent, name), mIncidence(incidence), mDate(qd)
77{ 87{
@@ -80,6 +90,6 @@ KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool
80#endif 90#endif
81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); 91 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this);
82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 92 Qt::WindowFlags wflags = windowFlags() |Qt::WRepaintNoErase;// WResizeNoErase
83 setWFlags ( wflags); 93 setWindowFlags ( wflags);
84 mAllDay = allday; 94 mAllDay = allday;
85 init ( incidence, qd ); 95 init ( incidence, qd );
@@ -104,5 +114,5 @@ void KOAgendaItem::initColor ()
104 ( !((static_cast<Todo*>(mIncidence))->isCompleted()) && 114 ( !((static_cast<Todo*>(mIncidence))->isCompleted()) &&
105 ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) { 115 ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) {
106 if ( (static_cast<Todo*>(mIncidence))->dtDue() < QDateTime::currentDateTime().date()) 116 if ( (static_cast<Todo*>(mIncidence))->dtDue() < (QDateTime)QDateTime::currentDateTime().date())
107 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 117 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
108 else 118 else
@@ -133,5 +143,5 @@ void KOAgendaItem::initColor ()
133 mColorGroup = QColorGroup( BackgroundColor.light(), 143 mColorGroup = QColorGroup( BackgroundColor.light(),
134 BackgroundColor.dark(),BackgroundColor.light(), 144 BackgroundColor.dark(),BackgroundColor.light(),
135 BackgroundColor.dark(),BackgroundColor, black, BackgroundColor) ; 145 BackgroundColor.dark(),BackgroundColor, Qt::black, BackgroundColor) ;
136 setBackgroundColor( mBackgroundColor ); 146 setBackgroundColor( mBackgroundColor );
137 mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); 147 mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250);
@@ -229,5 +239,5 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
229 } 239 }
230 if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { 240 if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) {
231 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 241 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::red );
232 if ( horLayout ) 242 if ( horLayout )
233 ++xOff; 243 ++xOff;
@@ -236,5 +246,5 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
236 } 246 }
237 if (mIncidence->doesRecur()) { 247 if (mIncidence->doesRecur()) {
238 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 248 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::blue );
239 if ( horLayout ) 249 if ( horLayout )
240 ++xOff; 250 ++xOff;
@@ -243,5 +253,5 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
243 } 253 }
244 if (mIncidence->description().length() > 0) { 254 if (mIncidence->description().length() > 0) {
245 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 255 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::darkGreen );
246 if ( horLayout ) 256 if ( horLayout )
247 ++xOff; 257 ++xOff;
@@ -250,5 +260,5 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
250 } 260 }
251 if (mIncidence->isReadOnly()) { 261 if (mIncidence->isReadOnly()) {
252 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 262 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::white );
253 if ( horLayout ) 263 if ( horLayout )
254 ++xOff; 264 ++xOff;
@@ -260,5 +270,5 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
260 270
261 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 271 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
262 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 272 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::black );
263 if ( horLayout ) 273 if ( horLayout )
264 ++xOff; 274 ++xOff;
@@ -271,5 +281,5 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
271 281
272 } else { 282 } else {
273 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 283 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::yellow );
274 if ( horLayout ) 284 if ( horLayout )
275 ++xOff; 285 ++xOff;
@@ -278,5 +288,5 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
278 288
279 } 289 }
280 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); 290 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::darkYellow );
281 if ( horLayout ) 291 if ( horLayout )
282 ++xOff; 292 ++xOff;
@@ -421,7 +431,7 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
421 int align; 431 int align;
422#ifndef DESKTOP_VERSION 432#ifndef DESKTOP_VERSION
423 align = ( AlignLeft|WordBreak|AlignTop); 433 align = ( Qt::AlignLeft|Qt::TextWordWrap|Qt::AlignTop);
424#else 434#else
425 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 435 align = ( Qt::AlignLeft|Qt::TextWrapAnywhere|Qt::TextWordWrap|Qt::AlignTop);
426#endif 436#endif
427 if ( addIcon ) { 437 if ( addIcon ) {
@@ -436,5 +446,5 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
436 } 446 }
437 if ( mWhiteText ) 447 if ( mWhiteText )
438 paint->setPen ( white); 448 paint->setPen ( Qt::white);
439 if ( x < 0 ) { 449 if ( x < 0 ) {
440 w = w+x-3; 450 w = w+x-3;
@@ -445,7 +455,7 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
445 w = parentWidget()->width() - 6; 455 w = parentWidget()->width() - 6;
446#ifndef DESKTOP_VERSION 456#ifndef DESKTOP_VERSION
447 align = ( AlignHCenter|WordBreak|AlignTop); 457 align = ( Qt::AlignHCenter|Qt::TextWordWrap|Qt::AlignTop);
448#else 458#else
449 align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); 459 align = ( Qt::AlignHCenter|Qt::TextWrapAnywhere|Qt::TextWordWrap|Qt::AlignTop);
450#endif 460#endif
451 461
@@ -562,5 +572,5 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e )
562 } 572 }
563 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); 573 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh);
564 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); 574 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,QPainter::CompositionMode_Source);
565} 575}
566void KOAgendaItem::computeText() 576void KOAgendaItem::computeText()
@@ -629,5 +639,5 @@ void KOAgendaItem::computeText()
629 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 639 tipText += "\n"+i18n("Location: ")+mIncidence->location();
630 } 640 }
631 QToolTip::add(this,tipText,toolTipGroup(),""); 641 QToolTip::add(this,tipText /*TODO:hacker: ,toolTipGroup(),"" */);
632#endif 642#endif
633} 643}
@@ -796,5 +806,5 @@ void KOAgendaItem::expandRight(int dx)
796QToolTipGroup *KOAgendaItem::toolTipGroup() 806QToolTipGroup *KOAgendaItem::toolTipGroup()
797{ 807{
798 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 808 /* TODO:hacker: if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); */
799 return mToolTipGroup; 809 return mToolTipGroup;
800} 810}
@@ -804,5 +814,5 @@ void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e )
804#ifndef KORG_NODND 814#ifndef KORG_NODND
805 if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || 815 if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) ||
806 !QTextDrag::canDecode( e ) ) { 816 !Q3TextDrag::canDecode( e ) ) {
807 e->ignore(); 817 e->ignore();
808 return; 818 return;
@@ -816,5 +826,5 @@ void KOAgendaItem::dropEvent( QDropEvent *e )
816#ifndef KORG_NODND 826#ifndef KORG_NODND
817 QString text; 827 QString text;
818 if(QTextDrag::decode(e,text)) 828 if(Q3TextDrag::decode(e,text))
819 { 829 {
820 kdDebug() << "Dropped : " << text << endl; 830 kdDebug() << "Dropped : " << text << endl;
@@ -834,10 +844,10 @@ void KOAgendaItem::dropEvent( QDropEvent *e )
834 844
835 845
836QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() 846Q3PtrList<KOAgendaItem> KOAgendaItem::conflictItems()
837{ 847{
838 return mConflictItems; 848 return mConflictItems;
839} 849}
840 850
841void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) 851void KOAgendaItem::setConflictItems(Q3PtrList<KOAgendaItem> ci)
842{ 852{
843 mConflictItems = ci; 853 mConflictItems = ci;