summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/komonthview.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp218
1 files changed, 115 insertions, 103 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 85e9166..ca55c43 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -14,28 +14,40 @@
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 <qpopupmenu.h> 20#include <q3popupmenu.h>
21#include <qfont.h> 21#include <qfont.h>
22#include <qfontmetrics.h> 22#include <qfontmetrics.h>
23#include <qkeycode.h> 23#include <qnamespace.h>
24#include <qhbox.h> 24#include <q3hbox.h>
25#include <qvbox.h> 25#include <q3vbox.h>
26#include <qwidgetstack.h> 26#include <q3widgetstack.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28#include <qtooltip.h> 28#include <qtooltip.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qwhatsthis.h> 31#include <q3whatsthis.h>
32#ifndef DESKTOP_VERSION 32#ifndef DESKTOP_VERSION
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#else 34#else
35#include <qapplication.h> 35#include <qapplication.h>
36#include <QDesktopWidget>
37//Added by qt3to4:
38#include <QResizeEvent>
39#include <QLabel>
40#include <QPixmap>
41#include <QFocusEvent>
42#include <QMouseEvent>
43#include <QKeyEvent>
44#include <Q3VBoxLayout>
45#include <Q3Frame>
46#include <Q3PointArray>
47#include <Q3PtrList>
36#endif 48#endif
37 49
38#include <kdebug.h> 50#include <kdebug.h>
39#include <klocale.h> 51#include <klocale.h>
40#include <kglobal.h> 52#include <kglobal.h>
41#include <kconfig.h> 53#include <kconfig.h>
@@ -56,16 +68,16 @@
56#include "komonthview.h" 68#include "komonthview.h"
57 69
58#define PIXMAP_SIZE 5 70#define PIXMAP_SIZE 5
59#ifdef DESKTOP_VERSION 71#ifdef DESKTOP_VERSION
60QToolTipGroup *MonthViewCell::mToolTipGroup = 0; 72QToolTipGroup *MonthViewCell::mToolTipGroup = 0;
61#endif 73#endif
62class KNOWhatsThis :public QWhatsThis 74class KNOWhatsThis :public Q3WhatsThis
63{ 75{
64public: 76public:
65 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; 77 KNOWhatsThis( KNoScrollListBox* sbox ) : Q3WhatsThis( sbox ), _wid( sbox) { };
66 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; 78 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); };
67 79
68protected: 80protected:
69 virtual QString text( const QPoint& p) 81 virtual QString text( const QPoint& p)
70 { 82 {
71 return _wid->getWhatsThisText(p) ; 83 return _wid->getWhatsThisText(p) ;
@@ -74,22 +86,22 @@ private:
74 KNoScrollListBox* _wid; 86 KNoScrollListBox* _wid;
75 87
76}; 88};
77 89
78 90
79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 91KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
80 : QListBox(parent, name, WRepaintNoErase) 92 : Q3ListBox(parent, name, Qt::WNoAutoErase)
81{ 93{
82#ifndef DESKTOP_VERSION 94#ifndef DESKTOP_VERSION
83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 95 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
84#endif 96#endif
85 mBlockDeselect = false; 97 mBlockDeselect = false;
86 mWT = new KNOWhatsThis(this); 98 mWT = new KNOWhatsThis(this);
87 resetOnFocusIn = true; 99 resetOnFocusIn = true;
88 setVScrollBarMode(QScrollView::AlwaysOff); 100 setVScrollBarMode(Q3ScrollView::AlwaysOff);
89 setHScrollBarMode(QScrollView::AlwaysOff); 101 setHScrollBarMode(Q3ScrollView::AlwaysOff);
90} 102}
91KNoScrollListBox::~KNoScrollListBox() 103KNoScrollListBox::~KNoScrollListBox()
92{ 104{
93#if QT_VERSION >= 0x030000 105#if QT_VERSION >= 0x030000
94 106
95#else 107#else
@@ -97,94 +109,94 @@ KNoScrollListBox::~KNoScrollListBox()
97#endif 109#endif
98} 110}
99 111
100 112
101void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) 113void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
102{ 114{
103 QListBox::focusInEvent ( e ); 115 Q3ListBox::focusInEvent ( e );
104 if ( count() ){ 116 if ( count() ){
105 int ci = currentItem(); 117 int ci = currentItem();
106 if ( ci < 0 ) ci = 0; 118 if ( ci < 0 ) ci = 0;
107 119
108 setCurrentItem( ci ); 120 setCurrentItem( ci );
109 setSelected ( ci, true ); 121 setSelected ( ci, true );
110 emit highlighted( item ( ci ) ); 122 emit highlighted( item ( ci ) );
111 123
112 resetOnFocusIn = true; 124 resetOnFocusIn = true;
113 125
114 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { 126 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
115 QListBoxItem *fi = firstItem (); 127 Q3ListBoxItem *fi = firstItem ();
116 if (fi ) { 128 if (fi ) {
117 int ihei = fi->height( this ); 129 int ihei = fi->height( this );
118 int hei = numRows () * ihei; 130 int hei = numRows () * ihei;
119 if ( hei < height() - horizontalScrollBar()->height () ) { 131 if ( hei < height() - horizontalScrollBar()->height () ) {
120 setVScrollBarMode(QScrollView::AlwaysOff); 132 setVScrollBarMode(Q3ScrollView::AlwaysOff);
121 } 133 }
122 else 134 else
123 setVScrollBarMode(QScrollView::Auto); 135 setVScrollBarMode(Q3ScrollView::Auto);
124 if ( ihei *3 > height() ) { 136 if ( ihei *3 > height() ) {
125 setHScrollBarMode(QScrollView::AlwaysOff); 137 setHScrollBarMode(Q3ScrollView::AlwaysOff);
126 } 138 }
127 else { 139 else {
128 setHScrollBarMode(QScrollView::Auto); 140 setHScrollBarMode(Q3ScrollView::Auto);
129 } 141 }
130 } else { 142 } else {
131 setVScrollBarMode(QScrollView::Auto); 143 setVScrollBarMode(Q3ScrollView::Auto);
132 setHScrollBarMode(QScrollView::Auto); 144 setHScrollBarMode(Q3ScrollView::Auto);
133 } 145 }
134 } 146 }
135 } 147 }
136} 148}
137void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) 149void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
138{ 150{
139 if ( ! mBlockDeselect ) { 151 if ( ! mBlockDeselect ) {
140 int i = currentItem (); 152 int i = currentItem ();
141 if ( i >= 0 ) { 153 if ( i >= 0 ) {
142 setSelected ( i, false ); 154 setSelected ( i, false );
143 } 155 }
144 QListBox::focusOutEvent ( e ); 156 Q3ListBox::focusOutEvent ( e );
145 } 157 }
146 setVScrollBarMode(QScrollView::AlwaysOff); 158 setVScrollBarMode(Q3ScrollView::AlwaysOff);
147 setHScrollBarMode(QScrollView::AlwaysOff); 159 setHScrollBarMode(Q3ScrollView::AlwaysOff);
148 if ( ! mBlockDeselect ) 160 if ( ! mBlockDeselect )
149 emit highlightIncidence( 0, (MonthViewCell*)this, 0 ); 161 emit highlightIncidence( 0, (MonthViewCell*)this, 0 );
150 mBlockDeselect = false; 162 mBlockDeselect = false;
151} 163}
152 164
153QString KNoScrollListBox::getWhatsThisText(QPoint p) 165QString KNoScrollListBox::getWhatsThisText(QPoint p)
154{ 166{
155 QListBoxItem* item = itemAt ( p ); 167 Q3ListBoxItem* item = itemAt ( p );
156 if ( ! item ) { 168 if ( ! item ) {
157 return i18n("Click in the cell\nto add an event!"); 169 return i18n("Click in the cell\nto add an event!");
158 } 170 }
159 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), 171 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(),
160 KOPrefs::instance()->mWTshowDetails, 172 KOPrefs::instance()->mWTshowDetails,
161 KOPrefs::instance()->mWTshowCreated, 173 KOPrefs::instance()->mWTshowCreated,
162 KOPrefs::instance()->mWTshowChanged); 174 KOPrefs::instance()->mWTshowChanged);
163} 175}
164void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 176void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
165{ 177{
166 //qDebug("KNoScrollListBox::keyPressEvent "); 178 //qDebug("KNoScrollListBox::keyPressEvent ");
167 switch(e->key()) { 179 switch(e->key()) {
168 case Key_Right: 180 case Qt::Key_Right:
169 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 181 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
170 { 182 {
171 e->ignore(); 183 e->ignore();
172 return; 184 return;
173 } 185 }
174 scrollBy(10,0); 186 scrollBy(10,0);
175 break; 187 break;
176 case Key_Left: 188 case Qt::Key_Left:
177 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 189 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
178 { 190 {
179 e->ignore(); 191 e->ignore();
180 return; 192 return;
181 } 193 }
182 scrollBy(-10,0); 194 scrollBy(-10,0);
183 break; 195 break;
184 case Key_Up: 196 case Qt::Key_Up:
185 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 197 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
186 e->ignore(); 198 e->ignore();
187 break; 199 break;
188 } 200 }
189 if ( count() ) { 201 if ( count() ) {
190 if ( currentItem() == 0 ) { 202 if ( currentItem() == 0 ) {
@@ -198,13 +210,13 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
198 setTopItem(topItem()-1); 210 setTopItem(topItem()-1);
199 } 211 }
200 } 212 }
201 } 213 }
202 } 214 }
203 break; 215 break;
204 case Key_Down: 216 case Qt::Key_Down:
205 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 217 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
206 e->ignore(); 218 e->ignore();
207 break; 219 break;
208 } 220 }
209 if ( count () ) { 221 if ( count () ) {
210 if ( ((uint)currentItem()+1) == count () ) { 222 if ( ((uint)currentItem()+1) == count () ) {
@@ -218,28 +230,28 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
218 setTopItem(topItem()+1); 230 setTopItem(topItem()+1);
219 } 231 }
220 } 232 }
221 } 233 }
222 } 234 }
223 break; 235 break;
224 case Key_I: 236 case Qt::Key_I:
225 QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); 237 QTimer::singleShot( 1, this, SLOT ( oneDown() ) );
226 e->ignore(); 238 e->ignore();
227 break; 239 break;
228 case Key_Return: 240 case Qt::Key_Return:
229 case Key_Enter: 241 case Qt::Key_Enter:
230 { 242 {
231 if ( currentItem() >= 0 ) { 243 if ( currentItem() >= 0 ) {
232 emit doubleClicked( item( currentItem() ) ); 244 emit doubleClicked( item( currentItem() ) );
233 e->accept(); 245 e->accept();
234 } else { 246 } else {
235 e->ignore(); 247 e->ignore();
236 } 248 }
237 } 249 }
238 break; 250 break;
239 case Key_Shift: 251 case Qt::Key_Shift:
240 emit shiftDown(); 252 emit shiftDown();
241 break; 253 break;
242 default: 254 default:
243 e->ignore(); 255 e->ignore();
244 break; 256 break;
245 } 257 }
@@ -263,31 +275,31 @@ void KNoScrollListBox::oneDown()
263 } 275 }
264 } 276 }
265} 277}
266void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 278void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
267{ 279{
268 switch(e->key()) { 280 switch(e->key()) {
269 case Key_Shift: 281 case Qt::Key_Shift:
270 emit shiftUp(); 282 emit shiftUp();
271 break; 283 break;
272 default: 284 default:
273 break; 285 break;
274 } 286 }
275} 287}
276 288
277void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 289void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
278{ 290{
279 QListBox::mousePressEvent(e); 291 Q3ListBox::mousePressEvent(e);
280 292
281 if(e->button() == RightButton) { 293 if(e->button() == Qt::RightButton) {
282 emit rightClick(); 294 emit rightClick();
283 } 295 }
284} 296}
285 297
286MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s) 298MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s)
287 : QListBoxItem() 299 : Q3ListBoxItem()
288{ 300{
289 mblockRepaint = true; 301 mblockRepaint = true;
290 isWeekItem = KOPrefs::instance()->mMonthViewWeek; 302 isWeekItem = KOPrefs::instance()->mMonthViewWeek;
291 recycle( incidence, s ); 303 recycle( incidence, s );
292} 304}
293void MonthViewItem::recycle( Incidence *incidence, const QString & s) 305void MonthViewItem::recycle( Incidence *incidence, const QString & s)
@@ -392,20 +404,20 @@ void MonthViewItem::paint(QPainter *p)
392 if ( mMultiday ) { 404 if ( mMultiday ) {
393 int yyy = y+(size/2); 405 int yyy = y+(size/2);
394 int sizeM = size+2; 406 int sizeM = size+2;
395 p->setBrush( QBrush( textColor ) ); 407 p->setBrush( QBrush( textColor ) );
396 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 408 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
397 if ( mMultiday == 2 || mMultiday == 3 ) { 409 if ( mMultiday == 2 || mMultiday == 3 ) {
398 QPointArray pa ( 3 ); 410 Q3PointArray pa ( 3 );
399 pa.setPoint (0, x, yyy ); 411 pa.setPoint (0, x, yyy );
400 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 412 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
401 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 413 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
402 p->drawPolygon( pa ); 414 p->drawPolygon( pa );
403 } 415 }
404 if ( mMultiday == 2 || mMultiday == 1 ) { 416 if ( mMultiday == 2 || mMultiday == 1 ) {
405 QPointArray pa ( 3 ); 417 Q3PointArray pa ( 3 );
406 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 418 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
407 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 419 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
408 pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); 420 pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
409 p->drawPolygon( pa ); 421 p->drawPolygon( pa );
410 } 422 }
411 if ( mMultiday == 1 ) { 423 if ( mMultiday == 1 ) {
@@ -459,21 +471,21 @@ void MonthViewItem::paint(QPainter *p)
459 int wid = fm.width( pText ); 471 int wid = fm.width( pText );
460 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 472 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
461 } 473 }
462 } 474 }
463} 475}
464 476
465int MonthViewItem::height(const QListBox *lb) const 477int MonthViewItem::height(const Q3ListBox *lb) const
466{ 478{
467 int ret = 10; 479 int ret = 10;
468 if ( lb ) 480 if ( lb )
469 ret = lb->fontMetrics().lineSpacing()+1; 481 ret = lb->fontMetrics().lineSpacing()+1;
470 return ret; 482 return ret;
471} 483}
472 484
473int MonthViewItem::width(const QListBox *lb) const 485int MonthViewItem::width(const Q3ListBox *lb) const
474{ 486{
475 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { 487 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) {
476 int size = PIXMAP_SIZE; 488 int size = PIXMAP_SIZE;
477 if ( QApplication::desktop()->width() < 300 ) 489 if ( QApplication::desktop()->width() < 300 )
478 size = 3; 490 size = 3;
479 int x = 1; 491 int x = 1;
@@ -511,44 +523,44 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
511 // mLabel = new QLabel( this );QPushButton 523 // mLabel = new QLabel( this );QPushButton
512 mLabel = new QPushButton( this ); 524 mLabel = new QPushButton( this );
513 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); 525 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
514 //mLabel->setLineWidth( 1 ); 526 //mLabel->setLineWidth( 1 );
515 //mLabel->setAlignment( AlignCenter ); 527 //mLabel->setAlignment( AlignCenter );
516 mLabel->setFlat( true ); 528 mLabel->setFlat( true );
517 mLabel->setFocusPolicy(NoFocus); 529 mLabel->setFocusPolicy(Qt::NoFocus);
518 //mItemList = new KNoScrollListBox( this ); 530 //mItemList = new KNoScrollListBox( this );
519 setMinimumSize( 10, 10 ); 531 setMinimumSize( 10, 10 );
520 setFrameStyle( QFrame::Panel | QFrame::Plain ); 532 setFrameStyle( Q3Frame::Panel | Q3Frame::Plain );
521 setLineWidth( 1 ); 533 setLineWidth( 1 );
522 //topLayout->addWidget( mItemList ); 534 //topLayout->addWidget( mItemList );
523 mLabel->raise(); 535 mLabel->raise();
524 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 536 // QColor( 0,0,255 ) QColor( 160,1600,255 )
525 mStandardPalette = palette(); 537 mStandardPalette = palette();
526 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 538 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
527 539
528 enableScrollBars( false ); 540 enableScrollBars( false );
529 updateConfig(); 541 updateConfig();
530 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); 542 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
531 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); 543 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
532 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), 544 connect( this , SIGNAL( doubleClicked( Q3ListBoxItem *) ),
533 SLOT( defaultAction( QListBoxItem * ) ) ); 545 SLOT( defaultAction( Q3ListBoxItem * ) ) );
534 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, 546 connect( this, SIGNAL( rightButtonPressed( Q3ListBoxItem *,
535 const QPoint &) ), 547 const QPoint &) ),
536 SLOT( contextMenu( QListBoxItem * ) ) ); 548 SLOT( contextMenu( Q3ListBoxItem * ) ) );
537 connect( this, SIGNAL( highlighted( QListBoxItem *) ), 549 connect( this, SIGNAL( highlighted( Q3ListBoxItem *) ),
538 SLOT( selection( QListBoxItem * ) ) ); 550 SLOT( selection( Q3ListBoxItem * ) ) );
539 551
540 /* 552 /*
541 connect( this, SIGNAL( clicked( QListBoxItem * ) ), 553 connect( this, SIGNAL( clicked( QListBoxItem * ) ),
542 SLOT( selection( QListBoxItem * ) ) ); 554 SLOT( selection( QListBoxItem * ) ) );
543 */ 555 */
544} 556}
545#ifdef DESKTOP_VERSION 557#ifdef DESKTOP_VERSION
546QToolTipGroup *MonthViewCell::toolTipGroup() 558QToolTipGroup *MonthViewCell::toolTipGroup()
547{ 559{
548 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 560 /* TODO:hacker: if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); */
549 return mToolTipGroup; 561 return mToolTipGroup;
550} 562}
551#endif 563#endif
552 564
553void MonthViewCell::setDate( const QDate &date ) 565void MonthViewCell::setDate( const QDate &date )
554{ 566{
@@ -634,13 +646,13 @@ void MonthViewCell::setHoliday( const QString &holiday )
634} 646}
635 647
636void MonthViewCell::startUpdateCell() 648void MonthViewCell::startUpdateCell()
637{ 649{
638 blockSignals( true ); 650 blockSignals( true );
639 mdayCount = 0; 651 mdayCount = 0;
640 setFocusPolicy(NoFocus); 652 setFocusPolicy(Qt::NoFocus);
641 if ( !mMonthView->isUpdatePossible() ) 653 if ( !mMonthView->isUpdatePossible() )
642 return; 654 return;
643 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 655 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
644 while ( mitem ) { 656 while ( mitem ) {
645 mitem->setBlockRepaint( true ); 657 mitem->setBlockRepaint( true );
646 mitem = (MonthViewItem *)mitem->next(); 658 mitem = (MonthViewItem *)mitem->next();
@@ -689,13 +701,13 @@ int MonthViewCell::insertEvent(Event *event)
689{ 701{
690 bool useToolTips = true; 702 bool useToolTips = true;
691#ifndef DESKTOP_VERSION 703#ifndef DESKTOP_VERSION
692 useToolTips = false; 704 useToolTips = false;
693#endif 705#endif
694 QString mToolTipText; 706 QString mToolTipText;
695 setFocusPolicy(WheelFocus); 707 setFocusPolicy(Qt::WheelFocus);
696 if ( !(event->doesRecur() == Recurrence::rNone) ) { 708 if ( !(event->doesRecur() == Recurrence::rNone) ) {
697 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) 709 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
698 return mdayCount; 710 return mdayCount;
699 else 711 else
700 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) 712 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
701 return mdayCount; 713 return mdayCount;
@@ -831,13 +843,13 @@ int MonthViewCell::insertEvent(Event *event)
831 if ( itcount > 1000 ) { 843 if ( itcount > 1000 ) {
832 qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount); 844 qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount);
833 itcount = 0; 845 itcount = 0;
834 } 846 }
835 for ( i = pos; i < itcount;++i ) { 847 for ( i = pos; i < itcount;++i ) {
836 // qDebug("i %d mday %u count %d ",i,itcount,mdayCount ); 848 // qDebug("i %d mday %u count %d ",i,itcount,mdayCount );
837 QListBoxItem* it = this->item ( i ); 849 Q3ListBoxItem* it = this->item ( i );
838 if ( it && text < it->text() ) { 850 if ( it && text < it->text() ) {
839 pos = i; 851 pos = i;
840 break; 852 break;
841 } 853 }
842 ++pos; 854 ++pos;
843 } 855 }
@@ -847,13 +859,13 @@ int MonthViewCell::insertEvent(Event *event)
847 mToolTip.append( mToolTipText ); 859 mToolTip.append( mToolTipText );
848 } 860 }
849 return mdayCount; 861 return mdayCount;
850} 862}
851void MonthViewCell::insertTodo(Todo *todo) 863void MonthViewCell::insertTodo(Todo *todo)
852{ 864{
853 setFocusPolicy(WheelFocus); 865 setFocusPolicy(Qt::WheelFocus);
854 QString text; 866 QString text;
855 if (todo->hasDueDate()) { 867 if (todo->hasDueDate()) {
856 if (!todo->doesFloat()) { 868 if (!todo->doesFloat()) {
857 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 869 text += KGlobal::locale()->formatTime(todo->dtDue().time());
858 text += " "; 870 text += " ";
859 } 871 }
@@ -919,13 +931,13 @@ void MonthViewCell::finishUpdateCell()
919 931
920 932
921 933
922#ifdef DESKTOP_VERSION 934#ifdef DESKTOP_VERSION
923 if (mToolTip.count() > 0 ) { 935 if (mToolTip.count() > 0 ) {
924 mToolTip.sort(); 936 mToolTip.sort();
925 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); 937 /* TODO: hacker: QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); */
926 } 938 }
927#endif 939#endif
928 //sort(); 940 //sort();
929 //setMyPalette(); 941 //setMyPalette();
930 setMyPalette(); 942 setMyPalette();
931 943
@@ -935,19 +947,19 @@ void MonthViewCell::finishUpdateCell()
935void MonthViewCell::updateCell() 947void MonthViewCell::updateCell()
936{ 948{
937 if ( !mMonthView->isUpdatePossible() ) 949 if ( !mMonthView->isUpdatePossible() )
938 return; 950 return;
939 startUpdateCell(); 951 startUpdateCell();
940 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 952 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
941 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 953 Q3PtrList<Event> events = mMonthView->calendar()->events( mDate, true );
942 Event *event; 954 Event *event;
943 for( event = events.first(); event; event = events.next() ) { // for event 955 for( event = events.first(); event; event = events.next() ) { // for event
944 insertEvent(event); 956 insertEvent(event);
945 } 957 }
946 // insert due todos 958 // insert due todos
947 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 959 Q3PtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
948 Todo *todo; 960 Todo *todo;
949 for(todo = todos.first(); todo; todo = todos.next()) { 961 for(todo = todos.first(); todo; todo = todos.next()) {
950 insertTodo( todo ); 962 insertTodo( todo );
951 } 963 }
952 finishUpdateCell(); 964 finishUpdateCell();
953 // if ( isVisible()) 965 // if ( isVisible())
@@ -989,34 +1001,34 @@ void MonthViewCell::updateConfig( bool bigFont ) // = false
989 1001
990void MonthViewCell::enableScrollBars( bool enabled ) 1002void MonthViewCell::enableScrollBars( bool enabled )
991{ 1003{
992 1004
993 return; 1005 return;
994 if ( enabled ) { 1006 if ( enabled ) {
995 QListBoxItem *fi = firstItem (); 1007 Q3ListBoxItem *fi = firstItem ();
996 if (fi ) { 1008 if (fi ) {
997 int ihei = fi->height( this ); 1009 int ihei = fi->height( this );
998 int hei = numRows () * ihei; 1010 int hei = numRows () * ihei;
999 if ( hei < height() - horizontalScrollBar()->height () ) { 1011 if ( hei < height() - horizontalScrollBar()->height () ) {
1000 setVScrollBarMode(QScrollView::AlwaysOff); 1012 setVScrollBarMode(Q3ScrollView::AlwaysOff);
1001 } 1013 }
1002 else 1014 else
1003 setVScrollBarMode(QScrollView::Auto); 1015 setVScrollBarMode(Q3ScrollView::Auto);
1004 if ( ihei *3 > height() ) { 1016 if ( ihei *3 > height() ) {
1005 setHScrollBarMode(QScrollView::AlwaysOff); 1017 setHScrollBarMode(Q3ScrollView::AlwaysOff);
1006 } 1018 }
1007 else { 1019 else {
1008 setHScrollBarMode(QScrollView::Auto); 1020 setHScrollBarMode(Q3ScrollView::Auto);
1009 } 1021 }
1010 } else { 1022 } else {
1011 setVScrollBarMode(QScrollView::Auto); 1023 setVScrollBarMode(Q3ScrollView::Auto);
1012 setHScrollBarMode(QScrollView::Auto); 1024 setHScrollBarMode(Q3ScrollView::Auto);
1013 } 1025 }
1014 } else { 1026 } else {
1015 setVScrollBarMode(QScrollView::AlwaysOff); 1027 setVScrollBarMode(Q3ScrollView::AlwaysOff);
1016 setHScrollBarMode(QScrollView::AlwaysOff); 1028 setHScrollBarMode(Q3ScrollView::AlwaysOff);
1017 } 1029 }
1018} 1030}
1019 1031
1020Incidence *MonthViewCell::selectedIncidence() 1032Incidence *MonthViewCell::selectedIncidence()
1021{ 1033{
1022 int index = currentItem(); 1034 int index = currentItem();
@@ -1080,13 +1092,13 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
1080 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 1092 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
1081 // mItemList->resize ( width(), height () ); 1093 // mItemList->resize ( width(), height () );
1082 if ( e ) 1094 if ( e )
1083 KNoScrollListBox::resizeEvent ( e ); 1095 KNoScrollListBox::resizeEvent ( e );
1084} 1096}
1085 1097
1086void MonthViewCell::defaultAction( QListBoxItem *item ) 1098void MonthViewCell::defaultAction( Q3ListBoxItem *item )
1087{ 1099{
1088 1100
1089 if ( !item ) { 1101 if ( !item ) {
1090 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1102 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1091 emit newEventSignal( dt ); 1103 emit newEventSignal( dt );
1092 return; 1104 return;
@@ -1102,24 +1114,24 @@ void MonthViewCell::showDay()
1102} 1114}
1103void MonthViewCell::newEvent() 1115void MonthViewCell::newEvent()
1104{ 1116{
1105 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1117 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1106 emit newEventSignal( dt ); 1118 emit newEventSignal( dt );
1107} 1119}
1108void MonthViewCell::cellClicked( QListBoxItem *item ) 1120void MonthViewCell::cellClicked( Q3ListBoxItem *item )
1109{ 1121{
1110 mMonthView->setSelectedCell( this ); 1122 mMonthView->setSelectedCell( this );
1111 if ( item == 0 ) { 1123 if ( item == 0 ) {
1112 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1124 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1113 emit newEventSignal( dt ); 1125 emit newEventSignal( dt );
1114 return; 1126 return;
1115 } 1127 }
1116 1128
1117} 1129}
1118 1130
1119void MonthViewCell::contextMenu( QListBoxItem *item ) 1131void MonthViewCell::contextMenu( Q3ListBoxItem *item )
1120{ 1132{
1121 mMonthView->setPopupCell( this ); 1133 mMonthView->setPopupCell( this );
1122 if ( !item ) { 1134 if ( !item ) {
1123 mMonthView->showContextMenu( 0 ); 1135 mMonthView->showContextMenu( 0 );
1124 return; 1136 return;
1125 } 1137 }
@@ -1130,13 +1142,13 @@ void MonthViewCell::contextMenu( QListBoxItem *item )
1130 if ( incidence ) { 1142 if ( incidence ) {
1131 mBlockDeselect = true; 1143 mBlockDeselect = true;
1132 mMonthView->showContextMenu( incidence ); 1144 mMonthView->showContextMenu( incidence );
1133 } 1145 }
1134} 1146}
1135 1147
1136void MonthViewCell::selection( QListBoxItem *item ) 1148void MonthViewCell::selection( Q3ListBoxItem *item )
1137{ 1149{
1138 if ( !item ) { 1150 if ( !item ) {
1139 emit highlightIncidence( 0 , this, 0 ); 1151 emit highlightIncidence( 0 , this, 0 );
1140 return; 1152 return;
1141 } 1153 }
1142 MonthViewItem * it = (static_cast<MonthViewItem *>( item )); 1154 MonthViewItem * it = (static_cast<MonthViewItem *>( item ));
@@ -1182,14 +1194,14 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1182 mShortDayLabelsM = false; 1194 mShortDayLabelsM = false;
1183 mShortDayLabelsW = false; 1195 mShortDayLabelsW = false;
1184 skipResize = false; 1196 skipResize = false;
1185 clPending = true; 1197 clPending = true;
1186 mPopupCell = 0; 1198 mPopupCell = 0;
1187 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1199 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1188 mWidStack = new QWidgetStack( this ); 1200 mWidStack = new Q3WidgetStack( this );
1189 QVBoxLayout* hb = new QVBoxLayout( this ); 1201 Q3VBoxLayout* hb = new Q3VBoxLayout( this );
1190 mMonthView = new QWidget( mWidStack ); 1202 mMonthView = new QWidget( mWidStack );
1191 mWeekView = new QWidget( mWidStack ); 1203 mWeekView = new QWidget( mWidStack );
1192#if QT_VERSION >= 0x030000 1204#if QT_VERSION >= 0x030000
1193 mWidStack->addWidget(mMonthView ); 1205 mWidStack->addWidget(mMonthView );
1194 mWidStack->addWidget(mWeekView ); 1206 mWidStack->addWidget(mWeekView );
1195#else 1207#else
@@ -1212,57 +1224,57 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1212 bfont.setBold( true ); 1224 bfont.setBold( true );
1213 int i; 1225 int i;
1214 1226
1215 for( i = 0; i < mDaysPerWeek; i++ ) { 1227 for( i = 0; i < mDaysPerWeek; i++ ) {
1216 QLabel *label = new QLabel( mMonthView ); 1228 QLabel *label = new QLabel( mMonthView );
1217 label->setFont(bfont); 1229 label->setFont(bfont);
1218 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1230 label->setFrameStyle(Q3Frame::Panel|Q3Frame::Raised);
1219 label->setLineWidth(1); 1231 label->setLineWidth(1);
1220 label->setAlignment(AlignCenter); 1232 label->setAlignment(Qt::AlignCenter);
1221 mDayLabels.insert( i, label ); 1233 mDayLabels.insert( i, label );
1222 label = new QLabel( mWeekView ); 1234 label = new QLabel( mWeekView );
1223 label->setFont(bfont); 1235 label->setFont(bfont);
1224 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1236 label->setFrameStyle(Q3Frame::Panel|Q3Frame::Raised);
1225 label->setLineWidth(1); 1237 label->setLineWidth(1);
1226 label->setAlignment(AlignCenter); 1238 label->setAlignment(Qt::AlignCenter);
1227 mDayLabelsW.insert( i, label ); 1239 mDayLabelsW.insert( i, label );
1228 } 1240 }
1229 1241
1230 bfont.setBold( false ); 1242 bfont.setBold( false );
1231 mWeekLabels.resize( mNumWeeks+1 ); 1243 mWeekLabels.resize( mNumWeeks+1 );
1232 mWeekLabelsW.resize( 2 ); 1244 mWeekLabelsW.resize( 2 );
1233 for( i = 0; i < mNumWeeks+1; i++ ) { 1245 for( i = 0; i < mNumWeeks+1; i++ ) {
1234 KOWeekButton *label = new KOWeekButton( mMonthView ); 1246 KOWeekButton *label = new KOWeekButton( mMonthView );
1235 label->setFocusPolicy(NoFocus); 1247 label->setFocusPolicy(Qt::NoFocus);
1236 label->setFont(bfont); 1248 label->setFont(bfont);
1237 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1249 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1238 label->setFlat(true); 1250 label->setFlat(true);
1239 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1251 Q3WhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1240 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1252 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1241 //label->setLineWidth(1); 1253 //label->setLineWidth(1);
1242 //label->setAlignment(AlignCenter); 1254 //label->setAlignment(AlignCenter);
1243 mWeekLabels.insert( i, label ); 1255 mWeekLabels.insert( i, label );
1244 } 1256 }
1245 mWeekLabels[mNumWeeks]->setText( i18n("W")); 1257 mWeekLabels[mNumWeeks]->setText( i18n("W"));
1246 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); 1258 mWeekLabels[mNumWeeks]->setFocusPolicy(Qt::WheelFocus);
1247 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 1259 Q3WhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
1248 1260
1249 for( i = 0; i < 1+1; i++ ) { 1261 for( i = 0; i < 1+1; i++ ) {
1250 KOWeekButton *label = new KOWeekButton( mWeekView ); 1262 KOWeekButton *label = new KOWeekButton( mWeekView );
1251 label->setFocusPolicy(NoFocus); 1263 label->setFocusPolicy(Qt::NoFocus);
1252 label->setFont(bfont); 1264 label->setFont(bfont);
1253 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1265 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1254 label->setFlat(true); 1266 label->setFlat(true);
1255 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1267 Q3WhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1256 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1268 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1257 //label->setLineWidth(1); 1269 //label->setLineWidth(1);
1258 //label->setAlignment(AlignCenter); 1270 //label->setAlignment(AlignCenter);
1259 mWeekLabelsW.insert( i, label ); 1271 mWeekLabelsW.insert( i, label );
1260 } 1272 }
1261 mWeekLabelsW[1]->setText( i18n("W")); 1273 mWeekLabelsW[1]->setText( i18n("W"));
1262 mWeekLabelsW[1]->setFocusPolicy(WheelFocus); 1274 mWeekLabelsW[1]->setFocusPolicy(Qt::WheelFocus);
1263 1275
1264 1276
1265 int row, col; 1277 int row, col;
1266 mCells.resize( mNumCells ); 1278 mCells.resize( mNumCells );
1267 for( row = 0; row < mNumWeeks; ++row ) { 1279 for( row = 0; row < mNumWeeks; ++row ) {
1268 for( col = 0; col < mDaysPerWeek; ++col ) { 1280 for( col = 0; col < mDaysPerWeek; ++col ) {
@@ -1302,19 +1314,19 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1302 SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); 1314 SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) ));
1303 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 1315 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
1304 } 1316 }
1305 1317
1306 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 1318 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
1307 mContextMenu = eventPopup(); 1319 mContextMenu = eventPopup();
1308 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1320 mContextMenu->addAdditionalItem(QIcon(QPixmap()),
1309 i18n("New Event..."),this, 1321 i18n("New Event..."),this,
1310 SLOT(slotNewEvent()),false); 1322 SLOT(slotNewEvent()),false);
1311 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1323 mContextMenu->addAdditionalItem(QIcon(QPixmap()),
1312 i18n("New Todo..."),this, 1324 i18n("New Todo..."),this,
1313 SLOT(slotNewTodo()),false); 1325 SLOT(slotNewTodo()),false);
1314 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1326 mContextMenu->addAdditionalItem(QIcon(QPixmap()),
1315 i18n("Journal"),this, 1327 i18n("Journal"),this,
1316 SLOT(slotEditJournal()),false); 1328 SLOT(slotEditJournal()),false);
1317 1329
1318 connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this, 1330 connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this,
1319 SLOT( catChanged( Incidence * ) )); 1331 SLOT( catChanged( Incidence * ) ));
1320 1332
@@ -1322,13 +1334,13 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1322 QString pathString = ""; 1334 QString pathString = "";
1323 if ( !KOPrefs::instance()->mToolBarMiniIcons ) { 1335 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
1324 if ( QApplication::desktop()->width() < 480 ) 1336 if ( QApplication::desktop()->width() < 480 )
1325 pathString += "icons16/"; 1337 pathString += "icons16/";
1326 } else 1338 } else
1327 pathString += "iconsmini/"; 1339 pathString += "iconsmini/";
1328 mNewItemMenu = new QPopupMenu( this ); 1340 mNewItemMenu = new Q3PopupMenu( this );
1329 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent())); 1341 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent()));
1330 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false); 1342 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false);
1331 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false); 1343 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false);
1332 1344
1333 // updateConfig(); //useless here... 1345 // updateConfig(); //useless here...
1334 // ... but we need mWidthLongDayLabel computed 1346 // ... but we need mWidthLongDayLabel computed
@@ -1394,13 +1406,13 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
1394 if ( mCellsW[i] == mc ) { 1406 if ( mCellsW[i] == mc ) {
1395 weekview = true; 1407 weekview = true;
1396 index = i; 1408 index = i;
1397 break; 1409 break;
1398 } 1410 }
1399 } 1411 }
1400 QPtrVector<MonthViewCell> *cells; 1412 Q3PtrVector<MonthViewCell> *cells;
1401 if ( weekview ) 1413 if ( weekview )
1402 cells = &mCellsW; 1414 cells = &mCellsW;
1403 else { 1415 else {
1404 for (uint i = 0; i < mCells.count(); ++i) { 1416 for (uint i = 0; i < mCells.count(); ++i) {
1405 if ( mCells[i] == mc ) { 1417 if ( mCells[i] == mc ) {
1406 index = i; 1418 index = i;
@@ -1492,15 +1504,15 @@ int KOMonthView::maxDatesHint()
1492 1504
1493int KOMonthView::currentDateCount() 1505int KOMonthView::currentDateCount()
1494{ 1506{
1495 return mNumCells; 1507 return mNumCells;
1496} 1508}
1497 1509
1498QPtrList<Incidence> KOMonthView::selectedIncidences() 1510Q3PtrList<Incidence> KOMonthView::selectedIncidences()
1499{ 1511{
1500 QPtrList<Incidence> selected; 1512 Q3PtrList<Incidence> selected;
1501 1513
1502 if ( mSelectedCell ) { 1514 if ( mSelectedCell ) {
1503 Incidence *incidence = mSelectedCell->selectedIncidence(); 1515 Incidence *incidence = mSelectedCell->selectedIncidence();
1504 if ( incidence ) selected.append( incidence ); 1516 if ( incidence ) selected.append( incidence );
1505 } 1517 }
1506 1518
@@ -1558,21 +1570,21 @@ void KOMonthView::updateConfig()
1558 } 1570 }
1559 1571
1560 for (uint i = 0; i < mCellsW.count(); ++i) { 1572 for (uint i = 0; i < mCellsW.count(); ++i) {
1561 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); 1573 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont);
1562 } 1574 }
1563#ifdef DESKTOP_VERSION 1575#ifdef DESKTOP_VERSION
1564 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); 1576 /* TODO:hacker: MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); */
1565#endif 1577#endif
1566 updateView(); 1578 updateView();
1567} 1579}
1568 1580
1569void KOMonthView::updateDayLabels() 1581void KOMonthView::updateDayLabels()
1570{ 1582{
1571 1583
1572 QPtrVector<QLabel> *mDayLabelsT; 1584 Q3PtrVector<QLabel> *mDayLabelsT;
1573 1585
1574 mDayLabelsT = &mDayLabelsW; 1586 mDayLabelsT = &mDayLabelsW;
1575 for (int i = 0; i < 7; i++) { 1587 for (int i = 0; i < 7; i++) {
1576 { 1588 {
1577 bool show = mShortDayLabelsW; 1589 bool show = mShortDayLabelsW;
1578 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1590 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
@@ -1607,15 +1619,15 @@ void KOMonthView::clearList()
1607 } 1619 }
1608} 1620}
1609void KOMonthView::showDates(const QDate &start, const QDate &) 1621void KOMonthView::showDates(const QDate &start, const QDate &)
1610{ 1622{
1611 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; 1623 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
1612 1624
1613 QPtrVector<MonthViewCell> *cells; 1625 Q3PtrVector<MonthViewCell> *cells;
1614 QPtrVector<QLabel> *dayLabels; 1626 Q3PtrVector<QLabel> *dayLabels;
1615 QPtrVector<KOWeekButton> *weekLabels; 1627 Q3PtrVector<KOWeekButton> *weekLabels;
1616 uint weekNum = 6; 1628 uint weekNum = 6;
1617 mStartDate = start; 1629 mStartDate = start;
1618 if ( mShowWeekView ) { 1630 if ( mShowWeekView ) {
1619 weekNum = 1; 1631 weekNum = 1;
1620 cells = &mCellsW; 1632 cells = &mCellsW;
1621 dayLabels = &mDayLabelsW; 1633 dayLabels = &mDayLabelsW;
@@ -1665,13 +1677,13 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
1665 (*weekLabels)[i]->setWeekNum( wno ); 1677 (*weekLabels)[i]->setWeekNum( wno );
1666 date = date.addDays( 7 ); 1678 date = date.addDays( 7 );
1667 } 1679 }
1668 updateView(); 1680 updateView();
1669} 1681}
1670 1682
1671void KOMonthView::showEvents(QPtrList<Event>) 1683void KOMonthView::showEvents(Q3PtrList<Event>)
1672{ 1684{
1673 qDebug("KOMonthView::selectEvents is not implemented yet. "); 1685 qDebug("KOMonthView::selectEvents is not implemented yet. ");
1674} 1686}
1675 1687
1676void KOMonthView::changeEventDisplay(Event *, int) 1688void KOMonthView::changeEventDisplay(Event *, int)
1677{ 1689{
@@ -1687,13 +1699,13 @@ void KOMonthView::updateView()
1687 if ( !updatePossible ) 1699 if ( !updatePossible )
1688 return; 1700 return;
1689 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); 1701 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU ");
1690 //QTime ti; 1702 //QTime ti;
1691 //ti.start(); 1703 //ti.start();
1692 clearSelection(); 1704 clearSelection();
1693 QPtrVector<MonthViewCell> *cells; 1705 Q3PtrVector<MonthViewCell> *cells;
1694 if ( mShowWeekView ) { 1706 if ( mShowWeekView ) {
1695 cells = &mCellsW; 1707 cells = &mCellsW;
1696 } else { 1708 } else {
1697 cells = &mCells; 1709 cells = &mCells;
1698 } 1710 }
1699#if 1 1711#if 1
@@ -1702,13 +1714,13 @@ void KOMonthView::updateView()
1702 if ( KOPrefs::instance()->mMonthViewWeek ) 1714 if ( KOPrefs::instance()->mMonthViewWeek )
1703 timeSpan = 6; 1715 timeSpan = 6;
1704 for( i = 0; i < timeSpan + 1; ++i ) { 1716 for( i = 0; i < timeSpan + 1; ++i ) {
1705 (*cells)[i]->startUpdateCell(); 1717 (*cells)[i]->startUpdateCell();
1706 } 1718 }
1707 1719
1708 QPtrList<Event> events = calendar()->events(); 1720 Q3PtrList<Event> events = calendar()->events();
1709 Event *event; 1721 Event *event;
1710 QDateTime dt; 1722 QDateTime dt;
1711 QDate endDate = mStartDate.addDays( timeSpan ); 1723 QDate endDate = mStartDate.addDays( timeSpan );
1712 for( event = events.first(); event; event = events.next() ) { // for event 1724 for( event = events.first(); event; event = events.next() ) { // for event
1713 if ( event->doesRecur() ) { 1725 if ( event->doesRecur() ) {
1714 bool last; 1726 bool last;
@@ -1766,13 +1778,13 @@ void KOMonthView::updateView()
1766 (*cells)[iii]->insertEvent( event ); 1778 (*cells)[iii]->insertEvent( event );
1767 } 1779 }
1768 } 1780 }
1769 } 1781 }
1770 } 1782 }
1771 // insert due todos 1783 // insert due todos
1772 QPtrList<Todo> todos = calendar()->todos( ); 1784 Q3PtrList<Todo> todos = calendar()->todos( );
1773 Todo *todo; 1785 Todo *todo;
1774 for(todo = todos.first(); todo; todo = todos.next()) { 1786 for(todo = todos.first(); todo; todo = todos.next()) {
1775 //insertTodo( todo ); 1787 //insertTodo( todo );
1776 if ( todo->hasDueDate() ) { 1788 if ( todo->hasDueDate() ) {
1777 int day = mStartDate.daysTo( todo->dtDue().date() ); 1789 int day = mStartDate.daysTo( todo->dtDue().date() );
1778 if ( day >= 0 && day < timeSpan + 1) { 1790 if ( day >= 0 && day < timeSpan + 1) {
@@ -2222,13 +2234,13 @@ void KOMonthView::setSelectedCell( MonthViewCell *cell )
2222 else 2234 else
2223 emit incidenceSelected( mSelectedCell->selectedIncidence() ); 2235 emit incidenceSelected( mSelectedCell->selectedIncidence() );
2224} 2236}
2225 2237
2226void KOMonthView::processSelectionChange() 2238void KOMonthView::processSelectionChange()
2227{ 2239{
2228 QPtrList<Incidence> incidences = selectedIncidences(); 2240 Q3PtrList<Incidence> incidences = selectedIncidences();
2229 if (incidences.count() > 0) { 2241 if (incidences.count() > 0) {
2230 emit incidenceSelected( incidences.first() ); 2242 emit incidenceSelected( incidences.first() );
2231 } else { 2243 } else {
2232 emit incidenceSelected( 0 ); 2244 emit incidenceSelected( 0 );
2233 clearSelection(); 2245 clearSelection();
2234 } 2246 }
@@ -2258,43 +2270,43 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
2258 e->accept(); 2270 e->accept();
2259 return; 2271 return;
2260 } 2272 }
2261 if (! e->isAutoRepeat() ) 2273 if (! e->isAutoRepeat() )
2262 mFlagKeyPressed = true; 2274 mFlagKeyPressed = true;
2263 switch(e->key()) { 2275 switch(e->key()) {
2264 case Key_Up: 2276 case Qt::Key_Up:
2265 { 2277 {
2266 if ( mShowWeekView ) { 2278 if ( mShowWeekView ) {
2267 emit selectWeekNum ( currentWeek() - 1 ); 2279 emit selectWeekNum ( currentWeek() - 1 );
2268 } 2280 }
2269 else { 2281 else {
2270 emit prevMonth(); 2282 emit prevMonth();
2271 } 2283 }
2272 } 2284 }
2273 e->accept(); 2285 e->accept();
2274 break; 2286 break;
2275 case Key_Down: 2287 case Qt::Key_Down:
2276 { 2288 {
2277 if ( mShowWeekView ) { 2289 if ( mShowWeekView ) {
2278 emit selectWeekNum ( currentWeek() +1); 2290 emit selectWeekNum ( currentWeek() +1);
2279 } 2291 }
2280 else { 2292 else {
2281 emit nextMonth(); 2293 emit nextMonth();
2282 } 2294 }
2283 2295
2284 } 2296 }
2285 e->accept(); 2297 e->accept();
2286 break; 2298 break;
2287 case Key_Return: 2299 case Qt::Key_Return:
2288 case Key_Enter: 2300 case Qt::Key_Enter:
2289 { 2301 {
2290 selectInternalWeekNum ( currentWeek() ); 2302 selectInternalWeekNum ( currentWeek() );
2291 } 2303 }
2292 e->accept(); 2304 e->accept();
2293 break; 2305 break;
2294 case Key_D: 2306 case Qt::Key_D:
2295 if ( mSelectedCell ) { 2307 if ( mSelectedCell ) {
2296 mSelectedCell->showDay(); 2308 mSelectedCell->showDay();
2297 e->accept(); 2309 e->accept();
2298 } else { 2310 } else {
2299 e->ignore(); 2311 e->ignore();
2300 } 2312 }