summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp76
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/datenavigatorcontainer.cpp36
-rw-r--r--korganizer/kdatenavigator.cpp40
-rw-r--r--korganizer/kdatenavigator.h8
-rw-r--r--korganizer/kodaymatrix.cpp11
-rw-r--r--korganizer/kodaymatrix.h1
-rw-r--r--korganizer/navigatorbar.cpp67
-rw-r--r--korganizer/navigatorbar.h1
9 files changed, 184 insertions, 58 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3ce123c..ab59d00 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -267,119 +267,123 @@ void CalendarView::init()
267 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 267 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
268 "CalendarView::LeftFrame"); 268 "CalendarView::LeftFrame");
269 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 269 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
270 270
271 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 271 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
272 "CalendarView::DateNavigator" ); 272 "CalendarView::DateNavigator" );
273 273
274 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 274 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
275 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 275 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
276 mTodoList->setNavigator( mNavigator ); 276 mTodoList->setNavigator( mNavigator );
277 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 277 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
278 278
279#ifdef KORG_NORESOURCEVIEW 279#ifdef KORG_NORESOURCEVIEW
280 mResourceView = 0; 280 mResourceView = 0;
281#else 281#else
282 if ( mResourceManager ) { 282 if ( mResourceManager ) {
283 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 283 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
284 mResourceView->updateView(); 284 mResourceView->updateView();
285 connect( mResourceView, SIGNAL( resourcesChanged() ), 285 connect( mResourceView, SIGNAL( resourcesChanged() ),
286 SLOT( updateView() ) ); 286 SLOT( updateView() ) );
287 } else { 287 } else {
288 mResourceView = 0; 288 mResourceView = 0;
289 } 289 }
290#endif 290#endif
291 QWidget *rightBox = new QWidget( mPanner ); 291 QWidget *rightBox = new QWidget( mPanner );
292 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 292 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
293 293
294 mRightFrame = new QWidgetStack( rightBox ); 294 mRightFrame = new QWidgetStack( rightBox );
295 rightLayout->addWidget( mRightFrame, 1 ); 295 rightLayout->addWidget( mRightFrame, 1 );
296 296
297 mLeftFrame = mLeftSplitter; 297 mLeftFrame = mLeftSplitter;
298#else 298#else
299 QWidget *mainBox = new QWidget( this ); 299 //QWidget *mainBox = new QWidget( this );
300 //QWidget *leftFrame = new QWidget( mainBox ); 300 //QWidget *leftFrame = new QWidget( mainBox );
301 QBoxLayout * mainBoxLayout; 301 //QBoxLayout * mainBoxLayout;
302 if ( KOPrefs::instance()->mVerticalScreen ) { 302 if ( KOPrefs::instance()->mVerticalScreen ) {
303 mainBoxLayout = new QVBoxLayout(mainBox); 303 //mainBoxLayout = new QVBoxLayout(mainBox);
304 //leftFrameLayout = new QHBoxLayout(leftFrame ); 304 //leftFrameLayout = new QHBoxLayout(leftFrame );
305 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mainBox);; 305 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
306 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left ); 306 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
307 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
308 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
307 } else { 309 } else {
308 mainBoxLayout = new QHBoxLayout(mainBox); 310 //mainBoxLayout = new QHBoxLayout(mainBox);
309 //leftFrameLayout = new QVBoxLayout(leftFrame ); 311 //leftFrameLayout = new QVBoxLayout(leftFrame );
310 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mainBox);; 312 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
313 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
314 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
311 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 315 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
312 } 316 }
313 //QBoxLayout * leftFrameLayout; 317 //QBoxLayout * leftFrameLayout;
314 topLayout->addWidget( mainBox ); 318 topLayout->addWidget( mMainFrame );
315 mainBoxLayout->addWidget (mLeftFrame); 319 //mainBoxLayout->addWidget (mLeftFrame);
316 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 320 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
317 "CalendarView::DateNavigator" ); 321 "CalendarView::DateNavigator" );
318#if 0 322#if 0
319 // FIXME 323 // FIXME
320 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 324 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
321 "CalendarView::DateNavigator", QDate::currentDate()); 325 "CalendarView::DateNavigator", QDate::currentDate());
322#endif 326#endif
323 // mDateNavigator->blockSignals( true ); 327 // mDateNavigator->blockSignals( true );
324 //leftFrameLayout->addWidget( mDateNavigator ); 328 //leftFrameLayout->addWidget( mDateNavigator );
325 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 329 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
326 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 330 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
327 mTodoList->setNavigator( mNavigator ); 331 mTodoList->setNavigator( mNavigator );
328#if 0 332#if 0
329 if ( QApplication::desktop()->width() < 480 ) { 333 if ( QApplication::desktop()->width() < 480 ) {
330 leftFrameLayout->addWidget(mFilterView); 334 leftFrameLayout->addWidget(mFilterView);
331 leftFrameLayout->addWidget(mTodoList, 2 ); 335 leftFrameLayout->addWidget(mTodoList, 2 );
332 336
333 } else { 337 } else {
334 leftFrameLayout->addWidget(mTodoList,2 ); 338 leftFrameLayout->addWidget(mTodoList,2 );
335 leftFrameLayout->addWidget(mFilterView ); 339 leftFrameLayout->addWidget(mFilterView );
336 } 340 }
337#endif 341#endif
338 mFilterView->hide(); 342 mFilterView->hide();
339 QWidget *rightBox = new QWidget( mainBox ); 343 QWidget *rightBox = new QWidget( mMainFrame );
340 mainBoxLayout->addWidget ( rightBox, 10 ); 344 //mainBoxLayout->addWidget ( rightBox, 10 );
341 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 345 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
342 mRightFrame = new QWidgetStack( rightBox ); 346 mRightFrame = new QWidgetStack( rightBox );
343 rightLayout->addWidget( mRightFrame, 10 ); 347 rightLayout->addWidget( mRightFrame, 10 );
344 348
345 //mLeftFrame = (QWidget *)leftFrame; 349 //mLeftFrame = (QWidget *)leftFrame;
346 if ( KOPrefs::instance()->mVerticalScreen ) { 350 if ( KOPrefs::instance()->mVerticalScreen ) {
347 mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 351 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
348 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 352 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
349 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 353 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
350 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 354 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
351 } else { 355 } else {
352 mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 356 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
353 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 357 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
354 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 358 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
355 } 359 }
356 if ( !KOPrefs::instance()->mShowDateNavigator) 360 if ( !KOPrefs::instance()->mShowDateNavigator)
357 mDateNavigator->hide(); 361 mDateNavigator->hide();
358 //qDebug("Calendarview Size %d %d ", width(), height()); 362 //qDebug("Calendarview Size %d %d ", width(), height());
359#endif 363#endif
360 364
361 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 365 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
362 SLOT( showDates( const KCal::DateList & ) ) ); 366 SLOT( showDates( const KCal::DateList & ) ) );
363 367
364 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 368 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
365 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 369 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
366 370
367 371
368 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 372 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
369 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 373 mNavigator, SLOT( selectWeek( const QDate & ) ) );
370 374
371 connect( mDateNavigator, SIGNAL( goPrevYear() ), 375 connect( mDateNavigator, SIGNAL( goPrevYear() ),
372 mNavigator, SLOT( selectPreviousYear() ) ); 376 mNavigator, SLOT( selectPreviousYear() ) );
373 connect( mDateNavigator, SIGNAL( goNextYear() ), 377 connect( mDateNavigator, SIGNAL( goNextYear() ),
374 mNavigator, SLOT( selectNextYear() ) ); 378 mNavigator, SLOT( selectNextYear() ) );
375 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 379 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
376 mNavigator, SLOT( selectPreviousMonth() ) ); 380 mNavigator, SLOT( selectPreviousMonth() ) );
377 connect( mDateNavigator, SIGNAL( goNextMonth() ), 381 connect( mDateNavigator, SIGNAL( goNextMonth() ),
378 mNavigator, SLOT( selectNextMonth() ) ); 382 mNavigator, SLOT( selectNextMonth() ) );
379 383
380 connect( mDateNavigator, SIGNAL( goPrevious() ), 384 connect( mDateNavigator, SIGNAL( goPrevious() ),
381 mNavigator, SLOT( selectPrevious() ) ); 385 mNavigator, SLOT( selectPrevious() ) );
382 connect( mDateNavigator, SIGNAL( goNext() ), 386 connect( mDateNavigator, SIGNAL( goNext() ),
383 mNavigator, SLOT( selectNext() ) ); 387 mNavigator, SLOT( selectNext() ) );
384 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 388 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
385 mNavigator, SLOT( slotMonthSelect( int ) ) ); 389 mNavigator, SLOT( slotMonthSelect( int ) ) );
@@ -1806,85 +1810,116 @@ void CalendarView::readSettings()
1806 sizes << mDateNavigator->minimumSizeHint().width(); 1810 sizes << mDateNavigator->minimumSizeHint().width();
1807 sizes << 300; 1811 sizes << 300;
1808 } 1812 }
1809 mPanner->setSizes(sizes); 1813 mPanner->setSizes(sizes);
1810 1814
1811 sizes = config->readIntListEntry("Separator2"); 1815 sizes = config->readIntListEntry("Separator2");
1812 if ( ( mResourceView && sizes.count() == 4 ) || 1816 if ( ( mResourceView && sizes.count() == 4 ) ||
1813 ( !mResourceView && sizes.count() == 3 ) ) { 1817 ( !mResourceView && sizes.count() == 3 ) ) {
1814 mLeftSplitter->setSizes(sizes); 1818 mLeftSplitter->setSizes(sizes);
1815 } 1819 }
1816#endif 1820#endif
1817 globalFlagBlockAgenda = 1; 1821 globalFlagBlockAgenda = 1;
1818 mViewManager->showAgendaView(); 1822 mViewManager->showAgendaView();
1819 //mViewManager->readSettings( config ); 1823 //mViewManager->readSettings( config );
1820 mTodoList->restoreLayout(config,QString("Todo Layout")); 1824 mTodoList->restoreLayout(config,QString("Todo Layout"));
1821 readFilterSettings(config); 1825 readFilterSettings(config);
1822 config->setGroup( "Views" ); 1826 config->setGroup( "Views" );
1823 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1827 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1824 1828
1825 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); 1829 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
1826 1830
1827 int resetval = 0; 1831 int resetval = 0;
1828 int maxVal = 0; 1832 int maxVal = 0;
1829 if (sizes.count() != 3) { 1833 if (sizes.count() != 3) {
1830 if ( KOPrefs::instance()->mVerticalScreen ) { 1834 if ( KOPrefs::instance()->mVerticalScreen ) {
1831 resetval = mDateNavigator->sizeHint().width()+2; 1835 resetval = mDateNavigator->sizeHint().width()+2;
1832 } else { 1836 } else {
1833 resetval = mDateNavigator->sizeHint().height()+2; 1837 resetval = mDateNavigator->sizeHint().height()+2;
1834 } 1838 }
1835 } 1839 }
1836 if ( !resetval ){// i.e. sizes.count() == 3 1840 if ( !resetval ){// i.e. sizes.count() == 3
1837 if ( KOPrefs::instance()->mVerticalScreen ) { 1841 if ( KOPrefs::instance()->mVerticalScreen ) {
1838 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) 1842 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 )
1839 resetval = mDateNavigator->sizeHint().width()+2; 1843 resetval = mDateNavigator->sizeHint().width()+2;
1840 } else { 1844 } else {
1841 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) 1845 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 )
1842 resetval = mDateNavigator->sizeHint().height()+2; 1846 resetval = mDateNavigator->sizeHint().height()+2;
1843 } 1847 }
1844 } 1848 }
1845 if ( resetval ) { 1849 if ( resetval ) {
1846 sizes.clear(); 1850 sizes.clear();
1847 if ( KOPrefs::instance()->mVerticalScreen ) { 1851 if ( KOPrefs::instance()->mVerticalScreen ) {
1848 maxVal = QApplication::desktop()->width() -10; 1852 maxVal = QApplication::desktop()->width() -10;
1849 } else { 1853 } else {
1850 maxVal = QApplication::desktop()->height()-10; 1854 maxVal = QApplication::desktop()->height()-10;
1851 } 1855 }
1852 sizes << resetval; 1856 sizes << resetval;
1853 if ( maxVal < resetval + resetval) 1857 if ( maxVal < resetval + resetval)
1854 resetval = maxVal - resetval; 1858 resetval = maxVal - resetval;
1855 sizes << resetval; 1859 sizes << resetval;
1856 sizes << 100; 1860 sizes << 100;
1857 } 1861 }
1858 mLeftFrame->setSizes(sizes); 1862 mLeftFrame->setSizes(sizes);
1863 sizes = config->readIntListEntry("Main Splitter Frame");
1864 if (sizes.count() != 3) {
1865 if ( !KOPrefs::instance()->mVerticalScreen ) {
1866 resetval = mDateNavigator->sizeHint().width()+2;
1867 } else {
1868 resetval = mDateNavigator->sizeHint().height()+2;
1869 }
1870 }
1871 if ( !resetval ){// i.e. sizes.count() == 3
1872 if ( !KOPrefs::instance()->mVerticalScreen ) {
1873 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 )
1874 resetval = mDateNavigator->sizeHint().width()+2;
1875 } else {
1876 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 )
1877 resetval = mDateNavigator->sizeHint().height()+2;
1878 }
1879 }
1880 if ( resetval ) {
1881 sizes.clear();
1882 if ( !KOPrefs::instance()->mVerticalScreen ) {
1883 maxVal = QApplication::desktop()->width() -10;
1884 } else {
1885 maxVal = QApplication::desktop()->height()-10;
1886 }
1887 sizes << resetval;
1888 if ( maxVal < resetval + resetval)
1889 resetval = maxVal - resetval;
1890 sizes << resetval;
1891 }
1892 mMainFrame->setSizes(sizes);
1893
1859 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1894 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1860 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1895 else if ( dateCount == 7 ) mNavigator->selectWeek();
1861 else mNavigator->selectDates( dateCount ); 1896 else mNavigator->selectDates( dateCount );
1862 // mViewManager->readSettings( config ); 1897 // mViewManager->readSettings( config );
1863 updateConfig(); 1898 updateConfig();
1864 globalFlagBlockAgenda = 2; 1899 globalFlagBlockAgenda = 2;
1865 mViewManager->readSettings( config ); 1900 mViewManager->readSettings( config );
1866#ifdef DESKTOP_VERSION 1901#ifdef DESKTOP_VERSION
1867 config->setGroup("WidgetLayout"); 1902 config->setGroup("WidgetLayout");
1868 QStringList list; 1903 QStringList list;
1869 list = config->readListEntry("MainLayout"); 1904 list = config->readListEntry("MainLayout");
1870 int x,y,w,h; 1905 int x,y,w,h;
1871 if ( ! list.isEmpty() ) { 1906 if ( ! list.isEmpty() ) {
1872 x = list[0].toInt(); 1907 x = list[0].toInt();
1873 y = list[1].toInt(); 1908 y = list[1].toInt();
1874 w = list[2].toInt(); 1909 w = list[2].toInt();
1875 h = list[3].toInt(); 1910 h = list[3].toInt();
1876 topLevelWidget()->setGeometry(x,y,w,h); 1911 topLevelWidget()->setGeometry(x,y,w,h);
1877 1912
1878 } else { 1913 } else {
1879 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1914 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1880 } 1915 }
1881 list = config->readListEntry("EditEventLayout"); 1916 list = config->readListEntry("EditEventLayout");
1882 if ( ! list.isEmpty() ) { 1917 if ( ! list.isEmpty() ) {
1883 x = list[0].toInt(); 1918 x = list[0].toInt();
1884 y = list[1].toInt(); 1919 y = list[1].toInt();
1885 w = list[2].toInt(); 1920 w = list[2].toInt();
1886 h = list[3].toInt(); 1921 h = list[3].toInt();
1887 mEventEditor->setGeometry(x,y,w,h); 1922 mEventEditor->setGeometry(x,y,w,h);
1888 1923
1889 } 1924 }
1890 list = config->readListEntry("EditTodoLayout"); 1925 list = config->readListEntry("EditTodoLayout");
@@ -1899,65 +1934,66 @@ void CalendarView::readSettings()
1899 list = config->readListEntry("ViewerLayout"); 1934 list = config->readListEntry("ViewerLayout");
1900 if ( ! list.isEmpty() ) { 1935 if ( ! list.isEmpty() ) {
1901 x = list[0].toInt(); 1936 x = list[0].toInt();
1902 y = list[1].toInt(); 1937 y = list[1].toInt();
1903 w = list[2].toInt(); 1938 w = list[2].toInt();
1904 h = list[3].toInt(); 1939 h = list[3].toInt();
1905 getEventViewerDialog()->setGeometry(x,y,w,h); 1940 getEventViewerDialog()->setGeometry(x,y,w,h);
1906 } 1941 }
1907#endif 1942#endif
1908 1943
1909} 1944}
1910 1945
1911 1946
1912void CalendarView::writeSettings() 1947void CalendarView::writeSettings()
1913{ 1948{
1914 // kdDebug() << "CalendarView::writeSettings" << endl; 1949 // kdDebug() << "CalendarView::writeSettings" << endl;
1915 1950
1916 KConfig *config = KOGlobals::config(); 1951 KConfig *config = KOGlobals::config();
1917 1952
1918 mViewManager->writeSettings( config ); 1953 mViewManager->writeSettings( config );
1919 mTodoList->saveLayout(config,QString("Todo Layout")); 1954 mTodoList->saveLayout(config,QString("Todo Layout"));
1920 mDialogManager->writeSettings( config ); 1955 mDialogManager->writeSettings( config );
1921 //KOPrefs::instance()->usrWriteConfig(); 1956 //KOPrefs::instance()->usrWriteConfig();
1922 KOPrefs::instance()->writeConfig(); 1957 KOPrefs::instance()->writeConfig();
1923 1958
1924 writeFilterSettings(config); 1959 writeFilterSettings(config);
1925 1960
1926 config->setGroup( "Views" ); 1961 config->setGroup( "Views" );
1927 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1962 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1928 1963
1929 QValueList<int> listINT = mLeftFrame->sizes(); 1964 QValueList<int> listINT = mLeftFrame->sizes();
1930 config->writeEntry("Left Splitter Frame",listINT); 1965 config->writeEntry("Left Splitter Frame",listINT);
1931 1966 listINT = mMainFrame->sizes();
1967 config->writeEntry("Main Splitter Frame",listINT);
1932#ifdef DESKTOP_VERSION 1968#ifdef DESKTOP_VERSION
1933 config->setGroup("WidgetLayout"); 1969 config->setGroup("WidgetLayout");
1934 QStringList list ;//= config->readListEntry("MainLayout"); 1970 QStringList list ;//= config->readListEntry("MainLayout");
1935 int x,y,w,h; 1971 int x,y,w,h;
1936 QWidget* wid; 1972 QWidget* wid;
1937 wid = topLevelWidget(); 1973 wid = topLevelWidget();
1938 x = wid->geometry().x(); 1974 x = wid->geometry().x();
1939 y = wid->geometry().y(); 1975 y = wid->geometry().y();
1940 w = wid->width(); 1976 w = wid->width();
1941 h = wid->height(); 1977 h = wid->height();
1942 list.clear(); 1978 list.clear();
1943 list << QString::number( x ); 1979 list << QString::number( x );
1944 list << QString::number( y ); 1980 list << QString::number( y );
1945 list << QString::number( w ); 1981 list << QString::number( w );
1946 list << QString::number( h ); 1982 list << QString::number( h );
1947 config->writeEntry("MainLayout",list ); 1983 config->writeEntry("MainLayout",list );
1948 1984
1949 wid = mEventEditor; 1985 wid = mEventEditor;
1950 x = wid->geometry().x(); 1986 x = wid->geometry().x();
1951 y = wid->geometry().y(); 1987 y = wid->geometry().y();
1952 w = wid->width(); 1988 w = wid->width();
1953 h = wid->height(); 1989 h = wid->height();
1954 list.clear(); 1990 list.clear();
1955 list << QString::number( x ); 1991 list << QString::number( x );
1956 list << QString::number( y ); 1992 list << QString::number( y );
1957 list << QString::number( w ); 1993 list << QString::number( w );
1958 list << QString::number( h ); 1994 list << QString::number( h );
1959 config->writeEntry("EditEventLayout",list ); 1995 config->writeEntry("EditEventLayout",list );
1960 1996
1961 wid = mTodoEditor; 1997 wid = mTodoEditor;
1962 x = wid->geometry().x(); 1998 x = wid->geometry().x();
1963 y = wid->geometry().y(); 1999 y = wid->geometry().y();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index fac9a9e..16e671f 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -502,65 +502,65 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
502 bool mViewerCallerIsSearchDialog; 502 bool mViewerCallerIsSearchDialog;
503 bool mBlockShowDates; 503 bool mBlockShowDates;
504 KSyncManager* mSyncManager; 504 KSyncManager* mSyncManager;
505 AlarmDialog * mAlarmDialog; 505 AlarmDialog * mAlarmDialog;
506 QString mAlarmNotification; 506 QString mAlarmNotification;
507 QString mSuspendAlarmNotification; 507 QString mSuspendAlarmNotification;
508 QTimer* mSuspendTimer; 508 QTimer* mSuspendTimer;
509 QTimer* mAlarmTimer; 509 QTimer* mAlarmTimer;
510 QTimer* mRecheckAlarmTimer; 510 QTimer* mRecheckAlarmTimer;
511 void computeAlarm( QString ); 511 void computeAlarm( QString );
512 void startAlarm( QString, QString ); 512 void startAlarm( QString, QString );
513 void setSyncEventsReadOnly(); 513 void setSyncEventsReadOnly();
514 514
515 QDateTime loadedFileVersion; 515 QDateTime loadedFileVersion;
516 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 516 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
517 void checkExternalId( Incidence * inc ); 517 void checkExternalId( Incidence * inc );
518 int mGlobalSyncMode; 518 int mGlobalSyncMode;
519 QString mCurrentSyncDevice; 519 QString mCurrentSyncDevice;
520 QString mCurrentSyncName; 520 QString mCurrentSyncName;
521 KOBeamPrefs* beamDialog; 521 KOBeamPrefs* beamDialog;
522 void init(); 522 void init();
523 int mDatePickerMode; 523 int mDatePickerMode;
524 bool mFlagEditDescription; 524 bool mFlagEditDescription;
525 QDateTime mLastCalendarSync; 525 QDateTime mLastCalendarSync;
526 void createPrinter(); 526 void createPrinter();
527 527
528 void calendarModified( bool, Calendar * ); 528 void calendarModified( bool, Calendar * );
529 529
530 CalPrinter *mCalPrinter; 530 CalPrinter *mCalPrinter;
531 531
532 QSplitter *mPanner; 532 QSplitter *mPanner;
533 QSplitter *mLeftSplitter; 533 QSplitter *mLeftSplitter;
534 KDGanttMinimizeSplitter *mLeftFrame; 534 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
535 QWidgetStack *mRightFrame; 535 QWidgetStack *mRightFrame;
536 536
537 KDatePicker* mDatePicker; 537 KDatePicker* mDatePicker;
538 QVBox* mDateFrame; 538 QVBox* mDateFrame;
539 539
540 DateNavigatorContainer *mDateNavigator; // widget showing small month view. 540 DateNavigatorContainer *mDateNavigator; // widget showing small month view.
541 541
542 KOFilterView *mFilterView; 542 KOFilterView *mFilterView;
543 543
544 ResourceView *mResourceView; 544 ResourceView *mResourceView;
545 545
546 // calendar object for this viewing instance 546 // calendar object for this viewing instance
547 Calendar *mCalendar; 547 Calendar *mCalendar;
548 548
549 CalendarResourceManager *mResourceManager; 549 CalendarResourceManager *mResourceManager;
550 550
551 FileStorage *mStorage; 551 FileStorage *mStorage;
552 552
553 DateNavigator *mNavigator; 553 DateNavigator *mNavigator;
554 554
555 KOViewManager *mViewManager; 555 KOViewManager *mViewManager;
556 KODialogManager *mDialogManager; 556 KODialogManager *mDialogManager;
557 557
558 // Calendar filters 558 // Calendar filters
559 QPtrList<CalFilter> mFilters; 559 QPtrList<CalFilter> mFilters;
560 560
561 // various housekeeping variables. 561 // various housekeeping variables.
562 bool mModified; // flag indicating if calendar is modified 562 bool mModified; // flag indicating if calendar is modified
563 bool mReadOnly; // flag indicating if calendar is read-only 563 bool mReadOnly; // flag indicating if calendar is read-only
564 QDate mSaveSingleDate; 564 QDate mSaveSingleDate;
565 565
566 Incidence *mSelectedIncidence; 566 Incidence *mSelectedIncidence;
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index b9bd1b9..3358ecf 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -4,64 +4,65 @@
4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <kdebug.h> 26#include <kdebug.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29//#include "koglobals.h" 29//#include "koglobals.h"
30#include "navigatorbar.h" 30#include "navigatorbar.h"
31#include "kdatenavigator.h" 31#include "kdatenavigator.h"
32 32
33#include <kcalendarsystem.h> 33#include <kcalendarsystem.h>
34 34
35#include "datenavigatorcontainer.h" 35#include "datenavigatorcontainer.h"
36#include "koprefs.h"
36 37
37DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, 38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
38 const char *name ) 39 const char *name )
39 : QWidget( parent, name ), mCalendar( 0 ), 40 : QWidget( parent, name ), mCalendar( 0 ),
40 mHorizontalCount( 1 ), mVerticalCount( 1 ) 41 mHorizontalCount( 1 ), mVerticalCount( 1 )
41{ 42{
42 mExtraViews.setAutoDelete( true ); 43 mExtraViews.setAutoDelete( true );
43 44
44 mNavigatorView = new KDateNavigator( this, name ); 45 mNavigatorView = new KDateNavigator( this, name );
45 46
46 connectNavigatorView( mNavigatorView ); 47 connectNavigatorView( mNavigatorView );
47} 48}
48 49
49DateNavigatorContainer::~DateNavigatorContainer() 50DateNavigatorContainer::~DateNavigatorContainer()
50{ 51{
51} 52}
52 53
53void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) 54void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
54{ 55{
55 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), 56 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
56 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 57 SIGNAL( datesSelected( const KCal::DateList & ) ) );
57#if 0 58#if 0
58 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), 59 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
59 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); 60 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) );
60 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), 61 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ),
61 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); 62 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) );
62#endif 63#endif
63 connect( v, SIGNAL( weekClicked( const QDate & ) ), 64 connect( v, SIGNAL( weekClicked( const QDate & ) ),
64 SIGNAL( weekClicked( const QDate & ) ) ); 65 SIGNAL( weekClicked( const QDate & ) ) );
65 66
66 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); 67 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
67 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); 68 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );
@@ -138,90 +139,117 @@ void DateNavigatorContainer::setBaseDates()
138{ 139{
139 KCal::DateList dateList = mNavigatorView->selectedDates(); 140 KCal::DateList dateList = mNavigatorView->selectedDates();
140 if ( dateList.isEmpty() ) { 141 if ( dateList.isEmpty() ) {
141 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; 142 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl;
142 } 143 }
143 QDate baseDate = dateList.first(); 144 QDate baseDate = dateList.first();
144 KDateNavigator *n; 145 KDateNavigator *n;
145 bool doRepaint = false; // skip first repaint 146 bool doRepaint = false; // skip first repaint
146 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 147 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
147 baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); 148 baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 );
148 n->setBaseDate( baseDate, doRepaint ); 149 n->setBaseDate( baseDate, doRepaint );
149 doRepaint = true; 150 doRepaint = true;
150 } 151 }
151} 152}
152 153
153void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) 154void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
154{ 155{
155#if 0 156#if 0
156 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; 157 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl;
157 kdDebug(5850) << " CURRENT SIZE: " << size() << endl; 158 kdDebug(5850) << " CURRENT SIZE: " << size() << endl;
158 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; 159 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl;
159 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl; 160 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl;
160 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; 161 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl;
161#endif 162#endif
162 QSize minSize = mNavigatorView->yourSizeHint(); 163 QSize minSize = mNavigatorView->yourSizeHint();
163 164
164// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; 165// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl;
165 166
166 int verticalCount = size().height() / minSize.height(); 167 int verticalCount = size().height() / minSize.height();
167 int horizontalCount = size().width() / minSize.width(); 168 int horizontalCount = size().width() / minSize.width();
168 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); 169 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() );
169 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); 170 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
171 bool fontchange = false;
172 QFont fo;
170 if ( horizontalCount != mHorizontalCount || 173 if ( horizontalCount != mHorizontalCount ||
171 verticalCount != mVerticalCount ) { 174 verticalCount != mVerticalCount ) {
172 uint count = horizontalCount * verticalCount; 175 uint count = horizontalCount * verticalCount;
173 if ( count == 0 ) { 176 if ( count == 0 ) {
174 mNavigatorView->resize( minSize ); 177 bool ok;
175 return; 178 fo = mNavigatorView->yourFontHint( size() , &ok);
179 //mNavigatorView->resize( size() );
180 //if ( ! ok )
181 // return;
182 minSize = mNavigatorView->sizeHint();
183 verticalCount = size().height() / minSize.height();
184 horizontalCount = size().width() / minSize.width();
185 if ( horizontalCount == 0 )
186 horizontalCount = 1;
187 if ( verticalCount == 0 )
188 verticalCount = 1;
189 fontchange = true;
190 count = horizontalCount * verticalCount;
191 } else {
192 if ( mNavigatorView->fontChanged() ) {
193 fontchange = true;
194 fo = KOPrefs::instance()->mDateNavigatorFont;
195 mNavigatorView->changeFont( fo );
196 mNavigatorView->unsetFontChanged();
197 }
176 } 198 }
177 199
178 while ( count > ( mExtraViews.count() + 1 ) ) { 200 while ( count > ( mExtraViews.count() + 1 ) ) {
179 KDateNavigator *n = new KDateNavigator( this ); 201 KDateNavigator *n = new KDateNavigator( this );
180 n->setMonthSignalOffset ( mExtraViews.count()+1 ); 202 n->setMonthSignalOffset ( mExtraViews.count()+1 );
181 mExtraViews.append( n ); 203 mExtraViews.append( n );
182 n->setCalendar( mCalendar ); 204 n->setCalendar( mCalendar );
183 setBaseDates(); 205 setBaseDates();
184 connectNavigatorView( n ); 206 connectNavigatorView( n );
185 n->show(); 207 n->show();
186 } 208 }
187 209
188 while ( count < ( mExtraViews.count() + 1 ) ) { 210 while ( count < ( mExtraViews.count() + 1 ) ) {
189 mExtraViews.removeLast(); 211 mExtraViews.removeLast();
190 } 212 }
191 213 if ( fontchange ) {
214 //mNavigatorView->changeFont( fo );
215 uint i;
216 for( i = 0; i < mExtraViews.count(); ++i ) {
217 KDateNavigator *view = mExtraViews.at( i );
218 view->changeFont( fo );
219 }
220 }
192 mHorizontalCount = horizontalCount; 221 mHorizontalCount = horizontalCount;
193 mVerticalCount = verticalCount; 222 mVerticalCount = verticalCount;
194 } 223 }
195
196 int height = size().height() / verticalCount; 224 int height = size().height() / verticalCount;
197 int width = size().width() / horizontalCount; 225 int width = size().width() / horizontalCount;
198 226
199 NavigatorBar *bar = mNavigatorView->navigatorBar(); 227 NavigatorBar *bar = mNavigatorView->navigatorBar();
200 if ( horizontalCount > 1 ) bar->showButtons( true, false ); 228 if ( horizontalCount > 1 ) bar->showButtons( true, false );
201 else bar->showButtons( true, true ); 229 else bar->showButtons( true, true );
202 230
203 mNavigatorView->setGeometry(0, 231 mNavigatorView->setGeometry(0,
204 0, width, height ); 232 0, width, height );
205 for( uint i = 0; i < mExtraViews.count(); ++i ) { 233 for( uint i = 0; i < mExtraViews.count(); ++i ) {
206 int x = ( i + 1 ) % horizontalCount; 234 int x = ( i + 1 ) % horizontalCount;
207 int y = ( i + 1 ) / horizontalCount; 235 int y = ( i + 1 ) / horizontalCount;
208 236
209 KDateNavigator *view = mExtraViews.at( i ); 237 KDateNavigator *view = mExtraViews.at( i );
210 bar = view->navigatorBar(); 238 bar = view->navigatorBar();
211 if ( y > 0 ) bar->showButtons( false, false ); 239 if ( y > 0 ) bar->showButtons( false, false );
212 else { 240 else {
213 if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); 241 if ( x + 1 == horizontalCount ) bar->showButtons( false, true );
214 else bar->showButtons( false, false ); 242 else bar->showButtons( false, false );
215 } 243 }
216 view->setGeometry( x * width, 244 view->setGeometry( x * width,
217 y * height, width, height ); 245 y * height, width, height );
218 } 246 }
219} 247}
220 248
221QSize DateNavigatorContainer::minimumSizeHint() const 249QSize DateNavigatorContainer::minimumSizeHint() const
222{ 250{
223 return mNavigatorView->minimumSizeHint(); 251 return mNavigatorView->minimumSizeHint();
224} 252}
225 253
226QSize DateNavigatorContainer::sizeHint() const 254QSize DateNavigatorContainer::sizeHint() const
227{ 255{
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index b097dc1..92a0ac2 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -87,64 +87,104 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
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 mySizeHint = sizeHint(); 118 mySizeHint = sizeHint();
119 mFontChanged = false;
120}
121void KDateNavigator::changeFont ( QFont fo )
122{
123 setFont( fo );
124 mNavigatorBar->resetFont( fo );
125}
126QFont KDateNavigator::yourFontHint( QSize si , bool *b)
127{
128 QFont fo = KOPrefs::instance()->mDateNavigatorFont;
129 *b = false;
130 int fontPoint = fo.pointSize();
131 while ( fontPoint > 5 ) {
132 --fontPoint;
133 fo.setPointSize( fontPoint );
134 setFont( fo );
135 mFontChanged = true;
136 mNavigatorBar->resetFont( fo );
137 QSize sh = sizeHint();
138 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() );
139 if ( si.width() > sh.width() && si.height() > sh.height()) {
140 *b = true;
141 //qDebug("fooooooooooooooooooooooouuuuund ");
142 break;
143 }
144 }
145 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() );
146 return fo;
147}
148QSize KDateNavigator::sizeHint() const
149{
150 QFontMetrics fm ( font() );
151 QSize day = daymatrix->sizeHint();
152 QSize nav = mNavigatorBar->sizeHint();
153 int wid = fm.width( "30") + day.width()+3;
154 int hei = fm.height() +day.height()+nav.height()+2;
155 if ( wid < nav.width() )
156 wid = nav.width() ;
157 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
158 return QSize ( wid, hei );
119} 159}
120void KDateNavigator::slotMonthSelected( int m ) 160void KDateNavigator::slotMonthSelected( int m )
121{ 161{
122 if ( m_MthYr.month() <= mMonthSignalOffset) 162 if ( m_MthYr.month() <= mMonthSignalOffset)
123 m += 12; 163 m += 12;
124 int mo = m - mMonthSignalOffset; 164 int mo = m - mMonthSignalOffset;
125 emit monthSelected( m - mMonthSignalOffset ); 165 emit monthSelected( m - mMonthSignalOffset );
126 166
127} 167}
128void KDateNavigator::setCalendar( Calendar *cal ) 168void KDateNavigator::setCalendar( Calendar *cal )
129{ 169{
130 daymatrix->setCalendar( cal ); 170 daymatrix->setCalendar( cal );
131} 171}
132 172
133void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true 173void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true
134{ 174{
135 m_MthYr = date; 175 m_MthYr = date;
136 176
137 updateDates(); 177 updateDates();
138 updateView(); 178 updateView();
139 179
140 KCal::DateList dates; 180 KCal::DateList dates;
141 dates.append( date ); 181 dates.append( date );
142 mNavigatorBar->selectDates( dates ); 182 mNavigatorBar->selectDates( dates );
143 183
144 daymatrix->clearSelection(); 184 daymatrix->clearSelection();
145 if ( doRepaint ) 185 if ( doRepaint )
146 daymatrix->repaint(); 186 daymatrix->repaint();
147} 187}
148 188
149void KDateNavigator::enableRollover(RolloverType r) 189void KDateNavigator::enableRollover(RolloverType r)
150{ 190{
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 292e71c..3177687 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -36,116 +36,122 @@ class 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 & , bool doRepaint = true ); 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; } 67 QSize yourSizeHint() { return mySizeHint; }
68 KODayMatrix *dayMatrix() { return daymatrix ;} 68 QFont yourFontHint( QSize , bool * b);
69 bool fontChanged() {return mFontChanged; }
70 void unsetFontChanged() { mFontChanged = false; }
71 KODayMatrix *dayMatrix() { return daymatrix ;}
72 QSize sizeHint() const;
73 void changeFont ( QFont fo );
69 public slots: 74 public slots:
70 void selectDates( const KCal::DateList & ); 75 void selectDates( const KCal::DateList & );
71 void updateView(); 76 void updateView();
72 void updateConfig(); 77 void updateConfig();
73 void updateDayMatrix(); 78 void updateDayMatrix();
74 79
75 signals: 80 signals:
76 void datesSelected( const KCal::DateList & ); 81 void datesSelected( const KCal::DateList & );
77 void eventDropped( Event * ); 82 void eventDropped( Event * );
78 void weekClicked( const QDate &); 83 void weekClicked( const QDate &);
79 84
80 void goPrevious(); 85 void goPrevious();
81 void goNext(); 86 void goNext();
82 87
83 void goNextMonth(); 88 void goNextMonth();
84 void goPrevMonth(); 89 void goPrevMonth();
85 void goNextYear(); 90 void goNextYear();
86 void goPrevYear(); 91 void goPrevYear();
87 void monthSelected( int ); 92 void monthSelected( int );
88 93
89 // Signals emitted at midnight carrying the new date. 94 // Signals emitted at midnight carrying the new date.
90 void dayPassed( QDate ); 95 void dayPassed( QDate );
91 void monthPassed( QDate ); 96 void monthPassed( QDate );
92 97
93 protected slots: 98 protected slots:
94 99
95 /** 100 /**
96 * Called regularly to see if we need to update the view 101 * Called regularly to see if we need to update the view
97 * wrt. the today box and the month box. Only important 102 * wrt. the today box and the month box. Only important
98 * if you leave KOrganizer idle for long periods of time. 103 * if you leave KOrganizer idle for long periods of time.
99 * 104 *
100 * Until we have a reliable way of setting QTimers to go 105 * Until we have a reliable way of setting QTimers to go
101 * off at a particular wall-clock time, we need this, 106 * off at a particular wall-clock time, we need this,
102 * which calls passedMidnight() at the right moments. 107 * which calls passedMidnight() at the right moments.
103 */ 108 */
104 void possiblyPastMidnight(); 109 void possiblyPastMidnight();
105 110
106 /** handles updating the view when midnight has come by due to idle time. 111 /** handles updating the view when midnight has come by due to idle time.
107 * 112 *
108 */ 113 */
109 void passedMidnight(); 114 void passedMidnight();
110 void slotMonthSelected( int m ); 115 void slotMonthSelected( int m );
111 protected: 116 protected:
112 void updateDates(); 117 void updateDates();
113 118
114 void wheelEvent (QWheelEvent *); 119 void wheelEvent (QWheelEvent *);
115 120
116 bool eventFilter (QObject *,QEvent *); 121 bool eventFilter (QObject *,QEvent *);
117 122
118 private: 123 private:
119 QSize mySizeHint; 124 QSize mySizeHint;
125 bool mFontChanged;
120 int mMonthSignalOffset; 126 int mMonthSignalOffset;
121 NavigatorBar *mNavigatorBar; 127 NavigatorBar *mNavigatorBar;
122 128
123 QFrame *headingSep; 129 QFrame *headingSep;
124 QFrame *weeknumSep; 130 QFrame *weeknumSep;
125 QLabel *headings[7]; 131 QLabel *headings[7];
126 QLabel *weeknos[7]; 132 QLabel *weeknos[7];
127 KODayMatrix *daymatrix; 133 KODayMatrix *daymatrix;
128 134
129 KCal::DateList mSelectedDates; 135 KCal::DateList mSelectedDates;
130 QDate m_MthYr; 136 QDate m_MthYr;
131 int m_fstDayOfWk; 137 int m_fstDayOfWk;
132 bool m_bShowWeekNums; 138 bool m_bShowWeekNums;
133 139
134 int dayNum(int row, int col); 140 int dayNum(int row, int col);
135 int dayToIndex(int dayNum); 141 int dayToIndex(int dayNum);
136 142
137 Calendar *mCalendar; 143 Calendar *mCalendar;
138 KCalendarSystem *mCalendarSystem; 144 KCalendarSystem *mCalendarSystem;
139 145
140 const QString *curHeaders; 146 const QString *curHeaders;
141 147
142 /** used to update the day view periodically, in particular every 148 /** used to update the day view periodically, in particular every
143 * midnight to move the "today" rectangle. 149 * midnight to move the "today" rectangle.
144 */ 150 */
145 QTimer *updateTimer; 151 QTimer *updateTimer;
146 QDate lastDayChecked; 152 QDate lastDayChecked;
147 RolloverType updateRollover; 153 RolloverType updateRollover;
148 154
149 // Disabling copy constructor and assignment operator 155 // Disabling copy constructor and assignment operator
150 KDateNavigator(const KDateNavigator & ); 156 KDateNavigator(const KDateNavigator & );
151 KDateNavigator &operator=(const KDateNavigator &); 157 KDateNavigator &operator=(const KDateNavigator &);
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 619ae39..9181936 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -767,32 +767,43 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
767 // DO NOT specially highlight holidays in selection ! 767 // DO NOT specially highlight holidays in selection !
768 if (i >= mSelStartT && i <= mSelEndT) { 768 if (i >= mSelStartT && i <= mSelEndT) {
769 ;//p.setPen(mSelectedDaysColor); 769 ;//p.setPen(mSelectedDaysColor);
770 } 770 }
771 771
772 p.drawText(col*dwidth, row*dheight, dwidth, dheight, 772 p.drawText(col*dwidth, row*dheight, dwidth, dheight,
773 Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); 773 Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]);
774 774
775 // reset color to actual color 775 // reset color to actual color
776 if (!mHolidays[i].isNull()) { 776 if (!mHolidays[i].isNull()) {
777 p.setPen(actcol); 777 p.setPen(actcol);
778 } 778 }
779 // reset bold font to plain font 779 // reset bold font to plain font
780 if (events[i] > 0) { 780 if (events[i] > 0) {
781 QFont myFont = font(); 781 QFont myFont = font();
782 myFont.setBold(false); 782 myFont.setBold(false);
783 p.setFont(myFont); 783 p.setFont(myFont);
784 } 784 }
785 } 785 }
786 bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); 786 bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP);
787} 787}
788 788
789// ---------------------------------------------------------------------------- 789// ----------------------------------------------------------------------------
790// R E SI Z E E V E N T H A N D L I N G 790// R E SI Z E E V E N T H A N D L I N G
791// ---------------------------------------------------------------------------- 791// ----------------------------------------------------------------------------
792 792
793void KODayMatrix::resizeEvent(QResizeEvent *) 793void KODayMatrix::resizeEvent(QResizeEvent *)
794{ 794{
795 QRect sz = frameRect(); 795 QRect sz = frameRect();
796 daysize.setHeight(sz.height()*7 / NUMDAYS); 796 daysize.setHeight(sz.height()*7 / NUMDAYS);
797 daysize.setWidth(sz.width() / 7); 797 daysize.setWidth(sz.width() / 7);
798} 798}
799
800QSize KODayMatrix::sizeHint() const
801{
802
803 QFontMetrics fm ( font() );
804 int wid = fm.width( "30") *7+7;
805 int hei = fm.height() * 6+4;
806 //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei);
807 return QSize ( wid, hei );
808
809}
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index c049942..39946de 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -141,64 +141,65 @@ public:
141 void setCalendar( Calendar * ); 141 void setCalendar( Calendar * );
142 /** returns the official name of this holy day or 0 if there is no label 142 /** returns the official name of this holy day or 0 if there is no label
143 * for this day. 143 * for this day.
144 */ 144 */
145 QString getHolidayLabel(int offset); 145 QString getHolidayLabel(int offset);
146 146
147 /** adds all actual selected days from mSelStart to mSelEnd to the supplied 147 /** adds all actual selected days from mSelStart to mSelEnd to the supplied
148 * DateList. 148 * DateList.
149 */ 149 */
150 void addSelectedDaysTo(DateList&); 150 void addSelectedDaysTo(DateList&);
151 151
152 /** sets the actual to be displayed selection in the day matrix starting from 152 /** sets the actual to be displayed selection in the day matrix starting from
153 * start and ending with end. Theview must be manually updated by calling 153 * start and ending with end. Theview must be manually updated by calling
154 * repaint. (?) 154 * repaint. (?)
155 */ 155 */
156 void setSelectedDaysFrom(const QDate& start, const QDate& end); 156 void setSelectedDaysFrom(const QDate& start, const QDate& end);
157 void clearSelection(); 157 void clearSelection();
158 158
159 /** Is today visible in the view? Keep this in sync with 159 /** Is today visible in the view? Keep this in sync with
160 * the values today (below) can take. 160 * the values today (below) can take.
161 */ 161 */
162 bool isTodayVisible() const { return today>=0; } ; 162 bool isTodayVisible() const { return today>=0; } ;
163 163
164 /** If today is visible, then we can find out if today is 164 /** If today is visible, then we can find out if today is
165 * near the beginning or the end of the month. 165 * near the beginning or the end of the month.
166 * This is dependent on today remaining the index 166 * This is dependent on today remaining the index
167 * in the array of visible dates and going from 167 * in the array of visible dates and going from
168 * top left (0) to bottom right (41). 168 * top left (0) to bottom right (41).
169 */ 169 */
170 bool isBeginningOfMonth() const { return today<=8; } ; 170 bool isBeginningOfMonth() const { return today<=8; } ;
171 bool isEndOfMonth() const { return today>=27; } ; 171 bool isEndOfMonth() const { return today>=27; } ;
172 QString getWhatsThisText( QPoint ) ; 172 QString getWhatsThisText( QPoint ) ;
173 QSize sizeHint() const;
173 174
174public slots: 175public slots:
175 /** Recalculates all the flags of the days in the matrix like holidays or events 176 /** Recalculates all the flags of the days in the matrix like holidays or events
176 * on a day (Actually calls above method with the actual startdate). 177 * on a day (Actually calls above method with the actual startdate).
177 */ 178 */
178 void updateView(); 179 void updateView();
179 void updateViewTimed(); 180 void updateViewTimed();
180 void repaintViewTimed(); 181 void repaintViewTimed();
181 182
182 /** 183 /**
183 * Calculate which square in the matrix should be 184 * Calculate which square in the matrix should be
184 * hilighted to indicate it's today. 185 * hilighted to indicate it's today.
185 */ 186 */
186 void recalculateToday(); 187 void recalculateToday();
187 188
188/* 189/*
189 void setStartDate(QDate); 190 void setStartDate(QDate);
190*/ 191*/
191 192
192signals: 193signals:
193 194
194 /** emitted if the user selects a block of days with the mouse by dragging a rectangle 195 /** emitted if the user selects a block of days with the mouse by dragging a rectangle
195 * inside the matrix 196 * inside the matrix
196 * 197 *
197 * @param daylist list of days that have been selected by the user 198 * @param daylist list of days that have been selected by the user
198 */ 199 */
199 void selected( const KCal::DateList &daylist ); 200 void selected( const KCal::DateList &daylist );
200 201
201 /** emitted if the user has dropped an event inside the matrix 202 /** emitted if the user has dropped an event inside the matrix
202 * 203 *
203 * @param event the dropped calendar event 204 * @param event the dropped calendar event
204 */ 205 */
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 27d4d17..4a51bba 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -33,205 +33,208 @@
33 33
34#include <kdebug.h> 34#include <kdebug.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kglobal.h> 36#include <kglobal.h>
37#include <kiconloader.h> 37#include <kiconloader.h>
38#include "libkdepim/kdatepicker.h" 38#include "libkdepim/kdatepicker.h"
39#include <knotifyclient.h> 39#include <knotifyclient.h>
40#include "kdatetbl.h" 40#include "kdatetbl.h"
41 41
42#include "koglobals.h" 42#include "koglobals.h"
43#include <kglobalsettings.h> 43#include <kglobalsettings.h>
44#include "koprefs.h" 44#include "koprefs.h"
45#ifndef KORG_NOPLUGINS 45#ifndef KORG_NOPLUGINS
46#include "kocore.h" 46#include "kocore.h"
47#endif 47#endif
48 48
49#include <kcalendarsystem.h> 49#include <kcalendarsystem.h>
50 50
51#include "navigatorbar.h" 51#include "navigatorbar.h"
52 52
53NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) 53NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name )
54 : QWidget( parent, name ) 54 : QWidget( parent, name )
55{ 55{
56 QBoxLayout *topLayout = new QHBoxLayout( this ); 56 QBoxLayout *topLayout = new QHBoxLayout( this );
57 57
58 // Set up the control buttons and date label 58 // Set up the control buttons and date label
59 mCtrlFrame = new QFrame( this ); 59 mCtrlFrame = new QFrame( this );
60 mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); 60 mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised);
61 mCtrlFrame->setLineWidth(1); 61 mCtrlFrame->setLineWidth(1);
62 62
63 topLayout->addWidget( mCtrlFrame ); 63 topLayout->addWidget( mCtrlFrame );
64 64
65 QFont tfont = font(); 65
66 if ( QApplication::desktop()->width() >= 480 )
67 tfont.setPointSize(tfont.pointSize()+2);
68 tfont.setBold(true);
69 66
70 bool isRTL = KOGlobals::self()->reverseLayout(); 67 bool isRTL = KOGlobals::self()->reverseLayout();
71#ifndef DESKTOP_VERSION 68#ifndef DESKTOP_VERSION
72 bool isDesktop = false; 69 bool isDesktop = false;
73#else 70#else
74 bool isDesktop = true; 71 bool isDesktop = true;
75#endif 72#endif
76 if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) 73 if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 )
77 isDesktop = true; 74 isDesktop = true;
78 // Create backward navigation buttons 75 // Create backward navigation buttons
79 mPrevYear = new QPushButton( mCtrlFrame ); 76 mPrevYear = new QPushButton( mCtrlFrame );
80 mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); 77 mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) );
81 QToolTip::add( mPrevYear, i18n("Previous Year") ); 78 QToolTip::add( mPrevYear, i18n("Previous Year") );
82 79
83 mPrevMonth = new QPushButton( mCtrlFrame ); 80 mPrevMonth = new QPushButton( mCtrlFrame );
84 mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); 81 mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") );
85 QToolTip::add( mPrevMonth, i18n("Previous Month") ); 82 QToolTip::add( mPrevMonth, i18n("Previous Month") );
86 83
87 // Create forward navigation buttons 84 // Create forward navigation buttons
88 mNextMonth = new QPushButton( mCtrlFrame ); 85 mNextMonth = new QPushButton( mCtrlFrame );
89 mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); 86 mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") );
90 QToolTip::add( mNextMonth, i18n("Next Month") ); 87 QToolTip::add( mNextMonth, i18n("Next Month") );
91 88
92 mPrevWeek = new QPushButton( mCtrlFrame ); 89 mPrevWeek = new QPushButton( mCtrlFrame );
93 mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); 90 mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") );
94 QToolTip::add( mPrevWeek, i18n("Previous Week") ); 91 QToolTip::add( mPrevWeek, i18n("Previous Week") );
95 92
96 // Create forward navigation buttons 93 // Create forward navigation buttons
97 mNextWeek = new QPushButton( mCtrlFrame ); 94 mNextWeek = new QPushButton( mCtrlFrame );
98 mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); 95 mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") );
99 QToolTip::add( mNextWeek, i18n("Next Week") ); 96 QToolTip::add( mNextWeek, i18n("Next Week") );
100 97
101 mNextYear = new QPushButton( mCtrlFrame ); 98 mNextYear = new QPushButton( mCtrlFrame );
102 mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); 99 mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") );
103 QToolTip::add( mNextYear, i18n("Next Year") ); 100 QToolTip::add( mNextYear, i18n("Next Year") );
104 mSelectMonth = new QPushButton( mCtrlFrame ); 101 mSelectMonth = new QPushButton( mCtrlFrame );
105 // Create month name label 102 // Create month name label
106 //selectMonth->setFont( tfont ); 103 //selectMonth->setFont( tfont );
107 // selectMonth->setAlignment( AlignCenter ); 104 // selectMonth->setAlignment( AlignCenter );
108 //mDateLabel = new QLabel( selectMonth ); 105 //mDateLabel = new QLabel( selectMonth );
109 //mDateLabel->setFont( tfont ); 106 //mDateLabel->setFont( tfont );
110 //mDateLabel->setAlignment( AlignCenter ); 107 //mDateLabel->setAlignment( AlignCenter );
111 if ( QString ( name ) == QString("useBigPixmaps") ) { 108 if ( QString ( name ) == QString("useBigPixmaps") ) {
112 mNextMonth->setFlat( true); 109 mNextMonth->setFlat( true);
113 mNextWeek->setFlat( true); 110 mNextWeek->setFlat( true);
114 mNextYear->setFlat( true); 111 mNextYear->setFlat( true);
115 mSelectMonth->setFlat( true); 112 mSelectMonth->setFlat( true);
116 mPrevYear->setFlat( true); 113 mPrevYear->setFlat( true);
117 mPrevMonth->setFlat( true); 114 mPrevMonth->setFlat( true);
118 mPrevWeek->setFlat( true); 115 mPrevWeek->setFlat( true);
119 } else { 116 } else {
120 mPrevWeek->hide(); 117 mPrevWeek->hide();
121 mNextWeek->hide(); 118 mNextWeek->hide();
122 } 119 }
123 mSelectMonth->setFont( tfont );
124 // Set minimum width to width of widest month name label
125 int i;
126 int maxwidth = 0;
127 QFontMetrics fm ( mSelectMonth->font() );
128 int width = fm.width("September '00" );
129// for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date);
130// ++i ) {
131// //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i,
132// // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" );
133// int width = fm.width("September 2000" );
134// if ( width > maxwidth ) maxwidth = width;
135// }
136 maxwidth = width+2;
137 int size = fm.height()+2;
138 if ( QApplication::desktop()->width() >= 480 ) {
139 size += 6;
140 maxwidth+= 6;
141 }
142 120
143 mSelectMonth->setFixedWidth( maxwidth ); 121 resetFont( font() );
144 mSelectMonth->setFixedHeight( size ); 122
145 mPrevYear->setFixedHeight( size ); 123
146 mPrevMonth->setFixedHeight( size );
147 mPrevWeek->setFixedHeight( size );
148 mNextMonth->setFixedHeight( size );
149 mNextWeek->setFixedHeight( size );
150 mNextYear->setFixedHeight ( size );
151 // set up control frame layout 124 // set up control frame layout
152 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); 125 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 );
153 ctrlLayout->addWidget( mPrevYear, 3 ); 126 ctrlLayout->addWidget( mPrevYear, 3 );
154 ctrlLayout->addWidget( mPrevMonth, 3 ); 127 ctrlLayout->addWidget( mPrevMonth, 3 );
155 ctrlLayout->addWidget( mPrevWeek, 3 ); 128 ctrlLayout->addWidget( mPrevWeek, 3 );
156 //ctrlLayout->addStretch( 1 ); 129 //ctrlLayout->addStretch( 1 );
157 // ctrlLayout->addSpacing( 1 ); 130 // ctrlLayout->addSpacing( 1 );
158 // ctrlLayout->addWidget( mDateLabel ); 131 // ctrlLayout->addWidget( mDateLabel );
159 ctrlLayout->addWidget( mSelectMonth ); 132 ctrlLayout->addWidget( mSelectMonth );
160 // ctrlLayout->addSpacing( 1 ); 133 // ctrlLayout->addSpacing( 1 );
161 // ctrlLayout->addStretch( 1 ); 134 // ctrlLayout->addStretch( 1 );
162 ctrlLayout->addWidget( mNextWeek, 3 ); 135 ctrlLayout->addWidget( mNextWeek, 3 );
163 ctrlLayout->addWidget( mNextMonth, 3 ); 136 ctrlLayout->addWidget( mNextMonth, 3 );
164 ctrlLayout->addWidget( mNextYear, 3 ); 137 ctrlLayout->addWidget( mNextYear, 3 );
165 138
166 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); 139 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) );
167 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); 140 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) );
168 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); 141 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) );
169 connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); 142 connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) );
170 connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); 143 connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) );
171 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); 144 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) );
172 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); 145 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) );
173 mPrevYear->setFocusPolicy(NoFocus); 146 mPrevYear->setFocusPolicy(NoFocus);
174 mPrevMonth->setFocusPolicy(NoFocus); 147 mPrevMonth->setFocusPolicy(NoFocus);
175 mNextMonth->setFocusPolicy(NoFocus); 148 mNextMonth->setFocusPolicy(NoFocus);
176 mPrevWeek->setFocusPolicy(NoFocus); 149 mPrevWeek->setFocusPolicy(NoFocus);
177 mNextWeek->setFocusPolicy(NoFocus); 150 mNextWeek->setFocusPolicy(NoFocus);
178 mNextYear->setFocusPolicy(NoFocus); 151 mNextYear->setFocusPolicy(NoFocus);
179 mSelectMonth->setFocusPolicy(NoFocus); 152 mSelectMonth->setFocusPolicy(NoFocus);
180 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); 153 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
181 154
182} 155}
183 156
184NavigatorBar::~NavigatorBar() 157NavigatorBar::~NavigatorBar()
185{ 158{
186} 159}
160void NavigatorBar::resetFont ( QFont fo )
161{
162
163 QFont tfont = fo;
164 if ( QApplication::desktop()->width() >= 480 )
165 tfont.setPointSize(tfont.pointSize()+2);
166 tfont.setBold(true);
167
168 mSelectMonth->setFont( tfont );
169 // Set minimum width to width of widest month name label
170 int i;
171 int maxwidth = 0;
172 QFontMetrics fm ( mSelectMonth->font() );
173 int width = fm.width("September '00" );
174 maxwidth = width+2;
175 int size = fm.height()+2;
176 if ( QApplication::desktop()->width() >= 480 ) {
177 size += 6;
178 maxwidth+= 6;
179 }
180 mSelectMonth->setMinimumWidth( maxwidth );
181 mSelectMonth->setFixedHeight( size );
182 mPrevYear->setFixedHeight( size );
183 mPrevMonth->setFixedHeight( size );
184 mPrevWeek->setFixedHeight( size );
185 mNextMonth->setFixedHeight( size );
186 mNextWeek->setFixedHeight( size );
187 mNextYear->setFixedHeight ( size );
188}
189
187void NavigatorBar::showButtons( bool left, bool right ) 190void NavigatorBar::showButtons( bool left, bool right )
188{ 191{
189 if ( left ) { 192 if ( left ) {
190 mPrevYear->show(); 193 mPrevYear->show();
191 mPrevMonth->show(); 194 mPrevMonth->show();
192 } else { 195 } else {
193 mPrevYear->hide(); 196 mPrevYear->hide();
194 mPrevMonth->hide(); 197 mPrevMonth->hide();
195 } 198 }
196 199
197 if ( right ) { 200 if ( right ) {
198 mNextYear->show(); 201 mNextYear->show();
199 mNextMonth->show(); 202 mNextMonth->show();
200 } else { 203 } else {
201 mNextYear->hide(); 204 mNextYear->hide();
202 mNextMonth->hide(); 205 mNextMonth->hide();
203 } 206 }
204 if ( !left && !right ) { 207 if ( !left && !right ) {
205 mSelectMonth->setMaximumWidth( 1024 ); 208 //mSelectMonth->setMaximumWidth( 1024 );
206 mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); 209 mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
207 } 210 }
208} 211}
209 212
210void NavigatorBar::selectMonth() 213void NavigatorBar::selectMonth()
211{ 214{
212 215
213 int month; 216 int month;
214 KPopupFrame* popup = new KPopupFrame(this); 217 KPopupFrame* popup = new KPopupFrame(this);
215 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); 218 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup);
216 // ----- 219 // -----
217 picker->resize(picker->sizeHint()); 220 picker->resize(picker->sizeHint());
218 popup->setMainWidget(picker); 221 popup->setMainWidget(picker);
219 picker->setFocus(); 222 picker->setFocus();
220 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 223 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
221 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) 224 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height()))))
222 { 225 {
223 month = picker->getResult(); 226 month = picker->getResult();
224 emit monthSelected ( month ); 227 emit monthSelected ( month );
225 } else { 228 } else {
226 KNotifyClient::beep(); 229 KNotifyClient::beep();
227 } 230 }
228 delete popup; 231 delete popup;
229} 232}
230void NavigatorBar::selectDates( const KCal::DateList &dateList ) 233void NavigatorBar::selectDates( const KCal::DateList &dateList )
231{ 234{
232 if (dateList.count() > 0) { 235 if (dateList.count() > 0) {
233 QDate date = dateList.first(); 236 QDate date = dateList.first();
234 237
235 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); 238 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem();
236 239
237 // compute the label at the top of the navigator 240 // compute the label at the top of the navigator
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h
index 4442caa..0b2f60b 100644
--- a/korganizer/navigatorbar.h
+++ b/korganizer/navigatorbar.h
@@ -10,61 +10,62 @@
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef NAVIGATORBAR_H 24#ifndef NAVIGATORBAR_H
25#define NAVIGATORBAR_H 25#define NAVIGATORBAR_H
26 26
27#include <libkcal/incidencebase.h> 27#include <libkcal/incidencebase.h>
28 28
29#include <qwidget.h> 29#include <qwidget.h>
30 30
31class QPushButton; 31class QPushButton;
32class QFrame; 32class QFrame;
33class QLabel; 33class QLabel;
34 34
35class NavigatorBar: public QWidget 35class NavigatorBar: public QWidget
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); 39 NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 );
40 ~NavigatorBar(); 40 ~NavigatorBar();
41 void showButtons( bool left, bool right ); 41 void showButtons( bool left, bool right );
42 void resetFont ( QFont fo );
42 43
43 public slots: 44 public slots:
44 void selectDates( const KCal::DateList & ); 45 void selectDates( const KCal::DateList & );
45 void selectMonth(); 46 void selectMonth();
46 47
47 signals: 48 signals:
48 void goNextMonth(); 49 void goNextMonth();
49 void goPrevMonth(); 50 void goPrevMonth();
50 void goNextWeek(); 51 void goNextWeek();
51 void goPrevWeek(); 52 void goPrevWeek();
52 void goNextYear(); 53 void goNextYear();
53 void goPrevYear(); 54 void goPrevYear();
54 void monthSelected( int ); 55 void monthSelected( int );
55 56
56 private: 57 private:
57 QFrame *mCtrlFrame; 58 QFrame *mCtrlFrame;
58 59
59 QPushButton *mPrevYear; 60 QPushButton *mPrevYear;
60 QPushButton *mPrevMonth; 61 QPushButton *mPrevMonth;
61 QPushButton *mNextMonth; 62 QPushButton *mNextMonth;
62 QPushButton *mPrevWeek; 63 QPushButton *mPrevWeek;
63 QPushButton *mNextWeek; 64 QPushButton *mNextWeek;
64 QPushButton *mNextYear; 65 QPushButton *mNextYear;
65 QPushButton *mSelectMonth; 66 QPushButton *mSelectMonth;
66 67
67 //QLabel *mDateLabel; 68 //QLabel *mDateLabel;
68}; 69};
69 70
70#endif 71#endif