summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt1
-rw-r--r--korganizer/koagenda.cpp31
-rw-r--r--korganizer/koagendaitem.cpp1
3 files changed, 31 insertions, 2 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 05c1afd..28029ee 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,101 +1,102 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.0.12 ************ 3********** VERSION 2.0.12 ************
4 4
5Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. 5Fixed a bug in todo start/due date handling for non recurring todos with a start and due date.
6Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes.
6 7
7 8
8********** VERSION 2.0.11 ************ 9********** VERSION 2.0.11 ************
9 10
10Fixed some problems in pi-sync mode 11Fixed some problems in pi-sync mode
11(e.g. details of events were not synced properly) 12(e.g. details of events were not synced properly)
12 13
13********** VERSION 2.0.10 ************ 14********** VERSION 2.0.10 ************
14 15
15KO/Pi: 16KO/Pi:
16In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. 17In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view.
17This is fixed. 18This is fixed.
18Changed the search dialog a bit to make it more user friendly. 19Changed the search dialog a bit to make it more user friendly.
19(E.g.: Removed message box about "no items found" and set key focus to search line edit after search). 20(E.g.: Removed message box about "no items found" and set key focus to search line edit after search).
20 21
21Added config option to hide the week number in KO/Pi toolbar. 22Added config option to hide the week number in KO/Pi toolbar.
22 23
23********** VERSION 2.0.9 ************ 24********** VERSION 2.0.9 ************
24 25
25Made month view icons for multiday events a bit nicer. 26Made month view icons for multiday events a bit nicer.
26Some minor fixes in KO/Pi 27Some minor fixes in KO/Pi
27(e.g. go to today did not work for new week view properly). 28(e.g. go to today did not work for new week view properly).
28 29
29 30
30********** VERSION 2.0.8 ************ 31********** VERSION 2.0.8 ************
31 32
32Fixed a problem in dependency info in the ipk files for the Zaurus. 33Fixed a problem in dependency info in the ipk files for the Zaurus.
33 34
34Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. 35Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar.
35 36
36Added a "go today" button to the datepicker. 37Added a "go today" button to the datepicker.
37 38
38Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) 39Added "created" and "last modified" to event/todo viewer (and What'sThis viewer)
39and made it configureable to show these values. 40and made it configureable to show these values.
40 41
41Fixed a problem for events (from external iCal files) that do have a duration but no end date. 42Fixed a problem for events (from external iCal files) that do have a duration but no end date.
42 43
43 44
44********** VERSION 2.0.7 ************ 45********** VERSION 2.0.7 ************
45 46
46Added global application font settings 47Added global application font settings
47(for all KDE-Pim/Pi apps) to the general settings. 48(for all KDE-Pim/Pi apps) to the general settings.
48 49
49Fixed a problem in OM/Pi when trying to login to some IMAP servers 50Fixed a problem in OM/Pi when trying to login to some IMAP servers
50(like the IMAP server of Apple: mail.mac.com ) 51(like the IMAP server of Apple: mail.mac.com )
51 52
52Added recurring todos to KO/Pi. 53Added recurring todos to KO/Pi.
53 54
54 55
55********** VERSION 2.0.6 ************ 56********** VERSION 2.0.6 ************
56 57
57Some bugfixes in the pi-sync mode. 58Some bugfixes in the pi-sync mode.
58Added German translation for pi-sync mode. 59Added German translation for pi-sync mode.
59 60
60KO/Pi: 61KO/Pi:
61Made the todolist using alternate background. 62Made the todolist using alternate background.
62 63
63Other minor fixes in KO/Pi. 64Other minor fixes in KO/Pi.
64 65
65 66
66********** VERSION 2.0.5 ************ 67********** VERSION 2.0.5 ************
67 68
68Bugfixes in KO/Pi. 69Bugfixes in KO/Pi.
69 70
70********** VERSION 2.0.4 ************ 71********** VERSION 2.0.4 ************
71 72
72KO/Pi: 73KO/Pi:
73Fixed problem loading translations for summary/location edit boxes in event/todo editor. 74Fixed problem loading translations for summary/location edit boxes in event/todo editor.
74 75
75Added a general "select week number" to the toolbar. 76Added a general "select week number" to the toolbar.
76 77
77Fixed some small problem of the new features introduced in version 2.0.3. 78Fixed some small problem of the new features introduced in version 2.0.3.
78 79
79Made it possible to specify one specific category as category color, 80Made it possible to specify one specific category as category color,
80if more than one categories are selected. 81if more than one categories are selected.
81 82
82Fixed a bug in saving colors for categories with non-ascii characters. 83Fixed a bug in saving colors for categories with non-ascii characters.
83(Like, e.g. German Umlauts). 84(Like, e.g. German Umlauts).
84Propably you have to set your colors again for those categories. 85Propably you have to set your colors again for those categories.
85 86
86 87
87********** VERSION 2.0.3 ************ 88********** VERSION 2.0.3 ************
88 89
89KO/Pi: 90KO/Pi:
90Added feature for changing alarm settings for many items at once: 91Added feature for changing alarm settings for many items at once:
91Open list view (or search dialog), select the desired items and choose in 92Open list view (or search dialog), select the desired items and choose in
92the popup menu: Set alarm for selected... 93the popup menu: Set alarm for selected...
93 94
94Added to the event/todo viewer the option to send an email to 95Added to the event/todo viewer the option to send an email to
95all attendees or all selected (with RSVP) attendees. 96all attendees or all selected (with RSVP) attendees.
96 97
97Made the week-month mode changing in month view faster. 98Made the week-month mode changing in month view faster.
98 99
99Made month view better useable with keyboard. 100Made month view better useable with keyboard.
100Now TAB key jumps to next cell with an event/todo. 101Now TAB key jumps to next cell with an event/todo.
101Scroll in cell with coursor keys, scroll in time (next week) with 102Scroll in cell with coursor keys, scroll in time (next week) with
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index a72e470..195b1fa 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -986,213 +986,240 @@ void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos)
986{ 986{
987// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; 987// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl;
988// QPoint point = viewport()->mapToGlobal(viewportPos); 988// QPoint point = viewport()->mapToGlobal(viewportPos);
989// kdDebug() << "Global: " << point.x() << "," << point.y() << endl; 989// kdDebug() << "Global: " << point.x() << "," << point.y() << endl;
990// point = clipper()->mapFromGlobal(point); 990// point = clipper()->mapFromGlobal(point);
991// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; 991// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl;
992 992
993 int x,y; 993 int x,y;
994 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 994 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
995// kdDebug() << "contents: " << x << "," << y << "\n" << endl; 995// kdDebug() << "contents: " << x << "," << y << "\n" << endl;
996 int gx,gy; 996 int gx,gy;
997 contentsToGrid(x,y,gx,gy); 997 contentsToGrid(x,y,gx,gy);
998 998
999 // Change cursor to resize cursor if appropriate 999 // Change cursor to resize cursor if appropriate
1000 if (mAllDayMode) { 1000 if (mAllDayMode) {
1001 int gridDistanceX = (x - gx * mGridSpacingX); 1001 int gridDistanceX = (x - gx * mGridSpacingX);
1002 if (gridDistanceX < mResizeBorderWidth && 1002 if (gridDistanceX < mResizeBorderWidth &&
1003 moveItem->cellX() == gx) { 1003 moveItem->cellX() == gx) {
1004 setCursor(sizeHorCursor); 1004 setCursor(sizeHorCursor);
1005 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && 1005 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
1006 moveItem->cellXWidth() == gx) { 1006 moveItem->cellXWidth() == gx) {
1007 setCursor(sizeHorCursor); 1007 setCursor(sizeHorCursor);
1008 } else { 1008 } else {
1009 setCursor(arrowCursor); 1009 setCursor(arrowCursor);
1010 } 1010 }
1011 } else { 1011 } else {
1012 int gridDistanceY = (y - gy * mGridSpacingY); 1012 int gridDistanceY = (y - gy * mGridSpacingY);
1013 if (gridDistanceY < mResizeBorderWidth && 1013 if (gridDistanceY < mResizeBorderWidth &&
1014 moveItem->cellYTop() == gy && 1014 moveItem->cellYTop() == gy &&
1015 !moveItem->firstMultiItem()) { 1015 !moveItem->firstMultiItem()) {
1016 setCursor(sizeVerCursor); 1016 setCursor(sizeVerCursor);
1017 } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && 1017 } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
1018 moveItem->cellYBottom() == gy && 1018 moveItem->cellYBottom() == gy &&
1019 !moveItem->lastMultiItem()) { 1019 !moveItem->lastMultiItem()) {
1020 setCursor(sizeVerCursor); 1020 setCursor(sizeVerCursor);
1021 } else { 1021 } else {
1022 setCursor(arrowCursor); 1022 setCursor(arrowCursor);
1023 } 1023 }
1024 } 1024 }
1025} 1025}
1026 1026
1027 1027
1028/* 1028/*
1029 Place item in cell and take care that multiple items using the same cell do 1029 Place item in cell and take care that multiple items using the same cell do
1030 not overlap. This method is not yet optimal. It doesn´t use the maximum space 1030 not overlap. This method is not yet optimal. It doesn´t use the maximum space
1031 it can get in all cases. 1031 it can get in all cases.
1032 At the moment the method has a bug: When an item is placed only the sub cell 1032 At the moment the method has a bug: When an item is placed only the sub cell
1033 widths of the items are changed, which are within the Y region the item to 1033 widths of the items are changed, which are within the Y region the item to
1034 place spans. When the sub cell width change of one of this items affects a 1034 place spans. When the sub cell width change of one of this items affects a
1035 cell, where other items are, which do not overlap in Y with the item to place, 1035 cell, where other items are, which do not overlap in Y with the item to place,
1036 the display gets corrupted, although the corruption looks quite nice. 1036 the display gets corrupted, although the corruption looks quite nice.
1037*/ 1037*/
1038void KOAgenda::placeSubCells(KOAgendaItem *placeItem) 1038void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
1039{ 1039{
1040 1040
1041 QPtrList<KOAgendaItem> conflictItems; 1041 QPtrList<KOAgendaItem> conflictItems;
1042 int maxSubCells = 0; 1042 int maxSubCells = 0;
1043 QIntDict<KOAgendaItem> subCellDict(5); 1043 QIntDict<KOAgendaItem> subCellDict(5);
1044 1044
1045 KOAgendaItem *item; 1045 KOAgendaItem *item;
1046 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1046 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1047 if (item != placeItem) { 1047 if (item != placeItem) {
1048 if (placeItem->cellX() <= item->cellXWidth() && 1048 if (placeItem->cellX() <= item->cellXWidth() &&
1049 placeItem->cellXWidth() >= item->cellX()) { 1049 placeItem->cellXWidth() >= item->cellX()) {
1050 if ((placeItem->cellYTop() <= item->cellYBottom()) && 1050 if ((placeItem->cellYTop() <= item->cellYBottom()) &&
1051 (placeItem->cellYBottom() >= item->cellYTop())) { 1051 (placeItem->cellYBottom() >= item->cellYTop())) {
1052 conflictItems.append(item); 1052 conflictItems.append(item);
1053 if (item->subCells() > maxSubCells) 1053 if (item->subCells() > maxSubCells)
1054 maxSubCells = item->subCells(); 1054 maxSubCells = item->subCells();
1055 subCellDict.insert(item->subCell(),item); 1055 subCellDict.insert(item->subCell(),item);
1056 } 1056 }
1057 } 1057 }
1058 } 1058 }
1059 } 1059 }
1060 1060
1061 if (conflictItems.count() > 0) { 1061 if (conflictItems.count() > 0) {
1062 // Look for unused sub cell and insert item 1062 // Look for unused sub cell and insert item
1063 int i; 1063 int i;
1064 for(i=0;i<maxSubCells;++i) { 1064 for(i=0;i<maxSubCells;++i) {
1065 if (!subCellDict.find(i)) { 1065 if (!subCellDict.find(i)) {
1066 placeItem->setSubCell(i); 1066 placeItem->setSubCell(i);
1067 break; 1067 break;
1068 } 1068 }
1069 } 1069 }
1070 if (i == maxSubCells) { 1070 if (i == maxSubCells) {
1071 placeItem->setSubCell(maxSubCells); 1071 placeItem->setSubCell(maxSubCells);
1072 maxSubCells++; // add new item to number of sub cells 1072 maxSubCells++; // add new item to number of sub cells
1073 } 1073 }
1074 1074
1075 // Prepare for sub cell geometry adjustment 1075 // Prepare for sub cell geometry adjustment
1076 int newSubCellWidth; 1076 int newSubCellWidth;
1077 if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; 1077 if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells;
1078 else newSubCellWidth = mGridSpacingX / maxSubCells; 1078 else newSubCellWidth = mGridSpacingX / maxSubCells;
1079 conflictItems.append(placeItem); 1079 conflictItems.append(placeItem);
1080 1080
1081 1081
1082 // Adjust sub cell geometry of all items 1082 // Adjust sub cell geometry of all direct conflict items
1083 for ( item=conflictItems.first(); item != 0; 1083 for ( item=conflictItems.first(); item != 0;
1084 item=conflictItems.next() ) { 1084 item=conflictItems.next() ) {
1085 item->setSubCells(maxSubCells); 1085 item->setSubCells(maxSubCells);
1086 if (mAllDayMode) { 1086 if (mAllDayMode) {
1087 item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); 1087 item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth);
1088 } else { 1088 } else {
1089 item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); 1089 item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY);
1090 } 1090 }
1091 int x,y; 1091 int x,y;
1092 gridToContents(item->cellX(),item->cellYTop(),x,y); 1092 gridToContents(item->cellX(),item->cellYTop(),x,y);
1093 if (mAllDayMode) { 1093 if (mAllDayMode) {
1094 y += item->subCell() * newSubCellWidth; 1094 y += item->subCell() * newSubCellWidth;
1095 } else { 1095 } else {
1096 x += item->subCell() * newSubCellWidth; 1096 x += item->subCell() * newSubCellWidth;
1097 } 1097 }
1098 moveChild(item,x,y); 1098 moveChild(item,x,y);
1099 // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); 1099 // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y);
1100 //item->updateItem(); 1100 //item->updateItem();
1101 } 1101 }
1102 1102 // Adjust sub cell geometry of all conflict items of all conflict items
1103 for ( item=conflictItems.first(); item != 0;
1104 item=conflictItems.next() ) {
1105 if ( placeItem != item ) {
1106 KOAgendaItem *item2;
1107 QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems();
1108 for ( item2=conflictItems2.first(); item2 != 0;
1109 item2=conflictItems2.next() ) {
1110 if ( item2->subCells() != maxSubCells) {
1111 item2->setSubCells(maxSubCells);
1112 if (mAllDayMode) {
1113 item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth);
1114 } else {
1115 item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY);
1116 }
1117 int x,y;
1118 gridToContents(item2->cellX(),item2->cellYTop(),x,y);
1119 if (mAllDayMode) {
1120 y += item2->subCell() * newSubCellWidth;
1121 } else {
1122 x += item2->subCell() * newSubCellWidth;
1123 }
1124 moveChild(item2,x,y);
1125 //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() );
1126 }
1127 }
1128 }
1129 }
1103 } else { 1130 } else {
1104 placeItem->setSubCell(0); 1131 placeItem->setSubCell(0);
1105 placeItem->setSubCells(1); 1132 placeItem->setSubCells(1);
1106 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); 1133 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY);
1107 else placeItem->resize(mGridSpacingX,placeItem->height()); 1134 else placeItem->resize(mGridSpacingX,placeItem->height());
1108 int x,y; 1135 int x,y;
1109 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); 1136 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y);
1110 moveChild(placeItem,x,y); 1137 moveChild(placeItem,x,y);
1111 } 1138 }
1112 placeItem->setConflictItems(conflictItems); 1139 placeItem->setConflictItems(conflictItems);
1113 // for ( item=conflictItems.first(); item != 0; 1140 // for ( item=conflictItems.first(); item != 0;
1114// item=conflictItems.next() ) { 1141// item=conflictItems.next() ) {
1115// //item->updateItem(); 1142// //item->updateItem();
1116// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); 1143// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() );
1117// } 1144// }
1118// placeItem->updateItem(); 1145// placeItem->updateItem();
1119} 1146}
1120 1147
1121void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 1148void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1122{ 1149{
1123 if ( globalFlagBlockAgenda ) 1150 if ( globalFlagBlockAgenda )
1124 return; 1151 return;
1125 //qDebug("KOAgenda::drawContents "); 1152 //qDebug("KOAgenda::drawContents ");
1126 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) 1153 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() )
1127 ;//drawContentsToPainter(); 1154 ;//drawContentsToPainter();
1128 1155
1129 QPaintDevice* pd = p->device(); 1156 QPaintDevice* pd = p->device();
1130 p->end(); 1157 p->end();
1131 int vx, vy; 1158 int vx, vy;
1132 int selectionX = KOGlobals::self()->reverseLayout() ? 1159 int selectionX = KOGlobals::self()->reverseLayout() ?
1133 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1160 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1134 mSelectionCellX * mGridSpacingX; 1161 mSelectionCellX * mGridSpacingX;
1135 contentsToViewport ( cx, cy, vx,vy); 1162 contentsToViewport ( cx, cy, vx,vy);
1136 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; 1163 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ;
1137 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) 1164 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) )
1138 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); 1165 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP);
1139 1166
1140 if ( mSelectionHeight > 0 ) { 1167 if ( mSelectionHeight > 0 ) {
1141 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); 1168 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
1142 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1169 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1143 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1170 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1144 contentsToViewport ( selectionX, mSelectionYTop, vx,vy); 1171 contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
1145 bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); 1172 bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
1146 } 1173 }
1147 } 1174 }
1148 //qDebug("btbl "); 1175 //qDebug("btbl ");
1149 p->begin( pd ); 1176 p->begin( pd );
1150 //qDebug("end "); 1177 //qDebug("end ");
1151} 1178}
1152 1179
1153void KOAgenda::finishUpdate() 1180void KOAgenda::finishUpdate()
1154{ 1181{
1155 1182
1156 KOAgendaItem *item; 1183 KOAgendaItem *item;
1157 globalFlagBlockAgendaItemPaint = 1; 1184 globalFlagBlockAgendaItemPaint = 1;
1158 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1185 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1159 if ( !item->isVisible() ) 1186 if ( !item->isVisible() )
1160 item->show(); 1187 item->show();
1161 1188
1162 } 1189 }
1163 globalFlagBlockAgendaItemUpdate = 0; 1190 globalFlagBlockAgendaItemUpdate = 0;
1164 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1191 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1165 item->repaintMe( ); 1192 item->repaintMe( );
1166 } 1193 }
1167 globalFlagBlockAgendaItemUpdate = 1; 1194 globalFlagBlockAgendaItemUpdate = 1;
1168 qApp->processEvents(); 1195 qApp->processEvents();
1169 globalFlagBlockAgendaItemPaint = 0; 1196 globalFlagBlockAgendaItemPaint = 0;
1170 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1197 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1171 item->repaint( false ); 1198 item->repaint( false );
1172 } 1199 }
1173 1200
1174} 1201}
1175 1202
1176/* 1203/*
1177 Draw grid in the background of the agenda. 1204 Draw grid in the background of the agenda.
1178*/ 1205*/
1179void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) 1206void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch)
1180{ 1207{
1181 1208
1182 1209
1183 if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) 1210 if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask )
1184 return; 1211 return;
1185 if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) 1212 if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 )
1186 return; 1213 return;
1187 int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); 1214 int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight();
1188 if ( ch < 1 ) 1215 if ( ch < 1 )
1189 ch = 1; 1216 ch = 1;
1190 if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { 1217 if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) {
1191 mPaintPixmap.resize( contentsWidth()+42, ch ); 1218 mPaintPixmap.resize( contentsWidth()+42, ch );
1192 } 1219 }
1193 mCurPixWid = contentsWidth(); 1220 mCurPixWid = contentsWidth();
1194 mCurPixHei = ch; 1221 mCurPixHei = ch;
1195 if ( mHighlightPixmap.width() < mGridSpacingX-1 || mHighlightPixmap.height() < ch ) { 1222 if ( mHighlightPixmap.width() < mGridSpacingX-1 || mHighlightPixmap.height() < ch ) {
1196 mHighlightPixmap.resize( mGridSpacingX-1, ch ); 1223 mHighlightPixmap.resize( mGridSpacingX-1, ch );
1197 mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); 1224 mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor );
1198 } 1225 }
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index d0a7b07..38bd93a 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -42,192 +42,193 @@
42#include <libkcal/kincidenceformatter.h> 42#include <libkcal/kincidenceformatter.h>
43extern int globalFlagBlockAgenda; 43extern int globalFlagBlockAgenda;
44extern int globalFlagBlockAgendaItemPaint; 44extern int globalFlagBlockAgendaItemPaint;
45extern int globalFlagBlockAgendaItemUpdate; 45extern int globalFlagBlockAgendaItemUpdate;
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48 48
49#include "koagendaitem.h" 49#include "koagendaitem.h"
50//#include "koagendaitem.moc" 50//#include "koagendaitem.moc"
51 51
52 52
53//-------------------------------------------------------------------------- 53//--------------------------------------------------------------------------
54 54
55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
56 56
57//-------------------------------------------------------------------------- 57//--------------------------------------------------------------------------
58 58
59class KOAgendaItemWhatsThis :public QWhatsThis 59class KOAgendaItemWhatsThis :public QWhatsThis
60{ 60{
61public: 61public:
62 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; 62 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { };
63 63
64protected: 64protected:
65 virtual QString text( const QPoint& ) 65 virtual QString text( const QPoint& )
66 { 66 {
67 return _view->getWhatsThisText() ; 67 return _view->getWhatsThisText() ;
68 } 68 }
69private: 69private:
70 KOAgendaItem * _view; 70 KOAgendaItem * _view;
71}; 71};
72 72
73KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 73KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
74 const char *name,WFlags) : 74 const char *name,WFlags) :
75 QWidget(parent, name), mIncidence(incidence), mDate(qd) 75 QWidget(parent, name), mIncidence(incidence), mDate(qd)
76{ 76{
77#ifndef DESKTOP_VERSION 77#ifndef DESKTOP_VERSION
78 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 78 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
79#endif 79#endif
80 new KOAgendaItemWhatsThis(this); 80 new KOAgendaItemWhatsThis(this);
81 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 81 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
82 setWFlags ( wflags); 82 setWFlags ( wflags);
83 mAllDay = allday; 83 mAllDay = allday;
84 init ( incidence, qd ); 84 init ( incidence, qd );
85 setMouseTracking(true); 85 setMouseTracking(true);
86 //setAcceptDrops(true); 86 //setAcceptDrops(true);
87 xPaintCoord = -1; 87 xPaintCoord = -1;
88 yPaintCoord = -1; 88 yPaintCoord = -1;
89} 89}
90QString KOAgendaItem::getWhatsThisText() 90QString KOAgendaItem::getWhatsThisText()
91{ 91{
92 if ( mIncidence ) 92 if ( mIncidence )
93 return KIncidenceFormatter::instance()->getFormattedText( mIncidence, 93 return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
94 KOPrefs::instance()->mWTshowDetails, 94 KOPrefs::instance()->mWTshowDetails,
95 KOPrefs::instance()->mWTshowCreated, 95 KOPrefs::instance()->mWTshowCreated,
96 KOPrefs::instance()->mWTshowChanged); 96 KOPrefs::instance()->mWTshowChanged);
97 return "KOAgendaItem::getWhatsThisText()::internal error"; 97 return "KOAgendaItem::getWhatsThisText()::internal error";
98} 98}
99void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 99void KOAgendaItem::init ( Incidence *incidence, QDate qd )
100{ 100{
101 mIncidence = incidence; 101 mIncidence = incidence;
102 mDate = qd; 102 mDate = qd;
103 mFirstMultiItem = 0; 103 mFirstMultiItem = 0;
104 mNextMultiItem = 0; 104 mNextMultiItem = 0;
105 mLastMultiItem = 0; 105 mLastMultiItem = 0;
106 computeText(); 106 computeText();
107 107
108 if ( (incidence->type() == "Todo") && 108 if ( (incidence->type() == "Todo") &&
109 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 109 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
110 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 110 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
111 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 111 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
112 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 112 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
113 else 113 else
114 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 114 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
115 } 115 }
116 else { 116 else {
117 QStringList categories = mIncidence->categories(); 117 QStringList categories = mIncidence->categories();
118 QString cat = categories.first(); 118 QString cat = categories.first();
119 if (cat.isEmpty()) { 119 if (cat.isEmpty()) {
120 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) 120 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) )
121 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 121 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
122 else 122 else
123 mBackgroundColor =KOPrefs::instance()->mEventColor; 123 mBackgroundColor =KOPrefs::instance()->mEventColor;
124 } else { 124 } else {
125 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 125 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
126 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { 126 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
127 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 127 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
128 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 128 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
129 } 129 }
130 } 130 }
131 131
132 } 132 }
133 mColorGroup = QColorGroup( mBackgroundColor.light(), 133 mColorGroup = QColorGroup( mBackgroundColor.light(),
134 mBackgroundColor.dark(),mBackgroundColor.light(), 134 mBackgroundColor.dark(),mBackgroundColor.light(),
135 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 135 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
136 setBackgroundColor( mBackgroundColor ); 136 setBackgroundColor( mBackgroundColor );
137 137
138 mConflictItems.clear();
138 setCellXY(0,0,1); 139 setCellXY(0,0,1);
139 setCellXWidth(0); 140 setCellXWidth(0);
140 setSubCell(0); 141 setSubCell(0);
141 setSubCells(1); 142 setSubCells(1);
142 setMultiItem(0,0,0); 143 setMultiItem(0,0,0);
143 startMove(); 144 startMove();
144 mSelected = true; 145 mSelected = true;
145 select(false); 146 select(false);
146 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 147 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
147 mFontPixelSize = fontinf.height();; 148 mFontPixelSize = fontinf.height();;
148 hide(); 149 hide();
149 xPaintCoord = -1; 150 xPaintCoord = -1;
150 yPaintCoord = -1; 151 yPaintCoord = -1;
151} 152}
152 153
153 154
154KOAgendaItem::~KOAgendaItem() 155KOAgendaItem::~KOAgendaItem()
155{ 156{
156 // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); 157 // qDebug("deleteKOAgendaItem::~KOAgendaItem( ");
157 158
158} 159}
159 160
160void KOAgendaItem::recreateIncidence() 161void KOAgendaItem::recreateIncidence()
161{ 162{
162#if 0 163#if 0
163 Incidence* newInc = mIncidence->clone(); 164 Incidence* newInc = mIncidence->clone();
164 newInc->recreate(); 165 newInc->recreate();
165 if ( mIncidence->doesRecur() ) { 166 if ( mIncidence->doesRecur() ) {
166 mIncidence->addExDate( mDate ); 167 mIncidence->addExDate( mDate );
167 newInc->recurrence()->unsetRecurs(); 168 newInc->recurrence()->unsetRecurs();
168 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 169 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
169 QTime tim = mIncidence->dtStart().time(); 170 QTime tim = mIncidence->dtStart().time();
170 newInc->setDtStart( QDateTime(mDate, tim) ); 171 newInc->setDtStart( QDateTime(mDate, tim) );
171 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 172 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
172 } 173 }
173#endif 174#endif
174 mIncidence = mIncidence->recreateCloneException( mDate ); 175 mIncidence = mIncidence->recreateCloneException( mDate );
175} 176}
176bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 177bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
177{ 178{
178 int size = AGENDA_ICON_SIZE; 179 int size = AGENDA_ICON_SIZE;
179 180
180 int yOff = 0; 181 int yOff = 0;
181 int xOff = 0; 182 int xOff = 0;
182 int x = pos().x() +3; 183 int x = pos().x() +3;
183 int y; 184 int y;
184 if ( mAllDay ) 185 if ( mAllDay )
185 y = pos().y()+3; 186 y = pos().y()+3;
186 else 187 else
187 y = mCellYTop * ( height() / cellHeight() ) +3; 188 y = mCellYTop * ( height() / cellHeight() ) +3;
188 if (mIncidence->cancelled()) { 189 if (mIncidence->cancelled()) {
189 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 190 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
190 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 191 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
191 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 192 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
192 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 193 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
193 if ( horLayout ) 194 if ( horLayout )
194 ++xOff; 195 ++xOff;
195 else 196 else
196 ++yOff; 197 ++yOff;
197 } 198 }
198 if (mIncidence->isAlarmEnabled()) { 199 if (mIncidence->isAlarmEnabled()) {
199 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 200 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
200 if ( horLayout ) 201 if ( horLayout )
201 ++xOff; 202 ++xOff;
202 else 203 else
203 ++yOff; 204 ++yOff;
204 } 205 }
205 if (mIncidence->recurrence()->doesRecur()) { 206 if (mIncidence->recurrence()->doesRecur()) {
206 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 207 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
207 if ( horLayout ) 208 if ( horLayout )
208 ++xOff; 209 ++xOff;
209 else 210 else
210 ++yOff; 211 ++yOff;
211 } 212 }
212 if (mIncidence->description().length() > 0) { 213 if (mIncidence->description().length() > 0) {
213 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 214 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
214 if ( horLayout ) 215 if ( horLayout )
215 ++xOff; 216 ++xOff;
216 else 217 else
217 ++yOff; 218 ++yOff;
218 } 219 }
219 if (mIncidence->isReadOnly()) { 220 if (mIncidence->isReadOnly()) {
220 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 221 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
221 if ( horLayout ) 222 if ( horLayout )
222 ++xOff; 223 ++xOff;
223 else 224 else
224 ++yOff; 225 ++yOff;
225 } 226 }
226 227
227 if (mIncidence->attendeeCount()>0) { 228 if (mIncidence->attendeeCount()>0) {
228 229
229 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 230 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
230 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 231 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
231 if ( horLayout ) 232 if ( horLayout )
232 ++xOff; 233 ++xOff;
233 else 234 else