-rw-r--r-- | korganizer/koviewmanager.cpp | 2 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 2 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 19 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 6 |
5 files changed, 30 insertions, 2 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index b2dd266..cf56fcf 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,581 +1,583 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
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 <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include "calendarview.h" | 36 | #include "calendarview.h" |
37 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
38 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
39 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
40 | #include "kodialogmanager.h" | 40 | #include "kodialogmanager.h" |
41 | #include "komonthview.h" | 41 | #include "komonthview.h" |
42 | #include "kolistview.h" | 42 | #include "kolistview.h" |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | #include "kojournalview.h" | 44 | #include "kojournalview.h" |
45 | #include "kotimespanview.h" | 45 | #include "kotimespanview.h" |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "navigatorbar.h" | 47 | #include "navigatorbar.h" |
48 | 48 | ||
49 | #include "koviewmanager.h" | 49 | #include "koviewmanager.h" |
50 | //extern bool externFlagMonthviewBlockPainting; | 50 | //extern bool externFlagMonthviewBlockPainting; |
51 | 51 | ||
52 | //bool globalFlagBlockPainting = false; | 52 | //bool globalFlagBlockPainting = false; |
53 | int globalFlagBlockAgenda = 0; | 53 | int globalFlagBlockAgenda = 0; |
54 | int globalFlagBlockLabel = 0; | 54 | int globalFlagBlockLabel = 0; |
55 | int globalFlagBlockAgendaItemPaint = 1; | 55 | int globalFlagBlockAgendaItemPaint = 1; |
56 | int globalFlagBlockAgendaItemUpdate = 1; | 56 | int globalFlagBlockAgendaItemUpdate = 1; |
57 | 57 | ||
58 | 58 | ||
59 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 59 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
60 | QObject(), mMainView( mainView ) | 60 | QObject(), mMainView( mainView ) |
61 | { | 61 | { |
62 | mCurrentView = 0; | 62 | mCurrentView = 0; |
63 | 63 | ||
64 | mWhatsNextView = 0; | 64 | mWhatsNextView = 0; |
65 | mTodoView = 0; | 65 | mTodoView = 0; |
66 | mAgendaView = 0; | 66 | mAgendaView = 0; |
67 | mMonthView = 0; | 67 | mMonthView = 0; |
68 | mListView = 0; | 68 | mListView = 0; |
69 | mJournalView = 0; | 69 | mJournalView = 0; |
70 | mTimeSpanView = 0; | 70 | mTimeSpanView = 0; |
71 | mCurrentAgendaView = 0 ; | 71 | mCurrentAgendaView = 0 ; |
72 | mFlagShowNextxDays = false; | 72 | mFlagShowNextxDays = false; |
73 | } | 73 | } |
74 | 74 | ||
75 | KOViewManager::~KOViewManager() | 75 | KOViewManager::~KOViewManager() |
76 | { | 76 | { |
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | KOrg::BaseView *KOViewManager::currentView() | 80 | KOrg::BaseView *KOViewManager::currentView() |
81 | { | 81 | { |
82 | return mCurrentView; | 82 | return mCurrentView; |
83 | } | 83 | } |
84 | 84 | ||
85 | void KOViewManager::readSettings(KConfig *config) | 85 | void KOViewManager::readSettings(KConfig *config) |
86 | { | 86 | { |
87 | config->setGroup("General"); | 87 | config->setGroup("General"); |
88 | QString view = config->readEntry("Current View"); | 88 | QString view = config->readEntry("Current View"); |
89 | if (view == "WhatsNext") showWhatsNextView(); | 89 | if (view == "WhatsNext") showWhatsNextView(); |
90 | else if (view == "Month") showMonthView(); | 90 | else if (view == "Month") showMonthView(); |
91 | else if (view == "List") showListView(); | 91 | else if (view == "List") showListView(); |
92 | else if (view == "Journal") showJournalView(); | 92 | else if (view == "Journal") showJournalView(); |
93 | else if (view == "TimeSpan") showTimeSpanView(); | 93 | else if (view == "TimeSpan") showTimeSpanView(); |
94 | else if (view == "Todo") showTodoView(); | 94 | else if (view == "Todo") showTodoView(); |
95 | else { | 95 | else { |
96 | showAgendaView(); | 96 | showAgendaView(); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | void KOViewManager::writeSettings(KConfig *config) | 100 | void KOViewManager::writeSettings(KConfig *config) |
101 | { | 101 | { |
102 | config->setGroup("General"); | 102 | config->setGroup("General"); |
103 | 103 | ||
104 | QString view; | 104 | QString view; |
105 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 105 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
106 | else if (mCurrentView == mMonthView) view = "Month"; | 106 | else if (mCurrentView == mMonthView) view = "Month"; |
107 | else if (mCurrentView == mListView) view = "List"; | 107 | else if (mCurrentView == mListView) view = "List"; |
108 | else if (mCurrentView == mJournalView) view = "Journal"; | 108 | else if (mCurrentView == mJournalView) view = "Journal"; |
109 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 109 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
110 | else if (mCurrentView == mTodoView) view = "Todo"; | 110 | else if (mCurrentView == mTodoView) view = "Todo"; |
111 | else view = "Agenda"; | 111 | else view = "Agenda"; |
112 | 112 | ||
113 | config->writeEntry("Current View",view); | 113 | config->writeEntry("Current View",view); |
114 | 114 | ||
115 | if (mAgendaView) { | 115 | if (mAgendaView) { |
116 | mAgendaView->writeSettings(config); | 116 | mAgendaView->writeSettings(config); |
117 | } | 117 | } |
118 | if (mTimeSpanView) { | 118 | if (mTimeSpanView) { |
119 | mTimeSpanView->writeSettings(config); | 119 | mTimeSpanView->writeSettings(config); |
120 | } | 120 | } |
121 | if (mListView) { | 121 | if (mListView) { |
122 | mListView->writeSettings(config); | 122 | mListView->writeSettings(config); |
123 | } | 123 | } |
124 | if (mTodoView) { | 124 | if (mTodoView) { |
125 | mTodoView->saveLayout(config,"Todo View"); | 125 | mTodoView->saveLayout(config,"Todo View"); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 129 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
130 | { | 130 | { |
131 | 131 | ||
132 | //mFlagShowNextxDays = false; | 132 | //mFlagShowNextxDays = false; |
133 | //if(view == mCurrentView) return; | 133 | //if(view == mCurrentView) return; |
134 | if ( view == 0 ) { | 134 | if ( view == 0 ) { |
135 | view = mCurrentView; | 135 | view = mCurrentView; |
136 | if ( view == 0 ) | 136 | if ( view == 0 ) |
137 | return; | 137 | return; |
138 | } | 138 | } |
139 | bool full = fullScreen; | 139 | bool full = fullScreen; |
140 | if(view == mCurrentView && view != mWhatsNextView ) { | 140 | if(view == mCurrentView && view != mWhatsNextView ) { |
141 | if ( mCurrentAgendaView < 0 ) | 141 | if ( mCurrentAgendaView < 0 ) |
142 | return; | 142 | return; |
143 | full = mMainView->leftFrame()->isVisible(); | 143 | full = mMainView->leftFrame()->isVisible(); |
144 | } else { | 144 | } else { |
145 | mCurrentView = view; | 145 | mCurrentView = view; |
146 | 146 | ||
147 | // bool full = fullScreen; | 147 | // bool full = fullScreen; |
148 | bool isFull = !mMainView->leftFrame()->isVisible(); | 148 | bool isFull = !mMainView->leftFrame()->isVisible(); |
149 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 149 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
150 | full = true; | 150 | full = true; |
151 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 151 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
152 | full = false; | 152 | full = false; |
153 | } | 153 | } |
154 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 154 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
155 | raiseCurrentView( full ); | 155 | raiseCurrentView( full ); |
156 | mMainView->processIncidenceSelection( 0 ); | 156 | mMainView->processIncidenceSelection( 0 ); |
157 | mMainView->updateView(); | 157 | mMainView->updateView(); |
158 | mMainView->adaptNavigationUnits(); | 158 | mMainView->adaptNavigationUnits(); |
159 | } | 159 | } |
160 | 160 | ||
161 | void KOViewManager::raiseCurrentView( bool fullScreen ) | 161 | void KOViewManager::raiseCurrentView( bool fullScreen ) |
162 | { | 162 | { |
163 | //qDebug("raiseCurrentView "); | 163 | //qDebug("raiseCurrentView "); |
164 | mCurrentAgendaView = 0; | 164 | mCurrentAgendaView = 0; |
165 | int wid = mMainView->width() ; | 165 | int wid = mMainView->width() ; |
166 | int hei = mMainView->height(); | 166 | int hei = mMainView->height(); |
167 | if ( mCurrentView == mMonthView ) { | 167 | if ( mCurrentView == mMonthView ) { |
168 | mMainView->navigatorBar()->show(); | 168 | mMainView->navigatorBar()->show(); |
169 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 169 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
170 | //mMainView->navigatorBar()->hide(); | 170 | //mMainView->navigatorBar()->hide(); |
171 | } else { | 171 | } else { |
172 | mMainView->navigatorBar()->hide(); | 172 | mMainView->navigatorBar()->hide(); |
173 | } | 173 | } |
174 | if ( fullScreen ) { | 174 | if ( fullScreen ) { |
175 | mMainView->leftFrame()->hide(); | 175 | mMainView->leftFrame()->hide(); |
176 | } else { | 176 | } else { |
177 | mMainView->leftFrame()->show(); | 177 | mMainView->leftFrame()->show(); |
178 | if ( KOPrefs::instance()->mVerticalScreen ) | 178 | if ( KOPrefs::instance()->mVerticalScreen ) |
179 | hei -= mMainView->leftFrame()->height(); | 179 | hei -= mMainView->leftFrame()->height(); |
180 | else | 180 | else |
181 | wid -= mMainView->leftFrame()->width(); | 181 | wid -= mMainView->leftFrame()->width(); |
182 | } | 182 | } |
183 | 183 | ||
184 | if ( globalFlagBlockAgenda == 5 ) { | 184 | if ( globalFlagBlockAgenda == 5 ) { |
185 | globalFlagBlockAgenda = 4; | 185 | globalFlagBlockAgenda = 4; |
186 | globalFlagBlockAgendaItemPaint = 1; | 186 | globalFlagBlockAgendaItemPaint = 1; |
187 | } | 187 | } |
188 | mMainView->viewStack()->raiseWidget(mCurrentView); | 188 | mMainView->viewStack()->raiseWidget(mCurrentView); |
189 | if ( globalFlagBlockAgenda == 4 ) { | 189 | if ( globalFlagBlockAgenda == 4 ) { |
190 | if ( mCurrentView == mAgendaView ) { | 190 | if ( mCurrentView == mAgendaView ) { |
191 | //globalFlagBlockAgenda =1 ; | 191 | //globalFlagBlockAgenda =1 ; |
192 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 192 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
193 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 193 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
194 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 194 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
195 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 195 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
196 | qApp->processEvents(); | 196 | qApp->processEvents(); |
197 | //qDebug("qApp->processEvents() "); | 197 | //qDebug("qApp->processEvents() "); |
198 | globalFlagBlockAgenda = 0; | 198 | globalFlagBlockAgenda = 0; |
199 | mAgendaView->repaintAgenda(); | 199 | mAgendaView->repaintAgenda(); |
200 | 200 | ||
201 | } | 201 | } |
202 | globalFlagBlockAgenda = 0; | 202 | globalFlagBlockAgenda = 0; |
203 | } | 203 | } |
204 | //qDebug("raiseCurrentView ende "); | 204 | //qDebug("raiseCurrentView ende "); |
205 | } | 205 | } |
206 | 206 | ||
207 | void KOViewManager::updateView() | 207 | void KOViewManager::updateView() |
208 | { | 208 | { |
209 | // qDebug("KOViewManager::updateView() "); | 209 | // qDebug("KOViewManager::updateView() "); |
210 | // if we are updating mTodoView, we get endless recursion | 210 | // if we are updating mTodoView, we get endless recursion |
211 | if ( mTodoView == mCurrentView ) | 211 | if ( mTodoView == mCurrentView ) |
212 | return; | 212 | return; |
213 | if ( mCurrentView ) mCurrentView->updateView(); | 213 | if ( mCurrentView ) mCurrentView->updateView(); |
214 | 214 | ||
215 | } | 215 | } |
216 | 216 | ||
217 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 217 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
218 | { | 218 | { |
219 | // kdDebug() << "KOViewManager::updateView()" << endl; | 219 | // kdDebug() << "KOViewManager::updateView()" << endl; |
220 | 220 | ||
221 | if (mCurrentView) mCurrentView->showDates(start, end); | 221 | if (mCurrentView) mCurrentView->showDates(start, end); |
222 | 222 | ||
223 | if (mTodoView) mTodoView->updateView(); | 223 | if (mTodoView) mTodoView->updateView(); |
224 | } | 224 | } |
225 | 225 | ||
226 | 226 | ||
227 | void KOViewManager::updateWNview() | 227 | void KOViewManager::updateWNview() |
228 | { | 228 | { |
229 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 229 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
230 | mWhatsNextView->updateView(); | 230 | mWhatsNextView->updateView(); |
231 | 231 | ||
232 | } | 232 | } |
233 | void KOViewManager::showWhatsNextView() | 233 | void KOViewManager::showWhatsNextView() |
234 | { | 234 | { |
235 | if (!mWhatsNextView) { | 235 | if (!mWhatsNextView) { |
236 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 236 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
237 | "KOViewManager::WhatsNextView"); | 237 | "KOViewManager::WhatsNextView"); |
238 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 238 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
239 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 239 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
240 | addView(mWhatsNextView); | 240 | addView(mWhatsNextView); |
241 | connect(this, SIGNAL( printWNV() ), | ||
242 | mWhatsNextView, SLOT( printMe() ) ); | ||
241 | } | 243 | } |
242 | globalFlagBlockAgenda = 1; | 244 | globalFlagBlockAgenda = 1; |
243 | showView(mWhatsNextView, true ); | 245 | showView(mWhatsNextView, true ); |
244 | //mWhatsNextView->updateView(); | 246 | //mWhatsNextView->updateView(); |
245 | 247 | ||
246 | } | 248 | } |
247 | 249 | ||
248 | void KOViewManager::showListView() | 250 | void KOViewManager::showListView() |
249 | { | 251 | { |
250 | if (!mListView) { | 252 | if (!mListView) { |
251 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 253 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
252 | addView(mListView); | 254 | addView(mListView); |
253 | 255 | ||
254 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 256 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
255 | mMainView, SLOT(showIncidence(Incidence *))); | 257 | mMainView, SLOT(showIncidence(Incidence *))); |
256 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 258 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
257 | mMainView, SLOT(editIncidence(Incidence *))); | 259 | mMainView, SLOT(editIncidence(Incidence *))); |
258 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 260 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
259 | mMainView, SLOT(deleteIncidence(Incidence *))); | 261 | mMainView, SLOT(deleteIncidence(Incidence *))); |
260 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 262 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
261 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 263 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
262 | connect( mListView, SIGNAL( signalNewEvent() ), | 264 | connect( mListView, SIGNAL( signalNewEvent() ), |
263 | mMainView, SLOT( newEvent() ) ); | 265 | mMainView, SLOT( newEvent() ) ); |
264 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 266 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
265 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 267 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
266 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 268 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
267 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 269 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
268 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 270 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
269 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 271 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
270 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 272 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
271 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 273 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
272 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 274 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
273 | } | 275 | } |
274 | // bool temp = mFlagShowNextxDays; | 276 | // bool temp = mFlagShowNextxDays; |
275 | //globalFlagBlockPainting = true; | 277 | //globalFlagBlockPainting = true; |
276 | globalFlagBlockAgenda = 1; | 278 | globalFlagBlockAgenda = 1; |
277 | if ( KOPrefs::instance()->mListViewMonthTimespan ) | 279 | if ( KOPrefs::instance()->mListViewMonthTimespan ) |
278 | mMainView->dateNavigator()->selectMonth(); | 280 | mMainView->dateNavigator()->selectMonth(); |
279 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 281 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
280 | //mFlagShowNextxDays = temp; | 282 | //mFlagShowNextxDays = temp; |
281 | } | 283 | } |
282 | 284 | ||
283 | void KOViewManager::showAgendaView( bool fullScreen ) | 285 | void KOViewManager::showAgendaView( bool fullScreen ) |
284 | { | 286 | { |
285 | 287 | ||
286 | mMainView->dialogManager()->hideSearchDialog(); | 288 | mMainView->dialogManager()->hideSearchDialog(); |
287 | // qDebug("KOViewManager::showAgendaView "); | 289 | // qDebug("KOViewManager::showAgendaView "); |
288 | bool full; | 290 | bool full; |
289 | full = fullScreen; | 291 | full = fullScreen; |
290 | if (!mAgendaView) { | 292 | if (!mAgendaView) { |
291 | full = false; | 293 | full = false; |
292 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 294 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
293 | addView(mAgendaView); | 295 | addView(mAgendaView); |
294 | #ifndef DESKTOP_VERSION | 296 | #ifndef DESKTOP_VERSION |
295 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 297 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
296 | #endif | 298 | #endif |
297 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 299 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
298 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 300 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
299 | 301 | ||
300 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 302 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
301 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 303 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
302 | mMainView, SLOT(newEvent(QDateTime))); | 304 | mMainView, SLOT(newEvent(QDateTime))); |
303 | // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 305 | // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
304 | // mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 306 | // mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
305 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 307 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
306 | mMainView, SLOT(newEvent(QDate))); | 308 | mMainView, SLOT(newEvent(QDate))); |
307 | 309 | ||
308 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 310 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
309 | mMainView, SLOT(editIncidence(Incidence *))); | 311 | mMainView, SLOT(editIncidence(Incidence *))); |
310 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 312 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
311 | mMainView, SLOT(showIncidence(Incidence *))); | 313 | mMainView, SLOT(showIncidence(Incidence *))); |
312 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 314 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
313 | mMainView, SLOT(deleteIncidence(Incidence *))); | 315 | mMainView, SLOT(deleteIncidence(Incidence *))); |
314 | 316 | ||
315 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 317 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
316 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 318 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
317 | 319 | ||
318 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 320 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
319 | mMainView, SLOT( toggleExpand() ) ); | 321 | mMainView, SLOT( toggleExpand() ) ); |
320 | 322 | ||
321 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 323 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
322 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 324 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
323 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 325 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
324 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 326 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
325 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 327 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
326 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 328 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
327 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 329 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
328 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 330 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
329 | SLOT( updateTodo( Todo *, int ) ) ); | 331 | SLOT( updateTodo( Todo *, int ) ) ); |
330 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 332 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
331 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 333 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
332 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 334 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
333 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 335 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
334 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 336 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
335 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 337 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
336 | mAgendaView->readSettings(); | 338 | mAgendaView->readSettings(); |
337 | mAgendaView->updateConfig(); | 339 | mAgendaView->updateConfig(); |
338 | } | 340 | } |
339 | 341 | ||
340 | showView( mAgendaView, full); | 342 | showView( mAgendaView, full); |
341 | 343 | ||
342 | } | 344 | } |
343 | 345 | ||
344 | void KOViewManager::showDayView() | 346 | void KOViewManager::showDayView() |
345 | { | 347 | { |
346 | mFlagShowNextxDays = false; | 348 | mFlagShowNextxDays = false; |
347 | globalFlagBlockLabel = 1; | 349 | globalFlagBlockLabel = 1; |
348 | globalFlagBlockAgenda = 1; | 350 | globalFlagBlockAgenda = 1; |
349 | if ( mCurrentAgendaView != 1 ) | 351 | if ( mCurrentAgendaView != 1 ) |
350 | mCurrentAgendaView = -1; | 352 | mCurrentAgendaView = -1; |
351 | showAgendaView(); | 353 | showAgendaView(); |
352 | qApp->processEvents(); | 354 | qApp->processEvents(); |
353 | globalFlagBlockAgenda = 2; | 355 | globalFlagBlockAgenda = 2; |
354 | globalFlagBlockLabel = 0; | 356 | globalFlagBlockLabel = 0; |
355 | mMainView->dateNavigator()->selectDates( 1 ); | 357 | mMainView->dateNavigator()->selectDates( 1 ); |
356 | mCurrentAgendaView = 1 ; | 358 | mCurrentAgendaView = 1 ; |
357 | 359 | ||
358 | } | 360 | } |
359 | 361 | ||
360 | void KOViewManager::showWorkWeekView() | 362 | void KOViewManager::showWorkWeekView() |
361 | { | 363 | { |
362 | mFlagShowNextxDays = false; | 364 | mFlagShowNextxDays = false; |
363 | globalFlagBlockAgenda = 1; | 365 | globalFlagBlockAgenda = 1; |
364 | globalFlagBlockLabel = 1; | 366 | globalFlagBlockLabel = 1; |
365 | if ( mCurrentAgendaView != 5 ) | 367 | if ( mCurrentAgendaView != 5 ) |
366 | mCurrentAgendaView = -1; | 368 | mCurrentAgendaView = -1; |
367 | showAgendaView(); | 369 | showAgendaView(); |
368 | qApp->processEvents(); | 370 | qApp->processEvents(); |
369 | globalFlagBlockAgenda = 2; | 371 | globalFlagBlockAgenda = 2; |
370 | globalFlagBlockLabel = 0; | 372 | globalFlagBlockLabel = 0; |
371 | mMainView->dateNavigator()->selectWorkWeek(); | 373 | mMainView->dateNavigator()->selectWorkWeek(); |
372 | mCurrentAgendaView = 5 ; | 374 | mCurrentAgendaView = 5 ; |
373 | 375 | ||
374 | } | 376 | } |
375 | 377 | ||
376 | void KOViewManager::showWeekView() | 378 | void KOViewManager::showWeekView() |
377 | { | 379 | { |
378 | /* | 380 | /* |
379 | globalFlagBlockAgenda = 2; | 381 | globalFlagBlockAgenda = 2; |
380 | qDebug("4globalFlagBlockAgenda = 2; "); | 382 | qDebug("4globalFlagBlockAgenda = 2; "); |
381 | //globalFlagBlockPainting = true; | 383 | //globalFlagBlockPainting = true; |
382 | mMainView->dateNavigator()->selectWeek(); | 384 | mMainView->dateNavigator()->selectWeek(); |
383 | showAgendaView(); | 385 | showAgendaView(); |
384 | */ | 386 | */ |
385 | 387 | ||
386 | 388 | ||
387 | mFlagShowNextxDays = false; | 389 | mFlagShowNextxDays = false; |
388 | globalFlagBlockAgenda = 1; | 390 | globalFlagBlockAgenda = 1; |
389 | globalFlagBlockLabel = 1; | 391 | globalFlagBlockLabel = 1; |
390 | if ( mCurrentAgendaView != 7 ) | 392 | if ( mCurrentAgendaView != 7 ) |
391 | mCurrentAgendaView = -1; | 393 | mCurrentAgendaView = -1; |
392 | showAgendaView(); | 394 | showAgendaView(); |
393 | qApp->processEvents(); | 395 | qApp->processEvents(); |
394 | globalFlagBlockAgenda = 2; | 396 | globalFlagBlockAgenda = 2; |
395 | globalFlagBlockLabel = 0; | 397 | globalFlagBlockLabel = 0; |
396 | mMainView->dateNavigator()->selectWeek(); | 398 | mMainView->dateNavigator()->selectWeek(); |
397 | mCurrentAgendaView = 7 ; | 399 | mCurrentAgendaView = 7 ; |
398 | } | 400 | } |
399 | 401 | ||
400 | void KOViewManager::showNextXView() | 402 | void KOViewManager::showNextXView() |
401 | { | 403 | { |
402 | 404 | ||
403 | globalFlagBlockAgenda = 1; | 405 | globalFlagBlockAgenda = 1; |
404 | if ( mCurrentAgendaView != 3 ) | 406 | if ( mCurrentAgendaView != 3 ) |
405 | mCurrentAgendaView = -1; | 407 | mCurrentAgendaView = -1; |
406 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 408 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
407 | globalFlagBlockAgenda = 2; | 409 | globalFlagBlockAgenda = 2; |
408 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 410 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
409 | KOPrefs::instance()->mNextXDays ); | 411 | KOPrefs::instance()->mNextXDays ); |
410 | mFlagShowNextxDays = true; | 412 | mFlagShowNextxDays = true; |
411 | mCurrentAgendaView = 3 ; | 413 | mCurrentAgendaView = 3 ; |
412 | } | 414 | } |
413 | bool KOViewManager::showsNextDays() | 415 | bool KOViewManager::showsNextDays() |
414 | { | 416 | { |
415 | return mFlagShowNextxDays; | 417 | return mFlagShowNextxDays; |
416 | } | 418 | } |
417 | void KOViewManager::showMonthView() | 419 | void KOViewManager::showMonthView() |
418 | { | 420 | { |
419 | if (!mMonthView) { | 421 | if (!mMonthView) { |
420 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 422 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
421 | 423 | ||
422 | addView(mMonthView); | 424 | addView(mMonthView); |
423 | // mMonthView->show(); | 425 | // mMonthView->show(); |
424 | // SIGNALS/SLOTS FOR MONTH VIEW | 426 | // SIGNALS/SLOTS FOR MONTH VIEW |
425 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 427 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
426 | mMainView, SLOT(newEvent(QDateTime))); | 428 | mMainView, SLOT(newEvent(QDateTime))); |
427 | 429 | ||
428 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 430 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
429 | mMainView, SLOT(showIncidence(Incidence *))); | 431 | mMainView, SLOT(showIncidence(Incidence *))); |
430 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 432 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
431 | mMainView, SLOT(editIncidence(Incidence *))); | 433 | mMainView, SLOT(editIncidence(Incidence *))); |
432 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 434 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
433 | mMainView, SLOT(deleteIncidence(Incidence *))); | 435 | mMainView, SLOT(deleteIncidence(Incidence *))); |
434 | 436 | ||
435 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 437 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
436 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 438 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
437 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 439 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
438 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 440 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
439 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 441 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
440 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 442 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
441 | 443 | ||
442 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 444 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
443 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 445 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
444 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 446 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
445 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 447 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
446 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 448 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
447 | mMainView, SLOT ( selectWeekNum( int ) ) ); | 449 | mMainView, SLOT ( selectWeekNum( int ) ) ); |
448 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 450 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
449 | mMainView, SLOT ( showDay( QDate ) ) ); | 451 | mMainView, SLOT ( showDay( QDate ) ) ); |
450 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 452 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
451 | mMonthView->updateConfig(); | 453 | mMonthView->updateConfig(); |
452 | } | 454 | } |
453 | 455 | ||
454 | globalFlagBlockAgenda = 1; | 456 | globalFlagBlockAgenda = 1; |
455 | //mFlagShowNextxDays = false; | 457 | //mFlagShowNextxDays = false; |
456 | // if(mMonthView == mCurrentView) return; | 458 | // if(mMonthView == mCurrentView) return; |
457 | mMainView->dateNavigator()->selectMonth(); | 459 | mMainView->dateNavigator()->selectMonth(); |
458 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); | 460 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); |
459 | //mMonthView->showDates(tmpList.first(), tmpList.last()); | 461 | //mMonthView->showDates(tmpList.first(), tmpList.last()); |
460 | 462 | ||
461 | showView(mMonthView, true ); | 463 | showView(mMonthView, true ); |
462 | 464 | ||
463 | } | 465 | } |
464 | 466 | ||
465 | void KOViewManager::showTodoView() | 467 | void KOViewManager::showTodoView() |
466 | { | 468 | { |
467 | //mFlagShowNextxDays = false; | 469 | //mFlagShowNextxDays = false; |
468 | if ( !mTodoView ) { | 470 | if ( !mTodoView ) { |
469 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 471 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
470 | "KOViewManager::TodoView" ); | 472 | "KOViewManager::TodoView" ); |
471 | 473 | ||
472 | addView( mTodoView ); | 474 | addView( mTodoView ); |
473 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 475 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
474 | 476 | ||
475 | // SIGNALS/SLOTS FOR TODO VIEW | 477 | // SIGNALS/SLOTS FOR TODO VIEW |
476 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 478 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
477 | mMainView, SLOT( newTodo() ) ); | 479 | mMainView, SLOT( newTodo() ) ); |
478 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 480 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
479 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 481 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
480 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 482 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
481 | mMainView, SLOT( showTodo( Todo * ) ) ); | 483 | mMainView, SLOT( showTodo( Todo * ) ) ); |
482 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 484 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
483 | mMainView, SLOT( editTodo( Todo * ) ) ); | 485 | mMainView, SLOT( editTodo( Todo * ) ) ); |
484 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 486 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
485 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 487 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
486 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 488 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
487 | mMainView, SLOT( purgeCompleted() ) ); | 489 | mMainView, SLOT( purgeCompleted() ) ); |
488 | 490 | ||
489 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 491 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
490 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 492 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
491 | 493 | ||
492 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 494 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
493 | SLOT( updateConfig() ) ); | 495 | SLOT( updateConfig() ) ); |
494 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 496 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
495 | SLOT( updateTodo( Todo *, int ) ) ); | 497 | SLOT( updateTodo( Todo *, int ) ) ); |
496 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 498 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
497 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 499 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
498 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 500 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
499 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 501 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
500 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 502 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
501 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 503 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
502 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 504 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
503 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 505 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
504 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 506 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
505 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | 507 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); |
506 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 508 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
507 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 509 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
508 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 510 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
509 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 511 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
510 | KConfig *config = KOGlobals::config(); | 512 | KConfig *config = KOGlobals::config(); |
511 | mTodoView->restoreLayout(config,"Todo View"); | 513 | mTodoView->restoreLayout(config,"Todo View"); |
512 | mTodoView->setNavigator( mMainView->dateNavigator() ); | 514 | mTodoView->setNavigator( mMainView->dateNavigator() ); |
513 | } | 515 | } |
514 | 516 | ||
515 | globalFlagBlockAgenda = 1; | 517 | globalFlagBlockAgenda = 1; |
516 | showView( mTodoView, true ); | 518 | showView( mTodoView, true ); |
517 | 519 | ||
518 | } | 520 | } |
519 | 521 | ||
520 | void KOViewManager::showJournalView() | 522 | void KOViewManager::showJournalView() |
521 | { | 523 | { |
522 | //mFlagShowNextxDays = false; | 524 | //mFlagShowNextxDays = false; |
523 | if (!mJournalView) { | 525 | if (!mJournalView) { |
524 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 526 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
525 | "KOViewManager::JournalView"); | 527 | "KOViewManager::JournalView"); |
526 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 528 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
527 | SLOT( updateConfig() ) ); | 529 | SLOT( updateConfig() ) ); |
528 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 530 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
529 | addView(mJournalView); | 531 | addView(mJournalView); |
530 | } | 532 | } |
531 | 533 | ||
532 | showView(mJournalView); | 534 | showView(mJournalView); |
533 | } | 535 | } |
534 | 536 | ||
535 | void KOViewManager::showTimeSpanView() | 537 | void KOViewManager::showTimeSpanView() |
536 | { | 538 | { |
537 | //mFlagShowNextxDays = false; | 539 | //mFlagShowNextxDays = false; |
538 | if (!mTimeSpanView) { | 540 | if (!mTimeSpanView) { |
539 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 541 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
540 | "KOViewManager::TimeSpanView"); | 542 | "KOViewManager::TimeSpanView"); |
541 | addView(mTimeSpanView); | 543 | addView(mTimeSpanView); |
542 | 544 | ||
543 | mTimeSpanView->readSettings(); | 545 | mTimeSpanView->readSettings(); |
544 | } | 546 | } |
545 | 547 | ||
546 | showView(mTimeSpanView); | 548 | showView(mTimeSpanView); |
547 | } | 549 | } |
548 | 550 | ||
549 | Incidence *KOViewManager::currentSelection() | 551 | Incidence *KOViewManager::currentSelection() |
550 | { | 552 | { |
551 | if (!mCurrentView) return 0; | 553 | if (!mCurrentView) return 0; |
552 | if ( mCurrentView == mListView ) { | 554 | if ( mCurrentView == mListView ) { |
553 | if ( mListView->currentItem() ) | 555 | if ( mListView->currentItem() ) |
554 | return mListView->currentItem(); | 556 | return mListView->currentItem(); |
555 | } | 557 | } |
556 | return mCurrentView->selectedIncidences().first(); | 558 | return mCurrentView->selectedIncidences().first(); |
557 | } | 559 | } |
558 | 560 | ||
559 | QDate KOViewManager::currentSelectionDate() | 561 | QDate KOViewManager::currentSelectionDate() |
560 | { | 562 | { |
561 | QDate qd; | 563 | QDate qd; |
562 | if (mCurrentView) { | 564 | if (mCurrentView) { |
563 | DateList qvl = mCurrentView->selectedDates(); | 565 | DateList qvl = mCurrentView->selectedDates(); |
564 | if (!qvl.isEmpty()) qd = qvl.first(); | 566 | if (!qvl.isEmpty()) qd = qvl.first(); |
565 | } | 567 | } |
566 | return qd; | 568 | return qd; |
567 | } | 569 | } |
568 | 570 | ||
569 | void KOViewManager::addView(KOrg::BaseView *view) | 571 | void KOViewManager::addView(KOrg::BaseView *view) |
570 | { | 572 | { |
571 | #if QT_VERSION >= 300 | 573 | #if QT_VERSION >= 300 |
572 | mMainView->viewStack()->addWidget( view ); | 574 | mMainView->viewStack()->addWidget( view ); |
573 | #else | 575 | #else |
574 | mMainView->viewStack()->addWidget( view, 1 ); | 576 | mMainView->viewStack()->addWidget( view, 1 ); |
575 | #endif | 577 | #endif |
576 | } | 578 | } |
577 | 579 | ||
578 | void KOViewManager::setDocumentId( const QString &id ) | 580 | void KOViewManager::setDocumentId( const QString &id ) |
579 | { | 581 | { |
580 | if (mTodoView) mTodoView->setDocumentId( id ); | 582 | if (mTodoView) mTodoView->setDocumentId( id ); |
581 | } | 583 | } |
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index 26b22be..6f76e2c 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h | |||
@@ -1,113 +1,115 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 | 3 | Copyright (c) 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
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 KOVIEWMANAGER_H | 24 | #ifndef KOVIEWMANAGER_H |
25 | #define KOVIEWMANAGER_H | 25 | #define KOVIEWMANAGER_H |
26 | 26 | ||
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | 28 | ||
29 | #include <korganizer/baseview.h> | 29 | #include <korganizer/baseview.h> |
30 | 30 | ||
31 | class CalendarView; | 31 | class CalendarView; |
32 | 32 | ||
33 | class KOListView; | 33 | class KOListView; |
34 | class KOAgendaView; | 34 | class KOAgendaView; |
35 | class KOMonthView; | 35 | class KOMonthView; |
36 | class KOTimeSpanView; | 36 | class KOTimeSpanView; |
37 | class KOTodoView; | 37 | class KOTodoView; |
38 | class KOWhatsNextView; | 38 | class KOWhatsNextView; |
39 | class KOJournalView; | 39 | class KOJournalView; |
40 | 40 | ||
41 | using namespace KCal; | 41 | using namespace KCal; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | This class manages the views of the calendar. It owns the objects and handles | 44 | This class manages the views of the calendar. It owns the objects and handles |
45 | creation and selection. | 45 | creation and selection. |
46 | */ | 46 | */ |
47 | class KOViewManager : public QObject | 47 | class KOViewManager : public QObject |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | KOViewManager( CalendarView * ); | 51 | KOViewManager( CalendarView * ); |
52 | virtual ~KOViewManager(); | 52 | virtual ~KOViewManager(); |
53 | 53 | ||
54 | /** changes the view to be the currently selected view */ | 54 | /** changes the view to be the currently selected view */ |
55 | void showView(KOrg::BaseView *, bool fullScreen = false ); | 55 | void showView(KOrg::BaseView *, bool fullScreen = false ); |
56 | void updateWNview(); | 56 | void updateWNview(); |
57 | void readSettings(KConfig *config); | 57 | void readSettings(KConfig *config); |
58 | void writeSettings(KConfig *config); | 58 | void writeSettings(KConfig *config); |
59 | bool showsNextDays(); | 59 | bool showsNextDays(); |
60 | /** Read which view was shown last from config file */ | 60 | /** Read which view was shown last from config file */ |
61 | void readCurrentView(KConfig *); | 61 | void readCurrentView(KConfig *); |
62 | /** Write which view is currently shown to config file */ | 62 | /** Write which view is currently shown to config file */ |
63 | void writeCurrentView(KConfig *); | 63 | void writeCurrentView(KConfig *); |
64 | 64 | ||
65 | KOrg::BaseView *currentView(); | 65 | KOrg::BaseView *currentView(); |
66 | 66 | ||
67 | void setDocumentId( const QString & ); | 67 | void setDocumentId( const QString & ); |
68 | 68 | ||
69 | void updateView(); | 69 | void updateView(); |
70 | void updateView( const QDate &start, const QDate &end ); | 70 | void updateView( const QDate &start, const QDate &end ); |
71 | 71 | ||
72 | void raiseCurrentView( bool fullScreen = false ); | 72 | void raiseCurrentView( bool fullScreen = false ); |
73 | 73 | ||
74 | void addView(KOrg::BaseView *); | 74 | void addView(KOrg::BaseView *); |
75 | 75 | ||
76 | Incidence *currentSelection(); | 76 | Incidence *currentSelection(); |
77 | QDate currentSelectionDate(); | 77 | QDate currentSelectionDate(); |
78 | 78 | ||
79 | KOAgendaView *agendaView() const { return mAgendaView; } | 79 | KOAgendaView *agendaView() const { return mAgendaView; } |
80 | 80 | ||
81 | signals: | ||
82 | void printWNV(); | ||
81 | public slots: | 83 | public slots: |
82 | void showWhatsNextView(); | 84 | void showWhatsNextView(); |
83 | void showListView(); | 85 | void showListView(); |
84 | void showAgendaView( bool fullScreen = false ); | 86 | void showAgendaView( bool fullScreen = false ); |
85 | void showDayView(); | 87 | void showDayView(); |
86 | void showWorkWeekView(); | 88 | void showWorkWeekView(); |
87 | void showWeekView(); | 89 | void showWeekView(); |
88 | void showNextXView(); | 90 | void showNextXView(); |
89 | void showMonthView(); | 91 | void showMonthView(); |
90 | void showTodoView(); | 92 | void showTodoView(); |
91 | void showJournalView(); | 93 | void showJournalView(); |
92 | void showTimeSpanView(); | 94 | void showTimeSpanView(); |
93 | 95 | ||
94 | private: | 96 | private: |
95 | CalendarView *mMainView; | 97 | CalendarView *mMainView; |
96 | 98 | ||
97 | int mCurrentAgendaView; | 99 | int mCurrentAgendaView; |
98 | KOAgendaView *mAgendaView; | 100 | KOAgendaView *mAgendaView; |
99 | KOListView *mListView; | 101 | KOListView *mListView; |
100 | KOMonthView *mMonthView; | 102 | KOMonthView *mMonthView; |
101 | KOTodoView *mTodoView; | 103 | KOTodoView *mTodoView; |
102 | KOWhatsNextView *mWhatsNextView; | 104 | KOWhatsNextView *mWhatsNextView; |
103 | KOJournalView *mJournalView; | 105 | KOJournalView *mJournalView; |
104 | KOTimeSpanView *mTimeSpanView; | 106 | KOTimeSpanView *mTimeSpanView; |
105 | 107 | ||
106 | KOrg::BaseView *mCurrentView; // currently active event view | 108 | KOrg::BaseView *mCurrentView; // currently active event view |
107 | 109 | ||
108 | int mAgendaViewMode; | 110 | int mAgendaViewMode; |
109 | bool mFlagShowNextxDays; | 111 | bool mFlagShowNextxDays; |
110 | 112 | ||
111 | }; | 113 | }; |
112 | 114 | ||
113 | #endif | 115 | #endif |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 5f14bfa..219f7c3 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -1,708 +1,725 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qlayout.h> | 20 | #include <qlayout.h> |
21 | #include <qtextbrowser.h> | 21 | #include <qtextbrowser.h> |
22 | #include <qtextcodec.h> | 22 | #include <qtextcodec.h> |
23 | #include <qfileinfo.h> | 23 | #include <qfileinfo.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | 25 | ||
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | 27 | ||
28 | #include <kglobal.h> | 28 | #include <kglobal.h> |
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kiconloader.h> | 31 | #include <kiconloader.h> |
32 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
33 | 33 | ||
34 | #include <libkcal/calendar.h> | 34 | #include <libkcal/calendar.h> |
35 | 35 | ||
36 | #ifndef KORG_NOPRINTER | 36 | #ifndef KORG_NOPRINTER |
37 | #include "calprinter.h" | 37 | #include "calprinter.h" |
38 | #endif | 38 | #endif |
39 | #include "koglobals.h" | 39 | #include "koglobals.h" |
40 | #include "koprefs.h" | 40 | #include "koprefs.h" |
41 | #include "koeventviewerdialog.h" | 41 | #include "koeventviewerdialog.h" |
42 | #include <qstylesheet.h> | 42 | #include <qstylesheet.h> |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | using namespace KOrg; | 44 | using namespace KOrg; |
45 | 45 | ||
46 | void WhatsNextTextBrowser::setSource(const QString& n) | 46 | void WhatsNextTextBrowser::setSource(const QString& n) |
47 | { | 47 | { |
48 | 48 | ||
49 | if (n.startsWith("event:")) { | 49 | if (n.startsWith("event:")) { |
50 | emit showIncidence(n); | 50 | emit showIncidence(n); |
51 | return; | 51 | return; |
52 | } else if (n.startsWith("todo:")) { | 52 | } else if (n.startsWith("todo:")) { |
53 | emit showIncidence(n); | 53 | emit showIncidence(n); |
54 | return; | 54 | return; |
55 | } else { | 55 | } else { |
56 | QTextBrowser::setSource(n); | 56 | QTextBrowser::setSource(n); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, | 60 | KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, |
61 | const char *name) | 61 | const char *name) |
62 | : KOrg::BaseView(calendar, parent, name) | 62 | : KOrg::BaseView(calendar, parent, name) |
63 | { | 63 | { |
64 | // mDateLabel = | 64 | // mDateLabel = |
65 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); | 65 | // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); |
66 | // mDateLabel->setMargin(2); | 66 | // mDateLabel->setMargin(2); |
67 | // mDateLabel->setAlignment(AlignCenter); | 67 | // mDateLabel->setAlignment(AlignCenter); |
68 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 68 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
69 | mView = new WhatsNextTextBrowser(this); | 69 | mView = new WhatsNextTextBrowser(this); |
70 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); | 70 | connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); |
71 | QStyleSheet* stsh = mView->styleSheet(); | 71 | QStyleSheet* stsh = mView->styleSheet(); |
72 | QStyleSheetItem * style ; | 72 | QStyleSheetItem * style ; |
73 | style = stsh->item ("h2" ); | 73 | style = stsh->item ("h2" ); |
74 | if ( style ) { | 74 | if ( style ) { |
75 | style->setMargin(QStyleSheetItem::MarginAll,0); | 75 | style->setMargin(QStyleSheetItem::MarginAll,0); |
76 | } | 76 | } |
77 | style = stsh->item ("h3" ); | 77 | style = stsh->item ("h3" ); |
78 | if ( style ) { | 78 | if ( style ) { |
79 | style->setMargin(QStyleSheetItem::MarginAll,0); | 79 | style->setMargin(QStyleSheetItem::MarginAll,0); |
80 | } | 80 | } |
81 | mEventViewer = 0; | 81 | mEventViewer = 0; |
82 | 82 | ||
83 | QBoxLayout *topLayout = new QVBoxLayout(this); | 83 | QBoxLayout *topLayout = new QVBoxLayout(this); |
84 | // topLayout->addWidget(mDateLabel); | 84 | // topLayout->addWidget(mDateLabel); |
85 | topLayout->addWidget(mView); | 85 | topLayout->addWidget(mView); |
86 | mTimer = new QTimer( this ); | 86 | mTimer = new QTimer( this ); |
87 | connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); | 87 | connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); |
88 | 88 | ||
89 | connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | 89 | connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); |
90 | connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | 90 | connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); |
91 | } | 91 | } |
92 | 92 | ||
93 | KOWhatsNextView::~KOWhatsNextView() | 93 | KOWhatsNextView::~KOWhatsNextView() |
94 | { | 94 | { |
95 | } | 95 | } |
96 | 96 | ||
97 | int KOWhatsNextView::maxDatesHint() | 97 | int KOWhatsNextView::maxDatesHint() |
98 | { | 98 | { |
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | 101 | ||
102 | int KOWhatsNextView::currentDateCount() | 102 | int KOWhatsNextView::currentDateCount() |
103 | { | 103 | { |
104 | return 0; | 104 | return 0; |
105 | } | 105 | } |
106 | 106 | ||
107 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() | 107 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() |
108 | { | 108 | { |
109 | QPtrList<Incidence> eventList; | 109 | QPtrList<Incidence> eventList; |
110 | 110 | ||
111 | return eventList; | 111 | return eventList; |
112 | } | 112 | } |
113 | 113 | ||
114 | 114 | void KOWhatsNextView::printMe() | |
115 | { | ||
116 | #ifdef DESKTOP_VERSION | ||
117 | QPrinter printer; | ||
118 | if (!printer.setup() ) | ||
119 | return; | ||
120 | QTextBrowser tb; | ||
121 | tb.setFixedSize( 600, 4000 ); | ||
122 | QPainter::redirect ( tb.viewport(), &printer ); | ||
123 | updateView(); | ||
124 | tb.setText( mText ); | ||
125 | tb.show(); | ||
126 | tb.repaint(); | ||
127 | tb.hide(); | ||
128 | KMessageBox::information( this, i18n("Printing What's Next View!\n\nPlease close after\nprinting is finished.")); | ||
129 | #endif | ||
130 | } | ||
115 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 131 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
116 | const QDate &td) | 132 | const QDate &td) |
117 | { | 133 | { |
118 | #ifndef KORG_NOPRINTER | 134 | #ifndef KORG_NOPRINTER |
119 | calPrinter->preview(CalPrinter::Day, fd, td); | 135 | calPrinter->preview(CalPrinter::Day, fd, td); |
120 | #endif | 136 | #endif |
121 | } | 137 | } |
122 | void KOWhatsNextView::updateConfig() | 138 | void KOWhatsNextView::updateConfig() |
123 | { | 139 | { |
124 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 140 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
125 | updateView(); | 141 | updateView(); |
126 | 142 | ||
127 | } | 143 | } |
128 | void KOWhatsNextView::showEvent ( QShowEvent * e ) | 144 | void KOWhatsNextView::showEvent ( QShowEvent * e ) |
129 | { | 145 | { |
130 | //qDebug("KOWhatsNextView::showEvent "); | 146 | //qDebug("KOWhatsNextView::showEvent "); |
131 | restartTimer(); | 147 | restartTimer(); |
132 | QWidget::showEvent ( e ); | 148 | QWidget::showEvent ( e ); |
133 | } | 149 | } |
134 | void KOWhatsNextView::hideEvent ( QHideEvent * e) | 150 | void KOWhatsNextView::hideEvent ( QHideEvent * e) |
135 | { | 151 | { |
136 | //qDebug(" KOWhatsNextView::hideEvent"); | 152 | //qDebug(" KOWhatsNextView::hideEvent"); |
137 | mTimer->stop(); | 153 | mTimer->stop(); |
138 | QWidget::hideEvent ( e ); | 154 | QWidget::hideEvent ( e ); |
139 | } | 155 | } |
140 | void KOWhatsNextView::restartTimer() | 156 | void KOWhatsNextView::restartTimer() |
141 | { | 157 | { |
142 | //qDebug("KOWhatsNextView::restartTimer() "); | 158 | //qDebug("KOWhatsNextView::restartTimer() "); |
143 | mTimer->start( 300000 ); | 159 | mTimer->start( 300000 ); |
144 | //mTimer->start( 5000 ); | 160 | //mTimer->start( 5000 ); |
145 | } | 161 | } |
146 | void KOWhatsNextView::updateView() | 162 | void KOWhatsNextView::updateView() |
147 | { | 163 | { |
148 | if ( mTimer->isActive() ) | 164 | if ( mTimer->isActive() ) |
149 | restartTimer(); | 165 | restartTimer(); |
150 | //qDebug("KOWhatsNextView::updateView() "); | 166 | //qDebug("KOWhatsNextView::updateView() "); |
151 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); | 167 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); |
152 | KIconLoader kil("korganizer"); | 168 | KIconLoader kil("korganizer"); |
153 | QString ipath;// = new QString(); | 169 | QString ipath;// = new QString(); |
154 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); | 170 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); |
155 | //<big><big><strong>" + date + "</strong></big></big>\n"; | 171 | //<big><big><strong>" + date + "</strong></big></big>\n"; |
156 | mText = "<table width=\"100%\">\n"; | 172 | mText = "<table width=\"100%\">\n"; |
157 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 173 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
158 | #ifdef DESKTOP_VERSION | 174 | #ifdef DESKTOP_VERSION |
159 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; | 175 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; |
160 | #else | 176 | #else |
161 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | 177 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; |
162 | #endif | 178 | #endif |
163 | // mText += "<img src=\""; | 179 | // mText += "<img src=\""; |
164 | // mText += ipath; | 180 | // mText += ipath; |
165 | // mText += "\">"; | 181 | // mText += "\">"; |
166 | mEventDate = QDate::currentDate(); | 182 | mEventDate = QDate::currentDate(); |
167 | #ifdef DESKTOP_VERSION | 183 | #ifdef DESKTOP_VERSION |
168 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; | 184 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; |
169 | #else | 185 | #else |
170 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; | 186 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; |
171 | #endif | 187 | #endif |
172 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 188 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
173 | int iii; | 189 | int iii; |
174 | mTodos.clear(); | 190 | mTodos.clear(); |
175 | QPtrList<Event> events; | 191 | QPtrList<Event> events; |
176 | QPtrList<Todo> todos = calendar()->todos(); | 192 | QPtrList<Todo> todos = calendar()->todos(); |
177 | Todo * todo; | 193 | Todo * todo; |
178 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; | 194 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; |
179 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; | 195 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; |
180 | bool itemAdded = false; | 196 | bool itemAdded = false; |
181 | for ( iii = 0; iii < daysToShow; ++iii ) { | 197 | for ( iii = 0; iii < daysToShow; ++iii ) { |
182 | QString date; | 198 | QString date; |
183 | itemAdded = false; | 199 | itemAdded = false; |
184 | events = calendar()->events( mEventDate, true ); | 200 | events = calendar()->events( mEventDate, true ); |
185 | 201 | ||
186 | if ( iii == 0 ) { // today !!! | 202 | if ( iii == 0 ) { // today !!! |
187 | todo = todos.first(); | 203 | todo = todos.first(); |
188 | while(todo) { | 204 | while(todo) { |
189 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { | 205 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { |
190 | if ( ! itemAdded ) { | 206 | if ( ! itemAdded ) { |
191 | appendDay ( iii, mEventDate ); | 207 | appendDay ( iii, mEventDate ); |
192 | //itemAdded = true; | 208 | //itemAdded = true; |
193 | 209 | ||
194 | } //bool reply=false, bool notRed = true, bool appendTable = false); | 210 | } //bool reply=false, bool notRed = true, bool appendTable = false); |
195 | appendEvent(todo, false, false, !itemAdded ); | 211 | appendEvent(todo, false, false, !itemAdded ); |
196 | itemAdded = true; | 212 | itemAdded = true; |
197 | } | 213 | } |
198 | todo = todos.next(); | 214 | todo = todos.next(); |
199 | } | 215 | } |
200 | } | 216 | } |
201 | 217 | ||
202 | 218 | ||
203 | if (events.count() > 0) { | 219 | if (events.count() > 0) { |
204 | // mText += "<p></p>"; | 220 | // mText += "<p></p>"; |
205 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 221 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
206 | // mText += "<h2>"; | 222 | // mText += "<h2>"; |
207 | //mText += " <img src=\""; | 223 | //mText += " <img src=\""; |
208 | //mText += ipath; | 224 | //mText += ipath; |
209 | //mText += "\">"; | 225 | //mText += "\">"; |
210 | if ( ! itemAdded ) { | 226 | if ( ! itemAdded ) { |
211 | appendDay ( iii, mEventDate ); | 227 | appendDay ( iii, mEventDate ); |
212 | 228 | ||
213 | } | 229 | } |
214 | // for first day (iii == 0) | 230 | // for first day (iii == 0) |
215 | // we may have syncevents, or events in the past, which maybe should not be diaplayed | 231 | // we may have syncevents, or events in the past, which maybe should not be diaplayed |
216 | // for that reason we cannot append <table> in appendDay () for iii == 0 | 232 | // for that reason we cannot append <table> in appendDay () for iii == 0 |
217 | // we must append it in the first successful call of appendEvent() | 233 | // we must append it in the first successful call of appendEvent() |
218 | Event *ev = events.first(); | 234 | Event *ev = events.first(); |
219 | while(ev) { | 235 | while(ev) { |
220 | //qDebug("+++++event append %s", ev->summary().latin1()); | 236 | //qDebug("+++++event append %s", ev->summary().latin1()); |
221 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { | 237 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { |
222 | if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) | 238 | if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) |
223 | itemAdded = true; | 239 | itemAdded = true; |
224 | } | 240 | } |
225 | ev = events.next(); | 241 | ev = events.next(); |
226 | } | 242 | } |
227 | 243 | ||
228 | //mText += "</table>\n"; | 244 | //mText += "</table>\n"; |
229 | } | 245 | } |
230 | 246 | ||
231 | todo = todos.first(); | 247 | todo = todos.first(); |
232 | while(todo) { | 248 | while(todo) { |
233 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { | 249 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { |
234 | if ( ! itemAdded ) { | 250 | if ( ! itemAdded ) { |
235 | appendDay ( iii, mEventDate ); | 251 | appendDay ( iii, mEventDate ); |
236 | //itemAdded = true; | 252 | //itemAdded = true; |
237 | } | 253 | } |
238 | appendEvent(todo, false , iii!= 0,!itemAdded); | 254 | appendEvent(todo, false , iii!= 0,!itemAdded); |
239 | itemAdded = true; | 255 | itemAdded = true; |
240 | } | 256 | } |
241 | todo = todos.next(); | 257 | todo = todos.next(); |
242 | } | 258 | } |
243 | if ( !itemAdded && iii == 0 ) { | 259 | if ( !itemAdded && iii == 0 ) { |
244 | // appendDay ( iii, mEventDate ); | 260 | // appendDay ( iii, mEventDate ); |
245 | //mText += "<table>"; | 261 | //mText += "<table>"; |
246 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; | 262 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; |
247 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do.") +"</em></font></h3>\n"; | 263 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do.") +"</em></font></h3>\n"; |
248 | //mText +="</table>"; | 264 | //mText +="</table>"; |
249 | } | 265 | } |
250 | if ( itemAdded ) | 266 | if ( itemAdded ) |
251 | mText += "</table>\n"; | 267 | mText += "</table>\n"; |
252 | mEventDate = mEventDate.addDays( 1 ); | 268 | mEventDate = mEventDate.addDays( 1 ); |
253 | } | 269 | } |
254 | 270 | ||
255 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; | 271 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; |
256 | if (todos.count() > 0 && topmostPrios > 0 ) { | 272 | if (todos.count() > 0 && topmostPrios > 0 ) { |
257 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 273 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
258 | // mText += "<h2>"; | 274 | // mText += "<h2>"; |
259 | //<img src=\""; | 275 | //<img src=\""; |
260 | // mText += ipath; | 276 | // mText += ipath; |
261 | // mText += "\">"; | 277 | // mText += "\">"; |
262 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; | 278 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; |
263 | 279 | ||
264 | //mText += "<ul>\n"; | 280 | //mText += "<ul>\n"; |
265 | bool gotone = false; | 281 | bool gotone = false; |
266 | int priority = 1; | 282 | int priority = 1; |
267 | int priosFound = 0; | 283 | int priosFound = 0; |
268 | #ifdef DESKTOP_VERSION | 284 | #ifdef DESKTOP_VERSION |
269 | mText +="<p></p>"; | 285 | mText +="<p></p>"; |
270 | #endif | 286 | #endif |
271 | 287 | ||
272 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; | 288 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; |
273 | mText += "<ul>\n"; | 289 | mText += "<ul>\n"; |
274 | while (!gotone && priority<6) { | 290 | while (!gotone && priority<6) { |
275 | todo = todos.first(); | 291 | todo = todos.first(); |
276 | while(todo) { | 292 | while(todo) { |
277 | if (!todo->isCompleted() && (todo->priority() == priority) ) { | 293 | if (!todo->isCompleted() && (todo->priority() == priority) ) { |
278 | if ( appendTodo(todo) ) | 294 | if ( appendTodo(todo) ) |
279 | gotone = true; | 295 | gotone = true; |
280 | } | 296 | } |
281 | todo = todos.next(); | 297 | todo = todos.next(); |
282 | } | 298 | } |
283 | if ( gotone ) { | 299 | if ( gotone ) { |
284 | gotone = false; | 300 | gotone = false; |
285 | ++priosFound; | 301 | ++priosFound; |
286 | if ( priosFound == topmostPrios ) | 302 | if ( priosFound == topmostPrios ) |
287 | break; | 303 | break; |
288 | } | 304 | } |
289 | priority++; | 305 | priority++; |
290 | // kdDebug() << "adding the todos..." << endl; | 306 | // kdDebug() << "adding the todos..." << endl; |
291 | } | 307 | } |
292 | mText += "</ul>\n"; | 308 | mText += "</ul>\n"; |
293 | } | 309 | } |
294 | 310 | ||
295 | int replys = 0; | 311 | int replys = 0; |
296 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); | 312 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); |
297 | if (events.count() > 0) { | 313 | if (events.count() > 0) { |
298 | Event *ev = events.first(); | 314 | Event *ev = events.first(); |
299 | while(ev) { | 315 | while(ev) { |
300 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 316 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
301 | if (me!=0) { | 317 | if (me!=0) { |
302 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 318 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
303 | if (replys == 0) { | 319 | if (replys == 0) { |
304 | mText += "<p></p>"; | 320 | mText += "<p></p>"; |
305 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 321 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
306 | //mText += "<h2>"; | 322 | //mText += "<h2>"; |
307 | //<img src=\""; | 323 | //<img src=\""; |
308 | // mText += ipath; | 324 | // mText += ipath; |
309 | // mText += "\">"; | 325 | // mText += "\">"; |
310 | //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; | 326 | //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; |
311 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; | 327 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; |
312 | mText += "<table>\n"; | 328 | mText += "<table>\n"; |
313 | } | 329 | } |
314 | replys++; | 330 | replys++; |
315 | appendEvent(ev,true); | 331 | appendEvent(ev,true); |
316 | } | 332 | } |
317 | } | 333 | } |
318 | ev = events.next(); | 334 | ev = events.next(); |
319 | } | 335 | } |
320 | } | 336 | } |
321 | todos = calendar()->todos(); | 337 | todos = calendar()->todos(); |
322 | if (todos.count() > 0) { | 338 | if (todos.count() > 0) { |
323 | Todo *to = todos.first(); | 339 | Todo *to = todos.first(); |
324 | while(to) { | 340 | while(to) { |
325 | if ( !to->isCompleted() ){ | 341 | if ( !to->isCompleted() ){ |
326 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 342 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
327 | if (me!=0) { | 343 | if (me!=0) { |
328 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 344 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
329 | if (replys == 0) { | 345 | if (replys == 0) { |
330 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; | 346 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; |
331 | mText += "<table>\n"; | 347 | mText += "<table>\n"; |
332 | } | 348 | } |
333 | replys++; | 349 | replys++; |
334 | appendEvent(to, true); | 350 | appendEvent(to, true); |
335 | } | 351 | } |
336 | } | 352 | } |
337 | } | 353 | } |
338 | to = todos.next(); | 354 | to = todos.next(); |
339 | } | 355 | } |
340 | } | 356 | } |
341 | if (replys > 0 ) mText += "</table>\n"; | 357 | if (replys > 0 ) mText += "</table>\n"; |
342 | 358 | ||
343 | 359 | ||
344 | mText += "</td></tr>\n</table>\n"; | 360 | mText += "</td></tr>\n</table>\n"; |
345 | 361 | ||
346 | mView->setText(mText); | 362 | mView->setText(mText); |
347 | mView->setFocus(); | 363 | mView->setFocus(); |
348 | 364 | ||
349 | // QPixmap bPix = SmallIcon( "back" ); | 365 | // QPixmap bPix = SmallIcon( "back" ); |
350 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); | 366 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); |
351 | // QWidget* test = new QWidget(); | 367 | // QWidget* test = new QWidget(); |
352 | // test->setBackgroundMode(FixedPixmap ); | 368 | // test->setBackgroundMode(FixedPixmap ); |
353 | // test->setBackgroundPixmap ( bPix ); | 369 | // test->setBackgroundPixmap ( bPix ); |
354 | // test->resize( 300, 400 ); | 370 | // test->resize( 300, 400 ); |
355 | // test->show(); | 371 | // test->show(); |
356 | // mView->setBackgroundMode(FixedPixmap ); | 372 | // mView->setBackgroundMode(FixedPixmap ); |
357 | // mView->setBackgroundPixmap ( bPix ); | 373 | // mView->setBackgroundPixmap ( bPix ); |
358 | // qDebug("%s ",mText.latin1()); | 374 | // qDebug("%s ",mText.latin1()); |
359 | } | 375 | } |
360 | 376 | ||
361 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) | 377 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) |
362 | { | 378 | { |
363 | QString date; | 379 | QString date; |
364 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); | 380 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); |
365 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { | 381 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { |
366 | if ( i == 0 ) { | 382 | if ( i == 0 ) { |
367 | //mText += "<table>\n"; | 383 | //mText += "<table>\n"; |
368 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; | 384 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; |
369 | } | 385 | } |
370 | else if ( i == 1 ) | 386 | else if ( i == 1 ) |
371 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; | 387 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; |
372 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; | 388 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; |
373 | mText += "<h2>" + date + "</h2>\n"; | 389 | mText += "<h2>" + date + "</h2>\n"; |
374 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 390 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
375 | mText += "<table>\n"; | 391 | mText += "<table>\n"; |
376 | 392 | ||
377 | 393 | ||
378 | 394 | ||
379 | } else { | 395 | } else { |
380 | if ( i == 0 ) { | 396 | if ( i == 0 ) { |
381 | //mText += "<table>\n"; | 397 | //mText += "<table>\n"; |
382 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; | 398 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; |
383 | } | 399 | } |
384 | 400 | ||
385 | #ifdef DESKTOP_VERSION | 401 | #ifdef DESKTOP_VERSION |
386 | else if ( i == 1 ) { | 402 | else if ( i == 1 ) { |
387 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; | 403 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; |
388 | } | 404 | } |
389 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; | 405 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; |
390 | #else | 406 | #else |
391 | else if ( i == 1 ) { | 407 | else if ( i == 1 ) { |
392 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; | 408 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; |
393 | } | 409 | } |
394 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; | 410 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; |
395 | 411 | ||
396 | #endif | 412 | #endif |
397 | mText += "<h2>" + date + "</h2>\n"; | 413 | mText += "<h2>" + date + "</h2>\n"; |
398 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 414 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
399 | mText += "<table>\n"; | 415 | mText += "<table>\n"; |
400 | } | 416 | } |
401 | } | 417 | } |
402 | 418 | ||
403 | 419 | ||
404 | void KOWhatsNextView::showDates(const QDate &, const QDate &) | 420 | void KOWhatsNextView::showDates(const QDate &, const QDate &) |
405 | { | 421 | { |
406 | updateView(); | 422 | updateView(); |
407 | } | 423 | } |
408 | 424 | ||
409 | void KOWhatsNextView::showEvents(QPtrList<Event>) | 425 | void KOWhatsNextView::showEvents(QPtrList<Event>) |
410 | { | 426 | { |
411 | } | 427 | } |
412 | 428 | ||
413 | void KOWhatsNextView::changeEventDisplay(Event *, int action) | 429 | void KOWhatsNextView::changeEventDisplay(Event *, int action) |
414 | { | 430 | { |
415 | switch(action) { | 431 | switch(action) { |
416 | case KOGlobals::EVENTADDED: | 432 | case KOGlobals::EVENTADDED: |
417 | updateView(); | 433 | updateView(); |
418 | break; | 434 | break; |
419 | case KOGlobals::EVENTEDITED: | 435 | case KOGlobals::EVENTEDITED: |
420 | updateView(); | 436 | updateView(); |
421 | break; | 437 | break; |
422 | case KOGlobals::EVENTDELETED: | 438 | case KOGlobals::EVENTDELETED: |
423 | updateView(); | 439 | updateView(); |
424 | break; | 440 | break; |
425 | default: | 441 | default: |
426 | updateView(); | 442 | updateView(); |
427 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; | 443 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; |
428 | } | 444 | } |
429 | } | 445 | } |
430 | 446 | ||
431 | bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) | 447 | bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) |
432 | { | 448 | { |
433 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) | 449 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) |
434 | return false; | 450 | return false; |
435 | QDateTime cdt = QDateTime::currentDateTime(); | 451 | QDateTime cdt = QDateTime::currentDateTime(); |
436 | QDateTime noc; | 452 | QDateTime noc; |
437 | QString tempText; | 453 | QString tempText; |
438 | if ( appendTable && !notRed ) { | 454 | if ( appendTable && !notRed ) { |
439 | tempText = "<table>"; | 455 | tempText = "<table>"; |
440 | } | 456 | } |
441 | bool ok = true; | 457 | bool ok = true; |
442 | if ( reply ) { | 458 | if ( reply ) { |
443 | noc = ev->getNextOccurence( cdt, &ok ); | 459 | noc = ev->getNextOccurence( cdt, &ok ); |
444 | if (! ok && ev->type() == "Event") | 460 | if (! ok && ev->type() == "Event") |
445 | return false; | 461 | return false; |
446 | } | 462 | } |
447 | tempText += "<tr><td><b>"; | 463 | tempText += "<tr><td><b>"; |
448 | if (ev->type()=="Event") { | 464 | if (ev->type()=="Event") { |
449 | if (reply) { | 465 | if (reply) { |
450 | if (!ev->doesFloat()) | 466 | if (!ev->doesFloat()) |
451 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; | 467 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; |
452 | else | 468 | else |
453 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 469 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
454 | 470 | ||
455 | } else { | 471 | } else { |
456 | if (!ev->doesFloat()) { | 472 | if (!ev->doesFloat()) { |
457 | Event *event = static_cast<Event *>(ev); | 473 | Event *event = static_cast<Event *>(ev); |
458 | QDateTime st,end; | 474 | QDateTime st,end; |
459 | if ( event->recurrence()->doesRecur() ) { | 475 | if ( event->recurrence()->doesRecur() ) { |
460 | QDate recDate= mEventDate; | 476 | QDate recDate= mEventDate; |
461 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); | 477 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); |
462 | while ( ! event->recursOn( recDate ) ) { | 478 | while ( ! event->recursOn( recDate ) ) { |
463 | recDate = recDate.addDays( -1 ); | 479 | recDate = recDate.addDays( -1 ); |
464 | 480 | ||
465 | } | 481 | } |
466 | st = QDateTime ( recDate, event->dtStart().time() ); | 482 | st = QDateTime ( recDate, event->dtStart().time() ); |
467 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); | 483 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); |
468 | } | 484 | } |
469 | else { | 485 | else { |
470 | st = event->dtStart(); | 486 | st = event->dtStart(); |
471 | end = event->dtEnd(); | 487 | end = event->dtEnd(); |
472 | } | 488 | } |
473 | 489 | ||
474 | 490 | ||
475 | QString dateText; | 491 | QString dateText; |
476 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); | 492 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); |
477 | if ( st.date() < mEventDate ) | 493 | if ( st.date() < mEventDate ) |
478 | dateText = "++:++-"; | 494 | dateText = "++:++-"; |
479 | else | 495 | else |
480 | dateText = event->dtStartTimeStr() + "-"; | 496 | dateText = event->dtStartTimeStr() + "-"; |
481 | if ( end.date() > mEventDate ) | 497 | if ( end.date() > mEventDate ) |
482 | dateText += "++:++"; | 498 | dateText += "++:++"; |
483 | else | 499 | else |
484 | dateText += event->dtEndTimeStr(); | 500 | dateText += event->dtEndTimeStr(); |
485 | if ( notRed ) | 501 | if ( notRed ) |
486 | tempText += dateText; | 502 | tempText += dateText; |
487 | else { | 503 | else { |
488 | if ( end < cdt ) { | 504 | if ( end < cdt ) { |
489 | if ( !KOPrefs::instance()->mWNViewShowsPast ) | 505 | if ( !KOPrefs::instance()->mWNViewShowsPast ) |
490 | return false; | 506 | return false; |
491 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; | 507 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; |
492 | } | 508 | } |
493 | else if ( st < cdt ) | 509 | else if ( st < cdt ) |
494 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; | 510 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; |
495 | else | 511 | else |
496 | tempText += dateText; | 512 | tempText += dateText; |
497 | 513 | ||
498 | } | 514 | } |
499 | 515 | ||
500 | } else { | 516 | } else { |
501 | tempText += i18n("Allday:"); | 517 | tempText += i18n("Allday:"); |
502 | 518 | ||
503 | } | 519 | } |
504 | } | 520 | } |
505 | } else { | 521 | } else { |
506 | mTodos.append( ev ); | 522 | mTodos.append( ev ); |
507 | tempText += i18n("ToDo:"); | 523 | tempText += i18n("ToDo:"); |
508 | if (reply) { | 524 | if (reply) { |
509 | tempText += " "; | 525 | tempText += " "; |
510 | if ( noc != cdt ) { | 526 | if ( noc != cdt ) { |
511 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 527 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
512 | } | 528 | } |
513 | } else { | 529 | } else { |
514 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { | 530 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { |
515 | // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 531 | // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
516 | QString dfs = KGlobal::locale()->dateFormatShort(); | 532 | QString dfs = KGlobal::locale()->dateFormatShort(); |
517 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 533 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
518 | tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; | 534 | tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; |
519 | KGlobal::locale()->setDateFormatShort(dfs); | 535 | KGlobal::locale()->setDateFormatShort(dfs); |
520 | } else { | 536 | } else { |
521 | if (!ev->doesFloat() ) | 537 | if (!ev->doesFloat() ) |
522 | if( ( (Todo*)ev)->dtDue() < cdt ) { | 538 | if( ( (Todo*)ev)->dtDue() < cdt ) { |
523 | tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; | 539 | tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; |
524 | 540 | ||
525 | 541 | ||
526 | } else | 542 | } else |
527 | tempText +=((Todo*)ev)->dtDueTimeStr(); | 543 | tempText +=((Todo*)ev)->dtDueTimeStr(); |
528 | mTodos.append( ev ); | 544 | mTodos.append( ev ); |
529 | } | 545 | } |
530 | } | 546 | } |
531 | } | 547 | } |
532 | tempText += "</b></td><td>"; | 548 | tempText += "</b></td><td>"; |
533 | bool needClose = false; | 549 | bool needClose = false; |
534 | if ( ev->cancelled() ) { | 550 | if ( ev->cancelled() ) { |
535 | tempText += "<font color=\"#F00000\">[c"; | 551 | tempText += "<font color=\"#F00000\">[c"; |
536 | needClose =true; | 552 | needClose =true; |
537 | 553 | ||
538 | } | 554 | } |
539 | if ( ev->isAlarmEnabled() ) { | 555 | if ( ev->isAlarmEnabled() ) { |
540 | if ( !needClose) | 556 | if ( !needClose) |
541 | tempText +="["; | 557 | tempText +="["; |
542 | tempText += "a"; | 558 | tempText += "a"; |
543 | needClose =true; | 559 | needClose =true; |
544 | 560 | ||
545 | } | 561 | } |
546 | if ( ev->description().length() > 0 ) { | 562 | if ( ev->description().length() > 0 ) { |
547 | if ( !needClose) | 563 | if ( !needClose) |
548 | tempText +="["; | 564 | tempText +="["; |
549 | tempText += "i"; | 565 | tempText += "i"; |
550 | needClose =true; | 566 | needClose =true; |
551 | } | 567 | } |
552 | if ( ev->recurrence()->doesRecur() ) { | 568 | if ( ev->recurrence()->doesRecur() ) { |
553 | if ( !needClose) | 569 | if ( !needClose) |
554 | tempText +="["; | 570 | tempText +="["; |
555 | tempText += "r"; | 571 | tempText += "r"; |
556 | needClose =true; | 572 | needClose =true; |
557 | } | 573 | } |
558 | if ( needClose ) { | 574 | if ( needClose ) { |
559 | tempText += "] "; | 575 | tempText += "] "; |
560 | } | 576 | } |
561 | if ( ev->cancelled() ) | 577 | if ( ev->cancelled() ) |
562 | tempText += "</font>"; | 578 | tempText += "</font>"; |
563 | tempText += "<a "; | 579 | tempText += "<a "; |
564 | if (ev->type()=="Event") tempText += "href=\"event:"; | 580 | if (ev->type()=="Event") tempText += "href=\"event:"; |
565 | if (ev->type()=="Todo") tempText += "href=\"todo:"; | 581 | if (ev->type()=="Todo") tempText += "href=\"todo:"; |
566 | tempText += ev->uid() + "\">"; | 582 | tempText += ev->uid() + "\">"; |
567 | if ( ev->summary().length() > 0 ) | 583 | if ( ev->summary().length() > 0 ) |
568 | tempText += ev->summary(); | 584 | tempText += ev->summary(); |
569 | else | 585 | else |
570 | tempText += i18n("-no summary-"); | 586 | tempText += i18n("-no summary-"); |
571 | tempText += "</a>"; | 587 | tempText += "</a>"; |
572 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 588 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
573 | if ( !ev->location().isEmpty() ) | 589 | if ( !ev->location().isEmpty() ) |
574 | tempText += " ("+ev->location() +")"; | 590 | tempText += " ("+ev->location() +")"; |
575 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) | 591 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) |
576 | tempText += " ["+ev->relatedTo()->summary() +"]"; | 592 | tempText += " ["+ev->relatedTo()->summary() +"]"; |
577 | tempText += "</td></tr>\n"; | 593 | tempText += "</td></tr>\n"; |
578 | mText += tempText; | 594 | mText += tempText; |
579 | return true; | 595 | return true; |
580 | } | 596 | } |
581 | 597 | ||
582 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) | 598 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) |
583 | { | 599 | { |
584 | if ( mTodos.find( ev ) != mTodos.end() ) return false; | 600 | if ( mTodos.find( ev ) != mTodos.end() ) return false; |
585 | 601 | ||
586 | mTodos.append( ev ); | 602 | mTodos.append( ev ); |
587 | if ( !isSub ) | 603 | if ( !isSub ) |
588 | mText += "<p>"; | 604 | mText += "<p>"; |
589 | else | 605 | else |
590 | mText += "<li>"; | 606 | mText += "<li>"; |
591 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; | 607 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; |
592 | 608 | ||
593 | 609 | ||
594 | mText += ind; | 610 | mText += ind; |
595 | bool needClose = false; | 611 | bool needClose = false; |
596 | if ( ev->cancelled() ) { | 612 | if ( ev->cancelled() ) { |
597 | mText += "<font color=\"#F00000\">[c"; | 613 | mText += "<font color=\"#F00000\">[c"; |
598 | needClose =true; | 614 | needClose =true; |
599 | 615 | ||
600 | } | 616 | } |
601 | if ( ev->isAlarmEnabled() ) { | 617 | if ( ev->isAlarmEnabled() ) { |
602 | if ( !needClose) | 618 | if ( !needClose) |
603 | mText +="["; | 619 | mText +="["; |
604 | mText += "a"; | 620 | mText += "a"; |
605 | needClose =true; | 621 | needClose =true; |
606 | 622 | ||
607 | } | 623 | } |
608 | 624 | ||
609 | if ( ev->description().length() > 0 ) { | 625 | if ( ev->description().length() > 0 ) { |
610 | if ( !needClose) | 626 | if ( !needClose) |
611 | mText +="["; | 627 | mText +="["; |
612 | mText += "i"; | 628 | mText += "i"; |
613 | needClose =true; | 629 | needClose =true; |
614 | } | 630 | } |
615 | // if ( ev->recurrence()->doesRecur() ) { | 631 | // if ( ev->recurrence()->doesRecur() ) { |
616 | // if ( !needClose) | 632 | // if ( !needClose) |
617 | // mText +="("; | 633 | // mText +="("; |
618 | // mText += "r"; | 634 | // mText += "r"; |
619 | // needClose =true; | 635 | // needClose =true; |
620 | // } | 636 | // } |
621 | if ( needClose ) | 637 | if ( needClose ) |
622 | mText += "] "; | 638 | mText += "] "; |
623 | if ( ev->cancelled() ) | 639 | if ( ev->cancelled() ) |
624 | mText += "</font>"; | 640 | mText += "</font>"; |
625 | mText += "<a href=\"todo:" + ev->uid() + "\">"; | 641 | mText += "<a href=\"todo:" + ev->uid() + "\">"; |
626 | mText += ev->summary(); | 642 | mText += ev->summary(); |
627 | mText += "</a>"; | 643 | mText += "</a>"; |
628 | if ( ((Todo*)ev)->hasDueDate () ) { | 644 | if ( ((Todo*)ev)->hasDueDate () ) { |
629 | QString year = ""; | 645 | QString year = ""; |
630 | int ye = ((Todo*)ev)->dtDue().date().year(); | 646 | int ye = ((Todo*)ev)->dtDue().date().year(); |
631 | if ( QDateTime::currentDateTime().date().year() != ye ) | 647 | if ( QDateTime::currentDateTime().date().year() != ye ) |
632 | year = QString::number( ye ); | 648 | year = QString::number( ye ); |
633 | QString dfs = KGlobal::locale()->dateFormatShort(); | 649 | QString dfs = KGlobal::locale()->dateFormatShort(); |
634 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 650 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
635 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; | 651 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; |
636 | KGlobal::locale()->setDateFormatShort(dfs); | 652 | KGlobal::locale()->setDateFormatShort(dfs); |
637 | } | 653 | } |
638 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 654 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
639 | if ( !ev->location().isEmpty() ) | 655 | if ( !ev->location().isEmpty() ) |
640 | mText += " ("+ev->location() +")"; | 656 | mText += " ("+ev->location() +")"; |
641 | if ( !isSub ) { | 657 | if ( !isSub ) { |
642 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) | 658 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) |
643 | mText += " ["+ev->relatedTo()->summary() +"]"; | 659 | mText += " ["+ev->relatedTo()->summary() +"]"; |
644 | mText += "</p>\n"; | 660 | mText += "</p>\n"; |
645 | } | 661 | } |
646 | else { | 662 | else { |
647 | ind += "-"; | 663 | ind += "-"; |
648 | mText += "</li>\n"; | 664 | mText += "</li>\n"; |
649 | } | 665 | } |
650 | QPtrList<Incidence> Relations = ev->relations(); | 666 | QPtrList<Incidence> Relations = ev->relations(); |
651 | Incidence *to; | 667 | Incidence *to; |
652 | for (to=Relations.first();to;to=Relations.next()) { | 668 | for (to=Relations.first();to;to=Relations.next()) { |
653 | if (!((Todo*)to)->isCompleted()) | 669 | if (!((Todo*)to)->isCompleted()) |
654 | appendTodo( to, ind , true ); | 670 | appendTodo( to, ind , true ); |
655 | } | 671 | } |
656 | 672 | ||
657 | return true; | 673 | return true; |
658 | } | 674 | } |
659 | 675 | ||
660 | /* | 676 | /* |
661 | void KOWhatsNextView::createEventViewer() | 677 | void KOWhatsNextView::createEventViewer() |
662 | { | 678 | { |
663 | if (!mEventViewer) { | 679 | if (!mEventViewer) { |
664 | 680 | ||
665 | mEventViewer = new KOEventViewerDialog(this); | 681 | mEventViewer = new KOEventViewerDialog(this); |
666 | } | 682 | } |
667 | } | 683 | } |
668 | */ | 684 | */ |
669 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) | 685 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) |
670 | { | 686 | { |
671 | mEventViewer = v; | 687 | mEventViewer = v; |
672 | } | 688 | } |
673 | 689 | ||
674 | // TODO: Create this function in CalendarView and remove it from here | 690 | // TODO: Create this function in CalendarView and remove it from here |
675 | void KOWhatsNextView::showIncidence(const QString &uid) | 691 | void KOWhatsNextView::showIncidence(const QString &uid) |
676 | { | 692 | { |
693 | |||
677 | if ( !mEventViewer ) { | 694 | if ( !mEventViewer ) { |
678 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); | 695 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); |
679 | return; | 696 | return; |
680 | } | 697 | } |
681 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; | 698 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; |
682 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); | 699 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); |
683 | if (uid.startsWith("event:")) { | 700 | if (uid.startsWith("event:")) { |
684 | #ifdef DESKTOP_VERSION | 701 | #ifdef DESKTOP_VERSION |
685 | Event *event = calendar()->event(uid.mid(8)); | 702 | Event *event = calendar()->event(uid.mid(8)); |
686 | #else | 703 | #else |
687 | Event *event = calendar()->event(uid.mid(6)); | 704 | Event *event = calendar()->event(uid.mid(6)); |
688 | #endif | 705 | #endif |
689 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); | 706 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); |
690 | if (!event) return; | 707 | if (!event) return; |
691 | //createEventViewer(); | 708 | //createEventViewer(); |
692 | mEventViewer->setEvent(event); | 709 | mEventViewer->setEvent(event); |
693 | } else if (uid.startsWith("todo:")) { | 710 | } else if (uid.startsWith("todo:")) { |
694 | #ifdef DESKTOP_VERSION | 711 | #ifdef DESKTOP_VERSION |
695 | Todo *todo = calendar()->todo(uid.mid(7)); | 712 | Todo *todo = calendar()->todo(uid.mid(7)); |
696 | #else | 713 | #else |
697 | Todo *todo = calendar()->todo(uid.mid(5)); | 714 | Todo *todo = calendar()->todo(uid.mid(5)); |
698 | #endif | 715 | #endif |
699 | if (!todo) return; | 716 | if (!todo) return; |
700 | //createEventViewer(); | 717 | //createEventViewer(); |
701 | mEventViewer->setTodo(todo); | 718 | mEventViewer->setTodo(todo); |
702 | } else { | 719 | } else { |
703 | return; | 720 | return; |
704 | 721 | ||
705 | } | 722 | } |
706 | mEventViewer->showMe(); | 723 | mEventViewer->showMe(); |
707 | mEventViewer->raise(); | 724 | mEventViewer->raise(); |
708 | } | 725 | } |
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h index 9049268..0231cf2 100644 --- a/korganizer/kowhatsnextview.h +++ b/korganizer/kowhatsnextview.h | |||
@@ -1,96 +1,99 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | #ifndef KOWHATSNEXTVIEW_H | 19 | #ifndef KOWHATSNEXTVIEW_H |
20 | #define KOWHATSNEXTVIEW_H | 20 | #define KOWHATSNEXTVIEW_H |
21 | 21 | ||
22 | #include <qtextbrowser.h> | 22 | #include <qtextbrowser.h> |
23 | #include <qtimer.h> | 23 | #include <qtimer.h> |
24 | 24 | ||
25 | #include <korganizer/baseview.h> | 25 | #include <korganizer/baseview.h> |
26 | 26 | ||
27 | class QListView; | 27 | class QListView; |
28 | class QLabel; | 28 | class QLabel; |
29 | 29 | ||
30 | class KOEventViewerDialog; | 30 | class KOEventViewerDialog; |
31 | 31 | ||
32 | #include <qpainter.h> | ||
33 | #include <qwidget.h> | ||
32 | class WhatsNextTextBrowser : public QTextBrowser { | 34 | class WhatsNextTextBrowser : public QTextBrowser { |
33 | Q_OBJECT | 35 | Q_OBJECT |
34 | public: | 36 | public: |
35 | WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {} | 37 | WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {} |
36 | 38 | ||
37 | void setSource(const QString &); | 39 | void setSource(const QString &); |
38 | 40 | ||
39 | signals: | 41 | signals: |
40 | void showIncidence(const QString &uid); | 42 | void showIncidence(const QString &uid); |
41 | }; | 43 | }; |
42 | 44 | ||
43 | 45 | ||
44 | /** | 46 | /** |
45 | This class provides a view of the next events and todos | 47 | This class provides a view of the next events and todos |
46 | */ | 48 | */ |
47 | class KOWhatsNextView : public KOrg::BaseView | 49 | class KOWhatsNextView : public KOrg::BaseView |
48 | { | 50 | { |
49 | Q_OBJECT | 51 | Q_OBJECT |
50 | public: | 52 | public: |
51 | KOWhatsNextView(Calendar *calendar, QWidget *parent = 0, | 53 | KOWhatsNextView(Calendar *calendar, QWidget *parent = 0, |
52 | const char *name = 0); | 54 | const char *name = 0); |
53 | ~KOWhatsNextView(); | 55 | ~KOWhatsNextView(); |
54 | 56 | ||
55 | virtual int maxDatesHint(); | 57 | virtual int maxDatesHint(); |
56 | virtual int currentDateCount(); | 58 | virtual int currentDateCount(); |
57 | void setEventViewer(KOEventViewerDialog* v ); | 59 | void setEventViewer(KOEventViewerDialog* v ); |
58 | virtual QPtrList<Incidence> selectedIncidences(); | 60 | virtual QPtrList<Incidence> selectedIncidences(); |
59 | DateList selectedDates() | 61 | DateList selectedDates() |
60 | {DateList q; | 62 | {DateList q; |
61 | return q;} | 63 | return q;} |
62 | virtual void printPreview(CalPrinter *calPrinter, | 64 | virtual void printPreview(CalPrinter *calPrinter, |
63 | const QDate &, const QDate &); | 65 | const QDate &, const QDate &); |
64 | 66 | ||
65 | public slots: | 67 | public slots: |
66 | virtual void updateView(); | 68 | virtual void updateView(); |
69 | void printMe(); | ||
67 | virtual void showDates(const QDate &start, const QDate &end); | 70 | virtual void showDates(const QDate &start, const QDate &end); |
68 | virtual void showEvents(QPtrList<Event> eventList); | 71 | virtual void showEvents(QPtrList<Event> eventList); |
69 | void updateConfig(); | 72 | void updateConfig(); |
70 | void changeEventDisplay(Event *, int); | 73 | void changeEventDisplay(Event *, int); |
71 | 74 | ||
72 | protected: | 75 | protected: |
73 | bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false); | 76 | bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false); |
74 | bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); | 77 | bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); |
75 | void appendDay( int i, QDate date ); | 78 | void appendDay( int i, QDate date ); |
76 | QDate mEventDate; | 79 | QDate mEventDate; |
77 | virtual void showEvent ( QShowEvent * ); | 80 | virtual void showEvent ( QShowEvent * ); |
78 | virtual void hideEvent ( QHideEvent * ); | 81 | virtual void hideEvent ( QHideEvent * ); |
79 | 82 | ||
80 | private slots: | 83 | private slots: |
81 | void showIncidence(const QString &); | 84 | void showIncidence(const QString &); |
82 | void restartTimer(); | 85 | void restartTimer(); |
83 | 86 | ||
84 | 87 | ||
85 | private: | 88 | private: |
86 | //void createEventViewer(); | 89 | //void createEventViewer(); |
87 | QTimer* mTimer; | 90 | QTimer* mTimer; |
88 | QTextBrowser *mView; | 91 | QTextBrowser *mView; |
89 | QString mText; | 92 | QString mText; |
90 | // QLabel *mDateLabel; | 93 | // QLabel *mDateLabel; |
91 | KOEventViewerDialog *mEventViewer; | 94 | KOEventViewerDialog *mEventViewer; |
92 | 95 | ||
93 | QValueList<Incidence *> mTodos; | 96 | QValueList<Incidence *> mTodos; |
94 | }; | 97 | }; |
95 | 98 | ||
96 | #endif | 99 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 6bc5b3a..def8431 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,1894 +1,1898 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "koagenda.h" | 50 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 53 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 56 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 58 | #include "koglobals.h" |
59 | #include "kglobal.h" | 59 | #include "kglobal.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "simplealarmclient.h" | 62 | #include "simplealarmclient.h" |
63 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #include "koimportoldialog.h" | 69 | #include "koimportoldialog.h" |
70 | #endif | 70 | #endif |
71 | #include "mainwindow.h" | 71 | #include "mainwindow.h" |
72 | 72 | ||
73 | class KOex2phonePrefs : public QDialog | 73 | class KOex2phonePrefs : public QDialog |
74 | { | 74 | { |
75 | public: | 75 | public: |
76 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 76 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
77 | QDialog( parent, name, true ) | 77 | QDialog( parent, name, true ) |
78 | { | 78 | { |
79 | setCaption( i18n("Export to phone options") ); | 79 | setCaption( i18n("Export to phone options") ); |
80 | QVBoxLayout* lay = new QVBoxLayout( this ); | 80 | QVBoxLayout* lay = new QVBoxLayout( this ); |
81 | lay->setSpacing( 3 ); | 81 | lay->setSpacing( 3 ); |
82 | lay->setMargin( 3 ); | 82 | lay->setMargin( 3 ); |
83 | QLabel *lab; | 83 | QLabel *lab; |
84 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 84 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
85 | lab->setAlignment (AlignHCenter ); | 85 | lab->setAlignment (AlignHCenter ); |
86 | QHBox* temphb; | 86 | QHBox* temphb; |
87 | temphb = new QHBox( this ); | 87 | temphb = new QHBox( this ); |
88 | new QLabel( i18n("I/O device: "), temphb ); | 88 | new QLabel( i18n("I/O device: "), temphb ); |
89 | mPhoneDevice = new QLineEdit( temphb); | 89 | mPhoneDevice = new QLineEdit( temphb); |
90 | lay->addWidget( temphb ); | 90 | lay->addWidget( temphb ); |
91 | temphb = new QHBox( this ); | 91 | temphb = new QHBox( this ); |
92 | new QLabel( i18n("Connection: "), temphb ); | 92 | new QLabel( i18n("Connection: "), temphb ); |
93 | mPhoneConnection = new QLineEdit( temphb); | 93 | mPhoneConnection = new QLineEdit( temphb); |
94 | lay->addWidget( temphb ); | 94 | lay->addWidget( temphb ); |
95 | temphb = new QHBox( this ); | 95 | temphb = new QHBox( this ); |
96 | new QLabel( i18n("Model(opt.): "), temphb ); | 96 | new QLabel( i18n("Model(opt.): "), temphb ); |
97 | mPhoneModel = new QLineEdit( temphb); | 97 | mPhoneModel = new QLineEdit( temphb); |
98 | lay->addWidget( temphb ); | 98 | lay->addWidget( temphb ); |
99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
100 | mWriteBackFuture->setChecked( true ); | 100 | mWriteBackFuture->setChecked( true ); |
101 | lay->addWidget( mWriteBackFuture ); | 101 | lay->addWidget( mWriteBackFuture ); |
102 | temphb = new QHBox( this ); | 102 | temphb = new QHBox( this ); |
103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
105 | mWriteBackFutureWeeks->setValue( 8 ); | 105 | mWriteBackFutureWeeks->setValue( 8 ); |
106 | lay->addWidget( temphb ); | 106 | lay->addWidget( temphb ); |
107 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 107 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
108 | lab->setAlignment (AlignHCenter ); | 108 | lab->setAlignment (AlignHCenter ); |
109 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 109 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
110 | lay->addWidget( ok ); | 110 | lay->addWidget( ok ); |
111 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 111 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
112 | lay->addWidget( cancel ); | 112 | lay->addWidget( cancel ); |
113 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 113 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
114 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 114 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
115 | resize( 220, 240 ); | 115 | resize( 220, 240 ); |
116 | qApp->processEvents(); | 116 | qApp->processEvents(); |
117 | int dw = QApplication::desktop()->width(); | 117 | int dw = QApplication::desktop()->width(); |
118 | int dh = QApplication::desktop()->height(); | 118 | int dh = QApplication::desktop()->height(); |
119 | move( (dw-width())/2, (dh - height() )/2 ); | 119 | move( (dw-width())/2, (dh - height() )/2 ); |
120 | } | 120 | } |
121 | 121 | ||
122 | public: | 122 | public: |
123 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 123 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
124 | QCheckBox* mWriteBackFuture; | 124 | QCheckBox* mWriteBackFuture; |
125 | QSpinBox* mWriteBackFutureWeeks; | 125 | QSpinBox* mWriteBackFutureWeeks; |
126 | }; | 126 | }; |
127 | 127 | ||
128 | int globalFlagBlockStartup; | 128 | int globalFlagBlockStartup; |
129 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 129 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
130 | QMainWindow( parent, name ) | 130 | QMainWindow( parent, name ) |
131 | { | 131 | { |
132 | 132 | ||
133 | #ifdef DESKTOP_VERSION | 133 | #ifdef DESKTOP_VERSION |
134 | setFont( QFont("Arial"), 14 ); | 134 | setFont( QFont("Arial"), 14 ); |
135 | #endif | 135 | #endif |
136 | mClosed = false; | 136 | mClosed = false; |
137 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 137 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
138 | QString confFile = locateLocal("config","korganizerrc"); | 138 | QString confFile = locateLocal("config","korganizerrc"); |
139 | QFileInfo finf ( confFile ); | 139 | QFileInfo finf ( confFile ); |
140 | bool showWarning = !finf.exists(); | 140 | bool showWarning = !finf.exists(); |
141 | setIcon(SmallIcon( "ko24" ) ); | 141 | setIcon(SmallIcon( "ko24" ) ); |
142 | mBlockAtStartup = true; | 142 | mBlockAtStartup = true; |
143 | mFlagKeyPressed = false; | 143 | mFlagKeyPressed = false; |
144 | setCaption("KOrganizer/Pi"); | 144 | setCaption("KOrganizer/Pi"); |
145 | KOPrefs *p = KOPrefs::instance(); | 145 | KOPrefs *p = KOPrefs::instance(); |
146 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 146 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
147 | if ( p->mHourSize > 18 ) | 147 | if ( p->mHourSize > 18 ) |
148 | p->mHourSize = 18; | 148 | p->mHourSize = 18; |
149 | QMainWindow::ToolBarDock tbd; | 149 | QMainWindow::ToolBarDock tbd; |
150 | if ( p->mToolBarHor ) { | 150 | if ( p->mToolBarHor ) { |
151 | if ( p->mToolBarUp ) | 151 | if ( p->mToolBarUp ) |
152 | tbd = Bottom; | 152 | tbd = Bottom; |
153 | else | 153 | else |
154 | tbd = Top; | 154 | tbd = Top; |
155 | } | 155 | } |
156 | else { | 156 | else { |
157 | if ( p->mToolBarUp ) | 157 | if ( p->mToolBarUp ) |
158 | tbd = Right; | 158 | tbd = Right; |
159 | else | 159 | else |
160 | tbd = Left; | 160 | tbd = Left; |
161 | } | 161 | } |
162 | if ( KOPrefs::instance()->mUseAppColors ) | 162 | if ( KOPrefs::instance()->mUseAppColors ) |
163 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 163 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
164 | globalFlagBlockStartup = 1; | 164 | globalFlagBlockStartup = 1; |
165 | iconToolBar = new QPEToolBar( this ); | 165 | iconToolBar = new QPEToolBar( this ); |
166 | addToolBar (iconToolBar , tbd ); | 166 | addToolBar (iconToolBar , tbd ); |
167 | mCalendarModifiedFlag = false; | 167 | mCalendarModifiedFlag = false; |
168 | 168 | ||
169 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 169 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
170 | splash->setAlignment ( AlignCenter ); | 170 | splash->setAlignment ( AlignCenter ); |
171 | setCentralWidget( splash ); | 171 | setCentralWidget( splash ); |
172 | #ifndef DESKTOP_VERSION | 172 | #ifndef DESKTOP_VERSION |
173 | showMaximized(); | 173 | showMaximized(); |
174 | #endif | 174 | #endif |
175 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 175 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
176 | setDefaultPreferences(); | 176 | setDefaultPreferences(); |
177 | mCalendar = new CalendarLocal(); | 177 | mCalendar = new CalendarLocal(); |
178 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 178 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
179 | mView->hide(); | 179 | mView->hide(); |
180 | //mView->resize(splash->size() ); | 180 | //mView->resize(splash->size() ); |
181 | initActions(); | 181 | initActions(); |
182 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 182 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
183 | mSyncManager->setBlockSave(false); | 183 | mSyncManager->setBlockSave(false); |
184 | mView->setSyncManager(mSyncManager); | 184 | mView->setSyncManager(mSyncManager); |
185 | #ifndef DESKTOP_VERSION | 185 | #ifndef DESKTOP_VERSION |
186 | iconToolBar->show(); | 186 | iconToolBar->show(); |
187 | qApp->processEvents(); | 187 | qApp->processEvents(); |
188 | #endif | 188 | #endif |
189 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 189 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
190 | int vh = height() ; | 190 | int vh = height() ; |
191 | int vw = width(); | 191 | int vw = width(); |
192 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 192 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
193 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 193 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
194 | vh -= iconToolBar->height(); | 194 | vh -= iconToolBar->height(); |
195 | } else { | 195 | } else { |
196 | vw -= iconToolBar->height(); | 196 | vw -= iconToolBar->height(); |
197 | } | 197 | } |
198 | //mView->setMaximumSize( splash->size() ); | 198 | //mView->setMaximumSize( splash->size() ); |
199 | //mView->resize( splash->size() ); | 199 | //mView->resize( splash->size() ); |
200 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 200 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
201 | mView->readSettings(); | 201 | mView->readSettings(); |
202 | bool newFile = false; | 202 | bool newFile = false; |
203 | if( !QFile::exists( defaultFileName() ) ) { | 203 | if( !QFile::exists( defaultFileName() ) ) { |
204 | QFileInfo finfo ( defaultFileName() ); | 204 | QFileInfo finfo ( defaultFileName() ); |
205 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 205 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
206 | qDebug("oldfile %s ", oldFile.latin1()); | 206 | qDebug("oldfile %s ", oldFile.latin1()); |
207 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 207 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
208 | finfo.setFile( oldFile ); | 208 | finfo.setFile( oldFile ); |
209 | if (finfo.exists() ) { | 209 | if (finfo.exists() ) { |
210 | KMessageBox::information( this, message); | 210 | KMessageBox::information( this, message); |
211 | mView->openCalendar( oldFile ); | 211 | mView->openCalendar( oldFile ); |
212 | qApp->processEvents(); | 212 | qApp->processEvents(); |
213 | } else { | 213 | } else { |
214 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 214 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
215 | finfo.setFile( oldFile ); | 215 | finfo.setFile( oldFile ); |
216 | if (finfo.exists() ) { | 216 | if (finfo.exists() ) { |
217 | KMessageBox::information( this, message); | 217 | KMessageBox::information( this, message); |
218 | mView->openCalendar( oldFile ); | 218 | mView->openCalendar( oldFile ); |
219 | qApp->processEvents(); | 219 | qApp->processEvents(); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | mView->saveCalendar( defaultFileName() ); | 222 | mView->saveCalendar( defaultFileName() ); |
223 | newFile = true; | 223 | newFile = true; |
224 | } | 224 | } |
225 | 225 | ||
226 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 226 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
227 | mView->openCalendar( defaultFileName() ); | 227 | mView->openCalendar( defaultFileName() ); |
228 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 228 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
229 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 229 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
230 | 230 | ||
231 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 231 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
232 | KOPrefs::instance()->setCategoryDefaults(); | 232 | KOPrefs::instance()->setCategoryDefaults(); |
233 | int count = mView->addCategories(); | 233 | int count = mView->addCategories(); |
234 | } | 234 | } |
235 | processIncidenceSelection( 0 ); | 235 | processIncidenceSelection( 0 ); |
236 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 236 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
237 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 237 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
238 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 238 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
239 | SLOT( slotModifiedChanged( bool ) ) ); | 239 | SLOT( slotModifiedChanged( bool ) ) ); |
240 | 240 | ||
241 | 241 | ||
242 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 242 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
243 | SLOT( disableBR(bool) ) ); | 243 | SLOT( disableBR(bool) ) ); |
244 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 244 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
245 | mView->setModified( false ); | 245 | mView->setModified( false ); |
246 | mBlockAtStartup = false; | 246 | mBlockAtStartup = false; |
247 | mView->setModified( false ); | 247 | mView->setModified( false ); |
248 | setCentralWidget( mView ); | 248 | setCentralWidget( mView ); |
249 | globalFlagBlockStartup = 0; | 249 | globalFlagBlockStartup = 0; |
250 | mView->show(); | 250 | mView->show(); |
251 | delete splash; | 251 | delete splash; |
252 | if ( newFile ) | 252 | if ( newFile ) |
253 | mView->updateConfig(); | 253 | mView->updateConfig(); |
254 | // qApp->processEvents(); | 254 | // qApp->processEvents(); |
255 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 255 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
256 | //fillSyncMenu(); | 256 | //fillSyncMenu(); |
257 | 257 | ||
258 | 258 | ||
259 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 259 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
260 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 260 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
261 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 261 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
262 | mSyncManager->setDefaultFileName( defaultFileName()); | 262 | mSyncManager->setDefaultFileName( defaultFileName()); |
263 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 263 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
264 | mSyncManager->fillSyncMenu(); | 264 | mSyncManager->fillSyncMenu(); |
265 | 265 | ||
266 | 266 | ||
267 | 267 | ||
268 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 268 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
269 | if ( showWarning ) { | 269 | if ( showWarning ) { |
270 | KMessageBox::information( this, | 270 | KMessageBox::information( this, |
271 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 271 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
272 | qApp->processEvents(); | 272 | qApp->processEvents(); |
273 | mView->dialogManager()->showSyncOptions(); | 273 | mView->dialogManager()->showSyncOptions(); |
274 | } | 274 | } |
275 | 275 | ||
276 | //US listen for result adressed from Ka/Pi | 276 | //US listen for result adressed from Ka/Pi |
277 | #ifndef DESKTOP_VERSION | 277 | #ifndef DESKTOP_VERSION |
278 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 278 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
279 | #endif | 279 | #endif |
280 | #ifndef DESKTOP_VERSION | 280 | #ifndef DESKTOP_VERSION |
281 | infrared = 0; | 281 | infrared = 0; |
282 | #endif | 282 | #endif |
283 | 283 | ||
284 | mBRdisabled = false; | 284 | mBRdisabled = false; |
285 | //toggleBeamReceive(); | 285 | //toggleBeamReceive(); |
286 | } | 286 | } |
287 | MainWindow::~MainWindow() | 287 | MainWindow::~MainWindow() |
288 | { | 288 | { |
289 | //qDebug("MainWindow::~MainWindow() "); | 289 | //qDebug("MainWindow::~MainWindow() "); |
290 | //save toolbar location | 290 | //save toolbar location |
291 | delete mCalendar; | 291 | delete mCalendar; |
292 | delete mSyncManager; | 292 | delete mSyncManager; |
293 | #ifndef DESKTOP_VERSION | 293 | #ifndef DESKTOP_VERSION |
294 | if ( infrared ) | 294 | if ( infrared ) |
295 | delete infrared; | 295 | delete infrared; |
296 | #endif | 296 | #endif |
297 | 297 | ||
298 | 298 | ||
299 | } | 299 | } |
300 | 300 | ||
301 | void MainWindow::disableBR(bool b) | 301 | void MainWindow::disableBR(bool b) |
302 | { | 302 | { |
303 | #ifndef DESKTOP_VERSION | 303 | #ifndef DESKTOP_VERSION |
304 | if ( b ) { | 304 | if ( b ) { |
305 | if ( infrared ) { | 305 | if ( infrared ) { |
306 | toggleBeamReceive(); | 306 | toggleBeamReceive(); |
307 | mBRdisabled = true; | 307 | mBRdisabled = true; |
308 | } | 308 | } |
309 | mBRdisabled = true; | 309 | mBRdisabled = true; |
310 | } else { | 310 | } else { |
311 | if ( mBRdisabled ) { | 311 | if ( mBRdisabled ) { |
312 | mBRdisabled = false; | 312 | mBRdisabled = false; |
313 | //makes no sense,because other cal ap is probably running | 313 | //makes no sense,because other cal ap is probably running |
314 | // toggleBeamReceive(); | 314 | // toggleBeamReceive(); |
315 | } | 315 | } |
316 | } | 316 | } |
317 | #endif | 317 | #endif |
318 | 318 | ||
319 | } | 319 | } |
320 | bool MainWindow::beamReceiveEnabled() | 320 | bool MainWindow::beamReceiveEnabled() |
321 | { | 321 | { |
322 | #ifndef DESKTOP_VERSION | 322 | #ifndef DESKTOP_VERSION |
323 | return ( infrared != 0 ); | 323 | return ( infrared != 0 ); |
324 | #endif | 324 | #endif |
325 | return false; | 325 | return false; |
326 | } | 326 | } |
327 | 327 | ||
328 | void MainWindow::toggleBeamReceive() | 328 | void MainWindow::toggleBeamReceive() |
329 | { | 329 | { |
330 | if ( mBRdisabled ) | 330 | if ( mBRdisabled ) |
331 | return; | 331 | return; |
332 | #ifndef DESKTOP_VERSION | 332 | #ifndef DESKTOP_VERSION |
333 | if ( infrared ) { | 333 | if ( infrared ) { |
334 | qDebug("disable BeamReceive "); | 334 | qDebug("disable BeamReceive "); |
335 | delete infrared; | 335 | delete infrared; |
336 | infrared = 0; | 336 | infrared = 0; |
337 | brAction->setOn(false); | 337 | brAction->setOn(false); |
338 | return; | 338 | return; |
339 | } | 339 | } |
340 | qDebug("enable BeamReceive "); | 340 | qDebug("enable BeamReceive "); |
341 | brAction->setOn(true); | 341 | brAction->setOn(true); |
342 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 342 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
343 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 343 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
344 | #endif | 344 | #endif |
345 | } | 345 | } |
346 | void MainWindow::showMaximized () | 346 | void MainWindow::showMaximized () |
347 | { | 347 | { |
348 | #ifndef DESKTOP_VERSION | 348 | #ifndef DESKTOP_VERSION |
349 | if ( ! globalFlagBlockStartup ) | 349 | if ( ! globalFlagBlockStartup ) |
350 | if ( mClosed ) | 350 | if ( mClosed ) |
351 | mView->goToday(); | 351 | mView->goToday(); |
352 | #endif | 352 | #endif |
353 | QWidget::showMaximized () ; | 353 | QWidget::showMaximized () ; |
354 | mClosed = false; | 354 | mClosed = false; |
355 | } | 355 | } |
356 | void MainWindow::closeEvent( QCloseEvent* ce ) | 356 | void MainWindow::closeEvent( QCloseEvent* ce ) |
357 | { | 357 | { |
358 | 358 | ||
359 | 359 | ||
360 | 360 | ||
361 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 361 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
362 | saveOnClose(); | 362 | saveOnClose(); |
363 | mClosed = true; | 363 | mClosed = true; |
364 | ce->accept(); | 364 | ce->accept(); |
365 | return; | 365 | return; |
366 | 366 | ||
367 | } | 367 | } |
368 | 368 | ||
369 | switch( QMessageBox::information( this, "KO/Pi", | 369 | switch( QMessageBox::information( this, "KO/Pi", |
370 | i18n("Do you really want\nto close KO/Pi?"), | 370 | i18n("Do you really want\nto close KO/Pi?"), |
371 | i18n("Close"), i18n("No"), | 371 | i18n("Close"), i18n("No"), |
372 | 0, 0 ) ) { | 372 | 0, 0 ) ) { |
373 | case 0: | 373 | case 0: |
374 | saveOnClose(); | 374 | saveOnClose(); |
375 | mClosed = true; | 375 | mClosed = true; |
376 | ce->accept(); | 376 | ce->accept(); |
377 | break; | 377 | break; |
378 | case 1: | 378 | case 1: |
379 | ce->ignore(); | 379 | ce->ignore(); |
380 | break; | 380 | break; |
381 | case 2: | 381 | case 2: |
382 | 382 | ||
383 | default: | 383 | default: |
384 | break; | 384 | break; |
385 | } | 385 | } |
386 | 386 | ||
387 | 387 | ||
388 | } | 388 | } |
389 | 389 | ||
390 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 390 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
391 | { | 391 | { |
392 | QDataStream stream( data, IO_ReadOnly ); | 392 | QDataStream stream( data, IO_ReadOnly ); |
393 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 393 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
394 | //QString datamess; | 394 | //QString datamess; |
395 | //qDebug("message "); | 395 | //qDebug("message "); |
396 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 396 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
397 | 397 | ||
398 | if ( cmsg == "setDocument(QString)" ) { | 398 | if ( cmsg == "setDocument(QString)" ) { |
399 | QDataStream stream( data, IO_ReadOnly ); | 399 | QDataStream stream( data, IO_ReadOnly ); |
400 | QString fileName; | 400 | QString fileName; |
401 | stream >> fileName; | 401 | stream >> fileName; |
402 | //qDebug("filename %s ", fileName.latin1()); | 402 | //qDebug("filename %s ", fileName.latin1()); |
403 | showMaximized(); | 403 | showMaximized(); |
404 | raise(); | 404 | raise(); |
405 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 405 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
406 | mSyncManager->slotSyncMenu( 1002 ); | 406 | mSyncManager->slotSyncMenu( 1002 ); |
407 | return; | 407 | return; |
408 | } | 408 | } |
409 | 409 | ||
410 | if ( cmsg == "-writeFile" ) { | 410 | if ( cmsg == "-writeFile" ) { |
411 | // I made from the "-writeFile" an "-writeAlarm" | 411 | // I made from the "-writeFile" an "-writeAlarm" |
412 | mView->viewManager()->showWhatsNextView(); | 412 | mView->viewManager()->showWhatsNextView(); |
413 | mCalendar->checkAlarmForIncidence( 0, true); | 413 | mCalendar->checkAlarmForIncidence( 0, true); |
414 | showMaximized(); | 414 | showMaximized(); |
415 | raise(); | 415 | raise(); |
416 | return; | 416 | return; |
417 | 417 | ||
418 | } | 418 | } |
419 | if ( cmsg == "-writeFileSilent" ) { | 419 | if ( cmsg == "-writeFileSilent" ) { |
420 | // I made from the "-writeFile" an "-writeAlarm" | 420 | // I made from the "-writeFile" an "-writeAlarm" |
421 | // mView->viewManager()->showWhatsNextView(); | 421 | // mView->viewManager()->showWhatsNextView(); |
422 | mCalendar->checkAlarmForIncidence( 0, true); | 422 | mCalendar->checkAlarmForIncidence( 0, true); |
423 | //showMaximized(); | 423 | //showMaximized(); |
424 | //raise(); | 424 | //raise(); |
425 | hide(); | 425 | hide(); |
426 | return; | 426 | return; |
427 | } | 427 | } |
428 | if ( cmsg == "-newCountdown" ) { | 428 | if ( cmsg == "-newCountdown" ) { |
429 | qDebug("newCountdown "); | 429 | qDebug("newCountdown "); |
430 | 430 | ||
431 | } | 431 | } |
432 | QString msg ; | 432 | QString msg ; |
433 | QString allmsg = cmsg; | 433 | QString allmsg = cmsg; |
434 | while ( allmsg.length() > 0 ) { | 434 | while ( allmsg.length() > 0 ) { |
435 | int nextC = allmsg.find( "-", 1 ); | 435 | int nextC = allmsg.find( "-", 1 ); |
436 | if ( nextC == -1 ) { | 436 | if ( nextC == -1 ) { |
437 | msg = allmsg; | 437 | msg = allmsg; |
438 | allmsg = ""; | 438 | allmsg = ""; |
439 | } else{ | 439 | } else{ |
440 | msg = allmsg.left( nextC ); | 440 | msg = allmsg.left( nextC ); |
441 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 441 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
442 | } | 442 | } |
443 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 443 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
444 | if ( msg == "-newEvent" ) { | 444 | if ( msg == "-newEvent" ) { |
445 | mView->newEvent(); | 445 | mView->newEvent(); |
446 | } | 446 | } |
447 | if ( msg == "-newTodo" ) { | 447 | if ( msg == "-newTodo" ) { |
448 | mView->newTodo(); | 448 | mView->newTodo(); |
449 | 449 | ||
450 | } | 450 | } |
451 | if ( msg == "-showWN" ) { | 451 | if ( msg == "-showWN" ) { |
452 | mView->viewManager()->showWhatsNextView(); | 452 | mView->viewManager()->showWhatsNextView(); |
453 | } | 453 | } |
454 | if ( msg == "-showTodo" ) { | 454 | if ( msg == "-showTodo" ) { |
455 | mView->viewManager()->showTodoView(); | 455 | mView->viewManager()->showTodoView(); |
456 | } | 456 | } |
457 | if ( msg == "-showList" ) { | 457 | if ( msg == "-showList" ) { |
458 | mView->viewManager()->showListView(); | 458 | mView->viewManager()->showListView(); |
459 | } | 459 | } |
460 | else if ( msg == "-showDay" ) { | 460 | else if ( msg == "-showDay" ) { |
461 | mView->viewManager()->showDayView(); | 461 | mView->viewManager()->showDayView(); |
462 | } | 462 | } |
463 | else if ( msg == "-showWWeek" ) { | 463 | else if ( msg == "-showWWeek" ) { |
464 | mView->viewManager()->showWorkWeekView(); | 464 | mView->viewManager()->showWorkWeekView(); |
465 | } | 465 | } |
466 | else if ( msg == "-ringSync" ) { | 466 | else if ( msg == "-ringSync" ) { |
467 | mSyncManager->multiSync( false ); | 467 | mSyncManager->multiSync( false ); |
468 | } | 468 | } |
469 | else if ( msg == "-showWeek" ) { | 469 | else if ( msg == "-showWeek" ) { |
470 | mView->viewManager()->showWeekView(); | 470 | mView->viewManager()->showWeekView(); |
471 | } | 471 | } |
472 | else if ( msg == "-showTodo" ) { | 472 | else if ( msg == "-showTodo" ) { |
473 | mView->viewManager()->showTodoView(); | 473 | mView->viewManager()->showTodoView(); |
474 | } | 474 | } |
475 | else if ( msg == "-showJournal" ) { | 475 | else if ( msg == "-showJournal" ) { |
476 | mView->dateNavigator()->selectDates( 1 ); | 476 | mView->dateNavigator()->selectDates( 1 ); |
477 | mView->dateNavigator()->selectToday(); | 477 | mView->dateNavigator()->selectToday(); |
478 | mView->viewManager()->showJournalView(); | 478 | mView->viewManager()->showJournalView(); |
479 | } | 479 | } |
480 | else if ( msg == "-showKO" ) { | 480 | else if ( msg == "-showKO" ) { |
481 | mView->viewManager()->showNextXView(); | 481 | mView->viewManager()->showNextXView(); |
482 | } | 482 | } |
483 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 483 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
484 | mView->viewManager()->showWhatsNextView(); | 484 | mView->viewManager()->showWhatsNextView(); |
485 | } | 485 | } |
486 | else if ( msg == "-showNextXView" ) { | 486 | else if ( msg == "-showNextXView" ) { |
487 | mView->viewManager()->showNextXView(); | 487 | mView->viewManager()->showNextXView(); |
488 | } | 488 | } |
489 | 489 | ||
490 | 490 | ||
491 | } | 491 | } |
492 | 492 | ||
493 | showMaximized(); | 493 | showMaximized(); |
494 | raise(); | 494 | raise(); |
495 | } | 495 | } |
496 | 496 | ||
497 | QPixmap MainWindow::loadPixmap( QString name ) | 497 | QPixmap MainWindow::loadPixmap( QString name ) |
498 | { | 498 | { |
499 | return SmallIcon( name ); | 499 | return SmallIcon( name ); |
500 | 500 | ||
501 | } | 501 | } |
502 | void MainWindow::initActions() | 502 | void MainWindow::initActions() |
503 | { | 503 | { |
504 | //KOPrefs::instance()->mShowFullMenu | 504 | //KOPrefs::instance()->mShowFullMenu |
505 | iconToolBar->clear(); | 505 | iconToolBar->clear(); |
506 | KOPrefs *p = KOPrefs::instance(); | 506 | KOPrefs *p = KOPrefs::instance(); |
507 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 507 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
508 | 508 | ||
509 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 509 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
510 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 510 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
511 | QPopupMenu *importMenu = new QPopupMenu( this ); | 511 | QPopupMenu *importMenu = new QPopupMenu( this ); |
512 | selectFilterMenu = new QPopupMenu( this ); | 512 | selectFilterMenu = new QPopupMenu( this ); |
513 | selectFilterMenu->setCheckable( true ); | 513 | selectFilterMenu->setCheckable( true ); |
514 | syncMenu = new QPopupMenu( this ); | 514 | syncMenu = new QPopupMenu( this ); |
515 | configureAgendaMenu = new QPopupMenu( this ); | 515 | configureAgendaMenu = new QPopupMenu( this ); |
516 | configureToolBarMenu = new QPopupMenu( this ); | 516 | configureToolBarMenu = new QPopupMenu( this ); |
517 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 517 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
518 | if ( KOPrefs::instance()->mShowFullMenu ) { | 518 | if ( KOPrefs::instance()->mShowFullMenu ) { |
519 | QMenuBar *menuBar1; | 519 | QMenuBar *menuBar1; |
520 | menuBar1 = menuBar(); | 520 | menuBar1 = menuBar(); |
521 | menuBar1->insertItem( i18n("File"), importMenu ); | 521 | menuBar1->insertItem( i18n("File"), importMenu ); |
522 | menuBar1->insertItem( i18n("View"), viewMenu ); | 522 | menuBar1->insertItem( i18n("View"), viewMenu ); |
523 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 523 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
524 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 524 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
525 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 525 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
526 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 526 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
527 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 527 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
528 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 528 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
529 | } else { | 529 | } else { |
530 | QPEMenuBar *menuBar1; | 530 | QPEMenuBar *menuBar1; |
531 | menuBar1 = new QPEMenuBar( iconToolBar ); | 531 | menuBar1 = new QPEMenuBar( iconToolBar ); |
532 | QPopupMenu *menuBar = new QPopupMenu( this ); | 532 | QPopupMenu *menuBar = new QPopupMenu( this ); |
533 | menuBar1->insertItem( i18n("ME"), menuBar); | 533 | menuBar1->insertItem( i18n("ME"), menuBar); |
534 | menuBar->insertItem( i18n("File"), importMenu ); | 534 | menuBar->insertItem( i18n("File"), importMenu ); |
535 | menuBar->insertItem( i18n("View"), viewMenu ); | 535 | menuBar->insertItem( i18n("View"), viewMenu ); |
536 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 536 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
537 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 537 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
538 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 538 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
539 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 539 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
540 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 540 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
541 | menuBar->insertItem( i18n("Help"), helpMenu ); | 541 | menuBar->insertItem( i18n("Help"), helpMenu ); |
542 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 542 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
543 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 543 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
544 | } | 544 | } |
545 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 545 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
546 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); | 546 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); |
547 | 547 | ||
548 | // ****************** | 548 | // ****************** |
549 | QAction *action; | 549 | QAction *action; |
550 | QIconSet icon; | 550 | QIconSet icon; |
551 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 551 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
552 | configureToolBarMenu->setCheckable( true ); | 552 | configureToolBarMenu->setCheckable( true ); |
553 | 553 | ||
554 | QString pathString = ""; | 554 | QString pathString = ""; |
555 | if ( !p->mToolBarMiniIcons ) { | 555 | if ( !p->mToolBarMiniIcons ) { |
556 | if ( QApplication::desktop()->width() < 480 ) | 556 | if ( QApplication::desktop()->width() < 480 ) |
557 | pathString += "icons16/"; | 557 | pathString += "icons16/"; |
558 | } else | 558 | } else |
559 | pathString += "iconsmini/"; | 559 | pathString += "iconsmini/"; |
560 | configureAgendaMenu->setCheckable( true ); | 560 | configureAgendaMenu->setCheckable( true ); |
561 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); | 561 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); |
562 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); | 562 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); |
563 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); | 563 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); |
564 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); | 564 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); |
565 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); | 565 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); |
566 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); | 566 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); |
567 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); | 567 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); |
568 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); | 568 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); |
569 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 569 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
570 | 570 | ||
571 | icon = loadPixmap( pathString + "configure" ); | 571 | icon = loadPixmap( pathString + "configure" ); |
572 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 572 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
573 | action->addTo( actionMenu ); | 573 | action->addTo( actionMenu ); |
574 | connect( action, SIGNAL( activated() ), | 574 | connect( action, SIGNAL( activated() ), |
575 | mView, SLOT( edit_options() ) ); | 575 | mView, SLOT( edit_options() ) ); |
576 | actionMenu->insertSeparator(); | 576 | actionMenu->insertSeparator(); |
577 | 577 | ||
578 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 578 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
579 | action->addTo( actionMenu ); | 579 | action->addTo( actionMenu ); |
580 | connect( action, SIGNAL( activated() ), | 580 | connect( action, SIGNAL( activated() ), |
581 | mView, SLOT( undo_delete() ) ); | 581 | mView, SLOT( undo_delete() ) ); |
582 | actionMenu->insertSeparator(); | 582 | actionMenu->insertSeparator(); |
583 | 583 | ||
584 | icon = loadPixmap( pathString + "newevent" ); | 584 | icon = loadPixmap( pathString + "newevent" ); |
585 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 585 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
586 | configureToolBarMenu->insertSeparator(); | 586 | configureToolBarMenu->insertSeparator(); |
587 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 587 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
588 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 588 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
589 | ne_action->addTo( actionMenu ); | 589 | ne_action->addTo( actionMenu ); |
590 | connect( ne_action, SIGNAL( activated() ), | 590 | connect( ne_action, SIGNAL( activated() ), |
591 | mView, SLOT( newEvent() ) ); | 591 | mView, SLOT( newEvent() ) ); |
592 | icon = loadPixmap( pathString + "newtodo" ); | 592 | icon = loadPixmap( pathString + "newtodo" ); |
593 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 593 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
594 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 594 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
595 | nt_action->addTo( actionMenu ); | 595 | nt_action->addTo( actionMenu ); |
596 | connect( nt_action, SIGNAL( activated() ), | 596 | connect( nt_action, SIGNAL( activated() ), |
597 | mView, SLOT( newTodo() ) ); | 597 | mView, SLOT( newTodo() ) ); |
598 | icon = loadPixmap( pathString + "navi" ); | 598 | icon = loadPixmap( pathString + "navi" ); |
599 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 599 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
600 | action->addTo( viewMenu ); | 600 | action->addTo( viewMenu ); |
601 | connect( action, SIGNAL( activated() ), | 601 | connect( action, SIGNAL( activated() ), |
602 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 602 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
603 | icon = loadPixmap( pathString + "filter" ); | 603 | icon = loadPixmap( pathString + "filter" ); |
604 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 604 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
605 | action->addTo( viewMenu ); | 605 | action->addTo( viewMenu ); |
606 | connect( action, SIGNAL( activated() ), | 606 | connect( action, SIGNAL( activated() ), |
607 | mView, SLOT( toggleFilter() ) ); | 607 | mView, SLOT( toggleFilter() ) ); |
608 | action = new QAction( i18n("Toggle Allday"), i18n("Toggle Allday"), 0, this ); | 608 | action = new QAction( i18n("Toggle Allday"), i18n("Toggle Allday"), 0, this ); |
609 | action->addTo( viewMenu ); | 609 | action->addTo( viewMenu ); |
610 | connect( action, SIGNAL( activated() ), | 610 | connect( action, SIGNAL( activated() ), |
611 | mView, SLOT( toggleAllDaySize() ) ); | 611 | mView, SLOT( toggleAllDaySize() ) ); |
612 | 612 | ||
613 | viewMenu->insertSeparator(); | 613 | viewMenu->insertSeparator(); |
614 | icon = loadPixmap( pathString + "picker" ); | 614 | icon = loadPixmap( pathString + "picker" ); |
615 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 615 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
616 | action->addTo( viewMenu ); | 616 | action->addTo( viewMenu ); |
617 | connect( action, SIGNAL( activated() ), | 617 | connect( action, SIGNAL( activated() ), |
618 | mView, SLOT( showDatePicker() ) ); | 618 | mView, SLOT( showDatePicker() ) ); |
619 | action->addTo( iconToolBar ); | 619 | action->addTo( iconToolBar ); |
620 | viewMenu->insertSeparator(); | 620 | viewMenu->insertSeparator(); |
621 | icon = loadPixmap( pathString + "list" ); | 621 | icon = loadPixmap( pathString + "list" ); |
622 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 622 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
623 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 623 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
624 | showlist_action->addTo( viewMenu ); | 624 | showlist_action->addTo( viewMenu ); |
625 | connect( showlist_action, SIGNAL( activated() ), | 625 | connect( showlist_action, SIGNAL( activated() ), |
626 | mView->viewManager(), SLOT( showListView() ) ); | 626 | mView->viewManager(), SLOT( showListView() ) ); |
627 | 627 | ||
628 | 628 | ||
629 | icon = loadPixmap( pathString + "day" ); | 629 | icon = loadPixmap( pathString + "day" ); |
630 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 630 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
631 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 631 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
632 | day1_action->addTo( viewMenu ); | 632 | day1_action->addTo( viewMenu ); |
633 | // action->addTo( toolBar ); | 633 | // action->addTo( toolBar ); |
634 | connect( day1_action, SIGNAL( activated() ), | 634 | connect( day1_action, SIGNAL( activated() ), |
635 | mView->viewManager(), SLOT( showDayView() ) ); | 635 | mView->viewManager(), SLOT( showDayView() ) ); |
636 | 636 | ||
637 | icon = loadPixmap( pathString + "workweek" ); | 637 | icon = loadPixmap( pathString + "workweek" ); |
638 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 638 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
639 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 639 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
640 | day5_action->addTo( viewMenu ); | 640 | day5_action->addTo( viewMenu ); |
641 | connect( day5_action, SIGNAL( activated() ), | 641 | connect( day5_action, SIGNAL( activated() ), |
642 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 642 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
643 | 643 | ||
644 | icon = loadPixmap( pathString + "week" ); | 644 | icon = loadPixmap( pathString + "week" ); |
645 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 645 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
646 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 646 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
647 | day7_action->addTo( viewMenu ); | 647 | day7_action->addTo( viewMenu ); |
648 | connect( day7_action, SIGNAL( activated() ), | 648 | connect( day7_action, SIGNAL( activated() ), |
649 | mView->viewManager(), SLOT( showWeekView() ) ); | 649 | mView->viewManager(), SLOT( showWeekView() ) ); |
650 | 650 | ||
651 | icon = loadPixmap( pathString + "month" ); | 651 | icon = loadPixmap( pathString + "month" ); |
652 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 652 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
653 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 653 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
654 | month_action->addTo( viewMenu ); | 654 | month_action->addTo( viewMenu ); |
655 | connect( month_action, SIGNAL( activated() ), | 655 | connect( month_action, SIGNAL( activated() ), |
656 | mView->viewManager(), SLOT( showMonthView() ) ); | 656 | mView->viewManager(), SLOT( showMonthView() ) ); |
657 | 657 | ||
658 | icon = loadPixmap( pathString + "todo" ); | 658 | icon = loadPixmap( pathString + "todo" ); |
659 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 659 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
660 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 660 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
661 | todoview_action->addTo( viewMenu ); | 661 | todoview_action->addTo( viewMenu ); |
662 | connect( todoview_action, SIGNAL( activated() ), | 662 | connect( todoview_action, SIGNAL( activated() ), |
663 | mView->viewManager(), SLOT( showTodoView() ) ); | 663 | mView->viewManager(), SLOT( showTodoView() ) ); |
664 | 664 | ||
665 | icon = loadPixmap( pathString + "journal" ); | 665 | icon = loadPixmap( pathString + "journal" ); |
666 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 666 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
667 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 667 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
668 | viewjournal_action->addTo( viewMenu ); | 668 | viewjournal_action->addTo( viewMenu ); |
669 | connect( viewjournal_action, SIGNAL( activated() ), | 669 | connect( viewjournal_action, SIGNAL( activated() ), |
670 | mView->viewManager(), SLOT( showJournalView() ) ); | 670 | mView->viewManager(), SLOT( showJournalView() ) ); |
671 | 671 | ||
672 | icon = loadPixmap( pathString + "xdays" ); | 672 | icon = loadPixmap( pathString + "xdays" ); |
673 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); | 673 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); |
674 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 674 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
675 | xdays_action->addTo( viewMenu ); | 675 | xdays_action->addTo( viewMenu ); |
676 | connect( xdays_action, SIGNAL( activated() ), | 676 | connect( xdays_action, SIGNAL( activated() ), |
677 | mView->viewManager(), SLOT( showNextXView() ) ); | 677 | mView->viewManager(), SLOT( showNextXView() ) ); |
678 | 678 | ||
679 | icon = loadPixmap( pathString + "whatsnext" ); | 679 | icon = loadPixmap( pathString + "whatsnext" ); |
680 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); | 680 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); |
681 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 681 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
682 | whatsnext_action->addTo( viewMenu ); | 682 | whatsnext_action->addTo( viewMenu ); |
683 | connect( whatsnext_action, SIGNAL( activated() ), | 683 | connect( whatsnext_action, SIGNAL( activated() ), |
684 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 684 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
685 | 685 | ||
686 | #if 0 | 686 | #if 0 |
687 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 687 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
688 | action->addTo( viewMenu ); | 688 | action->addTo( viewMenu ); |
689 | connect( action, SIGNAL( activated() ), | 689 | connect( action, SIGNAL( activated() ), |
690 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 690 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
691 | #endif | 691 | #endif |
692 | 692 | ||
693 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 693 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
694 | this ); | 694 | this ); |
695 | mNewSubTodoAction->addTo( actionMenu ); | 695 | mNewSubTodoAction->addTo( actionMenu ); |
696 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 696 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
697 | mView, SLOT( newSubTodo() ) ); | 697 | mView, SLOT( newSubTodo() ) ); |
698 | 698 | ||
699 | actionMenu->insertSeparator(); | 699 | actionMenu->insertSeparator(); |
700 | 700 | ||
701 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 701 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
702 | mShowAction->addTo( actionMenu ); | 702 | mShowAction->addTo( actionMenu ); |
703 | connect( mShowAction, SIGNAL( activated() ), | 703 | connect( mShowAction, SIGNAL( activated() ), |
704 | mView, SLOT( showIncidence() ) ); | 704 | mView, SLOT( showIncidence() ) ); |
705 | 705 | ||
706 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 706 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
707 | mEditAction->addTo( actionMenu ); | 707 | mEditAction->addTo( actionMenu ); |
708 | connect( mEditAction, SIGNAL( activated() ), | 708 | connect( mEditAction, SIGNAL( activated() ), |
709 | mView, SLOT( editIncidence() ) ); | 709 | mView, SLOT( editIncidence() ) ); |
710 | 710 | ||
711 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 711 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
712 | mDeleteAction->addTo( actionMenu ); | 712 | mDeleteAction->addTo( actionMenu ); |
713 | connect( mDeleteAction, SIGNAL( activated() ), | 713 | connect( mDeleteAction, SIGNAL( activated() ), |
714 | mView, SLOT( deleteIncidence() ) ); | 714 | mView, SLOT( deleteIncidence() ) ); |
715 | 715 | ||
716 | 716 | ||
717 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 717 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
718 | mCloneAction->addTo( actionMenu ); | 718 | mCloneAction->addTo( actionMenu ); |
719 | connect( mCloneAction, SIGNAL( activated() ), | 719 | connect( mCloneAction, SIGNAL( activated() ), |
720 | mView, SLOT( cloneIncidence() ) ); | 720 | mView, SLOT( cloneIncidence() ) ); |
721 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 721 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
722 | mMoveAction->addTo( actionMenu ); | 722 | mMoveAction->addTo( actionMenu ); |
723 | connect( mMoveAction, SIGNAL( activated() ), | 723 | connect( mMoveAction, SIGNAL( activated() ), |
724 | mView, SLOT( moveIncidence() ) ); | 724 | mView, SLOT( moveIncidence() ) ); |
725 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 725 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
726 | mBeamAction->addTo( actionMenu ); | 726 | mBeamAction->addTo( actionMenu ); |
727 | connect( mBeamAction, SIGNAL( activated() ), | 727 | connect( mBeamAction, SIGNAL( activated() ), |
728 | mView, SLOT( beamIncidence() ) ); | 728 | mView, SLOT( beamIncidence() ) ); |
729 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 729 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
730 | mCancelAction->addTo( actionMenu ); | 730 | mCancelAction->addTo( actionMenu ); |
731 | connect( mCancelAction, SIGNAL( activated() ), | 731 | connect( mCancelAction, SIGNAL( activated() ), |
732 | mView, SLOT( toggleCancelIncidence() ) ); | 732 | mView, SLOT( toggleCancelIncidence() ) ); |
733 | 733 | ||
734 | actionMenu->insertSeparator(); | 734 | actionMenu->insertSeparator(); |
735 | 735 | ||
736 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 736 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
737 | this ); | 737 | this ); |
738 | action->addTo( actionMenu ); | 738 | action->addTo( actionMenu ); |
739 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 739 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
740 | 740 | ||
741 | icon = loadPixmap( pathString + "search" ); | 741 | icon = loadPixmap( pathString + "search" ); |
742 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 742 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
743 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 743 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
744 | search_action->addTo( actionMenu ); | 744 | search_action->addTo( actionMenu ); |
745 | connect( search_action, SIGNAL( activated() ), | 745 | connect( search_action, SIGNAL( activated() ), |
746 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 746 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
747 | 747 | ||
748 | icon = loadPixmap( pathString + "today" ); | 748 | icon = loadPixmap( pathString + "today" ); |
749 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 749 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
750 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 750 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
751 | today_action->addTo( actionMenu ); | 751 | today_action->addTo( actionMenu ); |
752 | connect( today_action, SIGNAL( activated() ), | 752 | connect( today_action, SIGNAL( activated() ), |
753 | mView, SLOT( goToday() ) ); | 753 | mView, SLOT( goToday() ) ); |
754 | 754 | ||
755 | if ( KOPrefs::instance()->mShowFullMenu ) { | 755 | if ( KOPrefs::instance()->mShowFullMenu ) { |
756 | actionMenu->insertSeparator(); | 756 | actionMenu->insertSeparator(); |
757 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 757 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
758 | 758 | ||
759 | } | 759 | } |
760 | // actionMenu->insertSeparator(); | 760 | // actionMenu->insertSeparator(); |
761 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 761 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
762 | this ); | 762 | this ); |
763 | action->addTo( importMenu ); | 763 | action->addTo( importMenu ); |
764 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 764 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
765 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 765 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
766 | this ); | 766 | this ); |
767 | action->addTo( importMenu ); | 767 | action->addTo( importMenu ); |
768 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 768 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
769 | importMenu->insertSeparator(); | 769 | importMenu->insertSeparator(); |
770 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 770 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
771 | this ); | 771 | this ); |
772 | action->addTo( importMenu ); | 772 | action->addTo( importMenu ); |
773 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 773 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
774 | #ifndef DESKTOP_VERSION | 774 | #ifndef DESKTOP_VERSION |
775 | importMenu->insertSeparator(); | 775 | importMenu->insertSeparator(); |
776 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 776 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
777 | this ); | 777 | this ); |
778 | action->addTo( importMenu ); | 778 | action->addTo( importMenu ); |
779 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 779 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
780 | #else | 780 | #else |
781 | #ifdef _WIN32_ | 781 | #ifdef _WIN32_ |
782 | importMenu->insertSeparator(); | 782 | importMenu->insertSeparator(); |
783 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 783 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
784 | this ); | 784 | this ); |
785 | action->addTo( importMenu ); | 785 | action->addTo( importMenu ); |
786 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 786 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
787 | #endif | 787 | #endif |
788 | #endif | 788 | #endif |
789 | 789 | ||
790 | importMenu->insertSeparator(); | 790 | importMenu->insertSeparator(); |
791 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 791 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
792 | this ); | 792 | this ); |
793 | action->addTo( importMenu ); | 793 | action->addTo( importMenu ); |
794 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 794 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
795 | 795 | ||
796 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 796 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
797 | this ); | 797 | this ); |
798 | action->addTo( importMenu ); | 798 | action->addTo( importMenu ); |
799 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 799 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
800 | 800 | ||
801 | importMenu->insertSeparator(); | 801 | importMenu->insertSeparator(); |
802 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 802 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
803 | this ); | 803 | this ); |
804 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 804 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
805 | 805 | ||
806 | 806 | ||
807 | //LR | 807 | //LR |
808 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 808 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
809 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 809 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
810 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 810 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
811 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 811 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
812 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); | 812 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); |
813 | 813 | ||
814 | importMenu->insertSeparator(); | 814 | importMenu->insertSeparator(); |
815 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 815 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
816 | this ); | 816 | this ); |
817 | action->addTo( importMenu ); | 817 | action->addTo( importMenu ); |
818 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 818 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
819 | #ifndef DESKTOP_VERSION | 819 | #ifndef DESKTOP_VERSION |
820 | importMenu->insertSeparator(); | 820 | importMenu->insertSeparator(); |
821 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 821 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
822 | this ); | 822 | this ); |
823 | brAction->addTo( importMenu ); | 823 | brAction->addTo( importMenu ); |
824 | brAction->setToggleAction (true ) ; | 824 | brAction->setToggleAction (true ) ; |
825 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 825 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
826 | 826 | ||
827 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 827 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
828 | this ); | 828 | this ); |
829 | action->addTo( importMenu ); | 829 | action->addTo( importMenu ); |
830 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 830 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
831 | 831 | ||
832 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 832 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
833 | this ); | 833 | this ); |
834 | action->addTo( importMenu ); | 834 | action->addTo( importMenu ); |
835 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 835 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
836 | #else | 836 | #else |
837 | importMenu->insertSeparator(); | 837 | importMenu->insertSeparator(); |
838 | icon = loadPixmap( pathString + "print" ); | 838 | icon = loadPixmap( pathString + "print" ); |
839 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 839 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
840 | action->addTo( importMenu ); | 840 | action->addTo( importMenu ); |
841 | connect( action, SIGNAL( activated() ), | 841 | connect( action, SIGNAL( activated() ), |
842 | this, SLOT( printCal() ) ); | 842 | this, SLOT( printCal() ) ); |
843 | 843 | ||
844 | icon = loadPixmap( pathString + "print" ); | 844 | icon = loadPixmap( pathString + "print" ); |
845 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 845 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
846 | action->addTo( importMenu ); | 846 | action->addTo( importMenu ); |
847 | connect( action, SIGNAL( activated() ), | 847 | connect( action, SIGNAL( activated() ), |
848 | this, SLOT( printSel() ) ); | 848 | this, SLOT( printSel() ) ); |
849 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | ||
850 | action->addTo( importMenu ); | ||
851 | connect( action, SIGNAL( activated() ), | ||
852 | mView->viewManager(), SIGNAL( printWNV() ) ); | ||
849 | #endif | 853 | #endif |
850 | importMenu->insertSeparator(); | 854 | importMenu->insertSeparator(); |
851 | action = new QAction( "beam all", i18n("Save"), 0, | 855 | action = new QAction( "beam all", i18n("Save"), 0, |
852 | this ); | 856 | this ); |
853 | action->addTo( importMenu ); | 857 | action->addTo( importMenu ); |
854 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 858 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
855 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 859 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
856 | this ); | 860 | this ); |
857 | action->addTo( importMenu ); | 861 | action->addTo( importMenu ); |
858 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 862 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
859 | 863 | ||
860 | //menuBar->insertItem( "Configure",configureMenu ); | 864 | //menuBar->insertItem( "Configure",configureMenu ); |
861 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 865 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
862 | icon = loadPixmap( "korganizer/korganizer" ); | 866 | icon = loadPixmap( "korganizer/korganizer" ); |
863 | 867 | ||
864 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 868 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
865 | action->addTo( helpMenu ); | 869 | action->addTo( helpMenu ); |
866 | connect( action, SIGNAL( activated() ), | 870 | connect( action, SIGNAL( activated() ), |
867 | SLOT( whatsNew() ) ); | 871 | SLOT( whatsNew() ) ); |
868 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 872 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
869 | action->addTo( helpMenu ); | 873 | action->addTo( helpMenu ); |
870 | connect( action, SIGNAL( activated() ), | 874 | connect( action, SIGNAL( activated() ), |
871 | SLOT( features() ) ); | 875 | SLOT( features() ) ); |
872 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 876 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
873 | action->addTo( helpMenu ); | 877 | action->addTo( helpMenu ); |
874 | connect( action, SIGNAL( activated() ), | 878 | connect( action, SIGNAL( activated() ), |
875 | SLOT( keyBindings() ) ); | 879 | SLOT( keyBindings() ) ); |
876 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 880 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
877 | action->addTo( helpMenu ); | 881 | action->addTo( helpMenu ); |
878 | connect( action, SIGNAL( activated() ), | 882 | connect( action, SIGNAL( activated() ), |
879 | SLOT( synchowto() ) ); | 883 | SLOT( synchowto() ) ); |
880 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 884 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
881 | action->addTo( helpMenu ); | 885 | action->addTo( helpMenu ); |
882 | connect( action, SIGNAL( activated() ), | 886 | connect( action, SIGNAL( activated() ), |
883 | SLOT( kdesynchowto() ) ); | 887 | SLOT( kdesynchowto() ) ); |
884 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 888 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
885 | action->addTo( helpMenu ); | 889 | action->addTo( helpMenu ); |
886 | connect( action, SIGNAL( activated() ), | 890 | connect( action, SIGNAL( activated() ), |
887 | SLOT( multisynchowto() ) ); | 891 | SLOT( multisynchowto() ) ); |
888 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 892 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
889 | action->addTo( helpMenu ); | 893 | action->addTo( helpMenu ); |
890 | connect( action, SIGNAL( activated() ), | 894 | connect( action, SIGNAL( activated() ), |
891 | SLOT( aboutAutoSaving() ) ); | 895 | SLOT( aboutAutoSaving() ) ); |
892 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 896 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
893 | action->addTo( helpMenu ); | 897 | action->addTo( helpMenu ); |
894 | connect( action, SIGNAL( activated() ), | 898 | connect( action, SIGNAL( activated() ), |
895 | SLOT( aboutKnownBugs() ) ); | 899 | SLOT( aboutKnownBugs() ) ); |
896 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 900 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
897 | action->addTo( helpMenu ); | 901 | action->addTo( helpMenu ); |
898 | connect( action, SIGNAL( activated() ), | 902 | connect( action, SIGNAL( activated() ), |
899 | SLOT( usertrans() ) ); | 903 | SLOT( usertrans() ) ); |
900 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 904 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
901 | action->addTo( helpMenu ); | 905 | action->addTo( helpMenu ); |
902 | connect( action, SIGNAL( activated() ), | 906 | connect( action, SIGNAL( activated() ), |
903 | SLOT( faq() ) ); | 907 | SLOT( faq() ) ); |
904 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 908 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
905 | action->addTo( helpMenu ); | 909 | action->addTo( helpMenu ); |
906 | connect( action, SIGNAL( activated() ), | 910 | connect( action, SIGNAL( activated() ), |
907 | SLOT( licence() ) ); | 911 | SLOT( licence() ) ); |
908 | action = new QAction( "about", i18n("About..."), 0, this ); | 912 | action = new QAction( "about", i18n("About..."), 0, this ); |
909 | action->addTo( helpMenu ); | 913 | action->addTo( helpMenu ); |
910 | connect( action, SIGNAL( activated() ), | 914 | connect( action, SIGNAL( activated() ), |
911 | SLOT( about() ) ); | 915 | SLOT( about() ) ); |
912 | //menuBar->insertSeparator(); | 916 | //menuBar->insertSeparator(); |
913 | 917 | ||
914 | // ****************************************************** | 918 | // ****************************************************** |
915 | // menubar icons | 919 | // menubar icons |
916 | 920 | ||
917 | 921 | ||
918 | iconToolBar->setHorizontalStretchable (true ); | 922 | iconToolBar->setHorizontalStretchable (true ); |
919 | //menuBar->insertItem( iconToolBar ); | 923 | //menuBar->insertItem( iconToolBar ); |
920 | //xdays_action | 924 | //xdays_action |
921 | if (p-> mShowIconNewEvent) | 925 | if (p-> mShowIconNewEvent) |
922 | ne_action->addTo( iconToolBar ); | 926 | ne_action->addTo( iconToolBar ); |
923 | if (p->mShowIconNewTodo ) | 927 | if (p->mShowIconNewTodo ) |
924 | nt_action->addTo( iconToolBar ); | 928 | nt_action->addTo( iconToolBar ); |
925 | if (p-> mShowIconSearch) | 929 | if (p-> mShowIconSearch) |
926 | search_action->addTo( iconToolBar ); | 930 | search_action->addTo( iconToolBar ); |
927 | if (p-> mShowIconNext) | 931 | if (p-> mShowIconNext) |
928 | whatsnext_action->addTo( iconToolBar ); | 932 | whatsnext_action->addTo( iconToolBar ); |
929 | if (p-> mShowIconNextDays) | 933 | if (p-> mShowIconNextDays) |
930 | xdays_action->addTo( iconToolBar ); | 934 | xdays_action->addTo( iconToolBar ); |
931 | if (p-> mShowIconList) | 935 | if (p-> mShowIconList) |
932 | showlist_action->addTo( iconToolBar ); | 936 | showlist_action->addTo( iconToolBar ); |
933 | if (p-> mShowIconDay1) | 937 | if (p-> mShowIconDay1) |
934 | day1_action->addTo( iconToolBar ); | 938 | day1_action->addTo( iconToolBar ); |
935 | if (p-> mShowIconDay5) | 939 | if (p-> mShowIconDay5) |
936 | day5_action->addTo( iconToolBar ); | 940 | day5_action->addTo( iconToolBar ); |
937 | if (p-> mShowIconDay7) | 941 | if (p-> mShowIconDay7) |
938 | day7_action->addTo( iconToolBar ); | 942 | day7_action->addTo( iconToolBar ); |
939 | if (p-> mShowIconMonth) | 943 | if (p-> mShowIconMonth) |
940 | month_action->addTo( iconToolBar ); | 944 | month_action->addTo( iconToolBar ); |
941 | if (p-> mShowIconTodoview) | 945 | if (p-> mShowIconTodoview) |
942 | todoview_action->addTo( iconToolBar ); | 946 | todoview_action->addTo( iconToolBar ); |
943 | if (p-> mShowIconJournal) | 947 | if (p-> mShowIconJournal) |
944 | viewjournal_action->addTo( iconToolBar ); | 948 | viewjournal_action->addTo( iconToolBar ); |
945 | icon = loadPixmap( pathString + "2leftarrowB" ); | 949 | icon = loadPixmap( pathString + "2leftarrowB" ); |
946 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 950 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
947 | if (p-> mShowIconBackFast) { | 951 | if (p-> mShowIconBackFast) { |
948 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 952 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
949 | connect( action, SIGNAL( activated() ), | 953 | connect( action, SIGNAL( activated() ), |
950 | mView, SLOT( goPreviousMonth() ) ); | 954 | mView, SLOT( goPreviousMonth() ) ); |
951 | action->addTo( iconToolBar ); | 955 | action->addTo( iconToolBar ); |
952 | } | 956 | } |
953 | icon = loadPixmap( pathString + "1leftarrowB" ); | 957 | icon = loadPixmap( pathString + "1leftarrowB" ); |
954 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 958 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
955 | if (p-> mShowIconBack) { | 959 | if (p-> mShowIconBack) { |
956 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 960 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
957 | connect( action, SIGNAL( activated() ), | 961 | connect( action, SIGNAL( activated() ), |
958 | mView, SLOT( goPrevious() ) ); | 962 | mView, SLOT( goPrevious() ) ); |
959 | action->addTo( iconToolBar ); | 963 | action->addTo( iconToolBar ); |
960 | } | 964 | } |
961 | if (p-> mShowIconToday) | 965 | if (p-> mShowIconToday) |
962 | today_action->addTo( iconToolBar ); | 966 | today_action->addTo( iconToolBar ); |
963 | icon = loadPixmap( pathString + "1rightarrowB" ); | 967 | icon = loadPixmap( pathString + "1rightarrowB" ); |
964 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 968 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
965 | if (p-> mShowIconForward) { | 969 | if (p-> mShowIconForward) { |
966 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 970 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
967 | connect( action, SIGNAL( activated() ), | 971 | connect( action, SIGNAL( activated() ), |
968 | mView, SLOT( goNext() ) ); | 972 | mView, SLOT( goNext() ) ); |
969 | action->addTo( iconToolBar ); | 973 | action->addTo( iconToolBar ); |
970 | } | 974 | } |
971 | icon = loadPixmap( pathString + "2rightarrowB" ); | 975 | icon = loadPixmap( pathString + "2rightarrowB" ); |
972 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 976 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
973 | if (p-> mShowIconForwardFast) { | 977 | if (p-> mShowIconForwardFast) { |
974 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 978 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
975 | connect( action, SIGNAL( activated() ), | 979 | connect( action, SIGNAL( activated() ), |
976 | mView, SLOT( goNextMonth() ) ); | 980 | mView, SLOT( goNextMonth() ) ); |
977 | action->addTo( iconToolBar ); | 981 | action->addTo( iconToolBar ); |
978 | } | 982 | } |
979 | 983 | ||
980 | 984 | ||
981 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 985 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
982 | 986 | ||
983 | if (p-> mShowIconNewEvent) | 987 | if (p-> mShowIconNewEvent) |
984 | configureToolBarMenu->setItemChecked( 10, true ); | 988 | configureToolBarMenu->setItemChecked( 10, true ); |
985 | if (p->mShowIconNewTodo ) | 989 | if (p->mShowIconNewTodo ) |
986 | configureToolBarMenu->setItemChecked( 20, true ); | 990 | configureToolBarMenu->setItemChecked( 20, true ); |
987 | if (p-> mShowIconSearch) | 991 | if (p-> mShowIconSearch) |
988 | configureToolBarMenu->setItemChecked( 120, true ); | 992 | configureToolBarMenu->setItemChecked( 120, true ); |
989 | if (p-> mShowIconList) | 993 | if (p-> mShowIconList) |
990 | configureToolBarMenu->setItemChecked( 30, true ); | 994 | configureToolBarMenu->setItemChecked( 30, true ); |
991 | if (p-> mShowIconDay1) | 995 | if (p-> mShowIconDay1) |
992 | configureToolBarMenu->setItemChecked( 40, true ); | 996 | configureToolBarMenu->setItemChecked( 40, true ); |
993 | if (p-> mShowIconDay5) | 997 | if (p-> mShowIconDay5) |
994 | configureToolBarMenu->setItemChecked( 50, true ); | 998 | configureToolBarMenu->setItemChecked( 50, true ); |
995 | if (p-> mShowIconDay7) | 999 | if (p-> mShowIconDay7) |
996 | configureToolBarMenu->setItemChecked( 60, true ); | 1000 | configureToolBarMenu->setItemChecked( 60, true ); |
997 | if (p-> mShowIconMonth) | 1001 | if (p-> mShowIconMonth) |
998 | configureToolBarMenu->setItemChecked( 70, true ); | 1002 | configureToolBarMenu->setItemChecked( 70, true ); |
999 | if (p-> mShowIconTodoview) | 1003 | if (p-> mShowIconTodoview) |
1000 | configureToolBarMenu->setItemChecked( 80, true ); | 1004 | configureToolBarMenu->setItemChecked( 80, true ); |
1001 | if (p-> mShowIconBackFast) | 1005 | if (p-> mShowIconBackFast) |
1002 | configureToolBarMenu->setItemChecked( 200, true ); | 1006 | configureToolBarMenu->setItemChecked( 200, true ); |
1003 | if (p-> mShowIconBack) | 1007 | if (p-> mShowIconBack) |
1004 | configureToolBarMenu->setItemChecked( 210, true ); | 1008 | configureToolBarMenu->setItemChecked( 210, true ); |
1005 | if (p-> mShowIconToday) | 1009 | if (p-> mShowIconToday) |
1006 | configureToolBarMenu->setItemChecked( 130, true ); | 1010 | configureToolBarMenu->setItemChecked( 130, true ); |
1007 | if (p-> mShowIconForward) | 1011 | if (p-> mShowIconForward) |
1008 | configureToolBarMenu->setItemChecked( 220, true ); | 1012 | configureToolBarMenu->setItemChecked( 220, true ); |
1009 | if (p-> mShowIconForwardFast) | 1013 | if (p-> mShowIconForwardFast) |
1010 | configureToolBarMenu->setItemChecked( 230, true ); | 1014 | configureToolBarMenu->setItemChecked( 230, true ); |
1011 | if (p-> mShowIconNextDays) | 1015 | if (p-> mShowIconNextDays) |
1012 | configureToolBarMenu->setItemChecked( 100, true ); | 1016 | configureToolBarMenu->setItemChecked( 100, true ); |
1013 | if (p-> mShowIconNext) | 1017 | if (p-> mShowIconNext) |
1014 | configureToolBarMenu->setItemChecked( 110, true ); | 1018 | configureToolBarMenu->setItemChecked( 110, true ); |
1015 | if (p-> mShowIconJournal) | 1019 | if (p-> mShowIconJournal) |
1016 | configureToolBarMenu->setItemChecked( 90, true ); | 1020 | configureToolBarMenu->setItemChecked( 90, true ); |
1017 | if (p-> mShowIconWhatsThis) | 1021 | if (p-> mShowIconWhatsThis) |
1018 | configureToolBarMenu->setItemChecked( 300, true ); | 1022 | configureToolBarMenu->setItemChecked( 300, true ); |
1019 | 1023 | ||
1020 | QLabel* dummy = new QLabel( iconToolBar ); | 1024 | QLabel* dummy = new QLabel( iconToolBar ); |
1021 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1025 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1022 | if (!p-> mShowIconStretch) | 1026 | if (!p-> mShowIconStretch) |
1023 | iconToolBar->setStretchableWidget ( dummy ) ; | 1027 | iconToolBar->setStretchableWidget ( dummy ) ; |
1024 | else | 1028 | else |
1025 | configureToolBarMenu->setItemChecked( 5, true ); | 1029 | configureToolBarMenu->setItemChecked( 5, true ); |
1026 | if (p-> mShowIconWhatsThis) | 1030 | if (p-> mShowIconWhatsThis) |
1027 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1031 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1028 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1032 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1029 | configureAgenda( p->mHourSize ); | 1033 | configureAgenda( p->mHourSize ); |
1030 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1034 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1031 | } | 1035 | } |
1032 | 1036 | ||
1033 | void MainWindow::exportToPhone( int mode ) | 1037 | void MainWindow::exportToPhone( int mode ) |
1034 | { | 1038 | { |
1035 | 1039 | ||
1036 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1040 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1037 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1041 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1038 | KOex2phonePrefs ex2phone; | 1042 | KOex2phonePrefs ex2phone; |
1039 | 1043 | ||
1040 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1044 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1041 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1045 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1042 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1046 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1043 | if ( mode == 1 ) | 1047 | if ( mode == 1 ) |
1044 | ex2phone.setCaption(i18n("Export complete calendar")); | 1048 | ex2phone.setCaption(i18n("Export complete calendar")); |
1045 | if ( mode == 2 ) | 1049 | if ( mode == 2 ) |
1046 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1050 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1047 | 1051 | ||
1048 | if ( !ex2phone.exec() ) { | 1052 | if ( !ex2phone.exec() ) { |
1049 | return; | 1053 | return; |
1050 | } | 1054 | } |
1051 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1055 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1052 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1056 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1053 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1057 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1054 | 1058 | ||
1055 | int inFuture = 0; | 1059 | int inFuture = 0; |
1056 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1060 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1057 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1061 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1058 | QPtrList<Incidence> delSel; | 1062 | QPtrList<Incidence> delSel; |
1059 | if ( mode == 1 ) | 1063 | if ( mode == 1 ) |
1060 | delSel = mCalendar->rawIncidences(); | 1064 | delSel = mCalendar->rawIncidences(); |
1061 | if ( mode == 2 ) | 1065 | if ( mode == 2 ) |
1062 | delSel = mCalendar->incidences(); | 1066 | delSel = mCalendar->incidences(); |
1063 | CalendarLocal* cal = new CalendarLocal(); | 1067 | CalendarLocal* cal = new CalendarLocal(); |
1064 | cal->setLocalTime(); | 1068 | cal->setLocalTime(); |
1065 | Incidence *incidence = delSel.first(); | 1069 | Incidence *incidence = delSel.first(); |
1066 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1070 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1067 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1071 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1068 | while ( incidence ) { | 1072 | while ( incidence ) { |
1069 | if ( incidence->type() != "Journal" ) { | 1073 | if ( incidence->type() != "Journal" ) { |
1070 | bool add = true; | 1074 | bool add = true; |
1071 | if ( inFuture ) { | 1075 | if ( inFuture ) { |
1072 | QDateTime dt; | 1076 | QDateTime dt; |
1073 | if ( incidence->type() == "Todo" ) { | 1077 | if ( incidence->type() == "Todo" ) { |
1074 | Todo * t = (Todo*)incidence; | 1078 | Todo * t = (Todo*)incidence; |
1075 | if ( t->hasDueDate() ) | 1079 | if ( t->hasDueDate() ) |
1076 | dt = t->dtDue(); | 1080 | dt = t->dtDue(); |
1077 | else | 1081 | else |
1078 | dt = cur.addSecs( 62 ); | 1082 | dt = cur.addSecs( 62 ); |
1079 | } | 1083 | } |
1080 | else { | 1084 | else { |
1081 | bool ok; | 1085 | bool ok; |
1082 | dt = incidence->getNextOccurence( cur, &ok ); | 1086 | dt = incidence->getNextOccurence( cur, &ok ); |
1083 | if ( !ok ) | 1087 | if ( !ok ) |
1084 | dt = cur.addSecs( -62 ); | 1088 | dt = cur.addSecs( -62 ); |
1085 | } | 1089 | } |
1086 | if ( dt < cur || dt > end ) { | 1090 | if ( dt < cur || dt > end ) { |
1087 | add = false; | 1091 | add = false; |
1088 | } | 1092 | } |
1089 | } | 1093 | } |
1090 | if ( add ) { | 1094 | if ( add ) { |
1091 | Incidence *in = incidence->clone(); | 1095 | Incidence *in = incidence->clone(); |
1092 | cal->addIncidence( in ); | 1096 | cal->addIncidence( in ); |
1093 | } | 1097 | } |
1094 | } | 1098 | } |
1095 | incidence = delSel.next(); | 1099 | incidence = delSel.next(); |
1096 | } | 1100 | } |
1097 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1101 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1098 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1102 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1099 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1103 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1100 | 1104 | ||
1101 | setCaption( i18n("Writing to phone...")); | 1105 | setCaption( i18n("Writing to phone...")); |
1102 | if ( PhoneFormat::writeToPhone( cal ) ) | 1106 | if ( PhoneFormat::writeToPhone( cal ) ) |
1103 | setCaption( i18n("Export to phone successful!")); | 1107 | setCaption( i18n("Export to phone successful!")); |
1104 | else | 1108 | else |
1105 | setCaption( i18n("Error exporting to phone!")); | 1109 | setCaption( i18n("Error exporting to phone!")); |
1106 | delete cal; | 1110 | delete cal; |
1107 | } | 1111 | } |
1108 | 1112 | ||
1109 | 1113 | ||
1110 | void MainWindow::setDefaultPreferences() | 1114 | void MainWindow::setDefaultPreferences() |
1111 | { | 1115 | { |
1112 | KOPrefs *p = KOPrefs::instance(); | 1116 | KOPrefs *p = KOPrefs::instance(); |
1113 | 1117 | ||
1114 | p->mCompactDialogs = true; | 1118 | p->mCompactDialogs = true; |
1115 | p->mConfirm = true; | 1119 | p->mConfirm = true; |
1116 | // p->mEnableQuickTodo = false; | 1120 | // p->mEnableQuickTodo = false; |
1117 | 1121 | ||
1118 | } | 1122 | } |
1119 | 1123 | ||
1120 | QString MainWindow::resourcePath() | 1124 | QString MainWindow::resourcePath() |
1121 | { | 1125 | { |
1122 | return KGlobal::iconLoader()->iconPath(); | 1126 | return KGlobal::iconLoader()->iconPath(); |
1123 | } | 1127 | } |
1124 | 1128 | ||
1125 | void MainWindow::displayText( QString text ,QString cap ) | 1129 | void MainWindow::displayText( QString text ,QString cap ) |
1126 | { | 1130 | { |
1127 | QDialog dia( this, "name", true ); ; | 1131 | QDialog dia( this, "name", true ); ; |
1128 | dia.setCaption( cap ); | 1132 | dia.setCaption( cap ); |
1129 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1133 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1130 | lay->setSpacing( 3 ); | 1134 | lay->setSpacing( 3 ); |
1131 | lay->setMargin( 3 ); | 1135 | lay->setMargin( 3 ); |
1132 | QTextBrowser tb ( &dia ); | 1136 | QTextBrowser tb ( &dia ); |
1133 | lay->addWidget( &tb ); | 1137 | lay->addWidget( &tb ); |
1134 | tb.setText( text ); | 1138 | tb.setText( text ); |
1135 | #ifdef DESKTOP_VERSION | 1139 | #ifdef DESKTOP_VERSION |
1136 | dia.resize( 640, 480); | 1140 | dia.resize( 640, 480); |
1137 | #else | 1141 | #else |
1138 | dia.showMaximized(); | 1142 | dia.showMaximized(); |
1139 | #endif | 1143 | #endif |
1140 | dia.exec(); | 1144 | dia.exec(); |
1141 | } | 1145 | } |
1142 | 1146 | ||
1143 | void MainWindow::features() | 1147 | void MainWindow::features() |
1144 | { | 1148 | { |
1145 | 1149 | ||
1146 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1150 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1147 | } | 1151 | } |
1148 | 1152 | ||
1149 | void MainWindow::usertrans() | 1153 | void MainWindow::usertrans() |
1150 | { | 1154 | { |
1151 | 1155 | ||
1152 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1156 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1153 | } | 1157 | } |
1154 | 1158 | ||
1155 | void MainWindow::kdesynchowto() | 1159 | void MainWindow::kdesynchowto() |
1156 | { | 1160 | { |
1157 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1161 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1158 | } | 1162 | } |
1159 | void MainWindow::multisynchowto() | 1163 | void MainWindow::multisynchowto() |
1160 | { | 1164 | { |
1161 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1165 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1162 | } | 1166 | } |
1163 | void MainWindow::synchowto() | 1167 | void MainWindow::synchowto() |
1164 | { | 1168 | { |
1165 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1169 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1166 | } | 1170 | } |
1167 | void MainWindow::faq() | 1171 | void MainWindow::faq() |
1168 | { | 1172 | { |
1169 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1173 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1170 | 1174 | ||
1171 | } | 1175 | } |
1172 | void MainWindow::whatsNew() | 1176 | void MainWindow::whatsNew() |
1173 | { | 1177 | { |
1174 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1178 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1175 | 1179 | ||
1176 | } | 1180 | } |
1177 | void MainWindow::licence() | 1181 | void MainWindow::licence() |
1178 | { | 1182 | { |
1179 | KApplication::showLicence(); | 1183 | KApplication::showLicence(); |
1180 | 1184 | ||
1181 | } | 1185 | } |
1182 | void MainWindow::about() | 1186 | void MainWindow::about() |
1183 | { | 1187 | { |
1184 | QString version; | 1188 | QString version; |
1185 | #include <../version> | 1189 | #include <../version> |
1186 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1190 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1187 | i18n("KOrganizer/Platform-independent\n") + | 1191 | i18n("KOrganizer/Platform-independent\n") + |
1188 | "(KO/Pi) " + version + " - " + | 1192 | "(KO/Pi) " + version + " - " + |
1189 | 1193 | ||
1190 | #ifdef DESKTOP_VERSION | 1194 | #ifdef DESKTOP_VERSION |
1191 | i18n("Desktop Edition\n") + | 1195 | i18n("Desktop Edition\n") + |
1192 | #else | 1196 | #else |
1193 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + | 1197 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + |
1194 | #endif | 1198 | #endif |
1195 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); | 1199 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); |
1196 | } | 1200 | } |
1197 | void MainWindow::keyBindings() | 1201 | void MainWindow::keyBindings() |
1198 | { | 1202 | { |
1199 | QString cap = i18n("KO/Pi Keys + Colors"); | 1203 | QString cap = i18n("KO/Pi Keys + Colors"); |
1200 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1204 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1201 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1205 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1202 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1206 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1203 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1207 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1204 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1208 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1205 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1209 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1206 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1210 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1207 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1211 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1208 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1212 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1209 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1213 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1210 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1214 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1211 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1215 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1212 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1216 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1213 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1217 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1214 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1218 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1215 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1219 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1216 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1220 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1217 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1221 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1218 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1222 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1219 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1223 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1220 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1224 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1221 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1225 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1222 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1226 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1223 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1227 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1224 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1228 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1225 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1229 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1226 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1230 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1227 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1231 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1228 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1232 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1229 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1233 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1230 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1234 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1231 | i18n("<p><h3>In list view:</h3></p>\n") + | 1235 | i18n("<p><h3>In list view:</h3></p>\n") + |
1232 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1236 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1233 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1237 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1234 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1238 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1235 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1239 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1236 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1240 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1237 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1241 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1238 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1242 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1239 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1243 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1240 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1244 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1241 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1245 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1242 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1246 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1243 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1247 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1244 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1248 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1245 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1249 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1246 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1250 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1247 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1251 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1248 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1252 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1249 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1253 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1250 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1254 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1251 | displayText( text, cap); | 1255 | displayText( text, cap); |
1252 | } | 1256 | } |
1253 | void MainWindow::aboutAutoSaving() | 1257 | void MainWindow::aboutAutoSaving() |
1254 | { | 1258 | { |
1255 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1259 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1256 | 1260 | ||
1257 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1261 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1258 | 1262 | ||
1259 | } | 1263 | } |
1260 | void MainWindow::aboutKnownBugs() | 1264 | void MainWindow::aboutKnownBugs() |
1261 | { | 1265 | { |
1262 | QMessageBox* msg; | 1266 | QMessageBox* msg; |
1263 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1267 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1264 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1268 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1265 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1269 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1266 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1270 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1267 | i18n("\nor report them in the bugtracker on\n") + | 1271 | i18n("\nor report them in the bugtracker on\n") + |
1268 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1272 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1269 | QMessageBox::NoIcon, | 1273 | QMessageBox::NoIcon, |
1270 | QMessageBox::Ok, | 1274 | QMessageBox::Ok, |
1271 | QMessageBox::NoButton, | 1275 | QMessageBox::NoButton, |
1272 | QMessageBox::NoButton); | 1276 | QMessageBox::NoButton); |
1273 | msg->exec(); | 1277 | msg->exec(); |
1274 | delete msg; | 1278 | delete msg; |
1275 | 1279 | ||
1276 | } | 1280 | } |
1277 | 1281 | ||
1278 | QString MainWindow::defaultFileName() | 1282 | QString MainWindow::defaultFileName() |
1279 | { | 1283 | { |
1280 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1284 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1281 | } | 1285 | } |
1282 | QString MainWindow::syncFileName() | 1286 | QString MainWindow::syncFileName() |
1283 | { | 1287 | { |
1284 | #ifdef DESKTOP_VERSION | 1288 | #ifdef DESKTOP_VERSION |
1285 | return locateLocal( "tmp", "synccalendar.ics" ); | 1289 | return locateLocal( "tmp", "synccalendar.ics" ); |
1286 | #else | 1290 | #else |
1287 | return QString( "/tmp/synccalendar.ics" ); | 1291 | return QString( "/tmp/synccalendar.ics" ); |
1288 | #endif | 1292 | #endif |
1289 | } | 1293 | } |
1290 | 1294 | ||
1291 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1295 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1292 | { | 1296 | { |
1293 | if ( !incidence ) { | 1297 | if ( !incidence ) { |
1294 | enableIncidenceActions( false ); | 1298 | enableIncidenceActions( false ); |
1295 | 1299 | ||
1296 | mNewSubTodoAction->setEnabled( false ); | 1300 | mNewSubTodoAction->setEnabled( false ); |
1297 | setCaptionToDates(); | 1301 | setCaptionToDates(); |
1298 | return; | 1302 | return; |
1299 | 1303 | ||
1300 | } | 1304 | } |
1301 | 1305 | ||
1302 | //KGlobal::locale()->formatDateTime(nextA, true); | 1306 | //KGlobal::locale()->formatDateTime(nextA, true); |
1303 | QString startString = ""; | 1307 | QString startString = ""; |
1304 | if ( incidence->type() != "Todo" ) { | 1308 | if ( incidence->type() != "Todo" ) { |
1305 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1309 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1306 | if ( incidence->doesFloat() ) { | 1310 | if ( incidence->doesFloat() ) { |
1307 | startString += ": "+incidence->dtStartDateStr( true ); | 1311 | startString += ": "+incidence->dtStartDateStr( true ); |
1308 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1312 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1309 | 1313 | ||
1310 | } else { | 1314 | } else { |
1311 | startString = ": "+incidence->dtStartStr(true); | 1315 | startString = ": "+incidence->dtStartStr(true); |
1312 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1316 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1313 | 1317 | ||
1314 | } | 1318 | } |
1315 | 1319 | ||
1316 | } else { | 1320 | } else { |
1317 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1321 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1318 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1322 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1319 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1323 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1320 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1324 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1321 | } | 1325 | } |
1322 | 1326 | ||
1323 | } | 1327 | } |
1324 | else | 1328 | else |
1325 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1329 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1326 | if ( !incidence->location().isEmpty() ) | 1330 | if ( !incidence->location().isEmpty() ) |
1327 | startString += " (" +incidence->location()+")"; | 1331 | startString += " (" +incidence->location()+")"; |
1328 | setCaption( incidence->summary()+startString); | 1332 | setCaption( incidence->summary()+startString); |
1329 | 1333 | ||
1330 | enableIncidenceActions( true ); | 1334 | enableIncidenceActions( true ); |
1331 | 1335 | ||
1332 | if ( incidence->type() == "Event" ) { | 1336 | if ( incidence->type() == "Event" ) { |
1333 | mShowAction->setText( i18n("Show Event...") ); | 1337 | mShowAction->setText( i18n("Show Event...") ); |
1334 | mEditAction->setText( i18n("Edit Event...") ); | 1338 | mEditAction->setText( i18n("Edit Event...") ); |
1335 | mDeleteAction->setText( i18n("Delete Event...") ); | 1339 | mDeleteAction->setText( i18n("Delete Event...") ); |
1336 | 1340 | ||
1337 | mNewSubTodoAction->setEnabled( false ); | 1341 | mNewSubTodoAction->setEnabled( false ); |
1338 | } else if ( incidence->type() == "Todo" ) { | 1342 | } else if ( incidence->type() == "Todo" ) { |
1339 | mShowAction->setText( i18n("Show Todo...") ); | 1343 | mShowAction->setText( i18n("Show Todo...") ); |
1340 | mEditAction->setText( i18n("Edit Todo...") ); | 1344 | mEditAction->setText( i18n("Edit Todo...") ); |
1341 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1345 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1342 | 1346 | ||
1343 | mNewSubTodoAction->setEnabled( true ); | 1347 | mNewSubTodoAction->setEnabled( true ); |
1344 | } else { | 1348 | } else { |
1345 | mShowAction->setText( i18n("Show...") ); | 1349 | mShowAction->setText( i18n("Show...") ); |
1346 | mShowAction->setText( i18n("Edit...") ); | 1350 | mShowAction->setText( i18n("Edit...") ); |
1347 | mShowAction->setText( i18n("Delete...") ); | 1351 | mShowAction->setText( i18n("Delete...") ); |
1348 | 1352 | ||
1349 | mNewSubTodoAction->setEnabled( false ); | 1353 | mNewSubTodoAction->setEnabled( false ); |
1350 | } | 1354 | } |
1351 | } | 1355 | } |
1352 | 1356 | ||
1353 | void MainWindow::enableIncidenceActions( bool enabled ) | 1357 | void MainWindow::enableIncidenceActions( bool enabled ) |
1354 | { | 1358 | { |
1355 | mShowAction->setEnabled( enabled ); | 1359 | mShowAction->setEnabled( enabled ); |
1356 | mEditAction->setEnabled( enabled ); | 1360 | mEditAction->setEnabled( enabled ); |
1357 | mDeleteAction->setEnabled( enabled ); | 1361 | mDeleteAction->setEnabled( enabled ); |
1358 | 1362 | ||
1359 | mCloneAction->setEnabled( enabled ); | 1363 | mCloneAction->setEnabled( enabled ); |
1360 | mMoveAction->setEnabled( enabled ); | 1364 | mMoveAction->setEnabled( enabled ); |
1361 | mBeamAction->setEnabled( enabled ); | 1365 | mBeamAction->setEnabled( enabled ); |
1362 | mCancelAction->setEnabled( enabled ); | 1366 | mCancelAction->setEnabled( enabled ); |
1363 | } | 1367 | } |
1364 | 1368 | ||
1365 | void MainWindow::importOL() | 1369 | void MainWindow::importOL() |
1366 | { | 1370 | { |
1367 | #ifdef _WIN32_ | 1371 | #ifdef _WIN32_ |
1368 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1372 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1369 | id->exec(); | 1373 | id->exec(); |
1370 | delete id; | 1374 | delete id; |
1371 | mView->updateView(); | 1375 | mView->updateView(); |
1372 | #endif | 1376 | #endif |
1373 | } | 1377 | } |
1374 | void MainWindow::importBday() | 1378 | void MainWindow::importBday() |
1375 | { | 1379 | { |
1376 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1380 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1377 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1381 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1378 | i18n("Import!"), i18n("Cancel"), 0, | 1382 | i18n("Import!"), i18n("Cancel"), 0, |
1379 | 0, 1 ); | 1383 | 0, 1 ); |
1380 | if ( result == 0 ) { | 1384 | if ( result == 0 ) { |
1381 | mView->importBday(); | 1385 | mView->importBday(); |
1382 | 1386 | ||
1383 | } | 1387 | } |
1384 | 1388 | ||
1385 | 1389 | ||
1386 | } | 1390 | } |
1387 | void MainWindow::importQtopia() | 1391 | void MainWindow::importQtopia() |
1388 | { | 1392 | { |
1389 | #ifndef DESKTOP_VERSION | 1393 | #ifndef DESKTOP_VERSION |
1390 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1394 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1391 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1395 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1392 | i18n("Import!"), i18n("Cancel"), 0, | 1396 | i18n("Import!"), i18n("Cancel"), 0, |
1393 | 0, 1 ); | 1397 | 0, 1 ); |
1394 | if ( result == 0 ) { | 1398 | if ( result == 0 ) { |
1395 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1399 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1396 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1400 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1397 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1401 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1398 | mView->importQtopia( categories, datebook, todolist ); | 1402 | mView->importQtopia( categories, datebook, todolist ); |
1399 | } | 1403 | } |
1400 | #else | 1404 | #else |
1401 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1405 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1402 | i18n("Not supported \non desktop!\n"), | 1406 | i18n("Not supported \non desktop!\n"), |
1403 | i18n("Ok"), i18n("Cancel"), 0, | 1407 | i18n("Ok"), i18n("Cancel"), 0, |
1404 | 0, 1 ); | 1408 | 0, 1 ); |
1405 | 1409 | ||
1406 | #endif | 1410 | #endif |
1407 | } | 1411 | } |
1408 | 1412 | ||
1409 | void MainWindow::saveOnClose() | 1413 | void MainWindow::saveOnClose() |
1410 | { | 1414 | { |
1411 | KOPrefs *p = KOPrefs::instance(); | 1415 | KOPrefs *p = KOPrefs::instance(); |
1412 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1416 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1413 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1417 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1414 | iconToolBar->y() > height()/2; | 1418 | iconToolBar->y() > height()/2; |
1415 | mView->writeSettings(); | 1419 | mView->writeSettings(); |
1416 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1420 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1417 | save(); | 1421 | save(); |
1418 | } | 1422 | } |
1419 | void MainWindow::slotModifiedChanged( bool changed ) | 1423 | void MainWindow::slotModifiedChanged( bool changed ) |
1420 | { | 1424 | { |
1421 | if ( mBlockAtStartup ) | 1425 | if ( mBlockAtStartup ) |
1422 | return; | 1426 | return; |
1423 | int msec; | 1427 | int msec; |
1424 | // we store the changes after 1 minute, | 1428 | // we store the changes after 1 minute, |
1425 | // and for safety reasons after 10 minutes again | 1429 | // and for safety reasons after 10 minutes again |
1426 | if ( !mSyncManager->blockSave() ) | 1430 | if ( !mSyncManager->blockSave() ) |
1427 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1431 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1428 | else | 1432 | else |
1429 | msec = 1000 * 600; | 1433 | msec = 1000 * 600; |
1430 | mSaveTimer.start( msec, true ); // 1 minute | 1434 | mSaveTimer.start( msec, true ); // 1 minute |
1431 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1435 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1432 | mCalendarModifiedFlag = true; | 1436 | mCalendarModifiedFlag = true; |
1433 | } | 1437 | } |
1434 | void MainWindow::save() | 1438 | void MainWindow::save() |
1435 | { | 1439 | { |
1436 | if ( mSyncManager->blockSave() ) | 1440 | if ( mSyncManager->blockSave() ) |
1437 | return; | 1441 | return; |
1438 | mSyncManager->setBlockSave(true); | 1442 | mSyncManager->setBlockSave(true); |
1439 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1443 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1440 | 1444 | ||
1441 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1445 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1442 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1446 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1443 | qDebug("KO: Start saving data to file!"); | 1447 | qDebug("KO: Start saving data to file!"); |
1444 | mView->saveCalendar( defaultFileName() ); | 1448 | mView->saveCalendar( defaultFileName() ); |
1445 | 1449 | ||
1446 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1450 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1447 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1451 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1448 | QString savemes; | 1452 | QString savemes; |
1449 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1453 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1450 | setCaption(savemes); | 1454 | setCaption(savemes); |
1451 | } else | 1455 | } else |
1452 | setCaption(i18n("Saving cancelled!")); | 1456 | setCaption(i18n("Saving cancelled!")); |
1453 | mCalendarModifiedFlag = false; | 1457 | mCalendarModifiedFlag = false; |
1454 | mSyncManager->setBlockSave( false ); | 1458 | mSyncManager->setBlockSave( false ); |
1455 | } | 1459 | } |
1456 | 1460 | ||
1457 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1461 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1458 | { | 1462 | { |
1459 | if ( !e->isAutoRepeat() ) { | 1463 | if ( !e->isAutoRepeat() ) { |
1460 | mFlagKeyPressed = false; | 1464 | mFlagKeyPressed = false; |
1461 | } | 1465 | } |
1462 | } | 1466 | } |
1463 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1467 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1464 | { | 1468 | { |
1465 | qApp->processEvents(); | 1469 | qApp->processEvents(); |
1466 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1470 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1467 | e->ignore(); | 1471 | e->ignore(); |
1468 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1472 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1469 | return; | 1473 | return; |
1470 | } | 1474 | } |
1471 | if (! e->isAutoRepeat() ) | 1475 | if (! e->isAutoRepeat() ) |
1472 | mFlagKeyPressed = true; | 1476 | mFlagKeyPressed = true; |
1473 | KOPrefs *p = KOPrefs::instance(); | 1477 | KOPrefs *p = KOPrefs::instance(); |
1474 | bool showSelectedDates = false; | 1478 | bool showSelectedDates = false; |
1475 | int size; | 1479 | int size; |
1476 | int pro = 0; | 1480 | int pro = 0; |
1477 | //qDebug("MainWindow::keyPressEvent "); | 1481 | //qDebug("MainWindow::keyPressEvent "); |
1478 | switch ( e->key() ) { | 1482 | switch ( e->key() ) { |
1479 | case Qt::Key_Right: | 1483 | case Qt::Key_Right: |
1480 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1484 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1481 | mView->goNextMonth(); | 1485 | mView->goNextMonth(); |
1482 | else | 1486 | else |
1483 | mView->goNext(); | 1487 | mView->goNext(); |
1484 | showSelectedDates = true; | 1488 | showSelectedDates = true; |
1485 | break; | 1489 | break; |
1486 | case Qt::Key_Left: | 1490 | case Qt::Key_Left: |
1487 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1491 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1488 | mView->goPreviousMonth(); | 1492 | mView->goPreviousMonth(); |
1489 | else | 1493 | else |
1490 | mView->goPrevious(); | 1494 | mView->goPrevious(); |
1491 | showSelectedDates = true; | 1495 | showSelectedDates = true; |
1492 | break; | 1496 | break; |
1493 | case Qt::Key_Down: | 1497 | case Qt::Key_Down: |
1494 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1498 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1495 | break; | 1499 | break; |
1496 | case Qt::Key_Up: | 1500 | case Qt::Key_Up: |
1497 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1501 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1498 | break; | 1502 | break; |
1499 | case Qt::Key_I: | 1503 | case Qt::Key_I: |
1500 | mView->showIncidence(); | 1504 | mView->showIncidence(); |
1501 | break; | 1505 | break; |
1502 | case Qt::Key_Delete: | 1506 | case Qt::Key_Delete: |
1503 | case Qt::Key_Backspace: | 1507 | case Qt::Key_Backspace: |
1504 | mView->deleteIncidence(); | 1508 | mView->deleteIncidence(); |
1505 | break; | 1509 | break; |
1506 | case Qt::Key_D: | 1510 | case Qt::Key_D: |
1507 | mView->viewManager()->showDayView(); | 1511 | mView->viewManager()->showDayView(); |
1508 | showSelectedDates = true; | 1512 | showSelectedDates = true; |
1509 | break; | 1513 | break; |
1510 | case Qt::Key_O: | 1514 | case Qt::Key_O: |
1511 | mView->toggleFilerEnabled( ); | 1515 | mView->toggleFilerEnabled( ); |
1512 | break; | 1516 | break; |
1513 | case Qt::Key_0: | 1517 | case Qt::Key_0: |
1514 | case Qt::Key_1: | 1518 | case Qt::Key_1: |
1515 | case Qt::Key_2: | 1519 | case Qt::Key_2: |
1516 | case Qt::Key_3: | 1520 | case Qt::Key_3: |
1517 | case Qt::Key_4: | 1521 | case Qt::Key_4: |
1518 | case Qt::Key_5: | 1522 | case Qt::Key_5: |
1519 | case Qt::Key_6: | 1523 | case Qt::Key_6: |
1520 | case Qt::Key_7: | 1524 | case Qt::Key_7: |
1521 | case Qt::Key_8: | 1525 | case Qt::Key_8: |
1522 | case Qt::Key_9: | 1526 | case Qt::Key_9: |
1523 | pro = e->key()-48; | 1527 | pro = e->key()-48; |
1524 | if ( pro == 0 ) | 1528 | if ( pro == 0 ) |
1525 | pro = 10; | 1529 | pro = 10; |
1526 | if ( e->state() == Qt::ControlButton) | 1530 | if ( e->state() == Qt::ControlButton) |
1527 | pro += 10; | 1531 | pro += 10; |
1528 | break; | 1532 | break; |
1529 | case Qt::Key_M: | 1533 | case Qt::Key_M: |
1530 | mView->viewManager()->showMonthView(); | 1534 | mView->viewManager()->showMonthView(); |
1531 | showSelectedDates = true; | 1535 | showSelectedDates = true; |
1532 | break; | 1536 | break; |
1533 | case Qt::Key_Insert: | 1537 | case Qt::Key_Insert: |
1534 | mView->newEvent(); | 1538 | mView->newEvent(); |
1535 | break; | 1539 | break; |
1536 | case Qt::Key_S : | 1540 | case Qt::Key_S : |
1537 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1541 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1538 | mView->newSubTodo(); | 1542 | mView->newSubTodo(); |
1539 | else | 1543 | else |
1540 | mView->dialogManager()->showSearchDialog(); | 1544 | mView->dialogManager()->showSearchDialog(); |
1541 | break; | 1545 | break; |
1542 | case Qt::Key_Y : | 1546 | case Qt::Key_Y : |
1543 | case Qt::Key_Z : | 1547 | case Qt::Key_Z : |
1544 | mView->viewManager()->showWorkWeekView(); | 1548 | mView->viewManager()->showWorkWeekView(); |
1545 | showSelectedDates = true; | 1549 | showSelectedDates = true; |
1546 | break; | 1550 | break; |
1547 | case Qt::Key_U : | 1551 | case Qt::Key_U : |
1548 | mView->viewManager()->showWeekView(); | 1552 | mView->viewManager()->showWeekView(); |
1549 | showSelectedDates = true; | 1553 | showSelectedDates = true; |
1550 | break; | 1554 | break; |
1551 | case Qt::Key_H : | 1555 | case Qt::Key_H : |
1552 | keyBindings(); | 1556 | keyBindings(); |
1553 | break; | 1557 | break; |
1554 | case Qt::Key_W: | 1558 | case Qt::Key_W: |
1555 | mView->viewManager()->showWhatsNextView(); | 1559 | mView->viewManager()->showWhatsNextView(); |
1556 | break; | 1560 | break; |
1557 | case Qt::Key_L: | 1561 | case Qt::Key_L: |
1558 | mView->viewManager()->showListView(); | 1562 | mView->viewManager()->showListView(); |
1559 | break; | 1563 | break; |
1560 | case Qt::Key_N: | 1564 | case Qt::Key_N: |
1561 | mView->viewManager()->showNextXView(); | 1565 | mView->viewManager()->showNextXView(); |
1562 | showSelectedDates = true; | 1566 | showSelectedDates = true; |
1563 | break; | 1567 | break; |
1564 | case Qt::Key_V: | 1568 | case Qt::Key_V: |
1565 | mView->viewManager()->showTodoView(); | 1569 | mView->viewManager()->showTodoView(); |
1566 | break; | 1570 | break; |
1567 | case Qt::Key_C: | 1571 | case Qt::Key_C: |
1568 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1572 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1569 | break; | 1573 | break; |
1570 | case Qt::Key_P: | 1574 | case Qt::Key_P: |
1571 | mView->showDatePicker( ); | 1575 | mView->showDatePicker( ); |
1572 | break; | 1576 | break; |
1573 | case Qt::Key_F: | 1577 | case Qt::Key_F: |
1574 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1578 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1575 | mView->editFilters(); | 1579 | mView->editFilters(); |
1576 | else | 1580 | else |
1577 | mView->toggleFilter(); | 1581 | mView->toggleFilter(); |
1578 | break; | 1582 | break; |
1579 | case Qt::Key_X: | 1583 | case Qt::Key_X: |
1580 | mView->toggleDateNavigatorWidget(); | 1584 | mView->toggleDateNavigatorWidget(); |
1581 | break; | 1585 | break; |
1582 | case Qt::Key_Space: | 1586 | case Qt::Key_Space: |
1583 | mView->toggleExpand(); | 1587 | mView->toggleExpand(); |
1584 | break; | 1588 | break; |
1585 | case Qt::Key_A: | 1589 | case Qt::Key_A: |
1586 | mView->toggleAllDaySize(); | 1590 | mView->toggleAllDaySize(); |
1587 | break; | 1591 | break; |
1588 | case Qt::Key_T: | 1592 | case Qt::Key_T: |
1589 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1593 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1590 | mView->newTodo(); | 1594 | mView->newTodo(); |
1591 | else { | 1595 | else { |
1592 | mView->goToday(); | 1596 | mView->goToday(); |
1593 | showSelectedDates = true; | 1597 | showSelectedDates = true; |
1594 | } | 1598 | } |
1595 | break; | 1599 | break; |
1596 | case Qt::Key_J: | 1600 | case Qt::Key_J: |
1597 | mView->viewManager()->showJournalView(); | 1601 | mView->viewManager()->showJournalView(); |
1598 | break; | 1602 | break; |
1599 | case Qt::Key_B: | 1603 | case Qt::Key_B: |
1600 | mView->editIncidenceDescription();; | 1604 | mView->editIncidenceDescription();; |
1601 | break; | 1605 | break; |
1602 | // case Qt::Key_Return: | 1606 | // case Qt::Key_Return: |
1603 | case Qt::Key_E: | 1607 | case Qt::Key_E: |
1604 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1608 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1605 | mView->newEvent(); | 1609 | mView->newEvent(); |
1606 | else | 1610 | else |
1607 | mView->editIncidence(); | 1611 | mView->editIncidence(); |
1608 | break; | 1612 | break; |
1609 | case Qt::Key_Plus: | 1613 | case Qt::Key_Plus: |
1610 | size = p->mHourSize +2; | 1614 | size = p->mHourSize +2; |
1611 | if ( size <= 18 ) | 1615 | if ( size <= 18 ) |
1612 | configureAgenda( size ); | 1616 | configureAgenda( size ); |
1613 | break; | 1617 | break; |
1614 | case Qt::Key_Minus: | 1618 | case Qt::Key_Minus: |
1615 | size = p->mHourSize - 2; | 1619 | size = p->mHourSize - 2; |
1616 | if ( size >= 4 ) | 1620 | if ( size >= 4 ) |
1617 | configureAgenda( size ); | 1621 | configureAgenda( size ); |
1618 | break; | 1622 | break; |
1619 | 1623 | ||
1620 | 1624 | ||
1621 | default: | 1625 | default: |
1622 | e->ignore(); | 1626 | e->ignore(); |
1623 | } | 1627 | } |
1624 | if ( pro > 0 ) { | 1628 | if ( pro > 0 ) { |
1625 | mView->selectFilter( pro-1 ); | 1629 | mView->selectFilter( pro-1 ); |
1626 | } | 1630 | } |
1627 | if ( showSelectedDates ) { | 1631 | if ( showSelectedDates ) { |
1628 | ;// setCaptionToDates(); | 1632 | ;// setCaptionToDates(); |
1629 | } | 1633 | } |
1630 | 1634 | ||
1631 | } | 1635 | } |
1632 | 1636 | ||
1633 | void MainWindow::fillFilterMenu() | 1637 | void MainWindow::fillFilterMenu() |
1634 | { | 1638 | { |
1635 | selectFilterMenu->clear(); | 1639 | selectFilterMenu->clear(); |
1636 | bool disable = false; | 1640 | bool disable = false; |
1637 | if ( mView->filterView()->filtersEnabled() ) { | 1641 | if ( mView->filterView()->filtersEnabled() ) { |
1638 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); | 1642 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); |
1639 | } | 1643 | } |
1640 | else { | 1644 | else { |
1641 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); | 1645 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); |
1642 | disable = true; | 1646 | disable = true; |
1643 | } | 1647 | } |
1644 | selectFilterMenu->insertSeparator(); | 1648 | selectFilterMenu->insertSeparator(); |
1645 | QPtrList<CalFilter> fili = mView->filters(); | 1649 | QPtrList<CalFilter> fili = mView->filters(); |
1646 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1650 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1647 | CalFilter *filter = fili.first(); | 1651 | CalFilter *filter = fili.first(); |
1648 | int iii = 1; | 1652 | int iii = 1; |
1649 | while(filter) { | 1653 | while(filter) { |
1650 | selectFilterMenu->insertItem( filter->name(), iii ); | 1654 | selectFilterMenu->insertItem( filter->name(), iii ); |
1651 | if ( filter == curfilter) | 1655 | if ( filter == curfilter) |
1652 | selectFilterMenu->setItemChecked( iii, true ); | 1656 | selectFilterMenu->setItemChecked( iii, true ); |
1653 | if ( disable ) | 1657 | if ( disable ) |
1654 | selectFilterMenu->setItemEnabled( iii, false ); | 1658 | selectFilterMenu->setItemEnabled( iii, false ); |
1655 | filter = fili.next(); | 1659 | filter = fili.next(); |
1656 | ++iii; | 1660 | ++iii; |
1657 | } | 1661 | } |
1658 | } | 1662 | } |
1659 | void MainWindow::selectFilter( int fil ) | 1663 | void MainWindow::selectFilter( int fil ) |
1660 | { | 1664 | { |
1661 | if ( fil == 0 ) { | 1665 | if ( fil == 0 ) { |
1662 | mView->toggleFilerEnabled( ); | 1666 | mView->toggleFilerEnabled( ); |
1663 | } else { | 1667 | } else { |
1664 | mView->selectFilter( fil-1 ); | 1668 | mView->selectFilter( fil-1 ); |
1665 | } | 1669 | } |
1666 | } | 1670 | } |
1667 | void MainWindow::configureToolBar( int item ) | 1671 | void MainWindow::configureToolBar( int item ) |
1668 | { | 1672 | { |
1669 | 1673 | ||
1670 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1674 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1671 | KOPrefs *p = KOPrefs::instance(); | 1675 | KOPrefs *p = KOPrefs::instance(); |
1672 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1676 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1673 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1677 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1674 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1678 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1675 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1679 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1676 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1680 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1677 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1681 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1678 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1682 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1679 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1683 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1680 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1684 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1681 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1685 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1682 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1686 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1683 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1687 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1684 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1688 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1685 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1689 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1686 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1690 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1687 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1691 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1688 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1692 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1689 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1693 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1690 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1694 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1691 | // initActions(); | 1695 | // initActions(); |
1692 | } | 1696 | } |
1693 | 1697 | ||
1694 | void MainWindow::setCaptionToDates() | 1698 | void MainWindow::setCaptionToDates() |
1695 | { | 1699 | { |
1696 | QString selDates; | 1700 | QString selDates; |
1697 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1701 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1698 | if (mView->startDate() < mView->endDate() ) | 1702 | if (mView->startDate() < mView->endDate() ) |
1699 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1703 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1700 | setCaption( i18n("Dates: ") + selDates ); | 1704 | setCaption( i18n("Dates: ") + selDates ); |
1701 | 1705 | ||
1702 | } | 1706 | } |
1703 | // parameter item == 0: reinit | 1707 | // parameter item == 0: reinit |
1704 | void MainWindow::configureAgenda( int item ) | 1708 | void MainWindow::configureAgenda( int item ) |
1705 | { | 1709 | { |
1706 | 1710 | ||
1707 | KOPrefs *p = KOPrefs::instance(); | 1711 | KOPrefs *p = KOPrefs::instance(); |
1708 | 1712 | ||
1709 | int i; | 1713 | int i; |
1710 | // do not allow 4 for widgets higher than 480 | 1714 | // do not allow 4 for widgets higher than 480 |
1711 | // if ( QApplication::desktop()->height() > 480 ) { | 1715 | // if ( QApplication::desktop()->height() > 480 ) { |
1712 | // if ( item == 4 ) | 1716 | // if ( item == 4 ) |
1713 | // item = 6; | 1717 | // item = 6; |
1714 | // } | 1718 | // } |
1715 | for ( i = 4; i <= 18; i= i+2 ) | 1719 | for ( i = 4; i <= 18; i= i+2 ) |
1716 | configureAgendaMenu->setItemChecked( i, false ); | 1720 | configureAgendaMenu->setItemChecked( i, false ); |
1717 | configureAgendaMenu->setItemChecked( item, true ); | 1721 | configureAgendaMenu->setItemChecked( item, true ); |
1718 | if ( p->mHourSize == item ) | 1722 | if ( p->mHourSize == item ) |
1719 | return; | 1723 | return; |
1720 | p->mHourSize=item; | 1724 | p->mHourSize=item; |
1721 | mView->viewManager()->agendaView()->updateConfig(); | 1725 | mView->viewManager()->agendaView()->updateConfig(); |
1722 | } | 1726 | } |
1723 | 1727 | ||
1724 | void MainWindow::saveCalendar() | 1728 | void MainWindow::saveCalendar() |
1725 | { | 1729 | { |
1726 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1730 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1727 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1731 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1728 | 1732 | ||
1729 | if ( fn == "" ) | 1733 | if ( fn == "" ) |
1730 | return; | 1734 | return; |
1731 | QFileInfo info; | 1735 | QFileInfo info; |
1732 | info.setFile( fn ); | 1736 | info.setFile( fn ); |
1733 | QString mes; | 1737 | QString mes; |
1734 | bool createbup = true; | 1738 | bool createbup = true; |
1735 | if ( info. exists() ) { | 1739 | if ( info. exists() ) { |
1736 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1740 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1737 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1741 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1738 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1742 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1739 | 0, 1 ); | 1743 | 0, 1 ); |
1740 | if ( result != 0 ) { | 1744 | if ( result != 0 ) { |
1741 | createbup = false; | 1745 | createbup = false; |
1742 | } | 1746 | } |
1743 | } | 1747 | } |
1744 | if ( createbup ) { | 1748 | if ( createbup ) { |
1745 | mView->saveCalendar( fn ); | 1749 | mView->saveCalendar( fn ); |
1746 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1750 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1747 | KOPrefs::instance()->mLastSaveFile = fn; | 1751 | KOPrefs::instance()->mLastSaveFile = fn; |
1748 | setCaption(mes); | 1752 | setCaption(mes); |
1749 | } | 1753 | } |
1750 | } | 1754 | } |
1751 | void MainWindow::loadCalendar() | 1755 | void MainWindow::loadCalendar() |
1752 | { | 1756 | { |
1753 | 1757 | ||
1754 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1758 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1755 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1759 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1756 | 1760 | ||
1757 | if ( fn == "" ) | 1761 | if ( fn == "" ) |
1758 | return; | 1762 | return; |
1759 | QFileInfo info; | 1763 | QFileInfo info; |
1760 | info.setFile( fn ); | 1764 | info.setFile( fn ); |
1761 | QString mess; | 1765 | QString mess; |
1762 | bool loadbup = true; | 1766 | bool loadbup = true; |
1763 | if ( info. exists() ) { | 1767 | if ( info. exists() ) { |
1764 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1768 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1765 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1769 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1766 | mess, | 1770 | mess, |
1767 | i18n("Load!"), i18n("Cancel"), 0, | 1771 | i18n("Load!"), i18n("Cancel"), 0, |
1768 | 0, 1 ); | 1772 | 0, 1 ); |
1769 | if ( result != 0 ) { | 1773 | if ( result != 0 ) { |
1770 | loadbup = false; | 1774 | loadbup = false; |
1771 | } | 1775 | } |
1772 | } else { | 1776 | } else { |
1773 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1777 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1774 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1778 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1775 | 0, 1 ); | 1779 | 0, 1 ); |
1776 | 1780 | ||
1777 | return; | 1781 | return; |
1778 | } | 1782 | } |
1779 | if ( loadbup ) { | 1783 | if ( loadbup ) { |
1780 | mView->openCalendar( fn ); | 1784 | mView->openCalendar( fn ); |
1781 | KOPrefs::instance()->mLastLoadFile = fn; | 1785 | KOPrefs::instance()->mLastLoadFile = fn; |
1782 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1786 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1783 | setCaption(mess); | 1787 | setCaption(mess); |
1784 | } | 1788 | } |
1785 | 1789 | ||
1786 | } | 1790 | } |
1787 | void MainWindow::quickImportIcal() | 1791 | void MainWindow::quickImportIcal() |
1788 | { | 1792 | { |
1789 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1793 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1790 | } | 1794 | } |
1791 | void MainWindow::importFile( QString fn, bool quick ) | 1795 | void MainWindow::importFile( QString fn, bool quick ) |
1792 | { | 1796 | { |
1793 | QFileInfo info; | 1797 | QFileInfo info; |
1794 | info.setFile( fn ); | 1798 | info.setFile( fn ); |
1795 | QString mess; | 1799 | QString mess; |
1796 | bool loadbup = true; | 1800 | bool loadbup = true; |
1797 | if ( !info. exists() ) { | 1801 | if ( !info. exists() ) { |
1798 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1802 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1799 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1803 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1800 | mess ); | 1804 | mess ); |
1801 | return; | 1805 | return; |
1802 | } | 1806 | } |
1803 | int result = 0; | 1807 | int result = 0; |
1804 | if ( !quick ) { | 1808 | if ( !quick ) { |
1805 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1809 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1806 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1810 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1807 | mess, | 1811 | mess, |
1808 | "Import", "Cancel", 0, | 1812 | "Import", "Cancel", 0, |
1809 | 0, 1 ); | 1813 | 0, 1 ); |
1810 | } | 1814 | } |
1811 | if ( result == 0 ) { | 1815 | if ( result == 0 ) { |
1812 | if ( mView->openCalendar( fn, true )) { | 1816 | if ( mView->openCalendar( fn, true )) { |
1813 | KOPrefs::instance()->mLastImportFile = fn; | 1817 | KOPrefs::instance()->mLastImportFile = fn; |
1814 | setCaption(i18n("Imported file successfully")); | 1818 | setCaption(i18n("Imported file successfully")); |
1815 | } else { | 1819 | } else { |
1816 | setCaption(i18n("Error importing file")); | 1820 | setCaption(i18n("Error importing file")); |
1817 | } | 1821 | } |
1818 | } | 1822 | } |
1819 | } | 1823 | } |
1820 | 1824 | ||
1821 | void MainWindow::importIcal() | 1825 | void MainWindow::importIcal() |
1822 | { | 1826 | { |
1823 | 1827 | ||
1824 | QString fn =KOPrefs::instance()->mLastImportFile; | 1828 | QString fn =KOPrefs::instance()->mLastImportFile; |
1825 | 1829 | ||
1826 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1830 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1827 | if ( fn == "" ) | 1831 | if ( fn == "" ) |
1828 | return; | 1832 | return; |
1829 | importFile( fn, true ); | 1833 | importFile( fn, true ); |
1830 | 1834 | ||
1831 | } | 1835 | } |
1832 | 1836 | ||
1833 | void MainWindow::exportVCalendar() | 1837 | void MainWindow::exportVCalendar() |
1834 | { | 1838 | { |
1835 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1839 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1836 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1840 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1837 | if ( fn == "" ) | 1841 | if ( fn == "" ) |
1838 | return; | 1842 | return; |
1839 | QFileInfo info; | 1843 | QFileInfo info; |
1840 | info.setFile( fn ); | 1844 | info.setFile( fn ); |
1841 | QString mes; | 1845 | QString mes; |
1842 | bool createbup = true; | 1846 | bool createbup = true; |
1843 | if ( info. exists() ) { | 1847 | if ( info. exists() ) { |
1844 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 1848 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
1845 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1849 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1846 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1850 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1847 | 0, 1 ); | 1851 | 0, 1 ); |
1848 | if ( result != 0 ) { | 1852 | if ( result != 0 ) { |
1849 | createbup = false; | 1853 | createbup = false; |
1850 | } | 1854 | } |
1851 | } | 1855 | } |
1852 | if ( createbup ) { | 1856 | if ( createbup ) { |
1853 | if ( mView->exportVCalendar( fn ) ) { | 1857 | if ( mView->exportVCalendar( fn ) ) { |
1854 | KOPrefs::instance()->mLastVcalFile = fn; | 1858 | KOPrefs::instance()->mLastVcalFile = fn; |
1855 | if ( fn.length() > 20 ) | 1859 | if ( fn.length() > 20 ) |
1856 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1860 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1857 | else | 1861 | else |
1858 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1862 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1859 | setCaption(mes); | 1863 | setCaption(mes); |
1860 | } | 1864 | } |
1861 | } | 1865 | } |
1862 | 1866 | ||
1863 | } | 1867 | } |
1864 | 1868 | ||
1865 | void MainWindow::syncFileRequest() | 1869 | void MainWindow::syncFileRequest() |
1866 | { | 1870 | { |
1867 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 1871 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
1868 | mSyncManager->slotSyncMenu( 999 ); | 1872 | mSyncManager->slotSyncMenu( 999 ); |
1869 | } | 1873 | } |
1870 | save(); | 1874 | save(); |
1871 | } | 1875 | } |
1872 | void MainWindow::getFile( bool success ) | 1876 | void MainWindow::getFile( bool success ) |
1873 | { | 1877 | { |
1874 | if ( ! success ) { | 1878 | if ( ! success ) { |
1875 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 1879 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
1876 | return; | 1880 | return; |
1877 | } | 1881 | } |
1878 | mView->openCalendar( defaultFileName() ); | 1882 | mView->openCalendar( defaultFileName() ); |
1879 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 1883 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
1880 | mSyncManager->slotSyncMenu( 999 ); | 1884 | mSyncManager->slotSyncMenu( 999 ); |
1881 | } | 1885 | } |
1882 | setCaption( i18n("Pi-Sync successful!") ); | 1886 | setCaption( i18n("Pi-Sync successful!") ); |
1883 | } | 1887 | } |
1884 | 1888 | ||
1885 | void MainWindow::printSel( ) | 1889 | void MainWindow::printSel( ) |
1886 | { | 1890 | { |
1887 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 1891 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
1888 | } | 1892 | } |
1889 | 1893 | ||
1890 | void MainWindow::printCal() | 1894 | void MainWindow::printCal() |
1891 | { | 1895 | { |
1892 | mView->print();//mCp->showDialog(); | 1896 | mView->print();//mCp->showDialog(); |
1893 | } | 1897 | } |
1894 | 1898 | ||