summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--korganizer/datenavigatorcontainer.cpp20
-rw-r--r--korganizer/kdatenavigator.cpp5
-rw-r--r--korganizer/kdatenavigator.h5
-rw-r--r--korganizer/kodaymatrix.cpp0
5 files changed, 22 insertions, 9 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 29c530b..9acbbb1 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1811,97 +1811,96 @@ void CalendarView::readSettings()
1811 sizes = config->readIntListEntry("Separator2"); 1811 sizes = config->readIntListEntry("Separator2");
1812 if ( ( mResourceView && sizes.count() == 4 ) || 1812 if ( ( mResourceView && sizes.count() == 4 ) ||
1813 ( !mResourceView && sizes.count() == 3 ) ) { 1813 ( !mResourceView && sizes.count() == 3 ) ) {
1814 mLeftSplitter->setSizes(sizes); 1814 mLeftSplitter->setSizes(sizes);
1815 } 1815 }
1816#endif 1816#endif
1817 globalFlagBlockAgenda = 1; 1817 globalFlagBlockAgenda = 1;
1818 mViewManager->showAgendaView(); 1818 mViewManager->showAgendaView();
1819 //mViewManager->readSettings( config ); 1819 //mViewManager->readSettings( config );
1820 mTodoList->restoreLayout(config,QString("Todo Layout")); 1820 mTodoList->restoreLayout(config,QString("Todo Layout"));
1821 readFilterSettings(config); 1821 readFilterSettings(config);
1822 config->setGroup( "Views" ); 1822 config->setGroup( "Views" );
1823 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1823 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1824 1824
1825 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); 1825 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
1826 1826
1827 int resetval = 0; 1827 int resetval = 0;
1828 int maxVal = 0; 1828 int maxVal = 0;
1829 if (sizes.count() != 3) { 1829 if (sizes.count() != 3) {
1830 if ( KOPrefs::instance()->mVerticalScreen ) { 1830 if ( KOPrefs::instance()->mVerticalScreen ) {
1831 resetval = mDateNavigator->sizeHint().width()+2; 1831 resetval = mDateNavigator->sizeHint().width()+2;
1832 } else { 1832 } else {
1833 resetval = mDateNavigator->sizeHint().height()+2; 1833 resetval = mDateNavigator->sizeHint().height()+2;
1834 } 1834 }
1835 } 1835 }
1836 if ( !resetval ){// i.e. sizes.count() == 3 1836 if ( !resetval ){// i.e. sizes.count() == 3
1837 if ( KOPrefs::instance()->mVerticalScreen ) { 1837 if ( KOPrefs::instance()->mVerticalScreen ) {
1838 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) 1838 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 )
1839 resetval = mDateNavigator->sizeHint().width()+2; 1839 resetval = mDateNavigator->sizeHint().width()+2;
1840 } else { 1840 } else {
1841 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) 1841 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 )
1842 resetval = mDateNavigator->sizeHint().height()+2; 1842 resetval = mDateNavigator->sizeHint().height()+2;
1843 } 1843 }
1844 } 1844 }
1845 if ( resetval ) { 1845 if ( resetval ) {
1846 sizes.clear(); 1846 sizes.clear();
1847 if ( KOPrefs::instance()->mVerticalScreen ) { 1847 if ( KOPrefs::instance()->mVerticalScreen ) {
1848 maxVal = QApplication::desktop()->width() -10; 1848 maxVal = QApplication::desktop()->width() -10;
1849 } else { 1849 } else {
1850 maxVal = QApplication::desktop()->height()-10; 1850 maxVal = QApplication::desktop()->height()-10;
1851 } 1851 }
1852 sizes << resetval; 1852 sizes << resetval;
1853 if ( maxVal < resetval + resetval) 1853 if ( maxVal < resetval + resetval)
1854 resetval = maxVal - resetval; 1854 resetval = maxVal - resetval;
1855 sizes << resetval; 1855 sizes << resetval;
1856 sizes << 100; 1856 sizes << 100;
1857 } 1857 }
1858 mLeftFrame->setSizes(sizes); 1858 mLeftFrame->setSizes(sizes);
1859 qDebug("sizes count %d ", sizes.count());
1860 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1859 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1861 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1860 else if ( dateCount == 7 ) mNavigator->selectWeek();
1862 else mNavigator->selectDates( dateCount ); 1861 else mNavigator->selectDates( dateCount );
1863 // mViewManager->readSettings( config ); 1862 // mViewManager->readSettings( config );
1864 updateConfig(); 1863 updateConfig();
1865 globalFlagBlockAgenda = 2; 1864 globalFlagBlockAgenda = 2;
1866 mViewManager->readSettings( config ); 1865 mViewManager->readSettings( config );
1867#ifdef DESKTOP_VERSION 1866#ifdef DESKTOP_VERSION
1868 config->setGroup("WidgetLayout"); 1867 config->setGroup("WidgetLayout");
1869 QStringList list; 1868 QStringList list;
1870 list = config->readListEntry("MainLayout"); 1869 list = config->readListEntry("MainLayout");
1871 int x,y,w,h; 1870 int x,y,w,h;
1872 if ( ! list.isEmpty() ) { 1871 if ( ! list.isEmpty() ) {
1873 x = list[0].toInt(); 1872 x = list[0].toInt();
1874 y = list[1].toInt(); 1873 y = list[1].toInt();
1875 w = list[2].toInt(); 1874 w = list[2].toInt();
1876 h = list[3].toInt(); 1875 h = list[3].toInt();
1877 topLevelWidget()->setGeometry(x,y,w,h); 1876 topLevelWidget()->setGeometry(x,y,w,h);
1878 1877
1879 } else { 1878 } else {
1880 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1879 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1881 } 1880 }
1882 list = config->readListEntry("EditEventLayout"); 1881 list = config->readListEntry("EditEventLayout");
1883 if ( ! list.isEmpty() ) { 1882 if ( ! list.isEmpty() ) {
1884 x = list[0].toInt(); 1883 x = list[0].toInt();
1885 y = list[1].toInt(); 1884 y = list[1].toInt();
1886 w = list[2].toInt(); 1885 w = list[2].toInt();
1887 h = list[3].toInt(); 1886 h = list[3].toInt();
1888 mEventEditor->setGeometry(x,y,w,h); 1887 mEventEditor->setGeometry(x,y,w,h);
1889 1888
1890 } 1889 }
1891 list = config->readListEntry("EditTodoLayout"); 1890 list = config->readListEntry("EditTodoLayout");
1892 if ( ! list.isEmpty() ) { 1891 if ( ! list.isEmpty() ) {
1893 x = list[0].toInt(); 1892 x = list[0].toInt();
1894 y = list[1].toInt(); 1893 y = list[1].toInt();
1895 w = list[2].toInt(); 1894 w = list[2].toInt();
1896 h = list[3].toInt(); 1895 h = list[3].toInt();
1897 mTodoEditor->setGeometry(x,y,w,h); 1896 mTodoEditor->setGeometry(x,y,w,h);
1898 1897
1899 } 1898 }
1900 list = config->readListEntry("ViewerLayout"); 1899 list = config->readListEntry("ViewerLayout");
1901 if ( ! list.isEmpty() ) { 1900 if ( ! list.isEmpty() ) {
1902 x = list[0].toInt(); 1901 x = list[0].toInt();
1903 y = list[1].toInt(); 1902 y = list[1].toInt();
1904 w = list[2].toInt(); 1903 w = list[2].toInt();
1905 h = list[3].toInt(); 1904 h = list[3].toInt();
1906 getEventViewerDialog()->setGeometry(x,y,w,h); 1905 getEventViewerDialog()->setGeometry(x,y,w,h);
1907 } 1906 }
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index 3f6e29b..d09f484 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -82,133 +82,143 @@ void DateNavigatorContainer::setCalendar( Calendar *cal )
82 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 82 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
83 n->setCalendar( cal ); 83 n->setCalendar( cal );
84 } 84 }
85} 85}
86 86
87void DateNavigatorContainer::updateDayMatrix() 87void DateNavigatorContainer::updateDayMatrix()
88{ 88{
89 mNavigatorView->updateDayMatrix(); 89 mNavigatorView->updateDayMatrix();
90 KDateNavigator *n; 90 KDateNavigator *n;
91 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 91 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
92 n->updateDayMatrix(); 92 n->updateDayMatrix();
93 } 93 }
94} 94}
95 95
96void DateNavigatorContainer::updateToday() 96void DateNavigatorContainer::updateToday()
97{ 97{
98 qDebug("DateNavigatorContainer::updateToday() NOT IMPL "); 98 qDebug("DateNavigatorContainer::updateToday() NOT IMPL ");
99#if 0 99#if 0
100 mNavigatorView->updateToday(); 100 mNavigatorView->updateToday();
101 KDateNavigator *n; 101 KDateNavigator *n;
102 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 102 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
103 n->updateToday(); 103 n->updateToday();
104 } 104 }
105#endif 105#endif
106} 106}
107 107
108void DateNavigatorContainer::updateView() 108void DateNavigatorContainer::updateView()
109{ 109{
110 mNavigatorView->updateView(); 110 mNavigatorView->updateView();
111 KDateNavigator *n; 111 KDateNavigator *n;
112 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 112 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
113 n->updateView(); 113 n->updateView();
114 } 114 }
115} 115}
116 116
117void DateNavigatorContainer::updateConfig() 117void DateNavigatorContainer::updateConfig()
118{ 118{
119 mNavigatorView->updateConfig(); 119 mNavigatorView->updateConfig();
120 KDateNavigator *n; 120 KDateNavigator *n;
121 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 121 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
122 n->updateConfig(); 122 n->updateConfig();
123 } 123 }
124} 124}
125 125
126void DateNavigatorContainer::selectDates( const DateList &dateList ) 126void DateNavigatorContainer::selectDates( const DateList &dateList )
127{ 127{
128 mNavigatorView->selectDates( dateList ); 128 mNavigatorView->selectDates( dateList );
129 setBaseDates(); 129 setBaseDates();
130 if ( mExtraViews.count() ) {
131 KDateNavigator *view = mExtraViews.at( 0 );
132 view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
133 view->dayMatrix()->repaint();
134 }
130} 135}
131 136
132void DateNavigatorContainer::setBaseDates() 137void DateNavigatorContainer::setBaseDates()
133{ 138{
134 KCal::DateList dateList = mNavigatorView->selectedDates(); 139 KCal::DateList dateList = mNavigatorView->selectedDates();
135 if ( dateList.isEmpty() ) { 140 if ( dateList.isEmpty() ) {
136 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; 141 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl;
137 } 142 }
138 QDate baseDate = dateList.first(); 143 QDate baseDate = dateList.first();
139 KDateNavigator *n; 144 KDateNavigator *n;
145 bool doRepaint = false; // skip first repaint
140 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 146 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
141 baseDate = baseDate.addDays( baseDate.daysInMonth () ); 147 baseDate = baseDate.addDays( baseDate.daysInMonth () );
142 n->setBaseDate( baseDate ); 148 n->setBaseDate( baseDate, doRepaint );
149 doRepaint = true;
143 } 150 }
144} 151}
145 152
146void DateNavigatorContainer::resizeEvent( QResizeEvent * ) 153void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
147{ 154{
148#if 0 155#if 0
149 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; 156 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl;
150 kdDebug(5850) << " CURRENT SIZE: " << size() << endl; 157 kdDebug(5850) << " CURRENT SIZE: " << size() << endl;
151 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; 158 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl;
152 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl; 159 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl;
153 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; 160 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl;
154#endif 161#endif
155 162 QSize minSize = mNavigatorView->yourSizeHint();
156 QSize minSize = mNavigatorView->minimumSizeHint();
157 163
158// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; 164// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl;
159 165
160 int verticalCount = size().height() / minSize.height(); 166 int verticalCount = size().height() / minSize.height();
161 int horizontalCount = size().width() / minSize.width(); 167 int horizontalCount = size().width() / minSize.width();
168 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() );
162 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); 169 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
163 if ( horizontalCount != mHorizontalCount || 170 if ( horizontalCount != mHorizontalCount ||
164 verticalCount != mVerticalCount ) { 171 verticalCount != mVerticalCount ) {
165 uint count = horizontalCount * verticalCount; 172 uint count = horizontalCount * verticalCount;
166 if ( count == 0 ) return; 173 if ( count == 0 ) {
174 mNavigatorView->resize( minSize );
175 return;
176 }
167 177
168 while ( count > ( mExtraViews.count() + 1 ) ) { 178 while ( count > ( mExtraViews.count() + 1 ) ) {
169 KDateNavigator *n = new KDateNavigator( this ); 179 KDateNavigator *n = new KDateNavigator( this );
170 n->setMonthSignalOffset ( mExtraViews.count()+1 ); 180 n->setMonthSignalOffset ( mExtraViews.count()+1 );
171 mExtraViews.append( n ); 181 mExtraViews.append( n );
172 n->setCalendar( mCalendar ); 182 n->setCalendar( mCalendar );
173 setBaseDates(); 183 setBaseDates();
174 connectNavigatorView( n ); 184 connectNavigatorView( n );
175 n->show(); 185 n->show();
176 } 186 }
177 187
178 while ( count < ( mExtraViews.count() + 1 ) ) { 188 while ( count < ( mExtraViews.count() + 1 ) ) {
179 mExtraViews.removeLast(); 189 mExtraViews.removeLast();
180 } 190 }
181 191
182 mHorizontalCount = horizontalCount; 192 mHorizontalCount = horizontalCount;
183 mVerticalCount = verticalCount; 193 mVerticalCount = verticalCount;
184 } 194 }
185 195
186 int height = size().height() / verticalCount; 196 int height = size().height() / verticalCount;
187 int width = size().width() / horizontalCount; 197 int width = size().width() / horizontalCount;
188 198
189 NavigatorBar *bar = mNavigatorView->navigatorBar(); 199 NavigatorBar *bar = mNavigatorView->navigatorBar();
190 if ( horizontalCount > 1 ) bar->showButtons( true, false ); 200 if ( horizontalCount > 1 ) bar->showButtons( true, false );
191 else bar->showButtons( true, true ); 201 else bar->showButtons( true, true );
192 202
193 mNavigatorView->setGeometry(0, 203 mNavigatorView->setGeometry(0,
194 0, width, height ); 204 0, width, height );
195 for( uint i = 0; i < mExtraViews.count(); ++i ) { 205 for( uint i = 0; i < mExtraViews.count(); ++i ) {
196 int x = ( i + 1 ) % horizontalCount; 206 int x = ( i + 1 ) % horizontalCount;
197 int y = ( i + 1 ) / horizontalCount; 207 int y = ( i + 1 ) / horizontalCount;
198 208
199 KDateNavigator *view = mExtraViews.at( i ); 209 KDateNavigator *view = mExtraViews.at( i );
200 bar = view->navigatorBar(); 210 bar = view->navigatorBar();
201 if ( y > 0 ) bar->showButtons( false, false ); 211 if ( y > 0 ) bar->showButtons( false, false );
202 else { 212 else {
203 if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); 213 if ( x + 1 == horizontalCount ) bar->showButtons( false, true );
204 else bar->showButtons( false, false ); 214 else bar->showButtons( false, false );
205 } 215 }
206 view->setGeometry( x * width, 216 view->setGeometry( x * width,
207 y * height, width, height ); 217 y * height, width, height );
208 } 218 }
209} 219}
210 220
211QSize DateNavigatorContainer::minimumSizeHint() const 221QSize DateNavigatorContainer::minimumSizeHint() const
212{ 222{
213 return mNavigatorView->minimumSizeHint(); 223 return mNavigatorView->minimumSizeHint();
214} 224}
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index ab9a40f..b097dc1 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -70,123 +70,124 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
70 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 70 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
71 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 71 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
72 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); 72 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
73 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); 73 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
74 74
75 // get the day of the week on the first day 75 // get the day of the week on the first day
76 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 76 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
77 m_fstDayOfWk = dayone.dayOfWeek(); 77 m_fstDayOfWk = dayone.dayOfWeek();
78 78
79 int i; 79 int i;
80 80
81 // Set up the heading fields. 81 // Set up the heading fields.
82 for( i = 0; i < 7; i++ ) { 82 for( i = 0; i < 7; i++ ) {
83 headings[i] = new QLabel("",this); 83 headings[i] = new QLabel("",this);
84 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); 84 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold));
85 headings[i]->setAlignment(AlignCenter); 85 headings[i]->setAlignment(AlignCenter);
86 86
87 topLayout->addWidget(headings[i],1,i+1); 87 topLayout->addWidget(headings[i],1,i+1);
88 } 88 }
89 89
90 // Create the weeknumber labels 90 // Create the weeknumber labels
91 for( i = 0; i < 6; i++ ) { 91 for( i = 0; i < 6; i++ ) {
92 weeknos[i] = new QLabel(this); 92 weeknos[i] = new QLabel(this);
93 weeknos[i]->setAlignment(AlignCenter); 93 weeknos[i]->setAlignment(AlignCenter);
94 //weeknos[i]->setFont(QFont("Arial", 10)); 94 //weeknos[i]->setFont(QFont("Arial", 10));
95 if(!m_bShowWeekNums) { 95 if(!m_bShowWeekNums) {
96 weeknos[i]->hide(); 96 weeknos[i]->hide();
97 } 97 }
98 weeknos[i]->installEventFilter(this); 98 weeknos[i]->installEventFilter(this);
99 99
100 topLayout->addWidget(weeknos[i],i+2,0); 100 topLayout->addWidget(weeknos[i],i+2,0);
101 } 101 }
102 102
103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); 103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix");
104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); 104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken);
105 daymatrix->setLineWidth(1); 105 daymatrix->setLineWidth(1);
106 106
107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), 107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
108 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 108 SIGNAL( datesSelected( const KCal::DateList & ) ) );
109 109
110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ), 110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
111 SIGNAL( eventDropped( Event * ) ) ); 111 SIGNAL( eventDropped( Event * ) ) );
112 112
113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7); 113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
114 114
115 // read settings from configuration file. 115 // read settings from configuration file.
116 updateConfig(); 116 updateConfig();
117 enableRollover(FollowMonth); 117 enableRollover(FollowMonth);
118 //setFixedSize ( sizeHint() ); 118 mySizeHint = sizeHint();
119} 119}
120void KDateNavigator::slotMonthSelected( int m ) 120void KDateNavigator::slotMonthSelected( int m )
121{ 121{
122 if ( m_MthYr.month() <= mMonthSignalOffset) 122 if ( m_MthYr.month() <= mMonthSignalOffset)
123 m += 12; 123 m += 12;
124 int mo = m - mMonthSignalOffset; 124 int mo = m - mMonthSignalOffset;
125 emit monthSelected( m - mMonthSignalOffset ); 125 emit monthSelected( m - mMonthSignalOffset );
126 126
127} 127}
128void KDateNavigator::setCalendar( Calendar *cal ) 128void KDateNavigator::setCalendar( Calendar *cal )
129{ 129{
130 daymatrix->setCalendar( cal ); 130 daymatrix->setCalendar( cal );
131} 131}
132 132
133void KDateNavigator::setBaseDate( const QDate &date ) 133void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true
134{ 134{
135 m_MthYr = date; 135 m_MthYr = date;
136 136
137 updateDates(); 137 updateDates();
138 updateView(); 138 updateView();
139 139
140 KCal::DateList dates; 140 KCal::DateList dates;
141 dates.append( date ); 141 dates.append( date );
142 mNavigatorBar->selectDates( dates ); 142 mNavigatorBar->selectDates( dates );
143 143
144 daymatrix->clearSelection(); 144 daymatrix->clearSelection();
145 if ( doRepaint )
145 daymatrix->repaint(); 146 daymatrix->repaint();
146} 147}
147 148
148void KDateNavigator::enableRollover(RolloverType r) 149void KDateNavigator::enableRollover(RolloverType r)
149{ 150{
150 switch(r) 151 switch(r)
151 { 152 {
152 case None : 153 case None :
153 if (updateTimer) 154 if (updateTimer)
154 { 155 {
155 updateTimer->stop(); 156 updateTimer->stop();
156 delete updateTimer; 157 delete updateTimer;
157 updateTimer=0L; 158 updateTimer=0L;
158 } 159 }
159 break; 160 break;
160 case FollowDay : 161 case FollowDay :
161 case FollowMonth : 162 case FollowMonth :
162 if (!updateTimer) 163 if (!updateTimer)
163 { 164 {
164 updateTimer = new QTimer(this); 165 updateTimer = new QTimer(this);
165 QObject::connect(updateTimer,SIGNAL(timeout()), 166 QObject::connect(updateTimer,SIGNAL(timeout()),
166 this,SLOT(possiblyPastMidnight())); 167 this,SLOT(possiblyPastMidnight()));
167 } 168 }
168 updateTimer->start(0,true); 169 updateTimer->start(0,true);
169 lastDayChecked = QDate::currentDate(); 170 lastDayChecked = QDate::currentDate();
170 } 171 }
171 updateRollover=r; 172 updateRollover=r;
172} 173}
173 174
174 175
175KDateNavigator::~KDateNavigator() 176KDateNavigator::~KDateNavigator()
176{ 177{
177} 178}
178 179
179 180
180void KDateNavigator::passedMidnight() 181void KDateNavigator::passedMidnight()
181{ 182{
182 QDate today = QDate::currentDate(); 183 QDate today = QDate::currentDate();
183 bool emitMonth = false; 184 bool emitMonth = false;
184 185
185 if (today.month() != lastDayChecked.month()) 186 if (today.month() != lastDayChecked.month())
186 { 187 {
187 if (updateRollover==FollowMonth && 188 if (updateRollover==FollowMonth &&
188 daymatrix->isEndOfMonth()) { 189 daymatrix->isEndOfMonth()) {
189 goNextMonth(); 190 goNextMonth();
190 emitMonth=true; 191 emitMonth=true;
191 } 192 }
192 } 193 }
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 56822fa..292e71c 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -15,137 +15,140 @@
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KDATENAVIGATOR_H 23#ifndef KDATENAVIGATOR_H
24#define KDATENAVIGATOR_H 24#define KDATENAVIGATOR_H
25 25
26#include <qframe.h> 26#include <qframe.h>
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qlabel.h> 28#include <qlabel.h>
29 29
30#include <libkcal/calendar.h> 30#include <libkcal/calendar.h>
31 31
32#include "kodaymatrix.h" 32#include "kodaymatrix.h"
33 33
34class QPushButton; 34class QPushButton;
35class QTimer; 35class QTimer;
36 36
37class KCalendarSystem; 37class KCalendarSystem;
38 38
39class NavigatorBar; 39class NavigatorBar;
40 40
41class KDateNavigator: public QFrame 41class KDateNavigator: public QFrame
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44 public: 44 public:
45 KDateNavigator( QWidget *parent = 0,const char *name = 0 ); 45 KDateNavigator( QWidget *parent = 0,const char *name = 0 );
46 ~KDateNavigator(); 46 ~KDateNavigator();
47 47
48 /** The DateNavigator automatically checks for 48 /** The DateNavigator automatically checks for
49 * the passage of midnight. If rollover type is 49 * the passage of midnight. If rollover type is
50 * set to None, no signals are emitted and no 50 * set to None, no signals are emitted and no
51 * processing is done. With rollover set to 51 * processing is done. With rollover set to
52 * FollowDay, the day highlighter changes at 52 * FollowDay, the day highlighter changes at
53 * midnight and dayPassed() is emitted. 53 * midnight and dayPassed() is emitted.
54 * With FollowMonth, it has the same effect 54 * With FollowMonth, it has the same effect
55 * as FollowDay but also adjusts the month that is 55 * as FollowDay but also adjusts the month that is
56 * visible and emits monthPassed() when the month changes. 56 * visible and emits monthPassed() when the month changes.
57 */ 57 */
58 enum RolloverType { None, FollowDay, FollowMonth } ; 58 enum RolloverType { None, FollowDay, FollowMonth } ;
59 void enableRollover( RolloverType ); 59 void enableRollover( RolloverType );
60 60
61 void setShowWeekNums( bool enabled ); 61 void setShowWeekNums( bool enabled );
62 void setCalendar( Calendar * ); 62 void setCalendar( Calendar * );
63 void setBaseDate( const QDate & ); 63 void setBaseDate( const QDate & , bool doRepaint = true );
64 KCal::DateList selectedDates() const { return mSelectedDates; } 64 KCal::DateList selectedDates() const { return mSelectedDates; }
65 NavigatorBar *navigatorBar() const { return mNavigatorBar; } 65 NavigatorBar *navigatorBar() const { return mNavigatorBar; }
66 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off;} 66 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off;}
67 QSize yourSizeHint() { return mySizeHint; }
68 KODayMatrix *dayMatrix() { return daymatrix ;}
67 public slots: 69 public slots:
68 void selectDates( const KCal::DateList & ); 70 void selectDates( const KCal::DateList & );
69 void updateView(); 71 void updateView();
70 void updateConfig(); 72 void updateConfig();
71 void updateDayMatrix(); 73 void updateDayMatrix();
72 74
73 signals: 75 signals:
74 void datesSelected( const KCal::DateList & ); 76 void datesSelected( const KCal::DateList & );
75 void eventDropped( Event * ); 77 void eventDropped( Event * );
76 void weekClicked( const QDate &); 78 void weekClicked( const QDate &);
77 79
78 void goPrevious(); 80 void goPrevious();
79 void goNext(); 81 void goNext();
80 82
81 void goNextMonth(); 83 void goNextMonth();
82 void goPrevMonth(); 84 void goPrevMonth();
83 void goNextYear(); 85 void goNextYear();
84 void goPrevYear(); 86 void goPrevYear();
85 void monthSelected( int ); 87 void monthSelected( int );
86 88
87 // Signals emitted at midnight carrying the new date. 89 // Signals emitted at midnight carrying the new date.
88 void dayPassed( QDate ); 90 void dayPassed( QDate );
89 void monthPassed( QDate ); 91 void monthPassed( QDate );
90 92
91 protected slots: 93 protected slots:
92 94
93 /** 95 /**
94 * Called regularly to see if we need to update the view 96 * Called regularly to see if we need to update the view
95 * wrt. the today box and the month box. Only important 97 * wrt. the today box and the month box. Only important
96 * if you leave KOrganizer idle for long periods of time. 98 * if you leave KOrganizer idle for long periods of time.
97 * 99 *
98 * Until we have a reliable way of setting QTimers to go 100 * Until we have a reliable way of setting QTimers to go
99 * off at a particular wall-clock time, we need this, 101 * off at a particular wall-clock time, we need this,
100 * which calls passedMidnight() at the right moments. 102 * which calls passedMidnight() at the right moments.
101 */ 103 */
102 void possiblyPastMidnight(); 104 void possiblyPastMidnight();
103 105
104 /** handles updating the view when midnight has come by due to idle time. 106 /** handles updating the view when midnight has come by due to idle time.
105 * 107 *
106 */ 108 */
107 void passedMidnight(); 109 void passedMidnight();
108 void slotMonthSelected( int m ); 110 void slotMonthSelected( int m );
109 protected: 111 protected:
110 void updateDates(); 112 void updateDates();
111 113
112 void wheelEvent (QWheelEvent *); 114 void wheelEvent (QWheelEvent *);
113 115
114 bool eventFilter (QObject *,QEvent *); 116 bool eventFilter (QObject *,QEvent *);
115 117
116 private: 118 private:
119 QSize mySizeHint;
117 int mMonthSignalOffset; 120 int mMonthSignalOffset;
118 NavigatorBar *mNavigatorBar; 121 NavigatorBar *mNavigatorBar;
119 122
120 QFrame *headingSep; 123 QFrame *headingSep;
121 QFrame *weeknumSep; 124 QFrame *weeknumSep;
122 QLabel *headings[7]; 125 QLabel *headings[7];
123 QLabel *weeknos[7]; 126 QLabel *weeknos[7];
124 KODayMatrix *daymatrix; 127 KODayMatrix *daymatrix;
125 128
126 KCal::DateList mSelectedDates; 129 KCal::DateList mSelectedDates;
127 QDate m_MthYr; 130 QDate m_MthYr;
128 int m_fstDayOfWk; 131 int m_fstDayOfWk;
129 bool m_bShowWeekNums; 132 bool m_bShowWeekNums;
130 133
131 int dayNum(int row, int col); 134 int dayNum(int row, int col);
132 int dayToIndex(int dayNum); 135 int dayToIndex(int dayNum);
133 136
134 Calendar *mCalendar; 137 Calendar *mCalendar;
135 KCalendarSystem *mCalendarSystem; 138 KCalendarSystem *mCalendarSystem;
136 139
137 const QString *curHeaders; 140 const QString *curHeaders;
138 141
139 /** used to update the day view periodically, in particular every 142 /** used to update the day view periodically, in particular every
140 * midnight to move the "today" rectangle. 143 * midnight to move the "today" rectangle.
141 */ 144 */
142 QTimer *updateTimer; 145 QTimer *updateTimer;
143 QDate lastDayChecked; 146 QDate lastDayChecked;
144 RolloverType updateRollover; 147 RolloverType updateRollover;
145 148
146 // Disabling copy constructor and assignment operator 149 // Disabling copy constructor and assignment operator
147 KDateNavigator(const KDateNavigator & ); 150 KDateNavigator(const KDateNavigator & );
148 KDateNavigator &operator=(const KDateNavigator &); 151 KDateNavigator &operator=(const KDateNavigator &);
149}; 152};
150 153
151#endif 154#endif
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index a886f4a..17a8546 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp