-rw-r--r-- | korganizer/calendarview.cpp | 70 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 39 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 124 | ||||
-rw-r--r-- | korganizer/komonthview.h | 2 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 4 |
8 files changed, 192 insertions, 51 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 9a114d0..e766b8f 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2720,2 +2720,6 @@ void CalendarView::changeEventDisplay(Event *which, int action) | |||
2720 | mTodoList->updateView(); | 2720 | mTodoList->updateView(); |
2721 | if ( action != KOGlobals::EVENTDELETED ) { | ||
2722 | mConflictingEvent = which ; | ||
2723 | QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) ); | ||
2724 | } | ||
2721 | // } | 2725 | // } |
@@ -2725,3 +2729,69 @@ void CalendarView::changeEventDisplay(Event *which, int action) | |||
2725 | } | 2729 | } |
2730 | void CalendarView::checkConflictForEvent() | ||
2731 | { | ||
2732 | |||
2733 | if (!KOPrefs::instance()->mConfirm) | ||
2734 | return; | ||
2735 | if ( ! mConflictingEvent ) return; | ||
2736 | if ( mConflictingEvent->doesFloat() ) { | ||
2737 | mConflictingEvent = 0; | ||
2738 | return; | ||
2739 | } | ||
2740 | bool all = false; | ||
2741 | bool allday = false; | ||
2742 | Event * ev = mConflictingEvent; | ||
2743 | mConflictingEvent = 0; | ||
2744 | QDate start = ev->dtStart().date(); | ||
2745 | QDate end = ev->dtEnd().date().addDays(1); | ||
2746 | while ( start < end ) { | ||
2747 | QPtrList<Event> test = calendar()->events( start ); | ||
2748 | //qDebug("found %d on %s ", eventList.count(), start.toString().latin1()); | ||
2749 | Event * t_ev = test.first(); | ||
2750 | QDateTime es = ev->dtStart(); | ||
2751 | QDateTime ee = ev->dtEnd(); | ||
2752 | if ( ev->doesFloat() ) | ||
2753 | ee = ee.addDays( 1 ); | ||
2754 | if ( ! all ) { | ||
2755 | if ( ev->doesFloat() != allday ) | ||
2756 | t_ev = 0; | ||
2757 | } | ||
2758 | while ( t_ev ) { | ||
2759 | bool skip = false; | ||
2760 | if ( ! all ) { | ||
2761 | if ( t_ev->doesFloat() != allday ) | ||
2762 | skip = true; | ||
2763 | } | ||
2764 | if ( !skip && ev != t_ev ) { | ||
2765 | QDateTime ets = t_ev->dtStart(); | ||
2766 | QDateTime ete = t_ev->dtEnd(); | ||
2767 | if ( t_ev->doesFloat() ) | ||
2768 | ete = ete.addDays( 1 ); | ||
2769 | //qDebug("test %s -- %s -------- %s -- %s ", es.toString().latin1() , ee.toString().latin1(), ets.toString().latin1() , ete.toString().latin1() ); | ||
2770 | if ( es < ete && ets < ee ) { | ||
2771 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( ev->summary(),0 ) ).arg( KGlobal::formatMessage ( t_ev->summary(),0 )).arg(KGlobal::locale()->formatDate(start) ) ; | ||
2772 | qApp->processEvents(); | ||
2773 | int km = KMessageBox::warningContinueCancel(this,mess, | ||
2774 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); | ||
2775 | if ( km != KMessageBox::Continue ) | ||
2776 | return; | ||
2777 | |||
2778 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | ||
2779 | mViewManager->showDayView(); | ||
2780 | mNavigator->slotDaySelect( start ); | ||
2781 | int hour = es.time().hour(); | ||
2782 | if ( ets > es ) | ||
2783 | hour = ets.time().hour(); | ||
2784 | mViewManager->agendaView()->setStartHour( hour ); | ||
2785 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( ev->summary().left( 20 ) ).arg( t_ev->summary().left( 20 ) ) ); | ||
2786 | return; | ||
2787 | } | ||
2788 | } | ||
2789 | t_ev = test.next(); | ||
2790 | } | ||
2791 | start = start.addDays( 1 ); | ||
2792 | } | ||
2793 | qDebug("No conflict found "); | ||
2794 | |||
2726 | 2795 | ||
2796 | } | ||
2727 | 2797 | ||
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 51eb1d4..706d05d 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -510,2 +510,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
510 | void selectWeekNum ( int ); | 510 | void selectWeekNum ( int ); |
511 | void checkConflictForEvent(); | ||
511 | 512 | ||
@@ -536,2 +537,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
536 | protected: | 537 | protected: |
538 | Event *mConflictingEvent; | ||
537 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 539 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 7783dd4..d25f671 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -519,2 +519,19 @@ void KOListView::setAlarm() | |||
519 | inc->newAlarm(); | 519 | inc->newAlarm(); |
520 | Alarm *alarm = inc->alarms().first(); | ||
521 | alarm->setEnabled(true); | ||
522 | int j = kap.mAlarmTimeEdit->value()* -60; | ||
523 | if (kap.mAlarmIncrCombo->currentItem() == 1) | ||
524 | j = j * 60; | ||
525 | else if (kap.mAlarmIncrCombo->currentItem() == 2) | ||
526 | j = j * (60 * 24); | ||
527 | alarm->setStartOffset( j ); | ||
528 | |||
529 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { | ||
530 | alarm->setProcedureAlarm(kap.mAlarmProgram); | ||
531 | } | ||
532 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) | ||
533 | alarm->setAudioAlarm(kap.mAlarmSound); | ||
534 | else | ||
535 | alarm->setType(Alarm::Invalid); | ||
536 | } else { | ||
520 | QPtrList<Alarm> alarms = inc->alarms(); | 537 | QPtrList<Alarm> alarms = inc->alarms(); |
@@ -522,24 +539,2 @@ void KOListView::setAlarm() | |||
522 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 539 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
523 | alarm->setEnabled(true); | ||
524 | int j = kap.mAlarmTimeEdit->value()* -60; | ||
525 | if (kap.mAlarmIncrCombo->currentItem() == 1) | ||
526 | j = j * 60; | ||
527 | else if (kap.mAlarmIncrCombo->currentItem() == 2) | ||
528 | j = j * (60 * 24); | ||
529 | alarm->setStartOffset( j ); | ||
530 | |||
531 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { | ||
532 | alarm->setProcedureAlarm(kap.mAlarmProgram); | ||
533 | } | ||
534 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) | ||
535 | alarm->setAudioAlarm(kap.mAlarmSound); | ||
536 | else | ||
537 | alarm->setType(Alarm::Invalid); | ||
538 | //alarm->setAudioAlarm("default"); | ||
539 | // TODO: Deal with multiple alarms | ||
540 | break; // For now, stop after the first alarm | ||
541 | } | ||
542 | } else { | ||
543 | Alarm* alarm = inc->alarms().first(); | ||
544 | if ( alarm ) { | ||
545 | alarm->setEnabled(false); | 540 | alarm->setEnabled(false); |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 2289977..53bbe28 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1526,3 +1526,4 @@ void KOMonthView::updateConfig() | |||
1526 | computeLayout(); | 1526 | computeLayout(); |
1527 | } | 1527 | } else |
1528 | doComputeLayoutWeek(); | ||
1528 | updateDayLabels(); | 1529 | updateDayLabels(); |
@@ -1817,3 +1818,4 @@ void KOMonthView::resizeEvent(QResizeEvent * e) | |||
1817 | mComputeLayoutTimer->start( 100 ); | 1818 | mComputeLayoutTimer->start( 100 ); |
1818 | KOEventView::resizeEvent( e ); | 1819 | if ( e ) |
1820 | KOEventView::resizeEvent( e ); | ||
1819 | } | 1821 | } |
@@ -1828,6 +1830,6 @@ void KOMonthView::slotComputeLayout() | |||
1828 | } | 1830 | } |
1829 | void KOMonthView::computeLayoutWeek() | 1831 | |
1832 | void KOMonthView::doComputeLayoutWeek() | ||
1830 | { | 1833 | { |
1831 | static int lastWid = 0; | 1834 | |
1832 | static int lastHei = 0; | ||
1833 | int daysToShow; | 1835 | int daysToShow; |
@@ -1838,23 +1840,13 @@ void KOMonthView::computeLayoutWeek() | |||
1838 | } | 1840 | } |
1839 | int tWid = topLevelWidget()->size().width(); | ||
1840 | int tHei = topLevelWidget()->size().height(); | ||
1841 | |||
1842 | int wid = width();//e | 1841 | int wid = width();//e |
1843 | int hei = height()-1-mNavigatorBar->height(); | 1842 | int hei = height()-1-mNavigatorBar->height(); |
1844 | 1843 | if ( !KOPrefs::instance()->mMonthViewWeekRowlayout ) { | |
1845 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1846 | return; | ||
1847 | |||
1848 | if ( lastWid == width() && lastHei == height() ) { | ||
1849 | //qDebug("KOListWeekView::No compute layout needed "); | ||
1850 | return; | ||
1851 | } | ||
1852 | lastWid = width(); | ||
1853 | lastHei = height(); | ||
1854 | |||
1855 | |||
1856 | if ( wid < hei ) | ||
1857 | daysToShow = 2; | 1844 | daysToShow = 2; |
1858 | else | 1845 | } else { |
1859 | daysToShow = 3; | 1846 | if ( wid < hei ) |
1847 | daysToShow = 2; | ||
1848 | else | ||
1849 | daysToShow = 3; | ||
1850 | } | ||
1851 | bool landscape = (daysToShow == 3); | ||
1860 | mShowSatSunComp = true; | 1852 | mShowSatSunComp = true; |
@@ -1888,2 +1880,3 @@ void KOMonthView::computeLayoutWeek() | |||
1888 | } | 1880 | } |
1881 | int xC,yC,wC,hC; | ||
1889 | if ( i >= 5 ) { | 1882 | if ( i >= 5 ) { |
@@ -1891,5 +1884,11 @@ void KOMonthView::computeLayoutWeek() | |||
1891 | if ( i == 5 ) { | 1884 | if ( i == 5 ) { |
1892 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h); | 1885 | xC = x+weeklabelwid; |
1886 | yC = y; | ||
1887 | wC = wi/2+wi%2; | ||
1888 | hC = h; | ||
1893 | } else { | 1889 | } else { |
1894 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); | 1890 | xC = x+weeklabelwid; |
1891 | yC = y; | ||
1892 | wC = wi; | ||
1893 | hC = h; | ||
1895 | } | 1894 | } |
@@ -1902,4 +1901,10 @@ void KOMonthView::computeLayoutWeek() | |||
1902 | } | 1901 | } |
1903 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); | 1902 | xC = x+weeklabelwid; |
1903 | yC = y; | ||
1904 | wC = wi; | ||
1905 | hC = h; | ||
1904 | } | 1906 | } |
1907 | mDayLabelsW[mapWeekLayout(i,landscape)]->setGeometry( xC,yC,wC,hC); | ||
1908 | |||
1909 | |||
1905 | x += w; | 1910 | x += w; |
@@ -1925,2 +1930,3 @@ void KOMonthView::computeLayoutWeek() | |||
1925 | 1930 | ||
1931 | int xC,yC,wC,hC; | ||
1926 | if ( i >= 5 ) { | 1932 | if ( i >= 5 ) { |
@@ -1928,3 +1934,6 @@ void KOMonthView::computeLayoutWeek() | |||
1928 | max = h/2; | 1934 | max = h/2; |
1929 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1935 | xC = x+weeklabelwid; |
1936 | yC = y; | ||
1937 | wC = w; | ||
1938 | hC = max; | ||
1930 | x -= w ;y += h/2; | 1939 | x -= w ;y += h/2; |
@@ -1935,3 +1944,6 @@ void KOMonthView::computeLayoutWeek() | |||
1935 | max = h-h/2; | 1944 | max = h-h/2; |
1936 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1945 | xC = x+weeklabelwid; |
1946 | yC = y; | ||
1947 | wC = w; | ||
1948 | hC = max; | ||
1937 | y -= h/2; | 1949 | y -= h/2; |
@@ -1940,4 +1952,8 @@ void KOMonthView::computeLayoutWeek() | |||
1940 | max = h; | 1952 | max = h; |
1941 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1953 | xC = x+weeklabelwid; |
1954 | yC = y; | ||
1955 | wC = w; | ||
1956 | hC = h; | ||
1942 | } | 1957 | } |
1958 | mCellsW[mapWeekLayout(i,landscape)]->setGeometry ( xC,yC,wC,hC ); | ||
1943 | 1959 | ||
@@ -1965,2 +1981,52 @@ void KOMonthView::computeLayoutWeek() | |||
1965 | } | 1981 | } |
1982 | void KOMonthView::computeLayoutWeek() | ||
1983 | { | ||
1984 | static int lastWid = 0; | ||
1985 | static int lastHei = 0; | ||
1986 | int tWid = topLevelWidget()->size().width(); | ||
1987 | int tHei = topLevelWidget()->size().height(); | ||
1988 | int wid = width();//e | ||
1989 | int hei = height()-1-mNavigatorBar->height(); | ||
1990 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1991 | return; | ||
1992 | |||
1993 | if ( lastWid == width() && lastHei == height() ) { | ||
1994 | //qDebug("KOListWeekView::No compute layout needed "); | ||
1995 | return; | ||
1996 | } | ||
1997 | lastWid = width(); | ||
1998 | lastHei = height(); | ||
1999 | doComputeLayoutWeek(); | ||
2000 | } | ||
2001 | int KOMonthView::mapWeekLayout( int index, bool landscape ) | ||
2002 | { | ||
2003 | if ( KOPrefs::instance()->mMonthViewWeekRowlayout ) | ||
2004 | return index; | ||
2005 | int diff = 0; | ||
2006 | if ( !landscape ) diff = 1; | ||
2007 | switch( index ) { | ||
2008 | case 0: | ||
2009 | case 5: | ||
2010 | case 6: | ||
2011 | return index; | ||
2012 | break; | ||
2013 | case 1: | ||
2014 | return 2+diff; | ||
2015 | break; | ||
2016 | case 2: | ||
2017 | return 4-(3*diff); | ||
2018 | break; | ||
2019 | case 3: | ||
2020 | return 1+(3*diff); | ||
2021 | break; | ||
2022 | case 4: | ||
2023 | return 3-diff; | ||
2024 | break; | ||
2025 | default: | ||
2026 | qDebug("KO: Error in mapping week layout "); | ||
2027 | return index; | ||
2028 | break; | ||
2029 | } | ||
2030 | return index; | ||
2031 | } | ||
1966 | void KOMonthView::computeLayout() | 2032 | void KOMonthView::computeLayout() |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 4d62e9b..61a141a 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -304,2 +304,3 @@ class KOMonthView: public KOEventView | |||
304 | void updateDayLabels(); | 304 | void updateDayLabels(); |
305 | int mapWeekLayout( int, bool ); | ||
305 | 306 | ||
@@ -323,2 +324,3 @@ class KOMonthView: public KOEventView | |||
323 | void computeLayoutWeek(); | 324 | void computeLayoutWeek(); |
325 | void doComputeLayoutWeek(); | ||
324 | 326 | ||
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index a63297e..9e7f18c 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -266,2 +266,3 @@ KOPrefs::KOPrefs() : | |||
266 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); | 266 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); |
267 | addItemBool("MonthViewWeekRowlayout",&mMonthViewWeekRowlayout,true); | ||
267 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 268 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 392360d..2ff03fa 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -185,2 +185,3 @@ class KOPrefs : public KPimPrefs | |||
185 | bool mMonthViewWeek; | 185 | bool mMonthViewWeek; |
186 | bool mMonthViewWeekRowlayout; | ||
186 | QColor mAppColor1; | 187 | QColor mAppColor1; |
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index ebcff33..05bd73f 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -705,2 +705,6 @@ void KOPrefsDialog::setupViewsTab() | |||
705 | dummy = | 705 | dummy = |
706 | addWidBool(i18n("Week view mode uses row layout"), | ||
707 | &(KOPrefs::instance()->mMonthViewWeekRowlayout),topFrame); | ||
708 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
709 | dummy = | ||
706 | addWidBool(i18n("Show Sat/Sun together"), | 710 | addWidBool(i18n("Show Sat/Sun together"), |