-rw-r--r-- | korganizer/koagenda.cpp | 30 |
1 files changed, 28 insertions, 2 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) { |