summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-10 10:40:57 (UTC)
committer zautrix <zautrix>2005-03-10 10:40:57 (UTC)
commitb96161e4dd7fc19eea87257c2455b85420dad35a (patch) (unidiff)
treed2e518cdc4c6c314f6e42960d12653ad6c7083d3
parent4b05d69b961309df5d56714889c62ca530580914 (diff)
downloadkdepimpi-b96161e4dd7fc19eea87257c2455b85420dad35a.zip
kdepimpi-b96161e4dd7fc19eea87257c2455b85420dad35a.tar.gz
kdepimpi-b96161e4dd7fc19eea87257c2455b85420dad35a.tar.bz2
todo month view fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt2
-rw-r--r--korganizer/komonthview.cpp32
-rw-r--r--korganizer/komonthview.h5
3 files changed, 35 insertions, 4 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index d4b7971..95a1866 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -9,16 +9,18 @@ Added keyboard shorcuts for
9- add new item ( i + n key) 9- add new item ( i + n key)
10Fixed length of info in the title. 10Fixed length of info in the title.
11 11
12KO/Pi-KA/Pi: 12KO/Pi-KA/Pi:
13Changed "ME" menu bar entry to an icon. 13Changed "ME" menu bar entry to an icon.
14 14
15KO/Pi: 15KO/Pi:
16Fixed two minor bugs in displaying todos. 16Fixed two minor bugs in displaying todos.
17If in month view a cell is selected, the key shortcut "d" shows now that date.
18Added complete info for a todo in month view as an icon left of the text.
17 19
18 20
19********** VERSION 2.0.14 ************ 21********** VERSION 2.0.14 ************
20 22
21Made Passwordmanager PwM/Pi more userfriendly: 23Made Passwordmanager PwM/Pi more userfriendly:
22Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. 24Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more.
23Fixed bug in KO/Pi todo printing. 25Fixed bug in KO/Pi todo printing.
24Made Qtopia calendar import possible on desktop . 26Made Qtopia calendar import possible on desktop .
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index f983ff9..4bf9dea 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -272,16 +272,32 @@ void MonthViewItem::paint(QPainter *p)
272 if ( mMultiday == 3 ) { 272 if ( mMultiday == 3 ) {
273 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 273 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
274 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); 274 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
275 275
276 } 276 }
277 x += sizeM/2 + 1; 277 x += sizeM/2 + 1;
278 x += sizeM + 1; 278 x += sizeM + 1;
279 } 279 }
280
281 if ( mIncidence->type() == "Todo" ){
282 Todo* td = ( Todo* ) mIncidence;
283 if ( td->isCompleted() ) {
284 int half = size/2;
285 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
286 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
287 x += half+half + 4;
288
289 } else {
290 int val = td->percentComplete()/20;
291 p->fillRect ( x+1, y-1, val ,size+2,Qt::black );
292 p->drawRect ( x, y-1,7,size+2);
293 x += size + 3;
294 }
295 }
280 QFontMetrics fm = p->fontMetrics(); 296 QFontMetrics fm = p->fontMetrics();
281 int yPos; 297 int yPos;
282 int pmheight = size; 298 int pmheight = size;
283 if( pmheight < fm.height() ) 299 if( pmheight < fm.height() )
284 yPos = fm.ascent() + fm.leading()/2; 300 yPos = fm.ascent() + fm.leading()/2;
285 else 301 else
286 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 302 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
287 p->setPen( palette().color( QPalette::Normal, sel ? \ 303 p->setPen( palette().color( QPalette::Normal, sel ? \
@@ -597,17 +613,17 @@ void MonthViewCell::insertTodo(Todo *todo)
597 mItemList->setFocusPolicy(WheelFocus); 613 mItemList->setFocusPolicy(WheelFocus);
598 QString text; 614 QString text;
599 if (todo->hasDueDate()) { 615 if (todo->hasDueDate()) {
600 if (!todo->doesFloat()) { 616 if (!todo->doesFloat()) {
601 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 617 text += KGlobal::locale()->formatTime(todo->dtDue().time());
602 text += " "; 618 text += " ";
603 } 619 }
604 } 620 }
605 text += i18n("T: %1").arg(todo->summary()); 621 text += todo->summary();
606 622
607 MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 623 MonthViewItem *item = new MonthViewItem( todo, mDate, text );
608 //item->setPalette( mStandardPalette ); 624 //item->setPalette( mStandardPalette );
609 QPalette pal; 625 QPalette pal;
610 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 626 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
611 QStringList categories = todo->categories(); 627 QStringList categories = todo->categories();
612 QString cat = categories.first(); 628 QString cat = categories.first();
613 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 629 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
@@ -656,17 +672,17 @@ void MonthViewCell::finishUpdateCell()
656 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 672 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
657 } 673 }
658 674
659 mLabel->setText( text ); 675 mLabel->setText( text );
660 resizeEvent( 0 ); 676 resizeEvent( 0 );
661} 677}
662void MonthViewCell::updateCell() 678void MonthViewCell::updateCell()
663{ 679{
664 qDebug("MonthViewCell::updateCell() "); 680 //qDebug("MonthViewCell::updateCell() ");
665 if ( !mMonthView->isUpdatePossible() ) 681 if ( !mMonthView->isUpdatePossible() )
666 return; 682 return;
667 startUpdateCell(); 683 startUpdateCell();
668 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 684 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
669 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 685 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
670 Event *event; 686 Event *event;
671 for( event = events.first(); event; event = events.next() ) { // for event 687 for( event = events.first(); event; event = events.next() ) { // for event
672 insertEvent(event); 688 insertEvent(event);
@@ -1213,16 +1229,17 @@ void KOMonthView::changeEventDisplay(Event *, int)
1213 1229
1214void KOMonthView::updateView() 1230void KOMonthView::updateView()
1215{ 1231{
1216 1232
1217 if ( !updatePossible ) 1233 if ( !updatePossible )
1218 return; 1234 return;
1219 //QTime ti; 1235 //QTime ti;
1220 //ti.start(); 1236 //ti.start();
1237 clearSelection();
1221 QPtrVector<MonthViewCell> *cells; 1238 QPtrVector<MonthViewCell> *cells;
1222 if ( mShowWeekView ) { 1239 if ( mShowWeekView ) {
1223 cells = &mCellsW; 1240 cells = &mCellsW;
1224 } else { 1241 } else {
1225 cells = &mCells; 1242 cells = &mCells;
1226 } 1243 }
1227#if 1 1244#if 1
1228 int i; 1245 int i;
@@ -1588,17 +1605,17 @@ void KOMonthView::showContextMenu( Incidence *incidence )
1588 */ 1605 */
1589} 1606}
1590MonthViewCell * KOMonthView::selectedCell( ) 1607MonthViewCell * KOMonthView::selectedCell( )
1591{ 1608{
1592 return mSelectedCell; 1609 return mSelectedCell;
1593} 1610}
1594void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1611void KOMonthView::setSelectedCell( MonthViewCell *cell )
1595{ 1612{
1596 // qDebug("KOMonthView::setSelectedCell "); 1613 //qDebug("KOMonthView::setSelectedCell ");
1597 if ( mSelectedCell && mSelectedCell != cell ) { 1614 if ( mSelectedCell && mSelectedCell != cell ) {
1598 MonthViewCell * mvc = mSelectedCell; 1615 MonthViewCell * mvc = mSelectedCell;
1599 mSelectedCell = cell; 1616 mSelectedCell = cell;
1600 mvc->deselect(); 1617 mvc->deselect();
1601 } else 1618 } else
1602 mSelectedCell = cell; 1619 mSelectedCell = cell;
1603 // if ( mSelectedCell ) 1620 // if ( mSelectedCell )
1604 // mSelectedCell->select(); 1621 // mSelectedCell->select();
@@ -1610,16 +1627,17 @@ void KOMonthView::setSelectedCell( MonthViewCell *cell )
1610 1627
1611void KOMonthView::processSelectionChange() 1628void KOMonthView::processSelectionChange()
1612{ 1629{
1613 QPtrList<Incidence> incidences = selectedIncidences(); 1630 QPtrList<Incidence> incidences = selectedIncidences();
1614 if (incidences.count() > 0) { 1631 if (incidences.count() > 0) {
1615 emit incidenceSelected( incidences.first() ); 1632 emit incidenceSelected( incidences.first() );
1616 } else { 1633 } else {
1617 emit incidenceSelected( 0 ); 1634 emit incidenceSelected( 0 );
1635 clearSelection();
1618 } 1636 }
1619} 1637}
1620 1638
1621void KOMonthView::clearSelection() 1639void KOMonthView::clearSelection()
1622{ 1640{
1623 if ( mSelectedCell ) { 1641 if ( mSelectedCell ) {
1624 mSelectedCell->deselect(); 1642 mSelectedCell->deselect();
1625 mSelectedCell = 0; 1643 mSelectedCell = 0;
@@ -1658,13 +1676,21 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
1658 break; 1676 break;
1659 case Key_Return: 1677 case Key_Return:
1660 case Key_Enter: 1678 case Key_Enter:
1661 { 1679 {
1662 selectInternalWeekNum ( currentWeek() ); 1680 selectInternalWeekNum ( currentWeek() );
1663 } 1681 }
1664 e->accept(); 1682 e->accept();
1665 break; 1683 break;
1684 case Key_D:
1685 if ( mSelectedCell ) {
1686 mSelectedCell->showDay();
1687 e->accept();
1688 } else {
1689 e->ignore();
1690 }
1691 break;
1666 default: 1692 default:
1667 e->ignore(); 1693 e->ignore();
1668 break; 1694 break;
1669 } 1695 }
1670} 1696}
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index f92a69a..fd8cbf2 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -165,23 +165,26 @@ class MonthViewCell : public QWidget
165 void defaultAction( Incidence * ); 165 void defaultAction( Incidence * );
166 void newEventSignal( QDateTime ); 166 void newEventSignal( QDateTime );
167 void showDaySignal( QDate ); 167 void showDaySignal( QDate );
168 168
169 protected: 169 protected:
170 QString mToolTip; 170 QString mToolTip;
171 void resizeEvent( QResizeEvent * ); 171 void resizeEvent( QResizeEvent * );
172 172
173
174public slots:
175 void showDay();
176
173 protected slots: 177 protected slots:
174 void defaultAction( QListBoxItem * ); 178 void defaultAction( QListBoxItem * );
175 void contextMenu( QListBoxItem * ); 179 void contextMenu( QListBoxItem * );
176 void selection( QListBoxItem * ); 180 void selection( QListBoxItem * );
177 void cellClicked( QListBoxItem * ); 181 void cellClicked( QListBoxItem * );
178 void newEvent(); 182 void newEvent();
179 void showDay();
180 183
181 private: 184 private:
182 KOMonthView *mMonthView; 185 KOMonthView *mMonthView;
183 186
184 QDate mDate; 187 QDate mDate;
185 bool mPrimary; 188 bool mPrimary;
186 bool mHoliday; 189 bool mHoliday;
187 QString mHolidayString; 190 QString mHolidayString;