-rw-r--r-- | core/pim/datebook/datebookday.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index 0a40ea9..e212807 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -161,38 +161,47 @@ void DateBookDayView::keyPressEvent( QKeyEvent *e ) | |||
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 y=e->y(); | 177 | int sh=99,eh=-1; |
178 | int diff=y%(this->rowHeight(0)); | 178 | |
179 | int hour=y/this->rowHeight(0); | 179 | for(int i=0;i<this->numSelections();i++) { |
180 | quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(hour,0,0,0)),QDateTime(currDate,QTime(hour,59,0,0)),this->viewport(),"quickedit"); | 180 | QTableSelection sel = this->selection( i ); |
181 | sh = QMIN(sh,sel.topRow()); | ||
182 | eh = QMAX(sh,sel.bottomRow()+1); | ||
183 | } | ||
184 | if (sh > 23 || eh < 1) { | ||
185 | sh=8; | ||
186 | eh=9; | ||
187 | } | ||
188 | |||
189 | quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(sh,0,0,0)),QDateTime(currDate,QTime(eh,0,0,0)),this->viewport(),"quickedit"); | ||
181 | quickLineEdit->setGeometry(0,0,this->columnWidth(0)-1,this->rowHeight(0)); | 190 | quickLineEdit->setGeometry(0,0,this->columnWidth(0)-1,this->rowHeight(0)); |
182 | this->moveChild(quickLineEdit,0,y-diff); | 191 | this->moveChild(quickLineEdit,0,sh*this->rowHeight(0)); |
183 | quickLineEdit->setFocus(); | 192 | quickLineEdit->setFocus(); |
184 | quickLineEdit->show(); | 193 | quickLineEdit->show(); |
185 | } | 194 | } |
186 | 195 | ||
187 | //=========================================================================== | 196 | //=========================================================================== |
188 | 197 | ||
189 | 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=0) : QLineEdit(parent,name) |
190 | { | 199 | { |
191 | active=1; | 200 | active=1; |
192 | quickEvent.setStart(start); | 201 | quickEvent.setStart(start); |
193 | quickEvent.setEnd(end); | 202 | quickEvent.setEnd(end); |
194 | connect(this,SIGNAL(returnPressed()),this,SLOT(slotReturnPressed())); | 203 | connect(this,SIGNAL(returnPressed()),this,SLOT(slotReturnPressed())); |
195 | } | 204 | } |
196 | 205 | ||
197 | void DateBookDayViewQuickLineEdit::slotReturnPressed() | 206 | void DateBookDayViewQuickLineEdit::slotReturnPressed() |
198 | { | 207 | { |