From a08aff328d4393031d5ba7d622c2b05705a89d73 Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Wed, 04 Jul 2007 11:23:42 +0000 Subject: initial public commit of qt4 port --- (limited to 'korganizer/koagendaitem.cpp') diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 407424d..0f9a38f 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -19,13 +19,23 @@ #include #include -#include -#include +#include +#include #include -#include -#include +#include +#include #include #include +#include +//Added by qt3to4: +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -57,10 +67,10 @@ QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; //-------------------------------------------------------------------------- -class KOAgendaItemWhatsThis :public QWhatsThis +class KOAgendaItemWhatsThis :public Q3WhatsThis { public: - KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; + KOAgendaItemWhatsThis( KOAgendaItem* view ) : Q3WhatsThis( view ),_view (view) { }; protected: virtual QString text( const QPoint& ) @@ -72,15 +82,15 @@ private: }; KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, - const char *name,WFlags) : + const char *name,Qt::WFlags) : QWidget(parent, name), mIncidence(incidence), mDate(qd) { #ifndef DESKTOP_VERSION //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); #endif mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); - int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase - setWFlags ( wflags); + Qt::WindowFlags wflags = windowFlags() |Qt::WRepaintNoErase;// WResizeNoErase + setWindowFlags ( wflags); mAllDay = allday; init ( incidence, qd ); //setMouseTracking(true); @@ -103,7 +113,7 @@ void KOAgendaItem::initColor () if ( (mIncidence->typeID() == todoID ) && ( !((static_cast(mIncidence))->isCompleted()) && ((static_cast(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) { - if ( (static_cast(mIncidence))->dtDue() < QDateTime::currentDateTime().date()) + if ( (static_cast(mIncidence))->dtDue() < (QDateTime)QDateTime::currentDateTime().date()) mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; else mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; @@ -132,7 +142,7 @@ void KOAgendaItem::initColor () } mColorGroup = QColorGroup( BackgroundColor.light(), BackgroundColor.dark(),BackgroundColor.light(), - BackgroundColor.dark(),BackgroundColor, black, BackgroundColor) ; + BackgroundColor.dark(),BackgroundColor, Qt::black, BackgroundColor) ; setBackgroundColor( mBackgroundColor ); mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); } @@ -228,28 +238,28 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) ++yOff; } if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { - p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); + p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::red ); if ( horLayout ) ++xOff; else ++yOff; } if (mIncidence->doesRecur()) { - p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); + p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::blue ); if ( horLayout ) ++xOff; else ++yOff; } if (mIncidence->description().length() > 0) { - p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); + p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::darkGreen ); if ( horLayout ) ++xOff; else ++yOff; } if (mIncidence->isReadOnly()) { - p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); + p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::white ); if ( horLayout ) ++xOff; else @@ -259,7 +269,7 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) if (mIncidence->attendeeCount()>0) { if (mIncidence->organizer() == KOPrefs::instance()->email()) { - p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); + p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::black ); if ( horLayout ) ++xOff; else @@ -270,14 +280,14 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) } else { - p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); + p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::yellow ); if ( horLayout ) ++xOff; else ++yOff; } - p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); + p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::darkYellow ); if ( horLayout ) ++xOff; else @@ -420,9 +430,9 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) } int align; #ifndef DESKTOP_VERSION - align = ( AlignLeft|WordBreak|AlignTop); + align = ( Qt::AlignLeft|Qt::TextWordWrap|Qt::AlignTop); #else - align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); + align = ( Qt::AlignLeft|Qt::TextWrapAnywhere|Qt::TextWordWrap|Qt::AlignTop); #endif if ( addIcon ) { if ( ! horLayout ) { @@ -435,7 +445,7 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) } } if ( mWhiteText ) - paint->setPen ( white); + paint->setPen ( Qt::white); if ( x < 0 ) { w = w+x-3; x = 3; @@ -444,9 +454,9 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) if ( w > parentWidget()->width() ){ w = parentWidget()->width() - 6; #ifndef DESKTOP_VERSION - align = ( AlignHCenter|WordBreak|AlignTop); + align = ( Qt::AlignHCenter|Qt::TextWordWrap|Qt::AlignTop); #else - align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); + align = ( Qt::AlignHCenter|Qt::TextWrapAnywhere|Qt::TextWordWrap|Qt::AlignTop); #endif } @@ -561,7 +571,7 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e ) } } //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); - bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); + bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,QPainter::CompositionMode_Source); } void KOAgendaItem::computeText() { @@ -628,7 +638,7 @@ void KOAgendaItem::computeText() if (!mIncidence->location().isEmpty()) { tipText += "\n"+i18n("Location: ")+mIncidence->location(); } - QToolTip::add(this,tipText,toolTipGroup(),""); + QToolTip::add(this,tipText /*TODO:hacker: ,toolTipGroup(),"" */); #endif } void KOAgendaItem::updateItem() @@ -795,7 +805,7 @@ void KOAgendaItem::expandRight(int dx) QToolTipGroup *KOAgendaItem::toolTipGroup() { - if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); + /* TODO:hacker: if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); */ return mToolTipGroup; } @@ -803,7 +813,7 @@ void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) { #ifndef KORG_NODND if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || - !QTextDrag::canDecode( e ) ) { + !Q3TextDrag::canDecode( e ) ) { e->ignore(); return; } @@ -815,7 +825,7 @@ void KOAgendaItem::dropEvent( QDropEvent *e ) { #ifndef KORG_NODND QString text; - if(QTextDrag::decode(e,text)) + if(Q3TextDrag::decode(e,text)) { kdDebug() << "Dropped : " << text << endl; QStringList emails = QStringList::split(",",text); @@ -833,12 +843,12 @@ void KOAgendaItem::dropEvent( QDropEvent *e ) } -QPtrList KOAgendaItem::conflictItems() +Q3PtrList KOAgendaItem::conflictItems() { return mConflictItems; } -void KOAgendaItem::setConflictItems(QPtrList ci) +void KOAgendaItem::setConflictItems(Q3PtrList ci) { mConflictItems = ci; KOAgendaItem *item; -- cgit v0.9.0.2