summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index f54f7bc..60ae41f 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -443,100 +443,104 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
agendaLayout->addWidget(mEventIndicatorBottom,2,1);
QWidget *dummyAgendaRight = new QWidget(agendaFrame);
agendaLayout->addWidget(dummyAgendaRight,0,2);
// Create time labels
mTimeLabels = new TimeLabels(24,agendaFrame);
agendaLayout->addWidget(mTimeLabels,1,0);
connect(mTimeLabels,SIGNAL( scaleChanged()),
this,SLOT(updateConfig()));
// Create agenda
mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2);
agendaLayout->setColStretch(1,1);
mAgenda->setFocusPolicy(NoFocus);
// Create event context menu for agenda
mAgendaPopup = eventPopup();
mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")),
i18n("Toggle Alarm"),mAgenda,
SLOT(popupAlarm()),true);
connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
mAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
// make connections between dependent widgets
mTimeLabels->setAgenda(mAgenda);
// Update widgets to reflect user preferences
// updateConfig();
// createDayLabels();
// these blank widgets make the All Day Event box line up with the agenda
dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
// Scrolling
connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)),
mTimeLabels, SLOT(positionChanged()));
connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)),
SLOT(setContentsPos(int)));
// Create/Show/Edit/Delete Event
connect(mAgenda,SIGNAL(newEventSignal(int,int)),
SLOT(newEvent(int,int)));
+ connect(mAgenda,SIGNAL(newTodoSignal(int,int)),
+ 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 * ) ) );
@@ -1238,96 +1242,111 @@ void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
else
calPrinter->preview(CalPrinter::Week, fd, td);
#endif
}
// void KOAgendaView::updateMovedTodo()
// {
// // updateConfig();
// // emit updateTodoViews();
// }
void KOAgendaView::newEvent(int gx, int gy)
{
if (!mSelectedDates.count()) return;
QDate day = mSelectedDates[gx];
QTime time = mAgenda->gyToTime(gy);
QDateTime dt(day,time);
// if ( dt < QDateTime::currentDateTime () )
// dt = QDateTime::currentDateTime ().addSecs( 3600 );
emit newEventSignal(dt);
}
void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd)
{
if (!mSelectedDates.count()) return;
QDate dayStart = mSelectedDates[gxStart];
QDate dayEnd = mSelectedDates[gxEnd];
QTime timeStart = mAgenda->gyToTime(gyStart);
QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 );
QDateTime dtStart(dayStart,timeStart);
QDateTime dtEnd(dayEnd,timeEnd);
emit newEventSignal(dtStart,dtEnd);
}
void KOAgendaView::newEventAllDay(int gx, int )
{
if (!mSelectedDates.count()) return;
QDate day = mSelectedDates[gx];
emit newEventSignal(day);
}
+void KOAgendaView::newTodoAllDay(int gx, int )
+{
+ if (!mSelectedDates.count()) return;
+
+ QDateTime day (mSelectedDates[gx] );
+ emit newTodoSignal(day, true);
+}
+void KOAgendaView::newTodo(int gx, int gy )
+{
+ if (!mSelectedDates.count()) return;
+ QDate dayStart = mSelectedDates[gx];
+ QTime timeStart = mAgenda->gyToTime(gy);
+ QDateTime dt (dayStart,timeStart);
+ emit newTodoSignal( dt, false );
+}
void KOAgendaView::updateEventIndicatorTop(int newY)
{
uint i;
for(i=0;i<mMinY.size();++i) {
if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true);
else mEventIndicatorTop->enableColumn(i,false);
}
mEventIndicatorTop->update();
}
void KOAgendaView::updateEventIndicatorBottom(int newY)
{
uint i;
for(i=0;i<mMaxY.size();++i) {
if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true);
else mEventIndicatorBottom->enableColumn(i,false);
}
mEventIndicatorBottom->update();
}
void KOAgendaView::startDrag(Event *event)
{
#ifndef KORG_NODND
DndFactory factory( calendar() );
ICalDrag *vd = factory.createDrag(event,this);
if (vd->drag()) {
kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl;
}
#endif
}
void KOAgendaView::readSettings()
{
readSettings(KOGlobals::config());
}
void KOAgendaView::readSettings(KConfig *config)
{
// kdDebug() << "KOAgendaView::readSettings()" << endl;
config->setGroup("Views");
//#ifndef KORG_NOSPLITTER
QValueList<int> sizes = config->readIntListEntry("Separator AgendaView");
if (sizes.count() == 2) {