author | zautrix <zautrix> | 2005-02-09 10:33:00 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-09 10:33:00 (UTC) |
commit | 968099947455adc0e8681aedf8c161327e311f38 (patch) (unidiff) | |
tree | 2c4983417cd6d7348765a58990eac50aed8700e6 | |
parent | d0ab37d35ca9a9d919c9fc4856f3314bfef6dd5a (diff) | |
download | kdepimpi-968099947455adc0e8681aedf8c161327e311f38.zip kdepimpi-968099947455adc0e8681aedf8c161327e311f38.tar.gz kdepimpi-968099947455adc0e8681aedf8c161327e311f38.tar.bz2 |
start fix
-rw-r--r-- | korganizer/koagendaview.cpp | 10 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 7 |
3 files changed, 18 insertions, 0 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 0d36946..13d8398 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1504,64 +1504,74 @@ void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart, | |||
1504 | mTimeSpanBegin = dtStart; | 1504 | mTimeSpanBegin = dtStart; |
1505 | mTimeSpanEnd = dtEnd; | 1505 | mTimeSpanEnd = dtEnd; |
1506 | 1506 | ||
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | void KOAgendaView::deleteSelectedDateTime() | 1509 | void KOAgendaView::deleteSelectedDateTime() |
1510 | { | 1510 | { |
1511 | mTimeSpanBegin.setDate(QDate()); | 1511 | mTimeSpanBegin.setDate(QDate()); |
1512 | mTimeSpanEnd.setDate(QDate()); | 1512 | mTimeSpanEnd.setDate(QDate()); |
1513 | mTimeSpanInAllDay = false; | 1513 | mTimeSpanInAllDay = false; |
1514 | } | 1514 | } |
1515 | 1515 | ||
1516 | void KOAgendaView::keyPressEvent ( QKeyEvent * e ) | 1516 | void KOAgendaView::keyPressEvent ( QKeyEvent * e ) |
1517 | { | 1517 | { |
1518 | e->ignore(); | 1518 | e->ignore(); |
1519 | } | 1519 | } |
1520 | 1520 | ||
1521 | void KOAgendaView::scrollOneHourUp() | 1521 | void KOAgendaView::scrollOneHourUp() |
1522 | { | 1522 | { |
1523 | 1523 | ||
1524 | mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); | 1524 | mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); |
1525 | } | 1525 | } |
1526 | void KOAgendaView::scrollOneHourDown() | 1526 | void KOAgendaView::scrollOneHourDown() |
1527 | { | 1527 | { |
1528 | mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); | 1528 | mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); |
1529 | } | 1529 | } |
1530 | 1530 | ||
1531 | void KOAgendaView::setStartHour( int h ) | 1531 | void KOAgendaView::setStartHour( int h ) |
1532 | { | 1532 | { |
1533 | mAgenda->setStartHour( h ); | 1533 | mAgenda->setStartHour( h ); |
1534 | 1534 | ||
1535 | } | 1535 | } |
1536 | void KOAgendaView::setInitStartHour() | ||
1537 | { | ||
1538 | |||
1539 | if ( KOPrefs::instance()->mCenterOnCurrentTime ) | ||
1540 | setStartHour( QTime::currentTime ().hour() ); | ||
1541 | else | ||
1542 | setStartHour( KOPrefs::instance()->mDayBegins ); | ||
1543 | |||
1544 | } | ||
1545 | |||
1536 | 1546 | ||
1537 | void KOAgendaView::updateTodo( Todo * t, int ) | 1547 | void KOAgendaView::updateTodo( Todo * t, int ) |
1538 | { | 1548 | { |
1539 | if ( !isVisible() ) | 1549 | if ( !isVisible() ) |
1540 | return; | 1550 | return; |
1541 | bool remove = false; | 1551 | bool remove = false; |
1542 | bool removeAD = false; | 1552 | bool removeAD = false; |
1543 | QDate da; | 1553 | QDate da; |
1544 | if ( t->hasCompletedDate() ) | 1554 | if ( t->hasCompletedDate() ) |
1545 | da = t->completed().date(); | 1555 | da = t->completed().date(); |
1546 | else | 1556 | else |
1547 | da = t->dtDue().date(); | 1557 | da = t->dtDue().date(); |
1548 | if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { | 1558 | if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { |
1549 | remove = true; | 1559 | remove = true; |
1550 | removeAD = true; | 1560 | removeAD = true; |
1551 | } | 1561 | } |
1552 | else { | 1562 | else { |
1553 | bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; | 1563 | bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; |
1554 | if ( overdue && | 1564 | if ( overdue && |
1555 | QDate::currentDate() >= mSelectedDates.first() && | 1565 | QDate::currentDate() >= mSelectedDates.first() && |
1556 | QDate::currentDate() <= mSelectedDates.last()) { | 1566 | QDate::currentDate() <= mSelectedDates.last()) { |
1557 | removeAD = false; | 1567 | removeAD = false; |
1558 | remove = true; | 1568 | remove = true; |
1559 | } | 1569 | } |
1560 | else { | 1570 | else { |
1561 | 1571 | ||
1562 | if ( da < mSelectedDates.first() || | 1572 | if ( da < mSelectedDates.first() || |
1563 | da > mSelectedDates.last() ) { | 1573 | da > mSelectedDates.last() ) { |
1564 | remove = true; | 1574 | remove = true; |
1565 | removeAD = true; | 1575 | removeAD = true; |
1566 | } else { | 1576 | } else { |
1567 | remove = t->doesFloat() && !t->hasCompletedDate(); | 1577 | remove = t->doesFloat() && !t->hasCompletedDate(); |
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 4a058ce..8b8bac0 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -148,64 +148,65 @@ class KOAgendaView : public KOEventView { | |||
148 | void setStartHour( int ); | 148 | void setStartHour( int ); |
149 | void toggleAllDay(); | 149 | void toggleAllDay(); |
150 | 150 | ||
151 | 151 | ||
152 | /** Returns maximum number of days supported by the koagendaview */ | 152 | /** Returns maximum number of days supported by the koagendaview */ |
153 | virtual int maxDatesHint(); | 153 | virtual int maxDatesHint(); |
154 | 154 | ||
155 | /** Returns number of currently shown dates. */ | 155 | /** Returns number of currently shown dates. */ |
156 | virtual int currentDateCount(); | 156 | virtual int currentDateCount(); |
157 | 157 | ||
158 | /** returns the currently selected events */ | 158 | /** returns the currently selected events */ |
159 | virtual QPtrList<Incidence> selectedIncidences(); | 159 | virtual QPtrList<Incidence> selectedIncidences(); |
160 | 160 | ||
161 | /** returns the currently selected events */ | 161 | /** returns the currently selected events */ |
162 | virtual DateList selectedDates(); | 162 | virtual DateList selectedDates(); |
163 | 163 | ||
164 | /** Remove all events from view */ | 164 | /** Remove all events from view */ |
165 | void clearView(); | 165 | void clearView(); |
166 | KOAgenda *agenda() { return mAgenda;} | 166 | KOAgenda *agenda() { return mAgenda;} |
167 | virtual void printPreview(CalPrinter *calPrinter, | 167 | virtual void printPreview(CalPrinter *calPrinter, |
168 | const QDate &, const QDate &); | 168 | const QDate &, const QDate &); |
169 | 169 | ||
170 | /** start-datetime of selection */ | 170 | /** start-datetime of selection */ |
171 | QDateTime selectionStart() {return mTimeSpanBegin;} | 171 | QDateTime selectionStart() {return mTimeSpanBegin;} |
172 | /** end-datetime of selection */ | 172 | /** end-datetime of selection */ |
173 | QDateTime selectionEnd() {return mTimeSpanEnd;} | 173 | QDateTime selectionEnd() {return mTimeSpanEnd;} |
174 | /** returns true if selection is for whole day */ | 174 | /** returns true if selection is for whole day */ |
175 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} | 175 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} |
176 | /** make selected start/end invalid */ | 176 | /** make selected start/end invalid */ |
177 | void deleteSelectedDateTime(); | 177 | void deleteSelectedDateTime(); |
178 | void repaintAgenda(); | 178 | void repaintAgenda(); |
179 | public slots: | 179 | public slots: |
180 | void setInitStartHour(); | ||
180 | virtual void updateView(); | 181 | virtual void updateView(); |
181 | virtual void updateConfig(); | 182 | virtual void updateConfig(); |
182 | virtual void showDates(const QDate &start, const QDate &end); | 183 | virtual void showDates(const QDate &start, const QDate &end); |
183 | virtual void showEvents(QPtrList<Event> eventList); | 184 | virtual void showEvents(QPtrList<Event> eventList); |
184 | 185 | ||
185 | void updateTodo( Todo *, int ); | 186 | void updateTodo( Todo *, int ); |
186 | void changeEventDisplay(Event *, int); | 187 | void changeEventDisplay(Event *, int); |
187 | 188 | ||
188 | void clearSelection(); | 189 | void clearSelection(); |
189 | 190 | ||
190 | void newTodo(int gx,int gy); | 191 | void newTodo(int gx,int gy); |
191 | void newEvent(int gx,int gy); | 192 | void newEvent(int gx,int gy); |
192 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); | 193 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); |
193 | void newEventAllDay(int gx, int gy); | 194 | void newEventAllDay(int gx, int gy); |
194 | void newTodoAllDay(int gx, int gy); | 195 | void newTodoAllDay(int gx, int gy); |
195 | 196 | ||
196 | void startDrag(Event *); | 197 | void startDrag(Event *); |
197 | 198 | ||
198 | void readSettings(); | 199 | void readSettings(); |
199 | void readSettings(KConfig *); | 200 | void readSettings(KConfig *); |
200 | void writeSettings(KConfig *); | 201 | void writeSettings(KConfig *); |
201 | 202 | ||
202 | void setContentsPos(int y); | 203 | void setContentsPos(int y); |
203 | 204 | ||
204 | void setExpandedButton( bool expanded ); | 205 | void setExpandedButton( bool expanded ); |
205 | void scrollOneHourUp(); | 206 | void scrollOneHourUp(); |
206 | void scrollOneHourDown(); | 207 | void scrollOneHourDown(); |
207 | void addToCalSlot(Incidence *, Incidence *); | 208 | void addToCalSlot(Incidence *, Incidence *); |
208 | 209 | ||
209 | signals: | 210 | signals: |
210 | void showDateView( int, QDate ); | 211 | void showDateView( int, QDate ); |
211 | void newTodoSignal( QDateTime ,bool ); | 212 | void newTodoSignal( QDateTime ,bool ); |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index b0f26d1..f8f6c1d 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -65,65 +65,72 @@ KOViewManager::KOViewManager( CalendarView *mainView ) : | |||
65 | mWhatsNextView = 0; | 65 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 66 | mTodoView = 0; |
67 | mAgendaView = 0; | 67 | mAgendaView = 0; |
68 | mMonthView = 0; | 68 | mMonthView = 0; |
69 | mListView = 0; | 69 | mListView = 0; |
70 | mJournalView = 0; | 70 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 71 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 72 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 73 | mFlagShowNextxDays = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") showMonthView(); | 91 | else if (view == "Month") showMonthView(); |
92 | else if (view == "List") showListView(); | 92 | else if (view == "List") showListView(); |
93 | else if (view == "Journal") showJournalView(); | 93 | else if (view == "Journal") showJournalView(); |
94 | else if (view == "TimeSpan") showTimeSpanView(); | 94 | else if (view == "TimeSpan") showTimeSpanView(); |
95 | else if (view == "Todo") showTodoView(); | 95 | else if (view == "Todo") showTodoView(); |
96 | else { | 96 | else { |
97 | config->setGroup( "Views" ); | ||
98 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | ||
99 | mCurrentAgendaView = dateCount; | ||
97 | showAgendaView(); | 100 | showAgendaView(); |
101 | mCurrentAgendaView = dateCount; | ||
102 | #ifdef DESKTOP_VERSION | ||
103 | QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); | ||
104 | #endif | ||
98 | } | 105 | } |
99 | } | 106 | } |
100 | 107 | ||
101 | void KOViewManager::showDateView( int view, QDate date) | 108 | void KOViewManager::showDateView( int view, QDate date) |
102 | { | 109 | { |
103 | static int lastMode = 0; | 110 | static int lastMode = 0; |
104 | static int lastCount = 0; | 111 | static int lastCount = 0; |
105 | static bool lastNDMode = false; | 112 | static bool lastNDMode = false; |
106 | static QDate lastDate; | 113 | static QDate lastDate; |
107 | //qDebug("date %d %s", view, date.toString().latin1()); | 114 | //qDebug("date %d %s", view, date.toString().latin1()); |
108 | 115 | ||
109 | if (view != 9) | 116 | if (view != 9) |
110 | lastMode = 0; | 117 | lastMode = 0; |
111 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); | 118 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); |
112 | bool savemFlagShowNextxDays = mFlagShowNextxDays; | 119 | bool savemFlagShowNextxDays = mFlagShowNextxDays; |
113 | mFlagShowNextxDays = false; | 120 | mFlagShowNextxDays = false; |
114 | if ( view == 3 ) { | 121 | if ( view == 3 ) { |
115 | //mCurrentAgendaView = 1 ; | 122 | //mCurrentAgendaView = 1 ; |
116 | lastDate = mMainView->dateNavigator()->selectedDates().first(); | 123 | lastDate = mMainView->dateNavigator()->selectedDates().first(); |
117 | lastCount = mMainView->dateNavigator()->selectedDates().count(); | 124 | lastCount = mMainView->dateNavigator()->selectedDates().count(); |
118 | lastNDMode = savemFlagShowNextxDays; | 125 | lastNDMode = savemFlagShowNextxDays; |
119 | mMainView->showDay( date ); | 126 | mMainView->showDay( date ); |
120 | lastMode = 1; | 127 | lastMode = 1; |
121 | } else if (view == 4 ) { | 128 | } else if (view == 4 ) { |
122 | mCurrentAgendaView = 7 ; | 129 | mCurrentAgendaView = 7 ; |
123 | mMainView->dateNavigator()->selectDates( date, 7 ); | 130 | mMainView->dateNavigator()->selectDates( date, 7 ); |
124 | } else if (view == 5 ) { | 131 | } else if (view == 5 ) { |
125 | mCurrentAgendaView = 14 ; | 132 | mCurrentAgendaView = 14 ; |
126 | mMainView->dateNavigator()->selectDates( date, 14); | 133 | mMainView->dateNavigator()->selectDates( date, 14); |
127 | } else if (view == 6 ) { | 134 | } else if (view == 6 ) { |
128 | //mMainView->dateNavigator()->selectDates( date, 7 ); | 135 | //mMainView->dateNavigator()->selectDates( date, 7 ); |
129 | showMonthView(); | 136 | showMonthView(); |