author | zautrix <zautrix> | 2005-01-29 15:23:10 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-29 15:23:10 (UTC) |
commit | c6548bb194a5e73b9b72505c2e952ef6346dec46 (patch) (unidiff) | |
tree | 74039fb5cd5f1a64f6a7844c9ece030e6d76de87 /korganizer/koagenda.cpp | |
parent | f542fb5846520683e6241a522921e3d5eb24b833 (diff) | |
download | kdepimpi-c6548bb194a5e73b9b72505c2e952ef6346dec46.zip kdepimpi-c6548bb194a5e73b9b72505c2e952ef6346dec46.tar.gz kdepimpi-c6548bb194a5e73b9b72505c2e952ef6346dec46.tar.bz2 |
todo
-rw-r--r-- | korganizer/koagenda.cpp | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 7e0b216..73ee5cb 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -169,4 +169,15 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | |||
169 | QScrollView(parent,name,f) | 169 | QScrollView(parent,name,f) |
170 | { | 170 | { |
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 ); | ||
171 | 182 | ||
172 | mColumns = columns; | 183 | mColumns = columns; |
@@ -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,7 +439,23 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
419 | selectItem(0); | 439 | selectItem(0); |
420 | mActionItem = 0; | 440 | mActionItem = 0; |
441 | if (me->button() == RightButton ) { | ||
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; | ||
421 | setCursor(arrowCursor); | 456 | setCursor(arrowCursor); |
422 | startSelectAction(viewportPos); | 457 | startSelectAction(viewportPos); |
423 | } | 458 | } |
459 | } | ||
424 | break; | 460 | break; |
425 | 461 | ||
@@ -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 | ||
563 | void 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 | } | ||
523 | void KOAgenda::startSelectAction(QPoint viewportPos) | 573 | void KOAgenda::startSelectAction(QPoint viewportPos) |
524 | { | 574 | { |
@@ -610,5 +660,5 @@ void KOAgenda::performSelectAction(QPoint viewportPos) | |||
610 | } | 660 | } |
611 | 661 | ||
612 | void KOAgenda::endSelectAction() | 662 | void 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 | } |