summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-05 07:37:53 (UTC)
committer zautrix <zautrix>2005-07-05 07:37:53 (UTC)
commit28ca4c37fb0e131b2978584992840b3fdca21d3e (patch) (unidiff)
treefb4f7e51c0995b71e2a26a7300747b6b1b3acb23
parent5992ea9025ebddde8be72322c90aac8edeaf4d1c (diff)
downloadkdepimpi-28ca4c37fb0e131b2978584992840b3fdca21d3e.zip
kdepimpi-28ca4c37fb0e131b2978584992840b3fdca21d3e.tar.gz
kdepimpi-28ca4c37fb0e131b2978584992840b3fdca21d3e.tar.bz2
fixesss
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp30
-rw-r--r--korganizer/koagenda.h4
-rw-r--r--korganizer/koagendaitem.cpp5
-rw-r--r--korganizer/koagendaview.cpp31
-rw-r--r--korganizer/koagendaview.h5
5 files changed, 65 insertions, 10 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 0280c74..c339b57 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -15,96 +15,97 @@
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 21
22 As a special exception, permission is given to link this program 22 As a special exception, permission is given to link this program
23 with any edition of Qt, and distribute the resulting executable, 23 with any edition of Qt, and distribute the resulting executable,
24 without including the source code for Qt in the source distribution. 24 without including the source code for Qt in the source distribution.
25*/ 25*/
26 26
27#ifndef _WIN32_ 27#ifndef _WIN32_
28#define protected public 28#define protected public
29#include <qwidget.h> 29#include <qwidget.h>
30#undef protected 30#undef protected
31#endif 31#endif
32#include <qintdict.h> 32#include <qintdict.h>
33#include <qdatetime.h> 33#include <qdatetime.h>
34#include <qapplication.h> 34#include <qapplication.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <qcursor.h> 36#include <qcursor.h>
37#include <qpainter.h> 37#include <qpainter.h>
38 38
39#include <kdebug.h> 39#include <kdebug.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kiconloader.h> 41#include <kiconloader.h>
42#include <kglobal.h> 42#include <kglobal.h>
43 43
44#include "koagendaitem.h" 44#include "koagendaitem.h"
45#include "koprefs.h" 45#include "koprefs.h"
46#include "koglobals.h" 46#include "koglobals.h"
47 47
48#include "koagenda.h" 48#include "koagenda.h"
49 49
50#include <libkcal/event.h> 50#include <libkcal/event.h>
51#include <libkcal/todo.h> 51#include <libkcal/todo.h>
52 52
53#ifndef DESKTOP_VERSION 53#ifndef DESKTOP_VERSION
54#include <qpe/qpeapplication.h> 54#include <qpe/qpeapplication.h>
55#endif 55#endif
56 56
57//extern bool globalFlagBlockPainting; 57//extern bool globalFlagBlockPainting;
58extern int globalFlagBlockAgenda; 58extern int globalFlagBlockAgenda;
59extern int globalFlagBlockAgendaItemPaint; 59extern int globalFlagBlockAgendaItemPaint;
60extern int globalFlagBlockAgendaItemUpdate; 60extern int globalFlagBlockAgendaItemUpdate;
61extern int globalFlagBlockStartup; 61extern int globalFlagBlockStartup;
62 62
63bool KOAgenda::mInvalidPixmap = false;
63//////////////////////////////////////////////////////////////////////////// 64////////////////////////////////////////////////////////////////////////////
64MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) 65MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name)
65 : QFrame(_agenda->viewport(),name), agenda(_agenda) 66 : QFrame(_agenda->viewport(),name), agenda(_agenda)
66{ 67{
67 setLineWidth(0); 68 setLineWidth(0);
68 setMargin(0); 69 setMargin(0);
69 setBackgroundColor(Qt::red); 70 setBackgroundColor(Qt::red);
70 minutes = new QTimer(this); 71 minutes = new QTimer(this);
71 connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); 72 connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc()));
72 minutes->start(0, true); 73 minutes->start(0, true);
73 mTimeBox = new QLabel(this); 74 mTimeBox = new QLabel(this);
74 mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); 75 mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom);
75 QPalette pal = mTimeBox->palette(); 76 QPalette pal = mTimeBox->palette();
76 pal.setColor(QColorGroup::Foreground, Qt::red); 77 pal.setColor(QColorGroup::Foreground, Qt::red);
77 mTimeBox->setPalette(pal); 78 mTimeBox->setPalette(pal);
78 //mTimeBox->setAutoMask(true); 79 //mTimeBox->setAutoMask(true);
79 80
80 agenda->addChild(mTimeBox); 81 agenda->addChild(mTimeBox);
81 82
82 oldToday = -1; 83 oldToday = -1;
83} 84}
84 85
85MarcusBains::~MarcusBains() 86MarcusBains::~MarcusBains()
86{ 87{
87 delete minutes; 88 delete minutes;
88} 89}
89 90
90int MarcusBains::todayColumn() 91int MarcusBains::todayColumn()
91{ 92{
92 QDate currentDate = QDate::currentDate(); 93 QDate currentDate = QDate::currentDate();
93 94
94 DateList dateList = agenda->dateList(); 95 DateList dateList = agenda->dateList();
95 DateList::ConstIterator it; 96 DateList::ConstIterator it;
96 int col = 0; 97 int col = 0;
97 for(it = dateList.begin(); it != dateList.end(); ++it) { 98 for(it = dateList.begin(); it != dateList.end(); ++it) {
98 if((*it) == currentDate) 99 if((*it) == currentDate)
99 return KOGlobals::self()->reverseLayout() ? 100 return KOGlobals::self()->reverseLayout() ?
100 agenda->columns() - 1 - col : col; 101 agenda->columns() - 1 - col : col;
101 ++col; 102 ++col;
102 } 103 }
103 104
104 return -1; 105 return -1;
105} 106}
106void MarcusBains::updateLoc() 107void MarcusBains::updateLoc()
107{ 108{
108 updateLocation(); 109 updateLocation();
109} 110}
110void MarcusBains::updateLocation(bool recalculate) 111void MarcusBains::updateLocation(bool recalculate)
@@ -133,96 +134,97 @@ void MarcusBains::updateLocation(bool recalculate)
133 } 134 }
134 135
135 if(recalculate) 136 if(recalculate)
136 setFixedSize(agenda->gridSpacingX(),1); 137 setFixedSize(agenda->gridSpacingX(),1);
137 agenda->moveChild(this, x, y); 138 agenda->moveChild(this, x, y);
138 raise(); 139 raise();
139 140
140 if(recalculate) 141 if(recalculate)
141 //mTimeBox->setFont(QFont("helvetica",10)); 142 //mTimeBox->setFont(QFont("helvetica",10));
142 mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); 143 mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont);
143 144
144 mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); 145 mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds));
145 mTimeBox->adjustSize(); 146 mTimeBox->adjustSize();
146 // the -2 below is there because there is a bug in this program 147 // the -2 below is there because there is a bug in this program
147 // somewhere, where the last column of this widget is a few pixels 148 // somewhere, where the last column of this widget is a few pixels
148 // narrower than the other columns. 149 // narrower than the other columns.
149 int offs = (today==agenda->columns()-1) ? -4 : 0; 150 int offs = (today==agenda->columns()-1) ? -4 : 0;
150 agenda->moveChild(mTimeBox, 151 agenda->moveChild(mTimeBox,
151 x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, 152 x+agenda->gridSpacingX()-mTimeBox->width()+offs-1,
152 y-mTimeBox->height()); 153 y-mTimeBox->height());
153 154
154 mTimeBox->raise(); 155 mTimeBox->raise();
155 //mTimeBox->setAutoMask(true); 156 //mTimeBox->setAutoMask(true);
156 minutes->start(5000,true); 157 minutes->start(5000,true);
157} 158}
158 159
159 160
160//////////////////////////////////////////////////////////////////////////// 161////////////////////////////////////////////////////////////////////////////
161 162
162 163
163/* 164/*
164 Create an agenda widget with rows rows and columns columns. 165 Create an agenda widget with rows rows and columns columns.
165*/ 166*/
166KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, 167KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
167 const char *name,WFlags f) : 168 const char *name,WFlags f) :
168 QScrollView(parent,name,f) 169 QScrollView(parent,name,f)
169{ 170{
170 171
171 mAllAgendaPopup = 0; 172 mAllAgendaPopup = 0;
172 mColumns = columns; 173 mColumns = columns;
173 mRows = rows; 174 mRows = rows;
174 mGridSpacingY = rowSize; 175 mGridSpacingY = rowSize;
175 mAllDayMode = false; 176 mAllDayMode = false;
176#ifndef DESKTOP_VERSION 177#ifndef DESKTOP_VERSION
177 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 178 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
178#endif 179#endif
179 mHolidayMask = 0; 180 mHolidayMask = 0;
180 init(); 181 init();
182 connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) );
181} 183}
182 184
183/* 185/*
184 Create an agenda widget with columns columns and one row. This is used for 186 Create an agenda widget with columns columns and one row. This is used for
185 all-day events. 187 all-day events.
186*/ 188*/
187KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : 189KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) :
188 QScrollView(parent,name,f) 190 QScrollView(parent,name,f)
189{ 191{
190 mAllAgendaPopup = 0; 192 mAllAgendaPopup = 0;
191 blockResize = false; 193 blockResize = false;
192 mColumns = columns; 194 mColumns = columns;
193 mRows = 1; 195 mRows = 1;
194 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); 196 //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize);
195 mGridSpacingY = KOPrefs::instance()->mAllDaySize; 197 mGridSpacingY = KOPrefs::instance()->mAllDaySize;
196 mAllDayMode = true; 198 mAllDayMode = true;
197#ifndef DESKTOP_VERSION 199#ifndef DESKTOP_VERSION
198 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 200 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
199#endif 201#endif
200 mHolidayMask = 0; 202 mHolidayMask = 0;
201 init(); 203 init();
202} 204}
203 205
204 206
205KOAgenda::~KOAgenda() 207KOAgenda::~KOAgenda()
206{ 208{
207 if(mMarcusBains) delete mMarcusBains; 209 if(mMarcusBains) delete mMarcusBains;
208 210
209} 211}
210 212
211Incidence *KOAgenda::selectedIncidence() const 213Incidence *KOAgenda::selectedIncidence() const
212{ 214{
213 return (mSelectedItem ? mSelectedItem->incidence() : 0); 215 return (mSelectedItem ? mSelectedItem->incidence() : 0);
214} 216}
215 217
216 218
217QDate KOAgenda::selectedIncidenceDate() const 219QDate KOAgenda::selectedIncidenceDate() const
218{ 220{
219 return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); 221 return (mSelectedItem ? mSelectedItem->itemDate() : QDate());
220} 222}
221 223
222 224
223void KOAgenda::init() 225void KOAgenda::init()
224{ 226{
225 mPopupTimer = new QTimer(this); 227 mPopupTimer = new QTimer(this);
226 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); 228 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
227 229
228 mNewItemPopup = new QPopupMenu( this ); 230 mNewItemPopup = new QPopupMenu( this );
@@ -272,98 +274,114 @@ void KOAgenda::init()
272 mSelectionYTop = 0; 274 mSelectionYTop = 0;
273 mSelectionHeight = 0; 275 mSelectionHeight = 0;
274 276
275 mOldLowerScrollValue = -1; 277 mOldLowerScrollValue = -1;
276 mOldUpperScrollValue = -1; 278 mOldUpperScrollValue = -1;
277 279
278 mClickedItem = 0; 280 mClickedItem = 0;
279 281
280 mActionItem = 0; 282 mActionItem = 0;
281 mActionType = NOP; 283 mActionType = NOP;
282 mItemMoved = false; 284 mItemMoved = false;
283 285
284 mSelectedItem = 0; 286 mSelectedItem = 0;
285 287
286 // mItems.setAutoDelete(true); 288 // mItems.setAutoDelete(true);
287 289
288 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 290 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
289 291
290 viewport()->update(); 292 viewport()->update();
291 293
292 setMinimumSize(30, 1); 294 setMinimumSize(30, 1);
293// setMaximumHeight(mGridSpacingY * mRows + 5); 295// setMaximumHeight(mGridSpacingY * mRows + 5);
294 296
295 // Disable horizontal scrollbar. This is a hack. The geometry should be 297 // Disable horizontal scrollbar. This is a hack. The geometry should be
296 // controlled in a way that the contents horizontally always fits. Then it is 298 // controlled in a way that the contents horizontally always fits. Then it is
297 // not necessary to turn off the scrollbar. 299 // not necessary to turn off the scrollbar.
298 setHScrollBarMode(AlwaysOff); 300 setHScrollBarMode(AlwaysOff);
299 if ( ! mAllDayMode ) 301 if ( ! mAllDayMode )
300 setVScrollBarMode(AlwaysOn); 302 setVScrollBarMode(AlwaysOn);
301 else 303 else
302 setVScrollBarMode(AlwaysOff); 304 setVScrollBarMode(AlwaysOff);
303 305
304 setStartHour(KOPrefs::instance()->mDayBegins); 306 setStartHour(KOPrefs::instance()->mDayBegins);
305 307
306 calculateWorkingHours(); 308 calculateWorkingHours();
307 309
308 connect(verticalScrollBar(),SIGNAL(valueChanged(int)), 310 connect(verticalScrollBar(),SIGNAL(valueChanged(int)),
309 SLOT(checkScrollBoundaries(int))); 311 SLOT(checkScrollBoundaries(int)));
310 312
311 // Create the Marcus Bains line. 313 // Create the Marcus Bains line.
312 if(mAllDayMode) 314 if(mAllDayMode)
313 mMarcusBains = 0; 315 mMarcusBains = 0;
314 else { 316 else {
315 mMarcusBains = new MarcusBains(this); 317 mMarcusBains = new MarcusBains(this);
316 addChild(mMarcusBains); 318 addChild(mMarcusBains);
317 } 319 }
318 mPopupKind = 0; 320 mPopupKind = 0;
319 mPopupItem = 0; 321 mPopupItem = 0;
322 mInvalidPixmap = false;
323
320} 324}
321 325
326void KOAgenda::shrinkPixmap()
327{
328 mPaintPixmap.resize( 20,20);
329 mInvalidPixmap = true;
330}
331void KOAgenda::slotContentMove(int,int)
332{
333 if ( mActionType == NOP )
334 slotClearSelection();
335 if ( mSelectedItem && !mActionItem ) {
336 deselectItem();
337 emit incidenceSelected( 0 );
338 }
339}
322void KOAgenda::clear() 340void KOAgenda::clear()
323{ 341{
324 KOAgendaItem *item; 342 KOAgendaItem *item;
325 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 343 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
326 mUnusedItems.append( item ); 344 mUnusedItems.append( item );
327 //item->hide(); 345 //item->hide();
328 } 346 }
329 mItems.clear(); 347 mItems.clear();
330 mSelectedItem = 0; 348 mSelectedItem = 0;
331 clearSelection(); 349 clearSelection();
332} 350}
333 351
334void KOAgenda::clearSelection() 352void KOAgenda::clearSelection()
335{ 353{
336 mSelectionCellX = 0; 354 mSelectionCellX = 0;
337 mSelectionYTop = 0; 355 mSelectionYTop = 0;
338 mSelectionHeight = 0; 356 mSelectionHeight = 0;
339} 357}
340 358
341void KOAgenda::marcus_bains() 359void KOAgenda::marcus_bains()
342{ 360{
343 if(mMarcusBains) mMarcusBains->updateLocation(true); 361 if(mMarcusBains) mMarcusBains->updateLocation(true);
344} 362}
345 363
346 364
347void KOAgenda::changeColumns(int columns) 365void KOAgenda::changeColumns(int columns)
348{ 366{
349 if (columns == 0) { 367 if (columns == 0) {
350 qDebug("KOAgenda::changeColumns() called with argument 0 "); 368 qDebug("KOAgenda::changeColumns() called with argument 0 ");
351 return; 369 return;
352 } 370 }
353 clear(); 371 clear();
354 mColumns = columns; 372 mColumns = columns;
355 computeSizes(); 373 computeSizes();
356} 374}
357 375
358/* 376/*
359 This is the eventFilter function, which gets all events from the KOAgendaItems 377 This is the eventFilter function, which gets all events from the KOAgendaItems
360 contained in the agenda. It has to handle moving and resizing for all items. 378 contained in the agenda. It has to handle moving and resizing for all items.
361*/ 379*/
362bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) 380bool KOAgenda::eventFilter ( QObject *object, QEvent *event )
363{ 381{
364 // kdDebug() << "KOAgenda::eventFilter" << endl; 382 // kdDebug() << "KOAgenda::eventFilter" << endl;
365 switch(event->type()) { 383 switch(event->type()) {
366 case QEvent::MouseButtonPress: 384 case QEvent::MouseButtonPress:
367 case QEvent::MouseButtonDblClick: 385 case QEvent::MouseButtonDblClick:
368 case QEvent::MouseButtonRelease: 386 case QEvent::MouseButtonRelease:
369 case QEvent::MouseMove: 387 case QEvent::MouseMove:
@@ -877,96 +895,97 @@ void KOAgenda::performItemAction(QPoint viewportPos)
877 } 895 }
878 } else { 896 } else {
879 switch ( mActionType ) { 897 switch ( mActionType ) {
880 case MOVE: 898 case MOVE:
881 setCursor( sizeAllCursor ); 899 setCursor( sizeAllCursor );
882 break; 900 break;
883 case RESIZETOP: 901 case RESIZETOP:
884 case RESIZEBOTTOM: 902 case RESIZEBOTTOM:
885 setCursor( sizeVerCursor ); 903 setCursor( sizeVerCursor );
886 break; 904 break;
887 case RESIZELEFT: 905 case RESIZELEFT:
888 case RESIZERIGHT: 906 case RESIZERIGHT:
889 setCursor( sizeHorCursor ); 907 setCursor( sizeHorCursor );
890 break; 908 break;
891 default: 909 default:
892 setCursor( arrowCursor ); 910 setCursor( arrowCursor );
893 } 911 }
894 } 912 }
895 913
896 // Scroll if item was moved to upper or lower end of agenda. 914 // Scroll if item was moved to upper or lower end of agenda.
897 if (clipperPos.y() < mScrollBorderWidth) { 915 if (clipperPos.y() < mScrollBorderWidth) {
898 mScrollUpTimer.start(mScrollDelay); 916 mScrollUpTimer.start(mScrollDelay);
899 } else if (visibleHeight() - clipperPos.y() < 917 } else if (visibleHeight() - clipperPos.y() <
900 mScrollBorderWidth) { 918 mScrollBorderWidth) {
901 mScrollDownTimer.start(mScrollDelay); 919 mScrollDownTimer.start(mScrollDelay);
902 } else { 920 } else {
903 mScrollUpTimer.stop(); 921 mScrollUpTimer.stop();
904 mScrollDownTimer.stop(); 922 mScrollDownTimer.stop();
905 } 923 }
906 924
907 // Move or resize item if necessary 925 // Move or resize item if necessary
908 if (mCurrentCellX != gx || mCurrentCellY != gy) { 926 if (mCurrentCellX != gx || mCurrentCellY != gy) {
909 mItemMoved = true; 927 mItemMoved = true;
910 mActionItem->raise(); 928 mActionItem->raise();
911 if (mActionType == MOVE) { 929 if (mActionType == MOVE) {
912 // Move all items belonging to a multi item 930 // Move all items belonging to a multi item
913 KOAgendaItem *moveItem = mActionItem->firstMultiItem(); 931 KOAgendaItem *moveItem = mActionItem->firstMultiItem();
914 bool isMultiItem = (moveItem || mActionItem->lastMultiItem()); 932 bool isMultiItem = (moveItem || mActionItem->lastMultiItem());
915 if (!moveItem) moveItem = mActionItem; 933 if (!moveItem) moveItem = mActionItem;
916 while (moveItem) { 934 while (moveItem) {
917 int dy; 935 int dy;
918 if (isMultiItem) dy = 0; 936 if (isMultiItem) dy = 0;
919 else dy = gy - mCurrentCellY; 937 else dy = gy - mCurrentCellY;
920 moveItem->moveRelative(gx - mCurrentCellX,dy); 938 moveItem->moveRelative(gx - mCurrentCellX,dy);
921 int x,y; 939 int x,y;
922 gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); 940 gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y);
923 moveItem->resize(mGridSpacingX * moveItem->cellWidth(), 941 moveItem->resize(mGridSpacingX * moveItem->cellWidth(),
924 mGridSpacingY * moveItem->cellHeight()); 942 mGridSpacingY * moveItem->cellHeight());
943 moveItem->raise();
925 moveChild(moveItem,x,y); 944 moveChild(moveItem,x,y);
926 moveItem = moveItem->nextMultiItem(); 945 moveItem = moveItem->nextMultiItem();
927 } 946 }
928 } else if (mActionType == RESIZETOP) { 947 } else if (mActionType == RESIZETOP) {
929 if (mCurrentCellY <= mActionItem->cellYBottom()) { 948 if (mCurrentCellY <= mActionItem->cellYBottom()) {
930 mActionItem->expandTop(gy - mCurrentCellY); 949 mActionItem->expandTop(gy - mCurrentCellY);
931 mActionItem->resize(mActionItem->width(), 950 mActionItem->resize(mActionItem->width(),
932 mGridSpacingY * mActionItem->cellHeight()); 951 mGridSpacingY * mActionItem->cellHeight());
933 int x,y; 952 int x,y;
934 gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); 953 gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y);
935 //moveChild(mActionItem,childX(mActionItem),y); 954 //moveChild(mActionItem,childX(mActionItem),y);
936 QScrollView::moveChild( mActionItem,childX(mActionItem),y ); 955 QScrollView::moveChild( mActionItem,childX(mActionItem),y );
937 } 956 }
938 } else if (mActionType == RESIZEBOTTOM) { 957 } else if (mActionType == RESIZEBOTTOM) {
939 if (mCurrentCellY >= mActionItem->cellYTop()) { 958 if (mCurrentCellY >= mActionItem->cellYTop()) {
940 mActionItem->expandBottom(gy - mCurrentCellY); 959 mActionItem->expandBottom(gy - mCurrentCellY);
941 mActionItem->resize(mActionItem->width(), 960 mActionItem->resize(mActionItem->width(),
942 mGridSpacingY * mActionItem->cellHeight()); 961 mGridSpacingY * mActionItem->cellHeight());
943 } 962 }
944 } else if (mActionType == RESIZELEFT) { 963 } else if (mActionType == RESIZELEFT) {
945 if (mCurrentCellX <= mActionItem->cellXWidth()) { 964 if (mCurrentCellX <= mActionItem->cellXWidth()) {
946 mActionItem->expandLeft(gx - mCurrentCellX); 965 mActionItem->expandLeft(gx - mCurrentCellX);
947 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), 966 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(),
948 mActionItem->height()); 967 mActionItem->height());
949 int x,y; 968 int x,y;
950 gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); 969 gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y);
951 moveChild(mActionItem,x,childY(mActionItem)); 970 moveChild(mActionItem,x,childY(mActionItem));
952 } 971 }
953 } else if (mActionType == RESIZERIGHT) { 972 } else if (mActionType == RESIZERIGHT) {
954 if (mCurrentCellX >= mActionItem->cellX()) { 973 if (mCurrentCellX >= mActionItem->cellX()) {
955 mActionItem->expandRight(gx - mCurrentCellX); 974 mActionItem->expandRight(gx - mCurrentCellX);
956 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), 975 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(),
957 mActionItem->height()); 976 mActionItem->height());
958 } 977 }
959 } 978 }
960 mCurrentCellX = gx; 979 mCurrentCellX = gx;
961 mCurrentCellY = gy; 980 mCurrentCellY = gy;
962 } 981 }
963} 982}
964 983
965void KOAgenda::endItemAction() 984void KOAgenda::endItemAction()
966{ 985{
967 986
968 if ( mItemMoved ) { 987 if ( mItemMoved ) {
969 KOAgendaItem *placeItem = mActionItem->firstMultiItem(); 988 KOAgendaItem *placeItem = mActionItem->firstMultiItem();
970 if ( !placeItem ) { 989 if ( !placeItem ) {
971 placeItem = mActionItem; 990 placeItem = mActionItem;
972 } 991 }
@@ -1199,96 +1218,103 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
1199 item=conflictItems.next() ) { 1218 item=conflictItems.next() ) {
1200 if ( placeItem != item ) { 1219 if ( placeItem != item ) {
1201 KOAgendaItem *item2; 1220 KOAgendaItem *item2;
1202 QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); 1221 QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems();
1203 for ( item2=conflictItems2.first(); item2 != 0; 1222 for ( item2=conflictItems2.first(); item2 != 0;
1204 item2=conflictItems2.next() ) { 1223 item2=conflictItems2.next() ) {
1205 if ( item2->subCells() != maxSubCells) { 1224 if ( item2->subCells() != maxSubCells) {
1206 item2->setSubCells(maxSubCells); 1225 item2->setSubCells(maxSubCells);
1207 if (mAllDayMode) { 1226 if (mAllDayMode) {
1208 item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); 1227 item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth);
1209 } else { 1228 } else {
1210 item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); 1229 item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY);
1211 } 1230 }
1212 int x,y; 1231 int x,y;
1213 gridToContents(item2->cellX(),item2->cellYTop(),x,y); 1232 gridToContents(item2->cellX(),item2->cellYTop(),x,y);
1214 if (mAllDayMode) { 1233 if (mAllDayMode) {
1215 y += item2->subCell() * newSubCellWidth; 1234 y += item2->subCell() * newSubCellWidth;
1216 } else { 1235 } else {
1217 x += item2->subCell() * newSubCellWidth; 1236 x += item2->subCell() * newSubCellWidth;
1218 } 1237 }
1219 moveChild(item2,x,y); 1238 moveChild(item2,x,y);
1220 //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); 1239 //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() );
1221 } 1240 }
1222 } 1241 }
1223 } 1242 }
1224 } 1243 }
1225 } else { 1244 } else {
1226 placeItem->setSubCell(0); 1245 placeItem->setSubCell(0);
1227 placeItem->setSubCells(1); 1246 placeItem->setSubCells(1);
1228 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); 1247 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY);
1229 else placeItem->resize(mGridSpacingX,placeItem->height()); 1248 else placeItem->resize(mGridSpacingX,placeItem->height());
1230 int x,y; 1249 int x,y;
1231 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); 1250 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y);
1232 moveChild(placeItem,x,y); 1251 moveChild(placeItem,x,y);
1233 } 1252 }
1234 placeItem->setConflictItems(conflictItems); 1253 placeItem->setConflictItems(conflictItems);
1235 // for ( item=conflictItems.first(); item != 0; 1254 // for ( item=conflictItems.first(); item != 0;
1236// item=conflictItems.next() ) { 1255// item=conflictItems.next() ) {
1237// //item->updateItem(); 1256// //item->updateItem();
1238// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); 1257// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() );
1239// } 1258// }
1240// placeItem->updateItem(); 1259// placeItem->updateItem();
1241} 1260}
1242 1261
1243void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 1262void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1244{ 1263{
1245 if ( globalFlagBlockAgenda ) 1264 if ( globalFlagBlockAgenda )
1246 return; 1265 return;
1266
1267 if ( mInvalidPixmap ) {
1268 mInvalidPixmap = false;
1269 qDebug("InvalidPixmap ");
1270 QTimer::singleShot( 0, this, SIGNAL( updateViewSignal() ));
1271 return;
1272 }
1247 if ( ! mAllDayMode ) { 1273 if ( ! mAllDayMode ) {
1248 // currently not working for 1274 // currently not working for
1249 1275
1250 //qDebug("KOAgenda::drawContents "); 1276 //qDebug("KOAgenda::drawContents ");
1251 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) 1277 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() )
1252 ;//drawContentsToPainter(); 1278 ;//drawContentsToPainter();
1253 1279
1254 QPaintDevice* pd = p->device(); 1280 QPaintDevice* pd = p->device();
1255 p->end(); 1281 p->end();
1256 int vx, vy; 1282 int vx, vy;
1257 int selectionX = KOGlobals::self()->reverseLayout() ? 1283 int selectionX = KOGlobals::self()->reverseLayout() ?
1258 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1284 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1259 mSelectionCellX * mGridSpacingX; 1285 mSelectionCellX * mGridSpacingX;
1260 contentsToViewport ( cx, cy, vx,vy); 1286 contentsToViewport ( cx, cy, vx,vy);
1261 //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; 1287 //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ;
1262 1288
1263 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { 1289 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) {
1264 if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1290 if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1265 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { 1291 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) {
1266 1292
1267 int vxSel, vySel; 1293 int vxSel, vySel;
1268 contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); 1294 contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel);
1269 int off = mSelectionHeight; 1295 int off = mSelectionHeight;
1270 if ( vySel < 0 ) 1296 if ( vySel < 0 )
1271 off += vySel; 1297 off += vySel;
1272 //qDebug("OFF %d %d %d", off,vySel, vy ); 1298 //qDebug("OFF %d %d %d", off,vySel, vy );
1273 bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); 1299 bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP);
1274 } else { 1300 } else {
1275 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); 1301 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP);
1276 } 1302 }
1277 } 1303 }
1278 if ( mSelectionHeight > 0 ) { 1304 if ( mSelectionHeight > 0 ) {
1279 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); 1305 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
1280 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1306 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1281 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1307 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1282 contentsToViewport ( selectionX, mSelectionYTop, vx,vy); 1308 contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
1283 // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); 1309 // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
1284 int hei = mSelectionHeight; 1310 int hei = mSelectionHeight;
1285 int offset = 0; 1311 int offset = 0;
1286 while ( hei > 0 ) { 1312 while ( hei > 0 ) {
1287 int p_hei = 5; 1313 int p_hei = 5;
1288 if ( hei < 5 ) p_hei = hei; 1314 if ( hei < 5 ) p_hei = hei;
1289 hei -= 5; 1315 hei -= 5;
1290 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); 1316 bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP);
1291 offset += 5; 1317 offset += 5;
1292 } 1318 }
1293 } 1319 }
1294 } 1320 }
@@ -1871,103 +1897,103 @@ void KOAgenda::computeSizes()
1871{ 1897{
1872 if ( globalFlagBlockStartup ) 1898 if ( globalFlagBlockStartup )
1873 return; 1899 return;
1874 int frameOffset = frameWidth() * 2 +1; 1900 int frameOffset = frameWidth() * 2 +1;
1875 if (mAllDayMode) { 1901 if (mAllDayMode) {
1876 mGridSpacingX = (width()-frameOffset) / mColumns; 1902 mGridSpacingX = (width()-frameOffset) / mColumns;
1877 mGridSpacingY = height() - 2 * frameWidth() - 1; 1903 mGridSpacingY = height() - 2 * frameWidth() - 1;
1878 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); 1904 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1);
1879 // mGridSpacingY = height(); 1905 // mGridSpacingY = height();
1880 // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1906 // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1881 1907
1882 KOAgendaItem *item; 1908 KOAgendaItem *item;
1883 int subCellWidth; 1909 int subCellWidth;
1884 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1910 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1885 subCellWidth = mGridSpacingY / item->subCells(); 1911 subCellWidth = mGridSpacingY / item->subCells();
1886 item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); 1912 item->resize(mGridSpacingX * item->cellWidth(),subCellWidth);
1887 moveChild(item,KOGlobals::self()->reverseLayout() ? 1913 moveChild(item,KOGlobals::self()->reverseLayout() ?
1888 (mColumns - 1 - item->cellX()) * mGridSpacingX : 1914 (mColumns - 1 - item->cellX()) * mGridSpacingX :
1889 item->cellX() * mGridSpacingX, 1915 item->cellX() * mGridSpacingX,
1890 item->subCell() * subCellWidth); 1916 item->subCell() * subCellWidth);
1891 } 1917 }
1892 KOPrefs::instance()->mAllDaySize = mGridSpacingY; 1918 KOPrefs::instance()->mAllDaySize = mGridSpacingY;
1893 } else { 1919 } else {
1894 mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns; 1920 mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns;
1895 if (height() > mGridSpacingY * mRows + 1 ) { 1921 if (height() > mGridSpacingY * mRows + 1 ) {
1896 KOPrefs::instance()->mHourSize = ((height())/mRows)+1; 1922 KOPrefs::instance()->mHourSize = ((height())/mRows)+1;
1897 mGridSpacingY = KOPrefs::instance()->mHourSize ; 1923 mGridSpacingY = KOPrefs::instance()->mHourSize ;
1898 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1924 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1899 emit resizedSignal(); 1925 emit resizedSignal();
1900 } else 1926 } else
1901 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1927 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1902 KOAgendaItem *item; 1928 KOAgendaItem *item;
1903 int subCellWidth; 1929 int subCellWidth;
1904 1930
1905 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1931 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1906 subCellWidth = mGridSpacingX / item->subCells(); 1932 subCellWidth = mGridSpacingX / item->subCells();
1907 item->resize(subCellWidth,item->height()); 1933 item->resize(subCellWidth,item->height());
1908 moveChild(item,(KOGlobals::self()->reverseLayout() ? 1934 moveChild(item,(KOGlobals::self()->reverseLayout() ?
1909 (mColumns - 1 - item->cellX()) * mGridSpacingX : 1935 (mColumns - 1 - item->cellX()) * mGridSpacingX :
1910 item->cellX() * mGridSpacingX) + 1936 item->cellX() * mGridSpacingX) +
1911 item->subCell() * subCellWidth,childY(item)); 1937 item->subCell() * subCellWidth,childY(item));
1912 } 1938 }
1913 } 1939 }
1914 int cw = contentsWidth(); 1940 int cw = contentsWidth();
1915 int ch = contentsHeight(); 1941 int ch = contentsHeight();
1916 if ( mAllDayMode ) { 1942 if ( mAllDayMode ) {
1917 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); 1943 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday();
1918 if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) { 1944 if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) {
1919 //qDebug("paintPixAll->resize "); 1945 qDebug("paintPixAll->resize ");
1920 paintPixAll->resize( cw, ch ); 1946 paintPixAll->resize( cw, ch );
1921 } 1947 }
1922 } else { 1948 } else {
1923 QPixmap* paintPix = KOAgendaItem::paintPix(); 1949 QPixmap* paintPix = KOAgendaItem::paintPix();
1924 if ( paintPix->width() < cw || paintPix->height() < ch ) { 1950 if ( paintPix->width() < cw || paintPix->height() < ch ) {
1925 //qDebug("paintPix->resize "); 1951 qDebug("paintPix->resize ");
1926 paintPix->resize( cw , ch ); 1952 paintPix->resize( cw , ch );
1927 } 1953 }
1928 } 1954 }
1929 1955
1930 checkScrollBoundaries(); 1956 checkScrollBoundaries();
1931 marcus_bains(); 1957 marcus_bains();
1932 drawContentsToPainter(); 1958 drawContentsToPainter();
1933 viewport()->repaint(false); 1959 viewport()->repaint(false);
1934} 1960}
1935 1961
1936void KOAgenda::scrollUp() 1962void KOAgenda::scrollUp()
1937{ 1963{
1938 scrollBy(0,-mScrollOffset); 1964 scrollBy(0,-mScrollOffset);
1939} 1965}
1940 1966
1941 1967
1942void KOAgenda::scrollDown() 1968void KOAgenda::scrollDown()
1943{ 1969{
1944 scrollBy(0,mScrollOffset); 1970 scrollBy(0,mScrollOffset);
1945} 1971}
1946 1972
1947void KOAgenda::popupAlarm() 1973void KOAgenda::popupAlarm()
1948{ 1974{
1949 if (!mClickedItem) { 1975 if (!mClickedItem) {
1950 qDebug("KOAgenda::popupAlarm() called without having a clicked item "); 1976 qDebug("KOAgenda::popupAlarm() called without having a clicked item ");
1951 return; 1977 return;
1952 } 1978 }
1953 // TODO: deal correctly with multiple alarms 1979 // TODO: deal correctly with multiple alarms
1954 Alarm* alarm; 1980 Alarm* alarm;
1955 QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); 1981 QPtrList<Alarm> list(mClickedItem->incidence()->alarms());
1956 for(alarm=list.first();alarm;alarm=list.next()) { 1982 for(alarm=list.first();alarm;alarm=list.next()) {
1957 alarm->toggleAlarm(); 1983 alarm->toggleAlarm();
1958 } 1984 }
1959 emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); 1985 emit itemModified( mClickedItem , KOGlobals::EVENTEDITED );
1960 mClickedItem->paintMe( true ); 1986 mClickedItem->paintMe( true );
1961 mClickedItem->repaint( false ); 1987 mClickedItem->repaint( false );
1962} 1988}
1963 1989
1964/* 1990/*
1965 Calculates the minimum width 1991 Calculates the minimum width
1966*/ 1992*/
1967int KOAgenda::minimumWidth() const 1993int KOAgenda::minimumWidth() const
1968{ 1994{
1969 // TODO:: develop a way to dynamically determine the minimum width 1995 // TODO:: develop a way to dynamically determine the minimum width
1970 int min = 100; 1996 int min = 100;
1971 1997
1972 return min; 1998 return min;
1973} 1999}
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index de6acac..5d813b2 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -30,191 +30,195 @@
30#include <qpixmap.h> 30#include <qpixmap.h>
31#include <qguardedptr.h> 31#include <qguardedptr.h>
32 32
33#include "koagendaitem.h" 33#include "koagendaitem.h"
34#include "koeventview.h" 34#include "koeventview.h"
35 35
36class QPopupMenu; 36class QPopupMenu;
37class QTime; 37class QTime;
38class KConfig; 38class KConfig;
39class QFrame; 39class QFrame;
40class KOAgenda; 40class KOAgenda;
41class KCal::Event; 41class KCal::Event;
42class KCal::Todo; 42class KCal::Todo;
43 43
44using namespace KCal; 44using namespace KCal;
45 45
46class MarcusBains : public QFrame { 46class MarcusBains : public QFrame {
47 Q_OBJECT 47 Q_OBJECT
48 public: 48 public:
49 MarcusBains(KOAgenda *agenda=0,const char *name=0); 49 MarcusBains(KOAgenda *agenda=0,const char *name=0);
50 virtual ~MarcusBains(); 50 virtual ~MarcusBains();
51 51
52 public slots: 52 public slots:
53 void updateLocation(bool recalculate=false); 53 void updateLocation(bool recalculate=false);
54 void updateLoc(); 54 void updateLoc();
55 55
56 private: 56 private:
57 int todayColumn(); 57 int todayColumn();
58 QTimer *minutes; 58 QTimer *minutes;
59 QLabel *mTimeBox; 59 QLabel *mTimeBox;
60 KOAgenda *agenda; 60 KOAgenda *agenda;
61 QTime oldTime; 61 QTime oldTime;
62 int oldToday; 62 int oldToday;
63}; 63};
64 64
65 65
66class KOAgenda : public QScrollView 66class KOAgenda : public QScrollView
67{ 67{
68 Q_OBJECT 68 Q_OBJECT
69 public: 69 public:
70 enum MouseActionType { NOP, MOVE, SELECT, 70 enum MouseActionType { NOP, MOVE, SELECT,
71 RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT }; 71 RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT };
72 72
73 KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0, 73 KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0,
74 const char * name=0, WFlags f=0 ); 74 const char * name=0, WFlags f=0 );
75 KOAgenda ( int columns, QWidget * parent=0, 75 KOAgenda ( int columns, QWidget * parent=0,
76 const char * name=0, WFlags f=0 ); 76 const char * name=0, WFlags f=0 );
77 virtual ~KOAgenda(); 77 virtual ~KOAgenda();
78 static bool mInvalidPixmap;
78 79
79 Incidence *selectedIncidence() const; 80 Incidence *selectedIncidence() const;
80 QDate selectedIncidenceDate() const; 81 QDate selectedIncidenceDate() const;
81 82
82 virtual bool eventFilter ( QObject *, QEvent * ); 83 virtual bool eventFilter ( QObject *, QEvent * );
83 84
84 void contentsToGrid (int x, int y, int& gx, int& gy); 85 void contentsToGrid (int x, int y, int& gx, int& gy);
85 void gridToContents (int gx, int gy, int& x, int& y); 86 void gridToContents (int gx, int gy, int& x, int& y);
86 87
87 int timeToY (const QTime &time); 88 int timeToY (const QTime &time);
88 QTime gyToTime (int y); 89 QTime gyToTime (int y);
89 90
90 void setStartHour(int startHour); 91 void setStartHour(int startHour);
91 92
92 KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom); 93 KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom);
93 KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd); 94 KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd);
94 void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, 95 void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
95 int YTop,int YBottom); 96 int YTop,int YBottom);
96 97
97 void changeColumns(int columns); 98 void changeColumns(int columns);
98 99
99 int columns() { return mColumns; } 100 int columns() { return mColumns; }
100 int rows() { return mRows; } 101 int rows() { return mRows; }
101 102
102 int gridSpacingX() const { return mGridSpacingX; } 103 int gridSpacingX() const { return mGridSpacingX; }
103 int gridSpacingY() const { return mGridSpacingY; } 104 int gridSpacingY() const { return mGridSpacingY; }
104 105
105// virtual QSizePolicy sizePolicy() const; 106// virtual QSizePolicy sizePolicy() const;
106 107
107 void clear(); 108 void clear();
108 109
109 void clearSelection(); 110 void clearSelection();
110 void hideUnused(); 111 void hideUnused();
111 112
112 /** Calculates the minimum width */ 113 /** Calculates the minimum width */
113 virtual int minimumWidth() const; 114 virtual int minimumWidth() const;
114 /** Update configuration from preference settings */ 115 /** Update configuration from preference settings */
115 void updateConfig(); 116 void updateConfig();
116 117
117 void checkScrollBoundaries(); 118 void checkScrollBoundaries();
118 119
119 void setHolidayMask(QMemArray<bool> *); 120 void setHolidayMask(QMemArray<bool> *);
120 void setDateList(const DateList &selectedDates); 121 void setDateList(const DateList &selectedDates);
121 DateList dateList() const; 122 DateList dateList() const;
122 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); 123 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false);
123 void finishUpdate(); 124 void finishUpdate();
124 void printSelection(); 125 void printSelection();
125 void storePosition(); 126 void storePosition();
126 void restorePosition(); 127 void restorePosition();
127 void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; } 128 void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; }
129 void shrinkPixmap();
128 130
129 public slots: 131 public slots:
132 void slotContentMove(int,int);
130 void categoryChanged(Incidence * inc); 133 void categoryChanged(Incidence * inc);
131 void slotClearSelection(); 134 void slotClearSelection();
132 void popupMenu(); 135 void popupMenu();
133 void newItem( int ); 136 void newItem( int );
134 void moveChild( QWidget *, int, int ); 137 void moveChild( QWidget *, int, int );
135 void scrollUp(); 138 void scrollUp();
136 void scrollDown(); 139 void scrollDown();
137 void updateTodo( Todo * t, int , bool ); 140 void updateTodo( Todo * t, int , bool );
138 void popupAlarm(); 141 void popupAlarm();
139 142
140 void checkScrollBoundaries(int); 143 void checkScrollBoundaries(int);
141 144
142 /** Deselect selected items. This function does not emit any signals. */ 145 /** Deselect selected items. This function does not emit any signals. */
143 void deselectItem(); 146 void deselectItem();
144 /** Select item. If the argument is 0, the currently selected item gets 147 /** Select item. If the argument is 0, the currently selected item gets
145 deselected. This function emits the itemSelected(bool) signal to inform 148 deselected. This function emits the itemSelected(bool) signal to inform
146 about selection/deseelction of events. */ 149 about selection/deseelction of events. */
147 void selectItem(KOAgendaItem *); 150 void selectItem(KOAgendaItem *);
148 void finishResize(); 151 void finishResize();
149 152
150 signals: 153 signals:
151 void signalClearSelection(); 154 void signalClearSelection();
152 void showDateView( int, int); 155 void showDateView( int, int);
153 void newEventSignal(); 156 void newEventSignal();
154 void newEventSignal(int gx,int gy); 157 void newEventSignal(int gx,int gy);
155 void newTodoSignal(int gx,int gy); 158 void newTodoSignal(int gx,int gy);
156 void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); 159 void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
157 void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); 160 void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
158 void newStartSelectSignal(); 161 void newStartSelectSignal();
159 void showIncidenceSignal(Incidence *); 162 void showIncidenceSignal(Incidence *);
160 void editIncidenceSignal(Incidence *); 163 void editIncidenceSignal(Incidence *);
161 void deleteIncidenceSignal(Incidence *); 164 void deleteIncidenceSignal(Incidence *);
162 void showIncidencePopupSignal(Incidence *); 165 void showIncidencePopupSignal(Incidence *);
163 166
164 void itemModified(KOAgendaItem *item, int ); 167 void itemModified(KOAgendaItem *item, int );
165 void incidenceSelected(Incidence *); 168 void incidenceSelected(Incidence *);
166 169
167 void lowerYChanged(int); 170 void lowerYChanged(int);
168 void upperYChanged(int); 171 void upperYChanged(int);
169 172
170 void startDragSignal(Incidence *); 173 void startDragSignal(Incidence *);
171 void addToCalSignal(Incidence *, Incidence *); 174 void addToCalSignal(Incidence *, Incidence *);
172 void resizedSignal(); 175 void resizedSignal();
176 void updateViewSignal();
173 177
174 protected: 178 protected:
175 KOEventPopupMenu * mAllAgendaPopup; 179 KOEventPopupMenu * mAllAgendaPopup;
176 QPainter mPixPainter; 180 QPainter mPixPainter;
177 QPixmap mPaintPixmap; 181 QPixmap mPaintPixmap;
178 QPixmap mHighlightPixmap; 182 QPixmap mHighlightPixmap;
179 void drawContents(QPainter *p,int cx, int cy, int cw, int ch); 183 void drawContents(QPainter *p,int cx, int cy, int cw, int ch);
180 virtual void resizeEvent ( QResizeEvent * ); 184 virtual void resizeEvent ( QResizeEvent * );
181 185
182 /** Handles mouse events. Called from eventFilter */ 186 /** Handles mouse events. Called from eventFilter */
183 virtual bool eventFilter_mouse ( QObject *, QMouseEvent * ); 187 virtual bool eventFilter_mouse ( QObject *, QMouseEvent * );
184 188
185 /** Start selecting time span. */ 189 /** Start selecting time span. */
186 void startSelectAction(QPoint viewportPos); 190 void startSelectAction(QPoint viewportPos);
187 191
188 /** Select time span. */ 192 /** Select time span. */
189 void performSelectAction(QPoint viewportPos); 193 void performSelectAction(QPoint viewportPos);
190 194
191 /** Emd selecting time span. */ 195 /** Emd selecting time span. */
192 void endSelectAction( bool emitNewEvent = false ); 196 void endSelectAction( bool emitNewEvent = false );
193 197
194 /** Start moving/resizing agenda item */ 198 /** Start moving/resizing agenda item */
195 void startItemAction(QPoint viewportPos); 199 void startItemAction(QPoint viewportPos);
196 200
197 /** Move/resize agenda item */ 201 /** Move/resize agenda item */
198 void performItemAction(QPoint viewportPos); 202 void performItemAction(QPoint viewportPos);
199 203
200 /** End moving/resizing agenda item */ 204 /** End moving/resizing agenda item */
201 void endItemAction(); 205 void endItemAction();
202 206
203 /** Set cursor, when no item action is in progress */ 207 /** Set cursor, when no item action is in progress */
204 void setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos); 208 void setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos);
205 209
206 /** Place agenda item in agenda and adjust other cells if necessary */ 210 /** Place agenda item in agenda and adjust other cells if necessary */
207 void placeSubCells(KOAgendaItem *placeItem); 211 void placeSubCells(KOAgendaItem *placeItem);
208 212
209 /** Process the keyevent, including the ignored keyevents of eventwidgets. 213 /** Process the keyevent, including the ignored keyevents of eventwidgets.
210 * Implements pgup/pgdn and cursor key navigation in the view. 214 * Implements pgup/pgdn and cursor key navigation in the view.
211 */ 215 */
212 void keyPressEvent( QKeyEvent * ); 216 void keyPressEvent( QKeyEvent * );
213 217
214 void calculateWorkingHours(); 218 void calculateWorkingHours();
215 219
216 virtual void contentsMousePressEvent ( QMouseEvent * ); 220 virtual void contentsMousePressEvent ( QMouseEvent * );
217 221
218 private: 222 private:
219 void init(); 223 void init();
220 void marcus_bains(); 224 void marcus_bains();
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 8675ff6..303a92a 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -451,108 +451,105 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
451 451
452 } 452 }
453 } 453 }
454 QRect dr; 454 QRect dr;
455 if ( w + x > parentWidget()->width() ) 455 if ( w + x > parentWidget()->width() )
456 w = parentWidget()->width()-x; 456 w = parentWidget()->width()-x;
457 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); 457 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr );
458 //qDebug("%d %d %d %d ", x, yy, w, h ); 458 //qDebug("%d %d %d %d ", x, yy, w, h );
459 if ( mIncidence->cancelled() ){ 459 if ( mIncidence->cancelled() ){
460 460
461 461
462 small = ( height() < 20 ); 462 small = ( height() < 20 );
463 463
464 if ( ! small ) { 464 if ( ! small ) {
465 QFontMetrics fm ( paint->font() ); 465 QFontMetrics fm ( paint->font() );
466 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); 466 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2);
467 } 467 }
468 468
469 } 469 }
470 pa.end(); 470 pa.end();
471 471
472} 472}
473 473
474QPixmap * KOAgendaItem::paintPix() 474QPixmap * KOAgendaItem::paintPix()
475{ 475{
476 static QPixmap* mPaintPix = 0; 476 static QPixmap* mPaintPix = 0;
477 if ( ! mPaintPix ) { 477 if ( ! mPaintPix ) {
478 int w = QApplication::desktop()->width(); 478 int w = QApplication::desktop()->width();
479 int h = QApplication::desktop()->height(); 479 int h = QApplication::desktop()->height();
480 mPaintPix = new QPixmap(w,h); 480 mPaintPix = new QPixmap(w,h);
481 } 481 }
482 return mPaintPix ; 482 return mPaintPix ;
483} 483}
484QPixmap * KOAgendaItem::paintPixAllday() 484QPixmap * KOAgendaItem::paintPixAllday()
485{ 485{
486 static QPixmap* mPaintPixA = 0; 486 static QPixmap* mPaintPixA = 0;
487 if ( ! mPaintPixA ) { 487 if ( ! mPaintPixA ) {
488 int w = QApplication::desktop()->width(); 488 int w = QApplication::desktop()->width();
489 int h = QApplication::desktop()->height()/5; 489 int h = QApplication::desktop()->height()/5;
490 mPaintPixA = new QPixmap(w,h); 490 mPaintPixA = new QPixmap(w,h);
491 } 491 }
492 return mPaintPixA ; 492 return mPaintPixA ;
493} 493}
494 494
495void KOAgendaItem::repaintItem() 495void KOAgendaItem::repaintItem()
496{ 496{
497 globalFlagBlockAgendaItemPaint = 0; 497 globalFlagBlockAgendaItemPaint = 0;
498 globalFlagBlockAgenda = 0; 498 globalFlagBlockAgenda = 0;
499 //qDebug("AAA ");
500 repaint( false ); 499 repaint( false );
501 //qDebug("BBB ");
502} 500}
503void KOAgendaItem::paintEvent ( QPaintEvent *e ) 501void KOAgendaItem::paintEvent ( QPaintEvent *e )
504{ 502{
505 qDebug("CCC "); 503
506 if ( globalFlagBlockAgendaItemPaint ) 504 if ( globalFlagBlockAgendaItemPaint )
507 return; 505 return;
508 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) 506 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
509 return; 507 return;
510 qDebug("DDD ");
511 int yy; 508 int yy;
512 if ( mAllDay ) 509 if ( mAllDay )
513 yy = y(); 510 yy = y();
514 else 511 else
515 yy = mCellYTop * ( height() / cellHeight() ); 512 yy = mCellYTop * ( height() / cellHeight() );
516 int xx = x(); 513 int xx = x();
517 514
518 if ( xPaintCoord != xx || yPaintCoord != yy || 515 if ( xPaintCoord != xx || yPaintCoord != yy ||
519 wPaintCoord != width() || hPaintCoord != height()) { 516 wPaintCoord != width() || hPaintCoord != height()) {
520 xPaintCoord= xx; 517 xPaintCoord= xx;
521 yPaintCoord = yy; 518 yPaintCoord = yy;
522 wPaintCoord = width(); 519 wPaintCoord = width();
523 hPaintCoord = height(); 520 hPaintCoord = height();
524 globalFlagBlockAgendaItemUpdate = 0; 521 globalFlagBlockAgendaItemUpdate = 0;
525 paintMe( mSelected ); 522 paintMe( mSelected );
526 //qDebug("calling paintMe "); 523 //qDebug("calling paintMe ");
527 globalFlagBlockAgendaItemUpdate = 1; 524 globalFlagBlockAgendaItemUpdate = 1;
528 if ( mSelected ) 525 if ( mSelected )
529 return; 526 return;
530 } 527 }
531 int rx, ry, rw, rh; 528 int rx, ry, rw, rh;
532 rx = e->rect().x(); 529 rx = e->rect().x();
533 ry = e->rect().y(); 530 ry = e->rect().y();
534 rw = e->rect().width(); 531 rw = e->rect().width();
535 rh = e->rect().height(); 532 rh = e->rect().height();
536 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); 533 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
537 534
538 QPixmap* paintFrom ; 535 QPixmap* paintFrom ;
539 if ( mSelected ) { 536 if ( mSelected ) {
540 paintMe( mSelected ); 537 paintMe( mSelected );
541 return; 538 return;
542 } else { 539 } else {
543 if ( mAllDay ) 540 if ( mAllDay )
544 paintFrom = paintPixAllday(); 541 paintFrom = paintPixAllday();
545 else 542 else
546 paintFrom = paintPix(); 543 paintFrom = paintPix();
547 } 544 }
548 xx += rx; 545 xx += rx;
549 546
550 if ( xx < 0 ) { 547 if ( xx < 0 ) {
551 rw = rw + xx; 548 rw = rw + xx;
552 rx -= xx; 549 rx -= xx;
553 xx = 0; 550 xx = 0;
554 if ( rw <= 1 ) { 551 if ( rw <= 1 ) {
555 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); 552 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1());
556 return; 553 return;
557 } 554 }
558 } 555 }
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index f811fba..488d9d4 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -31,97 +31,97 @@
31#endif 31#endif
32#include <qfont.h> 32#include <qfont.h>
33#include <qfontmetrics.h> 33#include <qfontmetrics.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qtooltip.h> 35#include <qtooltip.h>
36#include <qpainter.h> 36#include <qpainter.h>
37#include <qpushbutton.h> 37#include <qpushbutton.h>
38#include <qapplication.h> 38#include <qapplication.h>
39 39
40#include <kapplication.h> 40#include <kapplication.h>
41#include <KDGanttMinimizeSplitter.h> 41#include <KDGanttMinimizeSplitter.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kstandarddirs.h> 43#include <kstandarddirs.h>
44#include <kiconloader.h> 44#include <kiconloader.h>
45#include <klocale.h> 45#include <klocale.h>
46#include <kconfig.h> 46#include <kconfig.h>
47#include <kglobal.h> 47#include <kglobal.h>
48#include "calendarview.h" 48#include "calendarview.h"
49#include "koviewmanager.h" 49#include "koviewmanager.h"
50 50
51#include <libkcal/calendar.h> 51#include <libkcal/calendar.h>
52#include <libkcal/icaldrag.h> 52#include <libkcal/icaldrag.h>
53#include <libkcal/dndfactory.h> 53#include <libkcal/dndfactory.h>
54 54
55#include <kcalendarsystem.h> 55#include <kcalendarsystem.h>
56 56
57#include "koglobals.h" 57#include "koglobals.h"
58#ifndef KORG_NOPLUGINS 58#ifndef KORG_NOPLUGINS
59#include "kocore.h" 59#include "kocore.h"
60#endif 60#endif
61#include "koprefs.h" 61#include "koprefs.h"
62#include "koagenda.h" 62#include "koagenda.h"
63#include "koagendaitem.h" 63#include "koagendaitem.h"
64#ifndef KORG_NOPRINTER 64#ifndef KORG_NOPRINTER
65#include "calprinter.h" 65#include "calprinter.h"
66#endif 66#endif
67 67
68#include "koagendaview.h" 68#include "koagendaview.h"
69//#include "koagendaview.moc" 69//#include "koagendaview.moc"
70 70
71//extern bool globalFlagBlockPainting; 71//extern bool globalFlagBlockPainting;
72extern int globalFlagBlockAgenda; 72extern int globalFlagBlockAgenda;
73extern int globalFlagBlockStartup; 73extern int globalFlagBlockStartup;
74extern int globalFlagBlockAgendaItemPaint; 74extern int globalFlagBlockAgendaItemPaint;
75extern int globalFlagBlockAgendaItemUpdate; 75extern int globalFlagBlockAgendaItemUpdate;
76extern int globalFlagBlockLabel; 76extern int globalFlagBlockLabel;
77using namespace KOrg; 77using namespace KOrg;
78 78
79 79#define IDLETIMEOUT 3
80 80
81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : 81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
82 QScrollView(parent,name,f) 82 QScrollView(parent,name,f)
83{ 83{
84 myPix.resize( 1, 1 ); 84 myPix.resize( 1, 1 );
85 mRows = rows; 85 mRows = rows;
86 86
87 mRedrawNeeded = true; 87 mRedrawNeeded = true;
88 setMinimumHeight( 20 ); 88 setMinimumHeight( 20 );
89 mCellHeight = KOPrefs::instance()->mHourSize*4; 89 mCellHeight = KOPrefs::instance()->mHourSize*4;
90 90
91 enableClipper(true); 91 enableClipper(true);
92 92
93 setHScrollBarMode(AlwaysOff); 93 setHScrollBarMode(AlwaysOff);
94 setVScrollBarMode(AlwaysOff); 94 setVScrollBarMode(AlwaysOff);
95 95
96 resizeContents(50,mRows * mCellHeight); 96 resizeContents(50,mRows * mCellHeight);
97 97
98 viewport()->setBackgroundMode( PaletteBackground ); 98 viewport()->setBackgroundMode( PaletteBackground );
99} 99}
100 100
101void TimeLabels::setCellHeight(int height) 101void TimeLabels::setCellHeight(int height)
102{ 102{
103 mCellHeight = height; 103 mCellHeight = height;
104} 104}
105 105
106/* 106/*
107 Optimization so that only the "dirty" portion of the scroll view 107 Optimization so that only the "dirty" portion of the scroll view
108 is redrawn. Unfortunately, this is not called by default paintEvent() method. 108 is redrawn. Unfortunately, this is not called by default paintEvent() method.
109*/ 109*/
110void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) 110void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
111{ 111{
112 112
113 cx = contentsX() + frameWidth()*2; 113 cx = contentsX() + frameWidth()*2;
114 cw = contentsWidth() ; 114 cw = contentsWidth() ;
115 // end of workaround 115 // end of workaround
116 116
117 int cell = ((int)(cy/mCellHeight)); 117 int cell = ((int)(cy/mCellHeight));
118 int y = cell * mCellHeight; 118 int y = cell * mCellHeight;
119 QFontMetrics fm = fontMetrics(); 119 QFontMetrics fm = fontMetrics();
120 QString hour; 120 QString hour;
121 QString suffix = "am"; 121 QString suffix = "am";
122 int timeHeight = fm.ascent(); 122 int timeHeight = fm.ascent();
123 QFont nFont = font(); 123 QFont nFont = font();
124 p->setFont( font()); 124 p->setFont( font());
125 125
126 if (!KGlobal::locale()->use12Clock()) { 126 if (!KGlobal::locale()->use12Clock()) {
127 suffix = "00"; 127 suffix = "00";
@@ -528,99 +528,122 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
528 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 528 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
529 SIGNAL(editIncidenceSignal(Incidence *))); 529 SIGNAL(editIncidenceSignal(Incidence *)));
530 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 530 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
531 SIGNAL(showIncidenceSignal(Incidence *))); 531 SIGNAL(showIncidenceSignal(Incidence *)));
532 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 532 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
533 SIGNAL(showIncidenceSignal(Incidence *))); 533 SIGNAL(showIncidenceSignal(Incidence *)));
534 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 534 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
535 SIGNAL(deleteIncidenceSignal(Incidence *))); 535 SIGNAL(deleteIncidenceSignal(Incidence *)));
536 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 536 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
537 SIGNAL(deleteIncidenceSignal(Incidence *))); 537 SIGNAL(deleteIncidenceSignal(Incidence *)));
538 538
539 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 539 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
540 SLOT(updateEventDates(KOAgendaItem *, int ))); 540 SLOT(updateEventDates(KOAgendaItem *, int )));
541 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 541 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
542 SLOT(updateEventDates(KOAgendaItem *, int))); 542 SLOT(updateEventDates(KOAgendaItem *, int)));
543 543
544 // event indicator update 544 // event indicator update
545 connect(mAgenda,SIGNAL(lowerYChanged(int)), 545 connect(mAgenda,SIGNAL(lowerYChanged(int)),
546 SLOT(updateEventIndicatorTop(int))); 546 SLOT(updateEventIndicatorTop(int)));
547 connect(mAgenda,SIGNAL(upperYChanged(int)), 547 connect(mAgenda,SIGNAL(upperYChanged(int)),
548 SLOT(updateEventIndicatorBottom(int))); 548 SLOT(updateEventIndicatorBottom(int)));
549 // drag signals 549 // drag signals
550 /* 550 /*
551 connect(mAgenda,SIGNAL(startDragSignal(Event *)), 551 connect(mAgenda,SIGNAL(startDragSignal(Event *)),
552 SLOT(startDrag(Event *))); 552 SLOT(startDrag(Event *)));
553 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), 553 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)),
554 SLOT(startDrag(Event *))); 554 SLOT(startDrag(Event *)));
555 */ 555 */
556 // synchronize selections 556 // synchronize selections
557 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 557 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
558 mAllDayAgenda, SLOT( deselectItem() ) ); 558 mAllDayAgenda, SLOT( deselectItem() ) );
559 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 559 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
560 mAgenda, SLOT( deselectItem() ) ); 560 mAgenda, SLOT( deselectItem() ) );
561 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 561 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
562 SIGNAL( incidenceSelected( Incidence * ) ) ); 562 SIGNAL( incidenceSelected( Incidence * ) ) );
563 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 563 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
564 SIGNAL( incidenceSelected( Incidence * ) ) ); 564 SIGNAL( incidenceSelected( Incidence * ) ) );
565 connect( mAgenda, SIGNAL( resizedSignal() ), 565 connect( mAgenda, SIGNAL( resizedSignal() ),
566 SLOT( updateConfig( ) ) ); 566 SLOT( updateConfig( ) ) );
567 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), 567 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ),
568 SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); 568 SLOT( addToCalSlot(Incidence *, Incidence * ) ) );
569 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), 569 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ),
570 SLOT( addToCalSlot(Incidence * , Incidence *) ) ); 570 SLOT( addToCalSlot(Incidence * , Incidence *) ) );
571 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 571 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
572 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 572 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
573 573
574 connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); 574 connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) );
575 connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); 575 connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) );
576 connect( mAllDayAgenda, SIGNAL( updateViewSignal() ),this, SLOT( fillAgenda()) );
577 connect( mAgenda, SIGNAL( updateViewSignal() ), this, SLOT( fillAgenda()) );
576 578
579 mIdleTimer = new QTimer ( this );;
580 connect(mIdleTimer,SIGNAL(timeout()),SLOT(slotIdleTimeout()));
581}
582void KOAgendaView::slotIdleTimeout()
583{
584 qDebug("SECS TO %d ",mIdleStart.secsTo( QDateTime::currentDateTime() ) );
585 int secsfromstart = mIdleStart.secsTo( QDateTime::currentDateTime() );
586 mIdleTimer->stop();
587 bool isActice = topLevelWidget()->isActiveWindow();
588 qDebug("KO: Active Window %d ", isActice);
589 // we do nothing if we wake up from a suspend
590 if ( secsfromstart > IDLETIMEOUT + 50 && isActice ) {
591 qDebug("KO: Wakeup from suspend ");
592 mIdleTimer->start( IDLETIMEOUT * 1000 );
593 return;
594 }
595 qDebug("KO: Downsizing Pixmaps ");
596 mAgenda->shrinkPixmap();
597 mAllDayAgenda->shrinkPixmap();
598 KOAgendaItem::paintPix()->resize( 20,20);
599 KOAgendaItem::paintPixAllday()->resize( 20,20);
600
577} 601}
578
579void KOAgendaView::toggleAllDay() 602void KOAgendaView::toggleAllDay()
580{ 603{
581 if ( mSplitterAgenda->firstHandle() ) 604 if ( mSplitterAgenda->firstHandle() )
582 mSplitterAgenda->firstHandle()->toggle(); 605 mSplitterAgenda->firstHandle()->toggle();
583} 606}
584void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) 607void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
585{ 608{
586 calendar()->addIncidence( inc ); 609 calendar()->addIncidence( inc );
587 610
588 if ( incOld ) { 611 if ( incOld ) {
589 if ( incOld->typeID() == todoID ) 612 if ( incOld->typeID() == todoID )
590 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); 613 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
591 else 614 else
592 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); 615 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED);
593 } 616 }
594 617
595} 618}
596void KOAgendaView::categoryChanged(Incidence * inc) 619void KOAgendaView::categoryChanged(Incidence * inc)
597{ 620{
598 mAgenda->categoryChanged( inc ); 621 mAgenda->categoryChanged( inc );
599 mAllDayAgenda->categoryChanged( inc ); 622 mAllDayAgenda->categoryChanged( inc );
600} 623}
601KOAgendaView::~KOAgendaView() 624KOAgendaView::~KOAgendaView()
602{ 625{
603 delete mAllAgendaPopup; 626 delete mAllAgendaPopup;
604 //delete mAllDayAgendaPopup; 627 //delete mAllDayAgendaPopup;
605 delete KOAgendaItem::paintPix(); 628 delete KOAgendaItem::paintPix();
606 delete KOAgendaItem::paintPixAllday(); 629 delete KOAgendaItem::paintPixAllday();
607} 630}
608void KOAgendaView::resizeEvent( QResizeEvent* e ) 631void KOAgendaView::resizeEvent( QResizeEvent* e )
609{ 632{
610 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); 633 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width());
611 bool uc = false; 634 bool uc = false;
612 int ow = e->oldSize().width(); 635 int ow = e->oldSize().width();
613 int oh = e->oldSize().height(); 636 int oh = e->oldSize().height();
614 int w = e->size().width(); 637 int w = e->size().width();
615 int h = e->size().height(); 638 int h = e->size().height();
616 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { 639 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) {
617 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) 640 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda )
618 uc = true; 641 uc = true;
619 //qDebug("view changed %d %d %d %d ", ow, oh , w , h); 642 //qDebug("view changed %d %d %d %d ", ow, oh , w , h);
620 } 643 }
621 mUpcomingWidth = e->size().width() ; 644 mUpcomingWidth = e->size().width() ;
622 if ( mBlockUpdating || uc ) { 645 if ( mBlockUpdating || uc ) {
623 mBlockUpdating = false; 646 mBlockUpdating = false;
624 //mAgenda->setMinimumSize(800 , 600 ); 647 //mAgenda->setMinimumSize(800 , 600 );
625 //qDebug("mAgenda->resize+++++++++++++++ "); 648 //qDebug("mAgenda->resize+++++++++++++++ ");
626 updateConfig(); 649 updateConfig();
@@ -1253,140 +1276,142 @@ void KOAgendaView::fillAgenda()
1253 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); 1276 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue);
1254 if ( fillIn ) { 1277 if ( fillIn ) {
1255 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue 1278 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue
1256 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1279 if ( KOPrefs::instance()->mShowTodoInAgenda )
1257 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); 1280 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol);
1258 } 1281 }
1259 else { 1282 else {
1260 QDateTime dt; 1283 QDateTime dt;
1261 if ( todo->hasCompletedDate() ) 1284 if ( todo->hasCompletedDate() )
1262 dt = todo->completed(); 1285 dt = todo->completed();
1263 else 1286 else
1264 dt = todo->dtDue();; 1287 dt = todo->dtDue();;
1265 1288
1266 1289
1267 int endY = mAgenda->timeToY(dt.time()) - 1; 1290 int endY = mAgenda->timeToY(dt.time()) - 1;
1268 int hi = (18/KOPrefs::instance()->mHourSize); 1291 int hi = (18/KOPrefs::instance()->mHourSize);
1269 //qDebug("hei %d ",KOPrefs::instance()->mHourSize); 1292 //qDebug("hei %d ",KOPrefs::instance()->mHourSize);
1270 int startY = endY -hi; 1293 int startY = endY -hi;
1271 1294
1272 mAgenda->insertItem(todo,currentDate,curCol,startY,endY); 1295 mAgenda->insertItem(todo,currentDate,curCol,startY,endY);
1273 1296
1274 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1297 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1275 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1298 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1276 } 1299 }
1277 } 1300 }
1278 } 1301 }
1279 // ---------- display Todos] -------------- 1302 // ---------- display Todos] --------------
1280 1303
1281 ++curCol; 1304 ++curCol;
1282 } 1305 }
1283 mAgenda->hideUnused(); 1306 mAgenda->hideUnused();
1284 mAllDayAgenda->hideUnused(); 1307 mAllDayAgenda->hideUnused();
1285 mAgenda->checkScrollBoundaries(); 1308 mAgenda->checkScrollBoundaries();
1286 deleteSelectedDateTime(); 1309 deleteSelectedDateTime();
1287 createDayLabels(); 1310 createDayLabels();
1288 emit incidenceSelected( 0 ); 1311 emit incidenceSelected( 0 );
1289 1312
1290 if ( globalFlagBlockAgenda == 2 ) { 1313 if ( globalFlagBlockAgenda == 2 ) {
1291 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 1314 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
1292 setStartHour( KOPrefs::instance()->mDayBegins ); 1315 setStartHour( KOPrefs::instance()->mDayBegins );
1293 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 1316 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
1294 setStartHour( QTime::currentTime ().hour() ); 1317 setStartHour( QTime::currentTime ().hour() );
1295 } 1318 }
1296 qApp->processEvents(); 1319 qApp->processEvents();
1297 globalFlagBlockAgenda = 0; 1320 globalFlagBlockAgenda = 0;
1298 mAllDayAgenda->drawContentsToPainter(); 1321 mAllDayAgenda->drawContentsToPainter();
1299 mAgenda->drawContentsToPainter(); 1322 mAgenda->drawContentsToPainter();
1300 repaintAgenda(); 1323 repaintAgenda();
1324 mIdleTimer->start ( IDLETIMEOUT *1000 );
1325 mIdleStart = QDateTime::currentDateTime();
1301 onlyOne = false; 1326 onlyOne = false;
1302} 1327}
1303void KOAgendaView::repaintAgenda() 1328void KOAgendaView::repaintAgenda()
1304{ 1329{
1305 mAgenda->viewport()->repaint( false ); 1330 mAgenda->viewport()->repaint( false );
1306 mAllDayAgenda->viewport()->repaint( false ); 1331 mAllDayAgenda->viewport()->repaint( false );
1307 mAgenda->finishUpdate(); 1332 mAgenda->finishUpdate();
1308 mAllDayAgenda->finishUpdate(); 1333 mAllDayAgenda->finishUpdate();
1309} 1334}
1310 1335
1311 1336
1312void KOAgendaView::clearView() 1337void KOAgendaView::clearView()
1313{ 1338{
1314 mAllDayAgenda->clear(); 1339 mAllDayAgenda->clear();
1315 mAgenda->clear(); 1340 mAgenda->clear();
1316} 1341}
1317void KOAgendaView::clearList() 1342void KOAgendaView::clearList()
1318{ 1343{
1319 clearView(); 1344 clearView();
1320 mAllDayAgenda->hideUnused(); 1345 mAllDayAgenda->hideUnused();
1321 mAgenda->hideUnused(); 1346 mAgenda->hideUnused();
1322} 1347}
1323 1348
1324void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1349void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1325 const QDate &td) 1350 const QDate &td)
1326{ 1351{
1327#ifndef KORG_NOPRINTER 1352#ifndef KORG_NOPRINTER
1328 if (fd == td) 1353 if (fd == td)
1329 calPrinter->preview(CalPrinter::Day, fd, td); 1354 calPrinter->preview(CalPrinter::Day, fd, td);
1330 else 1355 else
1331 calPrinter->preview(CalPrinter::Week, fd, td); 1356 calPrinter->preview(CalPrinter::Week, fd, td);
1332#endif 1357#endif
1333} 1358}
1334 1359
1335// void KOAgendaView::updateMovedTodo() 1360// void KOAgendaView::updateMovedTodo()
1336// { 1361// {
1337// // updateConfig(); 1362// // updateConfig();
1338// // emit updateTodoViews(); 1363// // emit updateTodoViews();
1339// } 1364// }
1340 1365
1341void KOAgendaView::slotShowDateView( int mode , int d ) 1366void KOAgendaView::slotShowDateView( int mode , int d )
1342{ 1367{
1343 if ( d >= mSelectedDates.count() ) { 1368 if ( d >= mSelectedDates.count() ) {
1344 qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() ); 1369 qDebug("KOAgendaView::slotShowDateView datecounterror %d %d ", d, mSelectedDates.count() );
1345 1370
1346 } else { 1371 } else {
1347 QDate day = mSelectedDates[d]; 1372 QDate day = mSelectedDates[d];
1348 emit showDateView(mode , day ); 1373 emit showDateView(mode , day );
1349 } 1374 }
1350 1375
1351} 1376}
1352void KOAgendaView::newEvent(int gx, int gy) 1377void KOAgendaView::newEvent(int gx, int gy)
1353{ 1378{
1354 if (!mSelectedDates.count()) return; 1379 if (!mSelectedDates.count()) return;
1355 1380
1356 QDate day = mSelectedDates[gx]; 1381 QDate day = mSelectedDates[gx];
1357 1382
1358 QTime time = mAgenda->gyToTime(gy); 1383 QTime time = mAgenda->gyToTime(gy);
1359 QDateTime dt(day,time); 1384 QDateTime dt(day,time);
1360 // if ( dt < QDateTime::currentDateTime () ) 1385 // if ( dt < QDateTime::currentDateTime () )
1361 // dt = QDateTime::currentDateTime ().addSecs( 3600 ); 1386 // dt = QDateTime::currentDateTime ().addSecs( 3600 );
1362 emit newEventSignal(dt); 1387 emit newEventSignal(dt);
1363} 1388}
1364 1389
1365void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) 1390void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd)
1366{ 1391{
1367 if (!mSelectedDates.count()) return; 1392 if (!mSelectedDates.count()) return;
1368 1393
1369 QDate dayStart = mSelectedDates[gxStart]; 1394 QDate dayStart = mSelectedDates[gxStart];
1370 QDate dayEnd = mSelectedDates[gxEnd]; 1395 QDate dayEnd = mSelectedDates[gxEnd];
1371 1396
1372 QTime timeStart = mAgenda->gyToTime(gyStart); 1397 QTime timeStart = mAgenda->gyToTime(gyStart);
1373 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); 1398 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 );
1374 1399
1375 QDateTime dtStart(dayStart,timeStart); 1400 QDateTime dtStart(dayStart,timeStart);
1376 QDateTime dtEnd(dayEnd,timeEnd); 1401 QDateTime dtEnd(dayEnd,timeEnd);
1377 1402
1378 emit newEventSignal(dtStart,dtEnd); 1403 emit newEventSignal(dtStart,dtEnd);
1379} 1404}
1380 1405
1381void KOAgendaView::newEventAllDay(int gx, int ) 1406void KOAgendaView::newEventAllDay(int gx, int )
1382{ 1407{
1383 if (!mSelectedDates.count()) return; 1408 if (!mSelectedDates.count()) return;
1384 1409
1385 QDate day = mSelectedDates[gx]; 1410 QDate day = mSelectedDates[gx];
1386 1411
1387 emit newEventSignal(day); 1412 emit newEventSignal(day);
1388} 1413}
1389void KOAgendaView::newTodoAllDay(int gx, int ) 1414void KOAgendaView::newTodoAllDay(int gx, int )
1390{ 1415{
1391 if (!mSelectedDates.count()) return; 1416 if (!mSelectedDates.count()) return;
1392 1417
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index a1cf308..effd7a3 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -165,130 +165,133 @@ class KOAgendaView : public KOEventView {
165 virtual DateList selectedDates(); 165 virtual DateList selectedDates();
166 166
167 /** Remove all events from view */ 167 /** Remove all events from view */
168 void clearView(); 168 void clearView();
169 void clearList(); 169 void clearList();
170 KOAgenda *agenda() { return mAgenda;} 170 KOAgenda *agenda() { return mAgenda;}
171 virtual void printPreview(CalPrinter *calPrinter, 171 virtual void printPreview(CalPrinter *calPrinter,
172 const QDate &, const QDate &); 172 const QDate &, const QDate &);
173 173
174 /** start-datetime of selection */ 174 /** start-datetime of selection */
175 QDateTime selectionStart() {return mTimeSpanBegin;} 175 QDateTime selectionStart() {return mTimeSpanBegin;}
176 /** end-datetime of selection */ 176 /** end-datetime of selection */
177 QDateTime selectionEnd() {return mTimeSpanEnd;} 177 QDateTime selectionEnd() {return mTimeSpanEnd;}
178 /** returns true if selection is for whole day */ 178 /** returns true if selection is for whole day */
179 bool selectedIsAllDay() {return mTimeSpanInAllDay;} 179 bool selectedIsAllDay() {return mTimeSpanInAllDay;}
180 /** make selected start/end invalid */ 180 /** make selected start/end invalid */
181 void deleteSelectedDateTime(); 181 void deleteSelectedDateTime();
182 void repaintAgenda(); 182 void repaintAgenda();
183 public slots: 183 public slots:
184 void setInitStartHour(); 184 void setInitStartHour();
185 virtual void updateView(); 185 virtual void updateView();
186 virtual void updateConfig(); 186 virtual void updateConfig();
187 virtual void showDates(const QDate &start, const QDate &end); 187 virtual void showDates(const QDate &start, const QDate &end);
188 virtual void showEvents(QPtrList<Event> eventList); 188 virtual void showEvents(QPtrList<Event> eventList);
189 189
190 void updateTodo( Todo *, int ); 190 void updateTodo( Todo *, int );
191 void changeEventDisplay(Event *, int); 191 void changeEventDisplay(Event *, int);
192 192
193 void clearSelection(); 193 void clearSelection();
194 194
195 void newTodo(int gx,int gy); 195 void newTodo(int gx,int gy);
196 void newEvent(int gx,int gy); 196 void newEvent(int gx,int gy);
197 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); 197 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd);
198 void newEventAllDay(int gx, int gy); 198 void newEventAllDay(int gx, int gy);
199 void newTodoAllDay(int gx, int gy); 199 void newTodoAllDay(int gx, int gy);
200 200
201 void startDrag(Event *); 201 void startDrag(Event *);
202 202
203 void readSettings(); 203 void readSettings();
204 void readSettings(KConfig *); 204 void readSettings(KConfig *);
205 void writeSettings(KConfig *); 205 void writeSettings(KConfig *);
206 206
207 void setContentsPos(int y); 207 void setContentsPos(int y);
208 208
209 void scrollOneHourUp(); 209 void scrollOneHourUp();
210 void scrollOneHourDown(); 210 void scrollOneHourDown();
211 void addToCalSlot(Incidence *, Incidence *); 211 void addToCalSlot(Incidence *, Incidence *);
212 void slotShowDateView( int, int ); 212 void slotShowDateView( int, int );
213 void fillAgenda();
213 214
214 signals: 215 signals:
215 void showDateView( int, QDate ); 216 void showDateView( int, QDate );
216 void newTodoSignal( QDateTime ,bool ); 217 void newTodoSignal( QDateTime ,bool );
217 void toggleExpand(); 218 void toggleExpand();
218 void selectWeekNum( int ); 219 void selectWeekNum( int );
219 void todoMoved( Todo *, int ); 220 void todoMoved( Todo *, int );
220 void incidenceChanged(Incidence * , int ); 221 void incidenceChanged(Incidence * , int );
221 // void cloneIncidenceSignal(Incidence *); 222 // void cloneIncidenceSignal(Incidence *);
222 223
223 protected: 224 protected:
224 KOAgendaButton* getNewDaylabel(); 225 KOAgendaButton* getNewDaylabel();
225 bool mBlockUpdating; 226 bool mBlockUpdating;
226 int mUpcomingWidth; 227 int mUpcomingWidth;
227 /** Fill agenda beginning with date startDate */ 228 /** Fill agenda beginning with date startDate */
228 void fillAgenda(const QDate &startDate); 229 void fillAgenda(const QDate &startDate);
229 void resizeEvent( QResizeEvent* e ); 230 void resizeEvent( QResizeEvent* e );
230 /** Fill agenda using the current set value for the start date */ 231 /** Fill agenda using the current set value for the start date */
231 void fillAgenda();
232 232
233 /** Create labels for the selected dates. */ 233 /** Create labels for the selected dates. */
234 void createDayLabels(); 234 void createDayLabels();
235 235
236 /** 236 /**
237 Set the masks on the agenda widgets indicating, which days are holidays. 237 Set the masks on the agenda widgets indicating, which days are holidays.
238 */ 238 */
239 void setHolidayMasks(); 239 void setHolidayMasks();
240 240
241 protected slots: 241 protected slots:
242 void slotIdleTimeout();
242 void categoryChanged( Incidence * ); 243 void categoryChanged( Incidence * );
243 void slotDaylabelClicked( int ); 244 void slotDaylabelClicked( int );
244 /** Update event belonging to agenda item */ 245 /** Update event belonging to agenda item */
245 void updateEventDates(KOAgendaItem *item, int mode = -1); 246 void updateEventDates(KOAgendaItem *item, int mode = -1);
246 //void updateMovedTodo(); 247 //void updateMovedTodo();
247 248
248 void updateEventIndicatorTop(int newY); 249 void updateEventIndicatorTop(int newY);
249 void updateEventIndicatorBottom(int newY); 250 void updateEventIndicatorBottom(int newY);
250 251
251 /** Updates data for selected timespan */ 252 /** Updates data for selected timespan */
252 void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); 253 void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd);
253 /** Updates data for selected timespan for all day event*/ 254 /** Updates data for selected timespan for all day event*/
254 void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); 255 void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd);
255 256
256 private: 257 private:
258 QTimer* mIdleTimer;
259 QDateTime mIdleStart;
257 // view widgets 260 // view widgets
258 QFrame *mDayLabels; 261 QFrame *mDayLabels;
259 QHBox *mDayLabelsFrame; 262 QHBox *mDayLabelsFrame;
260 QBoxLayout *mLayoutDayLabels; 263 QBoxLayout *mLayoutDayLabels;
261 QFrame *mAllDayFrame; 264 QFrame *mAllDayFrame;
262 KOAgenda *mAllDayAgenda; 265 KOAgenda *mAllDayAgenda;
263 KOAgenda *mAgenda; 266 KOAgenda *mAgenda;
264 TimeLabels *mTimeLabels; 267 TimeLabels *mTimeLabels;
265 QWidget *mDummyAllDayLeft; 268 QWidget *mDummyAllDayLeft;
266 269
267 KDGanttMinimizeSplitter* mSplitterAgenda; 270 KDGanttMinimizeSplitter* mSplitterAgenda;
268 QPushButton *mExpandButton; 271 QPushButton *mExpandButton;
269 272
270 DateList mSelectedDates; // List of dates to be displayed 273 DateList mSelectedDates; // List of dates to be displayed
271 int mViewType; 274 int mViewType;
272 275
273 bool mWeekStartsMonday; 276 bool mWeekStartsMonday;
274 int mStartHour; 277 int mStartHour;
275 278
276 KOEventPopupMenu *mAllAgendaPopup; 279 KOEventPopupMenu *mAllAgendaPopup;
277 //KOEventPopupMenu *mAllDayAgendaPopup; 280 //KOEventPopupMenu *mAllDayAgendaPopup;
278 281
279 EventIndicator *mEventIndicatorTop; 282 EventIndicator *mEventIndicatorTop;
280 EventIndicator *mEventIndicatorBottom; 283 EventIndicator *mEventIndicatorBottom;
281 284
282 QMemArray<int> mMinY; 285 QMemArray<int> mMinY;
283 QMemArray<int> mMaxY; 286 QMemArray<int> mMaxY;
284 287
285 QMemArray<bool> mHolidayMask; 288 QMemArray<bool> mHolidayMask;
286 289
287 QPtrList<KOAgendaButton> mDayLabelsList; 290 QPtrList<KOAgendaButton> mDayLabelsList;
288 QDateTime mTimeSpanBegin; 291 QDateTime mTimeSpanBegin;
289 QDateTime mTimeSpanEnd; 292 QDateTime mTimeSpanEnd;
290 bool mTimeSpanInAllDay; 293 bool mTimeSpanInAllDay;
291 void keyPressEvent ( QKeyEvent * e ); 294 void keyPressEvent ( QKeyEvent * e );
292}; 295};
293 296
294#endif // KOAGENDAVIEW_H 297#endif // KOAGENDAVIEW_H