summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-02-01 12:06:53 (UTC)
committer zautrix <zautrix>2005-02-01 12:06:53 (UTC)
commitd1aa72f683fb264cca6936a8119d0abe9b310325 (patch) (unidiff)
treee9099e8a366ba9890139f6ecce5ad686d3c06d93 /korganizer
parent00b559c52051c05d6df41724b207a038c0e548bf (diff)
downloadkdepimpi-d1aa72f683fb264cca6936a8119d0abe9b310325.zip
kdepimpi-d1aa72f683fb264cca6936a8119d0abe9b310325.tar.gz
kdepimpi-d1aa72f683fb264cca6936a8119d0abe9b310325.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp41
-rw-r--r--korganizer/koagendaview.h1
-rw-r--r--korganizer/kodaymatrix.cpp8
-rw-r--r--korganizer/koviewmanager.cpp41
4 files changed, 48 insertions, 43 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index aa36553..8c27c43 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -622,12 +622,27 @@ void KOAgendaView::slotDaylabelClicked()
622 else 622 else
623 emit showDateView( 3, firstDate.addDays( cap.toInt()-1 ) ); 623 emit showDateView( 3, firstDate.addDays( cap.toInt()-1 ) );
624 } 624 }
625 else 625 else
626 showDateView( 10, firstDate.addDays(1 ) ); 626 showDateView( 10, firstDate.addDays(1 ) );
627} 627}
628
629QPushButton* KOAgendaView::getNewDaylabel()
630{
631
632 QPushButton * dayLabel = new QPushButton(mDayLabels);
633 dayLabel->setFlat( true );
634 connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) );
635 dayLabel->setFocusPolicy(NoFocus);
636 dayLabel->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding ));
637 mDayLabelsList.append( dayLabel );
638 mLayoutDayLabels->addWidget(dayLabel);
639 //mLayoutDayLabels->setStretchFactor(dayLabel, 100);
640 return dayLabel ;
641}
642
628void KOAgendaView::createDayLabels() 643void KOAgendaView::createDayLabels()
629{ 644{
630 645
631 if ( mBlockUpdating || globalFlagBlockLabel == 1) { 646 if ( mBlockUpdating || globalFlagBlockLabel == 1) {
632 // qDebug(" KOAgendaView::createDayLabels() blocked "); 647 // qDebug(" KOAgendaView::createDayLabels() blocked ");
633 return; 648 return;
@@ -646,13 +661,14 @@ void KOAgendaView::createDayLabels()
646 661
647 QFont dlf = KOPrefs::instance()->mTimeLabelsFont; 662 QFont dlf = KOPrefs::instance()->mTimeLabelsFont;
648 QFontMetrics fm ( dlf ); 663 QFontMetrics fm ( dlf );
649 int selCount = mSelectedDates.count(); 664 int selCount = mSelectedDates.count();
650 QString dayTest = "Mon 20"; 665 QString dayTest = "Mon 20";
651 int wid = fm.width( dayTest ); 666 int wid = fm.width( dayTest );
652 maxWid -= ( selCount * 3 ); 667 //maxWid -= ( selCount * 3 ); //working for QLabels
668 maxWid -= ( selCount * 5 ); //working for QPushButton
653 if ( maxWid < 0 ) 669 if ( maxWid < 0 )
654 maxWid = 20; 670 maxWid = 20;
655 int needWid = wid * selCount; 671 int needWid = wid * selCount;
656 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); 672 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid );
657 //if ( needWid > maxWid ) 673 //if ( needWid > maxWid )
658 // qDebug("DAYLABELS TOOOOOOO BIG "); 674 // qDebug("DAYLABELS TOOOOOOO BIG ");
@@ -666,13 +682,13 @@ void KOAgendaView::createDayLabels()
666 if ( maxLen < 2 ) { 682 if ( maxLen < 2 ) {
667 int fontPoint = dlf.pointSize(); 683 int fontPoint = dlf.pointSize();
668 while ( fontPoint > 4 ) { 684 while ( fontPoint > 4 ) {
669 --fontPoint; 685 --fontPoint;
670 dlf.setPointSize( fontPoint ); 686 dlf.setPointSize( fontPoint );
671 QFontMetrics f( dlf ); 687 QFontMetrics f( dlf );
672 wid = f.width( "20" ); 688 wid = f.width( "20" )+2;
673 needWid = wid * selCount; 689 needWid = wid * selCount;
674 if ( needWid < maxWid ) 690 if ( needWid < maxWid )
675 break; 691 break;
676 } 692 }
677 maxLen = 2; 693 maxLen = 2;
678 } 694 }
@@ -687,18 +703,13 @@ void KOAgendaView::createDayLabels()
687 // QFont lFont = dlf; 703 // QFont lFont = dlf;
688 bool appendLabels = false; 704 bool appendLabels = false;
689 QPushButton *dayLabel; 705 QPushButton *dayLabel;
690 dayLabel = mDayLabelsList.first(); 706 dayLabel = mDayLabelsList.first();
691 if ( !dayLabel ) { 707 if ( !dayLabel ) {
692 appendLabels = true; 708 appendLabels = true;
693 dayLabel = new QPushButton(mDayLabels); 709 dayLabel = getNewDaylabel();
694 dayLabel->setFlat( true );
695 connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) );
696 dayLabel->setFocusPolicy(NoFocus);
697 mDayLabelsList.append( dayLabel );
698 mLayoutDayLabels->addWidget(dayLabel);
699 } 710 }
700 dayLabel->setFixedWidth( mTimeLabels->width()+2 ); 711 dayLabel->setFixedWidth( mTimeLabels->width()+2 );
701 dayLabel->setFont( dlf ); 712 dayLabel->setFont( dlf );
702 dayLabel->setCaption("0"); 713 dayLabel->setCaption("0");
703 //dayLabel->setAlignment(QLabel::AlignHCenter); 714 //dayLabel->setAlignment(QLabel::AlignHCenter);
704 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); 715 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) );
@@ -713,18 +724,13 @@ void KOAgendaView::createDayLabels()
713 if ( ! appendLabels ) { 724 if ( ! appendLabels ) {
714 dayLabel = mDayLabelsList.next(); 725 dayLabel = mDayLabelsList.next();
715 if ( !dayLabel ) 726 if ( !dayLabel )
716 appendLabels = true; 727 appendLabels = true;
717 } 728 }
718 if ( appendLabels ) { 729 if ( appendLabels ) {
719 dayLabel = new QPushButton(mDayLabels); 730 dayLabel = getNewDaylabel();
720 dayLabel->setFlat( true );
721 connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) );
722 dayLabel->setFocusPolicy(NoFocus);
723 mDayLabelsList.append( dayLabel );
724 mLayoutDayLabels->addWidget(dayLabel);
725 } 731 }
726 dayLabel->setMinimumWidth( 1 ); 732 dayLabel->setMinimumWidth( 1 );
727 dayLabel->setMaximumWidth( 2048 ); 733 dayLabel->setMaximumWidth( 2048 );
728 dayLabel->setFont( dlf ); 734 dayLabel->setFont( dlf );
729 dayLabel->show(); 735 dayLabel->show();
730 dayLabel->setCaption(QString::number( counter )); 736 dayLabel->setCaption(QString::number( counter ));
@@ -804,18 +810,13 @@ void KOAgendaView::createDayLabels()
804 if ( ! appendLabels ) { 810 if ( ! appendLabels ) {
805 dayLabel = mDayLabelsList.next(); 811 dayLabel = mDayLabelsList.next();
806 if ( !dayLabel ) 812 if ( !dayLabel )
807 appendLabels = true; 813 appendLabels = true;
808 } 814 }
809 if ( appendLabels ) { 815 if ( appendLabels ) {
810 dayLabel = new QPushButton(mDayLabels); 816 dayLabel = getNewDaylabel();
811 dayLabel->setFlat( true );
812 connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) );
813 dayLabel->setFocusPolicy(NoFocus);
814 mDayLabelsList.append( dayLabel );
815 mLayoutDayLabels->addWidget(dayLabel);
816 } 817 }
817 //dayLabel->hide();//test only 818 //dayLabel->hide();//test only
818 819
819 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; 820 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ;
820 if ( offset < 0 ) offset = 0; 821 if ( offset < 0 ) offset = 0;
821 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); 822 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 );
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index fd0a7af..cbe86b6 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -187,12 +187,13 @@ class KOAgendaView : public KOEventView {
187 void toggleExpand(); 187 void toggleExpand();
188 void todoMoved( Todo *, int ); 188 void todoMoved( Todo *, int );
189 void incidenceChanged(Incidence * , int ); 189 void incidenceChanged(Incidence * , int );
190 // void cloneIncidenceSignal(Incidence *); 190 // void cloneIncidenceSignal(Incidence *);
191 191
192 protected: 192 protected:
193 QPushButton* getNewDaylabel();
193 bool mBlockUpdating; 194 bool mBlockUpdating;
194 int mUpcomingWidth; 195 int mUpcomingWidth;
195 /** Fill agenda beginning with date startDate */ 196 /** Fill agenda beginning with date startDate */
196 void fillAgenda(const QDate &startDate); 197 void fillAgenda(const QDate &startDate);
197 void resizeEvent( QResizeEvent* e ); 198 void resizeEvent( QResizeEvent* e );
198 /** Fill agenda using the current set value for the start date */ 199 /** Fill agenda using the current set value for the start date */
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index dd83d48..989f758 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -337,21 +337,21 @@ void KODayMatrix::mouseReleaseEvent (QMouseEvent* e)
337 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; 337 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1;
338 338
339 if (mSelInit > tmp) { 339 if (mSelInit > tmp) {
340 mSelEnd = mSelInit; 340 mSelEnd = mSelInit;
341 if (tmp != mSelStart) { 341 if (tmp != mSelStart) {
342 mSelStart = tmp; 342 mSelStart = tmp;
343 repaint(); 343 repaint(false);
344 } 344 }
345 } else { 345 } else {
346 mSelStart = mSelInit; 346 mSelStart = mSelInit;
347 347
348 //repaint only if selection has changed 348 //repaint only if selection has changed
349 if (tmp != mSelEnd) { 349 if (tmp != mSelEnd) {
350 mSelEnd = tmp; 350 mSelEnd = tmp;
351 repaint(); 351 repaint(false);
352 } 352 }
353 } 353 }
354 354
355 DateList daylist; 355 DateList daylist;
356 if ( mSelStart < 0 ) 356 if ( mSelStart < 0 )
357 mSelStart = 0; 357 mSelStart = 0;
@@ -368,21 +368,21 @@ void KODayMatrix::mouseMoveEvent (QMouseEvent* e)
368 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; 368 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1;
369 369
370 if (mSelInit > tmp) { 370 if (mSelInit > tmp) {
371 mSelEnd = mSelInit; 371 mSelEnd = mSelInit;
372 if (tmp != mSelStart) { 372 if (tmp != mSelStart) {
373 mSelStart = tmp; 373 mSelStart = tmp;
374 repaint(); 374 repaint(false);
375 } 375 }
376 } else { 376 } else {
377 mSelStart = mSelInit; 377 mSelStart = mSelInit;
378 378
379 //repaint only if selection has changed 379 //repaint only if selection has changed
380 if (tmp != mSelEnd) { 380 if (tmp != mSelEnd) {
381 mSelEnd = tmp; 381 mSelEnd = tmp;
382 repaint(); 382 repaint(false);
383 } 383 }
384 } 384 }
385} 385}
386 386
387// ---------------------------------------------------------------------------- 387// ----------------------------------------------------------------------------
388// D R A G ' N D R O P H A N D L I N G 388// D R A G ' N D R O P H A N D L I N G
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 188ad23..7e126d9 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -95,26 +95,28 @@ void KOViewManager::readSettings(KConfig *config)
95 else if (view == "Todo") showTodoView(); 95 else if (view == "Todo") showTodoView();
96 else { 96 else {
97 showAgendaView(); 97 showAgendaView();
98 } 98 }
99} 99}
100 100
101
102void KOViewManager::showDateView( int view, QDate date) 101void KOViewManager::showDateView( int view, QDate date)
103{ 102{
104 103 static int lastMode = 0;
104 static int lastCount = 0;
105 static bool lastNDMode = false;
106 static QDate lastDate;
105 //qDebug("date %d %s", view, date.toString().latin1()); 107 //qDebug("date %d %s", view, date.toString().latin1());
106#if 0 108
107 mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); 109 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
108 mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 ); 110 bool savemFlagShowNextxDays = mFlagShowNextxDays;
109 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 ); 111 mFlagShowNextxDays = false;
110 mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 );
111 mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
112#endif
113 if ( view == 3 ) { 112 if ( view == 3 ) {
114 //mCurrentAgendaView = 1 ; 113 //mCurrentAgendaView = 1 ;
114 lastDate = mMainView->dateNavigator()->selectedDates().first();
115 lastCount = mMainView->dateNavigator()->selectedDates().count();
116 lastNDMode = savemFlagShowNextxDays;
115 mMainView->showDay( date ); 117 mMainView->showDay( date );
116 } else if (view == 4 ) { 118 } else if (view == 4 ) {
117 mCurrentAgendaView = 7 ; 119 mCurrentAgendaView = 7 ;
118 mMainView->dateNavigator()->selectDates( date, 7 ); 120 mMainView->dateNavigator()->selectDates( date, 7 );
119 } else if (view == 5 ) { 121 } else if (view == 5 ) {
120 mCurrentAgendaView = 14 ; 122 mCurrentAgendaView = 14 ;
@@ -135,25 +137,26 @@ void KOViewManager::showDateView( int view, QDate date)
135 showAgendaView(KOPrefs::instance()->mFullViewMonth); 137 showAgendaView(KOPrefs::instance()->mFullViewMonth);
136 globalFlagBlockAgenda = 2; 138 globalFlagBlockAgenda = 2;
137 mMainView->dateNavigator()->selectDates( date , 139 mMainView->dateNavigator()->selectDates( date ,
138 KOPrefs::instance()->mNextXDays ); 140 KOPrefs::instance()->mNextXDays );
139 mFlagShowNextxDays = true; 141 mFlagShowNextxDays = true;
140 mCurrentAgendaView = 3 ; 142 mCurrentAgendaView = 3 ;
141 } if (view == 9) { 143 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
142 showWeekView(); 144 if ( lastMode ) {
145 mCurrentAgendaView = lastCount ;
146 mMainView->dateNavigator()->selectDates( lastDate, lastCount);
147 mFlagShowNextxDays = lastNDMode;
148 if ( mFlagShowNextxDays ) {
149 mCurrentAgendaView = 3 ;
150 }
151 } else
152 showWeekView();
143 } else if (view == 10) { 153 } else if (view == 10) {
144 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); 154 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
145 } 155 }
146 156 lastMode = view;
147#if 0
148 dateNavigator()->blockSignals( true );
149 dateNavigator()->selectDate( d );
150 dateNavigator()->blockSignals( false );
151 mViewManager->showDayView();
152#endif
153
154} 157}
155 158
156 159
157 160
158void KOViewManager::writeSettings(KConfig *config) 161void KOViewManager::writeSettings(KConfig *config)
159{ 162{