author | waspe <waspe> | 2003-11-04 16:37:14 (UTC) |
---|---|---|
committer | waspe <waspe> | 2003-11-04 16:37:14 (UTC) |
commit | efcd8d6a743261194b55df3afeec956fde9886d4 (patch) (unidiff) | |
tree | 7bf7232a92c40c8236813fc06aac18b4f8d16d1d | |
parent | d2c52ff34d0ef37d055f74bb9fd957c6ffc583a9 (diff) | |
download | opie-efcd8d6a743261194b55df3afeec956fde9886d4.zip opie-efcd8d6a743261194b55df3afeec956fde9886d4.tar.gz opie-efcd8d6a743261194b55df3afeec956fde9886d4.tar.bz2 |
remove merge conflict
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index f4008e9..4d64099 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -1,318 +1,318 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qmessagebox.h> | ||
21 | 20 | ||
22 | #include "datebookday.h" | 21 | #include "datebookday.h" |
23 | #include "datebookdayheaderimpl.h" | 22 | #include "datebookdayheaderimpl.h" |
24 | #include "datebookdayallday.h" | 23 | #include "datebookdayallday.h" |
25 | 24 | ||
26 | #include <qpe/datebookdb.h> | ||
27 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
28 | #include <qpe/event.h> | ||
29 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/timestring.h> | ||
31 | #include <qpe/qpedebug.h> | ||
32 | #include <qpe/ir.h> | 27 | #include <qpe/ir.h> |
33 | 28 | ||
34 | #include <qheader.h> | ||
35 | #include <qdatetime.h> | ||
36 | #include <qpainter.h> | ||
37 | #include <qsimplerichtext.h> | 29 | #include <qsimplerichtext.h> |
38 | #include <qpopupmenu.h> | 30 | #include <qpopupmenu.h> |
39 | #include <qtextcodec.h> | ||
40 | #include <qpalette.h> | ||
41 | 31 | ||
42 | #include <qlineedit.h> | ||
43 | 32 | ||
44 | #include <qtimer.h> | 33 | #include <qtimer.h> |
45 | 34 | ||
46 | DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, const char *name ) | 35 | DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, const char *name ) |
47 | : QTable( 24, 1, parent, name ), ampm( whichClock ), currDate( QDate::currentDate() ) | 36 | : QTable( 24, 1, parent, name ), ampm( whichClock ), currDate( QDate::currentDate() ) |
48 | { | 37 | { |
49 | enableClipper(TRUE); | 38 | enableClipper(TRUE); |
50 | setTopMargin( 0 ); | 39 | setTopMargin( 0 ); |
51 | horizontalHeader()->hide(); | 40 | horizontalHeader()->hide(); |
52 | setLeftMargin(38); | 41 | setLeftMargin(38); |
53 | setColumnStretchable( 0, TRUE ); | 42 | setColumnStretchable( 0, TRUE ); |
54 | setHScrollBarMode( QScrollView::AlwaysOff ); | 43 | setHScrollBarMode( QScrollView::AlwaysOff ); |
55 | verticalHeader()->setPalette(white); | 44 | verticalHeader()->setPalette(white); |
56 | verticalHeader()->setResizeEnabled(FALSE); | 45 | verticalHeader()->setResizeEnabled(FALSE); |
57 | setSelectionMode( Single ); | 46 | setSelectionMode( Single ); |
58 | 47 | ||
59 | // get rid of being able to edit things... | 48 | // get rid of being able to edit things... |
60 | QTableItem *tmp; | 49 | QTableItem *tmp; |
61 | int row; | 50 | int row; |
62 | for ( row = 0; row < numRows(); row++ ) { | 51 | for ( row = 0; row < numRows(); row++ ) { |
63 | tmp = new QTableItem( this, QTableItem::Never, QString::null); | 52 | tmp = new QTableItem( this, QTableItem::Never, QString::null); |
64 | setItem( row, 0, tmp ); | 53 | setItem( row, 0, tmp ); |
65 | //setRowHeight( row, 40); | 54 | //setRowHeight( row, 40); |
66 | } | 55 | } |
67 | 56 | ||
68 | initHeader(); | 57 | initHeader(); |
69 | QObject::connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotChangeClock(bool)) ); | 58 | QObject::connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotChangeClock(bool)) ); |
70 | } | 59 | } |
71 | 60 | ||
72 | void DateBookDayView::initHeader() | 61 | void DateBookDayView::initHeader() |
73 | { | 62 | { |
74 | QString strTmp; | 63 | QString strTmp; |
64 | int preferredWidth = 0; | ||
75 | for ( int i = 0; i < 24; ++i ) { | 65 | for ( int i = 0; i < 24; ++i ) { |
76 | if ( ampm ) { | 66 | if ( ampm ) { |
77 | if ( i == 0 ) | 67 | if ( i == 0 ) |
78 | strTmp = QString::number(12) + ":00"; | 68 | strTmp = QString::number(12) + ":00"; |
79 | else if ( i == 12 ) | 69 | else if ( i == 12 ) |
80 | strTmp = QString::number(12) + tr(":00p"); | 70 | strTmp = QString::number(12) + tr(":00p"); |
81 | else if ( i > 12 ) | 71 | else if ( i > 12 ) |
82 | strTmp = QString::number( i - 12 ) + tr(":00p"); | 72 | strTmp = QString::number( i - 12 ) + tr(":00p"); |
83 | else | 73 | else |
84 | strTmp = QString::number(i) + ":00"; | 74 | strTmp = QString::number(i) + ":00"; |
85 | } else { | 75 | } else { |
86 | if ( i < 10 ) | 76 | if ( i < 10 ) |
87 | strTmp = "0" + QString::number(i) + ":00"; | 77 | strTmp = "0" + QString::number(i) + ":00"; |
88 | else | 78 | else |
89 | strTmp = QString::number(i) + ":00"; | 79 | strTmp = QString::number(i) + ":00"; |
90 | } | 80 | } |
91 | strTmp = strTmp.rightJustify( 6, ' ' ); | 81 | strTmp = strTmp.rightJustify( 6, ' ' ); |
92 | verticalHeader()->setLabel( i, strTmp ); | 82 | verticalHeader()->setLabel( i, strTmp ); |
83 | |||
84 | // Compute correct width for current Font (Add some space right) | ||
85 | int actWidth = QFontMetrics( QFont::defaultFont() ).width( strTmp + QString(" ") ); | ||
86 | if ( preferredWidth < actWidth ) | ||
87 | preferredWidth = actWidth; | ||
93 | setRowStretchable( i, FALSE ); | 88 | setRowStretchable( i, FALSE ); |
94 | } | 89 | } |
90 | |||
91 | // It seems as if the header has a bug. It does not resize | ||
92 | // correct horizontally if it is used vertical.. | ||
93 | // Thus, we do it manually.. | ||
94 | setLeftMargin( preferredWidth ); | ||
95 | } | 95 | } |
96 | 96 | ||
97 | void DateBookDayView::slotDateChanged( int y, int m, int d ) | 97 | void DateBookDayView::slotDateChanged( int y, int m, int d ) |
98 | { | 98 | { |
99 | currDate.setYMD(y,m,d); | 99 | currDate.setYMD(y,m,d); |
100 | } | 100 | } |
101 | 101 | ||
102 | void DateBookDayView::slotChangeClock( bool newClock ) | 102 | void DateBookDayView::slotChangeClock( bool newClock ) |
103 | { | 103 | { |
104 | ampm = newClock; | 104 | ampm = newClock; |
105 | initHeader(); | 105 | initHeader(); |
106 | } | 106 | } |
107 | 107 | ||
108 | bool DateBookDayView::whichClock() const | 108 | bool DateBookDayView::whichClock() const |
109 | { | 109 | { |
110 | return ampm; | 110 | return ampm; |
111 | } | 111 | } |
112 | 112 | ||
113 | void DateBookDayView::moveUp() | 113 | void DateBookDayView::moveUp() |
114 | { | 114 | { |
115 | scrollBy(0, -20); | 115 | scrollBy(0, -20); |
116 | } | 116 | } |
117 | 117 | ||
118 | void DateBookDayView::moveDown() | 118 | void DateBookDayView::moveDown() |
119 | { | 119 | { |
120 | scrollBy(0, 20); | 120 | scrollBy(0, 20); |
121 | } | 121 | } |
122 | 122 | ||
123 | void DateBookDayView::paintCell( QPainter *p, int, int, const QRect &cr, bool ) | 123 | void DateBookDayView::paintCell( QPainter *p, int, int, const QRect &cr, bool ) |
124 | { | 124 | { |
125 | int w = cr.width(); | 125 | int w = cr.width(); |
126 | int h = cr.height(); | 126 | int h = cr.height(); |
127 | p->fillRect( 0, 0, w, h, colorGroup().brush( QColorGroup::Base ) ); | 127 | p->fillRect( 0, 0, w, h, colorGroup().brush( QColorGroup::Base ) ); |
128 | if ( showGrid() ) { | 128 | if ( showGrid() ) { |
129 | // Draw our lines | 129 | // Draw our lines |
130 | int x2 = w - 1; | 130 | int x2 = w - 1; |
131 | int y2 = h - 1; | 131 | int y2 = h - 1; |
132 | QPen pen( p->pen() ); | 132 | QPen pen( p->pen() ); |
133 | p->setPen( colorGroup().dark() ); | 133 | p->setPen( colorGroup().dark() ); |
134 | p->drawLine( x2, 0, x2, y2 ); | 134 | p->drawLine( x2, 0, x2, y2 ); |
135 | p->drawLine( 0, y2, x2, y2 ); | 135 | p->drawLine( 0, y2, x2, y2 ); |
136 | 136 | ||
137 | p->setPen( colorGroup().midlight() ); | 137 | p->setPen( colorGroup().midlight() ); |
138 | p->drawLine( 0, y2 - h/2, x2, y2 - h/2); | 138 | p->drawLine( 0, y2 - h/2, x2, y2 - h/2); |
139 | 139 | ||
140 | p->setPen( pen ); | 140 | p->setPen( pen ); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | void DateBookDayView::paintFocus( QPainter *, const QRect & ) | 144 | void DateBookDayView::paintFocus( QPainter *, const QRect & ) |
145 | { | 145 | { |
146 | } | 146 | } |
147 | 147 | ||
148 | void DateBookDayView::resizeEvent( QResizeEvent *e ) | 148 | void DateBookDayView::resizeEvent( QResizeEvent *e ) |
149 | { | 149 | { |
150 | QTable::resizeEvent( e ); | 150 | QTable::resizeEvent( e ); |
151 | columnWidthChanged( 0 ); | 151 | columnWidthChanged( 0 ); |
152 | emit sigColWidthChanged(); | 152 | emit sigColWidthChanged(); |
153 | } | 153 | } |
154 | 154 | ||
155 | void DateBookDayView::keyPressEvent( QKeyEvent *e ) | 155 | void DateBookDayView::keyPressEvent( QKeyEvent *e ) |
156 | { | 156 | { |
157 | QString txt = e->text(); | 157 | QString txt = e->text(); |
158 | if ( !txt.isNull() && txt[0] > ' ' && e->key() < 0x1000 ) { | 158 | if ( !txt.isNull() && txt[0] > ' ' && e->key() < 0x1000 ) { |
159 | // we this is some sort of thing we know about... | 159 | // we this is some sort of thing we know about... |
160 | e->accept(); | 160 | e->accept(); |
161 | emit sigCapturedKey( txt ); | 161 | emit sigCapturedKey( txt ); |
162 | } else { | 162 | } else { |
163 | // I don't know what this key is, do you? | 163 | // I don't know what this key is, do you? |
164 | e->ignore(); | 164 | e->ignore(); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | ||
168 | void DateBookDayView::setRowStyle( int style ) | 168 | void DateBookDayView::setRowStyle( int style ) |
169 | { | 169 | { |
170 | if (style<0) style = 0; | 170 | if (style<0) style = 0; |
171 | 171 | ||
172 | for (int i=0; i<numRows(); i++) | 172 | for (int i=0; i<numRows(); i++) |
173 | setRowHeight(i, style*10+20); | 173 | setRowHeight(i, style*10+20); |
174 | } | 174 | } |
175 | 175 | ||
176 | void DateBookDayView::contentsMouseReleaseEvent( QMouseEvent *e ) | 176 | void DateBookDayView::contentsMouseReleaseEvent( QMouseEvent* /* e */ ) |
177 | { | 177 | { |
178 | int sh=99,eh=-1; | 178 | int sh=99,eh=-1; |
179 | 179 | ||
180 | for(int i=0;i<this->numSelections();i++) { | 180 | for(int i=0;i<this->numSelections();i++) { |
181 | QTableSelection sel = this->selection( i ); | 181 | QTableSelection sel = this->selection( i ); |
182 | sh = QMIN(sh,sel.topRow()); | 182 | sh = QMIN(sh,sel.topRow()); |
183 | eh = QMAX(sh,sel.bottomRow()+1); | 183 | eh = QMAX(sh,sel.bottomRow()+1); |
184 | } | 184 | } |
185 | if (sh > 23 || eh < 1) { | 185 | if (sh > 23 || eh < 1) { |
186 | sh=8; | 186 | sh=8; |
187 | eh=9; | 187 | eh=9; |
188 | } | 188 | } |
189 | 189 | ||
190 | quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(sh,0,0,0)),QDateTime(currDate,QTime(eh,0,0,0)),this->viewport(),"quickedit"); | 190 | quickLineEdit=new DateBookDayViewQuickLineEdit(QDateTime(currDate,QTime(sh,0,0,0)),QDateTime(currDate,QTime(eh,0,0,0)),this->viewport(),"quickedit"); |
191 | quickLineEdit->setGeometry(0,0,this->columnWidth(0)-1,this->rowHeight(0)); | 191 | quickLineEdit->setGeometry(0,0,this->columnWidth(0)-1,this->rowHeight(0)); |
192 | this->moveChild(quickLineEdit,0,sh*this->rowHeight(0)); | 192 | this->moveChild(quickLineEdit,0,sh*this->rowHeight(0)); |
193 | quickLineEdit->setFocus(); | 193 | quickLineEdit->setFocus(); |
194 | quickLineEdit->show(); | 194 | quickLineEdit->show(); |
195 | } | 195 | } |
196 | 196 | ||
197 | //=========================================================================== | 197 | //=========================================================================== |
198 | 198 | ||
199 | DateBookDayViewQuickLineEdit::DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name) : QLineEdit(parent,name) | 199 | DateBookDayViewQuickLineEdit::DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name) : QLineEdit(parent,name) |
200 | { | 200 | { |
201 | active=1; | 201 | active=1; |
202 | quickEvent.setStart(start); | 202 | quickEvent.setStart(start); |
203 | quickEvent.setEnd(end); | 203 | quickEvent.setEnd(end); |
204 | connect(this,SIGNAL(returnPressed()),this,SLOT(slotReturnPressed())); | 204 | connect(this,SIGNAL(returnPressed()),this,SLOT(slotReturnPressed())); |
205 | } | 205 | } |
206 | 206 | ||
207 | void DateBookDayViewQuickLineEdit::slotReturnPressed() | 207 | void DateBookDayViewQuickLineEdit::slotReturnPressed() |
208 | { | 208 | { |
209 | if(active && (!this->text().isEmpty())) {// Fix to avoid having this event beeing added multiple times. | 209 | if(active && (!this->text().isEmpty())) {// Fix to avoid having this event beeing added multiple times. |
210 | quickEvent.setDescription(this->text()); | 210 | quickEvent.setDescription(this->text()); |
211 | connect(this,SIGNAL(insertEvent(const Event &)),this->topLevelWidget(),SLOT(insertEvent(const Event &))); | 211 | connect(this,SIGNAL(insertEvent(const Event &)),this->topLevelWidget(),SLOT(insertEvent(const Event &))); |
212 | emit(insertEvent(quickEvent)); | 212 | emit(insertEvent(quickEvent)); |
213 | active=0; | 213 | active=0; |
214 | } | 214 | } |
215 | /* we need to return to this object.. */ | 215 | /* we need to return to this object.. */ |
216 | QTimer::singleShot(500, this, SLOT(finallyCallClose()) );// Close and also delete this widget | 216 | QTimer::singleShot(500, this, SLOT(finallyCallClose()) );// Close and also delete this widget |
217 | } | 217 | } |
218 | void DateBookDayViewQuickLineEdit::finallyCallClose() { | 218 | void DateBookDayViewQuickLineEdit::finallyCallClose() { |
219 | close(true); // also deletes this widget... | 219 | close(true); // also deletes this widget... |
220 | } | 220 | } |
221 | 221 | ||
222 | void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent * e ) | 222 | void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */) |
223 | { | 223 | { |
224 | slotReturnPressed(); // Reuse code to add event and close this widget. | 224 | slotReturnPressed(); // Reuse code to add event and close this widget. |
225 | } | 225 | } |
226 | 226 | ||
227 | //=========================================================================== | 227 | //=========================================================================== |
228 | 228 | ||
229 | DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWidget *parent, const char *name ) | 229 | DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWidget *parent, const char *name ) |
230 | : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 ) | 230 | : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 ) |
231 | { | 231 | { |
232 | widgetList.setAutoDelete( true ); | 232 | widgetList.setAutoDelete( true ); |
233 | header = new DateBookDayHeader( startOnMonday, this, "day header" ); | 233 | header = new DateBookDayHeader( startOnMonday, this, "day header" ); |
234 | header->setDate( currDate.year(), currDate.month(), currDate.day() ); | 234 | header->setDate( currDate.year(), currDate.month(), currDate.day() ); |
235 | 235 | ||
236 | m_allDays = new DatebookdayAllday(newDb, this, "all day event list" ); | 236 | m_allDays = new DatebookdayAllday(newDb, this, "all day event list" ); |
237 | m_allDays->hide(); | 237 | m_allDays->hide(); |
238 | 238 | ||
239 | view = new DateBookDayView( ampm, this, "day view" ); | 239 | view = new DateBookDayView( ampm, this, "day view" ); |
240 | 240 | ||
241 | connect( header, SIGNAL( dateChanged( int, int, int ) ), this, SLOT( dateChanged( int, int, int ) ) ); | 241 | connect( header, SIGNAL( dateChanged( int, int, int ) ), this, SLOT( dateChanged( int, int, int ) ) ); |
242 | connect( header, SIGNAL( dateChanged( int, int, int ) ), view, SLOT( slotDateChanged( int, int, int ) ) ); | 242 | connect( header, SIGNAL( dateChanged( int, int, int ) ), view, SLOT( slotDateChanged( int, int, int ) ) ); |
243 | connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) ); | 243 | connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) ); |
244 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); | 244 | connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); |
245 | connect( view, SIGNAL(sigCapturedKey(const QString &)), this, SIGNAL(sigNewEvent(const QString&)) ); | 245 | connect( view, SIGNAL(sigCapturedKey(const QString &)), this, SIGNAL(sigNewEvent(const QString&)) ); |
246 | 246 | ||
247 | QTimer *timer = new QTimer( this ); | 247 | QTimer *timer = new QTimer( this ); |
248 | 248 | ||
249 | connect( timer, SIGNAL(timeout()), this, SLOT(updateView()) );//connect timer for updating timeMarker & daywidgetcolors | 249 | connect( timer, SIGNAL(timeout()), this, SLOT(updateView()) );//connect timer for updating timeMarker & daywidgetcolors |
250 | timer->start( 1000*60*5, FALSE ); //update every 5min | 250 | timer->start( 1000*60*5, FALSE ); //update every 5min |
251 | 251 | ||
252 | selectedWidget = 0; | 252 | selectedWidget = 0; |
253 | 253 | ||
254 | timeMarker = new DateBookDayTimeMarker( this ); | 254 | timeMarker = new DateBookDayTimeMarker( this ); |
255 | timeMarker->setTime( QTime::currentTime() ); | 255 | timeMarker->setTime( QTime::currentTime() ); |
256 | rowStyle = -1; // initialize with bogus values | 256 | rowStyle = -1; // initialize with bogus values |
257 | jumpToCurTime = false; | 257 | jumpToCurTime = false; |
258 | } | 258 | } |
259 | 259 | ||
260 | void DateBookDay::setJumpToCurTime( bool bJump ) | 260 | void DateBookDay::setJumpToCurTime( bool bJump ) |
261 | { | 261 | { |
262 | jumpToCurTime = bJump; | 262 | jumpToCurTime = bJump; |
263 | } | 263 | } |
264 | 264 | ||
265 | void DateBookDay::setRowStyle( int style ) | 265 | void DateBookDay::setRowStyle( int style ) |
266 | { | 266 | { |
267 | if (rowStyle != style) view->setRowStyle( style ); | 267 | if (rowStyle != style) view->setRowStyle( style ); |
268 | rowStyle = style; | 268 | rowStyle = style; |
269 | } | 269 | } |
270 | 270 | ||
271 | void DateBookDay::updateView( void ) | 271 | void DateBookDay::updateView( void ) |
272 | { | 272 | { |
273 | timeMarker->setTime( QTime::currentTime() ); | 273 | timeMarker->setTime( QTime::currentTime() ); |
274 | //need to find a way to update all DateBookDayWidgets | 274 | //need to find a way to update all DateBookDayWidgets |
275 | } | 275 | } |
276 | 276 | ||
277 | void DateBookDay::setSelectedWidget( DateBookDayWidget *w ) | 277 | void DateBookDay::setSelectedWidget( DateBookDayWidget *w ) |
278 | { | 278 | { |
279 | selectedWidget = w; | 279 | selectedWidget = w; |
280 | } | 280 | } |
281 | 281 | ||
282 | DateBookDayWidget * DateBookDay::getSelectedWidget( void ) | 282 | DateBookDayWidget * DateBookDay::getSelectedWidget( void ) |
283 | { | 283 | { |
284 | return selectedWidget; | 284 | return selectedWidget; |
285 | } | 285 | } |
286 | 286 | ||
287 | void DateBookDay::selectedDates( QDateTime &start, QDateTime &end ) | 287 | void DateBookDay::selectedDates( QDateTime &start, QDateTime &end ) |
288 | { | 288 | { |
289 | start.setDate( currDate ); | 289 | start.setDate( currDate ); |
290 | end.setDate( currDate ); | 290 | end.setDate( currDate ); |
291 | 291 | ||
292 | int sh=99,eh=-1; | 292 | int sh=99,eh=-1; |
293 | 293 | ||
294 | int n = dayView()->numSelections(); | 294 | int n = dayView()->numSelections(); |
295 | 295 | ||
296 | for (int i=0; i<n; i++) { | 296 | for (int i=0; i<n; i++) { |
297 | QTableSelection sel = dayView()->selection( i ); | 297 | QTableSelection sel = dayView()->selection( i ); |
298 | sh = QMIN(sh,sel.topRow()); | 298 | sh = QMIN(sh,sel.topRow()); |
299 | eh = QMAX(sh,sel.bottomRow()+1); | 299 | eh = QMAX(sh,sel.bottomRow()+1); |
300 | } | 300 | } |
301 | 301 | ||
302 | if (sh > 23 || eh < 1) { | 302 | if (sh > 23 || eh < 1) { |
303 | sh=8; | 303 | sh=8; |
304 | eh=9; | 304 | eh=9; |
305 | } | 305 | } |
306 | 306 | ||
307 | start.setTime( QTime( sh, 0, 0 ) ); | 307 | start.setTime( QTime( sh, 0, 0 ) ); |
308 | end.setTime( QTime( eh, 0, 0 ) ); | 308 | end.setTime( QTime( eh, 0, 0 ) ); |
309 | } | 309 | } |
310 | 310 | ||
311 | void DateBookDay::setDate( int y, int m, int d ) | 311 | void DateBookDay::setDate( int y, int m, int d ) |
312 | { | 312 | { |
313 | header->setDate( y, m, d ); | 313 | header->setDate( y, m, d ); |
314 | selectedWidget = 0; | 314 | selectedWidget = 0; |
315 | } | 315 | } |
316 | 316 | ||
317 | void DateBookDay::setDate( QDate d) | 317 | void DateBookDay::setDate( QDate d) |
318 | { | 318 | { |