-rw-r--r-- | korganizer/komonthview.cpp | 33 | ||||
-rw-r--r-- | korganizer/komonthview.h | 6 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 4 |
3 files changed, 30 insertions, 13 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 00b1e92..f2cfb75 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -793,61 +793,76 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
793 | mDayLabels.insert( i, label ); | 793 | mDayLabels.insert( i, label ); |
794 | } | 794 | } |
795 | 795 | ||
796 | bfont.setBold( false ); | 796 | bfont.setBold( false ); |
797 | mWeekLabels.resize( mNumWeeks+1 ); | 797 | mWeekLabels.resize( mNumWeeks+1 ); |
798 | for( i = 0; i < mNumWeeks+1; i++ ) { | 798 | for( i = 0; i < mNumWeeks+1; i++ ) { |
799 | KOWeekButton *label = new KOWeekButton( this ); | 799 | KOWeekButton *label = new KOWeekButton( this ); |
800 | label->setFont(bfont); | 800 | label->setFont(bfont); |
801 | connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); | 801 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
802 | label->setFlat(true); | 802 | label->setFlat(true); |
803 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); | 803 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
804 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 804 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
805 | //label->setLineWidth(1); | 805 | //label->setLineWidth(1); |
806 | //label->setAlignment(AlignCenter); | 806 | //label->setAlignment(AlignCenter); |
807 | mWeekLabels.insert( i, label ); | 807 | mWeekLabels.insert( i, label ); |
808 | } | 808 | } |
809 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 809 | mWeekLabels[mNumWeeks]->setText( i18n("")); |
810 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nswitch to week mode view")); | 810 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
811 | int row, col; | 811 | int row, col; |
812 | QPopupMenu * wpo = new QPopupMenu (this); | ||
813 | wpo->insertItem( i18n("W#"), 0 ); | ||
814 | for ( i = 1; i < 54; i++ ) | ||
815 | wpo->insertItem( i18n("%1").arg(i), i ); | ||
816 | mWeekLabels[mNumWeeks]->setPopup( wpo ); | ||
812 | mCells.resize( mNumCells ); | 817 | mCells.resize( mNumCells ); |
813 | for( row = 0; row < mNumWeeks; ++row ) { | 818 | for( row = 0; row < mNumWeeks; ++row ) { |
814 | for( col = 0; col < mDaysPerWeek; ++col ) { | 819 | for( col = 0; col < mDaysPerWeek; ++col ) { |
815 | MonthViewCell *cell = new MonthViewCell( this ); | 820 | MonthViewCell *cell = new MonthViewCell( this ); |
816 | mCells.insert( row * mDaysPerWeek + col, cell ); | 821 | mCells.insert( row * mDaysPerWeek + col, cell ); |
817 | 822 | ||
818 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 823 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
819 | SLOT( defaultAction( Incidence * ) ) ); | 824 | SLOT( defaultAction( Incidence * ) ) ); |
820 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 825 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
821 | SIGNAL( newEventSignal( QDateTime ) ) ); | 826 | SIGNAL( newEventSignal( QDateTime ) ) ); |
822 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 827 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
823 | SIGNAL( showDaySignal( QDate ) ) ); | 828 | SIGNAL( showDaySignal( QDate ) ) ); |
824 | } | 829 | } |
825 | } | 830 | } |
826 | 831 | ||
827 | connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), | 832 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
828 | SLOT( switchView() ) ); | 833 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); |
829 | mContextMenu = eventPopup(); | 834 | mContextMenu = eventPopup(); |
830 | // updateConfig(); //useless here | 835 | // updateConfig(); //useless here |
831 | 836 | ||
832 | emit incidenceSelected( 0 ); | 837 | emit incidenceSelected( 0 ); |
833 | } | 838 | } |
834 | 839 | ||
835 | KOMonthView::~KOMonthView() | 840 | KOMonthView::~KOMonthView() |
836 | { | 841 | { |
837 | delete mContextMenu; | 842 | delete mContextMenu; |
838 | } | 843 | } |
844 | void KOMonthView::selectDateWeekNum ( int ) | ||
845 | { | ||
846 | |||
847 | } | ||
848 | void KOMonthView::selectInternalWeekNum ( int n ) | ||
849 | { | ||
850 | emit selectWeekNum ( n ); | ||
851 | switchView(); | ||
852 | } | ||
853 | |||
839 | void KOMonthView::switchView() | 854 | void KOMonthView::switchView() |
840 | { | 855 | { |
841 | if ( selectedCell( ) ) | 856 | if ( selectedCell( ) ) |
842 | selectedCell()->deselect(); | 857 | selectedCell()->deselect(); |
843 | mShowWeekView = !mShowWeekView; | 858 | mShowWeekView = !mShowWeekView; |
844 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 859 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
845 | emit showNavigator( !mShowWeekView ); | 860 | //emit showNavigator( !mShowWeekView ); |
846 | computeLayout(); | 861 | computeLayout(); |
847 | updateConfig(); | 862 | updateConfig(); |
848 | } | 863 | } |
849 | 864 | ||
850 | int KOMonthView::maxDatesHint() | 865 | int KOMonthView::maxDatesHint() |
851 | { | 866 | { |
852 | return mNumCells; | 867 | return mNumCells; |
853 | } | 868 | } |
@@ -1217,17 +1232,17 @@ void KOMonthView::computeLayoutWeek() | |||
1217 | } | 1232 | } |
1218 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1233 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1219 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1234 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1220 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1235 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1221 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1236 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1222 | updateDayLabels(); | 1237 | updateDayLabels(); |
1223 | bool forceUpdate = !updatePossible; | 1238 | bool forceUpdate = !updatePossible; |
1224 | updatePossible = true; | 1239 | updatePossible = true; |
1225 | mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1240 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1226 | if ( forceUpdate ) | 1241 | if ( forceUpdate ) |
1227 | updateView(); | 1242 | updateView(); |
1228 | } | 1243 | } |
1229 | void KOMonthView::computeLayout() | 1244 | void KOMonthView::computeLayout() |
1230 | { | 1245 | { |
1231 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 1246 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
1232 | // note this only changes the text if the requested size crosses the | 1247 | // note this only changes the text if the requested size crosses the |
1233 | // threshold between big enough to support the full name and not big | 1248 | // threshold between big enough to support the full name and not big |
@@ -1326,17 +1341,17 @@ void KOMonthView::computeLayout() | |||
1326 | } | 1341 | } |
1327 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1342 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1328 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1343 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1329 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1344 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1330 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1345 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1331 | updateDayLabels(); | 1346 | updateDayLabels(); |
1332 | bool forceUpdate = !updatePossible; | 1347 | bool forceUpdate = !updatePossible; |
1333 | updatePossible = true; | 1348 | updatePossible = true; |
1334 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1349 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1335 | if ( forceUpdate ) | 1350 | if ( forceUpdate ) |
1336 | updateView(); | 1351 | updateView(); |
1337 | } | 1352 | } |
1338 | 1353 | ||
1339 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1354 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1340 | { | 1355 | { |
1341 | mContextMenu->showIncidencePopup(incidence); | 1356 | mContextMenu->showIncidencePopup(incidence); |
1342 | /* | 1357 | /* |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 0bc3743..1ed200b 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -235,24 +235,26 @@ class KOMonthView: public KOEventView | |||
235 | 235 | ||
236 | void clearSelection(); | 236 | void clearSelection(); |
237 | 237 | ||
238 | void showContextMenu( Incidence * ); | 238 | void showContextMenu( Incidence * ); |
239 | 239 | ||
240 | void setSelectedCell( MonthViewCell * ); | 240 | void setSelectedCell( MonthViewCell * ); |
241 | 241 | ||
242 | protected slots: | 242 | protected slots: |
243 | void selectDateWeekNum ( int ); | ||
244 | void selectInternalWeekNum ( int ); | ||
243 | void switchView(); | 245 | void switchView(); |
244 | void processSelectionChange(); | 246 | void processSelectionChange(); |
245 | signals: | 247 | signals: |
246 | void nextMonth(); | 248 | void nextMonth(); |
247 | void prevMonth(); | 249 | void prevMonth(); |
248 | void showNavigator( bool ); | 250 | void showNavigator( bool ); |
249 | void selectWeekNum ( int ); | 251 | void selectWeekNum ( int ); |
250 | void showDaySignal( QDate ); | 252 | void showDaySignal( QDate ); |
251 | protected: | 253 | protected: |
252 | void resizeEvent(QResizeEvent *); | 254 | void resizeEvent(QResizeEvent *); |
253 | void viewChanged(); | 255 | void viewChanged(); |
254 | void updateDayLabels(); | 256 | void updateDayLabels(); |
255 | 257 | ||
256 | private: | 258 | private: |
257 | bool mShowWeekView; | 259 | bool mShowWeekView; |
258 | bool updatePossible; | 260 | bool updatePossible; |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 8aa0697..ca3de59 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -217,17 +217,17 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | |||
217 | } | 217 | } |
218 | 218 | ||
219 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 219 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
220 | { | 220 | { |
221 | mCurrentAgendaView = 0; | 221 | mCurrentAgendaView = 0; |
222 | int wid = mMainView->width() ; | 222 | int wid = mMainView->width() ; |
223 | int hei = mMainView->height(); | 223 | int hei = mMainView->height(); |
224 | if ( mCurrentView == mMonthView ) { | 224 | if ( mCurrentView == mMonthView ) { |
225 | if ( !KOPrefs::instance()->mMonthViewWeek ) { | 225 | if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { |
226 | mMainView->navigatorBar()->show(); | 226 | mMainView->navigatorBar()->show(); |
227 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 227 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
228 | } | 228 | } |
229 | //mMainView->navigatorBar()->hide(); | 229 | //mMainView->navigatorBar()->hide(); |
230 | } else { | 230 | } else { |
231 | mMainView->navigatorBar()->hide(); | 231 | mMainView->navigatorBar()->hide(); |
232 | } | 232 | } |
233 | if ( fullScreen ) { | 233 | if ( fullScreen ) { |
@@ -513,17 +513,17 @@ void KOViewManager::showMonthView() | |||
513 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 513 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
514 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 514 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
515 | 515 | ||
516 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 516 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
517 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 517 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
518 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 518 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
519 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 519 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
520 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 520 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
521 | mMainView, SLOT ( selectWeekNum( int ) ) ); | 521 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); |
522 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 522 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
523 | mMainView, SLOT ( showDay( QDate ) ) ); | 523 | mMainView, SLOT ( showDay( QDate ) ) ); |
524 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 524 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
525 | connect( mMonthView, SIGNAL(nextMonth() ), | 525 | connect( mMonthView, SIGNAL(nextMonth() ), |
526 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); | 526 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); |
527 | connect( mMonthView, SIGNAL(prevMonth() ), | 527 | connect( mMonthView, SIGNAL(prevMonth() ), |
528 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); | 528 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); |
529 | connect( mMonthView, SIGNAL( showNavigator(bool) ), | 529 | connect( mMonthView, SIGNAL( showNavigator(bool) ), |