author | zautrix <zautrix> | 2005-07-05 07:37:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-05 07:37:53 (UTC) |
commit | 28ca4c37fb0e131b2978584992840b3fdca21d3e (patch) (unidiff) | |
tree | fb4f7e51c0995b71e2a26a7300747b6b1b3acb23 | |
parent | 5992ea9025ebddde8be72322c90aac8edeaf4d1c (diff) | |
download | kdepimpi-28ca4c37fb0e131b2978584992840b3fdca21d3e.zip kdepimpi-28ca4c37fb0e131b2978584992840b3fdca21d3e.tar.gz kdepimpi-28ca4c37fb0e131b2978584992840b3fdca21d3e.tar.bz2 |
fixesss
-rw-r--r-- | korganizer/koagenda.cpp | 30 | ||||
-rw-r--r-- | korganizer/koagenda.h | 4 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 5 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 31 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 5 |
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 | |||
@@ -39,48 +39,49 @@ | |||
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; |
58 | extern int globalFlagBlockAgenda; | 58 | extern int globalFlagBlockAgenda; |
59 | extern int globalFlagBlockAgendaItemPaint; | 59 | extern int globalFlagBlockAgendaItemPaint; |
60 | extern int globalFlagBlockAgendaItemUpdate; | 60 | extern int globalFlagBlockAgendaItemUpdate; |
61 | extern int globalFlagBlockStartup; | 61 | extern int globalFlagBlockStartup; |
62 | 62 | ||
63 | bool KOAgenda::mInvalidPixmap = false; | ||
63 | //////////////////////////////////////////////////////////////////////////// | 64 | //////////////////////////////////////////////////////////////////////////// |
64 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) | 65 | MarcusBains::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 | ||
85 | MarcusBains::~MarcusBains() | 86 | MarcusBains::~MarcusBains() |
86 | { | 87 | { |
@@ -157,48 +158,49 @@ void MarcusBains::updateLocation(bool recalculate) | |||
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 | */ |
166 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | 167 | KOAgenda::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 | */ |
187 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : | 189 | KOAgenda::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 | ||
@@ -296,50 +298,66 @@ void KOAgenda::init() | |||
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 | ||
326 | void KOAgenda::shrinkPixmap() | ||
327 | { | ||
328 | mPaintPixmap.resize( 20,20); | ||
329 | mInvalidPixmap = true; | ||
330 | } | ||
331 | void KOAgenda::slotContentMove(int,int) | ||
332 | { | ||
333 | if ( mActionType == NOP ) | ||
334 | slotClearSelection(); | ||
335 | if ( mSelectedItem && !mActionItem ) { | ||
336 | deselectItem(); | ||
337 | emit incidenceSelected( 0 ); | ||
338 | } | ||
339 | } | ||
322 | void KOAgenda::clear() | 340 | void 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 | ||
334 | void KOAgenda::clearSelection() | 352 | void 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 | ||
341 | void KOAgenda::marcus_bains() | 359 | void KOAgenda::marcus_bains() |
342 | { | 360 | { |
343 | if(mMarcusBains) mMarcusBains->updateLocation(true); | 361 | if(mMarcusBains) mMarcusBains->updateLocation(true); |
344 | } | 362 | } |
345 | 363 | ||
@@ -901,48 +919,49 @@ void KOAgenda::performItemAction(QPoint viewportPos) | |||
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()); |
@@ -1223,48 +1242,55 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | |||
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 | ||
1243 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | 1262 | void 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 ) |
@@ -1895,55 +1921,55 @@ void KOAgenda::computeSizes() | |||
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 | ||
1936 | void KOAgenda::scrollUp() | 1962 | void KOAgenda::scrollUp() |
1937 | { | 1963 | { |
1938 | scrollBy(0,-mScrollOffset); | 1964 | scrollBy(0,-mScrollOffset); |
1939 | } | 1965 | } |
1940 | 1966 | ||
1941 | 1967 | ||
1942 | void KOAgenda::scrollDown() | 1968 | void KOAgenda::scrollDown() |
1943 | { | 1969 | { |
1944 | scrollBy(0,mScrollOffset); | 1970 | scrollBy(0,mScrollOffset); |
1945 | } | 1971 | } |
1946 | 1972 | ||
1947 | void KOAgenda::popupAlarm() | 1973 | void KOAgenda::popupAlarm() |
1948 | { | 1974 | { |
1949 | if (!mClickedItem) { | 1975 | if (!mClickedItem) { |
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h index de6acac..5d813b2 100644 --- a/korganizer/koagenda.h +++ b/korganizer/koagenda.h | |||
@@ -54,48 +54,49 @@ class MarcusBains : public QFrame { | |||
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 | ||
66 | class KOAgenda : public QScrollView | 66 | class 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 | ||
@@ -104,93 +105,96 @@ class KOAgenda : public QScrollView | |||
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 | ||
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 8675ff6..303a92a 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -475,60 +475,57 @@ QPixmap * 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 | } |
484 | QPixmap * KOAgendaItem::paintPixAllday() | 484 | QPixmap * 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 | ||
495 | void KOAgendaItem::repaintItem() | 495 | void 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 | } |
503 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) | 501 | void 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(); |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index f811fba..488d9d4 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -55,49 +55,49 @@ | |||
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; |
72 | extern int globalFlagBlockAgenda; | 72 | extern int globalFlagBlockAgenda; |
73 | extern int globalFlagBlockStartup; | 73 | extern int globalFlagBlockStartup; |
74 | extern int globalFlagBlockAgendaItemPaint; | 74 | extern int globalFlagBlockAgendaItemPaint; |
75 | extern int globalFlagBlockAgendaItemUpdate; | 75 | extern int globalFlagBlockAgendaItemUpdate; |
76 | extern int globalFlagBlockLabel; | 76 | extern int globalFlagBlockLabel; |
77 | using namespace KOrg; | 77 | using namespace KOrg; |
78 | 78 | ||
79 | 79 | #define IDLETIMEOUT 3 | |
80 | 80 | ||
81 | TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : | 81 | TimeLabels::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 | ||
101 | void TimeLabels::setCellHeight(int height) | 101 | void TimeLabels::setCellHeight(int height) |
102 | { | 102 | { |
103 | mCellHeight = height; | 103 | mCellHeight = height; |
@@ -552,51 +552,74 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
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 | } | ||
582 | void 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 | |||
579 | void KOAgendaView::toggleAllDay() | 602 | void KOAgendaView::toggleAllDay() |
580 | { | 603 | { |
581 | if ( mSplitterAgenda->firstHandle() ) | 604 | if ( mSplitterAgenda->firstHandle() ) |
582 | mSplitterAgenda->firstHandle()->toggle(); | 605 | mSplitterAgenda->firstHandle()->toggle(); |
583 | } | 606 | } |
584 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 607 | void 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 | } |
596 | void KOAgendaView::categoryChanged(Incidence * inc) | 619 | void KOAgendaView::categoryChanged(Incidence * inc) |
597 | { | 620 | { |
598 | mAgenda->categoryChanged( inc ); | 621 | mAgenda->categoryChanged( inc ); |
599 | mAllDayAgenda->categoryChanged( inc ); | 622 | mAllDayAgenda->categoryChanged( inc ); |
600 | } | 623 | } |
601 | KOAgendaView::~KOAgendaView() | 624 | KOAgendaView::~KOAgendaView() |
602 | { | 625 | { |
@@ -1277,92 +1300,94 @@ void KOAgendaView::fillAgenda() | |||
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 | } |
1303 | void KOAgendaView::repaintAgenda() | 1328 | void 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 | ||
1312 | void KOAgendaView::clearView() | 1337 | void KOAgendaView::clearView() |
1313 | { | 1338 | { |
1314 | mAllDayAgenda->clear(); | 1339 | mAllDayAgenda->clear(); |
1315 | mAgenda->clear(); | 1340 | mAgenda->clear(); |
1316 | } | 1341 | } |
1317 | void KOAgendaView::clearList() | 1342 | void KOAgendaView::clearList() |
1318 | { | 1343 | { |
1319 | clearView(); | 1344 | clearView(); |
1320 | mAllDayAgenda->hideUnused(); | 1345 | mAllDayAgenda->hideUnused(); |
1321 | mAgenda->hideUnused(); | 1346 | mAgenda->hideUnused(); |
1322 | } | 1347 | } |
1323 | 1348 | ||
1324 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1349 | void 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 | ||
1341 | void KOAgendaView::slotShowDateView( int mode , int d ) | 1366 | void 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 | } |
1352 | void KOAgendaView::newEvent(int gx, int gy) | 1377 | void 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 | ||
1365 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) | 1390 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) |
1366 | { | 1391 | { |
1367 | if (!mSelectedDates.count()) return; | 1392 | if (!mSelectedDates.count()) return; |
1368 | 1393 | ||
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index a1cf308..effd7a3 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -189,92 +189,95 @@ class KOAgendaView : public KOEventView { | |||
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; |