summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index eea9a4d..4aeb20c 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1016,193 +1016,197 @@ QDate MonthViewCell::selectedIncidenceDate()
1016{ 1016{
1017 QDate qd; 1017 QDate qd;
1018 int index = currentItem(); 1018 int index = currentItem();
1019 if ( index < 0 ) return qd; 1019 if ( index < 0 ) return qd;
1020 return mDate; 1020 return mDate;
1021} 1021}
1022 1022
1023void MonthViewCell::deselect() 1023void MonthViewCell::deselect()
1024{ 1024{
1025 clearSelection(); 1025 clearSelection();
1026 enableScrollBars( false ); 1026 enableScrollBars( false );
1027 // updateCell(); 1027 // updateCell();
1028} 1028}
1029void MonthViewCell::select() 1029void MonthViewCell::select()
1030{ 1030{
1031 ;// updateCell(); 1031 ;// updateCell();
1032} 1032}
1033 1033
1034void MonthViewCell::resizeEvent ( QResizeEvent * e ) 1034void MonthViewCell::resizeEvent ( QResizeEvent * e )
1035{ 1035{
1036 if ( !mMonthView->isUpdatePossible() ) 1036 if ( !mMonthView->isUpdatePossible() )
1037 return; 1037 return;
1038 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); 1038 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
1039 deselect(); 1039 deselect();
1040 mLabel->setMaximumHeight( height() - lineWidth()*2 ); 1040 mLabel->setMaximumHeight( height() - lineWidth()*2 );
1041 1041
1042 QString text; 1042 QString text;
1043 //mLabel->setText( text ); 1043 //mLabel->setText( text );
1044 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 1044 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
1045 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 1045 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
1046 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " " + QString::number( mDate.day() ); 1046 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " " + QString::number( mDate.day() );
1047 mLabel->resize( mLabelBigSize ); 1047 mLabel->resize( mLabelBigSize );
1048 } else { 1048 } else {
1049 mLabel->resize( mLabelSize ); 1049 mLabel->resize( mLabelSize );
1050 text = QString::number( mDate.day() ); 1050 text = QString::number( mDate.day() );
1051 } 1051 }
1052 mLabel->setText( text ); 1052 mLabel->setText( text );
1053 1053
1054 int size = height() - mLabel->height() - lineWidth()-1; 1054 int size = height() - mLabel->height() - lineWidth()-1;
1055 //qDebug("LW %d ", lineWidth()); 1055 //qDebug("LW %d ", lineWidth());
1056 if ( size > 0 ) 1056 if ( size > 0 )
1057 verticalScrollBar()->setMaximumHeight( size ); 1057 verticalScrollBar()->setMaximumHeight( size );
1058 size = width() - mLabel->width() -lineWidth()-1; 1058 size = width() - mLabel->width() -lineWidth()-1;
1059 if ( size > 0 ) 1059 if ( size > 0 )
1060 horizontalScrollBar()->setMaximumWidth( size ); 1060 horizontalScrollBar()->setMaximumWidth( size );
1061 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); 1061 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
1062 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 1062 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
1063 // mItemList->resize ( width(), height () ); 1063 // mItemList->resize ( width(), height () );
1064 if ( e ) 1064 if ( e )
1065 KNoScrollListBox::resizeEvent ( e ); 1065 KNoScrollListBox::resizeEvent ( e );
1066} 1066}
1067 1067
1068void MonthViewCell::defaultAction( QListBoxItem *item ) 1068void MonthViewCell::defaultAction( QListBoxItem *item )
1069{ 1069{
1070 1070
1071 if ( !item ) { 1071 if ( !item ) {
1072 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1072 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1073 emit newEventSignal( dt ); 1073 emit newEventSignal( dt );
1074 return; 1074 return;
1075 } 1075 }
1076 1076
1077 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1077 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1078 Incidence *incidence = eventItem->incidence(); 1078 Incidence *incidence = eventItem->incidence();
1079 if ( incidence ) mMonthView->defaultAction( incidence ); 1079 if ( incidence ) mMonthView->defaultAction( incidence );
1080} 1080}
1081void MonthViewCell::showDay() 1081void MonthViewCell::showDay()
1082{ 1082{
1083 emit showDaySignal( date() ); 1083 emit showDaySignal( date() );
1084} 1084}
1085void MonthViewCell::newEvent() 1085void MonthViewCell::newEvent()
1086{ 1086{
1087 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1087 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1088 emit newEventSignal( dt ); 1088 emit newEventSignal( dt );
1089} 1089}
1090void MonthViewCell::cellClicked( QListBoxItem *item ) 1090void MonthViewCell::cellClicked( QListBoxItem *item )
1091{ 1091{
1092 mMonthView->setSelectedCell( this ); 1092 mMonthView->setSelectedCell( this );
1093 if ( item == 0 ) { 1093 if ( item == 0 ) {
1094 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1094 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1095 emit newEventSignal( dt ); 1095 emit newEventSignal( dt );
1096 return; 1096 return;
1097 } 1097 }
1098 1098
1099} 1099}
1100 1100
1101void MonthViewCell::contextMenu( QListBoxItem *item ) 1101void MonthViewCell::contextMenu( QListBoxItem *item )
1102{ 1102{
1103 mMonthView->setPopupCell( this ); 1103 mMonthView->setPopupCell( this );
1104 if ( !item ) { 1104 if ( !item ) {
1105 mMonthView->showContextMenu( 0 ); 1105 mMonthView->showContextMenu( 0 );
1106 return; 1106 return;
1107 } 1107 }
1108 //selection( item ); 1108 //selection( item );
1109 //qApp->processEvents(); 1109 //qApp->processEvents();
1110 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1110 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1111 Incidence *incidence = eventItem->incidence(); 1111 Incidence *incidence = eventItem->incidence();
1112 if ( incidence ) mMonthView->showContextMenu( incidence ); 1112 if ( incidence ) {
1113 mMonthView->showContextMenu( incidence );
1114 selection( item );
1115 doHighLight( incidence );
1116 }
1113} 1117}
1114 1118
1115void MonthViewCell::selection( QListBoxItem *item ) 1119void MonthViewCell::selection( QListBoxItem *item )
1116{ 1120{
1117 if ( !item ) { 1121 if ( !item ) {
1118 emit highlightIncidence( 0 , this, 0 ); 1122 emit highlightIncidence( 0 , this, 0 );
1119 return; 1123 return;
1120 } 1124 }
1121 MonthViewItem * it = (static_cast<MonthViewItem *>( item )); 1125 MonthViewItem * it = (static_cast<MonthViewItem *>( item ));
1122 emit highlightIncidence( it->incidence(), this, it->multiDay() ); 1126 emit highlightIncidence( it->incidence(), this, it->multiDay() );
1123 mMonthView->setSelectedCell( this ); 1127 mMonthView->setSelectedCell( this );
1124} 1128}
1125 1129
1126void MonthViewCell::deHighLight() 1130void MonthViewCell::deHighLight()
1127{ 1131{
1128 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 1132 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
1129 while ( mitem ) { 1133 while ( mitem ) {
1130 if ( mitem->setHighlightedFalse() ) 1134 if ( mitem->setHighlightedFalse() )
1131 updateItem ( mitem ); 1135 updateItem ( mitem );
1132 mitem = (MonthViewItem *)mitem->next(); 1136 mitem = (MonthViewItem *)mitem->next();
1133 } 1137 }
1134} 1138}
1135// returns true if no inc found 1139// returns true if no inc found
1136bool MonthViewCell::doHighLight( Incidence * inc ) 1140bool MonthViewCell::doHighLight( Incidence * inc )
1137{ 1141{
1138 1142
1139 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 1143 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
1140 while ( mitem ) { 1144 while ( mitem ) {
1141 if ( mitem->incidence() == inc ) { 1145 if ( mitem->incidence() == inc ) {
1142 if ( mitem->setHighlighted( inc ) ) 1146 if ( mitem->setHighlighted( inc ) )
1143 updateItem ( mitem ); 1147 updateItem ( mitem );
1144 return false; 1148 return false;
1145 } 1149 }
1146 mitem = (MonthViewItem *)mitem->next(); 1150 mitem = (MonthViewItem *)mitem->next();
1147 } 1151 }
1148 return true; 1152 return true;
1149} 1153}
1150// ******************************************************************************* 1154// *******************************************************************************
1151// ******************************************************************************* 1155// *******************************************************************************
1152// ******************************************************************************* 1156// *******************************************************************************
1153 1157
1154 1158
1155KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 1159KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1156 : KOEventView( calendar, parent, name ), 1160 : KOEventView( calendar, parent, name ),
1157 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 1161 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
1158 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 1162 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
1159{ 1163{
1160 mFlagKeyPressed = false; 1164 mFlagKeyPressed = false;
1161 mShortDayLabelsM = false; 1165 mShortDayLabelsM = false;
1162 mShortDayLabelsW = false; 1166 mShortDayLabelsW = false;
1163 skipResize = false; 1167 skipResize = false;
1164 clPending = true; 1168 clPending = true;
1165 mPopupCell = 0; 1169 mPopupCell = 0;
1166 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1170 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1167 mWidStack = new QWidgetStack( this ); 1171 mWidStack = new QWidgetStack( this );
1168 QVBoxLayout* hb = new QVBoxLayout( this ); 1172 QVBoxLayout* hb = new QVBoxLayout( this );
1169 mMonthView = new QWidget( mWidStack ); 1173 mMonthView = new QWidget( mWidStack );
1170 mWeekView = new QWidget( mWidStack ); 1174 mWeekView = new QWidget( mWidStack );
1171#if QT_VERSION >= 0x030000 1175#if QT_VERSION >= 0x030000
1172 mWidStack->addWidget(mMonthView ); 1176 mWidStack->addWidget(mMonthView );
1173 mWidStack->addWidget(mWeekView ); 1177 mWidStack->addWidget(mWeekView );
1174#else 1178#else
1175 mWidStack->addWidget( mMonthView, 1 ); 1179 mWidStack->addWidget( mMonthView, 1 );
1176 mWidStack->addWidget( mWeekView , 1 ); 1180 mWidStack->addWidget( mWeekView , 1 );
1177#endif 1181#endif
1178 hb->addWidget( mNavigatorBar ); 1182 hb->addWidget( mNavigatorBar );
1179 hb->addWidget( mWidStack ); 1183 hb->addWidget( mWidStack );
1180 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 1184 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
1181 updatePossible = false; 1185 updatePossible = false;
1182 //updatePossible = true; 1186 //updatePossible = true;
1183 mCells.setAutoDelete( true ); 1187 mCells.setAutoDelete( true );
1184 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1188 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1185 mDayLabels.resize( mDaysPerWeek ); 1189 mDayLabels.resize( mDaysPerWeek );
1186 mDayLabelsW.resize( mDaysPerWeek ); 1190 mDayLabelsW.resize( mDaysPerWeek );
1187 QFont bfont = font(); 1191 QFont bfont = font();
1188 if ( QApplication::desktop()->width() < 650 ) { 1192 if ( QApplication::desktop()->width() < 650 ) {
1189 bfont.setPointSize( bfont.pointSize() - 2 ); 1193 bfont.setPointSize( bfont.pointSize() - 2 );
1190 } 1194 }
1191 bfont.setBold( true ); 1195 bfont.setBold( true );
1192 int i; 1196 int i;
1193 1197
1194 for( i = 0; i < mDaysPerWeek; i++ ) { 1198 for( i = 0; i < mDaysPerWeek; i++ ) {
1195 QLabel *label = new QLabel( mMonthView ); 1199 QLabel *label = new QLabel( mMonthView );
1196 label->setFont(bfont); 1200 label->setFont(bfont);
1197 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1201 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1198 label->setLineWidth(1); 1202 label->setLineWidth(1);
1199 label->setAlignment(AlignCenter); 1203 label->setAlignment(AlignCenter);
1200 mDayLabels.insert( i, label ); 1204 mDayLabels.insert( i, label );
1201 label = new QLabel( mWeekView ); 1205 label = new QLabel( mWeekView );
1202 label->setFont(bfont); 1206 label->setFont(bfont);
1203 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1207 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1204 label->setLineWidth(1); 1208 label->setLineWidth(1);
1205 label->setAlignment(AlignCenter); 1209 label->setAlignment(AlignCenter);
1206 mDayLabelsW.insert( i, label ); 1210 mDayLabelsW.insert( i, label );
1207 } 1211 }
1208 1212