summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-15 21:00:30 (UTC)
committer zautrix <zautrix>2005-06-15 21:00:30 (UTC)
commit4a9b5ad578e991f6216dc0556022a76223165f15 (patch) (unidiff)
tree41017358760a4db4b47e38a0364c219ed4760411
parente74483434835ad799b1a6880ae4576aacb14624a (diff)
downloadkdepimpi-4a9b5ad578e991f6216dc0556022a76223165f15.zip
kdepimpi-4a9b5ad578e991f6216dc0556022a76223165f15.tar.gz
kdepimpi-4a9b5ad578e991f6216dc0556022a76223165f15.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp15
-rw-r--r--korganizer/kotodoviewitem.cpp1
2 files changed, 6 insertions, 10 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 35c2a9f..b2ff33b 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -383,115 +383,110 @@ void KOQuickTodo::focusInEvent(QFocusEvent *ev)
383void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 383void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
384{ 384{
385 setText(i18n("Click to add a new Todo")); 385 setText(i18n("Click to add a new Todo"));
386 QLineEdit::focusOutEvent(ev); 386 QLineEdit::focusOutEvent(ev);
387} 387}
388 388
389///////////////////////////////////////////////////////////////////////////// 389/////////////////////////////////////////////////////////////////////////////
390 390
391KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 391KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
392 KOrg::BaseView(calendar,parent,name) 392 KOrg::BaseView(calendar,parent,name)
393{ 393{
394 mPendingUpdateBeforeRepaint = false; 394 mPendingUpdateBeforeRepaint = false;
395 isFlatDisplay = false; 395 isFlatDisplay = false;
396 mNavigator = 0; 396 mNavigator = 0;
397 QBoxLayout *topLayout = new QVBoxLayout(this); 397 QBoxLayout *topLayout = new QVBoxLayout(this);
398 mName = QString ( name ); 398 mName = QString ( name );
399 mBlockUpdate = false; 399 mBlockUpdate = false;
400 mQuickAdd = new KOQuickTodo(this); 400 mQuickAdd = new KOQuickTodo(this);
401 topLayout->addWidget(mQuickAdd); 401 topLayout->addWidget(mQuickAdd);
402 402
403 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 403 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
404 404
405 mTodoListView = new KOTodoListView(calendar,this, name ); 405 mTodoListView = new KOTodoListView(calendar,this, name );
406 topLayout->addWidget(mTodoListView); 406 topLayout->addWidget(mTodoListView);
407 //mTodoListView->header()->setMaximumHeight(30); 407 //mTodoListView->header()->setMaximumHeight(30);
408 mTodoListView->setRootIsDecorated(true); 408 mTodoListView->setRootIsDecorated(true);
409 mTodoListView->setAllColumnsShowFocus(true); 409 mTodoListView->setAllColumnsShowFocus(true);
410 410
411 mTodoListView->setShowSortIndicator(true); 411 mTodoListView->setShowSortIndicator(true);
412 412
413 mTodoListView->addColumn(i18n("Todo")); 413 mTodoListView->addColumn(i18n("Todo"));
414 mTodoListView->addColumn(i18n("Prio")); 414 mTodoListView->addColumn(i18n("Prio"));
415 mTodoListView->setColumnAlignment(1,AlignHCenter); 415 mTodoListView->setColumnAlignment(1,AlignHCenter);
416 mTodoListView->addColumn(i18n("Complete")); 416 mTodoListView->addColumn(i18n("Complete"));
417 mTodoListView->setColumnAlignment(2,AlignCenter); 417 mTodoListView->setColumnAlignment(2,AlignCenter);
418 418
419 mTodoListView->addColumn(i18n("Due Date")); 419 mTodoListView->addColumn(i18n("Due Date"));
420 mTodoListView->setColumnAlignment(3,AlignLeft); 420 mTodoListView->setColumnAlignment(3,AlignLeft);
421 mTodoListView->addColumn(i18n("Due Time")); 421 mTodoListView->addColumn(i18n("Due Time"));
422 mTodoListView->setColumnAlignment(4,AlignHCenter); 422 mTodoListView->setColumnAlignment(4,AlignHCenter);
423 423
424 mTodoListView->addColumn(i18n("Start Date")); 424 mTodoListView->addColumn(i18n("Start Date"));
425 mTodoListView->setColumnAlignment(5,AlignLeft); 425 mTodoListView->setColumnAlignment(5,AlignLeft);
426 mTodoListView->addColumn(i18n("Start Time")); 426 mTodoListView->addColumn(i18n("Start Time"));
427 mTodoListView->setColumnAlignment(6,AlignHCenter); 427 mTodoListView->setColumnAlignment(6,AlignHCenter);
428 428
429 mTodoListView->addColumn(i18n("Cancelled")); 429 mTodoListView->addColumn(i18n("Cancelled"));
430 mTodoListView->addColumn(i18n("Categories")); 430 mTodoListView->addColumn(i18n("Categories"));
431 mTodoListView->addColumn(i18n("Calendar"));
431#if 0 432#if 0
432 mTodoListView->addColumn(i18n("Sort Id")); 433 mTodoListView->addColumn(i18n("Sort Id"));
433 mTodoListView->setColumnAlignment(4,AlignHCenter); 434 mTodoListView->setColumnAlignment(4,AlignHCenter);
434#endif 435#endif
435 436
436 mTodoListView->setMinimumHeight( 60 ); 437 mTodoListView->setMinimumHeight( 60 );
437 mTodoListView->setItemsRenameable( true ); 438 mTodoListView->setItemsRenameable( true );
438 mTodoListView->setRenameable( 0 ); 439 mTodoListView->setRenameable( 0 );
439 mTodoListView->setColumnWidth( 0, 120 ); 440 mTodoListView->setColumnWidth( 0, 120 );
440 mTodoListView->setColumnWidthMode(0, QListView::Manual); 441 int iii = 0;
441 mTodoListView->setColumnWidthMode(1, QListView::Manual); 442 for ( iii = 0; iii< 10 ; ++iii )
442 mTodoListView->setColumnWidthMode(2, QListView::Manual); 443 mTodoListView->setColumnWidthMode( iii, QListView::Manual );
443 mTodoListView->setColumnWidthMode(3, QListView::Manual); 444
444 mTodoListView->setColumnWidthMode(4, QListView::Manual);
445 mTodoListView->setColumnWidthMode(5, QListView::Manual);
446 mTodoListView->setColumnWidthMode(6, QListView::Manual);
447 mTodoListView->setColumnWidthMode(7, QListView::Manual);
448 mTodoListView->setColumnWidthMode(8, QListView::Manual);
449
450 445
451 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); 446 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this);
452 447
453 mPriorityPopupMenu = new QPopupMenu(this); 448 mPriorityPopupMenu = new QPopupMenu(this);
454 for (int i = 1; i <= 5; i++) { 449 for (int i = 1; i <= 5; i++) {
455 QString label = QString ("%1").arg (i); 450 QString label = QString ("%1").arg (i);
456 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 451 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
457 } 452 }
458 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 453 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
459 454
460 mPercentageCompletedPopupMenu = new QPopupMenu(this); 455 mPercentageCompletedPopupMenu = new QPopupMenu(this);
461 for (int i = 0; i <= 100; i+=20) { 456 for (int i = 0; i <= 100; i+=20) {
462 QString label = QString ("%1 %").arg (i); 457 QString label = QString ("%1 %").arg (i);
463 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 458 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
464 } 459 }
465 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 460 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
466 461
467 462
468 463
469 mItemPopupMenu = new QPopupMenu(this); 464 mItemPopupMenu = new QPopupMenu(this);
470 mItemPopupMenu->insertItem(i18n("Show..."), this, 465 mItemPopupMenu->insertItem(i18n("Show..."), this,
471 SLOT (showTodo())); 466 SLOT (showTodo()));
472 mItemPopupMenu->insertItem(i18n("Edit..."), this, 467 mItemPopupMenu->insertItem(i18n("Edit..."), this,
473 SLOT (editTodo())); 468 SLOT (editTodo()));
474 mItemPopupMenu->insertItem( i18n("Delete"), this, 469 mItemPopupMenu->insertItem( i18n("Delete"), this,
475 SLOT (deleteTodo())); 470 SLOT (deleteTodo()));
476 mItemPopupMenu->insertItem( i18n("Clone..."), this, 471 mItemPopupMenu->insertItem( i18n("Clone..."), this,
477 SLOT (cloneTodo())); 472 SLOT (cloneTodo()));
478 mItemPopupMenu->insertItem( i18n("Move..."), this, 473 mItemPopupMenu->insertItem( i18n("Move..."), this,
479 SLOT (moveTodo())); 474 SLOT (moveTodo()));
480#ifndef DESKTOP_VERSION 475#ifndef DESKTOP_VERSION
481 mItemPopupMenu->insertItem( i18n("Beam..."), this, 476 mItemPopupMenu->insertItem( i18n("Beam..."), this,
482 SLOT (beamTodo())); 477 SLOT (beamTodo()));
483#endif 478#endif
484 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 479 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
485 SLOT (cancelTodo())); 480 SLOT (cancelTodo()));
486 mItemPopupMenu->insertSeparator(); 481 mItemPopupMenu->insertSeparator();
487 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, 482 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
488 SLOT (toggleRunningItem())); 483 SLOT (toggleRunningItem()));
489 mItemPopupMenu->insertSeparator(); 484 mItemPopupMenu->insertSeparator();
490 /* 485 /*
491 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 486 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
492 SLOT (newTodo())); 487 SLOT (newTodo()));
493 */ 488 */
494 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 489 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
495 SLOT (newSubTodo())); 490 SLOT (newSubTodo()));
496 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 491 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
497 SLOT (unparentTodo()),0,21); 492 SLOT (unparentTodo()),0,21);
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 748f3e4..f62aab8 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -110,96 +110,97 @@ void KOTodoViewItem::construct()
110 //setSortKey(4,keyt); 110 //setSortKey(4,keyt);
111 } 111 }
112 } else { 112 } else {
113 setText(3,""); 113 setText(3,"");
114 setText(4,""); 114 setText(4,"");
115 } 115 }
116 setSortKey(3,keyd); 116 setSortKey(3,keyd);
117 setSortKey(4,keyt); 117 setSortKey(4,keyt);
118 118
119 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); 119 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt);
120 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 120 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
121 121
122 122
123 123
124 keyd = ""; 124 keyd = "";
125 keyt = ""; 125 keyt = "";
126 126
127 if (mTodo->isRunning() ) { 127 if (mTodo->isRunning() ) {
128 QDate d = mTodo->runStart().date(); 128 QDate d = mTodo->runStart().date();
129 QTime t = mTodo->runStart().time(); 129 QTime t = mTodo->runStart().time();
130 skeyt.sprintf("%02d%02d",t.hour(),t.minute()); 130 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
131 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 131 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
132 keyd = KGlobal::locale()->formatDate( d , true); 132 keyd = KGlobal::locale()->formatDate( d , true);
133 keyt = KGlobal::locale()->formatTime( t ); 133 keyt = KGlobal::locale()->formatTime( t );
134 134
135 } else { 135 } else {
136 136
137 if (mTodo->hasStartDate()) { 137 if (mTodo->hasStartDate()) {
138 keyd = mTodo->dtStartDateStr(); 138 keyd = mTodo->dtStartDateStr();
139 QDate d = mTodo->dtStart().date(); 139 QDate d = mTodo->dtStart().date();
140 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 140 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
141 141
142 if ( !mTodo->doesFloat()) { 142 if ( !mTodo->doesFloat()) {
143 keyt = mTodo->dtStartTimeStr(); 143 keyt = mTodo->dtStartTimeStr();
144 QTime t = mTodo->dtStart().time(); 144 QTime t = mTodo->dtStart().time();
145 skeyt.sprintf("%02d%02d",t.hour(),t.minute()); 145 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
146 146
147 } 147 }
148 148
149 } 149 }
150 } 150 }
151 setText(5,keyd); 151 setText(5,keyd);
152 setText(6,keyt); 152 setText(6,keyt);
153 setSortKey(5,skeyd); 153 setSortKey(5,skeyd);
154 setSortKey(6,skeyt); 154 setSortKey(6,skeyt);
155 155
156 setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); 156 setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No"));
157 setText(8,mTodo->categoriesStr()); 157 setText(8,mTodo->categoriesStr());
158 setText(9,KOPrefs::instance()->calName( mTodo->calID()));
158 159
159#if 0 160#if 0
160 // Find sort id in description. It's the text behind the last '#' character 161 // Find sort id in description. It's the text behind the last '#' character
161 // found in the description. White spaces are removed from beginning and end 162 // found in the description. White spaces are removed from beginning and end
162 // of sort id. 163 // of sort id.
163 int pos = mTodo->description().findRev('#'); 164 int pos = mTodo->description().findRev('#');
164 if (pos < 0) { 165 if (pos < 0) {
165 setText(6,""); 166 setText(6,"");
166 } else { 167 } else {
167 QString str = mTodo->description().mid(pos+1); 168 QString str = mTodo->description().mid(pos+1);
168 str.stripWhiteSpace(); 169 str.stripWhiteSpace();
169 setText(6,str); 170 setText(6,str);
170 } 171 }
171#endif 172#endif
172 173
173 m_known = false; 174 m_known = false;
174 m_init = false; 175 m_init = false;
175 176
176 setMyPixmap(); 177 setMyPixmap();
177 178
178} 179}
179void KOTodoViewItem::setMyPixmap() 180void KOTodoViewItem::setMyPixmap()
180{ 181{
181 int size = 5; 182 int size = 5;
182 QPixmap pixi = QPixmap( 1, 1 ); 183 QPixmap pixi = QPixmap( 1, 1 );
183 // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { 184 // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) {
184// pixi = SmallIcon("redcross16"); 185// pixi = SmallIcon("redcross16");
185// } else { 186// } else {
186 QPainter p; 187 QPainter p;
187 188
188 int pixSize = 0; 189 int pixSize = 0;
189 QPixmap pPix = QPixmap( size, size ); 190 QPixmap pPix = QPixmap( size, size );
190 if ( mTodo->description().length() > 0 ) { 191 if ( mTodo->description().length() > 0 ) {
191 pixi.resize(size, pixSize+size); 192 pixi.resize(size, pixSize+size);
192 pPix.fill( Qt::darkGreen ); 193 pPix.fill( Qt::darkGreen );
193 p.begin( &pixi ); 194 p.begin( &pixi );
194 p. drawPixmap ( 0, pixSize, pPix); 195 p. drawPixmap ( 0, pixSize, pPix);
195 p.end(); 196 p.end();
196 pixSize += size; 197 pixSize += size;
197 } 198 }
198 if ( mTodo->isAlarmEnabled() && mTodo->alarmEnabled()) { 199 if ( mTodo->isAlarmEnabled() && mTodo->alarmEnabled()) {
199 pixi.resize(size, pixSize+size); 200 pixi.resize(size, pixSize+size);
200 pPix.fill( Qt::red ); 201 pPix.fill( Qt::red );
201 p.begin( &pixi ); 202 p.begin( &pixi );
202 p. drawPixmap ( 0, pixSize, pPix); 203 p. drawPixmap ( 0, pixSize, pPix);
203 p.end(); 204 p.end();
204 pixSize += size; 205 pixSize += size;
205 } 206 }