summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp24
-rw-r--r--korganizer/koagendaitem.h1
-rw-r--r--korganizer/koagendaview.cpp2
3 files changed, 11 insertions, 16 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 9fe1be4..abb29f7 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -251,386 +251,382 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
if (mIncidence->isReadOnly()) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->attendeeCount()>0) {
if (mIncidence->organizer() == KOPrefs::instance()->email()) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
if ( horLayout )
++xOff;
else
++yOff;
} else {
Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
if (me!=0) {
} else {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
if ( horLayout )
++xOff;
else
++yOff;
}
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
if ( horLayout )
++xOff;
else
++yOff;
}
}
return ( yOff || xOff );
}
void KOAgendaItem::select(bool selected)
{
//qDebug("select %d %d",firstMultiItem(), nextMultiItem() );
if (mSelected == selected) return;
mSelected = selected;
if ( ! isVisible() )
return;
if ( firstMultiItem() )
firstMultiItem()->select( selected );
if ( !firstMultiItem() && nextMultiItem() ) {
KOAgendaItem * placeItem = nextMultiItem();
while ( placeItem ) {
placeItem->select( selected );
placeItem = placeItem->nextMultiItem();
}
}
globalFlagBlockAgendaItemUpdate = 0;
paintMe( selected );
globalFlagBlockAgendaItemUpdate = 1;
repaint( false );
}
/*
The eventFilter has to filter the mouse events of the agenda item childs. The
events are fed into the event handling method of KOAgendaItem. This allows the
KOAgenda to handle the KOAgendaItems by using an eventFilter.
*/
bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e )
{
if (e->type() == QEvent::MouseButtonPress ||
e->type() == QEvent::MouseButtonDblClick ||
e->type() == QEvent::MouseButtonRelease ||
e->type() == QEvent::MouseMove) {
QMouseEvent *me = (QMouseEvent *)e;
QPoint itemPos = this->mapFromGlobal(((QWidget *)object)->
mapToGlobal(me->pos()));
QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state());
return event(&returnEvent);
} else {
return false;
}
}
void KOAgendaItem::repaintMe( )
{
paintMe ( mSelected );
}
void KOAgendaItem::paintMe( bool selected, QPainter* paint )
{
if ( globalFlagBlockAgendaItemUpdate && ! selected)
return;
QPainter pa;
if ( mSelected ) {
- pa.begin( paintPixSel() );
+ pa.begin( this );
} else {
if ( mAllDay )
pa.begin( paintPixAllday() );
else
pa.begin( paintPix() );
}
int x, yy, w, h;
float nfh = 7.0;
x = pos().x(); w = width(); h = height ();
if ( mAllDay )
yy = y();
else
- yy = mCellYTop * ( height() / cellHeight() );
+ yy = mCellYTop * ( height() / cellHeight() );
+ if ( mSelected ) {
+ pa.translate( -x, -yy );
+ }
xPaintCoord= x;
yPaintCoord = yy;
wPaintCoord = width();
hPaintCoord = height();
//qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height());
if ( paint == 0 )
paint = &pa;
bool horLayout = ( w < h );
int maxhei = mFontPixelSize+4;
if ( horLayout )
maxhei += AGENDA_ICON_SIZE -4;
bool small = ( h < maxhei );
if ( ! small )
paint->setFont(KOPrefs::instance()->mAgendaViewFont);
else {
QFont f = KOPrefs::instance()->mAgendaViewFont;
f.setBold( false );
int fh = f.pointSize();
nfh = (((float)height())/(float)(mFontPixelSize+4))*fh;
if ( nfh < 6 )
nfh = 6;
f.setPointSize( nfh );
paint->setFont(f);
}
paint->fillRect ( x, yy, w, h, mBackgroundColor );
static const QPixmap completedPxmp = SmallIcon("greenhook16");
static const QPixmap overduePxmp = SmallIcon("redcross16");
if ( mIncidence->typeID() == todoID ) {
Todo* tempTodo = static_cast<Todo*>(mIncidence);
int xx = pos().x()+(width()-completedPxmp.width()-3 );
int yyy = yy+3;
if ( tempTodo->isCompleted() )
paint->drawPixmap ( xx, yyy, completedPxmp );
else {
paint->drawPixmap ( xx, yyy, overduePxmp );
}
}
bool addIcon = false;
if ( ! small || w > 3 * h || h > 3* w )
addIcon = updateIcons( paint, horLayout );
//qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0);
qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0);
//qDebug("draw rect %d %d %d %d ",x, yy, w, h );
if ( ! small ) {
x += 3; yy += 3;w -= 6; h-= 5;
} else {
x += 2; yy += 1;w -= 4; h-= 4;
if ( nfh < 6.01 ) {
yy -= 2;
h += 4;
}
else
if ( nfh < h -2 )
++yy;
}
int align;
#ifndef DESKTOP_VERSION
align = ( AlignLeft|WordBreak|AlignTop);
#else
align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
#endif
if ( addIcon ) {
if ( ! horLayout ) {
x += AGENDA_ICON_SIZE+3;
w -= (AGENDA_ICON_SIZE+3);
}
else {
yy+= AGENDA_ICON_SIZE+2;
h -=(AGENDA_ICON_SIZE+3);
}
}
if ( mWhiteText )
paint->setPen ( white);
if ( x < 0 ) {
w = w+x-3;
x = 3;
if ( !horLayout && addIcon )
x += AGENDA_ICON_SIZE+3;
if ( w > parentWidget()->width() ){
w = parentWidget()->width() - 6;
#ifndef DESKTOP_VERSION
align = ( AlignHCenter|WordBreak|AlignTop);
#else
align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop);
#endif
}
}
QRect dr;
if ( w + x > parentWidget()->width() )
w = parentWidget()->width()-x;
paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr );
//qDebug("%d %d %d %d ", x, yy, w, h );
if ( mIncidence->cancelled() ){
small = ( height() < 20 );
if ( ! small ) {
QFontMetrics fm ( paint->font() );
paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2);
}
}
pa.end();
}
void KOAgendaItem::resizePixmap( int w , int h )
{
paintPix()->resize( w, h );
- paintPixSel()->resize( w, h );
}
QPixmap * KOAgendaItem::paintPix()
{
static QPixmap* mPaintPix = 0;
if ( ! mPaintPix ) {
int w = QApplication::desktop()->width();
int h = QApplication::desktop()->height();
mPaintPix = new QPixmap(w,h);
}
return mPaintPix ;
}
QPixmap * KOAgendaItem::paintPixAllday()
{
static QPixmap* mPaintPixA = 0;
if ( ! mPaintPixA ) {
int w = QApplication::desktop()->width();
int h = QApplication::desktop()->height()/3;
mPaintPixA = new QPixmap(w,h);
}
return mPaintPixA ;
}
-QPixmap * KOAgendaItem::paintPixSel()
-{
- static QPixmap* mPaintPixSel = 0;
- if ( ! mPaintPixSel ) {
- int w = QApplication::desktop()->width();
- int h = QApplication::desktop()->height();
- mPaintPixSel = new QPixmap(w,h);
- }
- return mPaintPixSel ;
-}
+
void KOAgendaItem::paintEvent ( QPaintEvent *e )
{
if ( globalFlagBlockAgendaItemPaint )
return;
if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
return;
int yy;
if ( mAllDay )
yy = y();
else
yy = mCellYTop * ( height() / cellHeight() );
int xx = x();
if ( xPaintCoord != xx || yPaintCoord != yy ||
wPaintCoord != width() || hPaintCoord != height()) {
xPaintCoord= xx;
yPaintCoord = yy;
wPaintCoord = width();
hPaintCoord = height();
globalFlagBlockAgendaItemUpdate = 0;
paintMe( mSelected );
//qDebug("calling paintMe ");
globalFlagBlockAgendaItemUpdate = 1;
+ if ( mSelected )
+ return;
}
int rx, ry, rw, rh;
rx = e->rect().x();
ry = e->rect().y();
rw = e->rect().width();
rh = e->rect().height();
//qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
QPixmap* paintFrom ;
if ( mSelected ) {
- paintFrom = paintPixSel();
+ paintMe( mSelected );
+ return;
} else {
if ( mAllDay )
paintFrom = paintPixAllday();
else
paintFrom = paintPix();
}
xx += rx;
if ( xx < 0 ) {
rw = rw + xx;
rx -= xx;
xx = 0;
if ( rw <= 1 ) {
//qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1());
return;
}
}
if ( paintFrom->width() < xx+rw ) {
rw = paintFrom->width() - xx;
if ( rw <= 1 ) {
//qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() );
return;
}
}
//qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh);
bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP);
}
void KOAgendaItem::computeText()
{
mDisplayedText = mIncidence->summary();
if ( (mIncidence->typeID() == todoID ) ) {
if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
else if ( !(mIncidence->doesFloat()))
mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
}
} else {
if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
if ( mAllDay ) {
if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
if ( mIncidence->doesRecur() ) {
mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")";
} else {
mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ;
}
}
}
}
if ( !mIncidence->location().isEmpty() ) {
if ( mAllDay )
mDisplayedText += " (";
else
mDisplayedText += "\n(";
mDisplayedText += mIncidence->location() +")";
}
#ifdef DESKTOP_VERSION
QString tipText = mIncidence->summary();
if ( !mIncidence->doesFloat() ) {
if ( mIncidence->typeID() == eventID ) {
if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
}
else {
tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
}
}
else if ( mIncidence->typeID() == todoID ) {
if (mIncidence->hasStartDate())
tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
if (((Todo*)mIncidence)->hasDueDate())
tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
}
} else if ( mIncidence->typeID() == todoID ) {
if (mIncidence->hasStartDate())
tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
if (((Todo*)mIncidence)->hasDueDate())
tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
}
if (!mIncidence->location().isEmpty()) {
tipText += "\n"+i18n("Location: ")+mIncidence->location();
}
QToolTip::add(this,tipText,toolTipGroup(),"");
#endif
}
void KOAgendaItem::updateItem()
{
computeText();
//qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
index dc2316a..7103abe 100644
--- a/korganizer/koagendaitem.h
+++ b/korganizer/koagendaitem.h
@@ -10,157 +10,156 @@
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef KOAGENDAITEM_H
#define KOAGENDAITEM_H
#include <qframe.h>
#include <qlabel.h>
#include <qpixmap.h>
#include <qdatetime.h>
#include <qpalette.h>
#include <libkcal/incidence.h>
class KOAgendaItemWhatsThis;
class QToolTipGroup;
class QDragEnterEvent;
class QDropEvent;
using namespace KCal;
/*
The KOAgendaItem has to make sure that it receives all mouse events, which are
to be used for dragging and resizing. That means it has to be installed as
eventfiler for its children, if it has children, and it has to pass mouse
events from the cildren to itself. See eventFilter().
*/
class KOAgendaItem : public QWidget
{
Q_OBJECT
public:
KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent, bool allday, const char *name=0,
WFlags f=0 );
~KOAgendaItem();
QString getWhatsThisText();
void init ( Incidence *incidence, QDate qd );
int cellX() { return mCellX; }
int cellXWidth() { return mCellXWidth; }
int cellYTop() { return mCellYTop; }
int cellYBottom() { return mCellYBottom; }
int cellHeight();
int cellWidth();
int subCell() { return mSubCell; }
int subCells() { return mSubCells; }
void setCellXY(int X, int YTop, int YBottom);
void setCellY(int YTop, int YBottom);
void setCellX(int XLeft, int XRight);
void setCellXWidth(int xwidth);
void setSubCell(int subCell);
void setSubCells(int subCells);
/** Start movement */
void startMove();
/** Reset to original values */
void resetMove();
void moveRelative(int dx,int dy);
void expandTop(int dy);
void expandBottom(int dy);
void expandLeft(int dx);
void expandRight(int dx);
int mLastMoveXPos;
void setMultiItem(KOAgendaItem *first,KOAgendaItem *next,
KOAgendaItem *last);
KOAgendaItem *firstMultiItem() { return mFirstMultiItem; }
KOAgendaItem *nextMultiItem() { return mNextMultiItem; }
KOAgendaItem *lastMultiItem() { return mLastMultiItem; }
Incidence *incidence() const { return mIncidence; }
QDate itemDate() { return mDate; }
/** Update the date of this item's occurence (not in the event) */
void setItemDate(QDate qd);
void setText ( const QString & text ) { mDisplayedText = text; }
QString text () { return mDisplayedText; }
virtual bool eventFilter ( QObject *, QEvent * );
static QToolTipGroup *toolTipGroup();
QPtrList<KOAgendaItem> conflictItems();
void setConflictItems(QPtrList<KOAgendaItem>);
void addConflictItem(KOAgendaItem *ci);
void paintMe( bool, QPainter* painter = 0 );
void repaintMe();
static void resizePixmap( int, int );
static QPixmap * paintPix();
- static QPixmap * paintPixSel();
static QPixmap * paintPixAllday();
void updateItem();
void computeText();
void recreateIncidence();
bool checkLayout();
void initColor ();
public slots:
bool updateIcons( QPainter *, bool );
void select(bool=true);
protected:
void dragEnterEvent(QDragEnterEvent *e);
void dropEvent(QDropEvent *e);
void paintEvent ( QPaintEvent * );
void resizeEvent ( QResizeEvent *ev );
private:
KOAgendaItemWhatsThis* mKOAgendaItemWhatsThis;
bool mAllDay;
bool mWhiteText;
int mCellX;
int mCellXWidth;
int mCellYTop,mCellYBottom;
int mSubCell; // subcell number of this item
int mSubCells; // Total number of subcells in cell of this item
int xPaintCoord;
int yPaintCoord;
int wPaintCoord;
int hPaintCoord;
// Variables to remember start position
int mStartCellX;
int mStartCellXWidth;
int mStartCellYTop,mStartCellYBottom;
int mLastMovePos;
// Multi item pointers
KOAgendaItem *mFirstMultiItem;
KOAgendaItem *mNextMultiItem;
KOAgendaItem *mLastMultiItem;
int mFontPixelSize;
Incidence *mIncidence; // corresponding event or todo
QDate mDate; //date this events occurs (for recurrence)
//void showIcon( QLabel*, int );
//QLabel *mTodoIconLabel;
//QLabel *mItemLabel;
//QWidget *mIconBox;
//QLabel *mIconAlarm,*mIconRecur,*mIconReadonly;
//QLabel *mIconReply,*mIconGroup,*mIconOrganizer;
//QLabel *mIconMoreInfo;
static QToolTipGroup *mToolTipGroup;
QColor mBackgroundColor;
QColorGroup mColorGroup;
QString mDisplayedText;
bool mSelected;
QPtrList<KOAgendaItem> mConflictItems;
};
#endif // KOAGENDAITEM_H
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 5a63b35..f811fba 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -510,193 +510,193 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
SLOT(newTodo(int,int)));
connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)),
SLOT(newEvent(int,int,int,int)));
connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)),
SLOT(newEventAllDay(int,int)));
connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)),
SLOT(newTodoAllDay(int,int)));
connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)),
SLOT(newEventAllDay(int,int)));
connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
SLOT(newTimeSpanSelected(int,int,int,int)));
connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
SLOT(newTimeSpanSelectedAllDay(int,int,int,int)));
connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
SIGNAL(editIncidenceSignal(Incidence *)));
connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
SIGNAL(editIncidenceSignal(Incidence *)));
connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
SIGNAL(showIncidenceSignal(Incidence *)));
connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
SIGNAL(showIncidenceSignal(Incidence *)));
connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
SIGNAL(deleteIncidenceSignal(Incidence *)));
connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
SIGNAL(deleteIncidenceSignal(Incidence *)));
connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
SLOT(updateEventDates(KOAgendaItem *, int )));
connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
SLOT(updateEventDates(KOAgendaItem *, int)));
// event indicator update
connect(mAgenda,SIGNAL(lowerYChanged(int)),
SLOT(updateEventIndicatorTop(int)));
connect(mAgenda,SIGNAL(upperYChanged(int)),
SLOT(updateEventIndicatorBottom(int)));
// drag signals
/*
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->typeID() == todoID )
emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
else
emit incidenceChanged(incOld, KOGlobals::EVENTEDITED);
}
}
void KOAgendaView::categoryChanged(Incidence * inc)
{
mAgenda->categoryChanged( inc );
mAllDayAgenda->categoryChanged( inc );
}
KOAgendaView::~KOAgendaView()
{
delete mAllAgendaPopup;
//delete mAllDayAgendaPopup;
delete KOAgendaItem::paintPix();
- delete KOAgendaItem::paintPixSel();
+ delete KOAgendaItem::paintPixAllday();
}
void KOAgendaView::resizeEvent( QResizeEvent* e )
{
//qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width());
bool uc = false;
int ow = e->oldSize().width();
int oh = e->oldSize().height();
int w = e->size().width();
int h = e->size().height();
if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) {
if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda )
uc = true;
//qDebug("view changed %d %d %d %d ", ow, oh , w , h);
}
mUpcomingWidth = e->size().width() ;
if ( mBlockUpdating || uc ) {
mBlockUpdating = false;
//mAgenda->setMinimumSize(800 , 600 );
//qDebug("mAgenda->resize+++++++++++++++ ");
updateConfig();
//qDebug("KOAgendaView::Updating now possible ");
} else
createDayLabels();
//qDebug("resizeEvent end ");
}
void KOAgendaView::slotDaylabelClicked( int num )
{
QDate firstDate = mSelectedDates.first();
if ( num == -1 )
emit showDateView( 6, firstDate );
else if (num >= 0 ) {
if ( mSelectedDates.count() == 1)
emit showDateView( 9, firstDate.addDays( num ) );
else
emit showDateView( 3, firstDate.addDays( num ) );
}
else
showDateView( 10, firstDate.addDays(1) );
}
KOAgendaButton* KOAgendaView::getNewDaylabel()
{
KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels);
connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) );
mDayLabelsList.append( dayLabel );
mLayoutDayLabels->addWidget(dayLabel);
return dayLabel ;
}
void KOAgendaView::createDayLabels()
{
if ( mBlockUpdating || globalFlagBlockLabel == 1) {
// qDebug(" KOAgendaView::createDayLabels() blocked ");
return;
}
int newHight;
if ( !mSelectedDates.count())
return;
// ### Before deleting and recreating we could check if mSelectedDates changed...
// It would remove some flickering and gain speed (since this is called by
// each updateView() call)
int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2;
mDayLabelsFrame->setMaximumWidth( mUpcomingWidth );
if ( maxWid < 20 )
maxWid = 20;
QFont dlf = KOPrefs::instance()->mTimeLabelsFont;
QFontMetrics fm ( dlf );
dlf.setBold( true );
int selCount = mSelectedDates.count();
int widModulo = maxWid - (mAgenda->gridSpacingX() * selCount)+1;
QString dayTest = "Mon 20";
//QString dayTest = "Mon 20";
int wid = fm.width( dayTest );
//maxWid -= ( selCount * 3 ); //working for QLabels
if ( QApplication::desktop()->width() <= 320 )
maxWid -= ( selCount * 3 ); //working for QPushButton
else
maxWid -= ( selCount * 4 ); //working for QPushButton
if ( maxWid < 0 )
maxWid = 20;
int needWid = wid * selCount;
//qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid );
//if ( needWid > maxWid )
// qDebug("DAYLABELS TOOOOOOO BIG ");
while ( needWid > maxWid ) {
dayTest = dayTest.left( dayTest.length() - 1 );
wid = fm.width( dayTest );
needWid = wid * selCount;