author | zautrix <zautrix> | 2005-04-14 18:55:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-14 18:55:22 (UTC) |
commit | 2a449f785f955649df9de639d38dcb250fe1376d (patch) (unidiff) | |
tree | 41aa30a1267ca70f4b9b8c07be26b3c577dc2874 | |
parent | d334d77ab00b91b9527bb5992b476c656c88b2fa (diff) | |
download | kdepimpi-2a449f785f955649df9de639d38dcb250fe1376d.zip kdepimpi-2a449f785f955649df9de639d38dcb250fe1376d.tar.gz kdepimpi-2a449f785f955649df9de639d38dcb250fe1376d.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 1dce841..baa11b5 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp | |||
@@ -44,271 +44,269 @@ KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) | |||
44 | sendSignalViewerClosed = true; | 44 | sendSignalViewerClosed = true; |
45 | mEventViewer = new KOEventViewer(this); | 45 | mEventViewer = new KOEventViewer(this); |
46 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 46 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
47 | setMainWidget(mEventViewer); | 47 | setMainWidget(mEventViewer); |
48 | setButtonText(Ok, i18n("Edit") ); | 48 | setButtonText(Ok, i18n("Edit") ); |
49 | 49 | ||
50 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), | 50 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), |
51 | SLOT(editIncidence())); | 51 | SLOT(editIncidence())); |
52 | QObject::connect(this,SIGNAL(user1Clicked()), | 52 | QObject::connect(this,SIGNAL(user1Clicked()), |
53 | SLOT(showIncidence())); | 53 | SLOT(showIncidence())); |
54 | mIncidence = 0; | 54 | mIncidence = 0; |
55 | // TODO: Set a sensible size (based on the content?). | 55 | // TODO: Set a sensible size (based on the content?). |
56 | //showMaximized(); | 56 | //showMaximized(); |
57 | //qDebug("++++++++++++KOEventViewerDialog() "); | 57 | //qDebug("++++++++++++KOEventViewerDialog() "); |
58 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 58 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
59 | // setFixedSize( 240,284 ); | 59 | // setFixedSize( 240,284 ); |
60 | // move( 0, 15 ); | 60 | // move( 0, 15 ); |
61 | // } else { | 61 | // } else { |
62 | // setMinimumSize(300,200); | 62 | // setMinimumSize(300,200); |
63 | // resize(320,300); | 63 | // resize(320,300); |
64 | // } | 64 | // } |
65 | mSyncMode = false; | 65 | mSyncMode = false; |
66 | mSyncResult = 0; | 66 | mSyncResult = 0; |
67 | 67 | ||
68 | } | 68 | } |
69 | 69 | ||
70 | KOEventViewerDialog::~KOEventViewerDialog() | 70 | KOEventViewerDialog::~KOEventViewerDialog() |
71 | { | 71 | { |
72 | //qDebug("-------~KOEventViewerDialog() "); | 72 | //qDebug("-------~KOEventViewerDialog() "); |
73 | } | 73 | } |
74 | void KOEventViewerDialog::showMe() | 74 | void KOEventViewerDialog::showMe() |
75 | { | 75 | { |
76 | 76 | ||
77 | #ifdef DESKTOP_VERSION | 77 | #ifdef DESKTOP_VERSION |
78 | int x,y,w,h; | 78 | int x,y,w,h; |
79 | x = geometry().x(); | 79 | x = geometry().x(); |
80 | y = geometry().y(); | 80 | y = geometry().y(); |
81 | w = width(); | 81 | w = width(); |
82 | h = height(); | 82 | h = height(); |
83 | show(); | 83 | show(); |
84 | setGeometry(x,y,w,h); | 84 | setGeometry(x,y,w,h); |
85 | raise(); | 85 | raise(); |
86 | #else | 86 | #else |
87 | showMaximized(); | 87 | showMaximized(); |
88 | #endif | 88 | #endif |
89 | QTimer::singleShot( 1, this, SLOT ( setMyFocus() ) ); | 89 | QTimer::singleShot( 1, this, SLOT ( setMyFocus() ) ); |
90 | 90 | ||
91 | } | 91 | } |
92 | void KOEventViewerDialog::setMyFocus() | 92 | void KOEventViewerDialog::setMyFocus() |
93 | { | 93 | { |
94 | 94 | ||
95 | setActiveWindow(); | 95 | setActiveWindow(); |
96 | mEventViewer->setFocus(); | 96 | mEventViewer->setFocus(); |
97 | 97 | ||
98 | } | 98 | } |
99 | void KOEventViewerDialog::print() | 99 | void KOEventViewerDialog::print() |
100 | { | 100 | { |
101 | mEventViewer->printMe(); | 101 | mEventViewer->printMe(); |
102 | 102 | ||
103 | } | 103 | } |
104 | void KOEventViewerDialog::setSyncMode( bool b ) | 104 | void KOEventViewerDialog::setSyncMode( bool b ) |
105 | { | 105 | { |
106 | mSyncMode = b; | 106 | mSyncMode = b; |
107 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); | 107 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); |
108 | if ( mSyncMode ) { | 108 | if ( mSyncMode ) { |
109 | findButton( Close )->setText( i18n("Cancel Sync")); | 109 | findButton( Close )->setText( i18n("Cancel Sync")); |
110 | findButton( Ok )->setText( i18n("Remote")); | 110 | findButton( Ok )->setText( i18n("Remote")); |
111 | findButton( User1 )->setText( i18n("Local")); | 111 | findButton( User1 )->setText( i18n("Local")); |
112 | } else { | 112 | } else { |
113 | findButton( Close )->setText( i18n("Close")); | 113 | findButton( Close )->setText( i18n("Close")); |
114 | findButton( Ok )->setText( i18n("Edit")); | 114 | findButton( Ok )->setText( i18n("Edit")); |
115 | findButton( User1 )->setText( i18n("Agenda")); | 115 | findButton( User1 )->setText( i18n("Agenda")); |
116 | } | 116 | } |
117 | mEventViewer->setSyncMode( b ); | 117 | mEventViewer->setSyncMode( b ); |
118 | } | 118 | } |
119 | void KOEventViewerDialog::setColorMode( int m ) | 119 | void KOEventViewerDialog::setColorMode( int m ) |
120 | { | 120 | { |
121 | mEventViewer->setColorMode( m ); | 121 | mEventViewer->setColorMode( m ); |
122 | } | 122 | } |
123 | int KOEventViewerDialog::executeS( bool local ) | 123 | int KOEventViewerDialog::executeS( bool local ) |
124 | { | 124 | { |
125 | mSyncResult = 3; | 125 | mSyncResult = 3; |
126 | if ( local ) | 126 | if ( local ) |
127 | findButton( User1 )->setFocus(); | 127 | findButton( User1 )->setFocus(); |
128 | else | 128 | else |
129 | findButton( Ok )->setFocus(); | 129 | findButton( Ok )->setFocus(); |
130 | exec(); | 130 | exec(); |
131 | return mSyncResult; | 131 | return mSyncResult; |
132 | } | 132 | } |
133 | 133 | ||
134 | void KOEventViewerDialog::updateConfig() | 134 | void KOEventViewerDialog::updateConfig() |
135 | { | 135 | { |
136 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 136 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
137 | 137 | ||
138 | } | 138 | } |
139 | void KOEventViewerDialog::setEvent(Event *event) | 139 | void KOEventViewerDialog::setEvent(Event *event) |
140 | { | 140 | { |
141 | mEventViewer->setEvent(event); | 141 | mEventViewer->setEvent(event); |
142 | mIncidence = event; | 142 | mIncidence = event; |
143 | mEventViewer->setFocus(); | 143 | mEventViewer->setFocus(); |
144 | //findButton( Close )->setFocus(); | 144 | //findButton( Close )->setFocus(); |
145 | if ( !mSyncMode ) { | 145 | if ( !mSyncMode ) { |
146 | findButton( User1 )->setText( i18n("Agenda")); | 146 | findButton( User1 )->setText( i18n("Agenda")); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | void KOEventViewerDialog::setIncidence(Incidence *in ) | 149 | void KOEventViewerDialog::setIncidence(Incidence *in ) |
150 | { | 150 | { |
151 | if ( in->type() == "Event" ) | 151 | if ( in->type() == "Event" ) |
152 | setEvent( (Event*) in ); | 152 | setEvent( (Event*) in ); |
153 | else if ( in->type() =="Todo" ) | 153 | else if ( in->type() =="Todo" ) |
154 | setTodo( (Todo*) in ); | 154 | setTodo( (Todo*) in ); |
155 | else if ( in->type() =="Journal" ) | 155 | else if ( in->type() =="Journal" ) |
156 | setJournal( (Journal*) in ); | 156 | setJournal( (Journal*) in ); |
157 | } | 157 | } |
158 | void KOEventViewerDialog::addIncidence(Incidence *in) | 158 | void KOEventViewerDialog::addIncidence(Incidence *in) |
159 | { | 159 | { |
160 | if ( in->type() == "Event" ) | 160 | if ( in->type() == "Event" ) |
161 | addEvent( (Event*) in ); | 161 | addEvent( (Event*) in ); |
162 | else if ( in->type() =="Todo" ) | 162 | else if ( in->type() =="Todo" ) |
163 | mEventViewer->setTodo( (Todo*) in, false ); | 163 | mEventViewer->setTodo( (Todo*) in, false ); |
164 | else if ( in->type() =="Journal" ) | 164 | else if ( in->type() =="Journal" ) |
165 | mEventViewer->setJournal( (Journal*) in, false ); | 165 | mEventViewer->setJournal( (Journal*) in, false ); |
166 | if ( mSyncMode ) { | 166 | if ( mSyncMode ) { |
167 | findButton( User1 )->setFocus(); | 167 | findButton( User1 )->setFocus(); |
168 | setCaption(i18n("Conflict! Please choose entry")); | 168 | setCaption(i18n("Conflict! Please choose entry")); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | void KOEventViewerDialog::addEvent(Event *event) | 172 | void KOEventViewerDialog::addEvent(Event *event) |
173 | { | 173 | { |
174 | mEventViewer->addEvent(event); | 174 | mEventViewer->addEvent(event); |
175 | mIncidence = event; | 175 | mIncidence = event; |
176 | mEventViewer->setFocus(); | 176 | mEventViewer->setFocus(); |
177 | //findButton( Close )->setFocus(); | 177 | //findButton( Close )->setFocus(); |
178 | if ( !mSyncMode ) { | 178 | if ( !mSyncMode ) { |
179 | findButton( User1 )->setText( i18n("Agenda")); | 179 | findButton( User1 )->setText( i18n("Agenda")); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
183 | void KOEventViewerDialog::setTodo(Todo *event) | 183 | void KOEventViewerDialog::setTodo(Todo *event) |
184 | { | 184 | { |
185 | mEventViewer->setTodo(event); | 185 | mEventViewer->setTodo(event); |
186 | mIncidence = (Incidence*)event; | 186 | mIncidence = (Incidence*)event; |
187 | mEventViewer->setFocus(); | 187 | mEventViewer->setFocus(); |
188 | //findButton( Close )->setFocus(); | 188 | //findButton( Close )->setFocus(); |
189 | if ( !mSyncMode ) { | 189 | if ( !mSyncMode ) { |
190 | findButton( User1 )->setText( i18n("Set complete")); | 190 | findButton( User1 )->setText( i18n("Set complete")); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | void KOEventViewerDialog::setJournal(Journal *j) | 193 | void KOEventViewerDialog::setJournal(Journal *j) |
194 | { | 194 | { |
195 | mEventViewer->setJournal(j); | 195 | mEventViewer->setJournal(j); |
196 | mIncidence = (Incidence*)j; | 196 | mIncidence = (Incidence*)j; |
197 | mEventViewer->setFocus(); | 197 | mEventViewer->setFocus(); |
198 | //findButton( Close )->setFocus(); | 198 | //findButton( Close )->setFocus(); |
199 | if ( !mSyncMode ) { | 199 | if ( !mSyncMode ) { |
200 | findButton( User1 )->setText( i18n("Agenda")); | 200 | findButton( User1 )->setText( i18n("Agenda")); |
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||
204 | void KOEventViewerDialog::addText(QString text) | 204 | void KOEventViewerDialog::addText(QString text) |
205 | { | 205 | { |
206 | mEventViewer->addText(text); | 206 | mEventViewer->addText(text); |
207 | mEventViewer->setFocus(); | 207 | mEventViewer->setFocus(); |
208 | //findButton( Close )->setFocus(); | 208 | //findButton( Close )->setFocus(); |
209 | } | 209 | } |
210 | void KOEventViewerDialog::editIncidence() | 210 | void KOEventViewerDialog::editIncidence() |
211 | { | 211 | { |
212 | sendSignalViewerClosed = false; | 212 | sendSignalViewerClosed = false; |
213 | if ( mSyncMode ) { | 213 | if ( mSyncMode ) { |
214 | mSyncResult = 2; | 214 | mSyncResult = 2; |
215 | accept(); | 215 | accept(); |
216 | return; | 216 | return; |
217 | } | 217 | } |
218 | if ( mIncidence ){ | 218 | if ( mIncidence ){ |
219 | #ifndef DESKTOP_VERSION | 219 | #ifndef DESKTOP_VERSION |
220 | //hide(); | 220 | //hide(); |
221 | close(); | 221 | close(); |
222 | #endif | 222 | #endif |
223 | emit editIncidence( mIncidence ); | 223 | emit editIncidence( mIncidence ); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | void KOEventViewerDialog::showIncidence() | 226 | void KOEventViewerDialog::showIncidence() |
227 | { | 227 | { |
228 | sendSignalViewerClosed = false; | 228 | sendSignalViewerClosed = false; |
229 | if ( mSyncMode ) { | 229 | if ( mSyncMode ) { |
230 | mSyncResult = 1; | 230 | mSyncResult = 1; |
231 | accept(); | 231 | accept(); |
232 | return; | 232 | return; |
233 | } | 233 | } |
234 | 234 | ||
235 | if ( mIncidence ){ | 235 | if ( mIncidence ){ |
236 | #ifndef DESKTOP_VERSION | ||
237 | hide(); | ||
238 | #endif | ||
239 | QDate date; | 236 | QDate date; |
240 | if ( mIncidence->type() == "Todo" ) { | 237 | if ( mIncidence->type() == "Todo" ) { |
241 | /* | 238 | /* |
242 | if ( ((Todo*)mIncidence)->hasDueDate() ) | 239 | if ( ((Todo*)mIncidence)->hasDueDate() ) |
243 | date = ((Todo*)mIncidence)->dtDue().date(); | 240 | date = ((Todo*)mIncidence)->dtDue().date(); |
244 | else { | 241 | else { |
245 | globalFlagBlockAgenda = 2; | 242 | globalFlagBlockAgenda = 2; |
246 | emit showAgendaView( false ); | 243 | emit showAgendaView( false ); |
247 | return; | 244 | return; |
248 | } | 245 | } |
249 | */ | 246 | */ |
250 | ((Todo*)mIncidence)->setCompleted( true ); | 247 | ((Todo*)mIncidence)->setCompleted( true ); |
251 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); | 248 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); |
252 | hide(); | ||
253 | emit todoCompleted(((Todo*)mIncidence)); | 249 | emit todoCompleted(((Todo*)mIncidence)); |
254 | return; | 250 | } else { |
255 | |||
256 | } else | ||
257 | date = mIncidence->dtStart().date(); | 251 | date = mIncidence->dtStart().date(); |
258 | globalFlagBlockAgenda = 1; | 252 | globalFlagBlockAgenda = 1; |
259 | emit showAgendaView( false ); | 253 | emit showAgendaView( false ); |
260 | globalFlagBlockAgenda = 2; | 254 | globalFlagBlockAgenda = 2; |
261 | emit jumpToTime( date ); | 255 | emit jumpToTime( date ); |
256 | } | ||
257 | #ifndef DESKTOP_VERSION | ||
258 | reject(); | ||
259 | #endif | ||
262 | } | 260 | } |
263 | } | 261 | } |
264 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) | 262 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) |
265 | { | 263 | { |
266 | switch ( e->key() ) { | 264 | switch ( e->key() ) { |
267 | 265 | ||
268 | case Qt::Key_A : | 266 | case Qt::Key_A : |
269 | case Qt::Key_L : | 267 | case Qt::Key_L : |
270 | showIncidence(); | 268 | showIncidence(); |
271 | break; | 269 | break; |
272 | case Qt::Key_E : | 270 | case Qt::Key_E : |
273 | case Qt::Key_R : | 271 | case Qt::Key_R : |
274 | editIncidence(); | 272 | editIncidence(); |
275 | break; | 273 | break; |
276 | case Qt::Key_C: | 274 | case Qt::Key_C: |
277 | case Qt::Key_Escape: | 275 | case Qt::Key_Escape: |
278 | sendSignalViewerClosed = true; | 276 | sendSignalViewerClosed = true; |
279 | close(); | 277 | close(); |
280 | break; | 278 | break; |
281 | case Qt::Key_I: | 279 | case Qt::Key_I: |
282 | #ifndef DESKTOP_VERSION | 280 | #ifndef DESKTOP_VERSION |
283 | sendSignalViewerClosed = true; | 281 | sendSignalViewerClosed = true; |
284 | close(); | 282 | close(); |
285 | #else | 283 | #else |
286 | sendSignalViewerClosed = true; | 284 | sendSignalViewerClosed = true; |
287 | slotViewerClosed(); | 285 | slotViewerClosed(); |
288 | //accept(); | 286 | //accept(); |
289 | #endif | 287 | #endif |
290 | break; | 288 | break; |
291 | default: | 289 | default: |
292 | KDialogBase::keyPressEvent ( e ); | 290 | KDialogBase::keyPressEvent ( e ); |
293 | break; | 291 | break; |
294 | } | 292 | } |
295 | 293 | ||
296 | } | 294 | } |
297 | void KOEventViewerDialog::hideEvent ( QHideEvent * e ) | 295 | void KOEventViewerDialog::hideEvent ( QHideEvent * e ) |
298 | { | 296 | { |
299 | KDialogBase::hideEvent ( e ); | 297 | KDialogBase::hideEvent ( e ); |
300 | QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); | 298 | QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); |
301 | } | 299 | } |
302 | 300 | ||
303 | void KOEventViewerDialog::slotViewerClosed() | 301 | void KOEventViewerDialog::slotViewerClosed() |
304 | { | 302 | { |
305 | if ( mSyncMode ) | 303 | if ( mSyncMode ) |
306 | return; | 304 | return; |
307 | 305 | ||
308 | if ( sendSignalViewerClosed ) { | 306 | if ( sendSignalViewerClosed ) { |
309 | //qDebug("KOEventViewerDialog::hideEvent "); | 307 | //qDebug("KOEventViewerDialog::hideEvent "); |
310 | emit signalViewerClosed(); | 308 | emit signalViewerClosed(); |
311 | } | 309 | } |
312 | sendSignalViewerClosed = true; | 310 | sendSignalViewerClosed = true; |
313 | } | 311 | } |
314 | 312 | ||