-rw-r--r-- | korganizer/calendarview.cpp | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 00285a5..29c530b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -325,57 +325,57 @@ void CalendarView::init() | |||
325 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 325 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
326 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 326 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
327 | mTodoList->setNavigator( mNavigator ); | 327 | mTodoList->setNavigator( mNavigator ); |
328 | #if 0 | 328 | #if 0 |
329 | if ( QApplication::desktop()->width() < 480 ) { | 329 | if ( QApplication::desktop()->width() < 480 ) { |
330 | leftFrameLayout->addWidget(mFilterView); | 330 | leftFrameLayout->addWidget(mFilterView); |
331 | leftFrameLayout->addWidget(mTodoList, 2 ); | 331 | leftFrameLayout->addWidget(mTodoList, 2 ); |
332 | 332 | ||
333 | } else { | 333 | } else { |
334 | leftFrameLayout->addWidget(mTodoList,2 ); | 334 | leftFrameLayout->addWidget(mTodoList,2 ); |
335 | leftFrameLayout->addWidget(mFilterView ); | 335 | leftFrameLayout->addWidget(mFilterView ); |
336 | } | 336 | } |
337 | #endif | 337 | #endif |
338 | mFilterView->hide(); | 338 | mFilterView->hide(); |
339 | QWidget *rightBox = new QWidget( mainBox ); | 339 | QWidget *rightBox = new QWidget( mainBox ); |
340 | mainBoxLayout->addWidget ( rightBox, 10 ); | 340 | mainBoxLayout->addWidget ( rightBox, 10 ); |
341 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 341 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
342 | mRightFrame = new QWidgetStack( rightBox ); | 342 | mRightFrame = new QWidgetStack( rightBox ); |
343 | rightLayout->addWidget( mRightFrame, 10 ); | 343 | rightLayout->addWidget( mRightFrame, 10 ); |
344 | 344 | ||
345 | //mLeftFrame = (QWidget *)leftFrame; | 345 | //mLeftFrame = (QWidget *)leftFrame; |
346 | if ( KOPrefs::instance()->mVerticalScreen ) { | 346 | if ( KOPrefs::instance()->mVerticalScreen ) { |
347 | mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 347 | mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
348 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 348 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
349 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 349 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
350 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 350 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
351 | } else { | 351 | } else { |
352 | mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 352 | mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
353 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 353 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
354 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 354 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
355 | } | 355 | } |
356 | if ( !KOPrefs::instance()->mShowDateNavigator) | 356 | if ( !KOPrefs::instance()->mShowDateNavigator) |
357 | mLeftFrame->toggle(); | 357 | mDateNavigator->hide(); |
358 | //qDebug("Calendarview Size %d %d ", width(), height()); | 358 | //qDebug("Calendarview Size %d %d ", width(), height()); |
359 | #endif | 359 | #endif |
360 | 360 | ||
361 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 361 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
362 | SLOT( showDates( const KCal::DateList & ) ) ); | 362 | SLOT( showDates( const KCal::DateList & ) ) ); |
363 | 363 | ||
364 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 364 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
365 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 365 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
366 | 366 | ||
367 | 367 | ||
368 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 368 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
369 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 369 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
370 | 370 | ||
371 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 371 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
372 | mNavigator, SLOT( selectPreviousYear() ) ); | 372 | mNavigator, SLOT( selectPreviousYear() ) ); |
373 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 373 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
374 | mNavigator, SLOT( selectNextYear() ) ); | 374 | mNavigator, SLOT( selectNextYear() ) ); |
375 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 375 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
376 | mNavigator, SLOT( selectPreviousMonth() ) ); | 376 | mNavigator, SLOT( selectPreviousMonth() ) ); |
377 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 377 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
378 | mNavigator, SLOT( selectNextMonth() ) ); | 378 | mNavigator, SLOT( selectNextMonth() ) ); |
379 | 379 | ||
380 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 380 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
381 | mNavigator, SLOT( selectPrevious() ) ); | 381 | mNavigator, SLOT( selectPrevious() ) ); |
@@ -1800,48 +1800,84 @@ void CalendarView::readSettings() | |||
1800 | KConfig *config = KOGlobals::config(); | 1800 | KConfig *config = KOGlobals::config(); |
1801 | #ifndef KORG_NOSPLITTER | 1801 | #ifndef KORG_NOSPLITTER |
1802 | config->setGroup("KOrganizer Geometry"); | 1802 | config->setGroup("KOrganizer Geometry"); |
1803 | 1803 | ||
1804 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1804 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1805 | if (sizes.count() != 2) { | 1805 | if (sizes.count() != 2) { |
1806 | sizes << mDateNavigator->minimumSizeHint().width(); | 1806 | sizes << mDateNavigator->minimumSizeHint().width(); |
1807 | sizes << 300; | 1807 | sizes << 300; |
1808 | } | 1808 | } |
1809 | mPanner->setSizes(sizes); | 1809 | mPanner->setSizes(sizes); |
1810 | 1810 | ||
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 | |||
1825 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | ||
1826 | |||
1827 | int resetval = 0; | ||
1828 | int maxVal = 0; | ||
1829 | if (sizes.count() != 3) { | ||
1830 | if ( KOPrefs::instance()->mVerticalScreen ) { | ||
1831 | resetval = mDateNavigator->sizeHint().width()+2; | ||
1832 | } else { | ||
1833 | resetval = mDateNavigator->sizeHint().height()+2; | ||
1834 | } | ||
1835 | } | ||
1836 | if ( !resetval ){// i.e. sizes.count() == 3 | ||
1837 | if ( KOPrefs::instance()->mVerticalScreen ) { | ||
1838 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) | ||
1839 | resetval = mDateNavigator->sizeHint().width()+2; | ||
1840 | } else { | ||
1841 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) | ||
1842 | resetval = mDateNavigator->sizeHint().height()+2; | ||
1843 | } | ||
1844 | } | ||
1845 | if ( resetval ) { | ||
1846 | sizes.clear(); | ||
1847 | if ( KOPrefs::instance()->mVerticalScreen ) { | ||
1848 | maxVal = QApplication::desktop()->width() -10; | ||
1849 | } else { | ||
1850 | maxVal = QApplication::desktop()->height()-10; | ||
1851 | } | ||
1852 | sizes << resetval; | ||
1853 | if ( maxVal < resetval + resetval) | ||
1854 | resetval = maxVal - resetval; | ||
1855 | sizes << resetval; | ||
1856 | sizes << 100; | ||
1857 | } | ||
1858 | mLeftFrame->setSizes(sizes); | ||
1859 | qDebug("sizes count %d ", sizes.count()); | ||
1824 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1860 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1825 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1861 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1826 | else mNavigator->selectDates( dateCount ); | 1862 | else mNavigator->selectDates( dateCount ); |
1827 | // mViewManager->readSettings( config ); | 1863 | // mViewManager->readSettings( config ); |
1828 | updateConfig(); | 1864 | updateConfig(); |
1829 | globalFlagBlockAgenda = 2; | 1865 | globalFlagBlockAgenda = 2; |
1830 | mViewManager->readSettings( config ); | 1866 | mViewManager->readSettings( config ); |
1831 | #ifdef DESKTOP_VERSION | 1867 | #ifdef DESKTOP_VERSION |
1832 | config->setGroup("WidgetLayout"); | 1868 | config->setGroup("WidgetLayout"); |
1833 | QStringList list; | 1869 | QStringList list; |
1834 | list = config->readListEntry("MainLayout"); | 1870 | list = config->readListEntry("MainLayout"); |
1835 | int x,y,w,h; | 1871 | int x,y,w,h; |
1836 | if ( ! list.isEmpty() ) { | 1872 | if ( ! list.isEmpty() ) { |
1837 | x = list[0].toInt(); | 1873 | x = list[0].toInt(); |
1838 | y = list[1].toInt(); | 1874 | y = list[1].toInt(); |
1839 | w = list[2].toInt(); | 1875 | w = list[2].toInt(); |
1840 | h = list[3].toInt(); | 1876 | h = list[3].toInt(); |
1841 | topLevelWidget()->setGeometry(x,y,w,h); | 1877 | topLevelWidget()->setGeometry(x,y,w,h); |
1842 | 1878 | ||
1843 | } else { | 1879 | } else { |
1844 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 1880 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
1845 | } | 1881 | } |
1846 | list = config->readListEntry("EditEventLayout"); | 1882 | list = config->readListEntry("EditEventLayout"); |
1847 | if ( ! list.isEmpty() ) { | 1883 | if ( ! list.isEmpty() ) { |
@@ -1880,48 +1916,51 @@ void CalendarView::writeSettings() | |||
1880 | 1916 | ||
1881 | KConfig *config = KOGlobals::config(); | 1917 | KConfig *config = KOGlobals::config(); |
1882 | 1918 | ||
1883 | #ifndef KORG_NOSPLITTER | 1919 | #ifndef KORG_NOSPLITTER |
1884 | config->setGroup("KOrganizer Geometry"); | 1920 | config->setGroup("KOrganizer Geometry"); |
1885 | 1921 | ||
1886 | QValueList<int> list = mPanner->sizes(); | 1922 | QValueList<int> list = mPanner->sizes(); |
1887 | config->writeEntry("Separator1",list); | 1923 | config->writeEntry("Separator1",list); |
1888 | 1924 | ||
1889 | list = mLeftSplitter->sizes(); | 1925 | list = mLeftSplitter->sizes(); |
1890 | config->writeEntry("Separator2",list); | 1926 | config->writeEntry("Separator2",list); |
1891 | #endif | 1927 | #endif |
1892 | 1928 | ||
1893 | mViewManager->writeSettings( config ); | 1929 | mViewManager->writeSettings( config ); |
1894 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1930 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1895 | mDialogManager->writeSettings( config ); | 1931 | mDialogManager->writeSettings( config ); |
1896 | //KOPrefs::instance()->usrWriteConfig(); | 1932 | //KOPrefs::instance()->usrWriteConfig(); |
1897 | KOPrefs::instance()->writeConfig(); | 1933 | KOPrefs::instance()->writeConfig(); |
1898 | 1934 | ||
1899 | writeFilterSettings(config); | 1935 | writeFilterSettings(config); |
1900 | 1936 | ||
1901 | config->setGroup( "Views" ); | 1937 | config->setGroup( "Views" ); |
1902 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1938 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1903 | 1939 | ||
1940 | QValueList<int> list = mLeftFrame->sizes(); | ||
1941 | config->writeEntry("Left Splitter Frame",list); | ||
1942 | |||
1904 | #ifdef DESKTOP_VERSION | 1943 | #ifdef DESKTOP_VERSION |
1905 | config->setGroup("WidgetLayout"); | 1944 | config->setGroup("WidgetLayout"); |
1906 | QStringList list ;//= config->readListEntry("MainLayout"); | 1945 | QStringList list ;//= config->readListEntry("MainLayout"); |
1907 | int x,y,w,h; | 1946 | int x,y,w,h; |
1908 | QWidget* wid; | 1947 | QWidget* wid; |
1909 | wid = topLevelWidget(); | 1948 | wid = topLevelWidget(); |
1910 | x = wid->geometry().x(); | 1949 | x = wid->geometry().x(); |
1911 | y = wid->geometry().y(); | 1950 | y = wid->geometry().y(); |
1912 | w = wid->width(); | 1951 | w = wid->width(); |
1913 | h = wid->height(); | 1952 | h = wid->height(); |
1914 | list.clear(); | 1953 | list.clear(); |
1915 | list << QString::number( x ); | 1954 | list << QString::number( x ); |
1916 | list << QString::number( y ); | 1955 | list << QString::number( y ); |
1917 | list << QString::number( w ); | 1956 | list << QString::number( w ); |
1918 | list << QString::number( h ); | 1957 | list << QString::number( h ); |
1919 | config->writeEntry("MainLayout",list ); | 1958 | config->writeEntry("MainLayout",list ); |
1920 | 1959 | ||
1921 | wid = mEventEditor; | 1960 | wid = mEventEditor; |
1922 | x = wid->geometry().x(); | 1961 | x = wid->geometry().x(); |
1923 | y = wid->geometry().y(); | 1962 | y = wid->geometry().y(); |
1924 | w = wid->width(); | 1963 | w = wid->width(); |
1925 | h = wid->height(); | 1964 | h = wid->height(); |
1926 | list.clear(); | 1965 | list.clear(); |
1927 | list << QString::number( x ); | 1966 | list << QString::number( x ); |
@@ -3693,56 +3732,53 @@ void CalendarView::showIntro() | |||
3693 | } | 3732 | } |
3694 | 3733 | ||
3695 | QWidgetStack *CalendarView::viewStack() | 3734 | QWidgetStack *CalendarView::viewStack() |
3696 | { | 3735 | { |
3697 | return mRightFrame; | 3736 | return mRightFrame; |
3698 | } | 3737 | } |
3699 | 3738 | ||
3700 | QWidget *CalendarView::leftFrame() | 3739 | QWidget *CalendarView::leftFrame() |
3701 | { | 3740 | { |
3702 | return ( QWidget *)mLeftFrame; | 3741 | return ( QWidget *)mLeftFrame; |
3703 | } | 3742 | } |
3704 | 3743 | ||
3705 | DateNavigator *CalendarView::dateNavigator() | 3744 | DateNavigator *CalendarView::dateNavigator() |
3706 | { | 3745 | { |
3707 | return mNavigator; | 3746 | return mNavigator; |
3708 | } | 3747 | } |
3709 | 3748 | ||
3710 | KDateNavigator* CalendarView::dateNavigatorWidget() | 3749 | KDateNavigator* CalendarView::dateNavigatorWidget() |
3711 | { | 3750 | { |
3712 | return mDateNavigator->navigatorView(); | 3751 | return mDateNavigator->navigatorView(); |
3713 | } | 3752 | } |
3714 | void CalendarView::toggleDateNavigatorWidget() | 3753 | void CalendarView::toggleDateNavigatorWidget() |
3715 | { | 3754 | { |
3716 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; | 3755 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; |
3717 | mLeftFrame->toggle(); | 3756 | |
3718 | // FIXME mShowDateNavigator is not the toggle state of mLeftFrame | ||
3719 | #if 0 | ||
3720 | if (!KOPrefs::instance()->mShowDateNavigator ) | 3757 | if (!KOPrefs::instance()->mShowDateNavigator ) |
3721 | mDateNavigator->hide(); | 3758 | mDateNavigator->hide(); |
3722 | else | 3759 | else |
3723 | mDateNavigator->show(); | 3760 | mDateNavigator->show(); |
3724 | #endif | ||
3725 | } | 3761 | } |
3726 | void CalendarView::addView(KOrg::BaseView *view) | 3762 | void CalendarView::addView(KOrg::BaseView *view) |
3727 | { | 3763 | { |
3728 | mViewManager->addView(view); | 3764 | mViewManager->addView(view); |
3729 | } | 3765 | } |
3730 | 3766 | ||
3731 | void CalendarView::showView(KOrg::BaseView *view) | 3767 | void CalendarView::showView(KOrg::BaseView *view) |
3732 | { | 3768 | { |
3733 | mViewManager->showView(view, mLeftFrame->isVisible()); | 3769 | mViewManager->showView(view, mLeftFrame->isVisible()); |
3734 | } | 3770 | } |
3735 | 3771 | ||
3736 | Incidence *CalendarView::currentSelection() | 3772 | Incidence *CalendarView::currentSelection() |
3737 | { | 3773 | { |
3738 | return mViewManager->currentSelection(); | 3774 | return mViewManager->currentSelection(); |
3739 | } | 3775 | } |
3740 | void CalendarView::toggleAllDaySize() | 3776 | void CalendarView::toggleAllDaySize() |
3741 | { | 3777 | { |
3742 | /* | 3778 | /* |
3743 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 3779 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
3744 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; | 3780 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; |
3745 | else | 3781 | else |
3746 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 3782 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
3747 | */ | 3783 | */ |
3748 | viewManager()->agendaView()->toggleAllDay(); | 3784 | viewManager()->agendaView()->toggleAllDay(); |