-rw-r--r-- | core/pim/datebook/datebookday.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index e212807..8232a51 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -150,97 +150,97 @@ void DateBookDayView::resizeEvent( QResizeEvent *e ) | |||
150 | columnWidthChanged( 0 ); | 150 | columnWidthChanged( 0 ); |
151 | emit sigColWidthChanged(); | 151 | emit sigColWidthChanged(); |
152 | } | 152 | } |
153 | 153 | ||
154 | void DateBookDayView::keyPressEvent( QKeyEvent *e ) | 154 | void DateBookDayView::keyPressEvent( QKeyEvent *e ) |
155 | { | 155 | { |
156 | QString txt = e->text(); | 156 | QString txt = e->text(); |
157 | if ( !txt.isNull() && txt[0] > ' ' && e->key() < 0x1000 ) { | 157 | if ( !txt.isNull() && txt[0] > ' ' && e->key() < 0x1000 ) { |
158 | // we this is some sort of thing we know about... | 158 | // we this is some sort of thing we know about... |
159 | e->accept(); | 159 | e->accept(); |
160 | emit sigCapturedKey( txt ); | 160 | emit sigCapturedKey( txt ); |
161 | } else { | 161 | } else { |
162 | // I don't know what this key is, do you? | 162 | // I don't know what this key is, do you? |
163 | e->ignore(); | 163 | e->ignore(); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | void DateBookDayView::setRowStyle( int style ) | 167 | void DateBookDayView::setRowStyle( int style ) |
168 | { | 168 | { |
169 | if (style<0) style = 0; | 169 | if (style<0) style = 0; |
170 | 170 | ||
171 | for (int i=0; i<numRows(); i++) | 171 | for (int i=0; i<numRows(); i++) |
172 | setRowHeight(i, style*10+20); | 172 | setRowHeight(i, style*10+20); |
173 | } | 173 | } |
174 | 174 | ||
175 | void DateBookDayView::contentsMouseReleaseEvent( QMouseEvent *e ) | 175 | void DateBookDayView::contentsMouseReleaseEvent( QMouseEvent *e ) |
176 | { | 176 | { |
177 | int sh=99,eh=-1; | 177 | int sh=99,eh=-1; |
178 | 178 | ||
179 | for(int i=0;i<this->numSelections();i++) { | 179 | for(int i=0;i<this->numSelections();i++) { |
180 | QTableSelection sel = this->selection( i ); | 180 | QTableSelection sel = this->selection( i ); |
181 | sh = QMIN(sh,sel.topRow()); | 181 | sh = QMIN(sh,sel.topRow()); |
182 | eh = QMAX(sh,sel.bottomRow()+1); | 182 | eh = QMAX(sh,sel.bottomRow()+1); |
183 | } | 183 | } |
184 | if (sh > 23 || eh < 1) { | 184 | if (sh > 23 || eh < 1) { |
185 | sh=8; | 185 | sh=8; |
186 | eh=9; | 186 | eh=9; |
187 | } | 187 | } |
188 | 188 | ||
189 | quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(sh,0,0,0)),QDateTime(currDate,QTime(eh,0,0,0)),this->viewport(),"quickedit"); | 189 | quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(sh,0,0,0)),QDateTime(currDate,QTime(eh,0,0,0)),this->viewport(),"quickedit"); |
190 | quickLineEdit->setGeometry(0,0,this->columnWidth(0)-1,this->rowHeight(0)); | 190 | quickLineEdit->setGeometry(0,0,this->columnWidth(0)-1,this->rowHeight(0)); |
191 | this->moveChild(quickLineEdit,0,sh*this->rowHeight(0)); | 191 | this->moveChild(quickLineEdit,0,sh*this->rowHeight(0)); |
192 | quickLineEdit->setFocus(); | 192 | quickLineEdit->setFocus(); |
193 | quickLineEdit->show(); | 193 | quickLineEdit->show(); |
194 | } | 194 | } |
195 | 195 | ||
196 | //=========================================================================== | 196 | //=========================================================================== |
197 | 197 | ||
198 | DateBookDayViewQuickLineEdit::DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name=0) : QLineEdit(parent,name) | 198 | DateBookDayViewQuickLineEdit::DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name) : QLineEdit(parent,name) |
199 | { | 199 | { |
200 | active=1; | 200 | active=1; |
201 | quickEvent.setStart(start); | 201 | quickEvent.setStart(start); |
202 | quickEvent.setEnd(end); | 202 | quickEvent.setEnd(end); |
203 | connect(this,SIGNAL(returnPressed()),this,SLOT(slotReturnPressed())); | 203 | connect(this,SIGNAL(returnPressed()),this,SLOT(slotReturnPressed())); |
204 | } | 204 | } |
205 | 205 | ||
206 | void DateBookDayViewQuickLineEdit::slotReturnPressed() | 206 | void DateBookDayViewQuickLineEdit::slotReturnPressed() |
207 | { | 207 | { |
208 | if(active && (!this->text().isEmpty())) {// Fix to avoid having this event beeing added multiple times. | 208 | if(active && (!this->text().isEmpty())) {// Fix to avoid having this event beeing added multiple times. |
209 | quickEvent.setDescription(this->text()); | 209 | quickEvent.setDescription(this->text()); |
210 | connect(this,SIGNAL(insertEvent(const Event &)),this->topLevelWidget(),SLOT(insertEvent(const Event &))); | 210 | connect(this,SIGNAL(insertEvent(const Event &)),this->topLevelWidget(),SLOT(insertEvent(const Event &))); |
211 | emit(insertEvent(quickEvent)); | 211 | emit(insertEvent(quickEvent)); |
212 | active=0; | 212 | active=0; |
213 | } | 213 | } |
214 | this->close(true);// Close and also delete this widget | 214 | this->close(true);// Close and also delete this widget |
215 | } | 215 | } |
216 | 216 | ||
217 | void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent * e ) | 217 | void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent * e ) |
218 | { | 218 | { |
219 | slotReturnPressed(); // Reuse code to add event and close this widget. | 219 | slotReturnPressed(); // Reuse code to add event and close this widget. |
220 | } | 220 | } |
221 | 221 | ||
222 | //=========================================================================== | 222 | //=========================================================================== |
223 | 223 | ||
224 | DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWidget *parent, const char *name ) | 224 | DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWidget *parent, const char *name ) |
225 | : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 ) | 225 | : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 ) |
226 | { | 226 | { |
227 | widgetList.setAutoDelete( true ); | 227 | widgetList.setAutoDelete( true ); |
228 | header = new DateBookDayHeader( startOnMonday, this, "day header" ); | 228 | header = new DateBookDayHeader( startOnMonday, this, "day header" ); |
229 | header->setDate( currDate.year(), currDate.month(), currDate.day() ); | 229 | header->setDate( currDate.year(), currDate.month(), currDate.day() ); |
230 | view = new DateBookDayView( ampm, this, "day view" ); | 230 | view = new DateBookDayView( ampm, this, "day view" ); |
231 | 231 | ||
232 | connect( header, SIGNAL( dateChanged( int, int, int ) ), this, SLOT( dateChanged( int, int, int ) ) ); | 232 | connect( header, SIGNAL( dateChanged( int, int, int ) ), this, SLOT( dateChanged( int, int, int ) ) ); |
233 | connect( header, SIGNAL( dateChanged( int, int, int ) ), view, SLOT( slotDateChanged( int, int, int ) ) ); | 233 | connect( header, SIGNAL( dateChanged( int, int, int ) ), view, SLOT( slotDateChanged( int, int, int ) ) ); |
234 | connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) ); | 234 | connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) ); |
235 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); | 235 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); |
236 | connect( view, SIGNAL(sigCapturedKey(const QString &)), this, SIGNAL(sigNewEvent(const QString&)) ); | 236 | connect( view, SIGNAL(sigCapturedKey(const QString &)), this, SIGNAL(sigNewEvent(const QString&)) ); |
237 | 237 | ||
238 | QTimer *timer = new QTimer( this ); | 238 | QTimer *timer = new QTimer( this ); |
239 | 239 | ||
240 | connect( timer, SIGNAL(timeout()), this, SLOT(updateView()) );//connect timer for updating timeMarker & daywidgetcolors | 240 | connect( timer, SIGNAL(timeout()), this, SLOT(updateView()) );//connect timer for updating timeMarker & daywidgetcolors |
241 | timer->start( 1000*60*5, FALSE ); //update every 5min | 241 | timer->start( 1000*60*5, FALSE ); //update every 5min |
242 | 242 | ||
243 | selectedWidget = 0; | 243 | selectedWidget = 0; |
244 | 244 | ||
245 | timeMarker = new DateBookDayTimeMarker( this ); | 245 | timeMarker = new DateBookDayTimeMarker( this ); |
246 | timeMarker->setTime( QTime::currentTime() ); | 246 | timeMarker->setTime( QTime::currentTime() ); |