summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp12
-rw-r--r--korganizer/komonthview.h3
2 files changed, 10 insertions, 5 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 4aeb20c..8d06040 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -21,189 +21,194 @@
21#include <qfont.h> 21#include <qfont.h>
22#include <qfontmetrics.h> 22#include <qfontmetrics.h>
23#include <qkeycode.h> 23#include <qkeycode.h>
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qwidgetstack.h> 26#include <qwidgetstack.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 <qwhatsthis.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#endif 36#endif
37 37
38#include <kdebug.h> 38#include <kdebug.h>
39#include <klocale.h> 39#include <klocale.h>
40#include <kglobal.h> 40#include <kglobal.h>
41#include <kconfig.h> 41#include <kconfig.h>
42#include <kiconloader.h> 42#include <kiconloader.h>
43 43
44#include <kcalendarsystem.h> 44#include <kcalendarsystem.h>
45 45
46#ifndef KORG_NOPRINTER 46#ifndef KORG_NOPRINTER
47#include "calprinter.h" 47#include "calprinter.h"
48#endif 48#endif
49#include "koprefs.h" 49#include "koprefs.h"
50#ifndef KORG_NOPLUGINS 50#ifndef KORG_NOPLUGINS
51#include "kocore.h" 51#include "kocore.h"
52#endif 52#endif
53#include "koglobals.h" 53#include "koglobals.h"
54#include <libkcal/kincidenceformatter.h> 54#include <libkcal/kincidenceformatter.h>
55 55
56#include "komonthview.h" 56#include "komonthview.h"
57 57
58#define PIXMAP_SIZE 5 58#define PIXMAP_SIZE 5
59#ifdef DESKTOP_VERSION 59#ifdef DESKTOP_VERSION
60QToolTipGroup *MonthViewCell::mToolTipGroup = 0; 60QToolTipGroup *MonthViewCell::mToolTipGroup = 0;
61#endif 61#endif
62class KNOWhatsThis :public QWhatsThis 62class KNOWhatsThis :public QWhatsThis
63{ 63{
64public: 64public:
65 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; 65 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { };
66 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; 66 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); };
67 67
68protected: 68protected:
69 virtual QString text( const QPoint& p) 69 virtual QString text( const QPoint& p)
70 { 70 {
71 return _wid->getWhatsThisText(p) ; 71 return _wid->getWhatsThisText(p) ;
72 }; 72 };
73private: 73private:
74 KNoScrollListBox* _wid; 74 KNoScrollListBox* _wid;
75 75
76}; 76};
77 77
78 78
79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
80 : QListBox(parent, name, WRepaintNoErase) 80 : QListBox(parent, name, WRepaintNoErase)
81{ 81{
82#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
84#endif 84#endif
85 mBlockDeselect = false;
85 mWT = new KNOWhatsThis(this); 86 mWT = new KNOWhatsThis(this);
86 resetOnFocusIn = true; 87 resetOnFocusIn = true;
87 setVScrollBarMode(QScrollView::AlwaysOff); 88 setVScrollBarMode(QScrollView::AlwaysOff);
88 setHScrollBarMode(QScrollView::AlwaysOff); 89 setHScrollBarMode(QScrollView::AlwaysOff);
89} 90}
90KNoScrollListBox::~KNoScrollListBox() 91KNoScrollListBox::~KNoScrollListBox()
91{ 92{
92#if QT_VERSION >= 0x030000 93#if QT_VERSION >= 0x030000
93 94
94#else 95#else
95 delete mWT; 96 delete mWT;
96#endif 97#endif
97} 98}
98 99
99 100
100void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) 101void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
101{ 102{
102 QListBox::focusInEvent ( e ); 103 QListBox::focusInEvent ( e );
103 if ( count() ){ 104 if ( count() ){
104 int ci = currentItem(); 105 int ci = currentItem();
105 if ( ci < 0 ) ci = 0; 106 if ( ci < 0 ) ci = 0;
106 107
107 setCurrentItem( ci ); 108 setCurrentItem( ci );
108 setSelected ( ci, true ); 109 setSelected ( ci, true );
109 emit highlighted( item ( ci ) ); 110 emit highlighted( item ( ci ) );
110 111
111 resetOnFocusIn = true; 112 resetOnFocusIn = true;
112 113
113 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { 114 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
114 QListBoxItem *fi = firstItem (); 115 QListBoxItem *fi = firstItem ();
115 if (fi ) { 116 if (fi ) {
116 int ihei = fi->height( this ); 117 int ihei = fi->height( this );
117 int hei = numRows () * ihei; 118 int hei = numRows () * ihei;
118 if ( hei < height() - horizontalScrollBar()->height () ) { 119 if ( hei < height() - horizontalScrollBar()->height () ) {
119 setVScrollBarMode(QScrollView::AlwaysOff); 120 setVScrollBarMode(QScrollView::AlwaysOff);
120 } 121 }
121 else 122 else
122 setVScrollBarMode(QScrollView::Auto); 123 setVScrollBarMode(QScrollView::Auto);
123 if ( ihei *3 > height() ) { 124 if ( ihei *3 > height() ) {
124 setHScrollBarMode(QScrollView::AlwaysOff); 125 setHScrollBarMode(QScrollView::AlwaysOff);
125 } 126 }
126 else { 127 else {
127 setHScrollBarMode(QScrollView::Auto); 128 setHScrollBarMode(QScrollView::Auto);
128 } 129 }
129 } else { 130 } else {
130 setVScrollBarMode(QScrollView::Auto); 131 setVScrollBarMode(QScrollView::Auto);
131 setHScrollBarMode(QScrollView::Auto); 132 setHScrollBarMode(QScrollView::Auto);
132 } 133 }
133 } 134 }
134 } 135 }
135} 136}
136void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) 137void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
137{ 138{
139 if ( ! mBlockDeselect ) {
138 int i = currentItem (); 140 int i = currentItem ();
139 if ( i >= 0 ) { 141 if ( i >= 0 ) {
140 setSelected ( i, false ); 142 setSelected ( i, false );
141 } 143 }
142 QListBox::focusOutEvent ( e ); 144 QListBox::focusOutEvent ( e );
145 }
143 setVScrollBarMode(QScrollView::AlwaysOff); 146 setVScrollBarMode(QScrollView::AlwaysOff);
144 setHScrollBarMode(QScrollView::AlwaysOff); 147 setHScrollBarMode(QScrollView::AlwaysOff);
145 emit highlightIncidence( 0, (MonthViewCell*)this, 0 ); 148 if ( ! mBlockDeselect )
149 emit highlightIncidence( 0, (MonthViewCell*)this, 0 );
150 mBlockDeselect = false;
146} 151}
147 152
148QString KNoScrollListBox::getWhatsThisText(QPoint p) 153QString KNoScrollListBox::getWhatsThisText(QPoint p)
149{ 154{
150 QListBoxItem* item = itemAt ( p ); 155 QListBoxItem* item = itemAt ( p );
151 if ( ! item ) { 156 if ( ! item ) {
152 return i18n("Click in the cell\nto add an event!"); 157 return i18n("Click in the cell\nto add an event!");
153 } 158 }
154 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), 159 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(),
155 KOPrefs::instance()->mWTshowDetails, 160 KOPrefs::instance()->mWTshowDetails,
156 KOPrefs::instance()->mWTshowCreated, 161 KOPrefs::instance()->mWTshowCreated,
157 KOPrefs::instance()->mWTshowChanged); 162 KOPrefs::instance()->mWTshowChanged);
158} 163}
159void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 164void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
160{ 165{
161 //qDebug("KNoScrollListBox::keyPressEvent "); 166 //qDebug("KNoScrollListBox::keyPressEvent ");
162 switch(e->key()) { 167 switch(e->key()) {
163 case Key_Right: 168 case Key_Right:
164 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 169 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
165 { 170 {
166 e->ignore(); 171 e->ignore();
167 return; 172 return;
168 } 173 }
169 scrollBy(10,0); 174 scrollBy(10,0);
170 break; 175 break;
171 case Key_Left: 176 case Key_Left:
172 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 177 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
173 { 178 {
174 e->ignore(); 179 e->ignore();
175 return; 180 return;
176 } 181 }
177 scrollBy(-10,0); 182 scrollBy(-10,0);
178 break; 183 break;
179 case Key_Up: 184 case Key_Up:
180 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 185 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
181 e->ignore(); 186 e->ignore();
182 break; 187 break;
183 } 188 }
184 if ( count() ) { 189 if ( count() ) {
185 if ( currentItem() == 0 ) { 190 if ( currentItem() == 0 ) {
186 emit prevCell(); 191 emit prevCell();
187 } else { 192 } else {
188 setCurrentItem((currentItem()+count()-1)%count()); 193 setCurrentItem((currentItem()+count()-1)%count());
189 if(!itemVisible(currentItem())) { 194 if(!itemVisible(currentItem())) {
190 if((unsigned int) currentItem() == (count()-1)) { 195 if((unsigned int) currentItem() == (count()-1)) {
191 setTopItem(currentItem()-numItemsVisible()+1); 196 setTopItem(currentItem()-numItemsVisible()+1);
192 } else { 197 } else {
193 setTopItem(topItem()-1); 198 setTopItem(topItem()-1);
194 } 199 }
195 } 200 }
196 } 201 }
197 } 202 }
198 break; 203 break;
199 case Key_Down: 204 case Key_Down:
200 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 205 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
201 e->ignore(); 206 e->ignore();
202 break; 207 break;
203 } 208 }
204 if ( count () ) { 209 if ( count () ) {
205 if ( ((uint)currentItem()+1) == count () ) { 210 if ( ((uint)currentItem()+1) == count () ) {
206 emit nextCell(); 211 emit nextCell();
207 } else { 212 } else {
208 setCurrentItem((currentItem()+1)%count()); 213 setCurrentItem((currentItem()+1)%count());
209 if(!itemVisible(currentItem())) { 214 if(!itemVisible(currentItem())) {
@@ -1049,131 +1054,130 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
1049 mLabel->resize( mLabelSize ); 1054 mLabel->resize( mLabelSize );
1050 text = QString::number( mDate.day() ); 1055 text = QString::number( mDate.day() );
1051 } 1056 }
1052 mLabel->setText( text ); 1057 mLabel->setText( text );
1053 1058
1054 int size = height() - mLabel->height() - lineWidth()-1; 1059 int size = height() - mLabel->height() - lineWidth()-1;
1055 //qDebug("LW %d ", lineWidth()); 1060 //qDebug("LW %d ", lineWidth());
1056 if ( size > 0 ) 1061 if ( size > 0 )
1057 verticalScrollBar()->setMaximumHeight( size ); 1062 verticalScrollBar()->setMaximumHeight( size );
1058 size = width() - mLabel->width() -lineWidth()-1; 1063 size = width() - mLabel->width() -lineWidth()-1;
1059 if ( size > 0 ) 1064 if ( size > 0 )
1060 horizontalScrollBar()->setMaximumWidth( size ); 1065 horizontalScrollBar()->setMaximumWidth( size );
1061 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); 1066 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
1062 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 1067 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
1063 // mItemList->resize ( width(), height () ); 1068 // mItemList->resize ( width(), height () );
1064 if ( e ) 1069 if ( e )
1065 KNoScrollListBox::resizeEvent ( e ); 1070 KNoScrollListBox::resizeEvent ( e );
1066} 1071}
1067 1072
1068void MonthViewCell::defaultAction( QListBoxItem *item ) 1073void MonthViewCell::defaultAction( QListBoxItem *item )
1069{ 1074{
1070 1075
1071 if ( !item ) { 1076 if ( !item ) {
1072 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1077 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1073 emit newEventSignal( dt ); 1078 emit newEventSignal( dt );
1074 return; 1079 return;
1075 } 1080 }
1076 1081
1077 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1082 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1078 Incidence *incidence = eventItem->incidence(); 1083 Incidence *incidence = eventItem->incidence();
1079 if ( incidence ) mMonthView->defaultAction( incidence ); 1084 if ( incidence ) mMonthView->defaultAction( incidence );
1080} 1085}
1081void MonthViewCell::showDay() 1086void MonthViewCell::showDay()
1082{ 1087{
1083 emit showDaySignal( date() ); 1088 emit showDaySignal( date() );
1084} 1089}
1085void MonthViewCell::newEvent() 1090void MonthViewCell::newEvent()
1086{ 1091{
1087 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1092 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1088 emit newEventSignal( dt ); 1093 emit newEventSignal( dt );
1089} 1094}
1090void MonthViewCell::cellClicked( QListBoxItem *item ) 1095void MonthViewCell::cellClicked( QListBoxItem *item )
1091{ 1096{
1092 mMonthView->setSelectedCell( this ); 1097 mMonthView->setSelectedCell( this );
1093 if ( item == 0 ) { 1098 if ( item == 0 ) {
1094 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1099 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1095 emit newEventSignal( dt ); 1100 emit newEventSignal( dt );
1096 return; 1101 return;
1097 } 1102 }
1098 1103
1099} 1104}
1100 1105
1101void MonthViewCell::contextMenu( QListBoxItem *item ) 1106void MonthViewCell::contextMenu( QListBoxItem *item )
1102{ 1107{
1103 mMonthView->setPopupCell( this ); 1108 mMonthView->setPopupCell( this );
1104 if ( !item ) { 1109 if ( !item ) {
1105 mMonthView->showContextMenu( 0 ); 1110 mMonthView->showContextMenu( 0 );
1106 return; 1111 return;
1107 } 1112 }
1108 //selection( item ); 1113 //selection( item );
1109 //qApp->processEvents(); 1114 //qApp->processEvents();
1110 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1115 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1111 Incidence *incidence = eventItem->incidence(); 1116 Incidence *incidence = eventItem->incidence();
1112 if ( incidence ) { 1117 if ( incidence ) {
1118 mBlockDeselect = true;
1113 mMonthView->showContextMenu( incidence ); 1119 mMonthView->showContextMenu( incidence );
1114 selection( item );
1115 doHighLight( incidence );
1116 } 1120 }
1117} 1121}
1118 1122
1119void MonthViewCell::selection( QListBoxItem *item ) 1123void MonthViewCell::selection( QListBoxItem *item )
1120{ 1124{
1121 if ( !item ) { 1125 if ( !item ) {
1122 emit highlightIncidence( 0 , this, 0 ); 1126 emit highlightIncidence( 0 , this, 0 );
1123 return; 1127 return;
1124 } 1128 }
1125 MonthViewItem * it = (static_cast<MonthViewItem *>( item )); 1129 MonthViewItem * it = (static_cast<MonthViewItem *>( item ));
1126 emit highlightIncidence( it->incidence(), this, it->multiDay() ); 1130 emit highlightIncidence( it->incidence(), this, it->multiDay() );
1127 mMonthView->setSelectedCell( this ); 1131 mMonthView->setSelectedCell( this );
1128} 1132}
1129 1133
1130void MonthViewCell::deHighLight() 1134void MonthViewCell::deHighLight()
1131{ 1135{
1132 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 1136 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
1133 while ( mitem ) { 1137 while ( mitem ) {
1134 if ( mitem->setHighlightedFalse() ) 1138 if ( mitem->setHighlightedFalse() )
1135 updateItem ( mitem ); 1139 updateItem ( mitem );
1136 mitem = (MonthViewItem *)mitem->next(); 1140 mitem = (MonthViewItem *)mitem->next();
1137 } 1141 }
1138} 1142}
1139// returns true if no inc found 1143// returns true if no inc found
1140bool MonthViewCell::doHighLight( Incidence * inc ) 1144bool MonthViewCell::doHighLight( Incidence * inc )
1141{ 1145{
1142 1146
1143 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 1147 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
1144 while ( mitem ) { 1148 while ( mitem ) {
1145 if ( mitem->incidence() == inc ) { 1149 if ( mitem->incidence() == inc ) {
1146 if ( mitem->setHighlighted( inc ) ) 1150 if ( mitem->setHighlighted( inc ) )
1147 updateItem ( mitem ); 1151 updateItem ( mitem );
1148 return false; 1152 return false;
1149 } 1153 }
1150 mitem = (MonthViewItem *)mitem->next(); 1154 mitem = (MonthViewItem *)mitem->next();
1151 } 1155 }
1152 return true; 1156 return true;
1153} 1157}
1154// ******************************************************************************* 1158// *******************************************************************************
1155// ******************************************************************************* 1159// *******************************************************************************
1156// ******************************************************************************* 1160// *******************************************************************************
1157 1161
1158 1162
1159KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 1163KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1160 : KOEventView( calendar, parent, name ), 1164 : KOEventView( calendar, parent, name ),
1161 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 1165 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
1162 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 1166 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
1163{ 1167{
1164 mFlagKeyPressed = false; 1168 mFlagKeyPressed = false;
1165 mShortDayLabelsM = false; 1169 mShortDayLabelsM = false;
1166 mShortDayLabelsW = false; 1170 mShortDayLabelsW = false;
1167 skipResize = false; 1171 skipResize = false;
1168 clPending = true; 1172 clPending = true;
1169 mPopupCell = 0; 1173 mPopupCell = 0;
1170 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1174 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1171 mWidStack = new QWidgetStack( this ); 1175 mWidStack = new QWidgetStack( this );
1172 QVBoxLayout* hb = new QVBoxLayout( this ); 1176 QVBoxLayout* hb = new QVBoxLayout( this );
1173 mMonthView = new QWidget( mWidStack ); 1177 mMonthView = new QWidget( mWidStack );
1174 mWeekView = new QWidget( mWidStack ); 1178 mWeekView = new QWidget( mWidStack );
1175#if QT_VERSION >= 0x030000 1179#if QT_VERSION >= 0x030000
1176 mWidStack->addWidget(mMonthView ); 1180 mWidStack->addWidget(mMonthView );
1177 mWidStack->addWidget(mWeekView ); 1181 mWidStack->addWidget(mWeekView );
1178#else 1182#else
1179 mWidStack->addWidget( mMonthView, 1 ); 1183 mWidStack->addWidget( mMonthView, 1 );
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 61a141a..1a9d16d 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -26,129 +26,130 @@
26#include <qlistbox.h> 26#include <qlistbox.h>
27#include <qpoint.h> 27#include <qpoint.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qintdict.h> 31#include <qintdict.h>
32#include <qpushbutton.h> 32#include <qpushbutton.h>
33#include <qvaluelist.h> 33#include <qvaluelist.h>
34#include <qptrvector.h> 34#include <qptrvector.h>
35 35
36#include <libkcal/calendar.h> 36#include <libkcal/calendar.h>
37#include <libkcal/event.h> 37#include <libkcal/event.h>
38 38
39#include "koeventview.h" 39#include "koeventview.h"
40#include "navigatorbar.h" 40#include "navigatorbar.h"
41 41
42#ifdef DESKTOP_VERSION 42#ifdef DESKTOP_VERSION
43class QToolTipGroup; 43class QToolTipGroup;
44#endif 44#endif
45 45
46class KNOWhatsThis; 46class KNOWhatsThis;
47class MonthViewCell; 47class MonthViewCell;
48class KOWeekButton : public QPushButton 48class KOWeekButton : public QPushButton
49{ 49{
50 Q_OBJECT 50 Q_OBJECT
51 public: 51 public:
52 KOWeekButton( QWidget *parent=0, const char *name=0 ) : 52 KOWeekButton( QWidget *parent=0, const char *name=0 ) :
53 QPushButton( parent, name) 53 QPushButton( parent, name)
54 { 54 {
55 connect( this, SIGNAL( clicked() ), 55 connect( this, SIGNAL( clicked() ),
56 SLOT( bottonClicked() )); 56 SLOT( bottonClicked() ));
57 mNumber = -1; 57 mNumber = -1;
58 } 58 }
59 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} 59 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
60 int getWeekNum() { return mNumber;} 60 int getWeekNum() { return mNumber;}
61 signals: 61 signals:
62 void selectWeekNum ( int ); 62 void selectWeekNum ( int );
63private: 63private:
64 void focusInEvent ( QFocusEvent * ){;} 64 void focusInEvent ( QFocusEvent * ){;}
65 int mNumber; 65 int mNumber;
66 void keyPressEvent ( QKeyEvent * e ) 66 void keyPressEvent ( QKeyEvent * e )
67 { 67 {
68 e->ignore(); 68 e->ignore();
69 } 69 }
70 70
71private slots : 71private slots :
72 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 72 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
73}; 73};
74 74
75class KNoScrollListBox: public QListBox 75class KNoScrollListBox: public QListBox
76{ 76{
77 Q_OBJECT 77 Q_OBJECT
78 public: 78 public:
79 KNoScrollListBox(QWidget *parent=0, const char *name=0); 79 KNoScrollListBox(QWidget *parent=0, const char *name=0);
80 ~KNoScrollListBox(); 80 ~KNoScrollListBox();
81 QString getWhatsThisText(QPoint p) ; 81 QString getWhatsThisText(QPoint p) ;
82 82
83 signals: 83 signals:
84 void shiftDown(); 84 void shiftDown();
85 void shiftUp(); 85 void shiftUp();
86 void rightClick(); 86 void rightClick();
87 void nextCell(); 87 void nextCell();
88 void prevCell(); 88 void prevCell();
89 void highlightIncidence( Incidence * , MonthViewCell*, int ); 89 void highlightIncidence( Incidence * , MonthViewCell*, int );
90 90 protected:
91 bool mBlockDeselect;
91 protected slots: 92 protected slots:
92 void oneDown(); 93 void oneDown();
93 void keyPressEvent(QKeyEvent *); 94 void keyPressEvent(QKeyEvent *);
94 void keyReleaseEvent(QKeyEvent *); 95 void keyReleaseEvent(QKeyEvent *);
95 void mousePressEvent(QMouseEvent *); 96 void mousePressEvent(QMouseEvent *);
96 void focusInEvent ( QFocusEvent * ); 97 void focusInEvent ( QFocusEvent * );
97 void focusOutEvent ( QFocusEvent * ); 98 void focusOutEvent ( QFocusEvent * );
98 99
99 private: 100 private:
100 bool resetOnFocusIn; 101 bool resetOnFocusIn;
101 KNOWhatsThis * mWT; 102 KNOWhatsThis * mWT;
102}; 103};
103 104
104 105
105class MonthViewItem: public QListBoxItem 106class MonthViewItem: public QListBoxItem
106{ 107{
107 public: 108 public:
108 MonthViewItem( Incidence *,const QString & title ); 109 MonthViewItem( Incidence *,const QString & title );
109 void recycle( Incidence *incidence, const QString & s); 110 void recycle( Incidence *incidence, const QString & s);
110 void setRecur(bool on) { mRecur = on; } 111 void setRecur(bool on) { mRecur = on; }
111 void setAlarm(bool on) { mAlarm = on; } 112 void setAlarm(bool on) { mAlarm = on; }
112 void setReply(bool on) { mReply = on; } 113 void setReply(bool on) { mReply = on; }
113 void setMoreInfo(bool on) { mInfo = on; } 114 void setMoreInfo(bool on) { mInfo = on; }
114 void setMultiDay(int type) { mMultiday = type; } 115 void setMultiDay(int type) { mMultiday = type; }
115 int multiDay() { return mMultiday; } 116 int multiDay() { return mMultiday; }
116 void setMultiDayPos(int type) { mdayPos = type; } 117 void setMultiDayPos(int type) { mdayPos = type; }
117 int gettMultiDayPos() { return mdayPos; } 118 int gettMultiDayPos() { return mdayPos; }
118 void setBlockRepaint(bool on) { mblockRepaint = on; } 119 void setBlockRepaint(bool on) { mblockRepaint = on; }
119 bool setHighlighted( Incidence * ); 120 bool setHighlighted( Incidence * );
120 121
121 void setPalette(const QPalette &p) { mPalette = p; } 122 void setPalette(const QPalette &p) { mPalette = p; }
122 QPalette palette() const { return mPalette; } 123 QPalette palette() const { return mPalette; }
123 bool setHighlightedFalse(); 124 bool setHighlightedFalse();
124 Incidence *incidence() const { return mIncidence; } 125 Incidence *incidence() const { return mIncidence; }
125 126
126 protected: 127 protected:
127 virtual void paint(QPainter *); 128 virtual void paint(QPainter *);
128 virtual int height(const QListBox *) const; 129 virtual int height(const QListBox *) const;
129 virtual int width(const QListBox *) const; 130 virtual int width(const QListBox *) const;
130 131
131 private: 132 private:
132 int mdayPos; 133 int mdayPos;
133 bool isWeekItem; 134 bool isWeekItem;
134 bool mblockRepaint; 135 bool mblockRepaint;
135 int mMultiday; 136 int mMultiday;
136 bool mRecur; 137 bool mRecur;
137 bool mAlarm; 138 bool mAlarm;
138 bool mReply; 139 bool mReply;
139 bool mInfo; 140 bool mInfo;
140 bool mDisplayHighlighted; 141 bool mDisplayHighlighted;
141 142
142 QPalette mPalette; 143 QPalette mPalette;
143 QDate mDate; 144 QDate mDate;
144 145
145 Incidence *mIncidence; 146 Incidence *mIncidence;
146}; 147};
147 148
148 149
149class KOMonthView; 150class KOMonthView;
150 151
151class MonthViewCell : public KNoScrollListBox 152class MonthViewCell : public KNoScrollListBox
152{ 153{
153 Q_OBJECT 154 Q_OBJECT
154 public: 155 public: