summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp18
-rw-r--r--korganizer/koagendaview.h1
-rw-r--r--korganizer/komonthview.cpp11
-rw-r--r--korganizer/koviewmanager.cpp2
4 files changed, 27 insertions, 5 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index d4ff77a..aed9bae 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -404,49 +404,65 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
404 mAllDayFrame = new QHBox(mSplitterAgenda); 404 mAllDayFrame = new QHBox(mSplitterAgenda);
405 mAllDayFrame->setFocusPolicy(NoFocus); 405 mAllDayFrame->setFocusPolicy(NoFocus);
406 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 406 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
407 agendaFrame->setFocusPolicy(NoFocus); 407 agendaFrame->setFocusPolicy(NoFocus);
408 408
409#endif 409#endif
410 410
411 // Create all-day agenda widget 411 // Create all-day agenda widget
412 mDummyAllDayLeft = new QVBox( mAllDayFrame ); 412 mDummyAllDayLeft = new QVBox( mAllDayFrame );
413 413
414 mExpandButton = new QPushButton(mDummyAllDayLeft); 414 mExpandButton = new QPushButton(mDummyAllDayLeft);
415 mExpandButton->setPixmap( mNotExpandedPixmap ); 415 mExpandButton->setPixmap( mNotExpandedPixmap );
416 int widebut = mExpandButton->sizeHint().width(); 416 int widebut = mExpandButton->sizeHint().width();
417 if ( QApplication::desktop()->width() < 480 ) 417 if ( QApplication::desktop()->width() < 480 )
418 widebut = widebut*2; 418 widebut = widebut*2;
419 else 419 else
420 widebut = (widebut*3) / 2; 420 widebut = (widebut*3) / 2;
421 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, 421 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
422 // QSizePolicy::Fixed ) ); 422 // QSizePolicy::Fixed ) );
423 mExpandButton->setFixedSize( widebut, widebut); 423 mExpandButton->setFixedSize( widebut, widebut);
424 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); 424 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
425 mExpandButton->setFocusPolicy(NoFocus); 425 mExpandButton->setFocusPolicy(NoFocus);
426 mAllDayAgenda = new KOAgenda(1,mAllDayFrame); 426 mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
427 mAllDayAgenda->setFocusPolicy(NoFocus); 427 mAllDayAgenda->setFocusPolicy(NoFocus);
428 QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); 428 QVBox *dummyAllDayRight = new QVBox(mAllDayFrame);
429
430 QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight);
431 QLabel * dummyAllDayRightL = new QLabel ( dummyAllDayRight );
432
433 dummyAllDayRightB->setFlat( true );
434 dummyAllDayRightB->setFocusPolicy(NoFocus);
435 // dummyAllDayRightB->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding ));
436 //dummyAllDayRightB->setFixedHeight( dummyAllDayRightB->sizeHint().height()/2 );
437 QPopupMenu * wpo = new QPopupMenu (this);
438 wpo->insertItem( i18n("W#"), 0 );
439 int i;
440 for ( i = 1; i < 54; i++ )
441 wpo->insertItem( QString::number( i ),i );
442 dummyAllDayRightB->setPopup( wpo );
443
444 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) );
429 445
430 // Create event context menu for all day agenda 446 // Create event context menu for all day agenda
431 mAllDayAgendaPopup = eventPopup(); 447 mAllDayAgendaPopup = eventPopup();
432 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 448 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
433 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 449 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
434 450
435 // Create agenda frame 451 // Create agenda frame
436 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); 452 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3);
437 // QHBox *agendaFrame = new QHBox(splitterAgenda); 453 // QHBox *agendaFrame = new QHBox(splitterAgenda);
438 454
439 // create event indicator bars 455 // create event indicator bars
440 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); 456 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
441 agendaLayout->addWidget(mEventIndicatorTop,0,1); 457 agendaLayout->addWidget(mEventIndicatorTop,0,1);
442 mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); 458 mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
443 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, 459 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
444 agendaFrame); 460 agendaFrame);
445 agendaLayout->addWidget(mEventIndicatorBottom,2,1); 461 agendaLayout->addWidget(mEventIndicatorBottom,2,1);
446 QWidget *dummyAgendaRight = new QWidget(agendaFrame); 462 QWidget *dummyAgendaRight = new QWidget(agendaFrame);
447 agendaLayout->addWidget(dummyAgendaRight,0,2); 463 agendaLayout->addWidget(dummyAgendaRight,0,2);
448 464
449 // Create time labels 465 // Create time labels
450 mTimeLabels = new TimeLabels(24,agendaFrame); 466 mTimeLabels = new TimeLabels(24,agendaFrame);
451 agendaLayout->addWidget(mTimeLabels,1,0); 467 agendaLayout->addWidget(mTimeLabels,1,0);
452 connect(mTimeLabels,SIGNAL( scaleChanged()), 468 connect(mTimeLabels,SIGNAL( scaleChanged()),
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index e9e85cc..4a058ce 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -189,48 +189,49 @@ class KOAgendaView : public KOEventView {
189 189
190 void newTodo(int gx,int gy); 190 void newTodo(int gx,int gy);
191 void newEvent(int gx,int gy); 191 void newEvent(int gx,int gy);
192 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); 192 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd);
193 void newEventAllDay(int gx, int gy); 193 void newEventAllDay(int gx, int gy);
194 void newTodoAllDay(int gx, int gy); 194 void newTodoAllDay(int gx, int gy);
195 195
196 void startDrag(Event *); 196 void startDrag(Event *);
197 197
198 void readSettings(); 198 void readSettings();
199 void readSettings(KConfig *); 199 void readSettings(KConfig *);
200 void writeSettings(KConfig *); 200 void writeSettings(KConfig *);
201 201
202 void setContentsPos(int y); 202 void setContentsPos(int y);
203 203
204 void setExpandedButton( bool expanded ); 204 void setExpandedButton( bool expanded );
205 void scrollOneHourUp(); 205 void scrollOneHourUp();
206 void scrollOneHourDown(); 206 void scrollOneHourDown();
207 void addToCalSlot(Incidence *, Incidence *); 207 void addToCalSlot(Incidence *, Incidence *);
208 208
209 signals: 209 signals:
210 void showDateView( int, QDate ); 210 void showDateView( int, QDate );
211 void newTodoSignal( QDateTime ,bool ); 211 void newTodoSignal( QDateTime ,bool );
212 void toggleExpand(); 212 void toggleExpand();
213 void selectWeekNum( int );
213 void todoMoved( Todo *, int ); 214 void todoMoved( Todo *, int );
214 void incidenceChanged(Incidence * , int ); 215 void incidenceChanged(Incidence * , int );
215 // void cloneIncidenceSignal(Incidence *); 216 // void cloneIncidenceSignal(Incidence *);
216 217
217 protected: 218 protected:
218 KOAgendaButton* getNewDaylabel(); 219 KOAgendaButton* getNewDaylabel();
219 bool mBlockUpdating; 220 bool mBlockUpdating;
220 int mUpcomingWidth; 221 int mUpcomingWidth;
221 /** Fill agenda beginning with date startDate */ 222 /** Fill agenda beginning with date startDate */
222 void fillAgenda(const QDate &startDate); 223 void fillAgenda(const QDate &startDate);
223 void resizeEvent( QResizeEvent* e ); 224 void resizeEvent( QResizeEvent* e );
224 /** Fill agenda using the current set value for the start date */ 225 /** Fill agenda using the current set value for the start date */
225 void fillAgenda(); 226 void fillAgenda();
226 227
227 /** Create labels for the selected dates. */ 228 /** Create labels for the selected dates. */
228 void createDayLabels(); 229 void createDayLabels();
229 230
230 /** 231 /**
231 Set the masks on the agenda widgets indicating, which days are holidays. 232 Set the masks on the agenda widgets indicating, which days are holidays.
232 */ 233 */
233 void setHolidayMasks(); 234 void setHolidayMasks();
234 235
235 protected slots: 236 protected slots:
236 void slotDaylabelClicked( int ); 237 void slotDaylabelClicked( int );
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index f2cfb75..ab96786 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -888,64 +888,67 @@ DateList KOMonthView::selectedDates()
888{ 888{
889 DateList selected; 889 DateList selected;
890 890
891 if ( mSelectedCell ) { 891 if ( mSelectedCell ) {
892 QDate qd = mSelectedCell->selectedIncidenceDate(); 892 QDate qd = mSelectedCell->selectedIncidenceDate();
893 if ( qd.isValid() ) selected.append( qd ); 893 if ( qd.isValid() ) selected.append( qd );
894 } 894 }
895 895
896 return selected; 896 return selected;
897} 897}
898 898
899void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 899void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
900 const QDate &td) 900 const QDate &td)
901{ 901{
902#ifndef KORG_NOPRINTER 902#ifndef KORG_NOPRINTER
903 calPrinter->preview(CalPrinter::Month, fd, td); 903 calPrinter->preview(CalPrinter::Month, fd, td);
904#endif 904#endif
905} 905}
906 906
907void KOMonthView::updateConfig() 907void KOMonthView::updateConfig()
908{ 908{
909 909
910 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 910 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
911 911
912 if ( mShowWeekView ) 912 if ( mShowWeekView ) {
913 mWeekStartsMonday = true; 913 mWeekStartsMonday = true;
914 }
914 QFontMetrics fontmetric(mDayLabels[0]->font()); 915 QFontMetrics fontmetric(mDayLabels[0]->font());
915 mWidthLongDayLabel = 0; 916 mWidthLongDayLabel = 0;
916 917
917 for (int i = 0; i < 7; i++) { 918 for (int i = 0; i < 7; i++) {
918 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 919 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
919 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 920 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
920 } 921 }
921 bool temp = mShowSatSunComp ; 922 bool temp = mShowSatSunComp ;
922 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 923 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
923 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 924 if ( ! mShowWeekView ) {
924 computeLayout(); 925 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
926 computeLayout();
927 }
925 updateDayLabels(); 928 updateDayLabels();
926 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 929 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
927 int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 930 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
928 //resizeEvent( 0 ); 931 //resizeEvent( 0 );
929 for (uint i = 0; i < mCells.count(); ++i) { 932 for (uint i = 0; i < mCells.count(); ++i) {
930 mCells[i]->updateConfig(); 933 mCells[i]->updateConfig();
931 } 934 }
932#ifdef DESKTOP_VERSION 935#ifdef DESKTOP_VERSION
933 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); 936 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
934#endif 937#endif
935 updateView(); 938 updateView();
936} 939}
937 940
938void KOMonthView::updateDayLabels() 941void KOMonthView::updateDayLabels()
939{ 942{
940 943
941 for (int i = 0; i < 7; i++) { 944 for (int i = 0; i < 7; i++) {
942 if (mWeekStartsMonday) { 945 if (mWeekStartsMonday) {
943 bool show = mShortDayLabels; 946 bool show = mShortDayLabels;
944 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) 947 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() )
945 show = true; 948 show = true;
946 mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 949 mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
947 } else { 950 } else {
948 if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); 951 if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels));
949 else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); 952 else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels));
950 953
951 } 954 }
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index ca3de59..a74c5fe 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -386,48 +386,50 @@ void KOViewManager::showAgendaView( bool fullScreen )
386 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 386 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
387 mMainView, SLOT(deleteIncidence(Incidence *))); 387 mMainView, SLOT(deleteIncidence(Incidence *)));
388 388
389 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 389 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
390 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 390 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
391 391
392 connect(mAgendaView, SIGNAL( toggleExpand() ), 392 connect(mAgendaView, SIGNAL( toggleExpand() ),
393 mMainView, SLOT( toggleExpand() ) ); 393 mMainView, SLOT( toggleExpand() ) );
394 394
395 connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), 395 connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ),
396 mAgendaView, SLOT( setExpandedButton( bool ) ) ); 396 mAgendaView, SLOT( setExpandedButton( bool ) ) );
397 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 397 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
398 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 398 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
399 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 399 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
400 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 400 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
401 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 401 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
402 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 402 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
403 SLOT( updateTodo( Todo *, int ) ) ); 403 SLOT( updateTodo( Todo *, int ) ) );
404 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 404 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
405 mMainView, SIGNAL( todoModified( Todo *, int ))); 405 mMainView, SIGNAL( todoModified( Todo *, int )));
406 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 406 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
407 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 407 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
408 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 408 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
409 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 409 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
410 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
411 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
410 mAgendaView->readSettings(); 412 mAgendaView->readSettings();
411 mAgendaView->updateConfig(); 413 mAgendaView->updateConfig();
412 } 414 }
413 415
414 showView( mAgendaView, full); 416 showView( mAgendaView, full);
415 417
416} 418}
417 419
418void KOViewManager::showDayView() 420void KOViewManager::showDayView()
419{ 421{
420 mFlagShowNextxDays = false; 422 mFlagShowNextxDays = false;
421 globalFlagBlockLabel = 1; 423 globalFlagBlockLabel = 1;
422 globalFlagBlockAgenda = 1; 424 globalFlagBlockAgenda = 1;
423 if ( mCurrentAgendaView != 1 ) 425 if ( mCurrentAgendaView != 1 )
424 mCurrentAgendaView = -1; 426 mCurrentAgendaView = -1;
425 showAgendaView(); 427 showAgendaView();
426 qApp->processEvents(); 428 qApp->processEvents();
427 globalFlagBlockAgenda = 2; 429 globalFlagBlockAgenda = 2;
428 globalFlagBlockLabel = 0; 430 globalFlagBlockLabel = 0;
429 mMainView->dateNavigator()->selectDates( 1 ); 431 mMainView->dateNavigator()->selectDates( 1 );
430 mCurrentAgendaView = 1 ; 432 mCurrentAgendaView = 1 ;
431 433
432} 434}
433 435