summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-29 00:10:48 (UTC)
committer zautrix <zautrix>2005-03-29 00:10:48 (UTC)
commita5d52c19d2cd9b008e5cf41d5c7d2c193df7ee46 (patch) (unidiff)
treeb9f1b2710da1cd0105382831ac0a3e3d7d44f09c
parent4e7c45695672ecdbd0cd14cac0ea29a8e134ee78 (diff)
downloadkdepimpi-a5d52c19d2cd9b008e5cf41d5c7d2c193df7ee46.zip
kdepimpi-a5d52c19d2cd9b008e5cf41d5c7d2c193df7ee46.tar.gz
kdepimpi-a5d52c19d2cd9b008e5cf41d5c7d2c193df7ee46.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp42
1 files changed, 24 insertions, 18 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index d825493..940d288 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -63,172 +63,178 @@ class 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 mWT = new KNOWhatsThis(this); 85 mWT = new KNOWhatsThis(this);
86} 86}
87KNoScrollListBox::~KNoScrollListBox() 87KNoScrollListBox::~KNoScrollListBox()
88{ 88{
89 89
90} 90}
91QString KNoScrollListBox::getWhatsThisText(QPoint p) 91QString KNoScrollListBox::getWhatsThisText(QPoint p)
92{ 92{
93 QListBoxItem* item = itemAt ( p ); 93 QListBoxItem* item = itemAt ( p );
94 if ( ! item ) { 94 if ( ! item ) {
95 return i18n("Click in the cell\nto add an event!"); 95 return i18n("Click in the cell\nto add an event!");
96 } 96 }
97 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), 97 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(),
98 KOPrefs::instance()->mWTshowDetails, 98 KOPrefs::instance()->mWTshowDetails,
99 KOPrefs::instance()->mWTshowCreated, 99 KOPrefs::instance()->mWTshowCreated,
100 KOPrefs::instance()->mWTshowChanged); 100 KOPrefs::instance()->mWTshowChanged);
101} 101}
102void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 102void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
103{ 103{
104 104
105 switch(e->key()) { 105 switch(e->key()) {
106 case Key_Right: 106 case Key_Right:
107 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 107 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
108 { 108 {
109 e->ignore(); 109 e->ignore();
110 return; 110 return;
111 } 111 }
112 scrollBy(10,0); 112 scrollBy(10,0);
113 break; 113 break;
114 case Key_Left: 114 case Key_Left:
115 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 115 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
116 { 116 {
117 e->ignore(); 117 e->ignore();
118 return; 118 return;
119 } 119 }
120 scrollBy(-10,0); 120 scrollBy(-10,0);
121 break; 121 break;
122 case Key_Up: 122 case Key_Up:
123 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 123 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
124 e->ignore(); 124 e->ignore();
125 break; 125 break;
126 } 126 }
127 setCurrentItem((currentItem()+count()-1)%count()); 127 if ( count() ) {
128 if(!itemVisible(currentItem())) { 128 setCurrentItem((currentItem()+count()-1)%count());
129 if((unsigned int) currentItem() == (count()-1)) { 129 if(!itemVisible(currentItem())) {
130 setTopItem(currentItem()-numItemsVisible()+1); 130 if((unsigned int) currentItem() == (count()-1)) {
131 } else { 131 setTopItem(currentItem()-numItemsVisible()+1);
132 setTopItem(topItem()-1); 132 } else {
133 setTopItem(topItem()-1);
134 }
133 } 135 }
134 } 136 }
135 break; 137 break;
136 case Key_Down: 138 case Key_Down:
137 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 139 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
138 e->ignore(); 140 e->ignore();
139 break; 141 break;
140 } 142 }
141 setCurrentItem((currentItem()+1)%count()); 143 if ( count () ) {
142 if(!itemVisible(currentItem())) { 144 setCurrentItem((currentItem()+1)%count());
143 if(currentItem() == 0) { 145 if(!itemVisible(currentItem())) {
144 setTopItem(0); 146 if(currentItem() == 0) {
145 } else { 147 setTopItem(0);
146 setTopItem(topItem()+1); 148 } else {
149 setTopItem(topItem()+1);
150 }
147 } 151 }
148 } 152 }
149 break; 153 break;
150 case Key_I: 154 case Key_I:
151 QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); 155 QTimer::singleShot( 11, this, SLOT ( oneDown() ) );
152 e->ignore(); 156 e->ignore();
153 break; 157 break;
154 case Key_Shift: 158 case Key_Shift:
155 emit shiftDown(); 159 emit shiftDown();
156 break; 160 break;
157 default: 161 default:
158 e->ignore(); 162 e->ignore();
159 break; 163 break;
160 } 164 }
161} 165}
162 166
163void KNoScrollListBox::oneDown() 167void KNoScrollListBox::oneDown()
164{ 168{
165 setCurrentItem((currentItem()+1)%count()); 169 if ( count () ) {
166 if(!itemVisible(currentItem())) { 170 setCurrentItem((currentItem()+1)%count());
167 if(currentItem() == 0) { 171 if(!itemVisible(currentItem())) {
168 setTopItem(0); 172 if(currentItem() == 0) {
169 } else { 173 setTopItem(0);
170 setTopItem(topItem()+1); 174 } else {
175 setTopItem(topItem()+1);
176 }
171 } 177 }
172 } 178 }
173} 179}
174void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 180void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
175{ 181{
176 switch(e->key()) { 182 switch(e->key()) {
177 case Key_Shift: 183 case Key_Shift:
178 emit shiftUp(); 184 emit shiftUp();
179 break; 185 break;
180 default: 186 default:
181 break; 187 break;
182 } 188 }
183} 189}
184 190
185void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 191void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
186{ 192{
187 QListBox::mousePressEvent(e); 193 QListBox::mousePressEvent(e);
188 194
189 if(e->button() == RightButton) { 195 if(e->button() == RightButton) {
190 emit rightClick(); 196 emit rightClick();
191 } 197 }
192} 198}
193 199
194MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 200MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
195 : QListBoxItem() 201 : QListBoxItem()
196{ 202{
197 mblockRepaint = true; 203 mblockRepaint = true;
198 setText( s ); 204 setText( s );
199 mMultiday = 0; 205 mMultiday = 0;
200 mIncidence = incidence; 206 mIncidence = incidence;
201 mDate = qd; 207 mDate = qd;
202 mRecur = false; 208 mRecur = false;
203 mAlarm = false; 209 mAlarm = false;
204 mReply = false; 210 mReply = false;
205 mInfo = false; 211 mInfo = false;
206 //qDebug("NEWWWWWWWWWWWWW "); 212 //qDebug("NEWWWWWWWWWWWWW ");
207} 213}
208void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) 214void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s)
209{ 215{
210 setText( s ); 216 setText( s );
211 mMultiday = 0; 217 mMultiday = 0;
212 mIncidence = incidence; 218 mIncidence = incidence;
213 mDate = qd; 219 mDate = qd;
214 mRecur = false; 220 mRecur = false;
215 mAlarm = false; 221 mAlarm = false;
216 mReply = false; 222 mReply = false;
217 mInfo = false; 223 mInfo = false;
218 //qDebug("recucleeeeeeeeeeeeeeeee "); 224 //qDebug("recucleeeeeeeeeeeeeeeee ");
219} 225}
220 226
221void MonthViewItem::paint(QPainter *p) 227void MonthViewItem::paint(QPainter *p)
222{ 228{
223 if ( mblockRepaint ) { 229 if ( mblockRepaint ) {
224 //qDebug("block "); 230 //qDebug("block ");
225 return; 231 return;
226 } 232 }
227 //qDebug("NON block "); 233 //qDebug("NON block ");
228#if QT_VERSION >= 0x030000 234#if QT_VERSION >= 0x030000
229 bool sel = isSelected(); 235 bool sel = isSelected();
230#else 236#else
231 bool sel = selected(); 237 bool sel = selected();
232#endif 238#endif
233 239
234 240