summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebookday.cpp19
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
@@ -173,14 +173,23 @@ void DateBookDayView::setRowStyle( int style )
}
void DateBookDayView::contentsMouseReleaseEvent( QMouseEvent *e )
{
- int y=e->y();
- int diff=y%(this->rowHeight(0));
- int hour=y/this->rowHeight(0);
- quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(hour,0,0,0)),QDateTime(currDate,QTime(hour,59,0,0)),this->viewport(),"quickedit");
+ int sh=99,eh=-1;
+
+ for(int i=0;i<this->numSelections();i++) {
+ QTableSelection sel = this->selection( i );
+ sh = QMIN(sh,sel.topRow());
+ eh = QMAX(sh,sel.bottomRow()+1);
+ }
+ if (sh > 23 || eh < 1) {
+ sh=8;
+ eh=9;
+ }
+
+ quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(sh,0,0,0)),QDateTime(currDate,QTime(eh,0,0,0)),this->viewport(),"quickedit");
quickLineEdit->setGeometry(0,0,this->columnWidth(0)-1,this->rowHeight(0));
- this->moveChild(quickLineEdit,0,y-diff);
+ this->moveChild(quickLineEdit,0,sh*this->rowHeight(0));
quickLineEdit->setFocus();
quickLineEdit->show();
}