author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/koagendaitem.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | korganizer/koagendaitem.cpp | 70 |
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 | |||
@@ -10,31 +10,41 @@ | |||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
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> |
31 | #include <kdebug.h> | 41 | #include <kdebug.h> |
32 | #include <kglobal.h> | 42 | #include <kglobal.h> |
33 | #include <klocale.h> | 43 | #include <klocale.h> |
34 | #ifndef DESKTOP_VERSION | 44 | #ifndef DESKTOP_VERSION |
35 | #include <qpe/qpeapplication.h> | 45 | #include <qpe/qpeapplication.h> |
36 | #define AGENDA_ICON_SIZE 5 | 46 | #define AGENDA_ICON_SIZE 5 |
37 | #else | 47 | #else |
38 | #include <qapplication.h> | 48 | #include <qapplication.h> |
39 | #define AGENDA_ICON_SIZE 7 | 49 | #define AGENDA_ICON_SIZE 7 |
40 | #endif | 50 | #endif |
@@ -48,71 +58,71 @@ extern int globalFlagBlockAgendaItemUpdate; | |||
48 | #include "koprefs.h" | 58 | #include "koprefs.h" |
49 | 59 | ||
50 | #include "koagendaitem.h" | 60 | #include "koagendaitem.h" |
51 | //#include "koagendaitem.moc" | 61 | //#include "koagendaitem.moc" |
52 | 62 | ||
53 | 63 | ||
54 | //-------------------------------------------------------------------------- | 64 | //-------------------------------------------------------------------------- |
55 | 65 | ||
56 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; | 66 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; |
57 | 67 | ||
58 | //-------------------------------------------------------------------------- | 68 | //-------------------------------------------------------------------------- |
59 | 69 | ||
60 | class KOAgendaItemWhatsThis :public QWhatsThis | 70 | class KOAgendaItemWhatsThis :public Q3WhatsThis |
61 | { | 71 | { |
62 | public: | 72 | public: |
63 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; | 73 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : Q3WhatsThis( view ),_view (view) { }; |
64 | 74 | ||
65 | protected: | 75 | protected: |
66 | virtual QString text( const QPoint& ) | 76 | virtual QString text( const QPoint& ) |
67 | { | 77 | { |
68 | return _view->getWhatsThisText() ; | 78 | return _view->getWhatsThisText() ; |
69 | } | 79 | } |
70 | private: | 80 | private: |
71 | KOAgendaItem * _view; | 81 | KOAgendaItem * _view; |
72 | }; | 82 | }; |
73 | 83 | ||
74 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 84 | KOAgendaItem::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 | { |
78 | #ifndef DESKTOP_VERSION | 88 | #ifndef DESKTOP_VERSION |
79 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 89 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
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 ); |
86 | //setMouseTracking(true); | 96 | //setMouseTracking(true); |
87 | //setAcceptDrops(true); | 97 | //setAcceptDrops(true); |
88 | xPaintCoord = -1; | 98 | xPaintCoord = -1; |
89 | yPaintCoord = -1; | 99 | yPaintCoord = -1; |
90 | } | 100 | } |
91 | QString KOAgendaItem::getWhatsThisText() | 101 | QString KOAgendaItem::getWhatsThisText() |
92 | { | 102 | { |
93 | if ( mIncidence ) | 103 | if ( mIncidence ) |
94 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, | 104 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, |
95 | KOPrefs::instance()->mWTshowDetails, | 105 | KOPrefs::instance()->mWTshowDetails, |
96 | KOPrefs::instance()->mWTshowCreated, | 106 | KOPrefs::instance()->mWTshowCreated, |
97 | KOPrefs::instance()->mWTshowChanged); | 107 | KOPrefs::instance()->mWTshowChanged); |
98 | return "KOAgendaItem::getWhatsThisText()::internal error"; | 108 | return "KOAgendaItem::getWhatsThisText()::internal error"; |
99 | } | 109 | } |
100 | 110 | ||
101 | void KOAgendaItem::initColor () | 111 | void KOAgendaItem::initColor () |
102 | { | 112 | { |
103 | if ( (mIncidence->typeID() == todoID ) && | 113 | if ( (mIncidence->typeID() == todoID ) && |
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 |
109 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 119 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
110 | } | 120 | } |
111 | else { | 121 | else { |
112 | QStringList categories = mIncidence->categories(); | 122 | QStringList categories = mIncidence->categories(); |
113 | QString cat = categories.first(); | 123 | QString cat = categories.first(); |
114 | if (cat.isEmpty()) { | 124 | if (cat.isEmpty()) { |
115 | if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) | 125 | if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) |
116 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 126 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
117 | else | 127 | else |
118 | mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() ); | 128 | mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() ); |
@@ -123,25 +133,25 @@ void KOAgendaItem::initColor () | |||
123 | mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; | 133 | mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; |
124 | } | 134 | } |
125 | } | 135 | } |
126 | 136 | ||
127 | } | 137 | } |
128 | 138 | ||
129 | QColor BackgroundColor ( mBackgroundColor ); | 139 | QColor BackgroundColor ( mBackgroundColor ); |
130 | if ( mIncidence->calID() > 1 ) { | 140 | if ( mIncidence->calID() > 1 ) { |
131 | //BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() ); | 141 | //BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() ); |
132 | } | 142 | } |
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); |
138 | } | 148 | } |
139 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 149 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
140 | { | 150 | { |
141 | mIncidence = incidence; | 151 | mIncidence = incidence; |
142 | mDate = qd; | 152 | mDate = qd; |
143 | mFirstMultiItem = 0; | 153 | mFirstMultiItem = 0; |
144 | mNextMultiItem = 0; | 154 | mNextMultiItem = 0; |
145 | mLastMultiItem = 0; | 155 | mLastMultiItem = 0; |
146 | computeText(); | 156 | computeText(); |
147 | initColor(); | 157 | initColor(); |
@@ -219,74 +229,74 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | |||
219 | } | 229 | } |
220 | if (mIncidence->cancelled() && height() < 20 ) { | 230 | if (mIncidence->cancelled() && height() < 20 ) { |
221 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 231 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
222 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 232 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
223 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 233 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
224 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 234 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
225 | if ( horLayout ) | 235 | if ( horLayout ) |
226 | ++xOff; | 236 | ++xOff; |
227 | else | 237 | else |
228 | ++yOff; | 238 | ++yOff; |
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; |
234 | else | 244 | else |
235 | ++yOff; | 245 | ++yOff; |
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; |
241 | else | 251 | else |
242 | ++yOff; | 252 | ++yOff; |
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; |
248 | else | 258 | else |
249 | ++yOff; | 259 | ++yOff; |
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; |
255 | else | 265 | else |
256 | ++yOff; | 266 | ++yOff; |
257 | } | 267 | } |
258 | 268 | ||
259 | if (mIncidence->attendeeCount()>0) { | 269 | if (mIncidence->attendeeCount()>0) { |
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; |
265 | else | 275 | else |
266 | ++yOff; | 276 | ++yOff; |
267 | } else { | 277 | } else { |
268 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 278 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
269 | if (me!=0) { | 279 | if (me!=0) { |
270 | 280 | ||
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; |
276 | else | 286 | else |
277 | ++yOff; | 287 | ++yOff; |
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; |
283 | else | 293 | else |
284 | ++yOff; | 294 | ++yOff; |
285 | 295 | ||
286 | } | 296 | } |
287 | 297 | ||
288 | } | 298 | } |
289 | return ( yOff || xOff ); | 299 | return ( yOff || xOff ); |
290 | } | 300 | } |
291 | 301 | ||
292 | 302 | ||
@@ -411,51 +421,51 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | |||
411 | } else { | 421 | } else { |
412 | x += 2; yy += 1;w -= 4; h-= 4; | 422 | x += 2; yy += 1;w -= 4; h-= 4; |
413 | if ( nfh < 6.01 ) { | 423 | if ( nfh < 6.01 ) { |
414 | yy -= 2; | 424 | yy -= 2; |
415 | h += 4; | 425 | h += 4; |
416 | } | 426 | } |
417 | else | 427 | else |
418 | if ( nfh < h -2 ) | 428 | if ( nfh < h -2 ) |
419 | ++yy; | 429 | ++yy; |
420 | } | 430 | } |
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 ) { |
428 | if ( ! horLayout ) { | 438 | if ( ! horLayout ) { |
429 | x += AGENDA_ICON_SIZE+3; | 439 | x += AGENDA_ICON_SIZE+3; |
430 | w -= (AGENDA_ICON_SIZE+3); | 440 | w -= (AGENDA_ICON_SIZE+3); |
431 | } | 441 | } |
432 | else { | 442 | else { |
433 | yy+= AGENDA_ICON_SIZE+2; | 443 | yy+= AGENDA_ICON_SIZE+2; |
434 | h -=(AGENDA_ICON_SIZE+3); | 444 | h -=(AGENDA_ICON_SIZE+3); |
435 | } | 445 | } |
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; |
441 | x = 3; | 451 | x = 3; |
442 | if ( !horLayout && addIcon ) | 452 | if ( !horLayout && addIcon ) |
443 | x += AGENDA_ICON_SIZE+3; | 453 | x += AGENDA_ICON_SIZE+3; |
444 | if ( w > parentWidget()->width() ){ | 454 | if ( w > parentWidget()->width() ){ |
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 | ||
452 | } | 462 | } |
453 | } | 463 | } |
454 | QRect dr; | 464 | QRect dr; |
455 | if ( w + x > parentWidget()->width() ) | 465 | if ( w + x > parentWidget()->width() ) |
456 | w = parentWidget()->width()-x; | 466 | w = parentWidget()->width()-x; |
457 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); | 467 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); |
458 | //qDebug("%d %d %d %d ", x, yy, w, h ); | 468 | //qDebug("%d %d %d %d ", x, yy, w, h ); |
459 | if ( mIncidence->cancelled() ){ | 469 | if ( mIncidence->cancelled() ){ |
460 | 470 | ||
461 | 471 | ||
@@ -552,25 +562,25 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e ) | |||
552 | //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); | 562 | //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); |
553 | return; | 563 | return; |
554 | } | 564 | } |
555 | } | 565 | } |
556 | if ( paintFrom->width() < xx+rw ) { | 566 | if ( paintFrom->width() < xx+rw ) { |
557 | rw = paintFrom->width() - xx; | 567 | rw = paintFrom->width() - xx; |
558 | if ( rw <= 1 ) { | 568 | if ( rw <= 1 ) { |
559 | //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); | 569 | //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); |
560 | return; | 570 | return; |
561 | } | 571 | } |
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 | } |
566 | void KOAgendaItem::computeText() | 576 | void KOAgendaItem::computeText() |
567 | { | 577 | { |
568 | mDisplayedText = mIncidence->summary(); | 578 | mDisplayedText = mIncidence->summary(); |
569 | if ( (mIncidence->typeID() == todoID ) ) { | 579 | if ( (mIncidence->typeID() == todoID ) ) { |
570 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { | 580 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { |
571 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) | 581 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) |
572 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; | 582 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; |
573 | else if ( !(mIncidence->doesFloat())) | 583 | else if ( !(mIncidence->doesFloat())) |
574 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; | 584 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; |
575 | } | 585 | } |
576 | } else { | 586 | } else { |
@@ -619,25 +629,25 @@ void KOAgendaItem::computeText() | |||
619 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); | 629 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); |
620 | } | 630 | } |
621 | } else if ( mIncidence->typeID() == todoID ) { | 631 | } else if ( mIncidence->typeID() == todoID ) { |
622 | if (mIncidence->hasStartDate()) | 632 | if (mIncidence->hasStartDate()) |
623 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); | 633 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); |
624 | if (((Todo*)mIncidence)->hasDueDate()) | 634 | if (((Todo*)mIncidence)->hasDueDate()) |
625 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); | 635 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); |
626 | } | 636 | } |
627 | 637 | ||
628 | if (!mIncidence->location().isEmpty()) { | 638 | if (!mIncidence->location().isEmpty()) { |
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 | } |
634 | void KOAgendaItem::updateItem() | 644 | void KOAgendaItem::updateItem() |
635 | { | 645 | { |
636 | computeText(); | 646 | computeText(); |
637 | 647 | ||
638 | //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); | 648 | //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); |
639 | paintMe( mSelected ); | 649 | paintMe( mSelected ); |
640 | repaint( false); | 650 | repaint( false); |
641 | } | 651 | } |
642 | 652 | ||
643 | void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) | 653 | void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) |
@@ -786,68 +796,68 @@ void KOAgendaItem::expandLeft(int dx) | |||
786 | } | 796 | } |
787 | 797 | ||
788 | void KOAgendaItem::expandRight(int dx) | 798 | void KOAgendaItem::expandRight(int dx) |
789 | { | 799 | { |
790 | int newX = cellX(); | 800 | int newX = cellX(); |
791 | int newXWidth = cellXWidth() + dx; | 801 | int newXWidth = cellXWidth() + dx; |
792 | if (newXWidth < newX) newXWidth = newX; | 802 | if (newXWidth < newX) newXWidth = newX; |
793 | setCellX(newX,newXWidth); | 803 | setCellX(newX,newXWidth); |
794 | } | 804 | } |
795 | 805 | ||
796 | QToolTipGroup *KOAgendaItem::toolTipGroup() | 806 | QToolTipGroup *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 | } |
801 | 811 | ||
802 | void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) | 812 | void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) |
803 | { | 813 | { |
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; |
809 | } | 819 | } |
810 | e->accept(); | 820 | e->accept(); |
811 | #endif | 821 | #endif |
812 | } | 822 | } |
813 | 823 | ||
814 | void KOAgendaItem::dropEvent( QDropEvent *e ) | 824 | void KOAgendaItem::dropEvent( QDropEvent *e ) |
815 | { | 825 | { |
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; |
821 | QStringList emails = QStringList::split(",",text); | 831 | QStringList emails = QStringList::split(",",text); |
822 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 832 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
823 | kdDebug() << " Email: " << (*it) << endl; | 833 | kdDebug() << " Email: " << (*it) << endl; |
824 | int pos = (*it).find("<"); | 834 | int pos = (*it).find("<"); |
825 | QString name = (*it).left(pos); | 835 | QString name = (*it).left(pos); |
826 | QString email = (*it).mid(pos); | 836 | QString email = (*it).mid(pos); |
827 | if (!email.isEmpty()) { | 837 | if (!email.isEmpty()) { |
828 | mIncidence->addAttendee(new Attendee(name,email)); | 838 | mIncidence->addAttendee(new Attendee(name,email)); |
829 | } | 839 | } |
830 | } | 840 | } |
831 | } | 841 | } |
832 | #endif | 842 | #endif |
833 | } | 843 | } |
834 | 844 | ||
835 | 845 | ||
836 | QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() | 846 | Q3PtrList<KOAgendaItem> KOAgendaItem::conflictItems() |
837 | { | 847 | { |
838 | return mConflictItems; | 848 | return mConflictItems; |
839 | } | 849 | } |
840 | 850 | ||
841 | void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) | 851 | void KOAgendaItem::setConflictItems(Q3PtrList<KOAgendaItem> ci) |
842 | { | 852 | { |
843 | mConflictItems = ci; | 853 | mConflictItems = ci; |
844 | KOAgendaItem *item; | 854 | KOAgendaItem *item; |
845 | for ( item=mConflictItems.first(); item != 0; | 855 | for ( item=mConflictItems.first(); item != 0; |
846 | item=mConflictItems.next() ) { | 856 | item=mConflictItems.next() ) { |
847 | item->addConflictItem(this); | 857 | item->addConflictItem(this); |
848 | } | 858 | } |
849 | } | 859 | } |
850 | 860 | ||
851 | void KOAgendaItem::addConflictItem(KOAgendaItem *ci) | 861 | void KOAgendaItem::addConflictItem(KOAgendaItem *ci) |
852 | { | 862 | { |
853 | if (mConflictItems.find(ci)<0) | 863 | if (mConflictItems.find(ci)<0) |