summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
Unidiff
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/komonthview.cpp83
1 files changed, 79 insertions, 4 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index b175f9a..2b7e41f 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -407,4 +407,5 @@ void MonthViewItem::paint(QPainter *p)
407 p->setPen( palette().color( QPalette::Normal, sel ? \ 407 p->setPen( palette().color( QPalette::Normal, sel ? \
408 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 408 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
409 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) {
409 p->drawText( x, yPos, text() ); 410 p->drawText( x, yPos, text() );
410 if ( mIncidence->cancelled() ) { 411 if ( mIncidence->cancelled() ) {
@@ -412,5 +413,14 @@ void MonthViewItem::paint(QPainter *p)
412 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 413 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
413 } 414 }
414 415 } else {
416 QString pText = text();
417 if( pText.mid(2,1) == ":" )
418 pText = pText.mid( 6 );
419 p->drawText( x, yPos, pText );
420 if ( mIncidence->cancelled() ) {
421 int wid = fm.width( pText );
422 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
423 }
424 }
415} 425}
416 426
@@ -1043,4 +1053,5 @@ void MonthViewCell::newEvent()
1043void MonthViewCell::cellClicked( QListBoxItem *item ) 1053void MonthViewCell::cellClicked( QListBoxItem *item )
1044{ 1054{
1055 mMonthView->setSelectedCell( this );
1045 qDebug("CELL "); 1056 qDebug("CELL ");
1046 if ( item == 0 ) { 1057 if ( item == 0 ) {
@@ -1054,6 +1065,9 @@ void MonthViewCell::cellClicked( QListBoxItem *item )
1054void MonthViewCell::contextMenu( QListBoxItem *item ) 1065void MonthViewCell::contextMenu( QListBoxItem *item )
1055{ 1066{
1056 if ( !item ) return; 1067 mMonthView->setPopupCell( this );
1057 1068 if ( !item ) {
1069 mMonthView->showContextMenu( 0 );
1070 return;
1071 }
1058 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1072 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1059 Incidence *incidence = eventItem->incidence(); 1073 Incidence *incidence = eventItem->incidence();
@@ -1084,4 +1098,5 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1084 skipResize = false; 1098 skipResize = false;
1085 clPending = true; 1099 clPending = true;
1100 mPopupCell = 0;
1086 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1101 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1087 mWidStack = new QWidgetStack( this ); 1102 mWidStack = new QWidgetStack( this );
@@ -1201,4 +1216,27 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1201 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 1216 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
1202 mContextMenu = eventPopup(); 1217 mContextMenu = eventPopup();
1218 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1219 i18n("New Event..."),this,
1220 SLOT(slotNewEvent()),false);
1221 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1222 i18n("New Todo..."),this,
1223 SLOT(slotNewTodo()),false);
1224 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1225 i18n("Journal"),this,
1226 SLOT(slotEditJournal()),false);
1227
1228
1229
1230 QString pathString = "";
1231 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
1232 if ( QApplication::desktop()->width() < 480 )
1233 pathString += "icons16/";
1234 } else
1235 pathString += "iconsmini/";
1236 mNewItemMenu = new QPopupMenu( this );
1237 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent()));
1238 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false);
1239 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false);
1240
1203 // updateConfig(); //useless here... 1241 // updateConfig(); //useless here...
1204 // ... but we need mWidthLongDayLabel computed 1242 // ... but we need mWidthLongDayLabel computed
@@ -1894,5 +1932,10 @@ void KOMonthView::computeLayout()
1894void KOMonthView::showContextMenu( Incidence *incidence ) 1932void KOMonthView::showContextMenu( Incidence *incidence )
1895{ 1933{
1934 if( incidence )
1896 mContextMenu->showIncidencePopup(incidence); 1935 mContextMenu->showIncidencePopup(incidence);
1936 else {
1937 //qDebug("KOMonthView::showContextMenu ");
1938 mNewItemMenu->popup(QCursor::pos());
1939 }
1897 /* 1940 /*
1898 if( incidence && incidence->type() == "Event" ) { 1941 if( incidence && incidence->type() == "Event" ) {
@@ -1910,5 +1953,5 @@ MonthViewCell * KOMonthView::selectedCell( )
1910void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1953void KOMonthView::setSelectedCell( MonthViewCell *cell )
1911{ 1954{
1912 //qDebug("KOMonthView::setSelectedCell "); 1955 //qDebug("KOMonthView::setSelectedCell %d", cell);
1913 if ( mSelectedCell && mSelectedCell != cell ) { 1956 if ( mSelectedCell && mSelectedCell != cell ) {
1914 MonthViewCell * mvc = mSelectedCell; 1957 MonthViewCell * mvc = mSelectedCell;
@@ -2015,2 +2058,34 @@ void KOMonthView::prevCell()
2015 focusNextPrevChild ( false ); 2058 focusNextPrevChild ( false );
2016} 2059}
2060
2061void KOMonthView::slotNewTodo()
2062{
2063 //qDebug("KOMonthView::slotNewTodo() ");
2064 if ( mPopupCell ){
2065 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
2066 emit newTodoSignal(dt,true);
2067 }
2068 mPopupCell = 0;
2069}
2070void KOMonthView::slotNewEvent()
2071{
2072 if ( mPopupCell ) {
2073 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
2074 emit newEventSignal( dt );
2075 }
2076 //qDebug("KOMonthView::slotNewEvent() ");
2077 mPopupCell = 0;
2078}
2079
2080void KOMonthView::slotEditJournal()
2081{
2082 if ( mPopupCell )
2083 emit showJournalSignal( 7, mPopupCell->date() );
2084 //qDebug("KOMonthView::slotEditJournal() ");
2085 mPopupCell = 0;
2086}
2087
2088void KOMonthView::setPopupCell( MonthViewCell * c)
2089{
2090 mPopupCell = c;
2091}