summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp264
-rw-r--r--korganizer/koagenda.h2
-rw-r--r--korganizer/koagendaview.cpp22
3 files changed, 42 insertions, 246 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 114ed75..355f4bb 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -453,57 +453,50 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
if (object != viewport()) {
viewportPos = ((QWidget *)object)->mapToParent(me->pos());
} else {
viewportPos = me->pos();
}
switch (me->type()) {
case QEvent::MouseButtonPress:
if (me->button() == LeftButton) {
mPopupTimer->start( 600 );
mLeftMouseDown = true;
}
blockMoving = true;
startX = viewportPos.x();
startY = viewportPos.y();
mPopupPos = me->globalPos();
if (object != viewport()) {
mPopupItem = (KOAgendaItem *)object;
mPopupKind = 1;
if (me->button() == RightButton) {
popupMenu();
} else if (me->button() == LeftButton) {
mActionItem = (KOAgendaItem *)object;
if (mActionItem) {
- if ( mSelectionHeight > 0 ) {
- int selectionCellX = mSelectionCellX * mGridSpacingX;
- int selectionYTop = mSelectionYTop;
- int gridSpacingX = mGridSpacingX;
- int selectionHeight = mSelectionHeight;
- clearSelection();
- repaintContents( selectionCellX, selectionYTop,
- gridSpacingX, selectionHeight,false );
- }
+ emit signalClearSelection();
+ slotClearSelection();
selectItem(mActionItem);
Incidence *incidence = mActionItem->incidence();
if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) {
mActionItem = 0;
} else {
startItemAction(viewportPos);
}
}
}
} else { // ---------- viewport()
mPopupItem = 0;
mPopupKind = 2;
selectItem(0);
mActionItem = 0;
if (me->button() == RightButton) {
int x,y;
viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
int gx,gy;
contentsToGrid(x,y,gx,gy);
mCurrentCellX = gx;
mCurrentCellY = gy;
mStartCellX = gx;
mStartCellY = gy;
popupMenu();
@@ -589,339 +582,162 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
case QEvent::MouseButtonDblClick:
mPopupTimer->stop();
if (object == viewport()) {
selectItem(0);
int x,y;
viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
int gx,gy;
contentsToGrid(x,y,gx,gy);
emit newEventSignal(gx,gy);
} else {
KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object;
selectItem(doubleClickedItem);
if ( KOPrefs::instance()->mEditOnDoubleClick )
emit editIncidenceSignal(doubleClickedItem->incidence());
else
emit showIncidenceSignal(doubleClickedItem->incidence());
}
break;
default:
break;
}
return true;
-#if 0
- //qDebug("KOAgenda::eventFilter_mous ");
- QPoint viewportPos;
- if (object != viewport()) {
- viewportPos = ((QWidget *)object)->mapToParent(me->pos());
- } else {
- viewportPos = me->pos();
- }
- static int startX = 0;
- static int startY = 0;
- static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 );
- static bool blockMoving = true;
- static bool leftMouseDown = false;
- bool rightButtonPressed = false;
- switch (me->type()) {
- case QEvent::MouseButtonPress:
- if (me->button() == LeftButton) {
- leftMouseDown = true;
- }
- else if (me->button() == RightButton) {
- leftMouseDown = false;
- }
- blockMoving = true;
- startX = viewportPos.x();
- startY = viewportPos.y();
- if (object != viewport()) { // item clicked **************
- if (me->button() == RightButton) {
- leftMouseDown = false;
- mClickedItem = (KOAgendaItem *)object;
- if (mActionItem ) {
- endItemAction();
- }
- if (mClickedItem) {
- selectItem(mClickedItem);
- emit showIncidencePopupSignal(mClickedItem->incidence());
- }
- return true;
- } else if (me->button() == LeftButton) {
- mActionItem = (KOAgendaItem *)object;
- if (mActionItem) {
- if ( mSelectionHeight > 0 ) {
- int selectionCellX = mSelectionCellX * mGridSpacingX;
- int selectionYTop = mSelectionYTop;
- int gridSpacingX = mGridSpacingX;
- int selectionHeight = mSelectionHeight;
- clearSelection();
- repaintContents( selectionCellX, selectionYTop,
- gridSpacingX, selectionHeight,false );
- }
- selectItem(mActionItem);
- Incidence *incidence = mActionItem->incidence();
- if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) {
- mActionItem = 0;
- } else {
- startItemAction(viewportPos);
- }
- }
- }
- } else { // ---------- viewport()
- selectItem(0);
- mActionItem = 0;
- if (me->button() == LeftButton ) {
- setCursor(arrowCursor);
- startSelectAction(viewportPos);
- } else if (me->button() == RightButton ) {
- setCursor(arrowCursor);
- if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action
- endSelectAction( false ); // do not emit new event signal
- leftMouseDown = false; // no more leftMouse computation
- }
- int x,y;
- viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
- int gx,gy;
- contentsToGrid(x,y,gx,gy);
- mCurrentCellX = gx;
- mCurrentCellY = gy;
- mStartCellX = gx;
- mStartCellY = gy;
- mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) );
- }
- }
- break;
-
- case QEvent::MouseButtonRelease:
-
- if (object != viewport()) {
- if (me->button() == LeftButton && leftMouseDown) {
- if (mActionItem) {
- QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos));
- //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 );
- if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) {
- mScrollUpTimer.stop();
- mScrollDownTimer.stop();
- mActionItem->resetMove();
- placeSubCells( mActionItem );
- // emit startDragSignal( mActionItem->incidence() );
- setCursor( arrowCursor );
- mActionItem = 0;
- mActionType = NOP;
- mItemMoved = 0;
- leftMouseDown = false;
- return true;
- }
- endItemAction();
- }
- }
-
- } else { // ---------- viewport()
- if (me->button() == LeftButton && leftMouseDown ) { //left click
- endSelectAction( true ); // emit new event signal
- }
- }
- if (me->button() == LeftButton)
- leftMouseDown = false;
-
- break;
- case QEvent::MouseMove:
- if ( !leftMouseDown )
- return true;
- if ( blockMoving ) {
- int dX, dY;
- dX = startX - viewportPos.x();
- if ( dX < 0 )
- dX = -dX;
- dY = viewportPos.y() - startY;
- if ( dY < 0 )
- dY = -dY;
- //qDebug("%d %d %d ", dX, dY , blockmoveDist );
- if ( dX > blockmoveDist || dY > blockmoveDist ) {
- blockMoving = false;
- }
- }
- if (object != viewport()) {
- KOAgendaItem *moveItem = (KOAgendaItem *)object;
- if (!moveItem->incidence()->isReadOnly() ) {
- if (!mActionItem)
- setNoActionCursor(moveItem,viewportPos);
- else {
- if ( !blockMoving )
- performItemAction(viewportPos);
- }
- }
- } else { // ---------- viewport()
- if ( mActionType == SELECT ) {
- performSelectAction( viewportPos );
- }
- }
- break;
-
- case QEvent::MouseButtonDblClick:
- blockMoving = false;
- leftMouseDown = false;
- if (object == viewport()) {
- selectItem(0);
- int x,y;
- viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
- int gx,gy;
- contentsToGrid(x,y,gx,gy);
- emit newEventSignal(gx,gy);
- } else {
- KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object;
- selectItem(doubleClickedItem);
- if ( KOPrefs::instance()->mEditOnDoubleClick )
- emit editIncidenceSignal(doubleClickedItem->incidence());
- else
- emit showIncidenceSignal(doubleClickedItem->incidence());
- }
- break;
-
- default:
- break;
- }
- return true;
-#endif
}
void KOAgenda::newItem( int item )
{
if ( item == 1 ) { //new event
newEventSignal(mStartCellX ,mStartCellY );
} else
if ( item == 2 ) { //new event
newTodoSignal(mStartCellX ,mStartCellY );
} else
{
emit showDateView( item, mStartCellX );
// 3Day view
// 4Week view
// 5Month view
// 6Journal view
}
}
+void KOAgenda::slotClearSelection()
+{
+ if (mSelectionHeight) {
+ int selectionX = mSelectionCellX * mGridSpacingX;
+ int top = mSelectionYTop - 2 *mGridSpacingY;
+ int hei = mSelectionHeight + 4 *mGridSpacingY;
+ clearSelection();
+ repaintContents( selectionX, top,
+ mGridSpacingX, hei ,false );
+ }
+
+}
void KOAgenda::startSelectAction(QPoint viewportPos)
{
- //emit newStartSelectSignal();
+
+ emit signalClearSelection();
+ slotClearSelection();
- mActionType = SELECT;
+ mActionType = SELECT;
- int x,y;
- viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
- int gx,gy;
- contentsToGrid(x,y,gx,gy);
+ int x,y;
+ viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
+ int gx,gy;
+ contentsToGrid(x,y,gx,gy);
- mStartCellX = gx;
- mStartCellY = gy;
- mCurrentCellX = gx;
- mCurrentCellY = gy;
-
- // Store coordinates of old selection
- int selectionX = mSelectionCellX * mGridSpacingX;
- int selectionYTop = mSelectionYTop;
- int selectionHeight = mSelectionHeight;
+ mStartCellX = gx;
+ mStartCellY = gy;
+ mCurrentCellX = gx;
+ mCurrentCellY = gy;
- // Store new selection
- mSelectionCellX = gx;
- mSelectionYTop = gy * mGridSpacingY;
- mSelectionHeight = mGridSpacingY;
+ // Store new selection
+ mSelectionCellX = gx;
+ mSelectionYTop = gy * mGridSpacingY;
+ mSelectionHeight = mGridSpacingY;
- // Clear old selection
- repaintContents( selectionX, selectionYTop,
- mGridSpacingX, selectionHeight,false );
-
- // Paint new selection
- // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop,
- // mGridSpacingX, mSelectionHeight );
+ // Paint new selection
+ repaintContents( mSelectionCellX * mGridSpacingX+1, mSelectionYTop,
+ mGridSpacingX-1, mSelectionHeight );
}
void KOAgenda::performSelectAction(QPoint viewportPos)
{
int x,y;
viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
int gx,gy;
contentsToGrid(x,y,gx,gy);
QPoint clipperPos = clipper()->
mapFromGlobal(viewport()->mapToGlobal(viewportPos));
// Scroll if cursor was moved to upper or lower end of agenda.
if (clipperPos.y() < mScrollBorderWidth) {
mScrollUpTimer.start(mScrollDelay);
} else if (visibleHeight() - clipperPos.y() <
mScrollBorderWidth) {
mScrollDownTimer.start(mScrollDelay);
} else {
mScrollUpTimer.stop();
mScrollDownTimer.stop();
}
if ( gy > mCurrentCellY ) {
mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop;
-#if 0
- // FIXME: Repaint only the newly selected region
- repaintContents( mSelectionCellX * mGridSpacingX,
- mCurrentCellY + mGridSpacingY,
- mGridSpacingX,
- mSelectionHeight - ( gy - mCurrentCellY - 1 ) * mGridSpacingY );
-#else
+
repaintContents( (KOGlobals::self()->reverseLayout() ?
mColumns - 1 - mSelectionCellX : mSelectionCellX) *
mGridSpacingX, mSelectionYTop,
mGridSpacingX, mSelectionHeight , false);
-#endif
mCurrentCellY = gy;
} else if ( gy < mCurrentCellY ) {
if ( gy >= mStartCellY ) {
int selectionHeight = mSelectionHeight;
mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop;
repaintContents( (KOGlobals::self()->reverseLayout() ?
mColumns - 1 - mSelectionCellX : mSelectionCellX) *
mGridSpacingX, mSelectionYTop,
mGridSpacingX, selectionHeight,false );
mCurrentCellY = gy;
} else {
}
}
}
void KOAgenda::endSelectAction( bool emitNewEvent )
{
mActionType = NOP;
mScrollUpTimer.stop();
mScrollDownTimer.stop();
emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY);
if ( emitNewEvent && mStartCellY < mCurrentCellY ) {
- qDebug("ew event signal ");
emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY);
}
}
void KOAgenda::startItemAction(QPoint viewportPos)
{
int x,y;
viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
int gx,gy;
contentsToGrid(x,y,gx,gy);
mStartCellX = gx;
mStartCellY = gy;
mCurrentCellX = gx;
mCurrentCellY = gy;
if (mAllDayMode) {
int gridDistanceX = (x - gx * mGridSpacingX);
if (gridDistanceX < mResizeBorderWidth &&
mActionItem->cellX() == mCurrentCellX) {
mActionType = RESIZELEFT;
setCursor(sizeHorCursor);
} else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
mActionItem->cellXWidth() == mCurrentCellX) {
@@ -1079,59 +895,49 @@ void KOAgenda::endItemAction()
KOAgendaItem *placeItem = mActionItem->firstMultiItem();
if ( !placeItem ) {
placeItem = mActionItem;
}
if ( placeItem->incidence()->recurrence()->doesRecur() ) {
Incidence* oldInc = placeItem->incidence();
placeItem->recreateIncidence();
emit addToCalSignal(placeItem->incidence(), oldInc );
}
int type = mActionType;
if ( mAllDayMode )
type = -1;
KOAgendaItem *modifiedItem = placeItem;
//emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */);
QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
KOAgendaItem *item;
if ( placeItem->incidence()->type() == "Todo" ) {
mSelectedItem = 0;
//qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth());
modifiedItem->mLastMoveXPos = mCurrentCellX;
emit itemModified( modifiedItem, mActionType );
}
else {
-#if 0
- for ( item=oldconflictItems.first(); item != 0;
- item=oldconflictItems.next() ) {
- placeSubCells(item);
- }
- while ( placeItem ) {
- //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());
- placeSubCells( placeItem );
- placeItem = placeItem->nextMultiItem();
- }
-#endif
+
globalFlagBlockAgendaItemPaint = 1;
for ( item=oldconflictItems.first(); item != 0;
item=oldconflictItems.next() ) {
placeSubCells(item);
}
while ( placeItem ) {
//qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());
oldconflictItems = placeItem->conflictItems();
for ( item=oldconflictItems.first(); item != 0;
item=oldconflictItems.next() ) {
placeSubCells(item);
}
placeSubCells( placeItem );
placeItem = placeItem->nextMultiItem();
}
globalFlagBlockAgendaItemPaint = 0;
for ( item=oldconflictItems.first(); item != 0;
item=oldconflictItems.next() ) {
globalFlagBlockAgendaItemUpdate = 0;
item->repaintMe();
globalFlagBlockAgendaItemUpdate = 1;
item->repaint( false );
}
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 4f1fdb9..fb9983e 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -106,67 +106,69 @@ class KOAgenda : public QScrollView
void clear();
void clearSelection();
void hideUnused();
/** Calculates the minimum width */
virtual int minimumWidth() const;
/** Update configuration from preference settings */
void updateConfig();
void checkScrollBoundaries();
void setHolidayMask(QMemArray<bool> *);
void setDateList(const DateList &selectedDates);
DateList dateList() const;
void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false);
void finishUpdate();
void printSelection();
void storePosition();
void restorePosition();
void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; }
public slots:
+ void slotClearSelection();
void popupMenu();
void newItem( int );
void moveChild( QWidget *, int, int );
void scrollUp();
void scrollDown();
void updateTodo( Todo * t, int , bool );
void popupAlarm();
void checkScrollBoundaries(int);
/** Deselect selected items. This function does not emit any signals. */
void deselectItem();
/** Select item. If the argument is 0, the currently selected item gets
deselected. This function emits the itemSelected(bool) signal to inform
about selection/deseelction of events. */
void selectItem(KOAgendaItem *);
void finishResize();
signals:
+ void signalClearSelection();
void showDateView( int, int);
void newEventSignal();
void newEventSignal(int gx,int gy);
void newTodoSignal(int gx,int gy);
void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
void newStartSelectSignal();
void showIncidenceSignal(Incidence *);
void editIncidenceSignal(Incidence *);
void deleteIncidenceSignal(Incidence *);
void showIncidencePopupSignal(Incidence *);
void itemModified(KOAgendaItem *item, int );
void incidenceSelected(Incidence *);
void lowerYChanged(int);
void upperYChanged(int);
void startDragSignal(Incidence *);
void addToCalSignal(Incidence *, Incidence *);
void resizedSignal();
protected:
KOEventPopupMenu * mAllAgendaPopup;
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 17f791d..b43c40e 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -413,49 +413,48 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
int widebut = mExpandButton->sizeHint().width()+4;
int heibut = mExpandButton->sizeHint().height()+4;
if ( heibut > widebut )
widebut = heibut ;
//mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
// QSizePolicy::Fixed ) );
mExpandButton->setFixedSize( widebut, widebut);
connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
mExpandButton->setFocusPolicy(NoFocus);
mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
mAllDayAgenda->setFocusPolicy(NoFocus);
QLabel *dummyAllDayRight = new QLabel (mAllDayFrame);
// Create event context menu for all day agenda
//mAllDayAgendaPopup = eventPopup();
// Create agenda frame
QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3);
// QHBox *agendaFrame = new QHBox(splitterAgenda);
// create event indicator bars
mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
#ifndef DESKTOP_VERSION
- // FIX
mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
#endif
mDayLabelsFrame = new QHBox(agendaFrame);
//topLayout->addWidget(mDayLabelsFrame);
mDayLabels = new QFrame (mDayLabelsFrame);
mLayoutDayLabels = new QHBoxLayout(mDayLabels);
agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2);
agendaLayout->addWidget(mEventIndicatorTop,1,1);
mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
agendaFrame);
agendaLayout->addWidget(mEventIndicatorBottom,3,1);
QWidget *dummyAgendaRight = new QWidget(agendaFrame);
agendaLayout->addWidget(dummyAgendaRight,1,2);
// Create time labels
mTimeLabels = new TimeLabels(24,agendaFrame);
agendaLayout->addWidget(mTimeLabels,2,0);
connect(mTimeLabels,SIGNAL( scaleChanged()),
this,SLOT(updateConfig()));
// Create agenda
mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2);
@@ -546,48 +545,50 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
/*
connect(mAgenda,SIGNAL(startDragSignal(Event *)),
SLOT(startDrag(Event *)));
connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)),
SLOT(startDrag(Event *)));
*/
// synchronize selections
connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
mAllDayAgenda, SLOT( deselectItem() ) );
connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
mAgenda, SLOT( deselectItem() ) );
connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
SIGNAL( incidenceSelected( Incidence * ) ) );
connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
SIGNAL( incidenceSelected( Incidence * ) ) );
connect( mAgenda, SIGNAL( resizedSignal() ),
SLOT( updateConfig( ) ) );
connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ),
SLOT( addToCalSlot(Incidence *, Incidence * ) ) );
connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ),
SLOT( addToCalSlot(Incidence * , Incidence *) ) );
// connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
//connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
+ connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) );
+ connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) );
}
void KOAgendaView::toggleAllDay()
{
if ( mSplitterAgenda->firstHandle() )
mSplitterAgenda->firstHandle()->toggle();
}
void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
{
calendar()->addIncidence( inc );
if ( incOld ) {
if ( incOld->type() == "Todo" )
emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
else
emit incidenceChanged(incOld, KOGlobals::EVENTEDITED);
}
}
KOAgendaView::~KOAgendaView()
{
delete mAllAgendaPopup;
@@ -704,54 +705,50 @@ void KOAgendaView::createDayLabels()
break;
}
maxLen = 2;
}
//qDebug("Max len %d ", dayTest.length() );
QFontMetrics tempF( dlf );
newHight = tempF.height();
mDayLabels->setFont( dlf );
// mLayoutDayLabels = new QHBoxLayout(mDayLabels);;
// mLayoutDayLabels->addSpacing(mTimeLabels->width());
//mLayoutDayLabels->addSpacing( 2 );
// QFont lFont = dlf;
bool appendLabels = false;
KOAgendaButton *dayLabel;
dayLabel = mDayLabelsList.first();
if ( !dayLabel ) {
appendLabels = true;
dayLabel = getNewDaylabel();
}
dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() );
dayLabel->setFont( dlf );
dayLabel->setNum( -1 );
//dayLabel->setAlignment(QLabel::AlignHCenter);
-#if 0
- if ( QApplication::desktop()->width() <= 320 )
- dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ).left(2) );
- else
-#endif
- dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) );
+
+ dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) );
dayLabel->show();
DateList::ConstIterator dit;
bool oneday = (mSelectedDates.first() == mSelectedDates.last() );
int counter = -1;
for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
++counter;
QDate date = *dit;
// QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels);
if ( ! appendLabels ) {
dayLabel = mDayLabelsList.next();
if ( !dayLabel )
appendLabels = true;
}
if ( appendLabels ) {
dayLabel = getNewDaylabel();
}
dayLabel->setMinimumWidth( 1 );
dayLabel->setMaximumWidth( 10240 );
dayLabel->setFont( dlf );
dayLabel->show();
dayLabel->setAutoRepeat( false );
dayLabel->setNum( counter );
QString str;
int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date);
@@ -1158,58 +1155,49 @@ void KOAgendaView::fillAgenda()
// kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
if (event->doesFloat()) {
if (event->recurrence()->doesRecur()) {
if (event->isMultiDay() ) {
endX = endX - beginX;// endX is now number of days
if ( event->recursOn( currentDate ) ) {
endX += curCol;
beginX = curCol;
mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
} else {
qDebug("days %d %s",endX , currentDate.toString().latin1());
QDate dateit = currentDate.addDays( -endX );
if ( event->recursOn( dateit ) ) {
qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() );
if ( curCol-endX < 0 ) {
mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol);
}
}
}
} else {
mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
}
-#if 0
- if (beginX <= 0 && curCol == 0) {
- mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
- } else if (beginX == curCol) {
- mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
- } else {
- qDebug("skipped %d %d %d ",beginX , endX, curCol);
- }
-#endif
- //mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
+
} else {
if (beginX <= 0 && curCol == 0) {
mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
} else if (beginX == curCol) {
mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
}
}
} else if (event->isMultiDay()) {
if ( event->doesRecur () ) {
QDate dateit = currentDate;
int count = 0;
int max = event->dtStart().daysTo( event->dtEnd() ) +2;
while (! event->recursOn( dateit ) && count <= max ) {
++count;
dateit = dateit.addDays( -1 );
}
bool ok;
QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok );
if ( ok )
{
int secs = event->dtStart().secsTo( event->dtEnd() );
QDateTime nextOcend =nextOcstart.addSecs( secs ); ;
beginX = currentDate.daysTo(nextOcstart.date()) + curCol;
endX = currentDate.daysTo(nextOcend.date()) + curCol;