summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-17 13:46:35 (UTC)
committer simon <simon>2002-12-17 13:46:35 (UTC)
commit65c1d23402f8df58524a8e182b00745cf9a4c3af (patch) (unidiff)
treec0e6d7f7abaaf09254eda212091a04243d115a6e
parent1e0289c2367b411fe9c4c34aff11988dc77c0f54 (diff)
downloadopie-65c1d23402f8df58524a8e182b00745cf9a4c3af.zip
opie-65c1d23402f8df58524a8e182b00745cf9a4c3af.tar.gz
opie-65c1d23402f8df58524a8e182b00745cf9a4c3af.tar.bz2
- word puzzle fix by Carsten
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/tableitems.cpp2
-rw-r--r--core/pim/todo/tableview.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/core/pim/todo/tableitems.cpp b/core/pim/todo/tableitems.cpp
index 86fe07d..a636de6 100644
--- a/core/pim/todo/tableitems.cpp
+++ b/core/pim/todo/tableitems.cpp
@@ -94,88 +94,88 @@ void ComboItem::setContentFromEditor( QWidget* w) {
94 QTableItem::setContentFromEditor( w ); 94 QTableItem::setContentFromEditor( w );
95 95
96 ev.setPriority( text().toInt() ); 96 ev.setPriority( text().toInt() );
97 //view->updateFromTable( ev ); 97 //view->updateFromTable( ev );
98} 98}
99void ComboItem::setText( const QString& s ) { 99void ComboItem::setText( const QString& s ) {
100 if ( m_cb ) 100 if ( m_cb )
101 m_cb->setCurrentItem( s.toInt()-1 ); 101 m_cb->setCurrentItem( s.toInt()-1 );
102 102
103 QTableItem::setText( s ); 103 QTableItem::setText( s );
104} 104}
105QString ComboItem::text()const { 105QString ComboItem::text()const {
106 if ( m_cb) 106 if ( m_cb)
107 return m_cb->currentText(); 107 return m_cb->currentText();
108 108
109 return QTableItem::text(); 109 return QTableItem::text();
110} 110}
111 111
112/* TodoTextItem */ 112/* TodoTextItem */
113TodoTextItem::~TodoTextItem() { 113TodoTextItem::~TodoTextItem() {
114 114
115} 115}
116TodoTextItem::TodoTextItem( QTable* t, 116TodoTextItem::TodoTextItem( QTable* t,
117 const QString& string ) 117 const QString& string )
118 : QTableItem( t, QTableItem::Never, string ) 118 : QTableItem( t, QTableItem::Never, string )
119{} 119{}
120 120
121/* DueTextItem */ 121/* DueTextItem */
122DueTextItem::DueTextItem( QTable* t, const OTodo& ev) 122DueTextItem::DueTextItem( QTable* t, const OTodo& ev)
123 : QTableItem(t, Never, QString::null ) 123 : QTableItem(t, Never, QString::null )
124{ 124{
125 setToDoEvent( ev ); 125 setToDoEvent( ev );
126} 126}
127DueTextItem::~DueTextItem() { 127DueTextItem::~DueTextItem() {
128 128
129} 129}
130QString DueTextItem::key() const { 130QString DueTextItem::key() const {
131 QString key; 131 QString key;
132 132
133 if( m_hasDate ){ 133 if( m_hasDate ){
134 if(m_off == 0 ){ 134 if(m_off == 0 ){
135 key.append("b"); 135 key.append("b");
136 }else if( m_off > 0 ){ 136 }else if( m_off > 0 ){
137 key.append("c"); 137 key.append("c");
138 }else if( m_off < 0 ){ 138 }else if( m_off < 0 ){
139 key.append("a"); 139 key.append("a");
140 } 140 }
141 key.append(QString::number(m_off ) ); 141 key.append(QString::number(m_off ) );
142 }else{ 142 }else{
143 key.append("d"); 143 key.append("d");
144 } 144 }
145 return key; 145 return key;
146} 146}
147void DueTextItem::setCompleted( bool comp ) { 147void DueTextItem::setCompleted( bool comp ) {
148 m_completed = comp; 148 m_completed = comp;
149 table()->updateCell( row(), col() ); 149 table()->updateCell( row(), col() );
150} 150}
151void DueTextItem::setToDoEvent( const OTodo& ev ) { 151void DueTextItem::setToDoEvent( const OTodo& ev ) {
152 m_hasDate = ev.hasDueDate(); 152 m_hasDate = ev.hasDueDate();
153 m_completed = ev.isCompleted(); 153 m_completed = ev.isCompleted();
154 154
155 if( ev.hasDueDate() ){ 155 if( ev.hasDueDate() ){
156 QDate today = QDate::currentDate(); 156 QDate today = QDate::currentDate();
157 m_off = today.daysTo(ev.dueDate() ); 157 m_off = today.daysTo(ev.dueDate() );
158 setText( QString::number(m_off) + " day(s) " ); 158 setText( tr( "%1 day(s)" ).arg( QString::number(m_off) ) );
159 }else{ 159 }else{
160 setText("n.d." ); 160 setText("n.d." );
161 m_off = 0; 161 m_off = 0;
162 } 162 }
163} 163}
164void DueTextItem::paint( QPainter* p, const QColorGroup &cg, 164void DueTextItem::paint( QPainter* p, const QColorGroup &cg,
165 const QRect& cr, bool selected ) { 165 const QRect& cr, bool selected ) {
166 QColorGroup cg2(cg); 166 QColorGroup cg2(cg);
167 167
168 QColor text = cg.text(); 168 QColor text = cg.text();
169 if( m_hasDate && !m_completed ){ 169 if( m_hasDate && !m_completed ){
170 if( m_off < 0 ){ 170 if( m_off < 0 ){
171 cg2.setColor(QColorGroup::Text, QColor(red ) ); 171 cg2.setColor(QColorGroup::Text, QColor(red ) );
172 }else if( m_off == 0 ){ 172 }else if( m_off == 0 ){
173 cg2.setColor(QColorGroup::Text, QColor(yellow) ); // orange isn't predefined 173 cg2.setColor(QColorGroup::Text, QColor(yellow) ); // orange isn't predefined
174 }else if( m_off > 0){ 174 }else if( m_off > 0){
175 cg2.setColor(QColorGroup::Text, QColor(green ) ); 175 cg2.setColor(QColorGroup::Text, QColor(green ) );
176 } 176 }
177 } 177 }
178 QTableItem::paint(p, cg2, cr, selected ); 178 QTableItem::paint(p, cg2, cr, selected );
179 /* restore default color */ 179 /* restore default color */
180 cg2.setColor(QColorGroup::Text, text ); 180 cg2.setColor(QColorGroup::Text, text );
181} 181}
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index 2434150..f59971e 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -318,129 +318,129 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool
318 318
319 QPen op = p->pen(); 319 QPen op = p->pen();
320 p->setPen(cg.mid()); 320 p->setPen(cg.mid());
321 p->drawLine( 0, cr.height() - 1, cr.width() - 1, cr.height() - 1 ); 321 p->drawLine( 0, cr.height() - 1, cr.width() - 1, cr.height() - 1 );
322 p->drawLine( cr.width() - 1, 0, cr.width() - 1, cr.height() - 1 ); 322 p->drawLine( cr.width() - 1, 0, cr.width() - 1, cr.height() - 1 );
323 p->setPen(op); 323 p->setPen(op);
324 324
325 QFont f = p->font(); 325 QFont f = p->font();
326 QFontMetrics fm(f); 326 QFontMetrics fm(f);
327 327
328 switch(col) { 328 switch(col) {
329 case 0: 329 case 0:
330 { 330 {
331 // completed field 331 // completed field
332 int marg = ( cr.width() - BoxSize ) / 2; 332 int marg = ( cr.width() - BoxSize ) / 2;
333 int x = 0; 333 int x = 0;
334 int y = ( cr.height() - BoxSize ) / 2; 334 int y = ( cr.height() - BoxSize ) / 2;
335 p->setPen( QPen( cg.text() ) ); 335 p->setPen( QPen( cg.text() ) );
336 p->drawRect( x + marg, y, BoxSize, BoxSize ); 336 p->drawRect( x + marg, y, BoxSize, BoxSize );
337 p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 ); 337 p->drawRect( x + marg+1, y+1, BoxSize-2, BoxSize-2 );
338 p->setPen( darkGreen ); 338 p->setPen( darkGreen );
339 x += 1; 339 x += 1;
340 y += 1; 340 y += 1;
341 if ( task.isCompleted() ) { 341 if ( task.isCompleted() ) {
342 QPointArray a( 9*2 ); 342 QPointArray a( 9*2 );
343 int i, xx, yy; 343 int i, xx, yy;
344 xx = x+2+marg; 344 xx = x+2+marg;
345 yy = y+4; 345 yy = y+4;
346 for ( i=0; i<4; i++ ) { 346 for ( i=0; i<4; i++ ) {
347 a.setPoint( 2*i, xx, yy ); 347 a.setPoint( 2*i, xx, yy );
348 a.setPoint( 2*i+1, xx, yy+2 ); 348 a.setPoint( 2*i+1, xx, yy+2 );
349 xx++; yy++; 349 xx++; yy++;
350 } 350 }
351 yy -= 2; 351 yy -= 2;
352 for ( i=4; i<9; i++ ) { 352 for ( i=4; i<9; i++ ) {
353 a.setPoint( 2*i, xx, yy ); 353 a.setPoint( 2*i, xx, yy );
354 a.setPoint( 2*i+1, xx, yy+2 ); 354 a.setPoint( 2*i+1, xx, yy+2 );
355 xx++; yy--; 355 xx++; yy--;
356 } 356 }
357 p->drawLineSegments( a ); 357 p->drawLineSegments( a );
358 } 358 }
359 } 359 }
360 break; 360 break;
361 case 1: 361 case 1:
362 // priority field 362 // priority field
363 { 363 {
364 QString text = QString::number(task.priority()); 364 QString text = QString::number(task.priority());
365 p->drawText(2,2 + fm.ascent(), text); 365 p->drawText(2,2 + fm.ascent(), text);
366 } 366 }
367 break; 367 break;
368 case 2: 368 case 2:
369 // description field 369 // description field
370 { 370 {
371 QString text = task.summary().isEmpty() ? 371 QString text = task.summary().isEmpty() ?
372 task.description().left(20) : 372 task.description().left(20) :
373 task.summary(); 373 task.summary();
374 p->drawText(2,2 + fm.ascent(), text); 374 p->drawText(2,2 + fm.ascent(), text);
375 } 375 }
376 break; 376 break;
377 case 3: 377 case 3:
378 { 378 {
379 QString text; 379 QString text;
380 if (task.hasDueDate()) { 380 if (task.hasDueDate()) {
381 int off = QDate::currentDate().daysTo( task.dueDate() ); 381 int off = QDate::currentDate().daysTo( task.dueDate() );
382 text = QString::number(off) + tr(" day(s)"); 382 text = tr( "%1 day(s)").arg(QString::number(off));
383 /* 383 /*
384 * set color if not completed 384 * set color if not completed
385 */ 385 */
386 if (!task.isCompleted() ) { 386 if (!task.isCompleted() ) {
387 QColor color = Qt::black; 387 QColor color = Qt::black;
388 if ( off < 0 ) 388 if ( off < 0 )
389 color = Qt::red; 389 color = Qt::red;
390 else if ( off == 0 ) 390 else if ( off == 0 )
391 color = Qt::yellow; 391 color = Qt::yellow;
392 else if ( off > 0 ) 392 else if ( off > 0 )
393 color = Qt::green; 393 color = Qt::green;
394 p->setPen(color ); 394 p->setPen(color );
395 } 395 }
396 } else { 396 } else {
397 text = tr("None"); 397 text = tr("None");
398 } 398 }
399 p->drawText(2,2 + fm.ascent(), text); 399 p->drawText(2,2 + fm.ascent(), text);
400 } 400 }
401 break; 401 break;
402 } 402 }
403 p->restore(); 403 p->restore();
404} 404}
405QWidget* TableView::createEditor(int row, int col, bool )const { 405QWidget* TableView::createEditor(int row, int col, bool )const {
406 switch( col ) { 406 switch( col ) {
407 case 1: { 407 case 1: {
408 /* the priority stuff */ 408 /* the priority stuff */
409 QComboBox* combo = new QComboBox( viewport() ); 409 QComboBox* combo = new QComboBox( viewport() );
410 combo->insertItem( "1" ); 410 combo->insertItem( "1" );
411 combo->insertItem( "2" ); 411 combo->insertItem( "2" );
412 combo->insertItem( "3" ); 412 combo->insertItem( "3" );
413 combo->insertItem( "4" ); 413 combo->insertItem( "4" );
414 combo->insertItem( "5" ); 414 combo->insertItem( "5" );
415 combo->setCurrentItem( sorted()[row].priority()-1 ); 415 combo->setCurrentItem( sorted()[row].priority()-1 );
416 return combo; 416 return combo;
417 } 417 }
418 /* summary */ 418 /* summary */
419 case 2:{ 419 case 2:{
420 QLineEdit* edit = new QLineEdit( viewport() ); 420 QLineEdit* edit = new QLineEdit( viewport() );
421 edit->setText( sorted()[row].summary() ); 421 edit->setText( sorted()[row].summary() );
422 return edit; 422 return edit;
423 } 423 }
424 case 0: 424 case 0:
425 default: 425 default:
426 return 0l; 426 return 0l;
427 } 427 }
428} 428}
429void TableView::setCellContentFromEditor(int row, int col ) { 429void TableView::setCellContentFromEditor(int row, int col ) {
430 if ( col == 1 ) { 430 if ( col == 1 ) {
431 QWidget* wid = cellWidget(row, 1 ); 431 QWidget* wid = cellWidget(row, 1 );
432 if ( wid->inherits("QComboBox") ) { 432 if ( wid->inherits("QComboBox") ) {
433 int pri = ((QComboBox*)wid)->currentItem() + 1; 433 int pri = ((QComboBox*)wid)->currentItem() + 1;
434 OTodo todo = sorted()[row]; 434 OTodo todo = sorted()[row];
435 if ( todo.priority() != pri ) { 435 if ( todo.priority() != pri ) {
436 todo.setPriority( pri ); 436 todo.setPriority( pri );
437 TodoView::update( todo.uid(), todo ); 437 TodoView::update( todo.uid(), todo );
438 updateView(); 438 updateView();
439 } 439 }
440 } 440 }
441 }else if ( col == 2) { 441 }else if ( col == 2) {
442 QWidget* wid = cellWidget(row, 2); 442 QWidget* wid = cellWidget(row, 2);
443 if ( wid->inherits("QLineEdit") ) { 443 if ( wid->inherits("QLineEdit") ) {
444 QString text = ((QLineEdit*)wid)->text(); 444 QString text = ((QLineEdit*)wid)->text();
445 OTodo todo = sorted()[row]; 445 OTodo todo = sorted()[row];
446 if ( todo.summary() != text ) { 446 if ( todo.summary() != text ) {