summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
Unidiff
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
@@ -17,22 +17,34 @@
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>
@@ -59,10 +71,10 @@
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:
@@ -77,7 +89,7 @@ private:
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 );
@@ -85,8 +97,8 @@ KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
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{
@@ -100,7 +112,7 @@ KNoScrollListBox::~KNoScrollListBox()
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;
@@ -112,24 +124,24 @@ void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
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 }
@@ -141,10 +153,10 @@ void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
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;
@@ -152,7 +164,7 @@ void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
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 }
@@ -165,7 +177,7 @@ void 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();
@@ -173,7 +185,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
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();
@@ -181,7 +193,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
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;
@@ -201,7 +213,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
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;
@@ -221,12 +233,12 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
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() ) );
@@ -236,7 +248,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
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:
@@ -266,7 +278,7 @@ void KNoScrollListBox::oneDown()
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:
@@ -276,15 +288,15 @@ void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
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;
@@ -395,14 +407,14 @@ void MonthViewItem::paint(QPainter *p)
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 );
@@ -462,7 +474,7 @@ void MonthViewItem::paint(QPainter *p)
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 )
@@ -470,7 +482,7 @@ int MonthViewItem::height(const QListBox *lb) const
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;
@@ -514,10 +526,10 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
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();
@@ -529,13 +541,13 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
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 * ) ),
@@ -545,7 +557,7 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
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
@@ -637,7 +649,7 @@ void 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 ();
@@ -692,7 +704,7 @@ int MonthViewCell::insertEvent(Event *event)
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;
@@ -834,7 +846,7 @@ int MonthViewCell::insertEvent(Event *event)
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;
@@ -850,7 +862,7 @@ int MonthViewCell::insertEvent(Event *event)
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()) {
@@ -922,7 +934,7 @@ void MonthViewCell::finishUpdateCell()
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();
@@ -938,13 +950,13 @@ void MonthViewCell::updateCell()
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 );
@@ -992,28 +1004,28 @@ void MonthViewCell::enableScrollBars( bool enabled )
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
@@ -1083,7 +1095,7 @@ void MonthViewCell::resizeEvent ( QResizeEvent * 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 ) {
@@ -1105,7 +1117,7 @@ void MonthViewCell::newEvent()
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 ) {
@@ -1116,7 +1128,7 @@ void MonthViewCell::cellClicked( QListBoxItem *item )
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 ) {
@@ -1133,7 +1145,7 @@ void MonthViewCell::contextMenu( QListBoxItem *item )
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 );
@@ -1185,8 +1197,8 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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
@@ -1215,15 +1227,15 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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
@@ -1232,34 +1244,34 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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;
@@ -1305,13 +1317,13 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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
@@ -1325,7 +1337,7 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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);
@@ -1397,7 +1409,7 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int
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 {
@@ -1495,9 +1507,9 @@ int KOMonthView::currentDateCount()
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();
@@ -1561,7 +1573,7 @@ void KOMonthView::updateConfig()
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}
@@ -1569,7 +1581,7 @@ void KOMonthView::updateConfig()
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++) {
@@ -1610,9 +1622,9 @@ void 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 ) {
@@ -1668,7 +1680,7 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
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}
@@ -1690,7 +1702,7 @@ void KOMonthView::updateView()
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 {
@@ -1705,7 +1717,7 @@ void KOMonthView::updateView()
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 );
@@ -1769,7 +1781,7 @@ void KOMonthView::updateView()
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 );
@@ -2225,7 +2237,7 @@ void KOMonthView::setSelectedCell( MonthViewCell *cell )
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 {
@@ -2261,7 +2273,7 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
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 );
@@ -2272,7 +2284,7 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
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);
@@ -2284,14 +2296,14 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
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();