summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp17
-rw-r--r--korganizer/calendarview.h4
-rw-r--r--korganizer/koagenda.cpp66
-rw-r--r--korganizer/koagenda.h6
-rw-r--r--korganizer/koagendaview.cpp19
-rw-r--r--korganizer/koagendaview.h3
-rw-r--r--korganizer/koeditorgeneraltodo.cpp17
-rw-r--r--korganizer/koviewmanager.cpp9
8 files changed, 119 insertions, 22 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 257a4dd..035d630 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2647,5 +2647,8 @@ void CalendarView::newEvent(QDate dt)
2647 QDateTime(dt, QTime(0,0,0)), true); 2647 QDateTime(dt, QTime(0,0,0)), true);
2648} 2648}
2649 2649void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint)
2650{
2651 newEvent(fromHint, toHint, false);
2652}
2650void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2653void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2651{ 2654{
@@ -2685,10 +2688,9 @@ void CalendarView::todoDeleted()
2685 2688
2686 2689
2687 2690void CalendarView::newTodoDateTime( QDateTime dt, bool allday )
2688void CalendarView::newTodo()
2689{ 2691{
2690 2692 qDebug("datetime ");
2691 showTodoEditor(); 2693 showTodoEditor();
2692 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); 2694 mTodoEditor->newTodo(dt,0,allday);
2693 if ( mFilterView->filtersEnabled() ) { 2695 if ( mFilterView->filtersEnabled() ) {
2694 CalFilter *filter = mFilterView->selectedFilter(); 2696 CalFilter *filter = mFilterView->selectedFilter();
@@ -2701,4 +2703,9 @@ void CalendarView::newTodo()
2701} 2703}
2702 2704
2705void CalendarView::newTodo()
2706{
2707 newTodoDateTime( QDateTime(),true );
2708}
2709
2703void CalendarView::newSubTodo() 2710void CalendarView::newSubTodo()
2704{ 2711{
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index c8d6bdd..7c59a8d 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -226,5 +226,6 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
226 /** create an editeventwin with supplied date/time, and if bool is true, 226 /** create an editeventwin with supplied date/time, and if bool is true,
227 * make the event take all day. */ 227 * make the event take all day. */
228 void newEvent(QDateTime, QDateTime, bool allDay = false); 228 void newEvent(QDateTime, QDateTime, bool allDay );
229 void newEvent(QDateTime, QDateTime);
229 void newEvent(QDateTime fh); 230 void newEvent(QDateTime fh);
230 void newEvent(QDate dt); 231 void newEvent(QDate dt);
@@ -261,4 +262,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
261 /** create new todo */ 262 /** create new todo */
262 void newTodo(); 263 void newTodo();
264 void newTodoDateTime(QDateTime, bool allday);
263 /** create new todo with a parent todo */ 265 /** create new todo with a parent todo */
264 void newSubTodo(); 266 void newSubTodo();
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 7e0b216..73ee5cb 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -169,5 +169,16 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
169 QScrollView(parent,name,f) 169 QScrollView(parent,name,f)
170{ 170{
171 171 mNewItemPopup = new QPopupMenu( this );
172 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
173 QString pathString = "";
174 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
175 if ( QApplication::desktop()->width() < 480 )
176 pathString += "icons16/";
177 } else
178 pathString += "iconsmini/";
179
180 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 );
181 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
182
172 mColumns = columns; 183 mColumns = columns;
173 mRows = rows; 184 mRows = rows;
@@ -188,5 +199,14 @@ KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) :
188 QScrollView(parent,name,f) 199 QScrollView(parent,name,f)
189{ 200{
190 201 mNewItemPopup = new QPopupMenu( this );
202 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
203 QString pathString = "";
204 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
205 if ( QApplication::desktop()->width() < 480 )
206 pathString += "icons16/";
207 } else
208 pathString += "iconsmini/";
209 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."),1 );
210 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
191 blockResize = false; 211 blockResize = false;
192 mColumns = columns; 212 mColumns = columns;
@@ -419,6 +439,22 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
419 selectItem(0); 439 selectItem(0);
420 mActionItem = 0; 440 mActionItem = 0;
421 setCursor(arrowCursor); 441 if (me->button() == RightButton ) {
422 startSelectAction(viewportPos); 442 blockNewEvent = true;
443 qDebug("right ");
444 int x,y;
445 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
446 int gx,gy;
447 contentsToGrid(x,y,gx,gy);
448 mStartCellX = gx;
449 mStartCellY = gy;
450 mCurrentCellX = gx;
451 mCurrentCellY = gy;
452 mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) );
453
454 } else {
455 blockNewEvent = false;
456 setCursor(arrowCursor);
457 startSelectAction(viewportPos);
458 }
423 } 459 }
424 break; 460 break;
@@ -457,5 +493,9 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
457 endItemAction(); 493 endItemAction();
458 } else if ( mActionType == SELECT ) { 494 } else if ( mActionType == SELECT ) {
459 endSelectAction(); 495 if (me->button() == RightButton ) {
496
497 } else {
498 endSelectAction( !blockNewEvent );
499 }
460 } 500 }
461 break; 501 break;
@@ -521,4 +561,14 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
521} 561}
522 562
563void KOAgenda::newItem( int item )
564{
565 qDebug("new %d ", item);
566 if ( item == 1 ) { //new event
567 newEventSignal(mStartCellX ,mStartCellY );
568 }
569 if ( item == 2 ) { //new event
570 newTodoSignal(mStartCellX ,mStartCellY );
571 }
572}
523void KOAgenda::startSelectAction(QPoint viewportPos) 573void KOAgenda::startSelectAction(QPoint viewportPos)
524{ 574{
@@ -610,5 +660,5 @@ void KOAgenda::performSelectAction(QPoint viewportPos)
610} 660}
611 661
612void KOAgenda::endSelectAction() 662void KOAgenda::endSelectAction( bool emitNewEvent )
613{ 663{
614 mActionType = NOP; 664 mActionType = NOP;
@@ -617,4 +667,6 @@ void KOAgenda::endSelectAction()
617 667
618 emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); 668 emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY);
669 if ( emitNewEvent && mStartCellY < mCurrentCellY )
670 emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY);
619} 671}
620 672
@@ -1661,5 +1713,5 @@ void KOAgenda::popupAlarm()
1661{ 1713{
1662 if (!mClickedItem) { 1714 if (!mClickedItem) {
1663 kdDebug() << "KOAgenda::popupAlarm() called without having a clicked item" << endl; 1715 qDebug("KOAgenda::popupAlarm() called without having a clicked item ");
1664 return; 1716 return;
1665 } 1717 }
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 111242f..12943d7 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -127,4 +127,5 @@ class KOAgenda : public QScrollView
127 127
128 public slots: 128 public slots:
129 void newItem( int );
129 void moveChild( QWidget *, int, int ); 130 void moveChild( QWidget *, int, int );
130 void scrollUp(); 131 void scrollUp();
@@ -146,4 +147,5 @@ class KOAgenda : public QScrollView
146 void newEventSignal(); 147 void newEventSignal();
147 void newEventSignal(int gx,int gy); 148 void newEventSignal(int gx,int gy);
149 void newTodoSignal(int gx,int gy);
148 void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); 150 void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
149 void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); 151 void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd);
@@ -181,5 +183,5 @@ class KOAgenda : public QScrollView
181 183
182 /** Emd selecting time span. */ 184 /** Emd selecting time span. */
183 void endSelectAction(); 185 void endSelectAction( bool emitNewEvent = false );
184 186
185 /** Start moving/resizing agenda item */ 187 /** Start moving/resizing agenda item */
@@ -208,4 +210,5 @@ class KOAgenda : public QScrollView
208 210
209 private: 211 private:
212 bool blockNewEvent;
210 void init(); 213 void init();
211 void marcus_bains(); 214 void marcus_bains();
@@ -275,4 +278,5 @@ class KOAgenda : public QScrollView
275 KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport); 278 KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport);
276 QPopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems 279 QPopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems
280 QPopupMenu *mNewItemPopup;
277 281
278 int mOldLowerScrollValue; 282 int mOldLowerScrollValue;
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index f54f7bc..60ae41f 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -489,8 +489,12 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
489 connect(mAgenda,SIGNAL(newEventSignal(int,int)), 489 connect(mAgenda,SIGNAL(newEventSignal(int,int)),
490 SLOT(newEvent(int,int))); 490 SLOT(newEvent(int,int)));
491 connect(mAgenda,SIGNAL(newTodoSignal(int,int)),
492 SLOT(newTodo(int,int)));
491 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), 493 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)),
492 SLOT(newEvent(int,int,int,int))); 494 SLOT(newEvent(int,int,int,int)));
493 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), 495 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)),
494 SLOT(newEventAllDay(int,int))); 496 SLOT(newEventAllDay(int,int)));
497 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)),
498 SLOT(newTodoAllDay(int,int)));
495 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), 499 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)),
496 SLOT(newEventAllDay(int,int))); 500 SLOT(newEventAllDay(int,int)));
@@ -1284,4 +1288,19 @@ void KOAgendaView::newEventAllDay(int gx, int )
1284 emit newEventSignal(day); 1288 emit newEventSignal(day);
1285} 1289}
1290void KOAgendaView::newTodoAllDay(int gx, int )
1291{
1292 if (!mSelectedDates.count()) return;
1293
1294 QDateTime day (mSelectedDates[gx] );
1295 emit newTodoSignal(day, true);
1296}
1297void KOAgendaView::newTodo(int gx, int gy )
1298{
1299 if (!mSelectedDates.count()) return;
1300 QDate dayStart = mSelectedDates[gx];
1301 QTime timeStart = mAgenda->gyToTime(gy);
1302 QDateTime dt (dayStart,timeStart);
1303 emit newTodoSignal( dt, false );
1304}
1286 1305
1287void KOAgendaView::updateEventIndicatorTop(int newY) 1306void KOAgendaView::updateEventIndicatorTop(int newY)
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 3cf938f..01d74a1 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -163,7 +163,9 @@ class KOAgendaView : public KOEventView {
163 void clearSelection(); 163 void clearSelection();
164 164
165 void newTodo(int gx,int gy);
165 void newEvent(int gx,int gy); 166 void newEvent(int gx,int gy);
166 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); 167 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd);
167 void newEventAllDay(int gx, int gy); 168 void newEventAllDay(int gx, int gy);
169 void newTodoAllDay(int gx, int gy);
168 170
169 void startDrag(Event *); 171 void startDrag(Event *);
@@ -181,4 +183,5 @@ class KOAgendaView : public KOEventView {
181 183
182 signals: 184 signals:
185 void newTodoSignal( QDateTime ,bool );
183 void toggleExpand(); 186 void toggleExpand();
184 void todoMoved( Todo *, int ); 187 void todoMoved( Todo *, int );
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index 158a7d3..b9a028b 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -196,7 +196,12 @@ void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay)
196 196
197 enableTimeEdits( !allDay ); 197 enableTimeEdits( !allDay );
198 198 if ( due.isValid() ) {
199 mDueCheck->setChecked(false); 199 mDueCheck->setChecked(true);
200 enableDueEdit(false); 200 enableDueEdit(true);
201 } else {
202 mDueCheck->setChecked(false);
203 enableDueEdit(false);
204 due = QDateTime::currentDateTime().addDays(7);
205 }
201 206
202 alarmDisable(true); 207 alarmDisable(true);
@@ -207,7 +212,7 @@ void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay)
207 mDueDateEdit->setDate(due.date()); 212 mDueDateEdit->setDate(due.date());
208 mDueTimeEdit->setTime(due.time()); 213 mDueTimeEdit->setTime(due.time());
209 214 due = due.addDays(-7);
210 mStartDateEdit->setDate(QDate::currentDate()); 215 mStartDateEdit->setDate(due.date());
211 mStartTimeEdit->setTime(QTime::currentTime()); 216 mStartTimeEdit->setTime(due.time());
212 217
213 mPriorityCombo->setCurrentItem(2); 218 mPriorityCombo->setCurrentItem(2);
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index e8d5ab1..a88276e 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -308,8 +308,13 @@ void KOViewManager::showAgendaView( bool fullScreen )
308 308
309 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 309 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
310
311
312
313 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)),
314 mMainView, SLOT(newTodoDateTime(QDateTime,bool)));
310 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 315 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
311 mMainView, SLOT(newEvent(QDateTime))); 316 mMainView, SLOT(newEvent(QDateTime)));
312 // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 317 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
313 // mMainView, SLOT(newEvent(QDateTime,QDateTime))); 318 mMainView, SLOT(newEvent(QDateTime,QDateTime)));
314 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 319 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
315 mMainView, SLOT(newEvent(QDate))); 320 mMainView, SLOT(newEvent(QDate)));