summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp64
-rw-r--r--korganizer/koagenda.cpp4
-rw-r--r--korganizer/koagenda.h1
-rw-r--r--korganizer/komonthview.cpp5
4 files changed, 15 insertions, 59 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 426e8f9..2582931 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -95,24 +95,25 @@
95#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
96#include "kocore.h" 96#include "kocore.h"
97#endif 97#endif
98#include "koeventeditor.h" 98#include "koeventeditor.h"
99#include "kotodoeditor.h" 99#include "kotodoeditor.h"
100#include "koprefs.h" 100#include "koprefs.h"
101#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
102#include "publishdialog.h" 102#include "publishdialog.h"
103#include "kofilterview.h" 103#include "kofilterview.h"
104#include "koglobals.h" 104#include "koglobals.h"
105#include "koviewmanager.h" 105#include "koviewmanager.h"
106#include "koagendaview.h" 106#include "koagendaview.h"
107#include "koagenda.h"
107#include "kodialogmanager.h" 108#include "kodialogmanager.h"
108#include "outgoingdialog.h" 109#include "outgoingdialog.h"
109#include "incomingdialog.h" 110#include "incomingdialog.h"
110#include "datenavigatorcontainer.h" 111#include "datenavigatorcontainer.h"
111#include "statusdialog.h" 112#include "statusdialog.h"
112#include "kdatenavigator.h" 113#include "kdatenavigator.h"
113#include "kotodoview.h" 114#include "kotodoview.h"
114#include "datenavigator.h" 115#include "datenavigator.h"
115#include "resourceview.h" 116#include "resourceview.h"
116#include "navigatorbar.h" 117#include "navigatorbar.h"
117#include "searchdialog.h" 118#include "searchdialog.h"
118#include "mainwindow.h" 119#include "mainwindow.h"
@@ -654,25 +655,29 @@ CalendarView::~CalendarView()
654 delete mEventViewerDialog; 655 delete mEventViewerDialog;
655 //kdDebug() << "~CalendarView() done" << endl; 656 //kdDebug() << "~CalendarView() done" << endl;
656} 657}
657void CalendarView::nextConflict( bool all, bool allday ) 658void CalendarView::nextConflict( bool all, bool allday )
658{ 659{
659 660
660 QPtrList<Event> testlist = mCalendar->events(); 661 QPtrList<Event> testlist = mCalendar->events();
661 Event * test = testlist.first(); 662 Event * test = testlist.first();
662 while ( test ) { 663 while ( test ) {
663 test->setTagged( false ); 664 test->setTagged( false );
664 test = testlist.next(); 665 test = testlist.next();
665 } 666 }
666 QDateTime startDT = QDateTime (mNavigator->selectedDates().first().addDays(1), QTime ( 0,0,0)); 667 QTime st ( 0,0,0);
668 if ( mViewManager->currentView() == mViewManager->agendaView() )
669 st = mViewManager->agendaView()->agenda()->getEndTime();
670 //qDebug("time %s ", st.toString().latin1());
671 QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st);
667 QDateTime conflict; 672 QDateTime conflict;
668 QDateTime retVal; 673 QDateTime retVal;
669 bool found = false; 674 bool found = false;
670 Event * cE = 0; 675 Event * cE = 0;
671 Event * cE2 = 0; 676 Event * cE2 = 0;
672 QPtrList<Event> testlist2 = testlist; 677 QPtrList<Event> testlist2 = testlist;
673 test = testlist.first(); 678 test = testlist.first();
674 bool skip = false; 679 bool skip = false;
675 while ( test ) { 680 while ( test ) {
676 skip = false; 681 skip = false;
677 if ( !all ) skip = ( allday != test->doesFloat() ); 682 if ( !all ) skip = ( allday != test->doesFloat() );
678 if ( !skip ) { 683 if ( !skip ) {
@@ -711,81 +716,24 @@ void CalendarView::nextConflict( bool all, bool allday )
711 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) 716 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
712 mViewManager->showDayView(); 717 mViewManager->showDayView();
713 mNavigator->slotDaySelect( conflict.date() ); 718 mNavigator->slotDaySelect( conflict.date() );
714 int hour = conflict.time().hour(); 719 int hour = conflict.time().hour();
715 mViewManager->agendaView()->setStartHour( hour ); 720 mViewManager->agendaView()->setStartHour( hour );
716 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); 721 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) );
717 return; 722 return;
718 } 723 }
719 724
720 topLevelWidget()->setCaption( i18n("No conflict found") ); 725 topLevelWidget()->setCaption( i18n("No conflict found") );
721 qDebug("No conflict found "); 726 qDebug("No conflict found ");
722 return; 727 return;
723
724
725
726
727
728#if 0
729
730
731 QDate end = start.addDays( 365*2);
732 while ( start < end ) {
733 QPtrList<Event> eventList = calendar()->events( start );
734 Event * ev = eventList.first();
735 QPtrList<Event> test = eventList;
736 while ( ev ) {
737 //qDebug("found %d on %s ", eventList.count(), start.toString().latin1());
738 Event * t_ev = test.first();
739 QDateTime es = ev->dtStart();
740 QDateTime ee = ev->dtEnd();
741 if ( ev->doesFloat() )
742 ee = ee.addDays( 1 );
743 if ( ! all ) {
744 if ( ev->doesFloat() != allday )
745 t_ev = 0;
746 }
747 while ( t_ev ) {
748 bool skip = false;
749 if ( ! all ) {
750 if ( t_ev->doesFloat() != allday )
751 skip = true;
752 }
753 if ( !skip && ev != t_ev ) {
754 QDateTime ets = t_ev->dtStart();
755 QDateTime ete = t_ev->dtEnd();
756 if ( t_ev->doesFloat() )
757 ete = ete.addDays( 1 );
758 //qDebug("test %s -- %s -------- %s -- %s ", es.toString().latin1() , ee.toString().latin1(), ets.toString().latin1() , ete.toString().latin1() );
759 if ( es < ete && ets < ee ) {
760 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
761 mViewManager->showDayView();
762 mNavigator->slotDaySelect( start );
763 int hour = es.time().hour();
764 if ( ets > es )
765 hour = ets.time().hour();
766 mViewManager->agendaView()->setStartHour( hour );
767 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( ev->summary().left( 20 ) ).arg( t_ev->summary().left( 20 ) ) );
768 return;
769 }
770 }
771 t_ev = test.next();
772 }
773 ev = eventList.next();
774 }
775 start = start.addDays( 1 );
776 }
777 topLevelWidget()->setCaption( i18n("No conflict found within the next two years") );
778 qDebug("No conflict found ");
779#endif
780} 728}
781 729
782void CalendarView::conflictAll() 730void CalendarView::conflictAll()
783{ 731{
784 nextConflict ( true, true ); 732 nextConflict ( true, true );
785} 733}
786void CalendarView::conflictAllday() 734void CalendarView::conflictAllday()
787{ 735{
788 nextConflict ( false, true ); 736 nextConflict ( false, true );
789} 737}
790void CalendarView::conflictNotAll() 738void CalendarView::conflictNotAll()
791{ 739{
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index b290020..779f12e 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1624,24 +1624,28 @@ QTime KOAgenda::gyToTime(int gy)
1624 } else { 1624 } else {
1625 time.setHMS( 23, 59, 59 ); 1625 time.setHMS( 23, 59, 59 );
1626 } 1626 }
1627 1627
1628 return time; 1628 return time;
1629} 1629}
1630 1630
1631void KOAgenda::setStartHour(int startHour) 1631void KOAgenda::setStartHour(int startHour)
1632{ 1632{
1633 int startCell = startHour * mRows / 24; 1633 int startCell = startHour * mRows / 24;
1634 setContentsPos(0,startCell * gridSpacingY()); 1634 setContentsPos(0,startCell * gridSpacingY());
1635} 1635}
1636QTime KOAgenda::getEndTime()
1637{
1638 return QTime ( (contentsY ()+viewport()->height())*24/contentsHeight ()+1,0,0);
1639}
1636void KOAgenda::hideUnused() 1640void KOAgenda::hideUnused()
1637{ 1641{
1638 // experimental only 1642 // experimental only
1639 // return; 1643 // return;
1640 KOAgendaItem *item; 1644 KOAgendaItem *item;
1641 for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { 1645 for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) {
1642 item->hide(); 1646 item->hide();
1643 } 1647 }
1644} 1648}
1645 1649
1646 1650
1647KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) 1651KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view)
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 0e3aed8..86cf2f4 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -118,24 +118,25 @@ class KOAgenda : public QScrollView
118 void checkScrollBoundaries(); 118 void checkScrollBoundaries();
119 119
120 void setHolidayMask(QMemArray<bool> *); 120 void setHolidayMask(QMemArray<bool> *);
121 void setDateList(const DateList &selectedDates); 121 void setDateList(const DateList &selectedDates);
122 DateList dateList() const; 122 DateList dateList() const;
123 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); 123 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false);
124 void finishUpdate(); 124 void finishUpdate();
125 void printSelection(); 125 void printSelection();
126 void storePosition(); 126 void storePosition();
127 void restorePosition(); 127 void restorePosition();
128 void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; } 128 void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; }
129 void shrinkPixmap(); 129 void shrinkPixmap();
130 QTime getEndTime();
130 131
131 public slots: 132 public slots:
132 void slotContentMove(int,int); 133 void slotContentMove(int,int);
133 void categoryChanged(Incidence * inc); 134 void categoryChanged(Incidence * inc);
134 void slotClearSelection(); 135 void slotClearSelection();
135 void popupMenu(); 136 void popupMenu();
136 void newItem( int ); 137 void newItem( int );
137 void moveChild( QWidget *, int, int ); 138 void moveChild( QWidget *, int, int );
138 void scrollUp(); 139 void scrollUp();
139 void scrollDown(); 140 void scrollDown();
140 void updateTodo( Todo * t, int , bool ); 141 void updateTodo( Todo * t, int , bool );
141 void popupAlarm(); 142 void popupAlarm();
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 53bbe28..b5a59af 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1831,27 +1831,30 @@ void KOMonthView::slotComputeLayout()
1831 1831
1832void KOMonthView::doComputeLayoutWeek() 1832void KOMonthView::doComputeLayoutWeek()
1833{ 1833{
1834 1834
1835 int daysToShow; 1835 int daysToShow;
1836 bool combinedSatSun = false; 1836 bool combinedSatSun = false;
1837 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1837 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1838 daysToShow = 6; 1838 daysToShow = 6;
1839 combinedSatSun = true; 1839 combinedSatSun = true;
1840 } 1840 }
1841 int wid = width();//e 1841 int wid = width();//e
1842 int hei = height()-1-mNavigatorBar->height(); 1842 int hei = height()-1-mNavigatorBar->height();
1843#ifdef DESKTOP_VERSION
1843 if ( !KOPrefs::instance()->mMonthViewWeekRowlayout ) { 1844 if ( !KOPrefs::instance()->mMonthViewWeekRowlayout ) {
1844 daysToShow = 2; 1845 daysToShow = 2;
1845 } else { 1846 } else
1847#endif
1848 {
1846 if ( wid < hei ) 1849 if ( wid < hei )
1847 daysToShow = 2; 1850 daysToShow = 2;
1848 else 1851 else
1849 daysToShow = 3; 1852 daysToShow = 3;
1850 } 1853 }
1851 bool landscape = (daysToShow == 3); 1854 bool landscape = (daysToShow == 3);
1852 mShowSatSunComp = true; 1855 mShowSatSunComp = true;
1853 combinedSatSun = true; 1856 combinedSatSun = true;
1854 1857
1855 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); 1858 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
1856 QFontMetrics fm ( mWeekLabels[0]->font() ); 1859 QFontMetrics fm ( mWeekLabels[0]->font() );
1857 int weeklabelwid = fm.width( "888" ); 1860 int weeklabelwid = fm.width( "888" );