summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
Unidiff
Diffstat (limited to 'korganizer/koagenda.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagenda.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 1a24887..9720f43 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -195,97 +195,97 @@ KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) :
195 mAllDayMode = true; 195 mAllDayMode = true;
196#ifndef DESKTOP_VERSION 196#ifndef DESKTOP_VERSION
197 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 197 //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
198#endif 198#endif
199 mHolidayMask = 0; 199 mHolidayMask = 0;
200 init(); 200 init();
201} 201}
202 202
203 203
204KOAgenda::~KOAgenda() 204KOAgenda::~KOAgenda()
205{ 205{
206 if(mMarcusBains) delete mMarcusBains; 206 if(mMarcusBains) delete mMarcusBains;
207 207
208} 208}
209 209
210Incidence *KOAgenda::selectedIncidence() const 210Incidence *KOAgenda::selectedIncidence() const
211{ 211{
212 return (mSelectedItem ? mSelectedItem->incidence() : 0); 212 return (mSelectedItem ? mSelectedItem->incidence() : 0);
213} 213}
214 214
215 215
216QDate KOAgenda::selectedIncidenceDate() const 216QDate KOAgenda::selectedIncidenceDate() const
217{ 217{
218 return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); 218 return (mSelectedItem ? mSelectedItem->itemDate() : QDate());
219} 219}
220 220
221 221
222void KOAgenda::init() 222void KOAgenda::init()
223{ 223{
224 mPopupTimer = new QTimer(this); 224 mPopupTimer = new QTimer(this);
225 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); 225 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
226 226
227 mNewItemPopup = new QPopupMenu( this ); 227 mNewItemPopup = new QPopupMenu( this );
228 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); 228 connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
229 QString pathString = ""; 229 QString pathString = "";
230 if ( !KOPrefs::instance()->mToolBarMiniIcons ) { 230 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
231 if ( QApplication::desktop()->width() < 480 ) 231 if ( QApplication::desktop()->width() < 480 )
232 pathString += "icons16/"; 232 pathString += "icons16/";
233 } else 233 } else
234 pathString += "iconsmini/"; 234 pathString += "iconsmini/";
235 235
236 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); 236 mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 );
237 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); 237 mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
238 mNewItemPopup->insertSeparator ( ); 238 mNewItemPopup->insertSeparator ( );
239 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); 239 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 );
240 mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); 240 mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 );
241 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); 241 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 );
242 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); 242 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 );
243 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next month"),6 ); 243 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 );
244 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); 244 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
245#ifndef _WIN32_ 245#ifndef _WIN32_
246 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase 246 int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase
247 viewport()->setWFlags ( wflags); 247 viewport()->setWFlags ( wflags);
248#endif 248#endif
249 mGridSpacingX = 80; 249 mGridSpacingX = 80;
250 mResizeBorderWidth = 8; 250 mResizeBorderWidth = 8;
251 mScrollBorderWidth = 8; 251 mScrollBorderWidth = 8;
252 mScrollDelay = 30; 252 mScrollDelay = 30;
253 mScrollOffset = 10; 253 mScrollOffset = 10;
254 mPaintPixmap.resize( 20,20); 254 mPaintPixmap.resize( 20,20);
255 //enableClipper(true); 255 //enableClipper(true);
256 256
257 // Grab key strokes for keyboard navigation of agenda. Seems to have no 257 // Grab key strokes for keyboard navigation of agenda. Seems to have no
258 // effect. Has to be fixed. 258 // effect. Has to be fixed.
259 setFocusPolicy(WheelFocus); 259 setFocusPolicy(WheelFocus);
260 260
261 connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); 261 connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp()));
262 connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); 262 connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown()));
263 connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); 263 connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize()));
264 264
265 mStartCellX = 0; 265 mStartCellX = 0;
266 mStartCellY = 0; 266 mStartCellY = 0;
267 mCurrentCellX = 0; 267 mCurrentCellX = 0;
268 mCurrentCellY = 0; 268 mCurrentCellY = 0;
269 269
270 mSelectionCellX = 0; 270 mSelectionCellX = 0;
271 mSelectionYTop = 0; 271 mSelectionYTop = 0;
272 mSelectionHeight = 0; 272 mSelectionHeight = 0;
273 273
274 mOldLowerScrollValue = -1; 274 mOldLowerScrollValue = -1;
275 mOldUpperScrollValue = -1; 275 mOldUpperScrollValue = -1;
276 276
277 mClickedItem = 0; 277 mClickedItem = 0;
278 278
279 mActionItem = 0; 279 mActionItem = 0;
280 mActionType = NOP; 280 mActionType = NOP;
281 mItemMoved = false; 281 mItemMoved = false;
282 282
283 mSelectedItem = 0; 283 mSelectedItem = 0;
284 284
285 // mItems.setAutoDelete(true); 285 // mItems.setAutoDelete(true);
286 286
287 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 287 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
288 288
289 viewport()->update(); 289 viewport()->update();
290 290
291 setMinimumSize(30, 1); 291 setMinimumSize(30, 1);
@@ -709,98 +709,97 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
709 else { 709 else {
710 if ( !blockMoving ) 710 if ( !blockMoving )
711 performItemAction(viewportPos); 711 performItemAction(viewportPos);
712 } 712 }
713 } 713 }
714 } else { // ---------- viewport() 714 } else { // ---------- viewport()
715 if ( mActionType == SELECT ) { 715 if ( mActionType == SELECT ) {
716 performSelectAction( viewportPos ); 716 performSelectAction( viewportPos );
717 } 717 }
718 } 718 }
719 break; 719 break;
720 720
721 case QEvent::MouseButtonDblClick: 721 case QEvent::MouseButtonDblClick:
722 blockMoving = false; 722 blockMoving = false;
723 leftMouseDown = false; 723 leftMouseDown = false;
724 if (object == viewport()) { 724 if (object == viewport()) {
725 selectItem(0); 725 selectItem(0);
726 int x,y; 726 int x,y;
727 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 727 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
728 int gx,gy; 728 int gx,gy;
729 contentsToGrid(x,y,gx,gy); 729 contentsToGrid(x,y,gx,gy);
730 emit newEventSignal(gx,gy); 730 emit newEventSignal(gx,gy);
731 } else { 731 } else {
732 KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; 732 KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object;
733 selectItem(doubleClickedItem); 733 selectItem(doubleClickedItem);
734 if ( KOPrefs::instance()->mEditOnDoubleClick ) 734 if ( KOPrefs::instance()->mEditOnDoubleClick )
735 emit editIncidenceSignal(doubleClickedItem->incidence()); 735 emit editIncidenceSignal(doubleClickedItem->incidence());
736 else 736 else
737 emit showIncidenceSignal(doubleClickedItem->incidence()); 737 emit showIncidenceSignal(doubleClickedItem->incidence());
738 } 738 }
739 break; 739 break;
740 740
741 default: 741 default:
742 break; 742 break;
743 } 743 }
744 return true; 744 return true;
745#endif 745#endif
746} 746}
747 747
748void KOAgenda::newItem( int item ) 748void KOAgenda::newItem( int item )
749{ 749{
750 if ( item == 1 ) { //new event 750 if ( item == 1 ) { //new event
751 newEventSignal(mStartCellX ,mStartCellY ); 751 newEventSignal(mStartCellX ,mStartCellY );
752 } else 752 } else
753 if ( item == 2 ) { //new event 753 if ( item == 2 ) { //new event
754 newTodoSignal(mStartCellX ,mStartCellY ); 754 newTodoSignal(mStartCellX ,mStartCellY );
755 } else 755 } else
756 { 756 {
757 QDate day = mSelectedDates[mStartCellX]; 757 emit showDateView( item, mStartCellX );
758 emit showDateView( item, day );
759 // 3Day view 758 // 3Day view
760 // 4Week view 759 // 4Week view
761 // 5Month view 760 // 5Month view
762 // 6Journal view 761 // 6Journal view
763 } 762 }
764} 763}
765void KOAgenda::startSelectAction(QPoint viewportPos) 764void KOAgenda::startSelectAction(QPoint viewportPos)
766{ 765{
767 //emit newStartSelectSignal(); 766 //emit newStartSelectSignal();
768 767
769 mActionType = SELECT; 768 mActionType = SELECT;
770 769
771 int x,y; 770 int x,y;
772 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 771 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
773 int gx,gy; 772 int gx,gy;
774 contentsToGrid(x,y,gx,gy); 773 contentsToGrid(x,y,gx,gy);
775 774
776 mStartCellX = gx; 775 mStartCellX = gx;
777 mStartCellY = gy; 776 mStartCellY = gy;
778 mCurrentCellX = gx; 777 mCurrentCellX = gx;
779 mCurrentCellY = gy; 778 mCurrentCellY = gy;
780 779
781 // Store coordinates of old selection 780 // Store coordinates of old selection
782 int selectionX = mSelectionCellX * mGridSpacingX; 781 int selectionX = mSelectionCellX * mGridSpacingX;
783 int selectionYTop = mSelectionYTop; 782 int selectionYTop = mSelectionYTop;
784 int selectionHeight = mSelectionHeight; 783 int selectionHeight = mSelectionHeight;
785 784
786 // Store new selection 785 // Store new selection
787 mSelectionCellX = gx; 786 mSelectionCellX = gx;
788 mSelectionYTop = gy * mGridSpacingY; 787 mSelectionYTop = gy * mGridSpacingY;
789 mSelectionHeight = mGridSpacingY; 788 mSelectionHeight = mGridSpacingY;
790 789
791 // Clear old selection 790 // Clear old selection
792 repaintContents( selectionX, selectionYTop, 791 repaintContents( selectionX, selectionYTop,
793 mGridSpacingX, selectionHeight,false ); 792 mGridSpacingX, selectionHeight,false );
794 793
795 // Paint new selection 794 // Paint new selection
796 // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop, 795 // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop,
797 // mGridSpacingX, mSelectionHeight ); 796 // mGridSpacingX, mSelectionHeight );
798} 797}
799 798
800void KOAgenda::performSelectAction(QPoint viewportPos) 799void KOAgenda::performSelectAction(QPoint viewportPos)
801{ 800{
802 int x,y; 801 int x,y;
803 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 802 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
804 int gx,gy; 803 int gx,gy;
805 contentsToGrid(x,y,gx,gy); 804 contentsToGrid(x,y,gx,gy);
806 805