author | zautrix <zautrix> | 2005-02-23 18:47:45 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-23 18:47:45 (UTC) |
commit | 31f24d21cd23bb7e4033e7ffa000e6c979133ce7 (patch) (unidiff) | |
tree | 2fa81f67efc6544a3664e6039a9602ef6f3466b9 | |
parent | faedffc5ce8391204e0340a21eaaf582319ac824 (diff) | |
download | kdepimpi-31f24d21cd23bb7e4033e7ffa000e6c979133ce7.zip kdepimpi-31f24d21cd23bb7e4033e7ffa000e6c979133ce7.tar.gz kdepimpi-31f24d21cd23bb7e4033e7ffa000e6c979133ce7.tar.bz2 |
many focus fixes
-rw-r--r-- | korganizer/calendarview.cpp | 54 | ||||
-rw-r--r-- | korganizer/calendarview.h | 3 | ||||
-rw-r--r-- | korganizer/koeventviewer.h | 2 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 21 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.h | 10 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 8 | ||||
-rw-r--r-- | korganizer/kolistview.h | 1 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 22 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 1 |
9 files changed, 111 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3dac20b..1009956 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -40,388 +40,392 @@ | |||
40 | #include <qprogressbar.h> | 40 | #include <qprogressbar.h> |
41 | #include <qmultilineedit.h> | 41 | #include <qmultilineedit.h> |
42 | #include <qtimer.h> | 42 | #include <qtimer.h> |
43 | #include <qwidgetstack.h> | 43 | #include <qwidgetstack.h> |
44 | #include <qptrlist.h> | 44 | #include <qptrlist.h> |
45 | #include <qregexp.h> | 45 | #include <qregexp.h> |
46 | #include <qgroupbox.h> | 46 | #include <qgroupbox.h> |
47 | #include <qfile.h> | 47 | #include <qfile.h> |
48 | #include <qdir.h> | 48 | #include <qdir.h> |
49 | #ifndef KORG_NOSPLITTER | 49 | #ifndef KORG_NOSPLITTER |
50 | #include <qsplitter.h> | 50 | #include <qsplitter.h> |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #include <kglobal.h> | 53 | #include <kglobal.h> |
54 | #include <kdebug.h> | 54 | #include <kdebug.h> |
55 | #include <kstandarddirs.h> | 55 | #include <kstandarddirs.h> |
56 | #include <kfiledialog.h> | 56 | #include <kfiledialog.h> |
57 | #include <kmessagebox.h> | 57 | #include <kmessagebox.h> |
58 | #include <knotifyclient.h> | 58 | #include <knotifyclient.h> |
59 | #include <kconfig.h> | 59 | #include <kconfig.h> |
60 | 60 | ||
61 | #include <libkdepim/ksyncprefsdialog.h> | 61 | #include <libkdepim/ksyncprefsdialog.h> |
62 | #include <krun.h> | 62 | #include <krun.h> |
63 | #include <kdirwatch.h> | 63 | #include <kdirwatch.h> |
64 | #include <libkdepim/kdatepicker.h> | 64 | #include <libkdepim/kdatepicker.h> |
65 | #include <libkdepim/ksyncprofile.h> | 65 | #include <libkdepim/ksyncprofile.h> |
66 | #include <libkdepim/kpimglobalprefs.h> | 66 | #include <libkdepim/kpimglobalprefs.h> |
67 | 67 | ||
68 | #include <libkcal/vcaldrag.h> | 68 | #include <libkcal/vcaldrag.h> |
69 | #include <libkcal/icaldrag.h> | 69 | #include <libkcal/icaldrag.h> |
70 | #include <libkcal/icalformat.h> | 70 | #include <libkcal/icalformat.h> |
71 | #include <libkcal/vcalformat.h> | 71 | #include <libkcal/vcalformat.h> |
72 | #include <libkcal/scheduler.h> | 72 | #include <libkcal/scheduler.h> |
73 | #include <libkcal/calendarlocal.h> | 73 | #include <libkcal/calendarlocal.h> |
74 | #include <libkcal/journal.h> | 74 | #include <libkcal/journal.h> |
75 | #include <libkcal/calfilter.h> | 75 | #include <libkcal/calfilter.h> |
76 | #include <libkcal/attendee.h> | 76 | #include <libkcal/attendee.h> |
77 | #include <libkcal/dndfactory.h> | 77 | #include <libkcal/dndfactory.h> |
78 | #include <libkcal/freebusy.h> | 78 | #include <libkcal/freebusy.h> |
79 | #include <libkcal/filestorage.h> | 79 | #include <libkcal/filestorage.h> |
80 | #include <libkcal/calendarresources.h> | 80 | #include <libkcal/calendarresources.h> |
81 | #include <libkcal/qtopiaformat.h> | 81 | #include <libkcal/qtopiaformat.h> |
82 | #include "../kalarmd/alarmdialog.h" | 82 | #include "../kalarmd/alarmdialog.h" |
83 | 83 | ||
84 | #ifndef DESKTOP_VERSION | 84 | #ifndef DESKTOP_VERSION |
85 | #include <libkcal/sharpformat.h> | 85 | #include <libkcal/sharpformat.h> |
86 | #include <externalapphandler.h> | 86 | #include <externalapphandler.h> |
87 | #endif | 87 | #endif |
88 | #include <libkcal/phoneformat.h> | 88 | #include <libkcal/phoneformat.h> |
89 | #ifndef KORG_NOMAIL | 89 | #ifndef KORG_NOMAIL |
90 | #include "komailclient.h" | 90 | #include "komailclient.h" |
91 | #endif | 91 | #endif |
92 | #ifndef KORG_NOPRINTER | 92 | #ifndef KORG_NOPRINTER |
93 | #include "calprinter.h" | 93 | #include "calprinter.h" |
94 | #endif | 94 | #endif |
95 | #ifndef KORG_NOPLUGINS | 95 | #ifndef KORG_NOPLUGINS |
96 | #include "kocore.h" | 96 | #include "kocore.h" |
97 | #endif | 97 | #endif |
98 | #include "koeventeditor.h" | 98 | #include "koeventeditor.h" |
99 | #include "kotodoeditor.h" | 99 | #include "kotodoeditor.h" |
100 | #include "koprefs.h" | 100 | #include "koprefs.h" |
101 | #include "koeventviewerdialog.h" | 101 | #include "koeventviewerdialog.h" |
102 | #include "publishdialog.h" | 102 | #include "publishdialog.h" |
103 | #include "kofilterview.h" | 103 | #include "kofilterview.h" |
104 | #include "koglobals.h" | 104 | #include "koglobals.h" |
105 | #include "koviewmanager.h" | 105 | #include "koviewmanager.h" |
106 | #include "koagendaview.h" | 106 | #include "koagendaview.h" |
107 | #include "kodialogmanager.h" | 107 | #include "kodialogmanager.h" |
108 | #include "outgoingdialog.h" | 108 | #include "outgoingdialog.h" |
109 | #include "incomingdialog.h" | 109 | #include "incomingdialog.h" |
110 | #include "statusdialog.h" | 110 | #include "statusdialog.h" |
111 | #include "kdatenavigator.h" | 111 | #include "kdatenavigator.h" |
112 | #include "kotodoview.h" | 112 | #include "kotodoview.h" |
113 | #include "datenavigator.h" | 113 | #include "datenavigator.h" |
114 | #include "resourceview.h" | 114 | #include "resourceview.h" |
115 | #include "navigatorbar.h" | 115 | #include "navigatorbar.h" |
116 | #include "searchdialog.h" | 116 | #include "searchdialog.h" |
117 | #include "mainwindow.h" | 117 | #include "mainwindow.h" |
118 | 118 | ||
119 | #include "calendarview.h" | 119 | #include "calendarview.h" |
120 | #ifndef DESKTOP_VERSION | 120 | #ifndef DESKTOP_VERSION |
121 | #include <qtopia/alarmserver.h> | 121 | #include <qtopia/alarmserver.h> |
122 | #endif | 122 | #endif |
123 | #ifndef _WIN32_ | 123 | #ifndef _WIN32_ |
124 | #include <stdlib.h> | 124 | #include <stdlib.h> |
125 | #include <stdio.h> | 125 | #include <stdio.h> |
126 | #include <unistd.h> | 126 | #include <unistd.h> |
127 | #else | 127 | #else |
128 | #include <qprocess.h> | 128 | #include <qprocess.h> |
129 | #endif | 129 | #endif |
130 | 130 | ||
131 | #ifdef DESKTOP_VERSION | 131 | #ifdef DESKTOP_VERSION |
132 | #include <kabc/stdaddressbook.h> | 132 | #include <kabc/stdaddressbook.h> |
133 | #endif | 133 | #endif |
134 | using namespace KOrg; | 134 | using namespace KOrg; |
135 | using namespace KCal; | 135 | using namespace KCal; |
136 | extern int globalFlagBlockAgenda; | 136 | extern int globalFlagBlockAgenda; |
137 | extern int globalFlagBlockStartup; | 137 | extern int globalFlagBlockStartup; |
138 | 138 | ||
139 | 139 | ||
140 | 140 | ||
141 | class KOBeamPrefs : public QDialog | 141 | class KOBeamPrefs : public QDialog |
142 | { | 142 | { |
143 | public: | 143 | public: |
144 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 144 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
145 | QDialog( parent, name, true ) | 145 | QDialog( parent, name, true ) |
146 | { | 146 | { |
147 | setCaption( i18n("Beam Options") ); | 147 | setCaption( i18n("Beam Options") ); |
148 | QVBoxLayout* lay = new QVBoxLayout( this ); | 148 | QVBoxLayout* lay = new QVBoxLayout( this ); |
149 | lay->setSpacing( 3 ); | 149 | lay->setSpacing( 3 ); |
150 | lay->setMargin( 3 ); | 150 | lay->setMargin( 3 ); |
151 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 151 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
152 | lay->addWidget( format ); | 152 | lay->addWidget( format ); |
153 | format->setExclusive ( true ) ; | 153 | format->setExclusive ( true ) ; |
154 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 154 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
155 | lay->addWidget( time ); time->setExclusive ( true ) ; | 155 | lay->addWidget( time ); time->setExclusive ( true ) ; |
156 | vcal = new QRadioButton(" vCalendar ", format ); | 156 | vcal = new QRadioButton(" vCalendar ", format ); |
157 | ical = new QRadioButton(" iCalendar ", format ); | 157 | ical = new QRadioButton(" iCalendar ", format ); |
158 | vcal->setChecked( true ); | 158 | vcal->setChecked( true ); |
159 | tz = new QRadioButton(i18n(" With timezone "), time ); | 159 | tz = new QRadioButton(i18n(" With timezone "), time ); |
160 | local = new QRadioButton(i18n(" Local time "), time ); | 160 | local = new QRadioButton(i18n(" Local time "), time ); |
161 | tz->setChecked( true ); | 161 | tz->setChecked( true ); |
162 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 162 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
163 | lay->addWidget( ok ); | 163 | lay->addWidget( ok ); |
164 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 164 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
165 | lay->addWidget( cancel ); | 165 | lay->addWidget( cancel ); |
166 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 166 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
167 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 167 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
168 | resize( 200, 200 ); | 168 | resize( 200, 200 ); |
169 | } | 169 | } |
170 | 170 | ||
171 | bool beamVcal() { return vcal->isChecked(); } | 171 | bool beamVcal() { return vcal->isChecked(); } |
172 | bool beamLocal() { return local->isChecked(); } | 172 | bool beamLocal() { return local->isChecked(); } |
173 | private: | 173 | private: |
174 | QRadioButton* vcal, *ical, *local, *tz; | 174 | QRadioButton* vcal, *ical, *local, *tz; |
175 | }; | 175 | }; |
176 | class KOCatPrefs : public QDialog | 176 | class KOCatPrefs : public QDialog |
177 | { | 177 | { |
178 | public: | 178 | public: |
179 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 179 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
180 | QDialog( parent, name, true ) | 180 | QDialog( parent, name, true ) |
181 | { | 181 | { |
182 | setCaption( i18n("Manage new Categories") ); | 182 | setCaption( i18n("Manage new Categories") ); |
183 | QVBoxLayout* lay = new QVBoxLayout( this ); | 183 | QVBoxLayout* lay = new QVBoxLayout( this ); |
184 | lay->setSpacing( 3 ); | 184 | lay->setSpacing( 3 ); |
185 | lay->setMargin( 3 ); | 185 | lay->setMargin( 3 ); |
186 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 186 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
187 | lay->addWidget( lab ); | 187 | lay->addWidget( lab ); |
188 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 188 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
189 | lay->addWidget( format ); | 189 | lay->addWidget( format ); |
190 | format->setExclusive ( true ) ; | 190 | format->setExclusive ( true ) ; |
191 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 191 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
192 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 192 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
193 | addCatBut->setChecked( true ); | 193 | addCatBut->setChecked( true ); |
194 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 194 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
195 | lay->addWidget( ok ); | 195 | lay->addWidget( ok ); |
196 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 196 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
197 | lay->addWidget( cancel ); | 197 | lay->addWidget( cancel ); |
198 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 198 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
199 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 199 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
200 | resize( 200, 200 ); | 200 | resize( 200, 200 ); |
201 | } | 201 | } |
202 | 202 | ||
203 | bool addCat() { return addCatBut->isChecked(); } | 203 | bool addCat() { return addCatBut->isChecked(); } |
204 | private: | 204 | private: |
205 | QRadioButton* addCatBut; | 205 | QRadioButton* addCatBut; |
206 | }; | 206 | }; |
207 | 207 | ||
208 | 208 | ||
209 | 209 | ||
210 | CalendarView::CalendarView( CalendarResources *calendar, | 210 | CalendarView::CalendarView( CalendarResources *calendar, |
211 | QWidget *parent, const char *name ) | 211 | QWidget *parent, const char *name ) |
212 | : CalendarViewBase( parent, name ), | 212 | : CalendarViewBase( parent, name ), |
213 | mCalendar( calendar ), | 213 | mCalendar( calendar ), |
214 | mResourceManager( calendar->resourceManager() ) | 214 | mResourceManager( calendar->resourceManager() ) |
215 | { | 215 | { |
216 | 216 | ||
217 | mEventEditor = 0; | 217 | mEventEditor = 0; |
218 | mTodoEditor = 0; | 218 | mTodoEditor = 0; |
219 | 219 | ||
220 | init(); | 220 | init(); |
221 | } | 221 | } |
222 | 222 | ||
223 | CalendarView::CalendarView( Calendar *calendar, | 223 | CalendarView::CalendarView( Calendar *calendar, |
224 | QWidget *parent, const char *name ) | 224 | QWidget *parent, const char *name ) |
225 | : CalendarViewBase( parent, name ), | 225 | : CalendarViewBase( parent, name ), |
226 | mCalendar( calendar ), | 226 | mCalendar( calendar ), |
227 | mResourceManager( 0 ) | 227 | mResourceManager( 0 ) |
228 | { | 228 | { |
229 | 229 | ||
230 | mEventEditor = 0; | 230 | mEventEditor = 0; |
231 | mTodoEditor = 0; | 231 | mTodoEditor = 0; |
232 | init();} | 232 | init(); |
233 | } | ||
233 | 234 | ||
234 | void CalendarView::init() | 235 | void CalendarView::init() |
235 | { | 236 | { |
237 | |||
238 | setFocusPolicy ( WheelFocus ); | ||
239 | mViewerCallerIsSearchDialog = false; | ||
236 | mBlockShowDates = false; | 240 | mBlockShowDates = false; |
237 | beamDialog = new KOBeamPrefs(); | 241 | beamDialog = new KOBeamPrefs(); |
238 | mDatePickerMode = 0; | 242 | mDatePickerMode = 0; |
239 | mCurrentSyncDevice = ""; | 243 | mCurrentSyncDevice = ""; |
240 | writeLocale(); | 244 | writeLocale(); |
241 | mViewManager = new KOViewManager( this ); | 245 | mViewManager = new KOViewManager( this ); |
242 | mDialogManager = new KODialogManager( this ); | 246 | mDialogManager = new KODialogManager( this ); |
243 | mEventViewerDialog = 0; | 247 | mEventViewerDialog = 0; |
244 | mModified = false; | 248 | mModified = false; |
245 | mReadOnly = false; | 249 | mReadOnly = false; |
246 | mSelectedIncidence = 0; | 250 | mSelectedIncidence = 0; |
247 | mCalPrinter = 0; | 251 | mCalPrinter = 0; |
248 | mFilters.setAutoDelete(true); | 252 | mFilters.setAutoDelete(true); |
249 | 253 | ||
250 | mCalendar->registerObserver( this ); | 254 | mCalendar->registerObserver( this ); |
251 | // TODO: Make sure that view is updated, when calendar is changed. | 255 | // TODO: Make sure that view is updated, when calendar is changed. |
252 | 256 | ||
253 | mStorage = new FileStorage( mCalendar ); | 257 | mStorage = new FileStorage( mCalendar ); |
254 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 258 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
255 | 259 | ||
256 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 260 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
257 | #ifndef KORG_NOSPLITTER | 261 | #ifndef KORG_NOSPLITTER |
258 | // create the main layout frames. | 262 | // create the main layout frames. |
259 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 263 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
260 | topLayout->addWidget(mPanner); | 264 | topLayout->addWidget(mPanner); |
261 | 265 | ||
262 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 266 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
263 | "CalendarView::LeftFrame"); | 267 | "CalendarView::LeftFrame"); |
264 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 268 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
265 | 269 | ||
266 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, | 270 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, |
267 | "CalendarView::DateNavigator", QDate::currentDate() ); | 271 | "CalendarView::DateNavigator", QDate::currentDate() ); |
268 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 272 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
269 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 273 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
270 | mTodoList->setNavigator( mNavigator ); | 274 | mTodoList->setNavigator( mNavigator ); |
271 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 275 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
272 | 276 | ||
273 | #ifdef KORG_NORESOURCEVIEW | 277 | #ifdef KORG_NORESOURCEVIEW |
274 | mResourceView = 0; | 278 | mResourceView = 0; |
275 | #else | 279 | #else |
276 | if ( mResourceManager ) { | 280 | if ( mResourceManager ) { |
277 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 281 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
278 | mResourceView->updateView(); | 282 | mResourceView->updateView(); |
279 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 283 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
280 | SLOT( updateView() ) ); | 284 | SLOT( updateView() ) ); |
281 | } else { | 285 | } else { |
282 | mResourceView = 0; | 286 | mResourceView = 0; |
283 | } | 287 | } |
284 | #endif | 288 | #endif |
285 | QWidget *rightBox = new QWidget( mPanner ); | 289 | QWidget *rightBox = new QWidget( mPanner ); |
286 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 290 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
287 | 291 | ||
288 | mRightFrame = new QWidgetStack( rightBox ); | 292 | mRightFrame = new QWidgetStack( rightBox ); |
289 | rightLayout->addWidget( mRightFrame, 1 ); | 293 | rightLayout->addWidget( mRightFrame, 1 ); |
290 | 294 | ||
291 | mLeftFrame = mLeftSplitter; | 295 | mLeftFrame = mLeftSplitter; |
292 | #else | 296 | #else |
293 | QWidget *mainBox = new QWidget( this ); | 297 | QWidget *mainBox = new QWidget( this ); |
294 | QWidget *leftFrame = new QWidget( mainBox ); | 298 | QWidget *leftFrame = new QWidget( mainBox ); |
295 | 299 | ||
296 | QBoxLayout * mainBoxLayout; | 300 | QBoxLayout * mainBoxLayout; |
297 | QBoxLayout * leftFrameLayout; | 301 | QBoxLayout * leftFrameLayout; |
298 | if ( KOPrefs::instance()->mVerticalScreen ) { | 302 | if ( KOPrefs::instance()->mVerticalScreen ) { |
299 | mainBoxLayout = new QVBoxLayout(mainBox); | 303 | mainBoxLayout = new QVBoxLayout(mainBox); |
300 | leftFrameLayout = new QHBoxLayout(leftFrame ); | 304 | leftFrameLayout = new QHBoxLayout(leftFrame ); |
301 | } else { | 305 | } else { |
302 | mainBoxLayout = new QHBoxLayout(mainBox); | 306 | mainBoxLayout = new QHBoxLayout(mainBox); |
303 | leftFrameLayout = new QVBoxLayout(leftFrame ); | 307 | leftFrameLayout = new QVBoxLayout(leftFrame ); |
304 | } | 308 | } |
305 | topLayout->addWidget( mainBox ); | 309 | topLayout->addWidget( mainBox ); |
306 | mainBoxLayout->addWidget (leftFrame); | 310 | mainBoxLayout->addWidget (leftFrame); |
307 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, | 311 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, |
308 | "CalendarView::DateNavigator", QDate::currentDate()); | 312 | "CalendarView::DateNavigator", QDate::currentDate()); |
309 | // mDateNavigator->blockSignals( true ); | 313 | // mDateNavigator->blockSignals( true ); |
310 | leftFrameLayout->addWidget( mDateNavigator ); | 314 | leftFrameLayout->addWidget( mDateNavigator ); |
311 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); | 315 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); |
312 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); | 316 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); |
313 | mTodoList->setNavigator( mNavigator ); | 317 | mTodoList->setNavigator( mNavigator ); |
314 | 318 | ||
315 | if ( QApplication::desktop()->width() < 480 ) { | 319 | if ( QApplication::desktop()->width() < 480 ) { |
316 | leftFrameLayout->addWidget(mFilterView); | 320 | leftFrameLayout->addWidget(mFilterView); |
317 | leftFrameLayout->addWidget(mTodoList, 2 ); | 321 | leftFrameLayout->addWidget(mTodoList, 2 ); |
318 | 322 | ||
319 | } else { | 323 | } else { |
320 | leftFrameLayout->addWidget(mTodoList,2 ); | 324 | leftFrameLayout->addWidget(mTodoList,2 ); |
321 | leftFrameLayout->addWidget(mFilterView ); | 325 | leftFrameLayout->addWidget(mFilterView ); |
322 | } | 326 | } |
323 | mFilterView->hide(); | 327 | mFilterView->hide(); |
324 | QWidget *rightBox = new QWidget( mainBox ); | 328 | QWidget *rightBox = new QWidget( mainBox ); |
325 | mainBoxLayout->addWidget ( rightBox, 10 ); | 329 | mainBoxLayout->addWidget ( rightBox, 10 ); |
326 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 330 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
327 | mRightFrame = new QWidgetStack( rightBox ); | 331 | mRightFrame = new QWidgetStack( rightBox ); |
328 | rightLayout->addWidget( mRightFrame, 10 ); | 332 | rightLayout->addWidget( mRightFrame, 10 ); |
329 | 333 | ||
330 | mLeftFrame = leftFrame; | 334 | mLeftFrame = leftFrame; |
331 | if ( KOPrefs::instance()->mVerticalScreen ) { | 335 | if ( KOPrefs::instance()->mVerticalScreen ) { |
332 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 336 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
333 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 337 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
334 | } else { | 338 | } else { |
335 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 339 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
336 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 340 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
337 | } | 341 | } |
338 | if ( !KOPrefs::instance()->mShowDateNavigator) | 342 | if ( !KOPrefs::instance()->mShowDateNavigator) |
339 | mDateNavigator->hide(); | 343 | mDateNavigator->hide(); |
340 | //qDebug("Calendarview Size %d %d ", width(), height()); | 344 | //qDebug("Calendarview Size %d %d ", width(), height()); |
341 | #endif | 345 | #endif |
342 | 346 | ||
343 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 347 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
344 | SLOT( showDates( const KCal::DateList & ) ) ); | 348 | SLOT( showDates( const KCal::DateList & ) ) ); |
345 | 349 | ||
346 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 350 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
347 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 351 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
348 | 352 | ||
349 | 353 | ||
350 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 354 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
351 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 355 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
352 | 356 | ||
353 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 357 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
354 | mNavigator, SLOT( selectPreviousYear() ) ); | 358 | mNavigator, SLOT( selectPreviousYear() ) ); |
355 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 359 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
356 | mNavigator, SLOT( selectNextYear() ) ); | 360 | mNavigator, SLOT( selectNextYear() ) ); |
357 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 361 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
358 | mNavigator, SLOT( selectPreviousMonth() ) ); | 362 | mNavigator, SLOT( selectPreviousMonth() ) ); |
359 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 363 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
360 | mNavigator, SLOT( selectNextMonth() ) ); | 364 | mNavigator, SLOT( selectNextMonth() ) ); |
361 | 365 | ||
362 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 366 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
363 | mNavigator, SLOT( selectPrevious() ) ); | 367 | mNavigator, SLOT( selectPrevious() ) ); |
364 | connect( mDateNavigator, SIGNAL( goNext() ), | 368 | connect( mDateNavigator, SIGNAL( goNext() ), |
365 | mNavigator, SLOT( selectNext() ) ); | 369 | mNavigator, SLOT( selectNext() ) ); |
366 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 370 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
367 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 371 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
368 | 372 | ||
369 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 373 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
370 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 374 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
371 | 375 | ||
372 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), | 376 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), |
373 | SLOT( eventAdded( Event *) ) ); | 377 | SLOT( eventAdded( Event *) ) ); |
374 | 378 | ||
375 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 379 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
376 | 380 | ||
377 | connect( this, SIGNAL( configChanged() ), | 381 | connect( this, SIGNAL( configChanged() ), |
378 | mDateNavigator, SLOT( updateConfig() ) ); | 382 | mDateNavigator, SLOT( updateConfig() ) ); |
379 | 383 | ||
380 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 384 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
381 | SLOT( newTodo() ) ); | 385 | SLOT( newTodo() ) ); |
382 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 386 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
383 | SLOT( newSubTodo( Todo * ) ) ); | 387 | SLOT( newSubTodo( Todo * ) ) ); |
384 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 388 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
385 | SLOT( editTodo( Todo * ) ) ); | 389 | SLOT( editTodo( Todo * ) ) ); |
386 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 390 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
387 | SLOT( showTodo( Todo *) ) ); | 391 | SLOT( showTodo( Todo *) ) ); |
388 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 392 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
389 | SLOT( deleteTodo( Todo *) ) ); | 393 | SLOT( deleteTodo( Todo *) ) ); |
390 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 394 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
391 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 395 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
392 | SLOT( purgeCompleted() ) ); | 396 | SLOT( purgeCompleted() ) ); |
393 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 397 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
394 | SIGNAL( todoModified( Todo *, int ) ) ); | 398 | SIGNAL( todoModified( Todo *, int ) ) ); |
395 | 399 | ||
396 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 400 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
397 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 401 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
398 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 402 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
399 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 403 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
400 | 404 | ||
401 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 405 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
402 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 406 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
403 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 407 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
404 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 408 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
405 | 409 | ||
406 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 410 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
407 | this, SLOT ( todo_unsub( Todo * ) ) ); | 411 | this, SLOT ( todo_unsub( Todo * ) ) ); |
408 | 412 | ||
409 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 413 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
410 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 414 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
411 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 415 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
412 | SLOT( updateTodo( Todo *, int ) ) ); | 416 | SLOT( updateTodo( Todo *, int ) ) ); |
413 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 417 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
414 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 418 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
415 | 419 | ||
416 | 420 | ||
417 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 421 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
418 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 422 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
419 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 423 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
420 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 424 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
421 | 425 | ||
422 | 426 | ||
423 | 427 | ||
424 | 428 | ||
425 | 429 | ||
426 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 430 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
427 | SLOT(checkClipboard())); | 431 | SLOT(checkClipboard())); |
@@ -2431,548 +2435,562 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | |||
2431 | while ( incidence ) { | 2435 | while ( incidence ) { |
2432 | Incidence *in = incidence->clone(); | 2436 | Incidence *in = incidence->clone(); |
2433 | if ( ! in->summary().isEmpty() ) { | 2437 | if ( ! in->summary().isEmpty() ) { |
2434 | in->setDescription(""); | 2438 | in->setDescription(""); |
2435 | } else { | 2439 | } else { |
2436 | in->setSummary( in->description().left(20)); | 2440 | in->setSummary( in->description().left(20)); |
2437 | in->setDescription(""); | 2441 | in->setDescription(""); |
2438 | } | 2442 | } |
2439 | if ( addText ) | 2443 | if ( addText ) |
2440 | description += in->summary() + "\n"; | 2444 | description += in->summary() + "\n"; |
2441 | cal->addIncidence( in ); | 2445 | cal->addIncidence( in ); |
2442 | incidence = delSel.next(); | 2446 | incidence = delSel.next(); |
2443 | } | 2447 | } |
2444 | if ( beamDialog->beamVcal() ) { | 2448 | if ( beamDialog->beamVcal() ) { |
2445 | fn += ".vcs"; | 2449 | fn += ".vcs"; |
2446 | FileStorage storage( cal, fn, new VCalFormat ); | 2450 | FileStorage storage( cal, fn, new VCalFormat ); |
2447 | storage.save(); | 2451 | storage.save(); |
2448 | } else { | 2452 | } else { |
2449 | fn += ".ics"; | 2453 | fn += ".ics"; |
2450 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 2454 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2451 | storage.save(); | 2455 | storage.save(); |
2452 | } | 2456 | } |
2453 | delete cal; | 2457 | delete cal; |
2454 | mes = i18n("KO/Pi: Ready for beaming"); | 2458 | mes = i18n("KO/Pi: Ready for beaming"); |
2455 | topLevelWidget()->setCaption(mes); | 2459 | topLevelWidget()->setCaption(mes); |
2456 | KApplication::convert2latin1( fn ); | 2460 | KApplication::convert2latin1( fn ); |
2457 | #ifndef DESKTOP_VERSION | 2461 | #ifndef DESKTOP_VERSION |
2458 | Ir *ir = new Ir( this ); | 2462 | Ir *ir = new Ir( this ); |
2459 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2463 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2460 | ir->send( fn, description, "text/x-vCalendar" ); | 2464 | ir->send( fn, description, "text/x-vCalendar" ); |
2461 | #endif | 2465 | #endif |
2462 | } | 2466 | } |
2463 | } | 2467 | } |
2464 | void CalendarView::beamDone( Ir *ir ) | 2468 | void CalendarView::beamDone( Ir *ir ) |
2465 | { | 2469 | { |
2466 | #ifndef DESKTOP_VERSION | 2470 | #ifndef DESKTOP_VERSION |
2467 | delete ir; | 2471 | delete ir; |
2468 | #endif | 2472 | #endif |
2469 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 2473 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
2470 | topLevelWidget()->raise(); | 2474 | topLevelWidget()->raise(); |
2471 | } | 2475 | } |
2472 | 2476 | ||
2473 | void CalendarView::moveIncidence(Incidence * inc ) | 2477 | void CalendarView::moveIncidence(Incidence * inc ) |
2474 | { | 2478 | { |
2475 | if ( !inc ) return; | 2479 | if ( !inc ) return; |
2476 | showDatePickerPopup(); | 2480 | showDatePickerPopup(); |
2477 | mDatePickerMode = 2; | 2481 | mDatePickerMode = 2; |
2478 | mMoveIncidence = inc ; | 2482 | mMoveIncidence = inc ; |
2479 | QDate da; | 2483 | QDate da; |
2480 | if ( mMoveIncidence->type() == "Todo" ) { | 2484 | if ( mMoveIncidence->type() == "Todo" ) { |
2481 | Todo * to = (Todo *) mMoveIncidence; | 2485 | Todo * to = (Todo *) mMoveIncidence; |
2482 | if ( to->hasDueDate() ) | 2486 | if ( to->hasDueDate() ) |
2483 | da = to->dtDue().date(); | 2487 | da = to->dtDue().date(); |
2484 | else | 2488 | else |
2485 | da = QDate::currentDate(); | 2489 | da = QDate::currentDate(); |
2486 | } else { | 2490 | } else { |
2487 | da = mMoveIncidence->dtStart().date(); | 2491 | da = mMoveIncidence->dtStart().date(); |
2488 | } | 2492 | } |
2489 | //PENDING set date for recurring incidence to date of recurrence | 2493 | //PENDING set date for recurring incidence to date of recurrence |
2490 | //mMoveIncidenceOldDate; | 2494 | //mMoveIncidenceOldDate; |
2491 | mDatePicker->setDate( da ); | 2495 | mDatePicker->setDate( da ); |
2492 | } | 2496 | } |
2493 | void CalendarView::showDatePickerPopup() | 2497 | void CalendarView::showDatePickerPopup() |
2494 | { | 2498 | { |
2495 | if ( mDateFrame->isVisible() ) | 2499 | if ( mDateFrame->isVisible() ) |
2496 | mDateFrame->hide(); | 2500 | mDateFrame->hide(); |
2497 | else { | 2501 | else { |
2498 | int offX = 0, offY = 0; | 2502 | int offX = 0, offY = 0; |
2499 | #ifdef DESKTOP_VERSION | 2503 | #ifdef DESKTOP_VERSION |
2500 | int w =mDatePicker->sizeHint().width() ; | 2504 | int w =mDatePicker->sizeHint().width() ; |
2501 | int h = mDatePicker->sizeHint().height() ; | 2505 | int h = mDatePicker->sizeHint().height() ; |
2502 | int dw = topLevelWidget()->width(); | 2506 | int dw = topLevelWidget()->width(); |
2503 | int dh = topLevelWidget()->height(); | 2507 | int dh = topLevelWidget()->height(); |
2504 | offX = topLevelWidget()->x(); | 2508 | offX = topLevelWidget()->x(); |
2505 | offY = topLevelWidget()->y(); | 2509 | offY = topLevelWidget()->y(); |
2506 | #else | 2510 | #else |
2507 | int w =mDatePicker->sizeHint().width() ; | 2511 | int w =mDatePicker->sizeHint().width() ; |
2508 | int h = mDatePicker->sizeHint().height() ; | 2512 | int h = mDatePicker->sizeHint().height() ; |
2509 | int dw = QApplication::desktop()->width(); | 2513 | int dw = QApplication::desktop()->width(); |
2510 | int dh = QApplication::desktop()->height(); | 2514 | int dh = QApplication::desktop()->height(); |
2511 | #endif | 2515 | #endif |
2512 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); | 2516 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); |
2513 | mDateFrame->show(); | 2517 | mDateFrame->show(); |
2514 | } | 2518 | } |
2515 | } | 2519 | } |
2516 | void CalendarView::showDatePicker( ) | 2520 | void CalendarView::showDatePicker( ) |
2517 | { | 2521 | { |
2518 | showDatePickerPopup(); | 2522 | showDatePickerPopup(); |
2519 | mDatePickerMode = 1; | 2523 | mDatePickerMode = 1; |
2520 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 2524 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
2521 | } | 2525 | } |
2522 | 2526 | ||
2523 | void CalendarView::showEventEditor() | 2527 | void CalendarView::showEventEditor() |
2524 | { | 2528 | { |
2525 | #ifdef DESKTOP_VERSION | 2529 | #ifdef DESKTOP_VERSION |
2526 | mEventEditor->show(); | 2530 | mEventEditor->show(); |
2527 | #else | 2531 | #else |
2528 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { | 2532 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { |
2529 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2533 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2530 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); | 2534 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); |
2531 | qApp->processEvents(); | 2535 | qApp->processEvents(); |
2532 | delete mEventEditor; | 2536 | delete mEventEditor; |
2533 | mEventEditor = mDialogManager->getEventEditor(); | 2537 | mEventEditor = mDialogManager->getEventEditor(); |
2534 | topLevelWidget()->setCaption( i18n("") ); | 2538 | topLevelWidget()->setCaption( i18n("") ); |
2535 | } | 2539 | } |
2536 | mEventEditor->showMaximized(); | 2540 | mEventEditor->showMaximized(); |
2537 | #endif | 2541 | #endif |
2538 | } | 2542 | } |
2539 | void CalendarView::showTodoEditor() | 2543 | void CalendarView::showTodoEditor() |
2540 | { | 2544 | { |
2541 | #ifdef DESKTOP_VERSION | 2545 | #ifdef DESKTOP_VERSION |
2542 | mTodoEditor->show(); | 2546 | mTodoEditor->show(); |
2543 | #else | 2547 | #else |
2544 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { | 2548 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { |
2545 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2549 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2546 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); | 2550 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); |
2547 | qApp->processEvents(); | 2551 | qApp->processEvents(); |
2548 | delete mTodoEditor; | 2552 | delete mTodoEditor; |
2549 | mTodoEditor = mDialogManager->getTodoEditor(); | 2553 | mTodoEditor = mDialogManager->getTodoEditor(); |
2550 | topLevelWidget()->setCaption( i18n("") ); | 2554 | topLevelWidget()->setCaption( i18n("") ); |
2551 | } | 2555 | } |
2552 | mTodoEditor->showMaximized(); | 2556 | mTodoEditor->showMaximized(); |
2553 | #endif | 2557 | #endif |
2554 | } | 2558 | } |
2555 | 2559 | ||
2556 | void CalendarView::cloneIncidence() | 2560 | void CalendarView::cloneIncidence() |
2557 | { | 2561 | { |
2558 | Incidence *incidence = currentSelection(); | 2562 | Incidence *incidence = currentSelection(); |
2559 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2563 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2560 | if ( incidence ) { | 2564 | if ( incidence ) { |
2561 | cloneIncidence(incidence); | 2565 | cloneIncidence(incidence); |
2562 | } | 2566 | } |
2563 | } | 2567 | } |
2564 | void CalendarView::moveIncidence() | 2568 | void CalendarView::moveIncidence() |
2565 | { | 2569 | { |
2566 | Incidence *incidence = currentSelection(); | 2570 | Incidence *incidence = currentSelection(); |
2567 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2571 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2568 | if ( incidence ) { | 2572 | if ( incidence ) { |
2569 | moveIncidence(incidence); | 2573 | moveIncidence(incidence); |
2570 | } | 2574 | } |
2571 | } | 2575 | } |
2572 | void CalendarView::beamIncidence() | 2576 | void CalendarView::beamIncidence() |
2573 | { | 2577 | { |
2574 | Incidence *incidence = currentSelection(); | 2578 | Incidence *incidence = currentSelection(); |
2575 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2579 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2576 | if ( incidence ) { | 2580 | if ( incidence ) { |
2577 | beamIncidence(incidence); | 2581 | beamIncidence(incidence); |
2578 | } | 2582 | } |
2579 | } | 2583 | } |
2580 | void CalendarView::toggleCancelIncidence() | 2584 | void CalendarView::toggleCancelIncidence() |
2581 | { | 2585 | { |
2582 | Incidence *incidence = currentSelection(); | 2586 | Incidence *incidence = currentSelection(); |
2583 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2587 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2584 | if ( incidence ) { | 2588 | if ( incidence ) { |
2585 | cancelIncidence(incidence); | 2589 | cancelIncidence(incidence); |
2586 | } | 2590 | } |
2587 | } | 2591 | } |
2588 | 2592 | ||
2589 | 2593 | ||
2590 | void CalendarView::cancelIncidence(Incidence * inc ) | 2594 | void CalendarView::cancelIncidence(Incidence * inc ) |
2591 | { | 2595 | { |
2592 | inc->setCancelled( ! inc->cancelled() ); | 2596 | inc->setCancelled( ! inc->cancelled() ); |
2593 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 2597 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
2594 | updateView(); | 2598 | updateView(); |
2595 | } | 2599 | } |
2596 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 2600 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
2597 | { | 2601 | { |
2598 | Incidence * newInc = orgInc->clone(); | 2602 | Incidence * newInc = orgInc->clone(); |
2599 | newInc->recreate(); | 2603 | newInc->recreate(); |
2600 | 2604 | ||
2601 | if ( newInc->type() == "Todo" ) { | 2605 | if ( newInc->type() == "Todo" ) { |
2602 | Todo* t = (Todo*) newInc; | 2606 | Todo* t = (Todo*) newInc; |
2603 | showTodoEditor(); | 2607 | showTodoEditor(); |
2604 | mTodoEditor->editTodo( t ); | 2608 | mTodoEditor->editTodo( t ); |
2605 | if ( mTodoEditor->exec() ) { | 2609 | if ( mTodoEditor->exec() ) { |
2606 | mCalendar->addTodo( t ); | 2610 | mCalendar->addTodo( t ); |
2607 | updateView(); | 2611 | updateView(); |
2608 | } else { | 2612 | } else { |
2609 | delete t; | 2613 | delete t; |
2610 | } | 2614 | } |
2611 | } | 2615 | } |
2612 | else { | 2616 | else { |
2613 | Event* e = (Event*) newInc; | 2617 | Event* e = (Event*) newInc; |
2614 | showEventEditor(); | 2618 | showEventEditor(); |
2615 | mEventEditor->editEvent( e ); | 2619 | mEventEditor->editEvent( e ); |
2616 | if ( mEventEditor->exec() ) { | 2620 | if ( mEventEditor->exec() ) { |
2617 | mCalendar->addEvent( e ); | 2621 | mCalendar->addEvent( e ); |
2618 | updateView(); | 2622 | updateView(); |
2619 | } else { | 2623 | } else { |
2620 | delete e; | 2624 | delete e; |
2621 | } | 2625 | } |
2622 | } | 2626 | } |
2627 | setActiveWindow(); | ||
2623 | } | 2628 | } |
2624 | 2629 | ||
2625 | void CalendarView::newEvent() | 2630 | void CalendarView::newEvent() |
2626 | { | 2631 | { |
2627 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 2632 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
2628 | KOAgendaView *aView = mViewManager->agendaView(); | 2633 | KOAgendaView *aView = mViewManager->agendaView(); |
2629 | if (aView) { | 2634 | if (aView) { |
2630 | if (aView->selectionStart().isValid()) { | 2635 | if (aView->selectionStart().isValid()) { |
2631 | if (aView->selectedIsAllDay()) { | 2636 | if (aView->selectedIsAllDay()) { |
2632 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 2637 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
2633 | } else { | 2638 | } else { |
2634 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 2639 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
2635 | } | 2640 | } |
2636 | return; | 2641 | return; |
2637 | } | 2642 | } |
2638 | } | 2643 | } |
2639 | 2644 | ||
2640 | QDate date = mNavigator->selectedDates().first(); | 2645 | QDate date = mNavigator->selectedDates().first(); |
2641 | QDateTime current = QDateTime::currentDateTime(); | 2646 | QDateTime current = QDateTime::currentDateTime(); |
2642 | if ( date <= current.date() ) { | 2647 | if ( date <= current.date() ) { |
2643 | int hour = current.time().hour() +1; | 2648 | int hour = current.time().hour() +1; |
2644 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 2649 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
2645 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2650 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2646 | } else | 2651 | } else |
2647 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 2652 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
2648 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 2653 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
2649 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2654 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2650 | } | 2655 | } |
2651 | 2656 | ||
2652 | void CalendarView::newEvent(QDateTime fh) | 2657 | void CalendarView::newEvent(QDateTime fh) |
2653 | { | 2658 | { |
2654 | newEvent(fh, | 2659 | newEvent(fh, |
2655 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 2660 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
2656 | } | 2661 | } |
2657 | 2662 | ||
2658 | void CalendarView::newEvent(QDate dt) | 2663 | void CalendarView::newEvent(QDate dt) |
2659 | { | 2664 | { |
2660 | newEvent(QDateTime(dt, QTime(0,0,0)), | 2665 | newEvent(QDateTime(dt, QTime(0,0,0)), |
2661 | QDateTime(dt, QTime(0,0,0)), true); | 2666 | QDateTime(dt, QTime(0,0,0)), true); |
2662 | } | 2667 | } |
2663 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) | 2668 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) |
2664 | { | 2669 | { |
2665 | newEvent(fromHint, toHint, false); | 2670 | newEvent(fromHint, toHint, false); |
2666 | } | 2671 | } |
2667 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 2672 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
2668 | { | 2673 | { |
2669 | 2674 | ||
2670 | showEventEditor(); | 2675 | showEventEditor(); |
2671 | mEventEditor->newEvent(fromHint,toHint,allDay); | 2676 | mEventEditor->newEvent(fromHint,toHint,allDay); |
2672 | if ( mFilterView->filtersEnabled() ) { | 2677 | if ( mFilterView->filtersEnabled() ) { |
2673 | CalFilter *filter = mFilterView->selectedFilter(); | 2678 | CalFilter *filter = mFilterView->selectedFilter(); |
2674 | if (filter && filter->showCategories()) { | 2679 | if (filter && filter->showCategories()) { |
2675 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 2680 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
2676 | } | 2681 | } |
2677 | if ( filter ) | 2682 | if ( filter ) |
2678 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 2683 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
2679 | } | 2684 | } |
2685 | mEventEditor->exec(); | ||
2686 | setActiveWindow(); | ||
2680 | } | 2687 | } |
2681 | void CalendarView::todoAdded(Todo * t) | 2688 | void CalendarView::todoAdded(Todo * t) |
2682 | { | 2689 | { |
2683 | 2690 | ||
2684 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 2691 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
2685 | updateTodoViews(); | 2692 | updateTodoViews(); |
2686 | } | 2693 | } |
2687 | void CalendarView::todoChanged(Todo * t) | 2694 | void CalendarView::todoChanged(Todo * t) |
2688 | { | 2695 | { |
2689 | emit todoModified( t, 4 ); | 2696 | emit todoModified( t, 4 ); |
2690 | // updateTodoViews(); | 2697 | // updateTodoViews(); |
2691 | } | 2698 | } |
2692 | void CalendarView::todoToBeDeleted(Todo *) | 2699 | void CalendarView::todoToBeDeleted(Todo *) |
2693 | { | 2700 | { |
2694 | //qDebug("todoToBeDeleted(Todo *) "); | 2701 | //qDebug("todoToBeDeleted(Todo *) "); |
2695 | updateTodoViews(); | 2702 | updateTodoViews(); |
2696 | } | 2703 | } |
2697 | void CalendarView::todoDeleted() | 2704 | void CalendarView::todoDeleted() |
2698 | { | 2705 | { |
2699 | //qDebug(" todoDeleted()"); | 2706 | //qDebug(" todoDeleted()"); |
2700 | updateTodoViews(); | 2707 | updateTodoViews(); |
2701 | } | 2708 | } |
2702 | 2709 | ||
2703 | 2710 | ||
2704 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) | 2711 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) |
2705 | { | 2712 | { |
2706 | showTodoEditor(); | 2713 | showTodoEditor(); |
2707 | mTodoEditor->newTodo(dt,0,allday); | 2714 | mTodoEditor->newTodo(dt,0,allday); |
2708 | if ( mFilterView->filtersEnabled() ) { | 2715 | if ( mFilterView->filtersEnabled() ) { |
2709 | CalFilter *filter = mFilterView->selectedFilter(); | 2716 | CalFilter *filter = mFilterView->selectedFilter(); |
2710 | if (filter && filter->showCategories()) { | 2717 | if (filter && filter->showCategories()) { |
2711 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 2718 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
2712 | } | 2719 | } |
2713 | if ( filter ) | 2720 | if ( filter ) |
2714 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 2721 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
2715 | } | 2722 | } |
2723 | mTodoEditor->exec(); | ||
2724 | setActiveWindow(); | ||
2716 | } | 2725 | } |
2717 | 2726 | ||
2718 | void CalendarView::newTodo() | 2727 | void CalendarView::newTodo() |
2719 | { | 2728 | { |
2720 | newTodoDateTime( QDateTime(),true ); | 2729 | newTodoDateTime( QDateTime(),true ); |
2721 | } | 2730 | } |
2722 | 2731 | ||
2723 | void CalendarView::newSubTodo() | 2732 | void CalendarView::newSubTodo() |
2724 | { | 2733 | { |
2725 | Todo *todo = selectedTodo(); | 2734 | Todo *todo = selectedTodo(); |
2726 | if ( todo ) newSubTodo( todo ); | 2735 | if ( todo ) newSubTodo( todo ); |
2727 | } | 2736 | } |
2728 | 2737 | ||
2729 | void CalendarView::newSubTodo(Todo *parentEvent) | 2738 | void CalendarView::newSubTodo(Todo *parentEvent) |
2730 | { | 2739 | { |
2731 | 2740 | ||
2732 | showTodoEditor(); | 2741 | showTodoEditor(); |
2733 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); | 2742 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); |
2743 | mTodoEditor->exec(); | ||
2744 | setActiveWindow(); | ||
2734 | } | 2745 | } |
2735 | 2746 | ||
2736 | void CalendarView::newFloatingEvent() | 2747 | void CalendarView::newFloatingEvent() |
2737 | { | 2748 | { |
2738 | DateList tmpList = mNavigator->selectedDates(); | 2749 | DateList tmpList = mNavigator->selectedDates(); |
2739 | QDate date = tmpList.first(); | 2750 | QDate date = tmpList.first(); |
2740 | 2751 | ||
2741 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 2752 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
2742 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 2753 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
2743 | } | 2754 | } |
2744 | 2755 | ||
2745 | 2756 | ||
2746 | void CalendarView::editEvent( Event *event ) | 2757 | void CalendarView::editEvent( Event *event ) |
2747 | { | 2758 | { |
2748 | 2759 | ||
2749 | if ( !event ) return; | 2760 | if ( !event ) return; |
2750 | if ( event->isReadOnly() ) { | 2761 | if ( event->isReadOnly() ) { |
2751 | showEvent( event ); | 2762 | showEvent( event ); |
2752 | return; | 2763 | return; |
2753 | } | 2764 | } |
2754 | showEventEditor(); | 2765 | showEventEditor(); |
2755 | mEventEditor->editEvent( event , mFlagEditDescription); | 2766 | mEventEditor->editEvent( event , mFlagEditDescription); |
2767 | mEventEditor->exec(); | ||
2768 | setActiveWindow(); | ||
2769 | |||
2756 | } | 2770 | } |
2757 | void CalendarView::editJournal( Journal *jour ) | 2771 | void CalendarView::editJournal( Journal *jour ) |
2758 | { | 2772 | { |
2759 | if ( !jour ) return; | 2773 | if ( !jour ) return; |
2760 | mDialogManager->hideSearchDialog(); | 2774 | mDialogManager->hideSearchDialog(); |
2761 | mViewManager->showJournalView(); | 2775 | mViewManager->showJournalView(); |
2762 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 2776 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
2763 | } | 2777 | } |
2764 | void CalendarView::editTodo( Todo *todo ) | 2778 | void CalendarView::editTodo( Todo *todo ) |
2765 | { | 2779 | { |
2766 | if ( !todo ) return; | 2780 | if ( !todo ) return; |
2767 | 2781 | ||
2768 | if ( todo->isReadOnly() ) { | 2782 | if ( todo->isReadOnly() ) { |
2769 | showTodo( todo ); | 2783 | showTodo( todo ); |
2770 | return; | 2784 | return; |
2771 | } | 2785 | } |
2772 | showTodoEditor(); | 2786 | showTodoEditor(); |
2773 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 2787 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
2788 | mTodoEditor->exec(); | ||
2789 | setActiveWindow(); | ||
2774 | 2790 | ||
2775 | } | 2791 | } |
2776 | 2792 | ||
2777 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 2793 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
2778 | { | 2794 | { |
2779 | if ( !mEventViewerDialog ) { | 2795 | if ( !mEventViewerDialog ) { |
2780 | mEventViewerDialog = new KOEventViewerDialog(this); | 2796 | mEventViewerDialog = new KOEventViewerDialog(this); |
2781 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 2797 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
2782 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 2798 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
2783 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 2799 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
2784 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 2800 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
2785 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 2801 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
2786 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 2802 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
2803 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), | ||
2804 | this, SLOT( slotViewerClosed() ) ); | ||
2787 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), | 2805 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), |
2788 | this, SLOT( todoChanged(Todo *) ) ); | 2806 | this, SLOT( todoChanged(Todo *) ) ); |
2789 | mEventViewerDialog->resize( 640, 480 ); | 2807 | mEventViewerDialog->resize( 640, 480 ); |
2790 | 2808 | ||
2791 | } | 2809 | } |
2792 | return mEventViewerDialog; | 2810 | return mEventViewerDialog; |
2793 | } | 2811 | } |
2794 | void CalendarView::showEvent(Event *event) | 2812 | void CalendarView::showEvent(Event *event) |
2795 | { | 2813 | { |
2796 | getEventViewerDialog()->setEvent(event); | 2814 | getEventViewerDialog()->setEvent(event); |
2797 | getEventViewerDialog()->showMe(); | 2815 | getEventViewerDialog()->showMe(); |
2798 | } | 2816 | } |
2799 | 2817 | ||
2800 | void CalendarView::showTodo(Todo *event) | 2818 | void CalendarView::showTodo(Todo *event) |
2801 | { | 2819 | { |
2802 | getEventViewerDialog()->setTodo(event); | 2820 | getEventViewerDialog()->setTodo(event); |
2803 | getEventViewerDialog()->showMe(); | 2821 | getEventViewerDialog()->showMe(); |
2804 | } | 2822 | } |
2805 | void CalendarView::showJournal( Journal *jour ) | 2823 | void CalendarView::showJournal( Journal *jour ) |
2806 | { | 2824 | { |
2807 | getEventViewerDialog()->setJournal(jour); | 2825 | getEventViewerDialog()->setJournal(jour); |
2808 | getEventViewerDialog()->showMe(); | 2826 | getEventViewerDialog()->showMe(); |
2809 | 2827 | ||
2810 | } | 2828 | } |
2811 | // void CalendarView::todoModified (Todo *event, int changed) | 2829 | // void CalendarView::todoModified (Todo *event, int changed) |
2812 | // { | 2830 | // { |
2813 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 2831 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
2814 | // // kdDebug() << "Todo modified and open" << endl; | 2832 | // // kdDebug() << "Todo modified and open" << endl; |
2815 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 2833 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
2816 | // // temp->modified (changed); | 2834 | // // temp->modified (changed); |
2817 | 2835 | ||
2818 | // // } | 2836 | // // } |
2819 | 2837 | ||
2820 | // mViewManager->updateView(); | 2838 | // mViewManager->updateView(); |
2821 | // } | 2839 | // } |
2822 | 2840 | ||
2823 | void CalendarView::appointment_show() | 2841 | void CalendarView::appointment_show() |
2824 | { | 2842 | { |
2825 | Event *anEvent = 0; | 2843 | Event *anEvent = 0; |
2826 | 2844 | ||
2827 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2845 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2828 | 2846 | ||
2829 | if (mViewManager->currentView()->isEventView()) { | 2847 | if (mViewManager->currentView()->isEventView()) { |
2830 | if ( incidence && incidence->type() == "Event" ) { | 2848 | if ( incidence && incidence->type() == "Event" ) { |
2831 | anEvent = static_cast<Event *>(incidence); | 2849 | anEvent = static_cast<Event *>(incidence); |
2832 | } | 2850 | } |
2833 | } | 2851 | } |
2834 | 2852 | ||
2835 | if (!anEvent) { | 2853 | if (!anEvent) { |
2836 | KNotifyClient::beep(); | 2854 | KNotifyClient::beep(); |
2837 | return; | 2855 | return; |
2838 | } | 2856 | } |
2839 | 2857 | ||
2840 | showEvent(anEvent); | 2858 | showEvent(anEvent); |
2841 | } | 2859 | } |
2842 | 2860 | ||
2843 | void CalendarView::appointment_edit() | 2861 | void CalendarView::appointment_edit() |
2844 | { | 2862 | { |
2845 | Event *anEvent = 0; | 2863 | Event *anEvent = 0; |
2846 | 2864 | ||
2847 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2865 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2848 | 2866 | ||
2849 | if (mViewManager->currentView()->isEventView()) { | 2867 | if (mViewManager->currentView()->isEventView()) { |
2850 | if ( incidence && incidence->type() == "Event" ) { | 2868 | if ( incidence && incidence->type() == "Event" ) { |
2851 | anEvent = static_cast<Event *>(incidence); | 2869 | anEvent = static_cast<Event *>(incidence); |
2852 | } | 2870 | } |
2853 | } | 2871 | } |
2854 | 2872 | ||
2855 | if (!anEvent) { | 2873 | if (!anEvent) { |
2856 | KNotifyClient::beep(); | 2874 | KNotifyClient::beep(); |
2857 | return; | 2875 | return; |
2858 | } | 2876 | } |
2859 | 2877 | ||
2860 | editEvent(anEvent); | 2878 | editEvent(anEvent); |
2861 | } | 2879 | } |
2862 | 2880 | ||
2863 | void CalendarView::appointment_delete() | 2881 | void CalendarView::appointment_delete() |
2864 | { | 2882 | { |
2865 | Event *anEvent = 0; | 2883 | Event *anEvent = 0; |
2866 | 2884 | ||
2867 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2885 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2868 | 2886 | ||
2869 | if (mViewManager->currentView()->isEventView()) { | 2887 | if (mViewManager->currentView()->isEventView()) { |
2870 | if ( incidence && incidence->type() == "Event" ) { | 2888 | if ( incidence && incidence->type() == "Event" ) { |
2871 | anEvent = static_cast<Event *>(incidence); | 2889 | anEvent = static_cast<Event *>(incidence); |
2872 | } | 2890 | } |
2873 | } | 2891 | } |
2874 | 2892 | ||
2875 | if (!anEvent) { | 2893 | if (!anEvent) { |
2876 | KNotifyClient::beep(); | 2894 | KNotifyClient::beep(); |
2877 | return; | 2895 | return; |
2878 | } | 2896 | } |
2879 | 2897 | ||
2880 | deleteEvent(anEvent); | 2898 | deleteEvent(anEvent); |
2881 | } | 2899 | } |
2882 | 2900 | ||
2883 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 2901 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
2884 | { | 2902 | { |
2885 | if (!sub) return; | 2903 | if (!sub) return; |
2886 | if (!parent) return; | 2904 | if (!parent) return; |
2887 | if ( sub->relatedTo() ) | 2905 | if ( sub->relatedTo() ) |
2888 | sub->relatedTo()->removeRelation(sub); | 2906 | sub->relatedTo()->removeRelation(sub); |
2889 | sub->setRelatedTo(parent); | 2907 | sub->setRelatedTo(parent); |
2890 | sub->setRelatedToUid(parent->uid()); | 2908 | sub->setRelatedToUid(parent->uid()); |
2891 | parent->addRelation(sub); | 2909 | parent->addRelation(sub); |
2892 | sub->updated(); | 2910 | sub->updated(); |
2893 | parent->updated(); | 2911 | parent->updated(); |
2894 | setModified(true); | 2912 | setModified(true); |
2895 | updateView(); | 2913 | updateView(); |
2896 | } | 2914 | } |
2897 | void CalendarView::todo_unsub(Todo *anTodo ) | 2915 | void CalendarView::todo_unsub(Todo *anTodo ) |
2898 | { | 2916 | { |
2899 | // Todo *anTodo = selectedTodo(); | 2917 | // Todo *anTodo = selectedTodo(); |
2900 | if (!anTodo) return; | 2918 | if (!anTodo) return; |
2901 | if (!anTodo->relatedTo()) return; | 2919 | if (!anTodo->relatedTo()) return; |
2902 | anTodo->relatedTo()->removeRelation(anTodo); | 2920 | anTodo->relatedTo()->removeRelation(anTodo); |
2903 | anTodo->setRelatedTo(0); | 2921 | anTodo->setRelatedTo(0); |
2904 | anTodo->updated(); | 2922 | anTodo->updated(); |
2905 | anTodo->setRelatedToUid(""); | 2923 | anTodo->setRelatedToUid(""); |
2906 | setModified(true); | 2924 | setModified(true); |
2907 | updateView(); | 2925 | updateView(); |
2908 | } | 2926 | } |
2909 | 2927 | ||
2910 | void CalendarView::deleteTodo(Todo *todo) | 2928 | void CalendarView::deleteTodo(Todo *todo) |
2911 | { | 2929 | { |
2912 | if (!todo) { | 2930 | if (!todo) { |
2913 | KNotifyClient::beep(); | 2931 | KNotifyClient::beep(); |
2914 | return; | 2932 | return; |
2915 | } | 2933 | } |
2916 | if (KOPrefs::instance()->mConfirm) { | 2934 | if (KOPrefs::instance()->mConfirm) { |
2917 | QString text = todo->summary().left(20); | 2935 | QString text = todo->summary().left(20); |
2918 | if (!todo->relations().isEmpty()) { | 2936 | if (!todo->relations().isEmpty()) { |
2919 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); | 2937 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); |
2920 | 2938 | ||
2921 | } | 2939 | } |
2922 | switch (msgItemDelete(text)) { | 2940 | switch (msgItemDelete(text)) { |
2923 | case KMessageBox::Continue: // OK | 2941 | case KMessageBox::Continue: // OK |
2924 | bool deleteT = false; | 2942 | bool deleteT = false; |
2925 | if (!todo->relations().isEmpty()) { | 2943 | if (!todo->relations().isEmpty()) { |
2926 | deleteT = removeCompletedSubTodos( todo ); | 2944 | deleteT = removeCompletedSubTodos( todo ); |
2927 | } | 2945 | } |
2928 | // deleteT == true: todo already deleted in removeCompletedSubTodos | 2946 | // deleteT == true: todo already deleted in removeCompletedSubTodos |
2929 | if ( !deleteT ) { | 2947 | if ( !deleteT ) { |
2930 | checkExternalId( todo ); | 2948 | checkExternalId( todo ); |
2931 | calendar()->deleteTodo(todo); | 2949 | calendar()->deleteTodo(todo); |
2932 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 2950 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2933 | updateView(); | 2951 | updateView(); |
2934 | } | 2952 | } |
2935 | break; | 2953 | break; |
2936 | } // switch | 2954 | } // switch |
2937 | } else { | 2955 | } else { |
2938 | checkExternalId( todo ); | 2956 | checkExternalId( todo ); |
2939 | mCalendar->deleteTodo(todo); | 2957 | mCalendar->deleteTodo(todo); |
2940 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 2958 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2941 | updateView(); | 2959 | updateView(); |
2942 | } | 2960 | } |
2943 | 2961 | ||
2944 | emit updateSearchDialog(); | 2962 | emit updateSearchDialog(); |
2945 | } | 2963 | } |
2946 | void CalendarView::deleteJournal(Journal *jour) | 2964 | void CalendarView::deleteJournal(Journal *jour) |
2947 | { | 2965 | { |
2948 | if (!jour) { | 2966 | if (!jour) { |
2949 | KNotifyClient::beep(); | 2967 | KNotifyClient::beep(); |
2950 | return; | 2968 | return; |
2951 | } | 2969 | } |
2952 | if (KOPrefs::instance()->mConfirm) { | 2970 | if (KOPrefs::instance()->mConfirm) { |
2953 | switch (msgItemDelete( jour->description().left(20))) { | 2971 | switch (msgItemDelete( jour->description().left(20))) { |
2954 | case KMessageBox::Continue: // OK | 2972 | case KMessageBox::Continue: // OK |
2955 | calendar()->deleteJournal(jour); | 2973 | calendar()->deleteJournal(jour); |
2956 | updateView(); | 2974 | updateView(); |
2957 | break; | 2975 | break; |
2958 | } // switch | 2976 | } // switch |
2959 | } else { | 2977 | } else { |
2960 | calendar()->deleteJournal(jour);; | 2978 | calendar()->deleteJournal(jour);; |
2961 | updateView(); | 2979 | updateView(); |
2962 | } | 2980 | } |
2963 | emit updateSearchDialog(); | 2981 | emit updateSearchDialog(); |
2964 | } | 2982 | } |
2965 | 2983 | ||
2966 | void CalendarView::deleteEvent(Event *anEvent) | 2984 | void CalendarView::deleteEvent(Event *anEvent) |
2967 | { | 2985 | { |
2968 | if (!anEvent) { | 2986 | if (!anEvent) { |
2969 | KNotifyClient::beep(); | 2987 | KNotifyClient::beep(); |
2970 | return; | 2988 | return; |
2971 | } | 2989 | } |
2972 | 2990 | ||
2973 | if (anEvent->recurrence()->doesRecur()) { | 2991 | if (anEvent->recurrence()->doesRecur()) { |
2974 | QDate itemDate = mViewManager->currentSelectionDate(); | 2992 | QDate itemDate = mViewManager->currentSelectionDate(); |
2975 | int km; | 2993 | int km; |
2976 | if (!itemDate.isValid()) { | 2994 | if (!itemDate.isValid()) { |
2977 | //kdDebug() << "Date Not Valid" << endl; | 2995 | //kdDebug() << "Date Not Valid" << endl; |
2978 | if (KOPrefs::instance()->mConfirm) { | 2996 | if (KOPrefs::instance()->mConfirm) { |
@@ -3549,376 +3567,408 @@ void CalendarView::editFilters() | |||
3549 | } | 3567 | } |
3550 | 3568 | ||
3551 | mDialogManager->showFilterEditDialog(&mFilters); | 3569 | mDialogManager->showFilterEditDialog(&mFilters); |
3552 | } | 3570 | } |
3553 | void CalendarView::toggleFilter() | 3571 | void CalendarView::toggleFilter() |
3554 | { | 3572 | { |
3555 | showFilter(! mFilterView->isVisible()); | 3573 | showFilter(! mFilterView->isVisible()); |
3556 | } | 3574 | } |
3557 | 3575 | ||
3558 | KOFilterView *CalendarView::filterView() | 3576 | KOFilterView *CalendarView::filterView() |
3559 | { | 3577 | { |
3560 | return mFilterView; | 3578 | return mFilterView; |
3561 | } | 3579 | } |
3562 | void CalendarView::selectFilter( int fil ) | 3580 | void CalendarView::selectFilter( int fil ) |
3563 | { | 3581 | { |
3564 | mFilterView->setSelectedFilter( fil ); | 3582 | mFilterView->setSelectedFilter( fil ); |
3565 | } | 3583 | } |
3566 | void CalendarView::showFilter(bool visible) | 3584 | void CalendarView::showFilter(bool visible) |
3567 | { | 3585 | { |
3568 | if (visible) mFilterView->show(); | 3586 | if (visible) mFilterView->show(); |
3569 | else mFilterView->hide(); | 3587 | else mFilterView->hide(); |
3570 | } | 3588 | } |
3571 | void CalendarView::toggleFilerEnabled( ) | 3589 | void CalendarView::toggleFilerEnabled( ) |
3572 | { | 3590 | { |
3573 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 3591 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
3574 | if ( !mFilterView->filtersEnabled() ) | 3592 | if ( !mFilterView->filtersEnabled() ) |
3575 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 3593 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
3576 | 3594 | ||
3577 | } | 3595 | } |
3578 | void CalendarView::updateFilter() | 3596 | void CalendarView::updateFilter() |
3579 | { | 3597 | { |
3580 | CalFilter *filter = mFilterView->selectedFilter(); | 3598 | CalFilter *filter = mFilterView->selectedFilter(); |
3581 | if (filter) { | 3599 | if (filter) { |
3582 | if (mFilterView->filtersEnabled()) { | 3600 | if (mFilterView->filtersEnabled()) { |
3583 | topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); | 3601 | topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); |
3584 | filter->setEnabled(true); | 3602 | filter->setEnabled(true); |
3585 | } | 3603 | } |
3586 | else filter->setEnabled(false); | 3604 | else filter->setEnabled(false); |
3587 | mCalendar->setFilter(filter); | 3605 | mCalendar->setFilter(filter); |
3588 | updateView(); | 3606 | updateView(); |
3589 | } | 3607 | } |
3590 | } | 3608 | } |
3591 | 3609 | ||
3592 | void CalendarView::filterEdited() | 3610 | void CalendarView::filterEdited() |
3593 | { | 3611 | { |
3594 | mFilterView->updateFilters(); | 3612 | mFilterView->updateFilters(); |
3595 | updateFilter(); | 3613 | updateFilter(); |
3596 | writeSettings(); | 3614 | writeSettings(); |
3597 | } | 3615 | } |
3598 | 3616 | ||
3599 | 3617 | ||
3600 | void CalendarView::takeOverEvent() | 3618 | void CalendarView::takeOverEvent() |
3601 | { | 3619 | { |
3602 | Incidence *incidence = currentSelection(); | 3620 | Incidence *incidence = currentSelection(); |
3603 | 3621 | ||
3604 | if (!incidence) return; | 3622 | if (!incidence) return; |
3605 | 3623 | ||
3606 | incidence->setOrganizer(KOPrefs::instance()->email()); | 3624 | incidence->setOrganizer(KOPrefs::instance()->email()); |
3607 | incidence->recreate(); | 3625 | incidence->recreate(); |
3608 | incidence->setReadOnly(false); | 3626 | incidence->setReadOnly(false); |
3609 | 3627 | ||
3610 | updateView(); | 3628 | updateView(); |
3611 | } | 3629 | } |
3612 | 3630 | ||
3613 | void CalendarView::takeOverCalendar() | 3631 | void CalendarView::takeOverCalendar() |
3614 | { | 3632 | { |
3615 | // TODO: Create Calendar::allIncidences() function and use it here | 3633 | // TODO: Create Calendar::allIncidences() function and use it here |
3616 | 3634 | ||
3617 | QPtrList<Event> events = mCalendar->events(); | 3635 | QPtrList<Event> events = mCalendar->events(); |
3618 | for(uint i=0; i<events.count(); ++i) { | 3636 | for(uint i=0; i<events.count(); ++i) { |
3619 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3637 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3620 | events.at(i)->recreate(); | 3638 | events.at(i)->recreate(); |
3621 | events.at(i)->setReadOnly(false); | 3639 | events.at(i)->setReadOnly(false); |
3622 | } | 3640 | } |
3623 | 3641 | ||
3624 | QPtrList<Todo> todos = mCalendar->todos(); | 3642 | QPtrList<Todo> todos = mCalendar->todos(); |
3625 | for(uint i=0; i<todos.count(); ++i) { | 3643 | for(uint i=0; i<todos.count(); ++i) { |
3626 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3644 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3627 | todos.at(i)->recreate(); | 3645 | todos.at(i)->recreate(); |
3628 | todos.at(i)->setReadOnly(false); | 3646 | todos.at(i)->setReadOnly(false); |
3629 | } | 3647 | } |
3630 | 3648 | ||
3631 | QPtrList<Journal> journals = mCalendar->journals(); | 3649 | QPtrList<Journal> journals = mCalendar->journals(); |
3632 | for(uint i=0; i<journals.count(); ++i) { | 3650 | for(uint i=0; i<journals.count(); ++i) { |
3633 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3651 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3634 | journals.at(i)->recreate(); | 3652 | journals.at(i)->recreate(); |
3635 | journals.at(i)->setReadOnly(false); | 3653 | journals.at(i)->setReadOnly(false); |
3636 | } | 3654 | } |
3637 | 3655 | ||
3638 | updateView(); | 3656 | updateView(); |
3639 | } | 3657 | } |
3640 | 3658 | ||
3641 | void CalendarView::showIntro() | 3659 | void CalendarView::showIntro() |
3642 | { | 3660 | { |
3643 | kdDebug() << "To be implemented." << endl; | 3661 | kdDebug() << "To be implemented." << endl; |
3644 | } | 3662 | } |
3645 | 3663 | ||
3646 | QWidgetStack *CalendarView::viewStack() | 3664 | QWidgetStack *CalendarView::viewStack() |
3647 | { | 3665 | { |
3648 | return mRightFrame; | 3666 | return mRightFrame; |
3649 | } | 3667 | } |
3650 | 3668 | ||
3651 | QWidget *CalendarView::leftFrame() | 3669 | QWidget *CalendarView::leftFrame() |
3652 | { | 3670 | { |
3653 | return mLeftFrame; | 3671 | return mLeftFrame; |
3654 | } | 3672 | } |
3655 | 3673 | ||
3656 | DateNavigator *CalendarView::dateNavigator() | 3674 | DateNavigator *CalendarView::dateNavigator() |
3657 | { | 3675 | { |
3658 | return mNavigator; | 3676 | return mNavigator; |
3659 | } | 3677 | } |
3660 | 3678 | ||
3661 | KDateNavigator* CalendarView::dateNavigatorWidget() | 3679 | KDateNavigator* CalendarView::dateNavigatorWidget() |
3662 | { | 3680 | { |
3663 | return mDateNavigator; | 3681 | return mDateNavigator; |
3664 | } | 3682 | } |
3665 | void CalendarView::toggleDateNavigatorWidget() | 3683 | void CalendarView::toggleDateNavigatorWidget() |
3666 | { | 3684 | { |
3667 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; | 3685 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; |
3668 | if (!KOPrefs::instance()->mShowDateNavigator ) | 3686 | if (!KOPrefs::instance()->mShowDateNavigator ) |
3669 | mDateNavigator->hide(); | 3687 | mDateNavigator->hide(); |
3670 | else | 3688 | else |
3671 | mDateNavigator->show(); | 3689 | mDateNavigator->show(); |
3672 | } | 3690 | } |
3673 | void CalendarView::addView(KOrg::BaseView *view) | 3691 | void CalendarView::addView(KOrg::BaseView *view) |
3674 | { | 3692 | { |
3675 | mViewManager->addView(view); | 3693 | mViewManager->addView(view); |
3676 | } | 3694 | } |
3677 | 3695 | ||
3678 | void CalendarView::showView(KOrg::BaseView *view) | 3696 | void CalendarView::showView(KOrg::BaseView *view) |
3679 | { | 3697 | { |
3680 | mViewManager->showView(view, mLeftFrame->isVisible()); | 3698 | mViewManager->showView(view, mLeftFrame->isVisible()); |
3681 | } | 3699 | } |
3682 | 3700 | ||
3683 | Incidence *CalendarView::currentSelection() | 3701 | Incidence *CalendarView::currentSelection() |
3684 | { | 3702 | { |
3685 | return mViewManager->currentSelection(); | 3703 | return mViewManager->currentSelection(); |
3686 | } | 3704 | } |
3687 | void CalendarView::toggleAllDaySize() | 3705 | void CalendarView::toggleAllDaySize() |
3688 | { | 3706 | { |
3689 | /* | 3707 | /* |
3690 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 3708 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
3691 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; | 3709 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; |
3692 | else | 3710 | else |
3693 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 3711 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
3694 | */ | 3712 | */ |
3695 | viewManager()->agendaView()->toggleAllDay(); | 3713 | viewManager()->agendaView()->toggleAllDay(); |
3696 | } | 3714 | } |
3697 | void CalendarView::toggleExpand() | 3715 | void CalendarView::toggleExpand() |
3698 | { | 3716 | { |
3699 | // if ( mLeftFrame->isHidden() ) { | 3717 | // if ( mLeftFrame->isHidden() ) { |
3700 | // mLeftFrame->show(); | 3718 | // mLeftFrame->show(); |
3701 | // emit calendarViewExpanded( false ); | 3719 | // emit calendarViewExpanded( false ); |
3702 | // } else { | 3720 | // } else { |
3703 | // mLeftFrame->hide(); | 3721 | // mLeftFrame->hide(); |
3704 | // emit calendarViewExpanded( true ); | 3722 | // emit calendarViewExpanded( true ); |
3705 | // } | 3723 | // } |
3706 | //qDebug(" CalendarView::toggleExpand()"); | 3724 | //qDebug(" CalendarView::toggleExpand()"); |
3707 | globalFlagBlockAgenda = 1; | 3725 | globalFlagBlockAgenda = 1; |
3708 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 3726 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
3709 | globalFlagBlockAgenda = 5; | 3727 | globalFlagBlockAgenda = 5; |
3710 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 3728 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
3711 | //mViewManager->showView( 0, true ); | 3729 | //mViewManager->showView( 0, true ); |
3712 | } | 3730 | } |
3713 | 3731 | ||
3714 | void CalendarView::calendarModified( bool modified, Calendar * ) | 3732 | void CalendarView::calendarModified( bool modified, Calendar * ) |
3715 | { | 3733 | { |
3716 | setModified( modified ); | 3734 | setModified( modified ); |
3717 | } | 3735 | } |
3718 | 3736 | ||
3719 | Todo *CalendarView::selectedTodo() | 3737 | Todo *CalendarView::selectedTodo() |
3720 | { | 3738 | { |
3721 | Incidence *incidence = currentSelection(); | 3739 | Incidence *incidence = currentSelection(); |
3722 | if ( incidence && incidence->type() == "Todo" ) { | 3740 | if ( incidence && incidence->type() == "Todo" ) { |
3723 | return static_cast<Todo *>( incidence ); | 3741 | return static_cast<Todo *>( incidence ); |
3724 | } | 3742 | } |
3725 | 3743 | ||
3726 | incidence = mTodoList->selectedIncidences().first(); | 3744 | incidence = mTodoList->selectedIncidences().first(); |
3727 | if ( incidence && incidence->type() == "Todo" ) { | 3745 | if ( incidence && incidence->type() == "Todo" ) { |
3728 | return static_cast<Todo *>( incidence ); | 3746 | return static_cast<Todo *>( incidence ); |
3729 | } | 3747 | } |
3730 | 3748 | ||
3731 | return 0; | 3749 | return 0; |
3732 | } | 3750 | } |
3733 | 3751 | ||
3734 | void CalendarView::dialogClosing(Incidence *in) | 3752 | void CalendarView::dialogClosing(Incidence *in) |
3735 | { | 3753 | { |
3736 | // mDialogList.remove(in); | 3754 | // mDialogList.remove(in); |
3737 | } | 3755 | } |
3738 | 3756 | ||
3739 | void CalendarView::showIncidence() | 3757 | void CalendarView::showIncidence() |
3740 | { | 3758 | { |
3759 | mViewerCallerIsSearchDialog = false; | ||
3741 | Incidence *incidence = currentSelection(); | 3760 | Incidence *incidence = currentSelection(); |
3742 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3761 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3743 | if ( incidence ) { | 3762 | if ( incidence ) { |
3744 | ShowIncidenceVisitor v; | 3763 | ShowIncidenceVisitor v; |
3745 | v.act( incidence, this ); | 3764 | v.act( incidence, this ); |
3746 | } | 3765 | } |
3747 | } | 3766 | } |
3748 | void CalendarView::editIncidenceDescription() | 3767 | void CalendarView::editIncidenceDescription() |
3749 | { | 3768 | { |
3750 | mFlagEditDescription = true; | 3769 | mFlagEditDescription = true; |
3751 | editIncidence(); | 3770 | editIncidence(); |
3752 | mFlagEditDescription = false; | 3771 | mFlagEditDescription = false; |
3753 | } | 3772 | } |
3754 | void CalendarView::editIncidence() | 3773 | void CalendarView::editIncidence() |
3755 | { | 3774 | { |
3756 | // qDebug("editIncidence() "); | 3775 | // qDebug("editIncidence() "); |
3757 | Incidence *incidence = currentSelection(); | 3776 | Incidence *incidence = currentSelection(); |
3758 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3777 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3759 | if ( incidence ) { | 3778 | if ( incidence ) { |
3760 | EditIncidenceVisitor v; | 3779 | EditIncidenceVisitor v; |
3761 | v.act( incidence, this ); | 3780 | v.act( incidence, this ); |
3762 | } | 3781 | } |
3763 | } | 3782 | } |
3764 | 3783 | ||
3765 | void CalendarView::deleteIncidence() | 3784 | void CalendarView::deleteIncidence() |
3766 | { | 3785 | { |
3767 | Incidence *incidence = currentSelection(); | 3786 | Incidence *incidence = currentSelection(); |
3768 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3787 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3769 | if ( incidence ) { | 3788 | if ( incidence ) { |
3770 | deleteIncidence(incidence); | 3789 | deleteIncidence(incidence); |
3771 | } | 3790 | } |
3772 | } | 3791 | } |
3773 | 3792 | ||
3774 | void CalendarView::showIncidence(Incidence *incidence) | 3793 | void CalendarView::showIncidence(Incidence *incidence) |
3775 | { | 3794 | { |
3795 | mViewerCallerIsSearchDialog = false; | ||
3796 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); | ||
3797 | if ( sender() && mDialogManager->getSearchDialog() ) { | ||
3798 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { | ||
3799 | mViewerCallerIsSearchDialog = true; | ||
3800 | } | ||
3801 | } | ||
3776 | if ( incidence ) { | 3802 | if ( incidence ) { |
3777 | ShowIncidenceVisitor v; | 3803 | ShowIncidenceVisitor v; |
3778 | v.act( incidence, this ); | 3804 | v.act( incidence, this ); |
3779 | } | 3805 | } |
3780 | } | 3806 | } |
3781 | 3807 | ||
3782 | void CalendarView::editIncidence(Incidence *incidence) | 3808 | void CalendarView::editIncidence(Incidence *incidence) |
3783 | { | 3809 | { |
3784 | if ( incidence ) { | 3810 | if ( incidence ) { |
3785 | 3811 | ||
3786 | EditIncidenceVisitor v; | 3812 | EditIncidenceVisitor v; |
3787 | v.act( incidence, this ); | 3813 | v.act( incidence, this ); |
3788 | 3814 | ||
3789 | } | 3815 | } |
3790 | } | 3816 | } |
3791 | 3817 | ||
3792 | void CalendarView::deleteIncidence(Incidence *incidence) | 3818 | void CalendarView::deleteIncidence(Incidence *incidence) |
3793 | { | 3819 | { |
3794 | //qDebug(" CalendarView::deleteIncidence "); | 3820 | //qDebug(" CalendarView::deleteIncidence "); |
3795 | if ( incidence ) { | 3821 | if ( incidence ) { |
3796 | DeleteIncidenceVisitor v; | 3822 | DeleteIncidenceVisitor v; |
3797 | v.act( incidence, this ); | 3823 | v.act( incidence, this ); |
3798 | } | 3824 | } |
3799 | } | 3825 | } |
3800 | 3826 | ||
3801 | 3827 | ||
3802 | void CalendarView::lookForOutgoingMessages() | 3828 | void CalendarView::lookForOutgoingMessages() |
3803 | { | 3829 | { |
3804 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 3830 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
3805 | ogd->loadMessages(); | 3831 | ogd->loadMessages(); |
3806 | } | 3832 | } |
3807 | 3833 | ||
3808 | void CalendarView::lookForIncomingMessages() | 3834 | void CalendarView::lookForIncomingMessages() |
3809 | { | 3835 | { |
3810 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 3836 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
3811 | icd->retrieve(); | 3837 | icd->retrieve(); |
3812 | } | 3838 | } |
3813 | 3839 | ||
3814 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 3840 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
3815 | { | 3841 | { |
3816 | bool deleteTodo = true; | 3842 | bool deleteTodo = true; |
3817 | QPtrList<Incidence> subTodos; | 3843 | QPtrList<Incidence> subTodos; |
3818 | Incidence *aTodo; | 3844 | Incidence *aTodo; |
3819 | subTodos = t->relations(); | 3845 | subTodos = t->relations(); |
3820 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 3846 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
3821 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 3847 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
3822 | deleteTodo = false; | 3848 | deleteTodo = false; |
3823 | } | 3849 | } |
3824 | if ( deleteTodo ) { | 3850 | if ( deleteTodo ) { |
3825 | if ( t->isCompleted() && !t->doesRecur()) { | 3851 | if ( t->isCompleted() && !t->doesRecur()) { |
3826 | checkExternalId( t ); | 3852 | checkExternalId( t ); |
3827 | mCalendar->deleteTodo( t ); | 3853 | mCalendar->deleteTodo( t ); |
3828 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 3854 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
3829 | } | 3855 | } |
3830 | else | 3856 | else |
3831 | deleteTodo = false; | 3857 | deleteTodo = false; |
3832 | } | 3858 | } |
3833 | return deleteTodo; | 3859 | return deleteTodo; |
3834 | 3860 | ||
3835 | } | 3861 | } |
3836 | void CalendarView::purgeCompleted() | 3862 | void CalendarView::purgeCompleted() |
3837 | { | 3863 | { |
3838 | int result = KMessageBox::warningContinueCancel(this, | 3864 | int result = KMessageBox::warningContinueCancel(this, |
3839 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); | 3865 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); |
3840 | 3866 | ||
3841 | if (result == KMessageBox::Continue) { | 3867 | if (result == KMessageBox::Continue) { |
3842 | 3868 | ||
3843 | QPtrList<Todo> todoCal; | 3869 | QPtrList<Todo> todoCal; |
3844 | QPtrList<Todo> rootTodos; | 3870 | QPtrList<Todo> rootTodos; |
3845 | //QPtrList<Incidence> rel; | 3871 | //QPtrList<Incidence> rel; |
3846 | Todo *aTodo;//, *rTodo; | 3872 | Todo *aTodo;//, *rTodo; |
3847 | Incidence *rIncidence; | 3873 | Incidence *rIncidence; |
3848 | bool childDelete = false; | 3874 | bool childDelete = false; |
3849 | bool deletedOne = true; | 3875 | bool deletedOne = true; |
3850 | todoCal = calendar()->todos(); | 3876 | todoCal = calendar()->todos(); |
3851 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 3877 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
3852 | if ( !aTodo->relatedTo() ) | 3878 | if ( !aTodo->relatedTo() ) |
3853 | rootTodos.append( aTodo ); | 3879 | rootTodos.append( aTodo ); |
3854 | } | 3880 | } |
3855 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 3881 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
3856 | removeCompletedSubTodos( aTodo ); | 3882 | removeCompletedSubTodos( aTodo ); |
3857 | } | 3883 | } |
3858 | 3884 | ||
3859 | updateView(); | 3885 | updateView(); |
3860 | } | 3886 | } |
3861 | } | 3887 | } |
3862 | 3888 | ||
3863 | void CalendarView::slotCalendarChanged() | 3889 | void CalendarView::slotCalendarChanged() |
3864 | { | 3890 | { |
3865 | ; | 3891 | ; |
3866 | } | 3892 | } |
3867 | 3893 | ||
3868 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 3894 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
3869 | { | 3895 | { |
3870 | //qDebug(" alendarView::keyPressEvent "); | 3896 | //qDebug(" alendarView::keyPressEvent "); |
3871 | e->ignore(); | 3897 | e->ignore(); |
3872 | } | 3898 | } |
3873 | 3899 | ||
3874 | 3900 | ||
3875 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 3901 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
3876 | { | 3902 | { |
3877 | // mSyncManager = manager; | 3903 | // mSyncManager = manager; |
3878 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 3904 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
3879 | qDebug("KO: SyncKDE request detected!"); | 3905 | qDebug("KO: SyncKDE request detected!"); |
3880 | } | 3906 | } |
3881 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3907 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3882 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3908 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3883 | return syncCalendar( filename, mode ); | 3909 | return syncCalendar( filename, mode ); |
3884 | } | 3910 | } |
3885 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 3911 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
3886 | { | 3912 | { |
3887 | //mSyncManager = manager; | 3913 | //mSyncManager = manager; |
3888 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3914 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3889 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3915 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3890 | if ( resource == "sharp" ) | 3916 | if ( resource == "sharp" ) |
3891 | syncExternal( 0 ); | 3917 | syncExternal( 0 ); |
3892 | if ( resource == "phone" ) | 3918 | if ( resource == "phone" ) |
3893 | syncExternal( 1 ); | 3919 | syncExternal( 1 ); |
3894 | // pending setmodified | 3920 | // pending setmodified |
3895 | return true; | 3921 | return true; |
3896 | } | 3922 | } |
3897 | void CalendarView::setSyncManager(KSyncManager* manager) | 3923 | void CalendarView::setSyncManager(KSyncManager* manager) |
3898 | { | 3924 | { |
3899 | mSyncManager = manager; | 3925 | mSyncManager = manager; |
3900 | } | 3926 | } |
3901 | 3927 | ||
3902 | void CalendarView::removeSyncInfo( QString syncProfile) | 3928 | void CalendarView::removeSyncInfo( QString syncProfile) |
3903 | { | 3929 | { |
3904 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 3930 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
3905 | mCalendar->removeSyncInfo( syncProfile ); | 3931 | mCalendar->removeSyncInfo( syncProfile ); |
3906 | 3932 | ||
3907 | } | 3933 | } |
3908 | 3934 | ||
3909 | void CalendarView::undo_delete() | 3935 | void CalendarView::undo_delete() |
3910 | { | 3936 | { |
3911 | //qDebug("undo_delete() "); | 3937 | //qDebug("undo_delete() "); |
3912 | Incidence* undo = mCalendar->undoIncidence(); | 3938 | Incidence* undo = mCalendar->undoIncidence(); |
3913 | if ( !undo ) { | 3939 | if ( !undo ) { |
3914 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 3940 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
3915 | i18n("KO/Pi")); | 3941 | i18n("KO/Pi")); |
3916 | return; | 3942 | return; |
3917 | } | 3943 | } |
3918 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + | 3944 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + |
3919 | i18n("\nAre you sure you want\nto restore this?"), | 3945 | i18n("\nAre you sure you want\nto restore this?"), |
3920 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 3946 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
3921 | mCalendar->undoDeleteIncidence(); | 3947 | mCalendar->undoDeleteIncidence(); |
3922 | updateView(); | 3948 | updateView(); |
3923 | } | 3949 | } |
3924 | } | 3950 | } |
3951 | |||
3952 | void CalendarView::slotViewerClosed() | ||
3953 | { | ||
3954 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); | ||
3955 | } | ||
3956 | |||
3957 | void CalendarView::resetFocus() | ||
3958 | { | ||
3959 | if ( mViewerCallerIsSearchDialog ) { | ||
3960 | if ( mDialogManager->getSearchDialog()->isVisible() ){ | ||
3961 | mDialogManager->getSearchDialog()->raise(); | ||
3962 | mDialogManager->getSearchDialog()->setActiveWindow(); | ||
3963 | mDialogManager->getSearchDialog()->listview()->resetFocus(); | ||
3964 | } else | ||
3965 | mViewerCallerIsSearchDialog = false; | ||
3966 | } | ||
3967 | if ( !mViewerCallerIsSearchDialog ) { | ||
3968 | //mViewManager->currentView()->setFocus(); | ||
3969 | //qDebug("sssssssssssssssset focus "); | ||
3970 | setActiveWindow(); | ||
3971 | //setFocus(); | ||
3972 | } | ||
3973 | mViewerCallerIsSearchDialog = false; | ||
3974 | } | ||
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index e626ea3..664d700 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -267,346 +267,349 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
267 | /** create new todo with a parent todo */ | 267 | /** create new todo with a parent todo */ |
268 | void newSubTodo(Todo *); | 268 | void newSubTodo(Todo *); |
269 | /** Delete todo */ | 269 | /** Delete todo */ |
270 | void deleteTodo(Todo *); | 270 | void deleteTodo(Todo *); |
271 | 271 | ||
272 | 272 | ||
273 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 273 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
274 | * emitted as result. */ | 274 | * emitted as result. */ |
275 | void checkClipboard(); | 275 | void checkClipboard(); |
276 | 276 | ||
277 | /** using the KConfig associated with the kapp variable, read in the | 277 | /** using the KConfig associated with the kapp variable, read in the |
278 | * settings from the config file. | 278 | * settings from the config file. |
279 | */ | 279 | */ |
280 | void readSettings(); | 280 | void readSettings(); |
281 | 281 | ||
282 | /** write current state to config file. */ | 282 | /** write current state to config file. */ |
283 | void writeSettings(); | 283 | void writeSettings(); |
284 | 284 | ||
285 | /** read settings for calendar filters */ | 285 | /** read settings for calendar filters */ |
286 | void readFilterSettings(KConfig *config); | 286 | void readFilterSettings(KConfig *config); |
287 | 287 | ||
288 | /** write settings for calendar filters */ | 288 | /** write settings for calendar filters */ |
289 | void writeFilterSettings(KConfig *config); | 289 | void writeFilterSettings(KConfig *config); |
290 | 290 | ||
291 | /** passes on the message that an event has changed to the currently | 291 | /** passes on the message that an event has changed to the currently |
292 | * activated view so that it can make appropriate display changes. */ | 292 | * activated view so that it can make appropriate display changes. */ |
293 | void changeEventDisplay(Event *, int); | 293 | void changeEventDisplay(Event *, int); |
294 | void changeIncidenceDisplay(Incidence *, int); | 294 | void changeIncidenceDisplay(Incidence *, int); |
295 | void changeTodoDisplay(Todo *, int); | 295 | void changeTodoDisplay(Todo *, int); |
296 | 296 | ||
297 | void eventAdded(Event *); | 297 | void eventAdded(Event *); |
298 | void eventChanged(Event *); | 298 | void eventChanged(Event *); |
299 | void eventToBeDeleted(Event *); | 299 | void eventToBeDeleted(Event *); |
300 | void eventDeleted(); | 300 | void eventDeleted(); |
301 | 301 | ||
302 | void todoAdded(Todo *); | 302 | void todoAdded(Todo *); |
303 | void todoChanged(Todo *); | 303 | void todoChanged(Todo *); |
304 | void todoToBeDeleted(Todo *); | 304 | void todoToBeDeleted(Todo *); |
305 | void todoDeleted(); | 305 | void todoDeleted(); |
306 | 306 | ||
307 | void updateView(const QDate &start, const QDate &end); | 307 | void updateView(const QDate &start, const QDate &end); |
308 | void updateView(); | 308 | void updateView(); |
309 | 309 | ||
310 | /** Full update of visible todo views */ | 310 | /** Full update of visible todo views */ |
311 | void updateTodoViews(); | 311 | void updateTodoViews(); |
312 | 312 | ||
313 | void updateUnmanagedViews(); | 313 | void updateUnmanagedViews(); |
314 | 314 | ||
315 | /** cut the current appointment to the clipboard */ | 315 | /** cut the current appointment to the clipboard */ |
316 | void edit_cut(); | 316 | void edit_cut(); |
317 | 317 | ||
318 | /** copy the current appointment(s) to the clipboard */ | 318 | /** copy the current appointment(s) to the clipboard */ |
319 | void edit_copy(); | 319 | void edit_copy(); |
320 | 320 | ||
321 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 321 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
322 | void edit_paste(); | 322 | void edit_paste(); |
323 | 323 | ||
324 | /** edit viewing and configuration options. */ | 324 | /** edit viewing and configuration options. */ |
325 | void edit_options(); | 325 | void edit_options(); |
326 | /** | 326 | /** |
327 | Functions for printing, previewing a print, and setting up printing | 327 | Functions for printing, previewing a print, and setting up printing |
328 | parameters. | 328 | parameters. |
329 | */ | 329 | */ |
330 | void print(); | 330 | void print(); |
331 | void printSetup(); | 331 | void printSetup(); |
332 | void printPreview(); | 332 | void printPreview(); |
333 | 333 | ||
334 | /** Export as iCalendar file */ | 334 | /** Export as iCalendar file */ |
335 | void exportICalendar(); | 335 | void exportICalendar(); |
336 | 336 | ||
337 | /** Export as vCalendar file */ | 337 | /** Export as vCalendar file */ |
338 | bool exportVCalendar( QString fn); | 338 | bool exportVCalendar( QString fn); |
339 | 339 | ||
340 | /** pop up a dialog to show an existing appointment. */ | 340 | /** pop up a dialog to show an existing appointment. */ |
341 | void appointment_show(); | 341 | void appointment_show(); |
342 | /** | 342 | /** |
343 | * pop up an Appointment Dialog to edit an existing appointment.Get | 343 | * pop up an Appointment Dialog to edit an existing appointment.Get |
344 | * information on the appointment from the list of unique IDs that is | 344 | * information on the appointment from the list of unique IDs that is |
345 | * currently in the View, called currIds. | 345 | * currently in the View, called currIds. |
346 | */ | 346 | */ |
347 | void appointment_edit(); | 347 | void appointment_edit(); |
348 | /** | 348 | /** |
349 | * pop up dialog confirming deletion of currently selected event in the | 349 | * pop up dialog confirming deletion of currently selected event in the |
350 | * View. | 350 | * View. |
351 | */ | 351 | */ |
352 | void appointment_delete(); | 352 | void appointment_delete(); |
353 | 353 | ||
354 | /** mails the currently selected event to a particular user as a vCalendar | 354 | /** mails the currently selected event to a particular user as a vCalendar |
355 | attachment. */ | 355 | attachment. */ |
356 | void action_mail(); | 356 | void action_mail(); |
357 | 357 | ||
358 | /* frees a subtodo from it's relation */ | 358 | /* frees a subtodo from it's relation */ |
359 | void todo_unsub( Todo * ); | 359 | void todo_unsub( Todo * ); |
360 | void todo_resub( Todo * parent, Todo * sub ); | 360 | void todo_resub( Todo * parent, Todo * sub ); |
361 | 361 | ||
362 | /** Take ownership of selected event. */ | 362 | /** Take ownership of selected event. */ |
363 | void takeOverEvent(); | 363 | void takeOverEvent(); |
364 | 364 | ||
365 | /** Take ownership of all events in calendar. */ | 365 | /** Take ownership of all events in calendar. */ |
366 | void takeOverCalendar(); | 366 | void takeOverCalendar(); |
367 | 367 | ||
368 | /** query whether or not the calendar is "dirty". */ | 368 | /** query whether or not the calendar is "dirty". */ |
369 | bool isModified(); | 369 | bool isModified(); |
370 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 370 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
371 | void setModified(bool modified=true); | 371 | void setModified(bool modified=true); |
372 | 372 | ||
373 | /** query if the calendar is read-only. */ | 373 | /** query if the calendar is read-only. */ |
374 | bool isReadOnly(); | 374 | bool isReadOnly(); |
375 | /** set state of calendar to read-only */ | 375 | /** set state of calendar to read-only */ |
376 | void setReadOnly(bool readOnly=true); | 376 | void setReadOnly(bool readOnly=true); |
377 | 377 | ||
378 | void eventUpdated(Incidence *); | 378 | void eventUpdated(Incidence *); |
379 | 379 | ||
380 | /* iTIP scheduling actions */ | 380 | /* iTIP scheduling actions */ |
381 | void schedule_publish(Incidence *incidence = 0); | 381 | void schedule_publish(Incidence *incidence = 0); |
382 | void schedule_request(Incidence *incidence = 0); | 382 | void schedule_request(Incidence *incidence = 0); |
383 | void schedule_refresh(Incidence *incidence = 0); | 383 | void schedule_refresh(Incidence *incidence = 0); |
384 | void schedule_cancel(Incidence *incidence = 0); | 384 | void schedule_cancel(Incidence *incidence = 0); |
385 | void schedule_add(Incidence *incidence = 0); | 385 | void schedule_add(Incidence *incidence = 0); |
386 | void schedule_reply(Incidence *incidence = 0); | 386 | void schedule_reply(Incidence *incidence = 0); |
387 | void schedule_counter(Incidence *incidence = 0); | 387 | void schedule_counter(Incidence *incidence = 0); |
388 | void schedule_declinecounter(Incidence *incidence = 0); | 388 | void schedule_declinecounter(Incidence *incidence = 0); |
389 | void schedule_publish_freebusy(int daysToPublish = 30); | 389 | void schedule_publish_freebusy(int daysToPublish = 30); |
390 | 390 | ||
391 | void openAddressbook(); | 391 | void openAddressbook(); |
392 | 392 | ||
393 | void editFilters(); | 393 | void editFilters(); |
394 | void toggleFilerEnabled(); | 394 | void toggleFilerEnabled(); |
395 | QPtrList<CalFilter> filters(); | 395 | QPtrList<CalFilter> filters(); |
396 | void toggleFilter(); | 396 | void toggleFilter(); |
397 | void showFilter(bool visible); | 397 | void showFilter(bool visible); |
398 | void updateFilter(); | 398 | void updateFilter(); |
399 | void filterEdited(); | 399 | void filterEdited(); |
400 | void selectFilter( int ); | 400 | void selectFilter( int ); |
401 | KOFilterView *filterView(); | 401 | KOFilterView *filterView(); |
402 | 402 | ||
403 | void showIntro(); | 403 | void showIntro(); |
404 | 404 | ||
405 | /** Move the curdatepient view date to today */ | 405 | /** Move the curdatepient view date to today */ |
406 | void goToday(); | 406 | void goToday(); |
407 | 407 | ||
408 | /** Move to the next date(s) in the current view */ | 408 | /** Move to the next date(s) in the current view */ |
409 | void goNext(); | 409 | void goNext(); |
410 | 410 | ||
411 | /** Move to the previous date(s) in the current view */ | 411 | /** Move to the previous date(s) in the current view */ |
412 | void goPrevious(); | 412 | void goPrevious(); |
413 | /** Move to the next date(s) in the current view */ | 413 | /** Move to the next date(s) in the current view */ |
414 | void goNextMonth(); | 414 | void goNextMonth(); |
415 | 415 | ||
416 | /** Move to the previous date(s) in the current view */ | 416 | /** Move to the previous date(s) in the current view */ |
417 | void goPreviousMonth(); | 417 | void goPreviousMonth(); |
418 | 418 | ||
419 | void toggleExpand(); | 419 | void toggleExpand(); |
420 | void toggleDateNavigatorWidget(); | 420 | void toggleDateNavigatorWidget(); |
421 | void toggleAllDaySize(); | 421 | void toggleAllDaySize(); |
422 | void dialogClosing(Incidence *); | 422 | void dialogClosing(Incidence *); |
423 | 423 | ||
424 | /** Look for new messages in the inbox */ | 424 | /** Look for new messages in the inbox */ |
425 | void lookForIncomingMessages(); | 425 | void lookForIncomingMessages(); |
426 | /** Look for new messages in the outbox */ | 426 | /** Look for new messages in the outbox */ |
427 | void lookForOutgoingMessages(); | 427 | void lookForOutgoingMessages(); |
428 | 428 | ||
429 | void processMainViewSelection( Incidence * ); | 429 | void processMainViewSelection( Incidence * ); |
430 | void processTodoListSelection( Incidence * ); | 430 | void processTodoListSelection( Incidence * ); |
431 | 431 | ||
432 | void processIncidenceSelection( Incidence * ); | 432 | void processIncidenceSelection( Incidence * ); |
433 | 433 | ||
434 | void purgeCompleted(); | 434 | void purgeCompleted(); |
435 | bool removeCompletedSubTodos( Todo* ); | 435 | bool removeCompletedSubTodos( Todo* ); |
436 | void slotCalendarChanged(); | 436 | void slotCalendarChanged(); |
437 | bool importBday(); | 437 | bool importBday(); |
438 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 438 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
439 | bool importQtopia( const QString &categoriesFile, | 439 | bool importQtopia( const QString &categoriesFile, |
440 | const QString &datebookFile, | 440 | const QString &datebookFile, |
441 | const QString &tasklistFile ); | 441 | const QString &tasklistFile ); |
442 | void syncExternal( int mode ); | 442 | void syncExternal( int mode ); |
443 | void slotSelectPickerDate( QDate ) ; | 443 | void slotSelectPickerDate( QDate ) ; |
444 | void showDatePicker() ; | 444 | void showDatePicker() ; |
445 | void showDatePickerPopup() ; | 445 | void showDatePickerPopup() ; |
446 | void moveIncidence(Incidence *) ; | 446 | void moveIncidence(Incidence *) ; |
447 | void beamIncidence(Incidence *) ; | 447 | void beamIncidence(Incidence *) ; |
448 | void beamCalendar() ; | 448 | void beamCalendar() ; |
449 | void beamFilteredCalendar() ; | 449 | void beamFilteredCalendar() ; |
450 | void beamIncidenceList(QPtrList<Incidence>) ; | 450 | void beamIncidenceList(QPtrList<Incidence>) ; |
451 | void manageCategories(); | 451 | void manageCategories(); |
452 | int addCategories(); | 452 | int addCategories(); |
453 | void removeCategories(); | 453 | void removeCategories(); |
454 | void setSyncDevice( QString ); | 454 | void setSyncDevice( QString ); |
455 | void setSyncName( QString ); | 455 | void setSyncName( QString ); |
456 | void showDay( QDate ); | 456 | void showDay( QDate ); |
457 | void undo_delete(); | 457 | void undo_delete(); |
458 | protected slots: | 458 | protected slots: |
459 | void resetFocus(); | ||
460 | void slotViewerClosed(); | ||
459 | void timerAlarm(); | 461 | void timerAlarm(); |
460 | void suspendAlarm(); | 462 | void suspendAlarm(); |
461 | void beamDone( Ir *ir ); | 463 | void beamDone( Ir *ir ); |
462 | /** Select a view or adapt the current view to display the specified dates. */ | 464 | /** Select a view or adapt the current view to display the specified dates. */ |
463 | void showDates( const KCal::DateList & ); | 465 | void showDates( const KCal::DateList & ); |
464 | void selectWeekNum ( int ); | 466 | void selectWeekNum ( int ); |
465 | 467 | ||
466 | public: | 468 | public: |
467 | // show a standard warning | 469 | // show a standard warning |
468 | // returns KMsgBox::yesNoCancel() | 470 | // returns KMsgBox::yesNoCancel() |
469 | int msgCalModified(); | 471 | int msgCalModified(); |
470 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 472 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
471 | 473 | ||
472 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 474 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
473 | virtual void removeSyncInfo( QString syncProfile); | 475 | virtual void removeSyncInfo( QString syncProfile); |
474 | void setSyncManager(KSyncManager* manager); | 476 | void setSyncManager(KSyncManager* manager); |
475 | void setLoadedFileVersion(QDateTime); | 477 | void setLoadedFileVersion(QDateTime); |
476 | bool checkFileVersion(QString fn); | 478 | bool checkFileVersion(QString fn); |
477 | bool checkFileChanged(QString fn); | 479 | bool checkFileChanged(QString fn); |
478 | Event* getLastSyncEvent(); | 480 | Event* getLastSyncEvent(); |
479 | /** Adapt navigation units correpsonding to step size of navigation of the | 481 | /** Adapt navigation units correpsonding to step size of navigation of the |
480 | * current view. | 482 | * current view. |
481 | */ | 483 | */ |
482 | void adaptNavigationUnits(); | 484 | void adaptNavigationUnits(); |
483 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 485 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
484 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 486 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
485 | //Attendee* getYourAttendee(Event *event); | 487 | //Attendee* getYourAttendee(Event *event); |
486 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 488 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
487 | protected: | 489 | protected: |
488 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 490 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
489 | 491 | ||
490 | // returns KMsgBox::OKCandel() | 492 | // returns KMsgBox::OKCandel() |
491 | int msgItemDelete(const QString name); | 493 | int msgItemDelete(const QString name); |
492 | void showEventEditor(); | 494 | void showEventEditor(); |
493 | void showTodoEditor(); | 495 | void showTodoEditor(); |
494 | void writeLocale(); | 496 | void writeLocale(); |
495 | Todo *selectedTodo(); | 497 | Todo *selectedTodo(); |
496 | 498 | ||
497 | private: | 499 | private: |
500 | bool mViewerCallerIsSearchDialog; | ||
498 | bool mBlockShowDates; | 501 | bool mBlockShowDates; |
499 | KSyncManager* mSyncManager; | 502 | KSyncManager* mSyncManager; |
500 | AlarmDialog * mAlarmDialog; | 503 | AlarmDialog * mAlarmDialog; |
501 | QString mAlarmNotification; | 504 | QString mAlarmNotification; |
502 | QString mSuspendAlarmNotification; | 505 | QString mSuspendAlarmNotification; |
503 | QTimer* mSuspendTimer; | 506 | QTimer* mSuspendTimer; |
504 | QTimer* mAlarmTimer; | 507 | QTimer* mAlarmTimer; |
505 | QTimer* mRecheckAlarmTimer; | 508 | QTimer* mRecheckAlarmTimer; |
506 | void computeAlarm( QString ); | 509 | void computeAlarm( QString ); |
507 | void startAlarm( QString, QString ); | 510 | void startAlarm( QString, QString ); |
508 | void setSyncEventsReadOnly(); | 511 | void setSyncEventsReadOnly(); |
509 | 512 | ||
510 | QDateTime loadedFileVersion; | 513 | QDateTime loadedFileVersion; |
511 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 514 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
512 | void checkExternalId( Incidence * inc ); | 515 | void checkExternalId( Incidence * inc ); |
513 | int mGlobalSyncMode; | 516 | int mGlobalSyncMode; |
514 | QString mCurrentSyncDevice; | 517 | QString mCurrentSyncDevice; |
515 | QString mCurrentSyncName; | 518 | QString mCurrentSyncName; |
516 | KOBeamPrefs* beamDialog; | 519 | KOBeamPrefs* beamDialog; |
517 | void init(); | 520 | void init(); |
518 | int mDatePickerMode; | 521 | int mDatePickerMode; |
519 | bool mFlagEditDescription; | 522 | bool mFlagEditDescription; |
520 | QDateTime mLastCalendarSync; | 523 | QDateTime mLastCalendarSync; |
521 | void createPrinter(); | 524 | void createPrinter(); |
522 | 525 | ||
523 | void calendarModified( bool, Calendar * ); | 526 | void calendarModified( bool, Calendar * ); |
524 | 527 | ||
525 | CalPrinter *mCalPrinter; | 528 | CalPrinter *mCalPrinter; |
526 | 529 | ||
527 | QSplitter *mPanner; | 530 | QSplitter *mPanner; |
528 | QSplitter *mLeftSplitter; | 531 | QSplitter *mLeftSplitter; |
529 | QWidget *mLeftFrame; | 532 | QWidget *mLeftFrame; |
530 | QWidgetStack *mRightFrame; | 533 | QWidgetStack *mRightFrame; |
531 | 534 | ||
532 | KDatePicker* mDatePicker; | 535 | KDatePicker* mDatePicker; |
533 | QVBox* mDateFrame; | 536 | QVBox* mDateFrame; |
534 | 537 | ||
535 | KDateNavigator *mDateNavigator; // widget showing small month view. | 538 | KDateNavigator *mDateNavigator; // widget showing small month view. |
536 | 539 | ||
537 | KOFilterView *mFilterView; | 540 | KOFilterView *mFilterView; |
538 | 541 | ||
539 | ResourceView *mResourceView; | 542 | ResourceView *mResourceView; |
540 | 543 | ||
541 | // calendar object for this viewing instance | 544 | // calendar object for this viewing instance |
542 | Calendar *mCalendar; | 545 | Calendar *mCalendar; |
543 | 546 | ||
544 | CalendarResourceManager *mResourceManager; | 547 | CalendarResourceManager *mResourceManager; |
545 | 548 | ||
546 | FileStorage *mStorage; | 549 | FileStorage *mStorage; |
547 | 550 | ||
548 | DateNavigator *mNavigator; | 551 | DateNavigator *mNavigator; |
549 | 552 | ||
550 | KOViewManager *mViewManager; | 553 | KOViewManager *mViewManager; |
551 | KODialogManager *mDialogManager; | 554 | KODialogManager *mDialogManager; |
552 | 555 | ||
553 | // Calendar filters | 556 | // Calendar filters |
554 | QPtrList<CalFilter> mFilters; | 557 | QPtrList<CalFilter> mFilters; |
555 | 558 | ||
556 | // various housekeeping variables. | 559 | // various housekeeping variables. |
557 | bool mModified; // flag indicating if calendar is modified | 560 | bool mModified; // flag indicating if calendar is modified |
558 | bool mReadOnly; // flag indicating if calendar is read-only | 561 | bool mReadOnly; // flag indicating if calendar is read-only |
559 | QDate mSaveSingleDate; | 562 | QDate mSaveSingleDate; |
560 | 563 | ||
561 | Incidence *mSelectedIncidence; | 564 | Incidence *mSelectedIncidence; |
562 | Incidence *mMoveIncidence; | 565 | Incidence *mMoveIncidence; |
563 | QDate mMoveIncidenceOldDate; | 566 | QDate mMoveIncidenceOldDate; |
564 | KOTodoView *mTodoList; | 567 | KOTodoView *mTodoList; |
565 | KOEventEditor * mEventEditor; | 568 | KOEventEditor * mEventEditor; |
566 | KOTodoEditor * mTodoEditor; | 569 | KOTodoEditor * mTodoEditor; |
567 | KOEventViewerDialog * mEventViewerDialog; | 570 | KOEventViewerDialog * mEventViewerDialog; |
568 | void keyPressEvent ( QKeyEvent *e) ; | 571 | void keyPressEvent ( QKeyEvent *e) ; |
569 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 572 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
570 | }; | 573 | }; |
571 | 574 | ||
572 | 575 | ||
573 | class CalendarViewVisitor : public Incidence::Visitor | 576 | class CalendarViewVisitor : public Incidence::Visitor |
574 | { | 577 | { |
575 | public: | 578 | public: |
576 | CalendarViewVisitor() : mView( 0 ) {} | 579 | CalendarViewVisitor() : mView( 0 ) {} |
577 | 580 | ||
578 | bool act( Incidence *incidence, CalendarView *view ) | 581 | bool act( Incidence *incidence, CalendarView *view ) |
579 | { | 582 | { |
580 | mView = view; | 583 | mView = view; |
581 | return incidence->accept( *this ); | 584 | return incidence->accept( *this ); |
582 | } | 585 | } |
583 | 586 | ||
584 | protected: | 587 | protected: |
585 | CalendarView *mView; | 588 | CalendarView *mView; |
586 | }; | 589 | }; |
587 | 590 | ||
588 | class ShowIncidenceVisitor : public CalendarViewVisitor | 591 | class ShowIncidenceVisitor : public CalendarViewVisitor |
589 | { | 592 | { |
590 | protected: | 593 | protected: |
591 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 594 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
592 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 595 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
593 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 596 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
594 | }; | 597 | }; |
595 | 598 | ||
596 | class EditIncidenceVisitor : public CalendarViewVisitor | 599 | class EditIncidenceVisitor : public CalendarViewVisitor |
597 | { | 600 | { |
598 | protected: | 601 | protected: |
599 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 602 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
600 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 603 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
601 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 604 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
602 | }; | 605 | }; |
603 | 606 | ||
604 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 607 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
605 | { | 608 | { |
606 | protected: | 609 | protected: |
607 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 610 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
608 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 611 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
609 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 612 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
610 | }; | 613 | }; |
611 | 614 | ||
612 | #endif | 615 | #endif |
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h index d8142ca..2d4a08e 100644 --- a/korganizer/koeventviewer.h +++ b/korganizer/koeventviewer.h | |||
@@ -1,76 +1,76 @@ | |||
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 KOEVENTVIEWER_H | 19 | #ifndef KOEVENTVIEWER_H |
20 | #define KOEVENTVIEWER_H | 20 | #define KOEVENTVIEWER_H |
21 | // | 21 | // |
22 | // Viewer widget for events. | 22 | // Viewer widget for events. |
23 | // | 23 | // |
24 | 24 | ||
25 | #include <qtextbrowser.h> | 25 | #include <qtextbrowser.h> |
26 | 26 | ||
27 | #include <libkcal/event.h> | 27 | #include <libkcal/event.h> |
28 | #include <libkcal/journal.h> | 28 | #include <libkcal/journal.h> |
29 | 29 | ||
30 | 30 | ||
31 | using namespace KCal; | 31 | using namespace KCal; |
32 | 32 | ||
33 | class KOEventViewer : public QTextBrowser { | 33 | class KOEventViewer : public QTextBrowser { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | KOEventViewer(QWidget *parent=0,const char *name=0); | 36 | KOEventViewer(QWidget *parent=0,const char *name=0); |
37 | virtual ~KOEventViewer(); | 37 | virtual ~KOEventViewer(); |
38 | 38 | ||
39 | void setSource(const QString &); | 39 | void setSource(const QString &); |
40 | void setEvent(Event *event); | 40 | void setEvent(Event *event); |
41 | void addEvent(Event *event); | 41 | void addEvent(Event *event); |
42 | void setTodo(Todo *event, bool clearV = true ); | 42 | void setTodo(Todo *event, bool clearV = true ); |
43 | void setJournal(Journal *jour, bool clearV = true ); | 43 | void setJournal(Journal *jour, bool clearV = true ); |
44 | 44 | ||
45 | void appendEvent(Event *event, int mode = 0 ); | 45 | void appendEvent(Event *event, int mode = 0 ); |
46 | void appendTodo(Todo *event, int mode = 0 ); | 46 | void appendTodo(Todo *event, int mode = 0 ); |
47 | void appendJournal(Journal *jour, int mode = 0 ); | 47 | void appendJournal(Journal *jour, int mode = 0 ); |
48 | 48 | ||
49 | void clearEvents(bool now=false); | 49 | void clearEvents(bool now=false); |
50 | 50 | ||
51 | void addText(QString text); | 51 | void addText(QString text); |
52 | void setSyncMode( bool ); | 52 | void setSyncMode( bool ); |
53 | void setColorMode( int ); | 53 | void setColorMode( int ); |
54 | void mailToAttendees( bool all ); | 54 | void mailToAttendees( bool all ); |
55 | 55 | ||
56 | protected: | 56 | protected: |
57 | int mColorMode; | 57 | int mColorMode; |
58 | void addTag(const QString & tag,const QString & text); | 58 | void addTag(const QString & tag,const QString & text); |
59 | 59 | ||
60 | void formatCategories(Incidence *event); | 60 | void formatCategories(Incidence *event); |
61 | void formatAttendees(Incidence *event); | 61 | void formatAttendees(Incidence *event); |
62 | void formatReadOnly(Incidence *event); | 62 | void formatReadOnly(Incidence *event); |
63 | void keyPressEvent ( QKeyEvent * e ); | 63 | void keyPressEvent ( QKeyEvent * e ); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | QTextBrowser *mEventTextView; | 66 | QTextBrowser *mEventTextView; |
67 | bool mSyncMode; | 67 | bool mSyncMode; |
68 | 68 | ||
69 | QString mText; | 69 | QString mText; |
70 | QString mMailSubject; | 70 | QString mMailSubject; |
71 | Incidence* mCurrentIncidence; | 71 | Incidence* mCurrentIncidence; |
72 | signals: | 72 | signals: |
73 | void launchaddressbook(QString uid); | 73 | void launchaddressbook(QString uid); |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #endif | 76 | #endif |
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 23e62d3..8bada3b 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp | |||
@@ -1,266 +1,283 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,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 <klocale.h> | 20 | #include <klocale.h> |
21 | 21 | ||
22 | #include <libkcal/event.h> | 22 | #include <libkcal/event.h> |
23 | #include <qtimer.h> | ||
23 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
24 | 25 | ||
25 | #include "koeventviewer.h" | 26 | #include "koeventviewer.h" |
26 | #include "koprefs.h" | 27 | #include "koprefs.h" |
27 | #include <libkcal/todo.h> | 28 | #include <libkcal/todo.h> |
28 | #include "qapp.h" | 29 | #include "qapp.h" |
29 | 30 | ||
30 | #include "koeventviewerdialog.h" | 31 | #include "koeventviewerdialog.h" |
31 | extern int globalFlagBlockAgenda; | 32 | extern int globalFlagBlockAgenda; |
32 | 33 | ||
33 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) | 34 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) |
34 | : KDialogBase(parent,name, | 35 | : KDialogBase(parent,name, |
35 | #ifndef DESKTOP_VERSION | 36 | #ifndef DESKTOP_VERSION |
36 | true , | 37 | true , |
37 | #else | 38 | #else |
38 | false, | 39 | false, |
39 | #endif | 40 | #endif |
40 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) | 41 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) |
41 | { | 42 | { |
42 | 43 | sendSignalViewerClosed = true; | |
43 | mEventViewer = new KOEventViewer(this); | 44 | mEventViewer = new KOEventViewer(this); |
44 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 45 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
45 | setMainWidget(mEventViewer); | 46 | setMainWidget(mEventViewer); |
46 | setButtonText(Ok, i18n("Edit") ); | 47 | setButtonText(Ok, i18n("Edit") ); |
47 | 48 | ||
48 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), | 49 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), |
49 | SLOT(editIncidence())); | 50 | SLOT(editIncidence())); |
50 | QObject::connect(this,SIGNAL(user1Clicked()), | 51 | QObject::connect(this,SIGNAL(user1Clicked()), |
51 | SLOT(showIncidence())); | 52 | SLOT(showIncidence())); |
52 | mIncidence = 0; | 53 | mIncidence = 0; |
53 | // TODO: Set a sensible size (based on the content?). | 54 | // TODO: Set a sensible size (based on the content?). |
54 | //showMaximized(); | 55 | //showMaximized(); |
55 | //qDebug("++++++++++++KOEventViewerDialog() "); | 56 | //qDebug("++++++++++++KOEventViewerDialog() "); |
56 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 57 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
57 | // setFixedSize( 240,284 ); | 58 | // setFixedSize( 240,284 ); |
58 | // move( 0, 15 ); | 59 | // move( 0, 15 ); |
59 | // } else { | 60 | // } else { |
60 | // setMinimumSize(300,200); | 61 | // setMinimumSize(300,200); |
61 | // resize(320,300); | 62 | // resize(320,300); |
62 | // } | 63 | // } |
63 | mSyncMode = false; | 64 | mSyncMode = false; |
64 | mSyncResult = 0; | 65 | mSyncResult = 0; |
65 | 66 | ||
66 | } | 67 | } |
67 | 68 | ||
68 | KOEventViewerDialog::~KOEventViewerDialog() | 69 | KOEventViewerDialog::~KOEventViewerDialog() |
69 | { | 70 | { |
70 | //qDebug("-------~KOEventViewerDialog() "); | 71 | //qDebug("-------~KOEventViewerDialog() "); |
71 | } | 72 | } |
72 | void KOEventViewerDialog::showMe() | 73 | void KOEventViewerDialog::showMe() |
73 | { | 74 | { |
74 | 75 | ||
75 | #ifdef DESKTOP_VERSION | 76 | #ifdef DESKTOP_VERSION |
76 | show(); | 77 | show(); |
77 | #else | 78 | #else |
78 | showMaximized(); | 79 | showMaximized(); |
79 | #endif | 80 | #endif |
80 | setActiveWindow(); | 81 | setActiveWindow(); |
81 | mEventViewer->setFocus(); | 82 | mEventViewer->setFocus(); |
82 | 83 | ||
83 | } | 84 | } |
84 | void KOEventViewerDialog::setSyncMode( bool b ) | 85 | void KOEventViewerDialog::setSyncMode( bool b ) |
85 | { | 86 | { |
86 | mSyncMode = b; | 87 | mSyncMode = b; |
87 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); | 88 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); |
88 | if ( mSyncMode ) { | 89 | if ( mSyncMode ) { |
89 | findButton( Close )->setText( i18n("Cancel Sync")); | 90 | findButton( Close )->setText( i18n("Cancel Sync")); |
90 | findButton( Ok )->setText( i18n("Remote")); | 91 | findButton( Ok )->setText( i18n("Remote")); |
91 | findButton( User1 )->setText( i18n("Local")); | 92 | findButton( User1 )->setText( i18n("Local")); |
92 | } else { | 93 | } else { |
93 | findButton( Close )->setText( i18n("Close")); | 94 | findButton( Close )->setText( i18n("Close")); |
94 | findButton( Ok )->setText( i18n("Edit")); | 95 | findButton( Ok )->setText( i18n("Edit")); |
95 | findButton( User1 )->setText( i18n("Agenda")); | 96 | findButton( User1 )->setText( i18n("Agenda")); |
96 | } | 97 | } |
97 | mEventViewer->setSyncMode( b ); | 98 | mEventViewer->setSyncMode( b ); |
98 | } | 99 | } |
99 | void KOEventViewerDialog::setColorMode( int m ) | 100 | void KOEventViewerDialog::setColorMode( int m ) |
100 | { | 101 | { |
101 | mEventViewer->setColorMode( m ); | 102 | mEventViewer->setColorMode( m ); |
102 | } | 103 | } |
103 | int KOEventViewerDialog::executeS( bool local ) | 104 | int KOEventViewerDialog::executeS( bool local ) |
104 | { | 105 | { |
105 | mSyncResult = 3; | 106 | mSyncResult = 3; |
106 | if ( local ) | 107 | if ( local ) |
107 | findButton( User1 )->setFocus(); | 108 | findButton( User1 )->setFocus(); |
108 | else | 109 | else |
109 | findButton( Ok )->setFocus(); | 110 | findButton( Ok )->setFocus(); |
110 | exec(); | 111 | exec(); |
111 | return mSyncResult; | 112 | return mSyncResult; |
112 | } | 113 | } |
113 | 114 | ||
114 | void KOEventViewerDialog::updateConfig() | 115 | void KOEventViewerDialog::updateConfig() |
115 | { | 116 | { |
116 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 117 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
117 | 118 | ||
118 | } | 119 | } |
119 | void KOEventViewerDialog::setEvent(Event *event) | 120 | void KOEventViewerDialog::setEvent(Event *event) |
120 | { | 121 | { |
121 | mEventViewer->setEvent(event); | 122 | mEventViewer->setEvent(event); |
122 | mIncidence = event; | 123 | mIncidence = event; |
123 | mEventViewer->setFocus(); | 124 | mEventViewer->setFocus(); |
124 | //findButton( Close )->setFocus(); | 125 | //findButton( Close )->setFocus(); |
125 | if ( !mSyncMode ) { | 126 | if ( !mSyncMode ) { |
126 | findButton( User1 )->setText( i18n("Agenda")); | 127 | findButton( User1 )->setText( i18n("Agenda")); |
127 | } | 128 | } |
128 | } | 129 | } |
129 | void KOEventViewerDialog::setIncidence(Incidence *in ) | 130 | void KOEventViewerDialog::setIncidence(Incidence *in ) |
130 | { | 131 | { |
131 | if ( in->type() == "Event" ) | 132 | if ( in->type() == "Event" ) |
132 | setEvent( (Event*) in ); | 133 | setEvent( (Event*) in ); |
133 | else if ( in->type() =="Todo" ) | 134 | else if ( in->type() =="Todo" ) |
134 | setTodo( (Todo*) in ); | 135 | setTodo( (Todo*) in ); |
135 | else if ( in->type() =="Journal" ) | 136 | else if ( in->type() =="Journal" ) |
136 | setJournal( (Journal*) in ); | 137 | setJournal( (Journal*) in ); |
137 | } | 138 | } |
138 | void KOEventViewerDialog::addIncidence(Incidence *in) | 139 | void KOEventViewerDialog::addIncidence(Incidence *in) |
139 | { | 140 | { |
140 | if ( in->type() == "Event" ) | 141 | if ( in->type() == "Event" ) |
141 | addEvent( (Event*) in ); | 142 | addEvent( (Event*) in ); |
142 | else if ( in->type() =="Todo" ) | 143 | else if ( in->type() =="Todo" ) |
143 | mEventViewer->setTodo( (Todo*) in, false ); | 144 | mEventViewer->setTodo( (Todo*) in, false ); |
144 | else if ( in->type() =="Journal" ) | 145 | else if ( in->type() =="Journal" ) |
145 | mEventViewer->setJournal( (Journal*) in, false ); | 146 | mEventViewer->setJournal( (Journal*) in, false ); |
146 | if ( mSyncMode ) { | 147 | if ( mSyncMode ) { |
147 | findButton( User1 )->setFocus(); | 148 | findButton( User1 )->setFocus(); |
148 | setCaption(i18n("Conflict! Please choose entry")); | 149 | setCaption(i18n("Conflict! Please choose entry")); |
149 | } | 150 | } |
150 | } | 151 | } |
151 | 152 | ||
152 | void KOEventViewerDialog::addEvent(Event *event) | 153 | void KOEventViewerDialog::addEvent(Event *event) |
153 | { | 154 | { |
154 | mEventViewer->addEvent(event); | 155 | mEventViewer->addEvent(event); |
155 | mIncidence = event; | 156 | mIncidence = event; |
156 | mEventViewer->setFocus(); | 157 | mEventViewer->setFocus(); |
157 | //findButton( Close )->setFocus(); | 158 | //findButton( Close )->setFocus(); |
158 | if ( !mSyncMode ) { | 159 | if ( !mSyncMode ) { |
159 | findButton( User1 )->setText( i18n("Agenda")); | 160 | findButton( User1 )->setText( i18n("Agenda")); |
160 | } | 161 | } |
161 | } | 162 | } |
162 | 163 | ||
163 | void KOEventViewerDialog::setTodo(Todo *event) | 164 | void KOEventViewerDialog::setTodo(Todo *event) |
164 | { | 165 | { |
165 | mEventViewer->setTodo(event); | 166 | mEventViewer->setTodo(event); |
166 | mIncidence = (Incidence*)event; | 167 | mIncidence = (Incidence*)event; |
167 | mEventViewer->setFocus(); | 168 | mEventViewer->setFocus(); |
168 | //findButton( Close )->setFocus(); | 169 | //findButton( Close )->setFocus(); |
169 | if ( !mSyncMode ) { | 170 | if ( !mSyncMode ) { |
170 | findButton( User1 )->setText( i18n("Set complete")); | 171 | findButton( User1 )->setText( i18n("Set complete")); |
171 | } | 172 | } |
172 | } | 173 | } |
173 | void KOEventViewerDialog::setJournal(Journal *j) | 174 | void KOEventViewerDialog::setJournal(Journal *j) |
174 | { | 175 | { |
175 | mEventViewer->setJournal(j); | 176 | mEventViewer->setJournal(j); |
176 | mIncidence = (Incidence*)j; | 177 | mIncidence = (Incidence*)j; |
177 | mEventViewer->setFocus(); | 178 | mEventViewer->setFocus(); |
178 | //findButton( Close )->setFocus(); | 179 | //findButton( Close )->setFocus(); |
179 | if ( !mSyncMode ) { | 180 | if ( !mSyncMode ) { |
180 | findButton( User1 )->setText( i18n("Agenda")); | 181 | findButton( User1 )->setText( i18n("Agenda")); |
181 | } | 182 | } |
182 | } | 183 | } |
183 | 184 | ||
184 | void KOEventViewerDialog::addText(QString text) | 185 | void KOEventViewerDialog::addText(QString text) |
185 | { | 186 | { |
186 | mEventViewer->addText(text); | 187 | mEventViewer->addText(text); |
187 | mEventViewer->setFocus(); | 188 | mEventViewer->setFocus(); |
188 | //findButton( Close )->setFocus(); | 189 | //findButton( Close )->setFocus(); |
189 | } | 190 | } |
190 | void KOEventViewerDialog::editIncidence() | 191 | void KOEventViewerDialog::editIncidence() |
191 | { | 192 | { |
193 | sendSignalViewerClosed = false; | ||
192 | if ( mSyncMode ) { | 194 | if ( mSyncMode ) { |
193 | mSyncResult = 2; | 195 | mSyncResult = 2; |
194 | accept(); | 196 | accept(); |
195 | return; | 197 | return; |
196 | } | 198 | } |
197 | if ( mIncidence ){ | 199 | if ( mIncidence ){ |
198 | #ifndef DESKTOP_VERSION | 200 | #ifndef DESKTOP_VERSION |
199 | hide(); | 201 | hide(); |
200 | #endif | 202 | #endif |
201 | emit editIncidence( mIncidence ); | 203 | emit editIncidence( mIncidence ); |
202 | } | 204 | } |
203 | } | 205 | } |
204 | void KOEventViewerDialog::showIncidence() | 206 | void KOEventViewerDialog::showIncidence() |
205 | { | 207 | { |
206 | 208 | sendSignalViewerClosed = false; | |
207 | if ( mSyncMode ) { | 209 | if ( mSyncMode ) { |
208 | mSyncResult = 1; | 210 | mSyncResult = 1; |
209 | accept(); | 211 | accept(); |
210 | return; | 212 | return; |
211 | } | 213 | } |
212 | 214 | ||
213 | if ( mIncidence ){ | 215 | if ( mIncidence ){ |
214 | #ifndef DESKTOP_VERSION | 216 | #ifndef DESKTOP_VERSION |
215 | hide(); | 217 | hide(); |
216 | #endif | 218 | #endif |
217 | QDate date; | 219 | QDate date; |
218 | if ( mIncidence->type() == "Todo" ) { | 220 | if ( mIncidence->type() == "Todo" ) { |
219 | /* | 221 | /* |
220 | if ( ((Todo*)mIncidence)->hasDueDate() ) | 222 | if ( ((Todo*)mIncidence)->hasDueDate() ) |
221 | date = ((Todo*)mIncidence)->dtDue().date(); | 223 | date = ((Todo*)mIncidence)->dtDue().date(); |
222 | else { | 224 | else { |
223 | globalFlagBlockAgenda = 2; | 225 | globalFlagBlockAgenda = 2; |
224 | emit showAgendaView( false ); | 226 | emit showAgendaView( false ); |
225 | return; | 227 | return; |
226 | } | 228 | } |
227 | */ | 229 | */ |
228 | ((Todo*)mIncidence)->setCompleted( true ); | 230 | ((Todo*)mIncidence)->setCompleted( true ); |
229 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); | 231 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); |
230 | hide(); | 232 | hide(); |
231 | emit todoCompleted(((Todo*)mIncidence)); | 233 | emit todoCompleted(((Todo*)mIncidence)); |
232 | return; | 234 | return; |
233 | 235 | ||
234 | } else | 236 | } else |
235 | date = mIncidence->dtStart().date(); | 237 | date = mIncidence->dtStart().date(); |
236 | globalFlagBlockAgenda = 1; | 238 | globalFlagBlockAgenda = 1; |
237 | emit showAgendaView( false ); | 239 | emit showAgendaView( false ); |
238 | globalFlagBlockAgenda = 2; | 240 | globalFlagBlockAgenda = 2; |
239 | emit jumpToTime( date ); | 241 | emit jumpToTime( date ); |
240 | } | 242 | } |
241 | } | 243 | } |
242 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) | 244 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) |
243 | { | 245 | { |
244 | switch ( e->key() ) { | 246 | switch ( e->key() ) { |
245 | 247 | ||
246 | case Qt::Key_A : | 248 | case Qt::Key_A : |
247 | case Qt::Key_L : | 249 | case Qt::Key_L : |
248 | showIncidence(); | 250 | showIncidence(); |
249 | break; | 251 | break; |
250 | case Qt::Key_E : | 252 | case Qt::Key_E : |
251 | case Qt::Key_R : | 253 | case Qt::Key_R : |
252 | editIncidence(); | 254 | editIncidence(); |
253 | break; | 255 | break; |
254 | case Qt::Key_C: | 256 | case Qt::Key_C: |
255 | case Qt::Key_Escape: | 257 | case Qt::Key_Escape: |
256 | close(); | 258 | close(); |
257 | break; | 259 | break; |
258 | case Qt::Key_I: | 260 | case Qt::Key_I: |
259 | accept(); | 261 | accept(); |
260 | break; | 262 | break; |
261 | default: | 263 | default: |
262 | KDialogBase::keyPressEvent ( e ); | 264 | KDialogBase::keyPressEvent ( e ); |
263 | break; | 265 | break; |
264 | } | 266 | } |
265 | 267 | ||
266 | } | 268 | } |
269 | void KOEventViewerDialog::hideEvent ( QHideEvent * e ) | ||
270 | { | ||
271 | KDialogBase::hideEvent ( e ); | ||
272 | QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); | ||
273 | } | ||
274 | |||
275 | void KOEventViewerDialog::slotViewerClosed() | ||
276 | { | ||
277 | if ( sendSignalViewerClosed ) { | ||
278 | //qDebug("KOEventViewerDialog::hideEvent "); | ||
279 | emit signalViewerClosed(); | ||
280 | } | ||
281 | sendSignalViewerClosed = true; | ||
282 | } | ||
283 | |||
diff --git a/korganizer/koeventviewerdialog.h b/korganizer/koeventviewerdialog.h index b6b4103..36431ad 100644 --- a/korganizer/koeventviewerdialog.h +++ b/korganizer/koeventviewerdialog.h | |||
@@ -1,71 +1,75 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000, 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 KOEVENTVIEWERDIALOG_H | 19 | #ifndef KOEVENTVIEWERDIALOG_H |
20 | #define KOEVENTVIEWERDIALOG_H | 20 | #define KOEVENTVIEWERDIALOG_H |
21 | // | 21 | // |
22 | // Viewer dialog for events. | 22 | // Viewer dialog for events. |
23 | // | 23 | // |
24 | 24 | ||
25 | #include <qtextview.h> | 25 | #include <qtextview.h> |
26 | 26 | ||
27 | #include <kdialogbase.h> | 27 | #include <kdialogbase.h> |
28 | 28 | ||
29 | #include <libkcal/event.h> | 29 | #include <libkcal/event.h> |
30 | 30 | ||
31 | using namespace KCal; | 31 | using namespace KCal; |
32 | 32 | ||
33 | class KOEventViewer; | 33 | class KOEventViewer; |
34 | 34 | ||
35 | class KOEventViewerDialog : public KDialogBase { | 35 | class KOEventViewerDialog : public KDialogBase { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | KOEventViewerDialog(QWidget *parent=0,const char *name=0); | 38 | KOEventViewerDialog(QWidget *parent=0,const char *name=0); |
39 | virtual ~KOEventViewerDialog(); | 39 | virtual ~KOEventViewerDialog(); |
40 | 40 | ||
41 | void setEvent(Event *event); | 41 | void setEvent(Event *event); |
42 | void addEvent(Event *event); | 42 | void addEvent(Event *event); |
43 | void setTodo(Todo *event); | 43 | void setTodo(Todo *event); |
44 | void setJournal(Journal *journal); | 44 | void setJournal(Journal *journal); |
45 | void setIncidence(Incidence *inc); | 45 | void setIncidence(Incidence *inc); |
46 | void addIncidence(Incidence *inc); | 46 | void addIncidence(Incidence *inc); |
47 | void addText(QString text); | 47 | void addText(QString text); |
48 | void showMe(); | 48 | void showMe(); |
49 | void setSyncMode( bool ); | 49 | void setSyncMode( bool ); |
50 | void setColorMode( int m ); | 50 | void setColorMode( int m ); |
51 | int executeS( bool ); | 51 | int executeS( bool ); |
52 | public slots: | 52 | public slots: |
53 | void updateConfig(); | 53 | void updateConfig(); |
54 | signals: | 54 | signals: |
55 | void editIncidence( Incidence* ); | 55 | void editIncidence( Incidence* ); |
56 | void jumpToTime( const QDate &); | 56 | void jumpToTime( const QDate &); |
57 | void showAgendaView( bool ); | 57 | void showAgendaView( bool ); |
58 | void todoCompleted(Todo*); | 58 | void todoCompleted(Todo*); |
59 | void signalViewerClosed(); | ||
59 | private slots: | 60 | private slots: |
61 | void slotViewerClosed(); | ||
60 | void editIncidence(); | 62 | void editIncidence(); |
61 | void showIncidence(); | 63 | void showIncidence(); |
62 | 64 | protected: | |
65 | void hideEvent ( QHideEvent * e ); | ||
63 | private: | 66 | private: |
67 | bool sendSignalViewerClosed; | ||
64 | bool mSyncMode; | 68 | bool mSyncMode; |
65 | int mSyncResult; | 69 | int mSyncResult; |
66 | KOEventViewer *mEventViewer; | 70 | KOEventViewer *mEventViewer; |
67 | Incidence* mIncidence; | 71 | Incidence* mIncidence; |
68 | void keyPressEvent ( QKeyEvent * e ); | 72 | void keyPressEvent ( QKeyEvent * e ); |
69 | }; | 73 | }; |
70 | 74 | ||
71 | #endif | 75 | #endif |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 4a6e17d..6acee75 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -595,592 +595,596 @@ void KOListView::saveDescriptionToFile() | |||
595 | if (!file.open( IO_WriteOnly ) ) { | 595 | if (!file.open( IO_WriteOnly ) ) { |
596 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); | 596 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); |
597 | return; | 597 | return; |
598 | } | 598 | } |
599 | QTextStream ts( &file ); | 599 | QTextStream ts( &file ); |
600 | ts << text; | 600 | ts << text; |
601 | file.close(); | 601 | file.close(); |
602 | //qDebug("%s ", text.latin1()); | 602 | //qDebug("%s ", text.latin1()); |
603 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); | 603 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); |
604 | KOPrefs::instance()->mLastSaveFile = fn; | 604 | KOPrefs::instance()->mLastSaveFile = fn; |
605 | topLevelWidget()->setCaption(mes); | 605 | topLevelWidget()->setCaption(mes); |
606 | } | 606 | } |
607 | } | 607 | } |
608 | } | 608 | } |
609 | void KOListView::saveToFile() | 609 | void KOListView::saveToFile() |
610 | { | 610 | { |
611 | 611 | ||
612 | int icount = 0; | 612 | int icount = 0; |
613 | QPtrList<Incidence> delSel ; | 613 | QPtrList<Incidence> delSel ; |
614 | QListViewItem *item = mListView->firstChild (); | 614 | QListViewItem *item = mListView->firstChild (); |
615 | while ( item ) { | 615 | while ( item ) { |
616 | if ( item->isSelected() ) { | 616 | if ( item->isSelected() ) { |
617 | delSel.append(((KOListViewItem *)item)->data()); | 617 | delSel.append(((KOListViewItem *)item)->data()); |
618 | ++icount; | 618 | ++icount; |
619 | } | 619 | } |
620 | 620 | ||
621 | item = item->nextSibling(); | 621 | item = item->nextSibling(); |
622 | } | 622 | } |
623 | if ( icount ) { | 623 | if ( icount ) { |
624 | QString fn = KOPrefs::instance()->mLastSaveFile; | 624 | QString fn = KOPrefs::instance()->mLastSaveFile; |
625 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 625 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
626 | 626 | ||
627 | if ( fn == "" ) | 627 | if ( fn == "" ) |
628 | return; | 628 | return; |
629 | QFileInfo info; | 629 | QFileInfo info; |
630 | info.setFile( fn ); | 630 | info.setFile( fn ); |
631 | QString mes; | 631 | QString mes; |
632 | bool createbup = true; | 632 | bool createbup = true; |
633 | if ( info. exists() ) { | 633 | if ( info. exists() ) { |
634 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 634 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
635 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 635 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
636 | i18n("Overwrite!"), i18n("Cancel"), 0, | 636 | i18n("Overwrite!"), i18n("Cancel"), 0, |
637 | 0, 1 ); | 637 | 0, 1 ); |
638 | if ( result != 0 ) { | 638 | if ( result != 0 ) { |
639 | createbup = false; | 639 | createbup = false; |
640 | } | 640 | } |
641 | } | 641 | } |
642 | if ( createbup ) { | 642 | if ( createbup ) { |
643 | CalendarLocal cal; | 643 | CalendarLocal cal; |
644 | cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 644 | cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
645 | Incidence *incidence = delSel.first(); | 645 | Incidence *incidence = delSel.first(); |
646 | while ( incidence ) { | 646 | while ( incidence ) { |
647 | cal.addIncidence( incidence->clone() ); | 647 | cal.addIncidence( incidence->clone() ); |
648 | incidence = delSel.next(); | 648 | incidence = delSel.next(); |
649 | } | 649 | } |
650 | ICalFormat format; | 650 | ICalFormat format; |
651 | format.save( &cal, fn ); | 651 | format.save( &cal, fn ); |
652 | mes = i18n("KO/Pi:Saved %1").arg(fn ); | 652 | mes = i18n("KO/Pi:Saved %1").arg(fn ); |
653 | KOPrefs::instance()->mLastSaveFile = fn; | 653 | KOPrefs::instance()->mLastSaveFile = fn; |
654 | topLevelWidget()->setCaption(mes); | 654 | topLevelWidget()->setCaption(mes); |
655 | } | 655 | } |
656 | } | 656 | } |
657 | } | 657 | } |
658 | void KOListView::deleteAll() | 658 | void KOListView::deleteAll() |
659 | { | 659 | { |
660 | int icount = 0; | 660 | int icount = 0; |
661 | QPtrList<Incidence> delSel ; | 661 | QPtrList<Incidence> delSel ; |
662 | QListViewItem *item = mListView->firstChild (); | 662 | QListViewItem *item = mListView->firstChild (); |
663 | while ( item ) { | 663 | while ( item ) { |
664 | if ( item->isSelected() ) { | 664 | if ( item->isSelected() ) { |
665 | delSel.append(((KOListViewItem *)item)->data()); | 665 | delSel.append(((KOListViewItem *)item)->data()); |
666 | ++icount; | 666 | ++icount; |
667 | } | 667 | } |
668 | 668 | ||
669 | item = item->nextSibling(); | 669 | item = item->nextSibling(); |
670 | } | 670 | } |
671 | if ( icount ) { | 671 | if ( icount ) { |
672 | Incidence *incidence = delSel.first(); | 672 | Incidence *incidence = delSel.first(); |
673 | Incidence *toDelete; | 673 | Incidence *toDelete; |
674 | KOPrefs *p = KOPrefs::instance(); | 674 | KOPrefs *p = KOPrefs::instance(); |
675 | bool confirm = p->mConfirm; | 675 | bool confirm = p->mConfirm; |
676 | QString mess; | 676 | QString mess; |
677 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); | 677 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); |
678 | if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { | 678 | if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { |
679 | p->mConfirm = false; | 679 | p->mConfirm = false; |
680 | int delCounter = 0; | 680 | int delCounter = 0; |
681 | QDialog dia ( this, "p-dialog", true ); | 681 | QDialog dia ( this, "p-dialog", true ); |
682 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); | 682 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); |
683 | QVBoxLayout lay( &dia ); | 683 | QVBoxLayout lay( &dia ); |
684 | lay.setMargin(7); | 684 | lay.setMargin(7); |
685 | lay.setSpacing(7); | 685 | lay.setSpacing(7); |
686 | lay.addWidget( &lab); | 686 | lay.addWidget( &lab); |
687 | QProgressBar bar( icount, &dia ); | 687 | QProgressBar bar( icount, &dia ); |
688 | lay.addWidget( &bar); | 688 | lay.addWidget( &bar); |
689 | int w = 220; | 689 | int w = 220; |
690 | int h = 50; | 690 | int h = 50; |
691 | int dw = QApplication::desktop()->width(); | 691 | int dw = QApplication::desktop()->width(); |
692 | int dh = QApplication::desktop()->height(); | 692 | int dh = QApplication::desktop()->height(); |
693 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 693 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
694 | //dia.resize( 240,50 ); | 694 | //dia.resize( 240,50 ); |
695 | dia.show(); | 695 | dia.show(); |
696 | 696 | ||
697 | while ( incidence ) { | 697 | while ( incidence ) { |
698 | bar.setProgress( delCounter ); | 698 | bar.setProgress( delCounter ); |
699 | mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); | 699 | mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); |
700 | dia.setCaption( mess ); | 700 | dia.setCaption( mess ); |
701 | qApp->processEvents(); | 701 | qApp->processEvents(); |
702 | toDelete = (incidence); | 702 | toDelete = (incidence); |
703 | incidence = delSel.next(); | 703 | incidence = delSel.next(); |
704 | emit deleteIncidenceSignal(toDelete ); | 704 | emit deleteIncidenceSignal(toDelete ); |
705 | if ( dia.result() != 0 ) | 705 | if ( dia.result() != 0 ) |
706 | break; | 706 | break; |
707 | 707 | ||
708 | } | 708 | } |
709 | mess = mess.sprintf( i18n("%d items remaining in list."), count() ); | 709 | mess = mess.sprintf( i18n("%d items remaining in list."), count() ); |
710 | topLevelWidget ()->setCaption( mess ); | 710 | topLevelWidget ()->setCaption( mess ); |
711 | p->mConfirm = confirm; | 711 | p->mConfirm = confirm; |
712 | } | 712 | } |
713 | } | 713 | } |
714 | 714 | ||
715 | 715 | ||
716 | } | 716 | } |
717 | int KOListView::maxDatesHint() | 717 | int KOListView::maxDatesHint() |
718 | { | 718 | { |
719 | return 0; | 719 | return 0; |
720 | } | 720 | } |
721 | 721 | ||
722 | int KOListView::currentDateCount() | 722 | int KOListView::currentDateCount() |
723 | { | 723 | { |
724 | return 0; | 724 | return 0; |
725 | } | 725 | } |
726 | 726 | ||
727 | QPtrList<Incidence> KOListView::selectedIncidences() | 727 | QPtrList<Incidence> KOListView::selectedIncidences() |
728 | { | 728 | { |
729 | QPtrList<Incidence> eventList; | 729 | QPtrList<Incidence> eventList; |
730 | QListViewItem *item = mListView->firstChild (); | 730 | QListViewItem *item = mListView->firstChild (); |
731 | while ( item ) { | 731 | while ( item ) { |
732 | if ( item->isSelected() ) { | 732 | if ( item->isSelected() ) { |
733 | eventList.append(((KOListViewItem *)item)->data()); | 733 | eventList.append(((KOListViewItem *)item)->data()); |
734 | } | 734 | } |
735 | 735 | ||
736 | item = item->nextSibling(); | 736 | item = item->nextSibling(); |
737 | } | 737 | } |
738 | 738 | ||
739 | // // QListViewItem *item = mListView->selectedItem(); | 739 | // // QListViewItem *item = mListView->selectedItem(); |
740 | //if (item) eventList.append(((KOListViewItem *)item)->data()); | 740 | //if (item) eventList.append(((KOListViewItem *)item)->data()); |
741 | 741 | ||
742 | return eventList; | 742 | return eventList; |
743 | } | 743 | } |
744 | 744 | ||
745 | DateList KOListView::selectedDates() | 745 | DateList KOListView::selectedDates() |
746 | { | 746 | { |
747 | DateList eventList; | 747 | DateList eventList; |
748 | return eventList; | 748 | return eventList; |
749 | } | 749 | } |
750 | 750 | ||
751 | void KOListView::showDates(bool show) | 751 | void KOListView::showDates(bool show) |
752 | { | 752 | { |
753 | // Shouldn't we set it to a value greater 0? When showDates is called with | 753 | // Shouldn't we set it to a value greater 0? When showDates is called with |
754 | // show == true at first, then the columnwidths are set to zero. | 754 | // show == true at first, then the columnwidths are set to zero. |
755 | static int oldColWidth1 = 0; | 755 | static int oldColWidth1 = 0; |
756 | static int oldColWidth3 = 0; | 756 | static int oldColWidth3 = 0; |
757 | 757 | ||
758 | if (!show) { | 758 | if (!show) { |
759 | oldColWidth1 = mListView->columnWidth(1); | 759 | oldColWidth1 = mListView->columnWidth(1); |
760 | oldColWidth3 = mListView->columnWidth(3); | 760 | oldColWidth3 = mListView->columnWidth(3); |
761 | mListView->setColumnWidth(1, 0); | 761 | mListView->setColumnWidth(1, 0); |
762 | mListView->setColumnWidth(3, 0); | 762 | mListView->setColumnWidth(3, 0); |
763 | } else { | 763 | } else { |
764 | mListView->setColumnWidth(1, oldColWidth1); | 764 | mListView->setColumnWidth(1, oldColWidth1); |
765 | mListView->setColumnWidth(3, oldColWidth3); | 765 | mListView->setColumnWidth(3, oldColWidth3); |
766 | } | 766 | } |
767 | mListView->repaint(); | 767 | mListView->repaint(); |
768 | } | 768 | } |
769 | 769 | ||
770 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 770 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
771 | const QDate &td) | 771 | const QDate &td) |
772 | { | 772 | { |
773 | #ifndef KORG_NOPRINTER | 773 | #ifndef KORG_NOPRINTER |
774 | calPrinter->preview(CalPrinter::Day, fd, td); | 774 | calPrinter->preview(CalPrinter::Day, fd, td); |
775 | #endif | 775 | #endif |
776 | } | 776 | } |
777 | 777 | ||
778 | void KOListView::showDates() | 778 | void KOListView::showDates() |
779 | { | 779 | { |
780 | showDates(true); | 780 | showDates(true); |
781 | } | 781 | } |
782 | 782 | ||
783 | void KOListView::hideDates() | 783 | void KOListView::hideDates() |
784 | { | 784 | { |
785 | showDates(false); | 785 | showDates(false); |
786 | } | 786 | } |
787 | 787 | void KOListView::resetFocus() | |
788 | { | ||
789 | mListView->setFocus(); | ||
790 | } | ||
788 | void KOListView::updateView() | 791 | void KOListView::updateView() |
789 | { | 792 | { |
790 | mListView->setFocus(); | 793 | mListView->setFocus(); |
791 | if ( mListView->firstChild () ) | 794 | if ( mListView->firstChild () ) |
792 | mListView->setCurrentItem( mListView->firstChild () ); | 795 | mListView->setCurrentItem( mListView->firstChild () ); |
793 | } | 796 | } |
794 | void KOListView::updateConfig() | 797 | void KOListView::updateConfig() |
795 | { | 798 | { |
796 | 799 | ||
797 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 800 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
798 | updateView(); | 801 | updateView(); |
799 | 802 | ||
800 | } | 803 | } |
801 | void KOListView::setStartDate(const QDate &start) | 804 | void KOListView::setStartDate(const QDate &start) |
802 | { | 805 | { |
803 | mStartDate = start; | 806 | mStartDate = start; |
804 | } | 807 | } |
805 | 808 | ||
806 | void KOListView::showDates(const QDate &start, const QDate &end) | 809 | void KOListView::showDates(const QDate &start, const QDate &end) |
807 | { | 810 | { |
808 | clear(); | 811 | clear(); |
809 | mStartDate = start; | 812 | mStartDate = start; |
810 | QDate date = start; | 813 | QDate date = start; |
811 | QPtrList<Journal> j_list; | 814 | QPtrList<Journal> j_list; |
812 | while( date <= end ) { | 815 | while( date <= end ) { |
813 | addEvents(calendar()->events(date)); | 816 | addEvents(calendar()->events(date)); |
814 | addTodos(calendar()->todos(date)); | 817 | addTodos(calendar()->todos(date)); |
815 | Journal* jo = calendar()->journal(date); | 818 | Journal* jo = calendar()->journal(date); |
816 | if ( jo ) | 819 | if ( jo ) |
817 | j_list.append( jo ); | 820 | j_list.append( jo ); |
818 | date = date.addDays( 1 ); | 821 | date = date.addDays( 1 ); |
819 | } | 822 | } |
820 | addJournals(j_list); | 823 | addJournals(j_list); |
821 | emit incidenceSelected( 0 ); | 824 | emit incidenceSelected( 0 ); |
822 | updateView(); | 825 | updateView(); |
823 | 826 | ||
824 | } | 827 | } |
825 | 828 | ||
826 | void KOListView::addEvents(QPtrList<Event> eventList) | 829 | void KOListView::addEvents(QPtrList<Event> eventList) |
827 | { | 830 | { |
828 | Event *ev; | 831 | Event *ev; |
829 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 832 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
830 | addIncidence(ev); | 833 | addIncidence(ev); |
831 | } | 834 | } |
832 | if ( !mListView->currentItem() ){ | 835 | if ( !mListView->currentItem() ){ |
833 | updateView(); | 836 | updateView(); |
834 | } | 837 | } |
835 | } | 838 | } |
836 | 839 | ||
837 | void KOListView::addTodos(QPtrList<Todo> eventList) | 840 | void KOListView::addTodos(QPtrList<Todo> eventList) |
838 | { | 841 | { |
839 | Todo *ev; | 842 | Todo *ev; |
840 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 843 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
841 | addIncidence(ev); | 844 | addIncidence(ev); |
842 | } | 845 | } |
843 | if ( !mListView->currentItem() ){ | 846 | if ( !mListView->currentItem() ){ |
844 | updateView(); | 847 | updateView(); |
845 | } | 848 | } |
846 | } | 849 | } |
847 | void KOListView::addJournals(QPtrList<Journal> eventList) | 850 | void KOListView::addJournals(QPtrList<Journal> eventList) |
848 | { | 851 | { |
849 | Journal *ev; | 852 | Journal *ev; |
850 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 853 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
851 | addIncidence(ev); | 854 | addIncidence(ev); |
852 | } | 855 | } |
853 | if ( !mListView->currentItem() ){ | 856 | if ( !mListView->currentItem() ){ |
854 | updateView(); | 857 | updateView(); |
855 | } | 858 | } |
856 | } | 859 | } |
857 | 860 | ||
858 | void KOListView::addIncidence(Incidence *incidence) | 861 | void KOListView::addIncidence(Incidence *incidence) |
859 | { | 862 | { |
860 | if ( mUidDict.find( incidence->uid() ) ) return; | 863 | if ( mUidDict.find( incidence->uid() ) ) return; |
861 | 864 | ||
862 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 865 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
863 | mUidDict.insert( incidence->uid(), incidence ); | 866 | mUidDict.insert( incidence->uid(), incidence ); |
864 | 867 | ||
865 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); | 868 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); |
866 | ListItemVisitor v(item, mStartDate ); | 869 | ListItemVisitor v(item, mStartDate ); |
867 | if (incidence->accept(v)) return; | 870 | if (incidence->accept(v)) return; |
868 | else delete item; | 871 | else delete item; |
869 | //qDebug("delete item "); | 872 | //qDebug("delete item "); |
870 | } | 873 | } |
871 | 874 | ||
872 | void KOListView::showEvents(QPtrList<Event> eventList) | 875 | void KOListView::showEvents(QPtrList<Event> eventList) |
873 | { | 876 | { |
874 | clear(); | 877 | clear(); |
875 | 878 | ||
876 | addEvents(eventList); | 879 | addEvents(eventList); |
877 | 880 | ||
878 | // After new creation of list view no events are selected. | 881 | // After new creation of list view no events are selected. |
879 | emit incidenceSelected( 0 ); | 882 | emit incidenceSelected( 0 ); |
880 | } | 883 | } |
881 | int KOListView::count() | 884 | int KOListView::count() |
882 | { | 885 | { |
883 | return mListView->childCount(); | 886 | return mListView->childCount(); |
884 | } | 887 | } |
885 | 888 | ||
886 | void KOListView::changeEventDisplay(Event *event, int action) | 889 | void KOListView::changeEventDisplay(Event *event, int action) |
887 | { | 890 | { |
888 | KOListViewItem *item; | 891 | KOListViewItem *item; |
889 | 892 | ||
890 | switch(action) { | 893 | switch(action) { |
891 | case KOGlobals::EVENTADDED: | 894 | case KOGlobals::EVENTADDED: |
892 | addIncidence( event ); | 895 | addIncidence( event ); |
893 | break; | 896 | break; |
894 | case KOGlobals::EVENTEDITED: | 897 | case KOGlobals::EVENTEDITED: |
895 | item = getItemForEvent(event); | 898 | item = getItemForEvent(event); |
896 | if (item) { | 899 | if (item) { |
897 | mUidDict.remove( event->uid() ); | 900 | mUidDict.remove( event->uid() ); |
898 | delete item; | 901 | delete item; |
899 | addIncidence( event ); | 902 | addIncidence( event ); |
900 | } | 903 | } |
901 | break; | 904 | break; |
902 | case KOGlobals::EVENTDELETED: | 905 | case KOGlobals::EVENTDELETED: |
903 | item = getItemForEvent(event); | 906 | item = getItemForEvent(event); |
904 | if (item) { | 907 | if (item) { |
905 | mUidDict.remove( event->uid() ); | 908 | mUidDict.remove( event->uid() ); |
906 | delete item; | 909 | delete item; |
907 | } | 910 | } |
908 | break; | 911 | break; |
909 | default: | 912 | default: |
910 | ; | 913 | ; |
911 | } | 914 | } |
912 | } | 915 | } |
913 | 916 | ||
914 | KOListViewItem *KOListView::getItemForEvent(Event *event) | 917 | KOListViewItem *KOListView::getItemForEvent(Event *event) |
915 | { | 918 | { |
916 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); | 919 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); |
917 | while (item) { | 920 | while (item) { |
918 | if (item->data() == event) return item; | 921 | if (item->data() == event) return item; |
919 | item = (KOListViewItem *)item->nextSibling(); | 922 | item = (KOListViewItem *)item->nextSibling(); |
920 | } | 923 | } |
921 | return 0; | 924 | return 0; |
922 | } | 925 | } |
923 | 926 | ||
924 | void KOListView::defaultItemAction(QListViewItem *i) | 927 | void KOListView::defaultItemAction(QListViewItem *i) |
925 | { | 928 | { |
926 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); | 929 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); |
927 | if ( item ) defaultAction( item->data() ); | 930 | if ( item ) defaultAction( item->data() ); |
928 | 931 | ||
929 | } | 932 | } |
930 | 933 | ||
931 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) | 934 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) |
932 | { | 935 | { |
933 | mActiveItem = (KOListViewItem *)item; | 936 | mActiveItem = (KOListViewItem *)item; |
934 | if (mActiveItem) { | 937 | if (mActiveItem) { |
935 | Incidence *incidence = mActiveItem->data(); | 938 | Incidence *incidence = mActiveItem->data(); |
936 | mPopupMenu->showIncidencePopup(incidence); | 939 | mPopupMenu->showIncidencePopup(incidence); |
937 | 940 | ||
938 | /* | 941 | /* |
939 | if ( incidence && incidence->type() == "Event" ) { | 942 | if ( incidence && incidence->type() == "Event" ) { |
940 | Event *event = static_cast<Event *>( incidence ); | 943 | Event *event = static_cast<Event *>( incidence ); |
941 | mPopupMenu->showEventPopup(event); | 944 | mPopupMenu->showEventPopup(event); |
942 | } | 945 | } |
943 | */ | 946 | */ |
944 | } | 947 | } |
945 | } | 948 | } |
946 | 949 | ||
947 | void KOListView::readSettings(KConfig *config, QString setting) | 950 | void KOListView::readSettings(KConfig *config, QString setting) |
948 | { | 951 | { |
949 | // qDebug("KOListView::readSettings "); | 952 | // qDebug("KOListView::readSettings "); |
950 | mListView->restoreLayout(config,setting); | 953 | mListView->restoreLayout(config,setting); |
951 | } | 954 | } |
952 | 955 | ||
953 | void KOListView::writeSettings(KConfig *config, QString setting) | 956 | void KOListView::writeSettings(KConfig *config, QString setting) |
954 | { | 957 | { |
955 | // qDebug("KOListView::writeSettings "); | 958 | // qDebug("KOListView::writeSettings "); |
956 | mListView->saveLayout(config, setting); | 959 | mListView->saveLayout(config, setting); |
957 | } | 960 | } |
958 | 961 | ||
959 | void KOListView::processSelectionChange(QListViewItem *) | 962 | void KOListView::processSelectionChange(QListViewItem *) |
960 | { | 963 | { |
961 | 964 | ||
962 | KOListViewItem *item = | 965 | KOListViewItem *item = |
963 | static_cast<KOListViewItem *>( mListView->currentItem() ); | 966 | static_cast<KOListViewItem *>( mListView->currentItem() ); |
964 | 967 | ||
965 | if ( !item ) { | 968 | if ( !item ) { |
966 | emit incidenceSelected( 0 ); | 969 | emit incidenceSelected( 0 ); |
967 | } else { | 970 | } else { |
968 | emit incidenceSelected( item->data() ); | 971 | emit incidenceSelected( item->data() ); |
969 | } | 972 | } |
970 | } | 973 | } |
971 | 974 | ||
972 | void KOListView::clearSelection() | 975 | void KOListView::clearSelection() |
973 | { | 976 | { |
974 | mListView->selectAll( false ); | 977 | mListView->selectAll( false ); |
975 | } | 978 | } |
976 | void KOListView::allSelection() | 979 | void KOListView::allSelection() |
977 | { | 980 | { |
978 | mListView->selectAll( true ); | 981 | mListView->selectAll( true ); |
979 | } | 982 | } |
980 | 983 | ||
981 | void KOListView::clear() | 984 | void KOListView::clear() |
982 | { | 985 | { |
983 | mListView->clear(); | 986 | mListView->clear(); |
984 | mUidDict.clear(); | 987 | mUidDict.clear(); |
985 | } | 988 | } |
986 | 989 | ||
987 | Incidence* KOListView::currentItem() | 990 | Incidence* KOListView::currentItem() |
988 | { | 991 | { |
989 | if ( mListView->currentItem() ) | 992 | if ( mListView->currentItem() ) |
990 | return ((KOListViewItem*) mListView->currentItem())->data(); | 993 | return ((KOListViewItem*) mListView->currentItem())->data(); |
991 | return 0; | 994 | return 0; |
992 | } | 995 | } |
993 | void KOListView::keyPressEvent ( QKeyEvent *e) | 996 | void KOListView::keyPressEvent ( QKeyEvent *e) |
994 | { | 997 | { |
995 | 998 | ||
996 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { | 999 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { |
997 | deleteAll(); | 1000 | deleteAll(); |
998 | return; | 1001 | return; |
999 | } | 1002 | } |
1000 | 1003 | ||
1001 | e->ignore(); | 1004 | e->ignore(); |
1002 | } | 1005 | } |
1003 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) | 1006 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) |
1004 | { | 1007 | { |
1005 | 1008 | ||
1006 | switch ( e->key() ) { | 1009 | switch ( e->key() ) { |
1007 | case Qt::Key_Down: | 1010 | case Qt::Key_Down: |
1008 | if ( e->state() == ShiftButton ) { | 1011 | if ( e->state() == ShiftButton ) { |
1009 | QListViewItem* cn = currentItem(); | 1012 | QListViewItem* cn = currentItem(); |
1010 | if ( !cn ) | 1013 | if ( !cn ) |
1011 | cn = firstChild(); | 1014 | cn = firstChild(); |
1012 | if ( !cn ) | 1015 | if ( !cn ) |
1013 | return; | 1016 | return; |
1014 | while ( cn->nextSibling() ) | 1017 | while ( cn->nextSibling() ) |
1015 | cn = cn->nextSibling(); | 1018 | cn = cn->nextSibling(); |
1016 | setCurrentItem ( cn ); | 1019 | setCurrentItem ( cn ); |
1017 | ensureItemVisible ( cn ); | 1020 | ensureItemVisible ( cn ); |
1018 | 1021 | ||
1019 | e->accept(); | 1022 | e->accept(); |
1020 | return; | 1023 | return; |
1021 | } | 1024 | } |
1022 | if ( e->state() == ControlButton ) { | 1025 | if ( e->state() == ControlButton ) { |
1023 | int count = childCount (); | 1026 | int count = childCount (); |
1024 | int jump = count / 5; | 1027 | int jump = count / 5; |
1025 | QListViewItem* cn; | 1028 | QListViewItem* cn; |
1026 | cn = currentItem(); | 1029 | cn = currentItem(); |
1027 | if ( ! cn ) | 1030 | if ( ! cn ) |
1028 | return; | 1031 | return; |
1029 | if ( jump == 0 ) | 1032 | if ( jump == 0 ) |
1030 | jump = 1; | 1033 | jump = 1; |
1031 | while ( jump && cn->nextSibling() ) { | 1034 | while ( jump && cn->nextSibling() ) { |
1032 | cn = cn->nextSibling(); | 1035 | cn = cn->nextSibling(); |
1033 | --jump; | 1036 | --jump; |
1034 | } | 1037 | } |
1035 | setCurrentItem ( cn ); | 1038 | setCurrentItem ( cn ); |
1036 | ensureItemVisible ( cn ); | 1039 | ensureItemVisible ( cn ); |
1037 | 1040 | ||
1038 | } else | 1041 | } else |
1039 | QListView::keyPressEvent ( e ) ; | 1042 | QListView::keyPressEvent ( e ) ; |
1040 | e->accept(); | 1043 | e->accept(); |
1041 | break; | 1044 | break; |
1042 | 1045 | ||
1043 | case Qt::Key_Up: | 1046 | case Qt::Key_Up: |
1044 | if ( e->state() == ShiftButton ) { | 1047 | if ( e->state() == ShiftButton ) { |
1045 | QListViewItem* cn = firstChild(); | 1048 | QListViewItem* cn = firstChild(); |
1046 | if ( cn ) { | 1049 | if ( cn ) { |
1047 | setCurrentItem ( cn ); | 1050 | setCurrentItem ( cn ); |
1048 | ensureItemVisible ( cn ); | 1051 | ensureItemVisible ( cn ); |
1049 | } | 1052 | } |
1050 | e->accept(); | 1053 | e->accept(); |
1051 | return; | 1054 | return; |
1052 | } | 1055 | } |
1053 | if ( e->state() == ControlButton ) { | 1056 | if ( e->state() == ControlButton ) { |
1054 | int count = childCount (); | 1057 | int count = childCount (); |
1055 | int jump = count / 5; | 1058 | int jump = count / 5; |
1056 | QListViewItem* cn; | 1059 | QListViewItem* cn; |
1057 | cn = currentItem(); | 1060 | cn = currentItem(); |
1058 | if ( ! cn ) | 1061 | if ( ! cn ) |
1059 | return; | 1062 | return; |
1060 | if ( jump == 0 ) | 1063 | if ( jump == 0 ) |
1061 | jump = 1; | 1064 | jump = 1; |
1062 | while ( jump && cn->itemAbove ()) { | 1065 | while ( jump && cn->itemAbove ()) { |
1063 | cn = cn->itemAbove (); | 1066 | cn = cn->itemAbove (); |
1064 | --jump; | 1067 | --jump; |
1065 | } | 1068 | } |
1066 | setCurrentItem ( cn ); | 1069 | setCurrentItem ( cn ); |
1067 | ensureItemVisible ( cn ); | 1070 | ensureItemVisible ( cn ); |
1068 | } else | 1071 | } else |
1069 | QListView::keyPressEvent ( e ) ; | 1072 | QListView::keyPressEvent ( e ) ; |
1070 | e->accept(); | 1073 | e->accept(); |
1071 | break; | 1074 | break; |
1072 | case Qt::Key_I: { | 1075 | case Qt::Key_I: { |
1073 | QListViewItem* cn; | 1076 | QListViewItem* cn; |
1074 | cn = currentItem(); | 1077 | cn = currentItem(); |
1075 | if ( cn ) { | 1078 | if ( cn ) { |
1076 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1079 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1077 | if ( ci ){ | 1080 | if ( ci ){ |
1078 | emit showIncidence( ci->data()); | 1081 | //emit showIncidence( ci->data()); |
1079 | cn = cn->nextSibling(); | 1082 | cn = cn->nextSibling(); |
1080 | if ( cn ) { | 1083 | if ( cn ) { |
1081 | setCurrentItem ( cn ); | 1084 | setCurrentItem ( cn ); |
1082 | ensureItemVisible ( cn ); | 1085 | ensureItemVisible ( cn ); |
1086 | emit showIncidence( ci->data()); | ||
1083 | } | 1087 | } |
1084 | } | 1088 | } |
1085 | } | 1089 | } |
1086 | e->accept(); | 1090 | e->accept(); |
1087 | } | 1091 | } |
1088 | break; | 1092 | break; |
1089 | case Qt::Key_Return: | 1093 | case Qt::Key_Return: |
1090 | case Qt::Key_Enter: | 1094 | case Qt::Key_Enter: |
1091 | { | 1095 | { |
1092 | QListViewItem* cn; | 1096 | QListViewItem* cn; |
1093 | cn = currentItem(); | 1097 | cn = currentItem(); |
1094 | if ( cn ) { | 1098 | if ( cn ) { |
1095 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1099 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1096 | if ( ci ){ | 1100 | if ( ci ){ |
1097 | if ( e->state() == ShiftButton ) | 1101 | if ( e->state() == ShiftButton ) |
1098 | ci->setSelected( false ); | 1102 | ci->setSelected( false ); |
1099 | else | 1103 | else |
1100 | ci->setSelected( true ); | 1104 | ci->setSelected( true ); |
1101 | cn = cn->nextSibling(); | 1105 | cn = cn->nextSibling(); |
1102 | if ( cn ) { | 1106 | if ( cn ) { |
1103 | setCurrentItem ( cn ); | 1107 | setCurrentItem ( cn ); |
1104 | ensureItemVisible ( cn ); | 1108 | ensureItemVisible ( cn ); |
1105 | } | 1109 | } |
1106 | } | 1110 | } |
1107 | } | 1111 | } |
1108 | e->accept(); | 1112 | e->accept(); |
1109 | } | 1113 | } |
1110 | break; | 1114 | break; |
1111 | default: | 1115 | default: |
1112 | e->ignore(); | 1116 | e->ignore(); |
1113 | } | 1117 | } |
1114 | } | 1118 | } |
1115 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1119 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1116 | : KListView( lv ) | 1120 | : KListView( lv ) |
1117 | { | 1121 | { |
1118 | #ifndef DESKTOP_VERSION | 1122 | #ifndef DESKTOP_VERSION |
1119 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1123 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1120 | #endif | 1124 | #endif |
1121 | mYMousePos = -1000; | 1125 | mYMousePos = -1000; |
1122 | setSelectionMode( QListView::Multi ); | 1126 | setSelectionMode( QListView::Multi ); |
1123 | setMultiSelection( true); | 1127 | setMultiSelection( true); |
1124 | mAllowPopupMenu = true; | 1128 | mAllowPopupMenu = true; |
1125 | mMouseDown = false; | 1129 | mMouseDown = false; |
1126 | 1130 | ||
1127 | } | 1131 | } |
1128 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1132 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1129 | { | 1133 | { |
1130 | if (!e) return; | 1134 | if (!e) return; |
1131 | QPoint vp = contentsToViewport(e->pos()); | 1135 | QPoint vp = contentsToViewport(e->pos()); |
1132 | QListViewItem *item = itemAt(vp); | 1136 | QListViewItem *item = itemAt(vp); |
1133 | if (!item) { | 1137 | if (!item) { |
1134 | emit newEvent(); | 1138 | emit newEvent(); |
1135 | return; | 1139 | return; |
1136 | } | 1140 | } |
1137 | KListView::contentsMouseDoubleClickEvent(e); | 1141 | KListView::contentsMouseDoubleClickEvent(e); |
1138 | } | 1142 | } |
1139 | 1143 | ||
1140 | 1144 | ||
1141 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1145 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1142 | { | 1146 | { |
1143 | //qDebug("contentsMousePressEvent++++ "); | 1147 | //qDebug("contentsMousePressEvent++++ "); |
1144 | if (! mMouseDown ) { | 1148 | if (! mMouseDown ) { |
1145 | mAllowPopupMenu = true; | 1149 | mAllowPopupMenu = true; |
1146 | mYMousePos = mapToGlobal( (e->pos())).y(); | 1150 | mYMousePos = mapToGlobal( (e->pos())).y(); |
1147 | } | 1151 | } |
1148 | if ( e->button() == RightButton && mMouseDown ) | 1152 | if ( e->button() == RightButton && mMouseDown ) |
1149 | return; | 1153 | return; |
1150 | if ( e->button() == LeftButton ) | 1154 | if ( e->button() == LeftButton ) |
1151 | mMouseDown = true; | 1155 | mMouseDown = true; |
1152 | KListView::contentsMousePressEvent( e ); | 1156 | KListView::contentsMousePressEvent( e ); |
1153 | } | 1157 | } |
1154 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1158 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1155 | { | 1159 | { |
1156 | //qDebug("contentsMouseReleaseEv---- "); | 1160 | //qDebug("contentsMouseReleaseEv---- "); |
1157 | if ( ! mMouseDown ) { | 1161 | if ( ! mMouseDown ) { |
1158 | if ( e->button() == RightButton && ! mAllowPopupMenu ) | 1162 | if ( e->button() == RightButton && ! mAllowPopupMenu ) |
1159 | return; | 1163 | return; |
1160 | QListViewItem* ci = currentItem(); | 1164 | QListViewItem* ci = currentItem(); |
1161 | if ( ci ) | 1165 | if ( ci ) |
1162 | ci->setSelected( true ); | 1166 | ci->setSelected( true ); |
1163 | KListView::contentsMouseReleaseEvent(e); | 1167 | KListView::contentsMouseReleaseEvent(e); |
1164 | return; | 1168 | return; |
1165 | } | 1169 | } |
1166 | if ( e->button() == LeftButton ) | 1170 | if ( e->button() == LeftButton ) |
1167 | mMouseDown = false; | 1171 | mMouseDown = false; |
1168 | if ( e->button() == RightButton && ! mAllowPopupMenu ) | 1172 | if ( e->button() == RightButton && ! mAllowPopupMenu ) |
1169 | return; | 1173 | return; |
1170 | if ( e->button() == RightButton ) { | 1174 | if ( e->button() == RightButton ) { |
1171 | QListViewItem* ci = currentItem(); | 1175 | QListViewItem* ci = currentItem(); |
1172 | if ( ci ) | 1176 | if ( ci ) |
1173 | ci->setSelected( true ); | 1177 | ci->setSelected( true ); |
1174 | } | 1178 | } |
1175 | KListView::contentsMouseReleaseEvent(e); | 1179 | KListView::contentsMouseReleaseEvent(e); |
1176 | } | 1180 | } |
1177 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1181 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1178 | { | 1182 | { |
1179 | // qDebug("contentsMouseMoveEv....... "); | 1183 | // qDebug("contentsMouseMoveEv....... "); |
1180 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | 1184 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); |
1181 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | 1185 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); |
1182 | if ( diff < 0 ) diff = -diff; | 1186 | if ( diff < 0 ) diff = -diff; |
1183 | if ( diff > 20 ) | 1187 | if ( diff > 20 ) |
1184 | mAllowPopupMenu = false; | 1188 | mAllowPopupMenu = false; |
1185 | KListView::contentsMouseMoveEvent(e); | 1189 | KListView::contentsMouseMoveEvent(e); |
1186 | } | 1190 | } |
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index bd5bd12..c86449d 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h | |||
@@ -65,239 +65,240 @@ class KOAlarmPrefs : public QDialog | |||
65 | { | 65 | { |
66 | setCaption( i18n("Alarm Options") ); | 66 | setCaption( i18n("Alarm Options") ); |
67 | QVBoxLayout* alarmLayout = new QVBoxLayout( this ); | 67 | QVBoxLayout* alarmLayout = new QVBoxLayout( this ); |
68 | alarmLayout->setSpacing( 3 ); | 68 | alarmLayout->setSpacing( 3 ); |
69 | alarmLayout->setMargin( 3 ); | 69 | alarmLayout->setMargin( 3 ); |
70 | QWidget *parent = this; | 70 | QWidget *parent = this; |
71 | mAlarmButton = new QCheckBox(i18n("Set reminder ON with offset to:"),parent); | 71 | mAlarmButton = new QCheckBox(i18n("Set reminder ON with offset to:"),parent); |
72 | alarmLayout->addWidget(mAlarmButton); | 72 | alarmLayout->addWidget(mAlarmButton); |
73 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; | 73 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; |
74 | mAlarmTimeEdit->setValue( 15 ); | 74 | mAlarmTimeEdit->setValue( 15 ); |
75 | alarmLayout->addWidget(mAlarmTimeEdit); | 75 | alarmLayout->addWidget(mAlarmTimeEdit); |
76 | mAlarmIncrCombo = new QComboBox(false, parent); | 76 | mAlarmIncrCombo = new QComboBox(false, parent); |
77 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); | 77 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); |
78 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); | 78 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); |
79 | mAlarmIncrCombo->insertItem(i18n("day(s)")); | 79 | mAlarmIncrCombo->insertItem(i18n("day(s)")); |
80 | alarmLayout->addWidget(mAlarmIncrCombo); | 80 | alarmLayout->addWidget(mAlarmIncrCombo); |
81 | QHBox * hb = new QHBox ( parent ); | 81 | QHBox * hb = new QHBox ( parent ); |
82 | alarmLayout->addWidget(hb); | 82 | alarmLayout->addWidget(hb); |
83 | mAlarmSoundButton = new QPushButton(hb); | 83 | mAlarmSoundButton = new QPushButton(hb); |
84 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); | 84 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); |
85 | mAlarmSoundButton->setToggleButton(true); | 85 | mAlarmSoundButton->setToggleButton(true); |
86 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); | 86 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); |
87 | mAlarmProgramButton = new QPushButton(hb); | 87 | mAlarmProgramButton = new QPushButton(hb); |
88 | mAlarmProgramButton->setPixmap(SmallIcon("run")); | 88 | mAlarmProgramButton->setPixmap(SmallIcon("run")); |
89 | mAlarmProgramButton->setToggleButton(true); | 89 | mAlarmProgramButton->setToggleButton(true); |
90 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); | 90 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); |
91 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); | 91 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); |
92 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); | 92 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); |
93 | mAlarmLabel = new QLabel( this ); | 93 | mAlarmLabel = new QLabel( this ); |
94 | alarmLayout->addWidget( mAlarmLabel ); | 94 | alarmLayout->addWidget( mAlarmLabel ); |
95 | mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) ); | 95 | mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) ); |
96 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 96 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
97 | mAlarmSoundButton->setOn( true ); | 97 | mAlarmSoundButton->setOn( true ); |
98 | QPushButton * ok = new QPushButton( i18n("Set Alarm!"), this ); | 98 | QPushButton * ok = new QPushButton( i18n("Set Alarm!"), this ); |
99 | alarmLayout->addWidget( ok ); | 99 | alarmLayout->addWidget( ok ); |
100 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 100 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
101 | alarmLayout->addWidget( cancel ); | 101 | alarmLayout->addWidget( cancel ); |
102 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 102 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
103 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 103 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
104 | resize( 200, 200 ); | 104 | resize( 200, 200 ); |
105 | 105 | ||
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | 109 | ||
110 | QString mAlarmSound, mAlarmProgram ; | 110 | QString mAlarmSound, mAlarmProgram ; |
111 | QCheckBox* mAlarmButton; | 111 | QCheckBox* mAlarmButton; |
112 | QSpinBox* mAlarmTimeEdit; | 112 | QSpinBox* mAlarmTimeEdit; |
113 | QLabel* mAlarmLabel; | 113 | QLabel* mAlarmLabel; |
114 | QComboBox* mAlarmIncrCombo ; | 114 | QComboBox* mAlarmIncrCombo ; |
115 | QPushButton* mAlarmSoundButton ,*mAlarmProgramButton; | 115 | QPushButton* mAlarmSoundButton ,*mAlarmProgramButton; |
116 | private slots: | 116 | private slots: |
117 | 117 | ||
118 | void pickAlarmSound() | 118 | void pickAlarmSound() |
119 | { | 119 | { |
120 | //QString prefix = mAlarmSound; | 120 | //QString prefix = mAlarmSound; |
121 | if (!mAlarmSoundButton->isOn()) { | 121 | if (!mAlarmSoundButton->isOn()) { |
122 | //mAlarmSound = ""; | 122 | //mAlarmSound = ""; |
123 | QToolTip::remove(mAlarmSoundButton); | 123 | QToolTip::remove(mAlarmSoundButton); |
124 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | 124 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); |
125 | mAlarmProgramButton->setOn(true); | 125 | mAlarmProgramButton->setOn(true); |
126 | mAlarmSoundButton->setOn(false); | 126 | mAlarmSoundButton->setOn(false); |
127 | } else { | 127 | } else { |
128 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, | 128 | QString fileName(KFileDialog::getOpenFileName(mAlarmSound, |
129 | i18n("*.wav|Wav Files"), 0)); | 129 | i18n("*.wav|Wav Files"), 0)); |
130 | if (!fileName.isEmpty()) { | 130 | if (!fileName.isEmpty()) { |
131 | mAlarmSound = fileName; | 131 | mAlarmSound = fileName; |
132 | mAlarmLabel->setText( "..."+fileName.right( 30 ) ); | 132 | mAlarmLabel->setText( "..."+fileName.right( 30 ) ); |
133 | QToolTip::remove(mAlarmSoundButton); | 133 | QToolTip::remove(mAlarmSoundButton); |
134 | QString dispStr = i18n("Playing '%1'").arg(fileName); | 134 | QString dispStr = i18n("Playing '%1'").arg(fileName); |
135 | QToolTip::add(mAlarmSoundButton, dispStr); | 135 | QToolTip::add(mAlarmSoundButton, dispStr); |
136 | mAlarmProgramButton->setOn(false); | 136 | mAlarmProgramButton->setOn(false); |
137 | mAlarmSoundButton->setOn(true); | 137 | mAlarmSoundButton->setOn(true); |
138 | } else { | 138 | } else { |
139 | mAlarmProgramButton->setOn(true); | 139 | mAlarmProgramButton->setOn(true); |
140 | mAlarmSoundButton->setOn(false); | 140 | mAlarmSoundButton->setOn(false); |
141 | 141 | ||
142 | } | 142 | } |
143 | } | 143 | } |
144 | }; | 144 | }; |
145 | 145 | ||
146 | void pickAlarmProgram() | 146 | void pickAlarmProgram() |
147 | { | 147 | { |
148 | if (!mAlarmProgramButton->isOn()) { | 148 | if (!mAlarmProgramButton->isOn()) { |
149 | //mAlarmProgram = ""; | 149 | //mAlarmProgram = ""; |
150 | QToolTip::remove(mAlarmProgramButton); | 150 | QToolTip::remove(mAlarmProgramButton); |
151 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | 151 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); |
152 | mAlarmProgramButton->setOn(false); | 152 | mAlarmProgramButton->setOn(false); |
153 | mAlarmSoundButton->setOn(true); | 153 | mAlarmSoundButton->setOn(true); |
154 | } else { | 154 | } else { |
155 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm.: ") , 0)); | 155 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm.: ") , 0)); |
156 | if (!fileName.isEmpty()) { | 156 | if (!fileName.isEmpty()) { |
157 | mAlarmProgram = fileName; | 157 | mAlarmProgram = fileName; |
158 | mAlarmLabel->setText( "..."+fileName.right( 30 ) ); | 158 | mAlarmLabel->setText( "..."+fileName.right( 30 ) ); |
159 | QToolTip::remove(mAlarmProgramButton); | 159 | QToolTip::remove(mAlarmProgramButton); |
160 | QString dispStr = i18n("Running '%1'").arg(fileName); | 160 | QString dispStr = i18n("Running '%1'").arg(fileName); |
161 | QToolTip::add(mAlarmProgramButton, dispStr); | 161 | QToolTip::add(mAlarmProgramButton, dispStr); |
162 | mAlarmSoundButton->setOn(false); | 162 | mAlarmSoundButton->setOn(false); |
163 | mAlarmProgramButton->setOn(true); | 163 | mAlarmProgramButton->setOn(true); |
164 | } else { | 164 | } else { |
165 | mAlarmProgramButton->setOn(false); | 165 | mAlarmProgramButton->setOn(false); |
166 | mAlarmSoundButton->setOn(true); | 166 | mAlarmSoundButton->setOn(true); |
167 | } | 167 | } |
168 | } | 168 | } |
169 | }; | 169 | }; |
170 | 170 | ||
171 | }; | 171 | }; |
172 | 172 | ||
173 | 173 | ||
174 | 174 | ||
175 | 175 | ||
176 | 176 | ||
177 | 177 | ||
178 | 178 | ||
179 | typedef CustomListViewItem<Incidence *> KOListViewItem; | 179 | typedef CustomListViewItem<Incidence *> KOListViewItem; |
180 | 180 | ||
181 | /** | 181 | /** |
182 | This class provides the initialisation of a KOListViewItem for calendar | 182 | This class provides the initialisation of a KOListViewItem for calendar |
183 | components using the Incidence::Visitor. | 183 | components using the Incidence::Visitor. |
184 | */ | 184 | */ |
185 | class ListItemVisitor : public Incidence::Visitor | 185 | class ListItemVisitor : public Incidence::Visitor |
186 | { | 186 | { |
187 | public: | 187 | public: |
188 | ListItemVisitor(KOListViewItem *, QDate d); | 188 | ListItemVisitor(KOListViewItem *, QDate d); |
189 | ~ListItemVisitor(); | 189 | ~ListItemVisitor(); |
190 | 190 | ||
191 | bool visit(Event *); | 191 | bool visit(Event *); |
192 | bool visit(Todo *); | 192 | bool visit(Todo *); |
193 | bool visit(Journal *); | 193 | bool visit(Journal *); |
194 | 194 | ||
195 | private: | 195 | private: |
196 | KOListViewItem *mItem; | 196 | KOListViewItem *mItem; |
197 | QDate mDate; | 197 | QDate mDate; |
198 | }; | 198 | }; |
199 | 199 | ||
200 | /** | 200 | /** |
201 | This class provides a multi-column list view of events. It can | 201 | This class provides a multi-column list view of events. It can |
202 | display events from one particular day or several days, it doesn't | 202 | display events from one particular day or several days, it doesn't |
203 | matter. To use a view that only handles one day at a time, use | 203 | matter. To use a view that only handles one day at a time, use |
204 | KODayListView. | 204 | KODayListView. |
205 | 205 | ||
206 | @short multi-column list view of various events. | 206 | @short multi-column list view of various events. |
207 | @author Preston Brown <pbrown@kde.org> | 207 | @author Preston Brown <pbrown@kde.org> |
208 | @see KOBaseView, KODayListView | 208 | @see KOBaseView, KODayListView |
209 | */ | 209 | */ |
210 | class KOListView; | 210 | class KOListView; |
211 | 211 | ||
212 | class KOListViewListView : public KListView | 212 | class KOListViewListView : public KListView |
213 | { | 213 | { |
214 | Q_OBJECT | 214 | Q_OBJECT |
215 | public: | 215 | public: |
216 | KOListViewListView(KOListView * lv ); | 216 | KOListViewListView(KOListView * lv ); |
217 | signals: | 217 | signals: |
218 | void newEvent(); | 218 | void newEvent(); |
219 | void showIncidence( Incidence* ); | 219 | void showIncidence( Incidence* ); |
220 | private: | 220 | private: |
221 | void keyPressEvent ( QKeyEvent * ) ; | 221 | void keyPressEvent ( QKeyEvent * ) ; |
222 | void contentsMouseDoubleClickEvent(QMouseEvent *e); | 222 | void contentsMouseDoubleClickEvent(QMouseEvent *e); |
223 | void contentsMousePressEvent(QMouseEvent *e); | 223 | void contentsMousePressEvent(QMouseEvent *e); |
224 | void contentsMouseReleaseEvent(QMouseEvent *e); | 224 | void contentsMouseReleaseEvent(QMouseEvent *e); |
225 | void contentsMouseMoveEvent(QMouseEvent *e); | 225 | void contentsMouseMoveEvent(QMouseEvent *e); |
226 | bool mAllowPopupMenu; | 226 | bool mAllowPopupMenu; |
227 | bool mMouseDown; | 227 | bool mMouseDown; |
228 | int mYMousePos; | 228 | int mYMousePos; |
229 | }; | 229 | }; |
230 | 230 | ||
231 | class KOListView : public KOEventView | 231 | class KOListView : public KOEventView |
232 | { | 232 | { |
233 | Q_OBJECT | 233 | Q_OBJECT |
234 | public: | 234 | public: |
235 | KOListView(Calendar *calendar, QWidget *parent = 0, | 235 | KOListView(Calendar *calendar, QWidget *parent = 0, |
236 | const char *name = 0); | 236 | const char *name = 0); |
237 | ~KOListView(); | 237 | ~KOListView(); |
238 | 238 | ||
239 | virtual int maxDatesHint(); | 239 | virtual int maxDatesHint(); |
240 | virtual int currentDateCount(); | 240 | virtual int currentDateCount(); |
241 | virtual QPtrList<Incidence> selectedIncidences(); | 241 | virtual QPtrList<Incidence> selectedIncidences(); |
242 | virtual DateList selectedDates(); | 242 | virtual DateList selectedDates(); |
243 | 243 | ||
244 | void showDates(bool show); | 244 | void showDates(bool show); |
245 | Incidence* currentItem(); | 245 | Incidence* currentItem(); |
246 | void addTodos(QPtrList<Todo> eventList); | 246 | void addTodos(QPtrList<Todo> eventList); |
247 | void addJournals(QPtrList<Journal> eventList); | 247 | void addJournals(QPtrList<Journal> eventList); |
248 | virtual void printPreview(CalPrinter *calPrinter, | 248 | virtual void printPreview(CalPrinter *calPrinter, |
249 | const QDate &, const QDate &); | 249 | const QDate &, const QDate &); |
250 | 250 | ||
251 | void readSettings(KConfig *config, QString setting = "KOListView Layout"); | 251 | void readSettings(KConfig *config, QString setting = "KOListView Layout"); |
252 | void writeSettings(KConfig *config, QString setting = "KOListView Layout"); | 252 | void writeSettings(KConfig *config, QString setting = "KOListView Layout"); |
253 | void updateList(); | 253 | void updateList(); |
254 | void setStartDate(const QDate &start); | 254 | void setStartDate(const QDate &start); |
255 | int count(); | 255 | int count(); |
256 | QString getWhatsThisText(QPoint p); | 256 | QString getWhatsThisText(QPoint p); |
257 | void resetFocus(); | ||
257 | signals: | 258 | signals: |
258 | void signalNewEvent(); | 259 | void signalNewEvent(); |
259 | void beamIncidenceList(QPtrList<Incidence>); | 260 | void beamIncidenceList(QPtrList<Incidence>); |
260 | 261 | ||
261 | public slots: | 262 | public slots: |
262 | virtual void updateView(); | 263 | virtual void updateView(); |
263 | virtual void showDates(const QDate &start, const QDate &end); | 264 | virtual void showDates(const QDate &start, const QDate &end); |
264 | virtual void showEvents(QPtrList<Event> eventList); | 265 | virtual void showEvents(QPtrList<Event> eventList); |
265 | void clearSelection(); | 266 | void clearSelection(); |
266 | void allSelection(); | 267 | void allSelection(); |
267 | 268 | ||
268 | void clear(); | 269 | void clear(); |
269 | void beamDone( Ir *ir ); | 270 | void beamDone( Ir *ir ); |
270 | void showDates(); | 271 | void showDates(); |
271 | void hideDates(); | 272 | void hideDates(); |
272 | void deleteAll(); | 273 | void deleteAll(); |
273 | void saveToFile(); | 274 | void saveToFile(); |
274 | void saveDescriptionToFile(); | 275 | void saveDescriptionToFile(); |
275 | void beamSelected(); | 276 | void beamSelected(); |
276 | void updateConfig(); | 277 | void updateConfig(); |
277 | void addCat(); | 278 | void addCat(); |
278 | void setCat(); | 279 | void setCat(); |
279 | void setAlarm(); | 280 | void setAlarm(); |
280 | void setCategories( bool removeOld ); | 281 | void setCategories( bool removeOld ); |
281 | void changeEventDisplay(Event *, int); | 282 | void changeEventDisplay(Event *, int); |
282 | 283 | ||
283 | void defaultItemAction(QListViewItem *item); | 284 | void defaultItemAction(QListViewItem *item); |
284 | void popupMenu(QListViewItem *item,const QPoint &,int); | 285 | void popupMenu(QListViewItem *item,const QPoint &,int); |
285 | 286 | ||
286 | protected slots: | 287 | protected slots: |
287 | void processSelectionChange(QListViewItem *); | 288 | void processSelectionChange(QListViewItem *); |
288 | 289 | ||
289 | protected: | 290 | protected: |
290 | void addEvents(QPtrList<Event> eventList); | 291 | void addEvents(QPtrList<Event> eventList); |
291 | void addIncidence(Incidence *); | 292 | void addIncidence(Incidence *); |
292 | KOListViewItem *getItemForEvent(Event *event); | 293 | KOListViewItem *getItemForEvent(Event *event); |
293 | 294 | ||
294 | private: | 295 | private: |
295 | KOListViewListView *mListView; | 296 | KOListViewListView *mListView; |
296 | KOEventPopupMenu *mPopupMenu; | 297 | KOEventPopupMenu *mPopupMenu; |
297 | KOListViewItem *mActiveItem; | 298 | KOListViewItem *mActiveItem; |
298 | QDict<Incidence> mUidDict; | 299 | QDict<Incidence> mUidDict; |
299 | QDate mStartDate; | 300 | QDate mStartDate; |
300 | void keyPressEvent ( QKeyEvent * ) ; | 301 | void keyPressEvent ( QKeyEvent * ) ; |
301 | }; | 302 | }; |
302 | 303 | ||
303 | #endif | 304 | #endif |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 3483e95..5e8ea27 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -416,465 +416,487 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
416 | new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 416 | new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
417 | 417 | ||
418 | mPriorityPopupMenu = new QPopupMenu(this); | 418 | mPriorityPopupMenu = new QPopupMenu(this); |
419 | for (int i = 1; i <= 5; i++) { | 419 | for (int i = 1; i <= 5; i++) { |
420 | QString label = QString ("%1").arg (i); | 420 | QString label = QString ("%1").arg (i); |
421 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 421 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
422 | } | 422 | } |
423 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 423 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
424 | 424 | ||
425 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 425 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
426 | for (int i = 0; i <= 100; i+=20) { | 426 | for (int i = 0; i <= 100; i+=20) { |
427 | QString label = QString ("%1 %").arg (i); | 427 | QString label = QString ("%1 %").arg (i); |
428 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 428 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
429 | } | 429 | } |
430 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 430 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
431 | 431 | ||
432 | 432 | ||
433 | 433 | ||
434 | mItemPopupMenu = new QPopupMenu(this); | 434 | mItemPopupMenu = new QPopupMenu(this); |
435 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 435 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
436 | SLOT (showTodo())); | 436 | SLOT (showTodo())); |
437 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 437 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
438 | SLOT (editTodo())); | 438 | SLOT (editTodo())); |
439 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 439 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
440 | SLOT (deleteTodo())); | 440 | SLOT (deleteTodo())); |
441 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 441 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
442 | SLOT (cloneTodo())); | 442 | SLOT (cloneTodo())); |
443 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 443 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
444 | SLOT (moveTodo())); | 444 | SLOT (moveTodo())); |
445 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 445 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
446 | SLOT (beamTodo())); | 446 | SLOT (beamTodo())); |
447 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 447 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
448 | SLOT (cancelTodo())); | 448 | SLOT (cancelTodo())); |
449 | mItemPopupMenu->insertSeparator(); | 449 | mItemPopupMenu->insertSeparator(); |
450 | 450 | ||
451 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 451 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
452 | SLOT (newTodo())); | 452 | SLOT (newTodo())); |
453 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 453 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
454 | SLOT (newSubTodo())); | 454 | SLOT (newSubTodo())); |
455 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 455 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
456 | SLOT (unparentTodo()),0,21); | 456 | SLOT (unparentTodo()),0,21); |
457 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 457 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
458 | SLOT (reparentTodo()),0,22); | 458 | SLOT (reparentTodo()),0,22); |
459 | mItemPopupMenu->insertSeparator(); | 459 | mItemPopupMenu->insertSeparator(); |
460 | #if 0 | 460 | #if 0 |
461 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 461 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
462 | this, SLOT( purgeCompleted() ) ); | 462 | this, SLOT( purgeCompleted() ) ); |
463 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 463 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
464 | this, SLOT( toggleCompleted() ),0, 33 ); | 464 | this, SLOT( toggleCompleted() ),0, 33 ); |
465 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 465 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
466 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 466 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
467 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 467 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
468 | this, SLOT( toggleRunning() ),0, 35 ); | 468 | this, SLOT( toggleRunning() ),0, 35 ); |
469 | 469 | ||
470 | #endif | 470 | #endif |
471 | mPopupMenu = new QPopupMenu(this); | 471 | mPopupMenu = new QPopupMenu(this); |
472 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 472 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
473 | SLOT (newTodo()),0,1); | 473 | SLOT (newTodo()),0,1); |
474 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 474 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
475 | this, SLOT(purgeCompleted()),0,2); | 475 | this, SLOT(purgeCompleted()),0,2); |
476 | mPopupMenu->insertItem(i18n("Show Completed"), | 476 | mPopupMenu->insertItem(i18n("Show Completed"), |
477 | this, SLOT( toggleCompleted() ),0,3 ); | 477 | this, SLOT( toggleCompleted() ),0,3 ); |
478 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 478 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
479 | this, SLOT( toggleQuickTodo() ),0,4 ); | 479 | this, SLOT( toggleQuickTodo() ),0,4 ); |
480 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 480 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
481 | this, SLOT( toggleRunning() ),0,5 ); | 481 | this, SLOT( toggleRunning() ),0,5 ); |
482 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 482 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
483 | this, SLOT( setAllOpen() ),0,6 ); | 483 | this, SLOT( setAllOpen() ),0,6 ); |
484 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 484 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
485 | this, SLOT( setAllClose() ),0,7 ); | 485 | this, SLOT( setAllClose() ),0,7 ); |
486 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 486 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
487 | this, SLOT( setAllFlat() ),0,8 ); | 487 | this, SLOT( setAllFlat() ),0,8 ); |
488 | mDocPrefs = new DocPrefs( name ); | 488 | mDocPrefs = new DocPrefs( name ); |
489 | 489 | ||
490 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 490 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
491 | mPopupMenu->setCheckable( true ); | 491 | mPopupMenu->setCheckable( true ); |
492 | mItemPopupMenu->setCheckable( true ); | 492 | mItemPopupMenu->setCheckable( true ); |
493 | 493 | ||
494 | 494 | ||
495 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 495 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
496 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 496 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
497 | 497 | ||
498 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 498 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
499 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 499 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
500 | 500 | ||
501 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 501 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
502 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 502 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
503 | 503 | ||
504 | 504 | ||
505 | // Double clicking conflicts with opening/closing the subtree | 505 | // Double clicking conflicts with opening/closing the subtree |
506 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 506 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
507 | SLOT( editItem( QListViewItem *) ) ); | 507 | SLOT( editItem( QListViewItem *) ) ); |
508 | /* | 508 | /* |
509 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 509 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
510 | const QPoint &,int ) ), | 510 | const QPoint &,int ) ), |
511 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 511 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
512 | */ | 512 | */ |
513 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 513 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
514 | const QPoint &,int ) ), | 514 | const QPoint &,int ) ), |
515 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 515 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
516 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 516 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
517 | SLOT( itemClicked( QListViewItem * ) ) ); | 517 | SLOT( itemClicked( QListViewItem * ) ) ); |
518 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 518 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
519 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 519 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
520 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 520 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
521 | SLOT( updateView() ) ); | 521 | SLOT( updateView() ) ); |
522 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 522 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
523 | SLOT( todoModified(Todo *, int) ) ); | 523 | SLOT( todoModified(Todo *, int) ) ); |
524 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 524 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
525 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 525 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
526 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 526 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
527 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 527 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
528 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 528 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
529 | SLOT( paintNeeded()) ); | 529 | SLOT( paintNeeded()) ); |
530 | 530 | ||
531 | #if 0 | 531 | #if 0 |
532 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 532 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
533 | SLOT(selectionChanged(QListViewItem *))); | 533 | SLOT(selectionChanged(QListViewItem *))); |
534 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 534 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
535 | SLOT(selectionChanged(QListViewItem *))); | 535 | SLOT(selectionChanged(QListViewItem *))); |
536 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 536 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
537 | SLOT(selectionChanged(QListViewItem *))); | 537 | SLOT(selectionChanged(QListViewItem *))); |
538 | #endif | 538 | #endif |
539 | 539 | ||
540 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 540 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
541 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 541 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
542 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 542 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
543 | 543 | ||
544 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 544 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
545 | SLOT( processSelectionChange() ) ); | 545 | SLOT( processSelectionChange() ) ); |
546 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 546 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
547 | SLOT( addQuickTodo() ) ); | 547 | SLOT( addQuickTodo() ) ); |
548 | 548 | ||
549 | } | 549 | } |
550 | 550 | ||
551 | KOTodoView::~KOTodoView() | 551 | KOTodoView::~KOTodoView() |
552 | { | 552 | { |
553 | delete mDocPrefs; | 553 | delete mDocPrefs; |
554 | } | 554 | } |
555 | QString KOTodoView::getWhatsThisText(QPoint p) | 555 | QString KOTodoView::getWhatsThisText(QPoint p) |
556 | { | 556 | { |
557 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); | 557 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); |
558 | if ( item ) | 558 | if ( item ) |
559 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), | 559 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), |
560 | KOPrefs::instance()->mWTshowDetails, | 560 | KOPrefs::instance()->mWTshowDetails, |
561 | KOPrefs::instance()->mWTshowCreated, | 561 | KOPrefs::instance()->mWTshowCreated, |
562 | KOPrefs::instance()->mWTshowChanged); | 562 | KOPrefs::instance()->mWTshowChanged); |
563 | return i18n("That is the todo view" ); | 563 | return i18n("That is the todo view" ); |
564 | 564 | ||
565 | } | 565 | } |
566 | 566 | ||
567 | void KOTodoView::jumpToDate () | 567 | void KOTodoView::jumpToDate () |
568 | { | 568 | { |
569 | // if (mActiveItem) { | 569 | // if (mActiveItem) { |
570 | // mActiveItem->todo()); | 570 | // mActiveItem->todo()); |
571 | // if ( mActiveItem->todo()->hasDueDate() ) | 571 | // if ( mActiveItem->todo()->hasDueDate() ) |
572 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 572 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
573 | } | 573 | } |
574 | void KOTodoView::paintNeeded() | 574 | void KOTodoView::paintNeeded() |
575 | { | 575 | { |
576 | if ( mPendingUpdateBeforeRepaint ) { | 576 | if ( mPendingUpdateBeforeRepaint ) { |
577 | updateView(); | 577 | updateView(); |
578 | mPendingUpdateBeforeRepaint = false; | 578 | mPendingUpdateBeforeRepaint = false; |
579 | } | 579 | } |
580 | } | 580 | } |
581 | void KOTodoView::paintEvent(QPaintEvent * pevent) | 581 | void KOTodoView::paintEvent(QPaintEvent * pevent) |
582 | { | 582 | { |
583 | if ( mPendingUpdateBeforeRepaint ) { | 583 | if ( mPendingUpdateBeforeRepaint ) { |
584 | updateView(); | 584 | updateView(); |
585 | mPendingUpdateBeforeRepaint = false; | 585 | mPendingUpdateBeforeRepaint = false; |
586 | } | 586 | } |
587 | KOrg::BaseView::paintEvent( pevent); | 587 | KOrg::BaseView::paintEvent( pevent); |
588 | } | 588 | } |
589 | 589 | ||
590 | void KOTodoView::updateView() | 590 | void KOTodoView::updateView() |
591 | { | 591 | { |
592 | pendingSubtodo = 0; | 592 | pendingSubtodo = 0; |
593 | if ( mBlockUpdate ) { | 593 | if ( mBlockUpdate ) { |
594 | return; | 594 | return; |
595 | } | 595 | } |
596 | if ( !isVisible() ) { | 596 | if ( !isVisible() ) { |
597 | mPendingUpdateBeforeRepaint = true; | 597 | mPendingUpdateBeforeRepaint = true; |
598 | return; | 598 | return; |
599 | } | 599 | } |
600 | //qDebug("KOTodoView::updateView() %x", this); | 600 | //qDebug("KOTodoView::updateView() %x", this); |
601 | if ( isFlatDisplay ) { | 601 | if ( isFlatDisplay ) { |
602 | displayAllFlat(); | 602 | displayAllFlat(); |
603 | return; | 603 | return; |
604 | } | 604 | } |
605 | //qDebug("update "); | 605 | //qDebug("update "); |
606 | // kdDebug() << "KOTodoView::updateView()" << endl; | 606 | // kdDebug() << "KOTodoView::updateView()" << endl; |
607 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 607 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
608 | Incidence* oldInc = 0; | ||
609 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | ||
610 | if (mActiveItem) | ||
611 | oldInc = mActiveItem->todo(); | ||
612 | |||
608 | mTodoListView->clear(); | 613 | mTodoListView->clear(); |
609 | if ( mName == "todolistsmall" ) { | 614 | if ( mName == "todolistsmall" ) { |
610 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 615 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
611 | int ps = fo.pointSize() -2; | 616 | int ps = fo.pointSize() -2; |
612 | if ( ps > 12 ) | 617 | if ( ps > 12 ) |
613 | ps -= 2; | 618 | ps -= 2; |
614 | fo.setPointSize( ps ); | 619 | fo.setPointSize( ps ); |
615 | } | 620 | } |
616 | } | 621 | } |
617 | 622 | ||
618 | mTodoListView->setFont( fo ); | 623 | mTodoListView->setFont( fo ); |
619 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 624 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
620 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 625 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
621 | QPtrList<Todo> todoList = calendar()->todos(); | 626 | QPtrList<Todo> todoList = calendar()->todos(); |
622 | 627 | ||
623 | /* | 628 | /* |
624 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 629 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
625 | Event *t; | 630 | Event *t; |
626 | for(t = todoList.first(); t; t = todoList.next()) { | 631 | for(t = todoList.first(); t; t = todoList.next()) { |
627 | kdDebug() << " " << t->getSummary() << endl; | 632 | kdDebug() << " " << t->getSummary() << endl; |
628 | 633 | ||
629 | if (t->getRelatedTo()) { | 634 | if (t->getRelatedTo()) { |
630 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 635 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
631 | } | 636 | } |
632 | 637 | ||
633 | QPtrList<Event> l = t->getRelations(); | 638 | QPtrList<Event> l = t->getRelations(); |
634 | Event *c; | 639 | Event *c; |
635 | for(c=l.first();c;c=l.next()) { | 640 | for(c=l.first();c;c=l.next()) { |
636 | kdDebug() << " - relation: " << c->getSummary() << endl; | 641 | kdDebug() << " - relation: " << c->getSummary() << endl; |
637 | } | 642 | } |
638 | } | 643 | } |
639 | */ | 644 | */ |
640 | 645 | ||
641 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 646 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
642 | // specific order of events. That means that we have to generate parent items | 647 | // specific order of events. That means that we have to generate parent items |
643 | // recursively for proper hierarchical display of Todos. | 648 | // recursively for proper hierarchical display of Todos. |
644 | mTodoMap.clear(); | 649 | mTodoMap.clear(); |
645 | Todo *todo; | 650 | Todo *todo; |
646 | todo = todoList.first();// todo; todo = todoList.next()) { | 651 | todo = todoList.first();// todo; todo = todoList.next()) { |
647 | while ( todo ) { | 652 | while ( todo ) { |
648 | bool next = true; | 653 | bool next = true; |
649 | // qDebug("todo %s ", todo->summary().latin1()); | 654 | // qDebug("todo %s ", todo->summary().latin1()); |
650 | Incidence *incidence = todo->relatedTo(); | 655 | Incidence *incidence = todo->relatedTo(); |
651 | while ( incidence ) { | 656 | while ( incidence ) { |
652 | if ( incidence->type() == "Todo") { | 657 | if ( incidence->type() == "Todo") { |
653 | //qDebug("related %s ",incidence->summary().latin1() ); | 658 | //qDebug("related %s ",incidence->summary().latin1() ); |
654 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 659 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { |
655 | //qDebug("related not found "); | 660 | //qDebug("related not found "); |
656 | todoList.remove( ); | 661 | todoList.remove( ); |
657 | todo = todoList.current(); | 662 | todo = todoList.current(); |
658 | next = false; | 663 | next = false; |
659 | incidence = 0; | 664 | incidence = 0; |
660 | 665 | ||
661 | } else { | 666 | } else { |
662 | //qDebug("related found "); | 667 | //qDebug("related found "); |
663 | incidence = incidence->relatedTo(); | 668 | incidence = incidence->relatedTo(); |
664 | } | 669 | } |
665 | } else | 670 | } else |
666 | incidence = 0; | 671 | incidence = 0; |
667 | } | 672 | } |
668 | if ( next ) | 673 | if ( next ) |
669 | todo = todoList.next(); | 674 | todo = todoList.next(); |
670 | } | 675 | } |
671 | // qDebug("again .... "); | 676 | // qDebug("again .... "); |
672 | // for(todo = todoList.first(); todo; todo = todoList.next()) { | 677 | // for(todo = todoList.first(); todo; todo = todoList.next()) { |
673 | 678 | ||
674 | // qDebug("yytodo %s ", todo->summary().latin1()); | 679 | // qDebug("yytodo %s ", todo->summary().latin1()); |
675 | // } | 680 | // } |
676 | //qDebug("for "); | 681 | //qDebug("for "); |
677 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 682 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
678 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) | 683 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) |
679 | { | 684 | { |
680 | insertTodoItem(todo); | 685 | insertTodoItem(todo); |
681 | } | 686 | } |
682 | } | 687 | } |
683 | //qDebug("for end "); | 688 | //qDebug("for end "); |
684 | // Restore opened/closed state | 689 | // Restore opened/closed state |
685 | mTodoListView->blockSignals( true ); | 690 | mTodoListView->blockSignals( true ); |
686 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 691 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
687 | mTodoListView->blockSignals( false ); | 692 | mTodoListView->blockSignals( false ); |
688 | mTodoListView->setFocus(); | 693 | mTodoListView->setFocus(); |
694 | if ( mTodoListView->firstChild () ) { | ||
695 | if ( oldInc ) { | ||
696 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); | ||
697 | while ( item ) { | ||
698 | if ( item->todo() == oldInc ) { | ||
699 | mTodoListView->setCurrentItem( item ); | ||
700 | mTodoListView->ensureItemVisible( item ); | ||
701 | break; | ||
702 | } | ||
703 | item = (KOTodoViewItem*)item->itemBelow(); | ||
704 | } | ||
705 | if ( ! item ) | ||
706 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | ||
707 | } else { | ||
708 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | ||
709 | } | ||
710 | } | ||
689 | processSelectionChange(); | 711 | processSelectionChange(); |
690 | } | 712 | } |
691 | 713 | ||
692 | bool KOTodoView::checkTodo( Todo * todo ) | 714 | bool KOTodoView::checkTodo( Todo * todo ) |
693 | { | 715 | { |
694 | 716 | ||
695 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 717 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
696 | return false; | 718 | return false; |
697 | if ( !todo->isCompleted() ) { | 719 | if ( !todo->isCompleted() ) { |
698 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) | 720 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) |
699 | return true; | 721 | return true; |
700 | } | 722 | } |
701 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 723 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
702 | if ( todo->hasStartDate() ) | 724 | if ( todo->hasStartDate() ) |
703 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 725 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
704 | return false; | 726 | return false; |
705 | if ( todo->hasDueDate() ) | 727 | if ( todo->hasDueDate() ) |
706 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 728 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
707 | return false; | 729 | return false; |
708 | } | 730 | } |
709 | return true; | 731 | return true; |
710 | } | 732 | } |
711 | 733 | ||
712 | void KOTodoView::restoreItemState( QListViewItem *item ) | 734 | void KOTodoView::restoreItemState( QListViewItem *item ) |
713 | { | 735 | { |
714 | pendingSubtodo = 0; | 736 | pendingSubtodo = 0; |
715 | while( item ) { | 737 | while( item ) { |
716 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 738 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
717 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 739 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
718 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 740 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
719 | item = item->nextSibling(); | 741 | item = item->nextSibling(); |
720 | } | 742 | } |
721 | } | 743 | } |
722 | 744 | ||
723 | 745 | ||
724 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 746 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
725 | KOTodoView::insertTodoItem(Todo *todo) | 747 | KOTodoView::insertTodoItem(Todo *todo) |
726 | { | 748 | { |
727 | 749 | ||
728 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 750 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
729 | // TODO: Check, if dynmaic cast is necessary | 751 | // TODO: Check, if dynmaic cast is necessary |
730 | 752 | ||
731 | pendingSubtodo = 0; | 753 | pendingSubtodo = 0; |
732 | Incidence *incidence = todo->relatedTo(); | 754 | Incidence *incidence = todo->relatedTo(); |
733 | if (incidence && incidence->type() == "Todo") { | 755 | if (incidence && incidence->type() == "Todo") { |
734 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 756 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
735 | 757 | ||
736 | // kdDebug() << " has Related" << endl; | 758 | // kdDebug() << " has Related" << endl; |
737 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 759 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
738 | itemIterator = mTodoMap.find(relatedTodo); | 760 | itemIterator = mTodoMap.find(relatedTodo); |
739 | if (itemIterator == mTodoMap.end()) { | 761 | if (itemIterator == mTodoMap.end()) { |
740 | // kdDebug() << " related not yet in list" << endl; | 762 | // kdDebug() << " related not yet in list" << endl; |
741 | itemIterator = insertTodoItem (relatedTodo); | 763 | itemIterator = insertTodoItem (relatedTodo); |
742 | } | 764 | } |
743 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 765 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
744 | // and one into the map. Sure finding is more easy but why? -zecke | 766 | // and one into the map. Sure finding is more easy but why? -zecke |
745 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 767 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
746 | return mTodoMap.insert(todo,todoItem); | 768 | return mTodoMap.insert(todo,todoItem); |
747 | } else { | 769 | } else { |
748 | // kdDebug() << " no Related" << endl; | 770 | // kdDebug() << " no Related" << endl; |
749 | // see above -zecke | 771 | // see above -zecke |
750 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 772 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
751 | return mTodoMap.insert(todo,todoItem); | 773 | return mTodoMap.insert(todo,todoItem); |
752 | } | 774 | } |
753 | } | 775 | } |
754 | 776 | ||
755 | 777 | ||
756 | void KOTodoView::updateConfig() | 778 | void KOTodoView::updateConfig() |
757 | { | 779 | { |
758 | updateView(); | 780 | updateView(); |
759 | mTodoListView->repaintContents(); | 781 | mTodoListView->repaintContents(); |
760 | } | 782 | } |
761 | 783 | ||
762 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 784 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
763 | { | 785 | { |
764 | QPtrList<Incidence> selected; | 786 | QPtrList<Incidence> selected; |
765 | 787 | ||
766 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 788 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
767 | // if (!item) item = mActiveItem; | 789 | // if (!item) item = mActiveItem; |
768 | if (item) selected.append(item->todo()); | 790 | if (item) selected.append(item->todo()); |
769 | 791 | ||
770 | return selected; | 792 | return selected; |
771 | } | 793 | } |
772 | 794 | ||
773 | QPtrList<Todo> KOTodoView::selectedTodos() | 795 | QPtrList<Todo> KOTodoView::selectedTodos() |
774 | { | 796 | { |
775 | QPtrList<Todo> selected; | 797 | QPtrList<Todo> selected; |
776 | 798 | ||
777 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 799 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
778 | // if (!item) item = mActiveItem; | 800 | // if (!item) item = mActiveItem; |
779 | if (item) selected.append(item->todo()); | 801 | if (item) selected.append(item->todo()); |
780 | 802 | ||
781 | return selected; | 803 | return selected; |
782 | } | 804 | } |
783 | 805 | ||
784 | void KOTodoView::changeEventDisplay(Event *, int) | 806 | void KOTodoView::changeEventDisplay(Event *, int) |
785 | { | 807 | { |
786 | updateView(); | 808 | updateView(); |
787 | } | 809 | } |
788 | 810 | ||
789 | void KOTodoView::showDates(const QDate &, const QDate &) | 811 | void KOTodoView::showDates(const QDate &, const QDate &) |
790 | { | 812 | { |
791 | } | 813 | } |
792 | 814 | ||
793 | void KOTodoView::showEvents(QPtrList<Event>) | 815 | void KOTodoView::showEvents(QPtrList<Event>) |
794 | { | 816 | { |
795 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 817 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
796 | } | 818 | } |
797 | 819 | ||
798 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 820 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
799 | const QDate &td) | 821 | const QDate &td) |
800 | { | 822 | { |
801 | #ifndef KORG_NOPRINTER | 823 | #ifndef KORG_NOPRINTER |
802 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 824 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
803 | #endif | 825 | #endif |
804 | } | 826 | } |
805 | 827 | ||
806 | void KOTodoView::editItem(QListViewItem *item ) | 828 | void KOTodoView::editItem(QListViewItem *item ) |
807 | { | 829 | { |
808 | // qDebug("editItem(QListViewItem *item ) "); | 830 | // qDebug("editItem(QListViewItem *item ) "); |
809 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 831 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
810 | } | 832 | } |
811 | 833 | ||
812 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 834 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
813 | { | 835 | { |
814 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 836 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
815 | } | 837 | } |
816 | 838 | ||
817 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 839 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) |
818 | { | 840 | { |
819 | pendingSubtodo = 0; | 841 | pendingSubtodo = 0; |
820 | mActiveItem = (KOTodoViewItem *)item; | 842 | mActiveItem = (KOTodoViewItem *)item; |
821 | if (item) { | 843 | if (item) { |
822 | switch (column){ | 844 | switch (column){ |
823 | case 1: | 845 | case 1: |
824 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 846 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
825 | case 2: | 847 | case 2: |
826 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 848 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
827 | case 3: | 849 | case 3: |
828 | moveTodo(); | 850 | moveTodo(); |
829 | break; | 851 | break; |
830 | case 8: | 852 | case 8: |
831 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; | 853 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; |
832 | default: | 854 | default: |
833 | mItemPopupMenu->popup(QCursor::pos()); | 855 | mItemPopupMenu->popup(QCursor::pos()); |
834 | } | 856 | } |
835 | } else mPopupMenu->popup(QCursor::pos()); | 857 | } else mPopupMenu->popup(QCursor::pos()); |
836 | } | 858 | } |
837 | void KOTodoView::newTodo() | 859 | void KOTodoView::newTodo() |
838 | { | 860 | { |
839 | emit newTodoSignal(); | 861 | emit newTodoSignal(); |
840 | } | 862 | } |
841 | 863 | ||
842 | void KOTodoView::newSubTodo() | 864 | void KOTodoView::newSubTodo() |
843 | { | 865 | { |
844 | if (mActiveItem) { | 866 | if (mActiveItem) { |
845 | emit newSubTodoSignal(mActiveItem->todo()); | 867 | emit newSubTodoSignal(mActiveItem->todo()); |
846 | } | 868 | } |
847 | } | 869 | } |
848 | void KOTodoView::unparentTodo() | 870 | void KOTodoView::unparentTodo() |
849 | { | 871 | { |
850 | if (mActiveItem) { | 872 | if (mActiveItem) { |
851 | emit unparentTodoSignal(mActiveItem->todo()); | 873 | emit unparentTodoSignal(mActiveItem->todo()); |
852 | } | 874 | } |
853 | } | 875 | } |
854 | 876 | ||
855 | void KOTodoView::reparentTodo() | 877 | void KOTodoView::reparentTodo() |
856 | { | 878 | { |
857 | if (mActiveItem) { | 879 | if (mActiveItem) { |
858 | qDebug("KOTodoView::reparentTodo() "); | 880 | qDebug("KOTodoView::reparentTodo() "); |
859 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 881 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
860 | pendingSubtodo = mActiveItem; | 882 | pendingSubtodo = mActiveItem; |
861 | } | 883 | } |
862 | } | 884 | } |
863 | void KOTodoView::editTodo() | 885 | void KOTodoView::editTodo() |
864 | { | 886 | { |
865 | if (mActiveItem) { | 887 | if (mActiveItem) { |
866 | emit editTodoSignal(mActiveItem->todo()); | 888 | emit editTodoSignal(mActiveItem->todo()); |
867 | } | 889 | } |
868 | } | 890 | } |
869 | void KOTodoView::cloneTodo() | 891 | void KOTodoView::cloneTodo() |
870 | { | 892 | { |
871 | if (mActiveItem) { | 893 | if (mActiveItem) { |
872 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 894 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
873 | } | 895 | } |
874 | } | 896 | } |
875 | void KOTodoView::cancelTodo() | 897 | void KOTodoView::cancelTodo() |
876 | { | 898 | { |
877 | if (mActiveItem) { | 899 | if (mActiveItem) { |
878 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 900 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
879 | } | 901 | } |
880 | } | 902 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 4f2cccf..2de7f28 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -98,385 +98,384 @@ class KOex2phonePrefs : public QDialog | |||
98 | temphb = new QHBox( this ); | 98 | temphb = new QHBox( this ); |
99 | new QLabel( i18n("Model(opt.): "), temphb ); | 99 | new QLabel( i18n("Model(opt.): "), temphb ); |
100 | mPhoneModel = new QLineEdit( temphb); | 100 | mPhoneModel = new QLineEdit( temphb); |
101 | lay->addWidget( temphb ); | 101 | lay->addWidget( temphb ); |
102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
103 | mWriteBackFuture->setChecked( true ); | 103 | mWriteBackFuture->setChecked( true ); |
104 | lay->addWidget( mWriteBackFuture ); | 104 | lay->addWidget( mWriteBackFuture ); |
105 | temphb = new QHBox( this ); | 105 | temphb = new QHBox( this ); |
106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
108 | mWriteBackFutureWeeks->setValue( 8 ); | 108 | mWriteBackFutureWeeks->setValue( 8 ); |
109 | lay->addWidget( temphb ); | 109 | lay->addWidget( temphb ); |
110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
111 | lab->setAlignment (AlignHCenter ); | 111 | lab->setAlignment (AlignHCenter ); |
112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
113 | lay->addWidget( ok ); | 113 | lay->addWidget( ok ); |
114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
115 | lay->addWidget( cancel ); | 115 | lay->addWidget( cancel ); |
116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
118 | resize( 220, 240 ); | 118 | resize( 220, 240 ); |
119 | qApp->processEvents(); | 119 | qApp->processEvents(); |
120 | int dw = QApplication::desktop()->width(); | 120 | int dw = QApplication::desktop()->width(); |
121 | int dh = QApplication::desktop()->height(); | 121 | int dh = QApplication::desktop()->height(); |
122 | move( (dw-width())/2, (dh - height() )/2 ); | 122 | move( (dw-width())/2, (dh - height() )/2 ); |
123 | } | 123 | } |
124 | 124 | ||
125 | public: | 125 | public: |
126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
127 | QCheckBox* mWriteBackFuture; | 127 | QCheckBox* mWriteBackFuture; |
128 | QSpinBox* mWriteBackFutureWeeks; | 128 | QSpinBox* mWriteBackFutureWeeks; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | int globalFlagBlockStartup; | 131 | int globalFlagBlockStartup; |
132 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 132 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
133 | QMainWindow( parent, name ) | 133 | QMainWindow( parent, name ) |
134 | { | 134 | { |
135 | 135 | ||
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 > 22 ) | 147 | if ( p->mHourSize > 22 ) |
148 | p->mHourSize = 22; | 148 | p->mHourSize = 22; |
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 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 168 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
169 | splash->setAlignment ( AlignCenter ); | 169 | splash->setAlignment ( AlignCenter ); |
170 | setCentralWidget( splash ); | 170 | setCentralWidget( splash ); |
171 | #ifndef DESKTOP_VERSION | 171 | #ifndef DESKTOP_VERSION |
172 | showMaximized(); | 172 | showMaximized(); |
173 | #endif | 173 | #endif |
174 | 174 | ||
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()->setAllDefaults(); | 232 | KOPrefs::instance()->setAllDefaults(); |
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(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 260 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
261 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 261 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
264 | mSyncManager->setDefaultFileName( sentSyncFile()); | 264 | mSyncManager->setDefaultFileName( sentSyncFile()); |
265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
266 | mSyncManager->fillSyncMenu(); | 266 | mSyncManager->fillSyncMenu(); |
267 | 267 | ||
268 | 268 | ||
269 | 269 | ||
270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
271 | if ( showWarning ) { | 271 | if ( showWarning ) { |
272 | KMessageBox::information( this, | 272 | KMessageBox::information( this, |
273 | "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"); | 273 | "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"); |
274 | qApp->processEvents(); | 274 | qApp->processEvents(); |
275 | mView->dialogManager()->showSyncOptions(); | 275 | mView->dialogManager()->showSyncOptions(); |
276 | } | 276 | } |
277 | 277 | ||
278 | //US listen for result adressed from Ka/Pi | 278 | //US listen for result adressed from Ka/Pi |
279 | #ifndef DESKTOP_VERSION | 279 | #ifndef DESKTOP_VERSION |
280 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 280 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
281 | #endif | 281 | #endif |
282 | #ifndef DESKTOP_VERSION | 282 | #ifndef DESKTOP_VERSION |
283 | infrared = 0; | 283 | infrared = 0; |
284 | #endif | 284 | #endif |
285 | updateWeek( mView->startDate() ); | 285 | updateWeek( mView->startDate() ); |
286 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 286 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
287 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 287 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
288 | mBRdisabled = false; | 288 | mBRdisabled = false; |
289 | //toggleBeamReceive(); | 289 | //toggleBeamReceive(); |
290 | setFocusPolicy ( WheelFocus ); | ||
291 | } | 290 | } |
292 | MainWindow::~MainWindow() | 291 | MainWindow::~MainWindow() |
293 | { | 292 | { |
294 | //qDebug("MainWindow::~MainWindow() "); | 293 | //qDebug("MainWindow::~MainWindow() "); |
295 | //save toolbar location | 294 | //save toolbar location |
296 | delete mCalendar; | 295 | delete mCalendar; |
297 | delete mSyncManager; | 296 | delete mSyncManager; |
298 | #ifndef DESKTOP_VERSION | 297 | #ifndef DESKTOP_VERSION |
299 | if ( infrared ) | 298 | if ( infrared ) |
300 | delete infrared; | 299 | delete infrared; |
301 | #endif | 300 | #endif |
302 | 301 | ||
303 | 302 | ||
304 | } | 303 | } |
305 | 304 | ||
306 | void MainWindow::disableBR(bool b) | 305 | void MainWindow::disableBR(bool b) |
307 | { | 306 | { |
308 | #ifndef DESKTOP_VERSION | 307 | #ifndef DESKTOP_VERSION |
309 | if ( b ) { | 308 | if ( b ) { |
310 | if ( infrared ) { | 309 | if ( infrared ) { |
311 | toggleBeamReceive(); | 310 | toggleBeamReceive(); |
312 | mBRdisabled = true; | 311 | mBRdisabled = true; |
313 | } | 312 | } |
314 | mBRdisabled = true; | 313 | mBRdisabled = true; |
315 | } else { | 314 | } else { |
316 | if ( mBRdisabled ) { | 315 | if ( mBRdisabled ) { |
317 | mBRdisabled = false; | 316 | mBRdisabled = false; |
318 | //makes no sense,because other cal ap is probably running | 317 | //makes no sense,because other cal ap is probably running |
319 | // toggleBeamReceive(); | 318 | // toggleBeamReceive(); |
320 | } | 319 | } |
321 | } | 320 | } |
322 | #endif | 321 | #endif |
323 | 322 | ||
324 | } | 323 | } |
325 | bool MainWindow::beamReceiveEnabled() | 324 | bool MainWindow::beamReceiveEnabled() |
326 | { | 325 | { |
327 | #ifndef DESKTOP_VERSION | 326 | #ifndef DESKTOP_VERSION |
328 | return ( infrared != 0 ); | 327 | return ( infrared != 0 ); |
329 | #endif | 328 | #endif |
330 | return false; | 329 | return false; |
331 | } | 330 | } |
332 | 331 | ||
333 | void MainWindow::toggleBeamReceive() | 332 | void MainWindow::toggleBeamReceive() |
334 | { | 333 | { |
335 | if ( mBRdisabled ) | 334 | if ( mBRdisabled ) |
336 | return; | 335 | return; |
337 | #ifndef DESKTOP_VERSION | 336 | #ifndef DESKTOP_VERSION |
338 | if ( infrared ) { | 337 | if ( infrared ) { |
339 | qDebug("disable BeamReceive "); | 338 | qDebug("disable BeamReceive "); |
340 | delete infrared; | 339 | delete infrared; |
341 | infrared = 0; | 340 | infrared = 0; |
342 | brAction->setOn(false); | 341 | brAction->setOn(false); |
343 | return; | 342 | return; |
344 | } | 343 | } |
345 | qDebug("enable BeamReceive "); | 344 | qDebug("enable BeamReceive "); |
346 | brAction->setOn(true); | 345 | brAction->setOn(true); |
347 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
348 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 347 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
349 | #endif | 348 | #endif |
350 | } | 349 | } |
351 | void MainWindow::showMaximized () | 350 | void MainWindow::showMaximized () |
352 | { | 351 | { |
353 | #ifndef DESKTOP_VERSION | 352 | #ifndef DESKTOP_VERSION |
354 | if ( ! globalFlagBlockStartup ) | 353 | if ( ! globalFlagBlockStartup ) |
355 | if ( mClosed ) | 354 | if ( mClosed ) |
356 | mView->goToday(); | 355 | mView->goToday(); |
357 | #endif | 356 | #endif |
358 | QWidget::showMaximized () ; | 357 | QWidget::showMaximized () ; |
359 | mClosed = false; | 358 | mClosed = false; |
360 | } | 359 | } |
361 | void MainWindow::closeEvent( QCloseEvent* ce ) | 360 | void MainWindow::closeEvent( QCloseEvent* ce ) |
362 | { | 361 | { |
363 | 362 | ||
364 | 363 | ||
365 | 364 | ||
366 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 365 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
367 | saveOnClose(); | 366 | saveOnClose(); |
368 | mClosed = true; | 367 | mClosed = true; |
369 | ce->accept(); | 368 | ce->accept(); |
370 | return; | 369 | return; |
371 | 370 | ||
372 | } | 371 | } |
373 | 372 | ||
374 | switch( QMessageBox::information( this, "KO/Pi", | 373 | switch( QMessageBox::information( this, "KO/Pi", |
375 | i18n("Do you really want\nto close KO/Pi?"), | 374 | i18n("Do you really want\nto close KO/Pi?"), |
376 | i18n("Close"), i18n("No"), | 375 | i18n("Close"), i18n("No"), |
377 | 0, 0 ) ) { | 376 | 0, 0 ) ) { |
378 | case 0: | 377 | case 0: |
379 | saveOnClose(); | 378 | saveOnClose(); |
380 | mClosed = true; | 379 | mClosed = true; |
381 | ce->accept(); | 380 | ce->accept(); |
382 | break; | 381 | break; |
383 | case 1: | 382 | case 1: |
384 | ce->ignore(); | 383 | ce->ignore(); |
385 | break; | 384 | break; |
386 | case 2: | 385 | case 2: |
387 | 386 | ||
388 | default: | 387 | default: |
389 | break; | 388 | break; |
390 | } | 389 | } |
391 | 390 | ||
392 | 391 | ||
393 | } | 392 | } |
394 | 393 | ||
395 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 394 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
396 | { | 395 | { |
397 | QDataStream stream( data, IO_ReadOnly ); | 396 | QDataStream stream( data, IO_ReadOnly ); |
398 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 397 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
399 | //QString datamess; | 398 | //QString datamess; |
400 | //qDebug("message "); | 399 | //qDebug("message "); |
401 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 400 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
402 | 401 | ||
403 | if ( cmsg == "setDocument(QString)" ) { | 402 | if ( cmsg == "setDocument(QString)" ) { |
404 | QDataStream stream( data, IO_ReadOnly ); | 403 | QDataStream stream( data, IO_ReadOnly ); |
405 | QString fileName; | 404 | QString fileName; |
406 | stream >> fileName; | 405 | stream >> fileName; |
407 | //qDebug("filename %s ", fileName.latin1()); | 406 | //qDebug("filename %s ", fileName.latin1()); |
408 | showMaximized(); | 407 | showMaximized(); |
409 | raise(); | 408 | raise(); |
410 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 409 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
411 | mSyncManager->slotSyncMenu( 1002 ); | 410 | mSyncManager->slotSyncMenu( 1002 ); |
412 | return; | 411 | return; |
413 | } | 412 | } |
414 | 413 | ||
415 | if ( cmsg == "-writeFile" ) { | 414 | if ( cmsg == "-writeFile" ) { |
416 | // I made from the "-writeFile" an "-writeAlarm" | 415 | // I made from the "-writeFile" an "-writeAlarm" |
417 | mView->viewManager()->showWhatsNextView(); | 416 | mView->viewManager()->showWhatsNextView(); |
418 | mCalendar->checkAlarmForIncidence( 0, true); | 417 | mCalendar->checkAlarmForIncidence( 0, true); |
419 | showMaximized(); | 418 | showMaximized(); |
420 | raise(); | 419 | raise(); |
421 | return; | 420 | return; |
422 | 421 | ||
423 | } | 422 | } |
424 | if ( cmsg == "-writeFileSilent" ) { | 423 | if ( cmsg == "-writeFileSilent" ) { |
425 | // I made from the "-writeFile" an "-writeAlarm" | 424 | // I made from the "-writeFile" an "-writeAlarm" |
426 | // mView->viewManager()->showWhatsNextView(); | 425 | // mView->viewManager()->showWhatsNextView(); |
427 | mCalendar->checkAlarmForIncidence( 0, true); | 426 | mCalendar->checkAlarmForIncidence( 0, true); |
428 | //showMaximized(); | 427 | //showMaximized(); |
429 | //raise(); | 428 | //raise(); |
430 | hide(); | 429 | hide(); |
431 | return; | 430 | return; |
432 | } | 431 | } |
433 | if ( cmsg == "-newCountdown" ) { | 432 | if ( cmsg == "-newCountdown" ) { |
434 | qDebug("newCountdown "); | 433 | qDebug("newCountdown "); |
435 | 434 | ||
436 | } | 435 | } |
437 | QString msg ; | 436 | QString msg ; |
438 | QString allmsg = cmsg; | 437 | QString allmsg = cmsg; |
439 | while ( allmsg.length() > 0 ) { | 438 | while ( allmsg.length() > 0 ) { |
440 | int nextC = allmsg.find( "-", 1 ); | 439 | int nextC = allmsg.find( "-", 1 ); |
441 | if ( nextC == -1 ) { | 440 | if ( nextC == -1 ) { |
442 | msg = allmsg; | 441 | msg = allmsg; |
443 | allmsg = ""; | 442 | allmsg = ""; |
444 | } else{ | 443 | } else{ |
445 | msg = allmsg.left( nextC ); | 444 | msg = allmsg.left( nextC ); |
446 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
447 | } | 446 | } |
448 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
449 | if ( msg == "-newEvent" ) { | 448 | if ( msg == "-newEvent" ) { |
450 | mView->newEvent(); | 449 | mView->newEvent(); |
451 | } | 450 | } |
452 | if ( msg == "-newTodo" ) { | 451 | if ( msg == "-newTodo" ) { |
453 | mView->newTodo(); | 452 | mView->newTodo(); |
454 | 453 | ||
455 | } | 454 | } |
456 | if ( msg == "-showWN" ) { | 455 | if ( msg == "-showWN" ) { |
457 | mView->viewManager()->showWhatsNextView(); | 456 | mView->viewManager()->showWhatsNextView(); |
458 | } | 457 | } |
459 | if ( msg == "-showTodo" ) { | 458 | if ( msg == "-showTodo" ) { |
460 | mView->viewManager()->showTodoView(); | 459 | mView->viewManager()->showTodoView(); |
461 | } | 460 | } |
462 | if ( msg == "-showList" ) { | 461 | if ( msg == "-showList" ) { |
463 | mView->viewManager()->showListView(); | 462 | mView->viewManager()->showListView(); |
464 | } | 463 | } |
465 | else if ( msg == "-showDay" ) { | 464 | else if ( msg == "-showDay" ) { |
466 | mView->viewManager()->showDayView(); | 465 | mView->viewManager()->showDayView(); |
467 | } | 466 | } |
468 | else if ( msg == "-showWWeek" ) { | 467 | else if ( msg == "-showWWeek" ) { |
469 | mView->viewManager()->showWorkWeekView(); | 468 | mView->viewManager()->showWorkWeekView(); |
470 | } | 469 | } |
471 | else if ( msg == "-ringSync" ) { | 470 | else if ( msg == "-ringSync" ) { |
472 | mSyncManager->multiSync( false ); | 471 | mSyncManager->multiSync( false ); |
473 | } | 472 | } |
474 | else if ( msg == "-showWeek" ) { | 473 | else if ( msg == "-showWeek" ) { |
475 | mView->viewManager()->showWeekView(); | 474 | mView->viewManager()->showWeekView(); |
476 | } | 475 | } |
477 | else if ( msg == "-showTodo" ) { | 476 | else if ( msg == "-showTodo" ) { |
478 | mView->viewManager()->showTodoView(); | 477 | mView->viewManager()->showTodoView(); |
479 | } | 478 | } |
480 | else if ( msg == "-showJournal" ) { | 479 | else if ( msg == "-showJournal" ) { |
481 | mView->dateNavigator()->selectDates( 1 ); | 480 | mView->dateNavigator()->selectDates( 1 ); |
482 | mView->dateNavigator()->selectToday(); | 481 | mView->dateNavigator()->selectToday(); |