-rw-r--r-- | korganizer/koagenda.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 662576f..92c1cd6 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -72,33 +72,33 @@ MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); minutes->start(0, true); mTimeBox = new QLabel(this); mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); QPalette pal = mTimeBox->palette(); pal.setColor(QColorGroup::Foreground, Qt::red); mTimeBox->setPalette(pal); //mTimeBox->setAutoMask(true); agenda->addChild(mTimeBox); oldToday = -1; } MarcusBains::~MarcusBains() { - delete minutes; + //delete minutes; } int MarcusBains::todayColumn() { QDate currentDate = QDate::currentDate(); DateList dateList = agenda->dateList(); DateList::ConstIterator it; int col = 0; for(it = dateList.begin(); it != dateList.end(); ++it) { if((*it) == currentDate) return KOGlobals::self()->reverseLayout() ? agenda->columns() - 1 - col : col; ++col; } @@ -138,36 +138,37 @@ void MarcusBains::updateLocation(bool recalculate) agenda->moveChild(this, x, y); raise(); if(recalculate) //mTimeBox->setFont(QFont("helvetica",10)); mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); mTimeBox->adjustSize(); // the -2 below is there because there is a bug in this program // somewhere, where the last column of this widget is a few pixels // narrower than the other columns. int offs = (today==agenda->columns()-1) ? -4 : 0; agenda->moveChild(mTimeBox, x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, y-mTimeBox->height()); - mTimeBox->raise(); //mTimeBox->setAutoMask(true); - minutes->start(5000,true); + int secs = QTime::currentTime().second(); + qDebug("second %d ", secs ); + minutes->start( (60 - secs +1)*1000 ,true); } //////////////////////////////////////////////////////////////////////////// /* Create an agenda widget with rows rows and columns columns. */ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, const char *name,WFlags f) : QScrollView(parent,name,f) { mAllAgendaPopup = 0; mColumns = columns; @@ -429,33 +430,33 @@ void KOAgenda::popupMenu() } void KOAgenda::categoryChanged(Incidence * inc) { KOAgendaItem *item; for ( item=mItems.first(); item != 0; item=mItems.next() ) { if ( item->incidence() == inc ) { item->initColor (); item->updateItem(); } } } bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) { if ( mInvalidPixmap ) { mInvalidPixmap = false; - qDebug("InvalidPixmap "); + qDebug("KO: Upsizing Pixmaps "); computeSizes(); emit updateViewSignal(); return true; } emit sendPing(); static int startX = 0; static int startY = 0; int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); static bool blockMoving = true; //qDebug("KOAgenda::eventFilter_mous "); if ( object == mNewItemPopup ) { //qDebug("mNewItemPopup "); if ( me->type() == QEvent::MouseButtonRelease ) { mNewItemPopup->removeEventFilter( this ); int dX = me->globalPos().x() - mPopupPos.x();; @@ -1263,33 +1264,33 @@ void KOAgenda::placeSubCells(KOAgendaItem *placeItem) placeItem->setConflictItems(conflictItems); // for ( item=conflictItems.first(); item != 0; // item=conflictItems.next() ) { // //item->updateItem(); // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); // } // placeItem->updateItem(); } void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) { if ( globalFlagBlockAgenda ) return; if ( mInvalidPixmap ) { mInvalidPixmap = false; - qDebug("InvalidPixmap "); + qDebug("KO: Upsizing Pixmaps "); computeSizes(); emit updateViewSignal(); return; } if ( ! mAllDayMode ) { // currently not working for //qDebug("KOAgenda::drawContents "); #if 0 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { qDebug("WAU "); drawContentsToPainter(); } #endif QPaintDevice* pd = p->device(); p->end(); @@ -1404,33 +1405,33 @@ void KOAgenda::finishUpdate() } for ( item=mItems.first(); item != 0; item=mItems.next() ) { if ( !item->isVisible() ) item->show(); } globalFlagBlockAgendaItemUpdate = 0; for ( item=mItems.first(); item != 0; item=mItems.next() ) { item->repaintMe( ); } globalFlagBlockAgendaItemUpdate = 1; qApp->processEvents(); globalFlagBlockAgendaItemPaint = 0; for ( item=mItems.first(); item != 0; item=mItems.next() ) { item->repaint( false ); } - + marcus_bains(); } /* Draw grid in the background of the agenda. */ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) { if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) return; if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) return; int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); if ( ch < 1 ) ch = 1; @@ -1787,33 +1788,32 @@ KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int if (YSize < 0) { YSize = 1; } int iheight = mGridSpacingY * YSize; agendaItem->resize(mGridSpacingX,iheight ); agendaItem->setCellXY(X,YTop,YBottom); agendaItem->setCellXWidth(X); //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); mItems.append(agendaItem); placeSubCells(agendaItem); //agendaItem->show(); - marcus_bains(); return agendaItem; } /* Insert all-day KOAgendaItem into agenda. */ KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) { if (!mAllDayMode) { return 0; } KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); @@ -1860,34 +1860,32 @@ void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, KOAgendaItem *next = 0; KOAgendaItem *last = multiItems.last(); KOAgendaItem *first = multiItems.first(); KOAgendaItem *setFirst,*setLast; current = first; while (current) { next = multiItems.next(); if (current == first) setFirst = 0; else setFirst = first; if (current == last) setLast = 0; else setLast = last; current->setMultiItem(setFirst,next,setLast); current = next; } - - marcus_bains(); } //QSizePolicy KOAgenda::sizePolicy() const //{ // Thought this would make the all-day event agenda minimum size and the // normal agenda take the remaining space. But it doesnīt work. The QSplitter // donīt seem to think that an Expanding widget needs more space than a // Preferred one. // But it doesnīt hurt, so it stays. // if (mAllDayMode) { // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); // } else { // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); // } //} @@ -1946,45 +1944,44 @@ void KOAgenda::computeSizes() int subCellWidth; for ( item=mItems.first(); item != 0; item=mItems.next() ) { subCellWidth = mGridSpacingX / item->subCells(); item->resize(subCellWidth,item->height()); moveChild(item,(KOGlobals::self()->reverseLayout() ? (mColumns - 1 - item->cellX()) * mGridSpacingX : item->cellX() * mGridSpacingX) + item->subCell() * subCellWidth,childY(item)); } } int cw = contentsWidth(); int ch = contentsHeight(); if ( mAllDayMode ) { QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) { - qDebug("paintPixAll->resize "); + //qDebug("paintPixAll->resize "); paintPixAll->resize( cw, ch ); } } else { QPixmap* paintPix = KOAgendaItem::paintPix(); if ( paintPix->width() < cw || paintPix->height() < ch ) { - qDebug("paintPix->resize "); + //qDebug("paintPix->resize "); paintPix->resize( cw , ch ); } } checkScrollBoundaries(); - marcus_bains(); drawContentsToPainter(); viewport()->repaint(false); } void KOAgenda::scrollUp() { scrollBy(0,-mScrollOffset); } void KOAgenda::scrollDown() { scrollBy(0,mScrollOffset); } void KOAgenda::popupAlarm() @@ -2018,33 +2015,32 @@ int KOAgenda::minimumWidth() const void KOAgenda::updateConfig() { if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor) viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); if ( mAllDayMode ) { mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize; //mGridSpacingY = KOPrefs::instance()->mAllDaySize; resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 ); // setMaximumHeight( mGridSpacingY+1 ); viewport()->repaint( false ); //setFixedHeight( mGridSpacingY+1 ); //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize); } else { mGridSpacingY = KOPrefs::instance()->mHourSize; calculateWorkingHours(); - marcus_bains(); } } void KOAgenda::checkScrollBoundaries() { // Invalidate old values to force update mOldLowerScrollValue = -1; mOldUpperScrollValue = -1; checkScrollBoundaries(verticalScrollBar()->value()); } void KOAgenda::checkScrollBoundaries(int v) { if ( mGridSpacingY == 0 ) return; @@ -2111,33 +2107,32 @@ void KOAgenda::calculateWorkingHours() mWorkingHoursYTop = mGridSpacingY * KOPrefs::instance()->mWorkingHoursStart * 4; mWorkingHoursYBottom = mGridSpacingY * KOPrefs::instance()->mWorkingHoursEnd * 4 - 1; } DateList KOAgenda::dateList() const { return mSelectedDates; } void KOAgenda::setDateList(const DateList &selectedDates) { mSelectedDates = selectedDates; - marcus_bains(); } void KOAgenda::setHolidayMask(QMemArray<bool> *mask) { mHolidayMask = mask; /* kdDebug() << "HolidayMask: "; for(uint i=0;i<mask->count();++i) { kdDebug() << (mask->at(i) ? "*" : "o"); } kdDebug() << endl; */ } void KOAgenda::contentsMousePressEvent ( QMouseEvent *event ) |