summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaitem.cpp
Side-by-side diff
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
@@ -16,19 +16,29 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <qlabel.h>
#include <qlayout.h>
-#include <qhbox.h>
-#include <qvbox.h>
+#include <q3hbox.h>
+#include <q3vbox.h>
#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qdragobject.h>
+#include <q3whatsthis.h>
+#include <q3dragobject.h>
#include <qdrawutil.h>
#include <qpainter.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3PtrList>
+#include <QPixmap>
+#include <QDragEnterEvent>
+#include <QDropEvent>
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <QEvent>
+#include <QPaintEvent>
#include <kiconloader.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#ifndef DESKTOP_VERSION
@@ -54,36 +64,36 @@ extern int globalFlagBlockAgendaItemUpdate;
//--------------------------------------------------------------------------
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& )
{
return _view->getWhatsThisText() ;
}
private:
KOAgendaItem * _view;
};
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);
//setAcceptDrops(true);
xPaintCoord = -1;
yPaintCoord = -1;
@@ -100,13 +110,13 @@ QString KOAgendaItem::getWhatsThisText()
void KOAgendaItem::initColor ()
{
if ( (mIncidence->typeID() == todoID ) &&
( !((static_cast<Todo*>(mIncidence))->isCompleted()) &&
((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) {
- if ( (static_cast<Todo*>(mIncidence))->dtDue() < QDateTime::currentDateTime().date())
+ if ( (static_cast<Todo*>(mIncidence))->dtDue() < (QDateTime)QDateTime::currentDateTime().date())
mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
else
mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
}
else {
QStringList categories = mIncidence->categories();
@@ -129,13 +139,13 @@ void KOAgendaItem::initColor ()
QColor BackgroundColor ( mBackgroundColor );
if ( mIncidence->calID() > 1 ) {
//BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() );
}
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);
}
void KOAgendaItem::init ( Incidence *incidence, QDate qd )
{
mIncidence = incidence;
@@ -225,62 +235,62 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
if ( horLayout )
++xOff;
else
++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
++yOff;
}
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
++yOff;
} else {
Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
if (me!=0) {
} 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
++yOff;
}
@@ -417,39 +427,39 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
else
if ( nfh < h -2 )
++yy;
}
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 ) {
x += AGENDA_ICON_SIZE+3;
w -= (AGENDA_ICON_SIZE+3);
}
else {
yy+= AGENDA_ICON_SIZE+2;
h -=(AGENDA_ICON_SIZE+3);
}
}
if ( mWhiteText )
- paint->setPen ( white);
+ paint->setPen ( Qt::white);
if ( x < 0 ) {
w = w+x-3;
x = 3;
if ( !horLayout && addIcon )
x += AGENDA_ICON_SIZE+3;
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
}
}
QRect dr;
if ( w + x > parentWidget()->width() )
@@ -558,13 +568,13 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e )
if ( rw <= 1 ) {
//qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() );
return;
}
}
//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()
{
mDisplayedText = mIncidence->summary();
if ( (mIncidence->typeID() == todoID ) ) {
if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
@@ -625,13 +635,13 @@ void KOAgendaItem::computeText()
tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
}
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()
{
computeText();
@@ -792,33 +802,33 @@ void KOAgendaItem::expandRight(int dx)
if (newXWidth < newX) newXWidth = newX;
setCellX(newX,newXWidth);
}
QToolTipGroup *KOAgendaItem::toolTipGroup()
{
- if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
+ /* TODO:hacker: if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); */
return mToolTipGroup;
}
void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e )
{
#ifndef KORG_NODND
if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) ||
- !QTextDrag::canDecode( e ) ) {
+ !Q3TextDrag::canDecode( e ) ) {
e->ignore();
return;
}
e->accept();
#endif
}
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);
for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
kdDebug() << " Email: " << (*it) << endl;
int pos = (*it).find("<");
@@ -830,18 +840,18 @@ void KOAgendaItem::dropEvent( QDropEvent *e )
}
}
#endif
}
-QPtrList<KOAgendaItem> KOAgendaItem::conflictItems()
+Q3PtrList<KOAgendaItem> KOAgendaItem::conflictItems()
{
return mConflictItems;
}
-void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci)
+void KOAgendaItem::setConflictItems(Q3PtrList<KOAgendaItem> ci)
{
mConflictItems = ci;
KOAgendaItem *item;
for ( item=mConflictItems.first(); item != 0;
item=mConflictItems.next() ) {
item->addConflictItem(this);