diff options
Diffstat (limited to 'korganizer/koagendaitem.cpp')
-rw-r--r-- | korganizer/koagendaitem.cpp | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 34d851a7f..629f59c31 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -23,9 +23,9 @@ without including the source code for Qt in the source distribution. */ -#include <qtooltip.h> -#include <qdragobject.h> -#include <qpainter.h> +#include <tqtooltip.h> +#include <tqdragobject.h> +#include <tqpainter.h> #include <kiconloader.h> #include <kdebug.h> @@ -51,21 +51,21 @@ //-------------------------------------------------------------------------- -QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; +TQToolTipGroup *KOAgendaItem::mToolTipGroup = 0; -QPixmap *KOAgendaItem::alarmPxmp = 0; -QPixmap *KOAgendaItem::recurPxmp = 0; -QPixmap *KOAgendaItem::readonlyPxmp = 0; -QPixmap *KOAgendaItem::replyPxmp = 0; -QPixmap *KOAgendaItem::groupPxmp = 0; -QPixmap *KOAgendaItem::groupPxmpTentative = 0; -QPixmap *KOAgendaItem::organizerPxmp = 0; +TQPixmap *KOAgendaItem::alarmPxmp = 0; +TQPixmap *KOAgendaItem::recurPxmp = 0; +TQPixmap *KOAgendaItem::readonlyPxmp = 0; +TQPixmap *KOAgendaItem::replyPxmp = 0; +TQPixmap *KOAgendaItem::groupPxmp = 0; +TQPixmap *KOAgendaItem::groupPxmpTentative = 0; +TQPixmap *KOAgendaItem::organizerPxmp = 0; //-------------------------------------------------------------------------- -KOAgendaItem::KOAgendaItem( Incidence *incidence, const QDate &qd, QWidget *parent, +KOAgendaItem::KOAgendaItem( Incidence *incidence, const TQDate &qd, TQWidget *parent, const char *name, WFlags f ) : - QWidget( parent, name, f ), mIncidence( incidence ), mDate( qd ), + TQWidget( parent, name, f ), mIncidence( incidence ), mDate( qd ), mLabelText( mIncidence->summary() ), mIconAlarm( false ), mIconRecur( false ), mIconReadonly( false ), mIconReply( false ), mIconGroup( false ), mIconGroupTentative( false ), mIconOrganizer( false ), @@ -76,7 +76,7 @@ KOAgendaItem::KOAgendaItem( Incidence *incidence, const QDate &qd, QWidget *pare setCellXY( 0, 0, 1 ); setCellXRight( 0 ); setMouseTracking( true ); - mResourceColor = QColor(); + mResourceColor = TQColor(); updateIcons(); // select() does nothing, if state hasn't change, so preset mSelected. @@ -188,7 +188,7 @@ int KOAgendaItem::cellWidth() const return mCellXRight - mCellXLeft + 1; } -void KOAgendaItem::setItemDate( const QDate &qd ) +void KOAgendaItem::setItemDate( const TQDate &qd ) { mDate = qd; } @@ -530,59 +530,59 @@ void KOAgendaItem::expandRight(int dx) setCellX( newXLeft, newXRight ); } -QToolTipGroup *KOAgendaItem::toolTipGroup() +TQToolTipGroup *KOAgendaItem::toolTipGroup() { - if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); + if (!mToolTipGroup) mToolTipGroup = new TQToolTipGroup(0); return mToolTipGroup; } -void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) +void KOAgendaItem::dragEnterEvent( TQDragEnterEvent *e ) { #ifndef KORG_NODND if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) ) { e->ignore(); return; } - if ( KVCardDrag::canDecode( e ) || QTextDrag::canDecode( e ) ) + if ( KVCardDrag::canDecode( e ) || TQTextDrag::canDecode( e ) ) e->accept(); else e->ignore(); #endif } -void KOAgendaItem::addAttendee( const QString &newAttendee ) +void KOAgendaItem::addAttendee( const TQString &newAttendee ) { kdDebug(5850) << " Email: " << newAttendee << endl; - QString name, email; + TQString name, email; KPIM::getNameAndMail( newAttendee, name, email ); if ( !( name.isEmpty() && email.isEmpty() ) ) { mIncidence->addAttendee(new Attendee(name,email)); - KMessageBox::information( this, i18n("Attendee \"%1\" added to the calendar item \"%2\"").arg(KPIM::normalizedAddress(name, email, QString())).arg(text()), i18n("Attendee added"), "AttendeeDroppedAdded" ); + KMessageBox::information( this, i18n("Attendee \"%1\" added to the calendar item \"%2\"").arg(KPIM::normalizedAddress(name, email, TQString())).arg(text()), i18n("Attendee added"), "AttendeeDroppedAdded" ); } } -void KOAgendaItem::dropEvent( QDropEvent *e ) +void KOAgendaItem::dropEvent( TQDropEvent *e ) { // TODO: Organize this better: First check for attachment (not only file, also any other url!), then if it's a vcard, otherwise check for attendees, then if the data is binary, add a binary attachment. #ifndef KORG_NODND - QString text; + TQString text; - bool decoded = QTextDrag::decode( e, text ); + bool decoded = TQTextDrag::decode( e, text ); if( decoded && text.startsWith( "file:" ) ) { mIncidence->addAttachment( new Attachment( text ) ); return; } #ifndef KORG_NOKABC - QString vcards; + TQString vcards; KABC::VCardConverter converter; KVCardDrag::decode( e, vcards ); KABC::Addressee::List list = converter.parseVCards( vcards ); KABC::Addressee::List::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { - QString em( (*it).fullEmail() ); + TQString em( (*it).fullEmail() ); if (em.isEmpty()) { em=(*it).realName(); } @@ -592,8 +592,8 @@ void KOAgendaItem::dropEvent( QDropEvent *e ) if( decoded ) { kdDebug(5850) << "Dropped : " << text << endl; - QStringList emails = QStringList::split( ",", text ); - for( QStringList::ConstIterator it = emails.begin(); it != emails.end(); + TQStringList emails = TQStringList::split( ",", text ); + for( TQStringList::ConstIterator it = emails.begin(); it != emails.end(); ++it ) { addAttendee( *it ); } @@ -604,12 +604,12 @@ void KOAgendaItem::dropEvent( QDropEvent *e ) } -QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() +TQPtrList<KOAgendaItem> KOAgendaItem::conflictItems() { return mConflictItems; } -void KOAgendaItem::setConflictItems( QPtrList<KOAgendaItem> ci ) +void KOAgendaItem::setConflictItems( TQPtrList<KOAgendaItem> ci ) { mConflictItems = ci; KOAgendaItem *item; @@ -624,7 +624,7 @@ void KOAgendaItem::addConflictItem( KOAgendaItem *ci ) if ( mConflictItems.find( ci ) < 0 ) mConflictItems.append( ci ); } -QString KOAgendaItem::label() const +TQString KOAgendaItem::label() const { return mLabelText; } @@ -644,17 +644,17 @@ bool KOAgendaItem::overlaps( KOrg::CellItem *o ) const return false; } -void KOAgendaItem::paintFrame( QPainter *p, const QColor &color ) +void KOAgendaItem::paintFrame( TQPainter *p, const TQColor &color ) { - QColor oldpen(p->pen().color()); + TQColor oldpen(p->pen().color()); p->setPen( color ); p->drawRect( 0, 0, width(), height() ); p->drawRect( 1, 1, width() - 2, height() - 2 ); p->setPen( oldpen ); } -static void conditionalPaint( QPainter *p, bool cond, int &x, int ft, - const QPixmap &pxmp ) +static void conditionalPaint( TQPainter *p, bool cond, int &x, int ft, + const TQPixmap &pxmp ) { if ( !cond ) return; @@ -662,22 +662,22 @@ static void conditionalPaint( QPainter *p, bool cond, int &x, int ft, x += pxmp.width() + ft; } -void KOAgendaItem::paintEventIcon( QPainter *p, int &x, int ft ) +void KOAgendaItem::paintEventIcon( TQPainter *p, int &x, int ft ) { if ( !mIncidence ) return; - static const QPixmap eventPxmp = + static const TQPixmap eventPxmp = KOGlobals::self()->smallIcon( "appointment" ); if ( mIncidence->type() != "Event" ) return; conditionalPaint( p, true, x, ft, eventPxmp ); } -void KOAgendaItem::paintTodoIcon( QPainter *p, int &x, int ft ) +void KOAgendaItem::paintTodoIcon( TQPainter *p, int &x, int ft ) { if ( !mIncidence ) return; - static const QPixmap todoPxmp = + static const TQPixmap todoPxmp = KOGlobals::self()->smallIcon( "todo" ); - static const QPixmap completedPxmp = + static const TQPixmap completedPxmp = KOGlobals::self()->smallIcon( "checkedbox" ); if ( mIncidence->type() != "Todo" ) return; @@ -686,7 +686,7 @@ void KOAgendaItem::paintTodoIcon( QPainter *p, int &x, int ft ) conditionalPaint( p, b, x, ft, completedPxmp ); } -void KOAgendaItem::paintAlarmIcon( QPainter *p, int &x, int ft ) +void KOAgendaItem::paintAlarmIcon( TQPainter *p, int &x, int ft ) { if (!mIconAlarm) return; int y = ft; @@ -698,7 +698,7 @@ void KOAgendaItem::paintAlarmIcon( QPainter *p, int &x, int ft ) x += alarmPxmp->width() + ft; } -void KOAgendaItem::paintIcons( QPainter *p, int &x, int ft ) +void KOAgendaItem::paintIcons( TQPainter *p, int &x, int ft ) { paintEventIcon( p, x, ft ); paintTodoIcon( p, x, ft ); @@ -711,7 +711,7 @@ void KOAgendaItem::paintIcons( QPainter *p, int &x, int ft ) conditionalPaint( p, mIconOrganizer, x, ft, *organizerPxmp ); } -void KOAgendaItem::paintEvent( QPaintEvent *ev ) +void KOAgendaItem::paintEvent( TQPaintEvent *ev ) { //HACK // to reproduce a crash: @@ -721,7 +721,7 @@ void KOAgendaItem::paintEvent( QPaintEvent *ev ) // the following check if ( !mIncidence )return; - QRect visRect = visibleRect(); + TQRect visRect = visibleRect(); // when scrolling horizontally in the side-by-side view, the repainted area is clipped // to the newly visible area, which is a problem since the content changes when visRect // changes, so repaint the full item in that case @@ -730,7 +730,7 @@ void KOAgendaItem::paintEvent( QPaintEvent *ev ) return; } - QPainter p( this ); + TQPainter p( this ); const int ft = 2; // frame thickness for layout, see paintFrame() const int margin = 1 + ft; // frame + space between frame and content @@ -740,40 +740,40 @@ void KOAgendaItem::paintEvent( QPaintEvent *ev ) // Also look at #17984 if ( !alarmPxmp ) { - alarmPxmp = new QPixmap( KOGlobals::self()->smallIcon("bell") ); - recurPxmp = new QPixmap( KOGlobals::self()->smallIcon("recur") ); - readonlyPxmp = new QPixmap( KOGlobals::self()->smallIcon("readonlyevent") ); - replyPxmp = new QPixmap( KOGlobals::self()->smallIcon("mail_reply") ); - groupPxmp = new QPixmap( KOGlobals::self()->smallIcon("groupevent") ); - groupPxmpTentative = new QPixmap( KOGlobals::self()->smallIcon("groupeventtentative") ); - organizerPxmp = new QPixmap( KOGlobals::self()->smallIcon("organizer") ); + alarmPxmp = new TQPixmap( KOGlobals::self()->smallIcon("bell") ); + recurPxmp = new TQPixmap( KOGlobals::self()->smallIcon("recur") ); + readonlyPxmp = new TQPixmap( KOGlobals::self()->smallIcon("readonlyevent") ); + replyPxmp = new TQPixmap( KOGlobals::self()->smallIcon("mail_reply") ); + groupPxmp = new TQPixmap( KOGlobals::self()->smallIcon("groupevent") ); + groupPxmpTentative = new TQPixmap( KOGlobals::self()->smallIcon("groupeventtentative") ); + organizerPxmp = new TQPixmap( KOGlobals::self()->smallIcon("organizer") ); } - QColor bgColor; + TQColor bgColor; if ( mIncidence->type() == "Todo" ) { if ( static_cast<Todo*>(mIncidence)->isOverdue() ) bgColor = KOPrefs::instance()->todoOverdueColor(); else if ( static_cast<Todo*>(mIncidence)->dtDue().date() == - QDateTime::currentDateTime().date() ) + TQDateTime::currentDateTime().date() ) bgColor = KOPrefs::instance()->todoDueTodayColor(); } - QColor categoryColor; - QStringList categories = mIncidence->categories(); - QString cat = categories.first(); + TQColor categoryColor; + TQStringList categories = mIncidence->categories(); + TQString cat = categories.first(); if (cat.isEmpty()) categoryColor = KOPrefs::instance()->mEventColor; else categoryColor = *(KOPrefs::instance()->categoryColor(cat)); - QColor resourceColor = mResourceColor; + TQColor resourceColor = mResourceColor; if ( !resourceColor.isValid() ) resourceColor = categoryColor; if (!KOPrefs::instance()->hasCategoryColor(cat)) categoryColor = resourceColor; - QColor frameColor; + TQColor frameColor; if ( KOPrefs::instance()->agendaViewColors() == KOPrefs::ResourceOnly || KOPrefs::instance()->agendaViewColors() == KOPrefs::CategoryInsideResourceOutside ) { frameColor = bgColor.isValid() ? bgColor : resourceColor; @@ -791,17 +791,17 @@ void KOAgendaItem::paintEvent( QPaintEvent *ev ) } if ( mSelected ) { - frameColor = QColor( 85 + frameColor.red() * 2/3, + frameColor = TQColor( 85 + frameColor.red() * 2/3, 85 + frameColor.green() * 2/3, 85 + frameColor.blue() * 2/3 ); } else { frameColor = frameColor.dark( 115 ); } - QColor textColor = getTextColor(bgColor); + TQColor textColor = getTextColor(bgColor); p.setPen( textColor ); p.setBackgroundColor( bgColor ); p.setFont(KOPrefs::instance()->mAgendaViewFont); - QFontMetrics fm = p.fontMetrics(); + TQFontMetrics fm = p.fontMetrics(); int singleLineHeight = fm.boundingRect( mLabelText ).height(); @@ -811,8 +811,8 @@ void KOAgendaItem::paintEvent( QPaintEvent *ev ) // calculate the height of the full version (case 4) to test whether it is // possible - QString shortH; - QString longH; + TQString shortH; + TQString longH; if ( !isMultiItem() ) { shortH = KGlobal::locale()->formatTime(mIncidence->dtStart().time()); if (mIncidence->type() != "Todo") @@ -829,7 +829,7 @@ void KOAgendaItem::paintEvent( QPaintEvent *ev ) } KWordWrap *ww = KWordWrap::formatText( fm, - QRect(0, 0, width() - (2 * margin), -1), + TQRect(0, 0, width() - (2 * margin), -1), 0, mLabelText ); int th = ww->boundingRect().height(); @@ -889,7 +889,7 @@ void KOAgendaItem::paintEvent( QPaintEvent *ev ) } ww = KWordWrap::formatText( fm, - QRect( 0, 0, txtWidth, + TQRect( 0, 0, txtWidth, (height() - (2 * margin)) ), 0, mLabelText ); @@ -920,7 +920,7 @@ void KOAgendaItem::paintEvent( QPaintEvent *ev ) // paint headline p.fillRect( 0, 0, width(), (ft/2) + margin + hlHeight, - QBrush( frameColor ) ); + TQBrush( frameColor ) ); } x += visRect.left(); @@ -932,7 +932,7 @@ void KOAgendaItem::paintEvent( QPaintEvent *ev ) else { // paint headline p.fillRect( 0, 0, width(), (ft/2) + margin + hlHeight, - QBrush( frameColor ) ); + TQBrush( frameColor ) ); txtWidth = width() - margin - x; eventX = x; @@ -940,7 +940,7 @@ void KOAgendaItem::paintEvent( QPaintEvent *ev ) hTxtWidth = width() - margin - x; } - QString headline; + TQString headline; int hw = fm.boundingRect( longH ).width(); if ( hw > hTxtWidth ) { headline = shortH; @@ -957,13 +957,13 @@ void KOAgendaItem::paintEvent( QPaintEvent *ev ) // draw event text ww = KWordWrap::formatText( fm, - QRect( 0, 0, txtWidth, height() - margin - y ), + TQRect( 0, 0, txtWidth, height() - margin - y ), 0, mLabelText ); p.setBackgroundColor( bgColor ); p.setPen( textColor ); - QString ws = ww->wrappedString(); + TQString ws = ww->wrappedString(); if ( ws.left( ws.length()-1 ).find( '\n' ) >= 0 ) ww->drawText( &p, eventX, y, Qt::AlignAuto | KWordWrap::FadeOut ); |