-rw-r--r-- | korganizer/calendarview.cpp | 18 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 23 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 |
3 files changed, 31 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 92fd59c..3a16fe6 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3097,964 +3097,970 @@ void CalendarView::deleteEvent(Event *anEvent) | |||
3097 | 3097 | ||
3098 | checkExternalId( anEvent); | 3098 | checkExternalId( anEvent); |
3099 | mCalendar->deleteEvent(anEvent); | 3099 | mCalendar->deleteEvent(anEvent); |
3100 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 3100 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
3101 | break; | 3101 | break; |
3102 | 3102 | ||
3103 | // Disabled because it does not work | 3103 | // Disabled because it does not work |
3104 | //#if 0 | 3104 | //#if 0 |
3105 | case KMessageBox::Yes: // just this one | 3105 | case KMessageBox::Yes: // just this one |
3106 | //QDate qd = mNavigator->selectedDates().first(); | 3106 | //QDate qd = mNavigator->selectedDates().first(); |
3107 | //if (!qd.isValid()) { | 3107 | //if (!qd.isValid()) { |
3108 | // kdDebug() << "no date selected, or invalid date" << endl; | 3108 | // kdDebug() << "no date selected, or invalid date" << endl; |
3109 | // KNotifyClient::beep(); | 3109 | // KNotifyClient::beep(); |
3110 | // return; | 3110 | // return; |
3111 | //} | 3111 | //} |
3112 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 3112 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
3113 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 3113 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
3114 | anEvent->addExDate(itemDate); | 3114 | anEvent->addExDate(itemDate); |
3115 | int duration = anEvent->recurrence()->duration(); | 3115 | int duration = anEvent->recurrence()->duration(); |
3116 | if ( duration > 0 ) { | 3116 | if ( duration > 0 ) { |
3117 | anEvent->recurrence()->setDuration( duration - 1 ); | 3117 | anEvent->recurrence()->setDuration( duration - 1 ); |
3118 | } | 3118 | } |
3119 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 3119 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
3120 | } | 3120 | } |
3121 | break; | 3121 | break; |
3122 | //#endif | 3122 | //#endif |
3123 | } // switch | 3123 | } // switch |
3124 | } else { | 3124 | } else { |
3125 | if (KOPrefs::instance()->mConfirm) { | 3125 | if (KOPrefs::instance()->mConfirm) { |
3126 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + | 3126 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + |
3127 | i18n("\nAre you sure you want\nto delete this event?"), | 3127 | i18n("\nAre you sure you want\nto delete this event?"), |
3128 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 3128 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
3129 | case KMessageBox::Continue: // OK | 3129 | case KMessageBox::Continue: // OK |
3130 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3130 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3131 | schedule(Scheduler::Cancel,anEvent); | 3131 | schedule(Scheduler::Cancel,anEvent); |
3132 | checkExternalId( anEvent); | 3132 | checkExternalId( anEvent); |
3133 | mCalendar->deleteEvent(anEvent); | 3133 | mCalendar->deleteEvent(anEvent); |
3134 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3134 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3135 | break; | 3135 | break; |
3136 | } // switch | 3136 | } // switch |
3137 | } else { | 3137 | } else { |
3138 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3138 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3139 | schedule(Scheduler::Cancel,anEvent); | 3139 | schedule(Scheduler::Cancel,anEvent); |
3140 | checkExternalId( anEvent); | 3140 | checkExternalId( anEvent); |
3141 | mCalendar->deleteEvent(anEvent); | 3141 | mCalendar->deleteEvent(anEvent); |
3142 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3142 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3143 | } | 3143 | } |
3144 | } // if-else | 3144 | } // if-else |
3145 | emit updateSearchDialog(); | 3145 | emit updateSearchDialog(); |
3146 | } | 3146 | } |
3147 | 3147 | ||
3148 | bool CalendarView::deleteEvent(const QString &uid) | 3148 | bool CalendarView::deleteEvent(const QString &uid) |
3149 | { | 3149 | { |
3150 | Event *ev = mCalendar->event(uid); | 3150 | Event *ev = mCalendar->event(uid); |
3151 | if (ev) { | 3151 | if (ev) { |
3152 | deleteEvent(ev); | 3152 | deleteEvent(ev); |
3153 | return true; | 3153 | return true; |
3154 | } else { | 3154 | } else { |
3155 | return false; | 3155 | return false; |
3156 | } | 3156 | } |
3157 | } | 3157 | } |
3158 | 3158 | ||
3159 | /*****************************************************************************/ | 3159 | /*****************************************************************************/ |
3160 | 3160 | ||
3161 | void CalendarView::action_mail() | 3161 | void CalendarView::action_mail() |
3162 | { | 3162 | { |
3163 | #ifndef KORG_NOMAIL | 3163 | #ifndef KORG_NOMAIL |
3164 | KOMailClient mailClient; | 3164 | KOMailClient mailClient; |
3165 | 3165 | ||
3166 | Incidence *incidence = currentSelection(); | 3166 | Incidence *incidence = currentSelection(); |
3167 | 3167 | ||
3168 | if (!incidence) { | 3168 | if (!incidence) { |
3169 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3169 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3170 | return; | 3170 | return; |
3171 | } | 3171 | } |
3172 | if(incidence->attendeeCount() == 0 ) { | 3172 | if(incidence->attendeeCount() == 0 ) { |
3173 | KMessageBox::sorry(this, | 3173 | KMessageBox::sorry(this, |
3174 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3174 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3175 | return; | 3175 | return; |
3176 | } | 3176 | } |
3177 | 3177 | ||
3178 | CalendarLocal cal_tmp; | 3178 | CalendarLocal cal_tmp; |
3179 | Event *event = 0; | 3179 | Event *event = 0; |
3180 | Event *ev = 0; | 3180 | Event *ev = 0; |
3181 | if ( incidence && incidence->type() == "Event" ) { | 3181 | if ( incidence && incidence->type() == "Event" ) { |
3182 | event = static_cast<Event *>(incidence); | 3182 | event = static_cast<Event *>(incidence); |
3183 | ev = new Event(*event); | 3183 | ev = new Event(*event); |
3184 | cal_tmp.addEvent(ev); | 3184 | cal_tmp.addEvent(ev); |
3185 | } | 3185 | } |
3186 | ICalFormat mForm(); | 3186 | ICalFormat mForm(); |
3187 | QString attachment = mForm.toString( &cal_tmp ); | 3187 | QString attachment = mForm.toString( &cal_tmp ); |
3188 | if (ev) delete(ev); | 3188 | if (ev) delete(ev); |
3189 | 3189 | ||
3190 | mailClient.mailAttendees(currentSelection(), attachment); | 3190 | mailClient.mailAttendees(currentSelection(), attachment); |
3191 | 3191 | ||
3192 | #endif | 3192 | #endif |
3193 | 3193 | ||
3194 | #if 0 | 3194 | #if 0 |
3195 | Event *anEvent = 0; | 3195 | Event *anEvent = 0; |
3196 | if (mViewManager->currentView()->isEventView()) { | 3196 | if (mViewManager->currentView()->isEventView()) { |
3197 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); | 3197 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); |
3198 | } | 3198 | } |
3199 | 3199 | ||
3200 | if (!anEvent) { | 3200 | if (!anEvent) { |
3201 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3201 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3202 | return; | 3202 | return; |
3203 | } | 3203 | } |
3204 | if(anEvent->attendeeCount() == 0 ) { | 3204 | if(anEvent->attendeeCount() == 0 ) { |
3205 | KMessageBox::sorry(this, | 3205 | KMessageBox::sorry(this, |
3206 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3206 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3207 | return; | 3207 | return; |
3208 | } | 3208 | } |
3209 | 3209 | ||
3210 | mailobject.emailEvent(anEvent); | 3210 | mailobject.emailEvent(anEvent); |
3211 | #endif | 3211 | #endif |
3212 | } | 3212 | } |
3213 | 3213 | ||
3214 | 3214 | ||
3215 | void CalendarView::schedule_publish(Incidence *incidence) | 3215 | void CalendarView::schedule_publish(Incidence *incidence) |
3216 | { | 3216 | { |
3217 | Event *event = 0; | 3217 | Event *event = 0; |
3218 | Todo *todo = 0; | 3218 | Todo *todo = 0; |
3219 | 3219 | ||
3220 | if (incidence == 0) { | 3220 | if (incidence == 0) { |
3221 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3221 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3222 | if (incidence == 0) { | 3222 | if (incidence == 0) { |
3223 | incidence = mTodoList->selectedIncidences().first(); | 3223 | incidence = mTodoList->selectedIncidences().first(); |
3224 | } | 3224 | } |
3225 | } | 3225 | } |
3226 | if ( incidence && incidence->type() == "Event" ) { | 3226 | if ( incidence && incidence->type() == "Event" ) { |
3227 | event = static_cast<Event *>(incidence); | 3227 | event = static_cast<Event *>(incidence); |
3228 | } else { | 3228 | } else { |
3229 | if ( incidence && incidence->type() == "Todo" ) { | 3229 | if ( incidence && incidence->type() == "Todo" ) { |
3230 | todo = static_cast<Todo *>(incidence); | 3230 | todo = static_cast<Todo *>(incidence); |
3231 | } | 3231 | } |
3232 | } | 3232 | } |
3233 | 3233 | ||
3234 | if (!event && !todo) { | 3234 | if (!event && !todo) { |
3235 | KMessageBox::sorry(this,i18n("No event selected.")); | 3235 | KMessageBox::sorry(this,i18n("No event selected.")); |
3236 | return; | 3236 | return; |
3237 | } | 3237 | } |
3238 | 3238 | ||
3239 | PublishDialog *publishdlg = new PublishDialog(); | 3239 | PublishDialog *publishdlg = new PublishDialog(); |
3240 | if (incidence->attendeeCount()>0) { | 3240 | if (incidence->attendeeCount()>0) { |
3241 | QPtrList<Attendee> attendees = incidence->attendees(); | 3241 | QPtrList<Attendee> attendees = incidence->attendees(); |
3242 | attendees.first(); | 3242 | attendees.first(); |
3243 | while ( attendees.current()!=0 ) { | 3243 | while ( attendees.current()!=0 ) { |
3244 | publishdlg->addAttendee(attendees.current()); | 3244 | publishdlg->addAttendee(attendees.current()); |
3245 | attendees.next(); | 3245 | attendees.next(); |
3246 | } | 3246 | } |
3247 | } | 3247 | } |
3248 | bool send = true; | 3248 | bool send = true; |
3249 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { | 3249 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { |
3250 | if ( publishdlg->exec() != QDialog::Accepted ) | 3250 | if ( publishdlg->exec() != QDialog::Accepted ) |
3251 | send = false; | 3251 | send = false; |
3252 | } | 3252 | } |
3253 | if ( send ) { | 3253 | if ( send ) { |
3254 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3254 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3255 | if ( event ) { | 3255 | if ( event ) { |
3256 | Event *ev = new Event(*event); | 3256 | Event *ev = new Event(*event); |
3257 | ev->registerObserver(0); | 3257 | ev->registerObserver(0); |
3258 | ev->clearAttendees(); | 3258 | ev->clearAttendees(); |
3259 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3259 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3260 | delete(ev); | 3260 | delete(ev); |
3261 | } | 3261 | } |
3262 | } else { | 3262 | } else { |
3263 | if ( todo ) { | 3263 | if ( todo ) { |
3264 | Todo *ev = new Todo(*todo); | 3264 | Todo *ev = new Todo(*todo); |
3265 | ev->registerObserver(0); | 3265 | ev->registerObserver(0); |
3266 | ev->clearAttendees(); | 3266 | ev->clearAttendees(); |
3267 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3267 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3268 | delete(ev); | 3268 | delete(ev); |
3269 | } | 3269 | } |
3270 | } | 3270 | } |
3271 | } | 3271 | } |
3272 | } | 3272 | } |
3273 | delete publishdlg; | 3273 | delete publishdlg; |
3274 | } | 3274 | } |
3275 | 3275 | ||
3276 | void CalendarView::schedule_request(Incidence *incidence) | 3276 | void CalendarView::schedule_request(Incidence *incidence) |
3277 | { | 3277 | { |
3278 | schedule(Scheduler::Request,incidence); | 3278 | schedule(Scheduler::Request,incidence); |
3279 | } | 3279 | } |
3280 | 3280 | ||
3281 | void CalendarView::schedule_refresh(Incidence *incidence) | 3281 | void CalendarView::schedule_refresh(Incidence *incidence) |
3282 | { | 3282 | { |
3283 | schedule(Scheduler::Refresh,incidence); | 3283 | schedule(Scheduler::Refresh,incidence); |
3284 | } | 3284 | } |
3285 | 3285 | ||
3286 | void CalendarView::schedule_cancel(Incidence *incidence) | 3286 | void CalendarView::schedule_cancel(Incidence *incidence) |
3287 | { | 3287 | { |
3288 | schedule(Scheduler::Cancel,incidence); | 3288 | schedule(Scheduler::Cancel,incidence); |
3289 | } | 3289 | } |
3290 | 3290 | ||
3291 | void CalendarView::schedule_add(Incidence *incidence) | 3291 | void CalendarView::schedule_add(Incidence *incidence) |
3292 | { | 3292 | { |
3293 | schedule(Scheduler::Add,incidence); | 3293 | schedule(Scheduler::Add,incidence); |
3294 | } | 3294 | } |
3295 | 3295 | ||
3296 | void CalendarView::schedule_reply(Incidence *incidence) | 3296 | void CalendarView::schedule_reply(Incidence *incidence) |
3297 | { | 3297 | { |
3298 | schedule(Scheduler::Reply,incidence); | 3298 | schedule(Scheduler::Reply,incidence); |
3299 | } | 3299 | } |
3300 | 3300 | ||
3301 | void CalendarView::schedule_counter(Incidence *incidence) | 3301 | void CalendarView::schedule_counter(Incidence *incidence) |
3302 | { | 3302 | { |
3303 | schedule(Scheduler::Counter,incidence); | 3303 | schedule(Scheduler::Counter,incidence); |
3304 | } | 3304 | } |
3305 | 3305 | ||
3306 | void CalendarView::schedule_declinecounter(Incidence *incidence) | 3306 | void CalendarView::schedule_declinecounter(Incidence *incidence) |
3307 | { | 3307 | { |
3308 | schedule(Scheduler::Declinecounter,incidence); | 3308 | schedule(Scheduler::Declinecounter,incidence); |
3309 | } | 3309 | } |
3310 | 3310 | ||
3311 | void CalendarView::schedule_publish_freebusy(int daysToPublish) | 3311 | void CalendarView::schedule_publish_freebusy(int daysToPublish) |
3312 | { | 3312 | { |
3313 | QDateTime start = QDateTime::currentDateTime(); | 3313 | QDateTime start = QDateTime::currentDateTime(); |
3314 | QDateTime end = start.addDays(daysToPublish); | 3314 | QDateTime end = start.addDays(daysToPublish); |
3315 | 3315 | ||
3316 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); | 3316 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); |
3317 | freebusy->setOrganizer(KOPrefs::instance()->email()); | 3317 | freebusy->setOrganizer(KOPrefs::instance()->email()); |
3318 | 3318 | ||
3319 | 3319 | ||
3320 | PublishDialog *publishdlg = new PublishDialog(); | 3320 | PublishDialog *publishdlg = new PublishDialog(); |
3321 | if ( publishdlg->exec() == QDialog::Accepted ) { | 3321 | if ( publishdlg->exec() == QDialog::Accepted ) { |
3322 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3322 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3323 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { | 3323 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { |
3324 | delete(freebusy); | 3324 | delete(freebusy); |
3325 | } | 3325 | } |
3326 | } | 3326 | } |
3327 | delete publishdlg; | 3327 | delete publishdlg; |
3328 | } | 3328 | } |
3329 | 3329 | ||
3330 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) | 3330 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) |
3331 | { | 3331 | { |
3332 | Event *event = 0; | 3332 | Event *event = 0; |
3333 | Todo *todo = 0; | 3333 | Todo *todo = 0; |
3334 | 3334 | ||
3335 | if (incidence == 0) { | 3335 | if (incidence == 0) { |
3336 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3336 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3337 | if (incidence == 0) { | 3337 | if (incidence == 0) { |
3338 | incidence = mTodoList->selectedIncidences().first(); | 3338 | incidence = mTodoList->selectedIncidences().first(); |
3339 | } | 3339 | } |
3340 | } | 3340 | } |
3341 | if ( incidence && incidence->type() == "Event" ) { | 3341 | if ( incidence && incidence->type() == "Event" ) { |
3342 | event = static_cast<Event *>(incidence); | 3342 | event = static_cast<Event *>(incidence); |
3343 | } | 3343 | } |
3344 | if ( incidence && incidence->type() == "Todo" ) { | 3344 | if ( incidence && incidence->type() == "Todo" ) { |
3345 | todo = static_cast<Todo *>(incidence); | 3345 | todo = static_cast<Todo *>(incidence); |
3346 | } | 3346 | } |
3347 | 3347 | ||
3348 | if (!event && !todo) { | 3348 | if (!event && !todo) { |
3349 | KMessageBox::sorry(this,i18n("No event selected.")); | 3349 | KMessageBox::sorry(this,i18n("No event selected.")); |
3350 | return; | 3350 | return; |
3351 | } | 3351 | } |
3352 | 3352 | ||
3353 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { | 3353 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { |
3354 | KMessageBox::sorry(this,i18n("The event has no attendees.")); | 3354 | KMessageBox::sorry(this,i18n("The event has no attendees.")); |
3355 | return; | 3355 | return; |
3356 | } | 3356 | } |
3357 | 3357 | ||
3358 | Event *ev = 0; | 3358 | Event *ev = 0; |
3359 | if (event) ev = new Event(*event); | 3359 | if (event) ev = new Event(*event); |
3360 | Todo *to = 0; | 3360 | Todo *to = 0; |
3361 | if (todo) to = new Todo(*todo); | 3361 | if (todo) to = new Todo(*todo); |
3362 | 3362 | ||
3363 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { | 3363 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { |
3364 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 3364 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
3365 | if (!me) { | 3365 | if (!me) { |
3366 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); | 3366 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); |
3367 | return; | 3367 | return; |
3368 | } | 3368 | } |
3369 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { | 3369 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { |
3370 | StatusDialog *statdlg = new StatusDialog(this); | 3370 | StatusDialog *statdlg = new StatusDialog(this); |
3371 | if (!statdlg->exec()==QDialog::Accepted) return; | 3371 | if (!statdlg->exec()==QDialog::Accepted) return; |
3372 | me->setStatus( statdlg->status() ); | 3372 | me->setStatus( statdlg->status() ); |
3373 | delete(statdlg); | 3373 | delete(statdlg); |
3374 | } | 3374 | } |
3375 | Attendee *menew = new Attendee(*me); | 3375 | Attendee *menew = new Attendee(*me); |
3376 | if (ev) { | 3376 | if (ev) { |
3377 | ev->clearAttendees(); | 3377 | ev->clearAttendees(); |
3378 | ev->addAttendee(menew,false); | 3378 | ev->addAttendee(menew,false); |
3379 | } else { | 3379 | } else { |
3380 | if (to) { | 3380 | if (to) { |
3381 | todo->clearAttendees(); | 3381 | todo->clearAttendees(); |
3382 | todo->addAttendee(menew,false); | 3382 | todo->addAttendee(menew,false); |
3383 | } | 3383 | } |
3384 | } | 3384 | } |
3385 | } | 3385 | } |
3386 | 3386 | ||
3387 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3387 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3388 | if (ev) { | 3388 | if (ev) { |
3389 | if ( !dlg->addMessage(ev,method) ) delete(ev); | 3389 | if ( !dlg->addMessage(ev,method) ) delete(ev); |
3390 | } else { | 3390 | } else { |
3391 | if (to) { | 3391 | if (to) { |
3392 | if ( !dlg->addMessage(to,method) ) delete(to); | 3392 | if ( !dlg->addMessage(to,method) ) delete(to); |
3393 | } | 3393 | } |
3394 | } | 3394 | } |
3395 | } | 3395 | } |
3396 | 3396 | ||
3397 | void CalendarView::openAddressbook() | 3397 | void CalendarView::openAddressbook() |
3398 | { | 3398 | { |
3399 | KRun::runCommand("kaddressbook"); | 3399 | KRun::runCommand("kaddressbook"); |
3400 | } | 3400 | } |
3401 | 3401 | ||
3402 | void CalendarView::setModified(bool modified) | 3402 | void CalendarView::setModified(bool modified) |
3403 | { | 3403 | { |
3404 | if ( modified ) | 3404 | if ( modified ) |
3405 | emit signalmodified(); | 3405 | emit signalmodified(); |
3406 | if (mModified != modified) { | 3406 | if (mModified != modified) { |
3407 | mModified = modified; | 3407 | mModified = modified; |
3408 | emit modifiedChanged(mModified); | 3408 | emit modifiedChanged(mModified); |
3409 | } | 3409 | } |
3410 | } | 3410 | } |
3411 | 3411 | ||
3412 | bool CalendarView::isReadOnly() | 3412 | bool CalendarView::isReadOnly() |
3413 | { | 3413 | { |
3414 | return mReadOnly; | 3414 | return mReadOnly; |
3415 | } | 3415 | } |
3416 | 3416 | ||
3417 | void CalendarView::setReadOnly(bool readOnly) | 3417 | void CalendarView::setReadOnly(bool readOnly) |
3418 | { | 3418 | { |
3419 | if (mReadOnly != readOnly) { | 3419 | if (mReadOnly != readOnly) { |
3420 | mReadOnly = readOnly; | 3420 | mReadOnly = readOnly; |
3421 | emit readOnlyChanged(mReadOnly); | 3421 | emit readOnlyChanged(mReadOnly); |
3422 | } | 3422 | } |
3423 | } | 3423 | } |
3424 | 3424 | ||
3425 | bool CalendarView::isModified() | 3425 | bool CalendarView::isModified() |
3426 | { | 3426 | { |
3427 | return mModified; | 3427 | return mModified; |
3428 | } | 3428 | } |
3429 | 3429 | ||
3430 | void CalendarView::printSetup() | 3430 | void CalendarView::printSetup() |
3431 | { | 3431 | { |
3432 | #ifndef KORG_NOPRINTER | 3432 | #ifndef KORG_NOPRINTER |
3433 | createPrinter(); | 3433 | createPrinter(); |
3434 | 3434 | ||
3435 | mCalPrinter->setupPrinter(); | 3435 | mCalPrinter->setupPrinter(); |
3436 | #endif | 3436 | #endif |
3437 | } | 3437 | } |
3438 | 3438 | ||
3439 | void CalendarView::print() | 3439 | void CalendarView::print() |
3440 | { | 3440 | { |
3441 | #ifndef KORG_NOPRINTER | 3441 | #ifndef KORG_NOPRINTER |
3442 | createPrinter(); | 3442 | createPrinter(); |
3443 | 3443 | ||
3444 | DateList tmpDateList = mNavigator->selectedDates(); | 3444 | DateList tmpDateList = mNavigator->selectedDates(); |
3445 | mCalPrinter->print(CalPrinter::Month, | 3445 | mCalPrinter->print(CalPrinter::Month, |
3446 | tmpDateList.first(), tmpDateList.last()); | 3446 | tmpDateList.first(), tmpDateList.last()); |
3447 | #endif | 3447 | #endif |
3448 | } | 3448 | } |
3449 | 3449 | ||
3450 | void CalendarView::printPreview() | 3450 | void CalendarView::printPreview() |
3451 | { | 3451 | { |
3452 | #ifndef KORG_NOPRINTER | 3452 | #ifndef KORG_NOPRINTER |
3453 | kdDebug() << "CalendarView::printPreview()" << endl; | 3453 | kdDebug() << "CalendarView::printPreview()" << endl; |
3454 | 3454 | ||
3455 | createPrinter(); | 3455 | createPrinter(); |
3456 | 3456 | ||
3457 | DateList tmpDateList = mNavigator->selectedDates(); | 3457 | DateList tmpDateList = mNavigator->selectedDates(); |
3458 | 3458 | ||
3459 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), | 3459 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), |
3460 | tmpDateList.last()); | 3460 | tmpDateList.last()); |
3461 | #endif | 3461 | #endif |
3462 | } | 3462 | } |
3463 | 3463 | ||
3464 | void CalendarView::exportICalendar() | 3464 | void CalendarView::exportICalendar() |
3465 | { | 3465 | { |
3466 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 3466 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
3467 | 3467 | ||
3468 | // Force correct extension | 3468 | // Force correct extension |
3469 | if (filename.right(4) != ".ics") filename += ".ics"; | 3469 | if (filename.right(4) != ".ics") filename += ".ics"; |
3470 | 3470 | ||
3471 | FileStorage storage( mCalendar, filename, new ICalFormat() ); | 3471 | FileStorage storage( mCalendar, filename, new ICalFormat() ); |
3472 | storage.save(); | 3472 | storage.save(); |
3473 | } | 3473 | } |
3474 | 3474 | ||
3475 | bool CalendarView::exportVCalendar( QString filename ) | 3475 | bool CalendarView::exportVCalendar( QString filename ) |
3476 | { | 3476 | { |
3477 | if (mCalendar->journals().count() > 0) { | 3477 | if (mCalendar->journals().count() > 0) { |
3478 | int result = KMessageBox::warningContinueCancel(this, | 3478 | int result = KMessageBox::warningContinueCancel(this, |
3479 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 3479 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
3480 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 3480 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
3481 | true); | 3481 | true); |
3482 | if (result != KMessageBox::Continue) return false; | 3482 | if (result != KMessageBox::Continue) return false; |
3483 | } | 3483 | } |
3484 | 3484 | ||
3485 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); | 3485 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); |
3486 | 3486 | ||
3487 | // Force correct extension | 3487 | // Force correct extension |
3488 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 3488 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
3489 | 3489 | ||
3490 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 3490 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
3491 | return storage.save(); | 3491 | return storage.save(); |
3492 | 3492 | ||
3493 | } | 3493 | } |
3494 | 3494 | ||
3495 | void CalendarView::eventUpdated(Incidence *) | 3495 | void CalendarView::eventUpdated(Incidence *) |
3496 | { | 3496 | { |
3497 | setModified(); | 3497 | setModified(); |
3498 | // Don't call updateView here. The code, which has caused the update of the | 3498 | // Don't call updateView here. The code, which has caused the update of the |
3499 | // event is responsible for updating the view. | 3499 | // event is responsible for updating the view. |
3500 | // updateView(); | 3500 | // updateView(); |
3501 | } | 3501 | } |
3502 | 3502 | ||
3503 | void CalendarView::adaptNavigationUnits() | 3503 | void CalendarView::adaptNavigationUnits() |
3504 | { | 3504 | { |
3505 | if (mViewManager->currentView()->isEventView()) { | 3505 | if (mViewManager->currentView()->isEventView()) { |
3506 | int days = mViewManager->currentView()->currentDateCount(); | 3506 | int days = mViewManager->currentView()->currentDateCount(); |
3507 | if (days == 1) { | 3507 | if (days == 1) { |
3508 | emit changeNavStringPrev(i18n("&Previous Day")); | 3508 | emit changeNavStringPrev(i18n("&Previous Day")); |
3509 | emit changeNavStringNext(i18n("&Next Day")); | 3509 | emit changeNavStringNext(i18n("&Next Day")); |
3510 | } else { | 3510 | } else { |
3511 | emit changeNavStringPrev(i18n("&Previous Week")); | 3511 | emit changeNavStringPrev(i18n("&Previous Week")); |
3512 | emit changeNavStringNext(i18n("&Next Week")); | 3512 | emit changeNavStringNext(i18n("&Next Week")); |
3513 | } | 3513 | } |
3514 | } | 3514 | } |
3515 | } | 3515 | } |
3516 | 3516 | ||
3517 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 3517 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
3518 | { | 3518 | { |
3519 | if ( incidence ) mTodoList->clearSelection(); | 3519 | if ( incidence ) mTodoList->clearSelection(); |
3520 | processIncidenceSelection( incidence ); | 3520 | processIncidenceSelection( incidence ); |
3521 | } | 3521 | } |
3522 | 3522 | ||
3523 | void CalendarView::processTodoListSelection( Incidence *incidence ) | 3523 | void CalendarView::processTodoListSelection( Incidence *incidence ) |
3524 | { | 3524 | { |
3525 | if ( incidence && mViewManager->currentView() ) { | 3525 | if ( incidence && mViewManager->currentView() ) { |
3526 | mViewManager->currentView()->clearSelection(); | 3526 | mViewManager->currentView()->clearSelection(); |
3527 | } | 3527 | } |
3528 | processIncidenceSelection( incidence ); | 3528 | processIncidenceSelection( incidence ); |
3529 | } | 3529 | } |
3530 | 3530 | ||
3531 | void CalendarView::processIncidenceSelection( Incidence *incidence ) | 3531 | void CalendarView::processIncidenceSelection( Incidence *incidence ) |
3532 | { | 3532 | { |
3533 | if ( incidence == mSelectedIncidence ) return; | 3533 | if ( incidence == mSelectedIncidence ) return; |
3534 | 3534 | ||
3535 | mSelectedIncidence = incidence; | 3535 | mSelectedIncidence = incidence; |
3536 | 3536 | ||
3537 | emit incidenceSelected( mSelectedIncidence ); | 3537 | emit incidenceSelected( mSelectedIncidence ); |
3538 | 3538 | ||
3539 | if ( incidence && incidence->type() == "Event" ) { | 3539 | if ( incidence && incidence->type() == "Event" ) { |
3540 | Event *event = static_cast<Event *>( incidence ); | 3540 | Event *event = static_cast<Event *>( incidence ); |
3541 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3541 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3542 | emit organizerEventsSelected( true ); | 3542 | emit organizerEventsSelected( true ); |
3543 | } else { | 3543 | } else { |
3544 | emit organizerEventsSelected(false); | 3544 | emit organizerEventsSelected(false); |
3545 | } | 3545 | } |
3546 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3546 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3547 | KOPrefs::instance()->email() ) ) { | 3547 | KOPrefs::instance()->email() ) ) { |
3548 | emit groupEventsSelected( true ); | 3548 | emit groupEventsSelected( true ); |
3549 | } else { | 3549 | } else { |
3550 | emit groupEventsSelected(false); | 3550 | emit groupEventsSelected(false); |
3551 | } | 3551 | } |
3552 | return; | 3552 | return; |
3553 | } else { | 3553 | } else { |
3554 | if ( incidence && incidence->type() == "Todo" ) { | 3554 | if ( incidence && incidence->type() == "Todo" ) { |
3555 | emit todoSelected( true ); | 3555 | emit todoSelected( true ); |
3556 | Todo *event = static_cast<Todo *>( incidence ); | 3556 | Todo *event = static_cast<Todo *>( incidence ); |
3557 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3557 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3558 | emit organizerEventsSelected( true ); | 3558 | emit organizerEventsSelected( true ); |
3559 | } else { | 3559 | } else { |
3560 | emit organizerEventsSelected(false); | 3560 | emit organizerEventsSelected(false); |
3561 | } | 3561 | } |
3562 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3562 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3563 | KOPrefs::instance()->email() ) ) { | 3563 | KOPrefs::instance()->email() ) ) { |
3564 | emit groupEventsSelected( true ); | 3564 | emit groupEventsSelected( true ); |
3565 | } else { | 3565 | } else { |
3566 | emit groupEventsSelected(false); | 3566 | emit groupEventsSelected(false); |
3567 | } | 3567 | } |
3568 | return; | 3568 | return; |
3569 | } else { | 3569 | } else { |
3570 | emit todoSelected( false ); | 3570 | emit todoSelected( false ); |
3571 | emit organizerEventsSelected(false); | 3571 | emit organizerEventsSelected(false); |
3572 | emit groupEventsSelected(false); | 3572 | emit groupEventsSelected(false); |
3573 | } | 3573 | } |
3574 | return; | 3574 | return; |
3575 | } | 3575 | } |
3576 | 3576 | ||
3577 | /* if ( incidence && incidence->type() == "Todo" ) { | 3577 | /* if ( incidence && incidence->type() == "Todo" ) { |
3578 | emit todoSelected( true ); | 3578 | emit todoSelected( true ); |
3579 | } else { | 3579 | } else { |
3580 | emit todoSelected( false ); | 3580 | emit todoSelected( false ); |
3581 | }*/ | 3581 | }*/ |
3582 | } | 3582 | } |
3583 | 3583 | ||
3584 | 3584 | ||
3585 | void CalendarView::checkClipboard() | 3585 | void CalendarView::checkClipboard() |
3586 | { | 3586 | { |
3587 | #ifndef KORG_NODND | 3587 | #ifndef KORG_NODND |
3588 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 3588 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
3589 | emit pasteEnabled(true); | 3589 | emit pasteEnabled(true); |
3590 | } else { | 3590 | } else { |
3591 | emit pasteEnabled(false); | 3591 | emit pasteEnabled(false); |
3592 | } | 3592 | } |
3593 | #endif | 3593 | #endif |
3594 | } | 3594 | } |
3595 | 3595 | ||
3596 | void CalendarView::showDates(const DateList &selectedDates) | 3596 | void CalendarView::showDates(const DateList &selectedDates) |
3597 | { | 3597 | { |
3598 | // kdDebug() << "CalendarView::selectDates()" << endl; | 3598 | // kdDebug() << "CalendarView::selectDates()" << endl; |
3599 | 3599 | ||
3600 | 3600 | ||
3601 | if ( !mBlockShowDates ) { | 3601 | if ( !mBlockShowDates ) { |
3602 | if ( mViewManager->currentView() ) { | 3602 | if ( mViewManager->currentView() ) { |
3603 | updateView( selectedDates.first(), selectedDates.last() ); | 3603 | updateView( selectedDates.first(), selectedDates.last() ); |
3604 | } else { | 3604 | } else { |
3605 | mViewManager->showAgendaView(); | 3605 | mViewManager->showAgendaView(); |
3606 | } | 3606 | } |
3607 | } | 3607 | } |
3608 | 3608 | ||
3609 | QDate date = selectedDates.first(); | ||
3610 | if ( ! date.isValid() ) { | ||
3611 | topLevelWidget()->setCaption(""); | ||
3612 | return; | ||
3613 | } | ||
3614 | |||
3609 | QString selDates; | 3615 | QString selDates; |
3610 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); | 3616 | selDates = KGlobal::locale()->formatDate( date, true); |
3611 | if (selectedDates.first() < selectedDates.last() ) | 3617 | if (selectedDates.first() < selectedDates.last() ) |
3612 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3618 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3613 | else { | 3619 | else { |
3614 | QString addString; | 3620 | QString addString; |
3615 | if ( selectedDates.first() == QDateTime::currentDateTime().date() ) | 3621 | if ( date == QDateTime::currentDateTime().date() ) |
3616 | addString = i18n("Today"); | 3622 | addString = i18n("Today"); |
3617 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | 3623 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
3618 | addString = i18n("Tomorrow"); | 3624 | addString = i18n("Tomorrow"); |
3619 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | 3625 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) |
3620 | addString = i18n("Yesterday"); | 3626 | addString = i18n("Yesterday"); |
3621 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | 3627 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) |
3622 | addString = i18n("Day before yesterday"); | 3628 | addString = i18n("Day before yesterday"); |
3623 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | 3629 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) |
3624 | addString = i18n("Day after tomorrow"); | 3630 | addString = i18n("Day after tomorrow"); |
3625 | if ( !addString.isEmpty() ) { | 3631 | if ( !addString.isEmpty() ) { |
3626 | topLevelWidget()->setCaption( addString+", " + selDates ); | 3632 | topLevelWidget()->setCaption( addString+", " + selDates ); |
3627 | return; | 3633 | return; |
3628 | } | 3634 | } |
3629 | } | 3635 | } |
3630 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 3636 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
3631 | 3637 | ||
3632 | } | 3638 | } |
3633 | 3639 | ||
3634 | QPtrList<CalFilter> CalendarView::filters() | 3640 | QPtrList<CalFilter> CalendarView::filters() |
3635 | { | 3641 | { |
3636 | return mFilters; | 3642 | return mFilters; |
3637 | 3643 | ||
3638 | } | 3644 | } |
3639 | void CalendarView::editFilters() | 3645 | void CalendarView::editFilters() |
3640 | { | 3646 | { |
3641 | // kdDebug() << "CalendarView::editFilters()" << endl; | 3647 | // kdDebug() << "CalendarView::editFilters()" << endl; |
3642 | 3648 | ||
3643 | CalFilter *filter = mFilters.first(); | 3649 | CalFilter *filter = mFilters.first(); |
3644 | while(filter) { | 3650 | while(filter) { |
3645 | kdDebug() << " Filter: " << filter->name() << endl; | 3651 | kdDebug() << " Filter: " << filter->name() << endl; |
3646 | filter = mFilters.next(); | 3652 | filter = mFilters.next(); |
3647 | } | 3653 | } |
3648 | 3654 | ||
3649 | mDialogManager->showFilterEditDialog(&mFilters); | 3655 | mDialogManager->showFilterEditDialog(&mFilters); |
3650 | } | 3656 | } |
3651 | void CalendarView::toggleFilter() | 3657 | void CalendarView::toggleFilter() |
3652 | { | 3658 | { |
3653 | showFilter(! mFilterView->isVisible()); | 3659 | showFilter(! mFilterView->isVisible()); |
3654 | } | 3660 | } |
3655 | 3661 | ||
3656 | KOFilterView *CalendarView::filterView() | 3662 | KOFilterView *CalendarView::filterView() |
3657 | { | 3663 | { |
3658 | return mFilterView; | 3664 | return mFilterView; |
3659 | } | 3665 | } |
3660 | void CalendarView::selectFilter( int fil ) | 3666 | void CalendarView::selectFilter( int fil ) |
3661 | { | 3667 | { |
3662 | mFilterView->setSelectedFilter( fil ); | 3668 | mFilterView->setSelectedFilter( fil ); |
3663 | } | 3669 | } |
3664 | void CalendarView::showFilter(bool visible) | 3670 | void CalendarView::showFilter(bool visible) |
3665 | { | 3671 | { |
3666 | if (visible) mFilterView->show(); | 3672 | if (visible) mFilterView->show(); |
3667 | else mFilterView->hide(); | 3673 | else mFilterView->hide(); |
3668 | } | 3674 | } |
3669 | void CalendarView::toggleFilerEnabled( ) | 3675 | void CalendarView::toggleFilerEnabled( ) |
3670 | { | 3676 | { |
3671 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 3677 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
3672 | if ( !mFilterView->filtersEnabled() ) | 3678 | if ( !mFilterView->filtersEnabled() ) |
3673 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 3679 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
3674 | 3680 | ||
3675 | } | 3681 | } |
3676 | void CalendarView::updateFilter() | 3682 | void CalendarView::updateFilter() |
3677 | { | 3683 | { |
3678 | CalFilter *filter = mFilterView->selectedFilter(); | 3684 | CalFilter *filter = mFilterView->selectedFilter(); |
3679 | if (filter) { | 3685 | if (filter) { |
3680 | QString mess; | 3686 | QString mess; |
3681 | if (mFilterView->filtersEnabled()) { | 3687 | if (mFilterView->filtersEnabled()) { |
3682 | mess = i18n("Filter selected: ")+filter->name(); | 3688 | mess = i18n("Filter selected: ")+filter->name(); |
3683 | filter->setEnabled(true); | 3689 | filter->setEnabled(true); |
3684 | } | 3690 | } |
3685 | else filter->setEnabled(false); | 3691 | else filter->setEnabled(false); |
3686 | mCalendar->setFilter(filter); | 3692 | mCalendar->setFilter(filter); |
3687 | updateView(); | 3693 | updateView(); |
3688 | if ( !mess.isEmpty() ) | 3694 | if ( !mess.isEmpty() ) |
3689 | topLevelWidget()->setCaption( mess ); | 3695 | topLevelWidget()->setCaption( mess ); |
3690 | 3696 | ||
3691 | } | 3697 | } |
3692 | } | 3698 | } |
3693 | 3699 | ||
3694 | void CalendarView::filterEdited() | 3700 | void CalendarView::filterEdited() |
3695 | { | 3701 | { |
3696 | mFilterView->updateFilters(); | 3702 | mFilterView->updateFilters(); |
3697 | updateFilter(); | 3703 | updateFilter(); |
3698 | writeSettings(); | 3704 | writeSettings(); |
3699 | } | 3705 | } |
3700 | 3706 | ||
3701 | 3707 | ||
3702 | void CalendarView::takeOverEvent() | 3708 | void CalendarView::takeOverEvent() |
3703 | { | 3709 | { |
3704 | Incidence *incidence = currentSelection(); | 3710 | Incidence *incidence = currentSelection(); |
3705 | 3711 | ||
3706 | if (!incidence) return; | 3712 | if (!incidence) return; |
3707 | 3713 | ||
3708 | incidence->setOrganizer(KOPrefs::instance()->email()); | 3714 | incidence->setOrganizer(KOPrefs::instance()->email()); |
3709 | incidence->recreate(); | 3715 | incidence->recreate(); |
3710 | incidence->setReadOnly(false); | 3716 | incidence->setReadOnly(false); |
3711 | 3717 | ||
3712 | updateView(); | 3718 | updateView(); |
3713 | } | 3719 | } |
3714 | 3720 | ||
3715 | void CalendarView::takeOverCalendar() | 3721 | void CalendarView::takeOverCalendar() |
3716 | { | 3722 | { |
3717 | // TODO: Create Calendar::allIncidences() function and use it here | 3723 | // TODO: Create Calendar::allIncidences() function and use it here |
3718 | 3724 | ||
3719 | QPtrList<Event> events = mCalendar->events(); | 3725 | QPtrList<Event> events = mCalendar->events(); |
3720 | for(uint i=0; i<events.count(); ++i) { | 3726 | for(uint i=0; i<events.count(); ++i) { |
3721 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3727 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3722 | events.at(i)->recreate(); | 3728 | events.at(i)->recreate(); |
3723 | events.at(i)->setReadOnly(false); | 3729 | events.at(i)->setReadOnly(false); |
3724 | } | 3730 | } |
3725 | 3731 | ||
3726 | QPtrList<Todo> todos = mCalendar->todos(); | 3732 | QPtrList<Todo> todos = mCalendar->todos(); |
3727 | for(uint i=0; i<todos.count(); ++i) { | 3733 | for(uint i=0; i<todos.count(); ++i) { |
3728 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3734 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3729 | todos.at(i)->recreate(); | 3735 | todos.at(i)->recreate(); |
3730 | todos.at(i)->setReadOnly(false); | 3736 | todos.at(i)->setReadOnly(false); |
3731 | } | 3737 | } |
3732 | 3738 | ||
3733 | QPtrList<Journal> journals = mCalendar->journals(); | 3739 | QPtrList<Journal> journals = mCalendar->journals(); |
3734 | for(uint i=0; i<journals.count(); ++i) { | 3740 | for(uint i=0; i<journals.count(); ++i) { |
3735 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3741 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3736 | journals.at(i)->recreate(); | 3742 | journals.at(i)->recreate(); |
3737 | journals.at(i)->setReadOnly(false); | 3743 | journals.at(i)->setReadOnly(false); |
3738 | } | 3744 | } |
3739 | 3745 | ||
3740 | updateView(); | 3746 | updateView(); |
3741 | } | 3747 | } |
3742 | 3748 | ||
3743 | void CalendarView::showIntro() | 3749 | void CalendarView::showIntro() |
3744 | { | 3750 | { |
3745 | kdDebug() << "To be implemented." << endl; | 3751 | kdDebug() << "To be implemented." << endl; |
3746 | } | 3752 | } |
3747 | 3753 | ||
3748 | QWidgetStack *CalendarView::viewStack() | 3754 | QWidgetStack *CalendarView::viewStack() |
3749 | { | 3755 | { |
3750 | return mRightFrame; | 3756 | return mRightFrame; |
3751 | } | 3757 | } |
3752 | 3758 | ||
3753 | QWidget *CalendarView::leftFrame() | 3759 | QWidget *CalendarView::leftFrame() |
3754 | { | 3760 | { |
3755 | return ( QWidget *)mLeftFrame; | 3761 | return ( QWidget *)mLeftFrame; |
3756 | } | 3762 | } |
3757 | 3763 | ||
3758 | DateNavigator *CalendarView::dateNavigator() | 3764 | DateNavigator *CalendarView::dateNavigator() |
3759 | { | 3765 | { |
3760 | return mNavigator; | 3766 | return mNavigator; |
3761 | } | 3767 | } |
3762 | 3768 | ||
3763 | KDateNavigator* CalendarView::dateNavigatorWidget() | 3769 | KDateNavigator* CalendarView::dateNavigatorWidget() |
3764 | { | 3770 | { |
3765 | return mDateNavigator->navigatorView(); | 3771 | return mDateNavigator->navigatorView(); |
3766 | } | 3772 | } |
3767 | void CalendarView::toggleDateNavigatorWidget() | 3773 | void CalendarView::toggleDateNavigatorWidget() |
3768 | { | 3774 | { |
3769 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; | 3775 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; |
3770 | 3776 | ||
3771 | if (!KOPrefs::instance()->mShowDateNavigator ) | 3777 | if (!KOPrefs::instance()->mShowDateNavigator ) |
3772 | mDateNavigator->hide(); | 3778 | mDateNavigator->hide(); |
3773 | else | 3779 | else |
3774 | mDateNavigator->show(); | 3780 | mDateNavigator->show(); |
3775 | } | 3781 | } |
3776 | void CalendarView::addView(KOrg::BaseView *view) | 3782 | void CalendarView::addView(KOrg::BaseView *view) |
3777 | { | 3783 | { |
3778 | mViewManager->addView(view); | 3784 | mViewManager->addView(view); |
3779 | } | 3785 | } |
3780 | 3786 | ||
3781 | void CalendarView::showView(KOrg::BaseView *view) | 3787 | void CalendarView::showView(KOrg::BaseView *view) |
3782 | { | 3788 | { |
3783 | mViewManager->showView(view, mLeftFrame->isVisible()); | 3789 | mViewManager->showView(view, mLeftFrame->isVisible()); |
3784 | } | 3790 | } |
3785 | 3791 | ||
3786 | Incidence *CalendarView::currentSelection() | 3792 | Incidence *CalendarView::currentSelection() |
3787 | { | 3793 | { |
3788 | return mViewManager->currentSelection(); | 3794 | return mViewManager->currentSelection(); |
3789 | } | 3795 | } |
3790 | void CalendarView::toggleAllDaySize() | 3796 | void CalendarView::toggleAllDaySize() |
3791 | { | 3797 | { |
3792 | /* | 3798 | /* |
3793 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 3799 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
3794 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; | 3800 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; |
3795 | else | 3801 | else |
3796 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 3802 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
3797 | */ | 3803 | */ |
3798 | viewManager()->agendaView()->toggleAllDay(); | 3804 | viewManager()->agendaView()->toggleAllDay(); |
3799 | } | 3805 | } |
3800 | void CalendarView::toggleExpand() | 3806 | void CalendarView::toggleExpand() |
3801 | { | 3807 | { |
3802 | // if ( mLeftFrame->isHidden() ) { | 3808 | // if ( mLeftFrame->isHidden() ) { |
3803 | // mLeftFrame->show(); | 3809 | // mLeftFrame->show(); |
3804 | // emit calendarViewExpanded( false ); | 3810 | // emit calendarViewExpanded( false ); |
3805 | // } else { | 3811 | // } else { |
3806 | // mLeftFrame->hide(); | 3812 | // mLeftFrame->hide(); |
3807 | // emit calendarViewExpanded( true ); | 3813 | // emit calendarViewExpanded( true ); |
3808 | // } | 3814 | // } |
3809 | //qDebug(" CalendarView::toggleExpand()"); | 3815 | //qDebug(" CalendarView::toggleExpand()"); |
3810 | globalFlagBlockAgenda = 1; | 3816 | globalFlagBlockAgenda = 1; |
3811 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 3817 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
3812 | globalFlagBlockAgenda = 5; | 3818 | globalFlagBlockAgenda = 5; |
3813 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 3819 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
3814 | //mViewManager->showView( 0, true ); | 3820 | //mViewManager->showView( 0, true ); |
3815 | } | 3821 | } |
3816 | 3822 | ||
3817 | void CalendarView::calendarModified( bool modified, Calendar * ) | 3823 | void CalendarView::calendarModified( bool modified, Calendar * ) |
3818 | { | 3824 | { |
3819 | setModified( modified ); | 3825 | setModified( modified ); |
3820 | } | 3826 | } |
3821 | 3827 | ||
3822 | Todo *CalendarView::selectedTodo() | 3828 | Todo *CalendarView::selectedTodo() |
3823 | { | 3829 | { |
3824 | Incidence *incidence = currentSelection(); | 3830 | Incidence *incidence = currentSelection(); |
3825 | if ( incidence && incidence->type() == "Todo" ) { | 3831 | if ( incidence && incidence->type() == "Todo" ) { |
3826 | return static_cast<Todo *>( incidence ); | 3832 | return static_cast<Todo *>( incidence ); |
3827 | } | 3833 | } |
3828 | 3834 | ||
3829 | incidence = mTodoList->selectedIncidences().first(); | 3835 | incidence = mTodoList->selectedIncidences().first(); |
3830 | if ( incidence && incidence->type() == "Todo" ) { | 3836 | if ( incidence && incidence->type() == "Todo" ) { |
3831 | return static_cast<Todo *>( incidence ); | 3837 | return static_cast<Todo *>( incidence ); |
3832 | } | 3838 | } |
3833 | 3839 | ||
3834 | return 0; | 3840 | return 0; |
3835 | } | 3841 | } |
3836 | 3842 | ||
3837 | void CalendarView::dialogClosing(Incidence *in) | 3843 | void CalendarView::dialogClosing(Incidence *in) |
3838 | { | 3844 | { |
3839 | // mDialogList.remove(in); | 3845 | // mDialogList.remove(in); |
3840 | } | 3846 | } |
3841 | 3847 | ||
3842 | void CalendarView::showIncidence() | 3848 | void CalendarView::showIncidence() |
3843 | { | 3849 | { |
3844 | mViewerCallerIsSearchDialog = false; | 3850 | mViewerCallerIsSearchDialog = false; |
3845 | Incidence *incidence = currentSelection(); | 3851 | Incidence *incidence = currentSelection(); |
3846 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3852 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3847 | if ( incidence ) { | 3853 | if ( incidence ) { |
3848 | ShowIncidenceVisitor v; | 3854 | ShowIncidenceVisitor v; |
3849 | v.act( incidence, this ); | 3855 | v.act( incidence, this ); |
3850 | } | 3856 | } |
3851 | } | 3857 | } |
3852 | void CalendarView::editIncidenceDescription() | 3858 | void CalendarView::editIncidenceDescription() |
3853 | { | 3859 | { |
3854 | mFlagEditDescription = true; | 3860 | mFlagEditDescription = true; |
3855 | editIncidence(); | 3861 | editIncidence(); |
3856 | mFlagEditDescription = false; | 3862 | mFlagEditDescription = false; |
3857 | } | 3863 | } |
3858 | void CalendarView::editIncidence() | 3864 | void CalendarView::editIncidence() |
3859 | { | 3865 | { |
3860 | // qDebug("editIncidence() "); | 3866 | // qDebug("editIncidence() "); |
3861 | Incidence *incidence = currentSelection(); | 3867 | Incidence *incidence = currentSelection(); |
3862 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3868 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3863 | if ( incidence ) { | 3869 | if ( incidence ) { |
3864 | EditIncidenceVisitor v; | 3870 | EditIncidenceVisitor v; |
3865 | v.act( incidence, this ); | 3871 | v.act( incidence, this ); |
3866 | } | 3872 | } |
3867 | } | 3873 | } |
3868 | 3874 | ||
3869 | void CalendarView::deleteIncidence() | 3875 | void CalendarView::deleteIncidence() |
3870 | { | 3876 | { |
3871 | Incidence *incidence = currentSelection(); | 3877 | Incidence *incidence = currentSelection(); |
3872 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3878 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3873 | if ( incidence ) { | 3879 | if ( incidence ) { |
3874 | deleteIncidence(incidence); | 3880 | deleteIncidence(incidence); |
3875 | } | 3881 | } |
3876 | } | 3882 | } |
3877 | 3883 | ||
3878 | void CalendarView::showIncidence(Incidence *incidence) | 3884 | void CalendarView::showIncidence(Incidence *incidence) |
3879 | { | 3885 | { |
3880 | mViewerCallerIsSearchDialog = false; | 3886 | mViewerCallerIsSearchDialog = false; |
3881 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); | 3887 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); |
3882 | if ( sender() && mDialogManager->getSearchDialog() ) { | 3888 | if ( sender() && mDialogManager->getSearchDialog() ) { |
3883 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { | 3889 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { |
3884 | mViewerCallerIsSearchDialog = true; | 3890 | mViewerCallerIsSearchDialog = true; |
3885 | } | 3891 | } |
3886 | } | 3892 | } |
3887 | if ( incidence ) { | 3893 | if ( incidence ) { |
3888 | ShowIncidenceVisitor v; | 3894 | ShowIncidenceVisitor v; |
3889 | v.act( incidence, this ); | 3895 | v.act( incidence, this ); |
3890 | } | 3896 | } |
3891 | } | 3897 | } |
3892 | 3898 | ||
3893 | void CalendarView::editIncidence(Incidence *incidence) | 3899 | void CalendarView::editIncidence(Incidence *incidence) |
3894 | { | 3900 | { |
3895 | if ( incidence ) { | 3901 | if ( incidence ) { |
3896 | 3902 | ||
3897 | EditIncidenceVisitor v; | 3903 | EditIncidenceVisitor v; |
3898 | v.act( incidence, this ); | 3904 | v.act( incidence, this ); |
3899 | 3905 | ||
3900 | } | 3906 | } |
3901 | } | 3907 | } |
3902 | 3908 | ||
3903 | void CalendarView::deleteIncidence(Incidence *incidence) | 3909 | void CalendarView::deleteIncidence(Incidence *incidence) |
3904 | { | 3910 | { |
3905 | //qDebug(" CalendarView::deleteIncidence "); | 3911 | //qDebug(" CalendarView::deleteIncidence "); |
3906 | if ( incidence ) { | 3912 | if ( incidence ) { |
3907 | DeleteIncidenceVisitor v; | 3913 | DeleteIncidenceVisitor v; |
3908 | v.act( incidence, this ); | 3914 | v.act( incidence, this ); |
3909 | } | 3915 | } |
3910 | } | 3916 | } |
3911 | 3917 | ||
3912 | 3918 | ||
3913 | void CalendarView::lookForOutgoingMessages() | 3919 | void CalendarView::lookForOutgoingMessages() |
3914 | { | 3920 | { |
3915 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 3921 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
3916 | ogd->loadMessages(); | 3922 | ogd->loadMessages(); |
3917 | } | 3923 | } |
3918 | 3924 | ||
3919 | void CalendarView::lookForIncomingMessages() | 3925 | void CalendarView::lookForIncomingMessages() |
3920 | { | 3926 | { |
3921 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 3927 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
3922 | icd->retrieve(); | 3928 | icd->retrieve(); |
3923 | } | 3929 | } |
3924 | 3930 | ||
3925 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 3931 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
3926 | { | 3932 | { |
3927 | bool deleteTodo = true; | 3933 | bool deleteTodo = true; |
3928 | QPtrList<Incidence> subTodos; | 3934 | QPtrList<Incidence> subTodos; |
3929 | Incidence *aTodo; | 3935 | Incidence *aTodo; |
3930 | subTodos = t->relations(); | 3936 | subTodos = t->relations(); |
3931 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 3937 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
3932 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 3938 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
3933 | deleteTodo = false; | 3939 | deleteTodo = false; |
3934 | } | 3940 | } |
3935 | if ( deleteTodo ) { | 3941 | if ( deleteTodo ) { |
3936 | if ( t->isCompleted() && !t->doesRecur()) { | 3942 | if ( t->isCompleted() && !t->doesRecur()) { |
3937 | checkExternalId( t ); | 3943 | checkExternalId( t ); |
3938 | mCalendar->deleteTodo( t ); | 3944 | mCalendar->deleteTodo( t ); |
3939 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 3945 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
3940 | } | 3946 | } |
3941 | else | 3947 | else |
3942 | deleteTodo = false; | 3948 | deleteTodo = false; |
3943 | } | 3949 | } |
3944 | return deleteTodo; | 3950 | return deleteTodo; |
3945 | 3951 | ||
3946 | } | 3952 | } |
3947 | void CalendarView::purgeCompleted() | 3953 | void CalendarView::purgeCompleted() |
3948 | { | 3954 | { |
3949 | int result = KMessageBox::warningContinueCancel(this, | 3955 | int result = KMessageBox::warningContinueCancel(this, |
3950 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); | 3956 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); |
3951 | 3957 | ||
3952 | if (result == KMessageBox::Continue) { | 3958 | if (result == KMessageBox::Continue) { |
3953 | 3959 | ||
3954 | QPtrList<Todo> todoCal; | 3960 | QPtrList<Todo> todoCal; |
3955 | QPtrList<Todo> rootTodos; | 3961 | QPtrList<Todo> rootTodos; |
3956 | //QPtrList<Incidence> rel; | 3962 | //QPtrList<Incidence> rel; |
3957 | Todo *aTodo;//, *rTodo; | 3963 | Todo *aTodo;//, *rTodo; |
3958 | Incidence *rIncidence; | 3964 | Incidence *rIncidence; |
3959 | bool childDelete = false; | 3965 | bool childDelete = false; |
3960 | bool deletedOne = true; | 3966 | bool deletedOne = true; |
3961 | todoCal = calendar()->todos(); | 3967 | todoCal = calendar()->todos(); |
3962 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 3968 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
3963 | if ( !aTodo->relatedTo() ) | 3969 | if ( !aTodo->relatedTo() ) |
3964 | rootTodos.append( aTodo ); | 3970 | rootTodos.append( aTodo ); |
3965 | } | 3971 | } |
3966 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 3972 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
3967 | removeCompletedSubTodos( aTodo ); | 3973 | removeCompletedSubTodos( aTodo ); |
3968 | } | 3974 | } |
3969 | 3975 | ||
3970 | updateView(); | 3976 | updateView(); |
3971 | } | 3977 | } |
3972 | } | 3978 | } |
3973 | 3979 | ||
3974 | void CalendarView::slotCalendarChanged() | 3980 | void CalendarView::slotCalendarChanged() |
3975 | { | 3981 | { |
3976 | ; | 3982 | ; |
3977 | } | 3983 | } |
3978 | 3984 | ||
3979 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 3985 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
3980 | { | 3986 | { |
3981 | //qDebug(" alendarView::keyPressEvent "); | 3987 | //qDebug(" alendarView::keyPressEvent "); |
3982 | e->ignore(); | 3988 | e->ignore(); |
3983 | } | 3989 | } |
3984 | 3990 | ||
3985 | 3991 | ||
3986 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 3992 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
3987 | { | 3993 | { |
3988 | // mSyncManager = manager; | 3994 | // mSyncManager = manager; |
3989 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 3995 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
3990 | qDebug("KO: SyncKDE request detected!"); | 3996 | qDebug("KO: SyncKDE request detected!"); |
3991 | } | 3997 | } |
3992 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3998 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3993 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3999 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3994 | return syncCalendar( filename, mode ); | 4000 | return syncCalendar( filename, mode ); |
3995 | } | 4001 | } |
3996 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 4002 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
3997 | { | 4003 | { |
3998 | //mSyncManager = manager; | 4004 | //mSyncManager = manager; |
3999 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 4005 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
4000 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4006 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4001 | if ( resource == "sharp" ) | 4007 | if ( resource == "sharp" ) |
4002 | syncExternal( 0 ); | 4008 | syncExternal( 0 ); |
4003 | if ( resource == "phone" ) | 4009 | if ( resource == "phone" ) |
4004 | syncExternal( 1 ); | 4010 | syncExternal( 1 ); |
4005 | // pending setmodified | 4011 | // pending setmodified |
4006 | return true; | 4012 | return true; |
4007 | } | 4013 | } |
4008 | void CalendarView::setSyncManager(KSyncManager* manager) | 4014 | void CalendarView::setSyncManager(KSyncManager* manager) |
4009 | { | 4015 | { |
4010 | mSyncManager = manager; | 4016 | mSyncManager = manager; |
4011 | } | 4017 | } |
4012 | 4018 | ||
4013 | void CalendarView::removeSyncInfo( QString syncProfile) | 4019 | void CalendarView::removeSyncInfo( QString syncProfile) |
4014 | { | 4020 | { |
4015 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 4021 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
4016 | mCalendar->removeSyncInfo( syncProfile ); | 4022 | mCalendar->removeSyncInfo( syncProfile ); |
4017 | 4023 | ||
4018 | } | 4024 | } |
4019 | 4025 | ||
4020 | void CalendarView::undo_delete() | 4026 | void CalendarView::undo_delete() |
4021 | { | 4027 | { |
4022 | //qDebug("undo_delete() "); | 4028 | //qDebug("undo_delete() "); |
4023 | Incidence* undo = mCalendar->undoIncidence(); | 4029 | Incidence* undo = mCalendar->undoIncidence(); |
4024 | if ( !undo ) { | 4030 | if ( !undo ) { |
4025 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 4031 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
4026 | i18n("KO/Pi")); | 4032 | i18n("KO/Pi")); |
4027 | return; | 4033 | return; |
4028 | } | 4034 | } |
4029 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + | 4035 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + |
4030 | i18n("\nAre you sure you want\nto restore this?"), | 4036 | i18n("\nAre you sure you want\nto restore this?"), |
4031 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 4037 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
4032 | mCalendar->undoDeleteIncidence(); | 4038 | mCalendar->undoDeleteIncidence(); |
4033 | updateView(); | 4039 | updateView(); |
4034 | } | 4040 | } |
4035 | } | 4041 | } |
4036 | 4042 | ||
4037 | void CalendarView::slotViewerClosed() | 4043 | void CalendarView::slotViewerClosed() |
4038 | { | 4044 | { |
4039 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); | 4045 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); |
4040 | } | 4046 | } |
4041 | 4047 | ||
4042 | void CalendarView::resetFocus() | 4048 | void CalendarView::resetFocus() |
4043 | { | 4049 | { |
4044 | if ( mViewerCallerIsSearchDialog ) { | 4050 | if ( mViewerCallerIsSearchDialog ) { |
4045 | if ( mDialogManager->getSearchDialog()->isVisible() ){ | 4051 | if ( mDialogManager->getSearchDialog()->isVisible() ){ |
4046 | mDialogManager->getSearchDialog()->raise(); | 4052 | mDialogManager->getSearchDialog()->raise(); |
4047 | mDialogManager->getSearchDialog()->setActiveWindow(); | 4053 | mDialogManager->getSearchDialog()->setActiveWindow(); |
4048 | mDialogManager->getSearchDialog()->listview()->resetFocus(); | 4054 | mDialogManager->getSearchDialog()->listview()->resetFocus(); |
4049 | } else | 4055 | } else |
4050 | mViewerCallerIsSearchDialog = false; | 4056 | mViewerCallerIsSearchDialog = false; |
4051 | } | 4057 | } |
4052 | if ( !mViewerCallerIsSearchDialog ) { | 4058 | if ( !mViewerCallerIsSearchDialog ) { |
4053 | //mViewManager->currentView()->setFocus(); | 4059 | //mViewManager->currentView()->setFocus(); |
4054 | //qDebug("sssssssssssssssset focus "); | 4060 | //qDebug("sssssssssssssssset focus "); |
4055 | topLevelWidget()->raise(); | 4061 | topLevelWidget()->raise(); |
4056 | setActiveWindow(); | 4062 | setActiveWindow(); |
4057 | //setFocus(); | 4063 | //setFocus(); |
4058 | } | 4064 | } |
4059 | mViewerCallerIsSearchDialog = false; | 4065 | mViewerCallerIsSearchDialog = false; |
4060 | } | 4066 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 7faf675..7d5cf72 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,656 +1,656 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "koagenda.h" | 50 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 53 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 56 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 58 | #include "koglobals.h" |
59 | #include "kglobal.h" | 59 | #include "kglobal.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "simplealarmclient.h" | 62 | #include "simplealarmclient.h" |
63 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #ifdef _OL_IMPORT_ | 69 | #ifdef _OL_IMPORT_ |
70 | #include "koimportoldialog.h" | 70 | #include "koimportoldialog.h" |
71 | #endif | 71 | #endif |
72 | #endif | 72 | #endif |
73 | #include "mainwindow.h" | 73 | #include "mainwindow.h" |
74 | 74 | ||
75 | 75 | ||
76 | class KOex2phonePrefs : public QDialog | 76 | class KOex2phonePrefs : public QDialog |
77 | { | 77 | { |
78 | public: | 78 | public: |
79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
80 | QDialog( parent, name, true ) | 80 | QDialog( parent, name, true ) |
81 | { | 81 | { |
82 | setCaption( i18n("Export to phone options") ); | 82 | setCaption( i18n("Export to phone options") ); |
83 | QVBoxLayout* lay = new QVBoxLayout( this ); | 83 | QVBoxLayout* lay = new QVBoxLayout( this ); |
84 | lay->setSpacing( 3 ); | 84 | lay->setSpacing( 3 ); |
85 | lay->setMargin( 3 ); | 85 | lay->setMargin( 3 ); |
86 | QLabel *lab; | 86 | QLabel *lab; |
87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
88 | lab->setAlignment (AlignHCenter ); | 88 | lab->setAlignment (AlignHCenter ); |
89 | QHBox* temphb; | 89 | QHBox* temphb; |
90 | temphb = new QHBox( this ); | 90 | temphb = new QHBox( this ); |
91 | new QLabel( i18n("I/O device: "), temphb ); | 91 | new QLabel( i18n("I/O device: "), temphb ); |
92 | mPhoneDevice = new QLineEdit( temphb); | 92 | mPhoneDevice = new QLineEdit( temphb); |
93 | lay->addWidget( temphb ); | 93 | lay->addWidget( temphb ); |
94 | temphb = new QHBox( this ); | 94 | temphb = new QHBox( this ); |
95 | new QLabel( i18n("Connection: "), temphb ); | 95 | new QLabel( i18n("Connection: "), temphb ); |
96 | mPhoneConnection = new QLineEdit( temphb); | 96 | mPhoneConnection = new QLineEdit( temphb); |
97 | lay->addWidget( temphb ); | 97 | lay->addWidget( temphb ); |
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("KO/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 | } | 290 | } |
291 | MainWindow::~MainWindow() | 291 | MainWindow::~MainWindow() |
292 | { | 292 | { |
293 | //qDebug("MainWindow::~MainWindow() "); | 293 | //qDebug("MainWindow::~MainWindow() "); |
294 | //save toolbar location | 294 | //save toolbar location |
295 | delete mCalendar; | 295 | delete mCalendar; |
296 | delete mSyncManager; | 296 | delete mSyncManager; |
297 | #ifndef DESKTOP_VERSION | 297 | #ifndef DESKTOP_VERSION |
298 | if ( infrared ) | 298 | if ( infrared ) |
299 | delete infrared; | 299 | delete infrared; |
300 | #endif | 300 | #endif |
301 | 301 | ||
302 | 302 | ||
303 | } | 303 | } |
304 | 304 | ||
305 | void MainWindow::disableBR(bool b) | 305 | void MainWindow::disableBR(bool b) |
306 | { | 306 | { |
307 | #ifndef DESKTOP_VERSION | 307 | #ifndef DESKTOP_VERSION |
308 | if ( b ) { | 308 | if ( b ) { |
309 | if ( infrared ) { | 309 | if ( infrared ) { |
310 | toggleBeamReceive(); | 310 | toggleBeamReceive(); |
311 | mBRdisabled = true; | 311 | mBRdisabled = true; |
312 | } | 312 | } |
313 | mBRdisabled = true; | 313 | mBRdisabled = true; |
314 | } else { | 314 | } else { |
315 | if ( mBRdisabled ) { | 315 | if ( mBRdisabled ) { |
316 | mBRdisabled = false; | 316 | mBRdisabled = false; |
317 | //makes no sense,because other cal ap is probably running | 317 | //makes no sense,because other cal ap is probably running |
318 | // toggleBeamReceive(); | 318 | // toggleBeamReceive(); |
319 | } | 319 | } |
320 | } | 320 | } |
321 | #endif | 321 | #endif |
322 | 322 | ||
323 | } | 323 | } |
324 | bool MainWindow::beamReceiveEnabled() | 324 | bool MainWindow::beamReceiveEnabled() |
325 | { | 325 | { |
326 | #ifndef DESKTOP_VERSION | 326 | #ifndef DESKTOP_VERSION |
327 | return ( infrared != 0 ); | 327 | return ( infrared != 0 ); |
328 | #endif | 328 | #endif |
329 | return false; | 329 | return false; |
330 | } | 330 | } |
331 | 331 | ||
332 | void MainWindow::toggleBeamReceive() | 332 | void MainWindow::toggleBeamReceive() |
333 | { | 333 | { |
334 | if ( mBRdisabled ) | 334 | if ( mBRdisabled ) |
335 | return; | 335 | return; |
336 | #ifndef DESKTOP_VERSION | 336 | #ifndef DESKTOP_VERSION |
337 | if ( infrared ) { | 337 | if ( infrared ) { |
338 | qDebug("disable BeamReceive "); | 338 | qDebug("disable BeamReceive "); |
339 | delete infrared; | 339 | delete infrared; |
340 | infrared = 0; | 340 | infrared = 0; |
341 | brAction->setOn(false); | 341 | brAction->setOn(false); |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | qDebug("enable BeamReceive "); | 344 | qDebug("enable BeamReceive "); |
345 | brAction->setOn(true); | 345 | brAction->setOn(true); |
346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
347 | 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& ))); |
348 | #endif | 348 | #endif |
349 | } | 349 | } |
350 | void MainWindow::showMaximized () | 350 | void MainWindow::showMaximized () |
351 | { | 351 | { |
352 | #ifndef DESKTOP_VERSION | 352 | #ifndef DESKTOP_VERSION |
353 | if ( ! globalFlagBlockStartup ) | 353 | if ( ! globalFlagBlockStartup ) |
354 | if ( mClosed ) | 354 | if ( mClosed ) |
355 | mView->goToday(); | 355 | mView->goToday(); |
356 | #endif | 356 | #endif |
357 | QWidget::showMaximized () ; | 357 | QWidget::showMaximized () ; |
358 | mClosed = false; | 358 | mClosed = false; |
359 | } | 359 | } |
360 | void MainWindow::closeEvent( QCloseEvent* ce ) | 360 | void MainWindow::closeEvent( QCloseEvent* ce ) |
361 | { | 361 | { |
362 | 362 | ||
363 | 363 | ||
364 | 364 | ||
365 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 365 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
366 | saveOnClose(); | 366 | saveOnClose(); |
367 | mClosed = true; | 367 | mClosed = true; |
368 | ce->accept(); | 368 | ce->accept(); |
369 | return; | 369 | return; |
370 | 370 | ||
371 | } | 371 | } |
372 | 372 | ||
373 | switch( QMessageBox::information( this, "KO/Pi", | 373 | switch( QMessageBox::information( this, "KO/Pi", |
374 | i18n("Do you really want\nto close KO/Pi?"), | 374 | i18n("Do you really want\nto close KO/Pi?"), |
375 | i18n("Close"), i18n("No"), | 375 | i18n("Close"), i18n("No"), |
376 | 0, 0 ) ) { | 376 | 0, 0 ) ) { |
377 | case 0: | 377 | case 0: |
378 | saveOnClose(); | 378 | saveOnClose(); |
379 | mClosed = true; | 379 | mClosed = true; |
380 | ce->accept(); | 380 | ce->accept(); |
381 | break; | 381 | break; |
382 | case 1: | 382 | case 1: |
383 | ce->ignore(); | 383 | ce->ignore(); |
384 | break; | 384 | break; |
385 | case 2: | 385 | case 2: |
386 | 386 | ||
387 | default: | 387 | default: |
388 | break; | 388 | break; |
389 | } | 389 | } |
390 | 390 | ||
391 | 391 | ||
392 | } | 392 | } |
393 | 393 | ||
394 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 394 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
395 | { | 395 | { |
396 | QDataStream stream( data, IO_ReadOnly ); | 396 | QDataStream stream( data, IO_ReadOnly ); |
397 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 397 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
398 | //QString datamess; | 398 | //QString datamess; |
399 | //qDebug("message "); | 399 | //qDebug("message "); |
400 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 400 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
401 | 401 | ||
402 | if ( cmsg == "setDocument(QString)" ) { | 402 | if ( cmsg == "setDocument(QString)" ) { |
403 | QDataStream stream( data, IO_ReadOnly ); | 403 | QDataStream stream( data, IO_ReadOnly ); |
404 | QString fileName; | 404 | QString fileName; |
405 | stream >> fileName; | 405 | stream >> fileName; |
406 | //qDebug("filename %s ", fileName.latin1()); | 406 | //qDebug("filename %s ", fileName.latin1()); |
407 | showMaximized(); | 407 | showMaximized(); |
408 | raise(); | 408 | raise(); |
409 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 409 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
410 | mSyncManager->slotSyncMenu( 1002 ); | 410 | mSyncManager->slotSyncMenu( 1002 ); |
411 | return; | 411 | return; |
412 | } | 412 | } |
413 | 413 | ||
414 | if ( cmsg == "-writeFile" ) { | 414 | if ( cmsg == "-writeFile" ) { |
415 | // I made from the "-writeFile" an "-writeAlarm" | 415 | // I made from the "-writeFile" an "-writeAlarm" |
416 | mView->viewManager()->showWhatsNextView(); | 416 | mView->viewManager()->showWhatsNextView(); |
417 | mCalendar->checkAlarmForIncidence( 0, true); | 417 | mCalendar->checkAlarmForIncidence( 0, true); |
418 | showMaximized(); | 418 | showMaximized(); |
419 | raise(); | 419 | raise(); |
420 | return; | 420 | return; |
421 | 421 | ||
422 | } | 422 | } |
423 | if ( cmsg == "-writeFileSilent" ) { | 423 | if ( cmsg == "-writeFileSilent" ) { |
424 | // I made from the "-writeFile" an "-writeAlarm" | 424 | // I made from the "-writeFile" an "-writeAlarm" |
425 | // mView->viewManager()->showWhatsNextView(); | 425 | // mView->viewManager()->showWhatsNextView(); |
426 | mCalendar->checkAlarmForIncidence( 0, true); | 426 | mCalendar->checkAlarmForIncidence( 0, true); |
427 | //showMaximized(); | 427 | //showMaximized(); |
428 | //raise(); | 428 | //raise(); |
429 | hide(); | 429 | hide(); |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | if ( cmsg == "-newCountdown" ) { | 432 | if ( cmsg == "-newCountdown" ) { |
433 | qDebug("newCountdown "); | 433 | qDebug("newCountdown "); |
434 | 434 | ||
435 | } | 435 | } |
436 | QString msg ; | 436 | QString msg ; |
437 | QString allmsg = cmsg; | 437 | QString allmsg = cmsg; |
438 | while ( allmsg.length() > 0 ) { | 438 | while ( allmsg.length() > 0 ) { |
439 | int nextC = allmsg.find( "-", 1 ); | 439 | int nextC = allmsg.find( "-", 1 ); |
440 | if ( nextC == -1 ) { | 440 | if ( nextC == -1 ) { |
441 | msg = allmsg; | 441 | msg = allmsg; |
442 | allmsg = ""; | 442 | allmsg = ""; |
443 | } else{ | 443 | } else{ |
444 | msg = allmsg.left( nextC ); | 444 | msg = allmsg.left( nextC ); |
445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
446 | } | 446 | } |
447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
448 | if ( msg == "-newEvent" ) { | 448 | if ( msg == "-newEvent" ) { |
449 | mView->newEvent(); | 449 | mView->newEvent(); |
450 | } | 450 | } |
451 | if ( msg == "-newTodo" ) { | 451 | if ( msg == "-newTodo" ) { |
452 | mView->newTodo(); | 452 | mView->newTodo(); |
453 | 453 | ||
454 | } | 454 | } |
455 | if ( msg == "-showWN" ) { | 455 | if ( msg == "-showWN" ) { |
456 | mView->viewManager()->showWhatsNextView(); | 456 | mView->viewManager()->showWhatsNextView(); |
457 | } | 457 | } |
458 | if ( msg == "-showTodo" ) { | 458 | if ( msg == "-showTodo" ) { |
459 | mView->viewManager()->showTodoView(); | 459 | mView->viewManager()->showTodoView(); |
460 | } | 460 | } |
461 | if ( msg == "-showList" ) { | 461 | if ( msg == "-showList" ) { |
462 | mView->viewManager()->showListView(); | 462 | mView->viewManager()->showListView(); |
463 | } | 463 | } |
464 | else if ( msg == "-showDay" ) { | 464 | else if ( msg == "-showDay" ) { |
465 | mView->viewManager()->showDayView(); | 465 | mView->viewManager()->showDayView(); |
466 | } | 466 | } |
467 | else if ( msg == "-showWWeek" ) { | 467 | else if ( msg == "-showWWeek" ) { |
468 | mView->viewManager()->showWorkWeekView(); | 468 | mView->viewManager()->showWorkWeekView(); |
469 | } | 469 | } |
470 | else if ( msg == "-ringSync" ) { | 470 | else if ( msg == "-ringSync" ) { |
471 | mSyncManager->multiSync( false ); | 471 | mSyncManager->multiSync( false ); |
472 | } | 472 | } |
473 | else if ( msg == "-showWeek" ) { | 473 | else if ( msg == "-showWeek" ) { |
474 | mView->viewManager()->showWeekView(); | 474 | mView->viewManager()->showWeekView(); |
475 | } | 475 | } |
476 | else if ( msg == "-showTodo" ) { | 476 | else if ( msg == "-showTodo" ) { |
477 | mView->viewManager()->showTodoView(); | 477 | mView->viewManager()->showTodoView(); |
478 | } | 478 | } |
479 | else if ( msg == "-showJournal" ) { | 479 | else if ( msg == "-showJournal" ) { |
480 | mView->dateNavigator()->selectDates( 1 ); | 480 | mView->dateNavigator()->selectDates( 1 ); |
481 | mView->dateNavigator()->selectToday(); | 481 | mView->dateNavigator()->selectToday(); |
482 | mView->viewManager()->showJournalView(); | 482 | mView->viewManager()->showJournalView(); |
483 | } | 483 | } |
484 | else if ( msg == "-showKO" ) { | 484 | else if ( msg == "-showKO" ) { |
485 | mView->viewManager()->showNextXView(); | 485 | mView->viewManager()->showNextXView(); |
486 | } | 486 | } |
487 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 487 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
488 | mView->viewManager()->showWhatsNextView(); | 488 | mView->viewManager()->showWhatsNextView(); |
489 | } | 489 | } |
490 | else if ( msg == "-showNextXView" ) { | 490 | else if ( msg == "-showNextXView" ) { |
491 | mView->viewManager()->showNextXView(); | 491 | mView->viewManager()->showNextXView(); |
492 | } | 492 | } |
493 | 493 | ||
494 | 494 | ||
495 | } | 495 | } |
496 | 496 | ||
497 | showMaximized(); | 497 | showMaximized(); |
498 | raise(); | 498 | raise(); |
499 | } | 499 | } |
500 | 500 | ||
501 | QPixmap MainWindow::loadPixmap( QString name ) | 501 | QPixmap MainWindow::loadPixmap( QString name ) |
502 | { | 502 | { |
503 | return SmallIcon( name ); | 503 | return SmallIcon( name ); |
504 | 504 | ||
505 | } | 505 | } |
506 | void MainWindow::initActions() | 506 | void MainWindow::initActions() |
507 | { | 507 | { |
508 | //KOPrefs::instance()->mShowFullMenu | 508 | //KOPrefs::instance()->mShowFullMenu |
509 | iconToolBar->clear(); | 509 | iconToolBar->clear(); |
510 | KOPrefs *p = KOPrefs::instance(); | 510 | KOPrefs *p = KOPrefs::instance(); |
511 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 511 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
512 | 512 | ||
513 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 513 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
514 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 514 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
515 | QPopupMenu *importMenu = new QPopupMenu( this ); | 515 | QPopupMenu *importMenu = new QPopupMenu( this ); |
516 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 516 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
517 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 517 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
518 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 518 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
519 | selectFilterMenu = new QPopupMenu( this ); | 519 | selectFilterMenu = new QPopupMenu( this ); |
520 | selectFilterMenu->setCheckable( true ); | 520 | selectFilterMenu->setCheckable( true ); |
521 | syncMenu = new QPopupMenu( this ); | 521 | syncMenu = new QPopupMenu( this ); |
522 | configureAgendaMenu = new QPopupMenu( this ); | 522 | configureAgendaMenu = new QPopupMenu( this ); |
523 | configureToolBarMenu = new QPopupMenu( this ); | 523 | configureToolBarMenu = new QPopupMenu( this ); |
524 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 524 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
525 | QIconSet icon; | 525 | QIconSet icon; |
526 | int pixWid = 22, pixHei = 22; | 526 | int pixWid = 22, pixHei = 22; |
527 | QString pathString = ""; | 527 | QString pathString = ""; |
528 | if ( !p->mToolBarMiniIcons ) { | 528 | if ( !p->mToolBarMiniIcons ) { |
529 | if ( QApplication::desktop()->width() < 480 ) { | 529 | if ( QApplication::desktop()->width() < 480 ) { |
530 | pathString += "icons16/"; | 530 | pathString += "icons16/"; |
531 | pixWid = 18; pixHei = 16; | 531 | pixWid = 18; pixHei = 16; |
532 | } | 532 | } |
533 | } else { | 533 | } else { |
534 | pathString += "iconsmini/"; | 534 | pathString += "iconsmini/"; |
535 | pixWid = 18; pixHei = 16; | 535 | pixWid = 18; pixHei = 16; |
536 | } | 536 | } |
537 | if ( KOPrefs::instance()->mShowFullMenu ) { | 537 | if ( KOPrefs::instance()->mShowFullMenu ) { |
538 | QMenuBar *menuBar1; | 538 | QMenuBar *menuBar1; |
539 | menuBar1 = menuBar(); | 539 | menuBar1 = menuBar(); |
540 | menuBar1->insertItem( i18n("File"), importMenu ); | 540 | menuBar1->insertItem( i18n("File"), importMenu ); |
541 | menuBar1->insertItem( i18n("View"), viewMenu ); | 541 | menuBar1->insertItem( i18n("View"), viewMenu ); |
542 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 542 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
543 | #ifdef DESKTOP_VERSION | 543 | #ifdef DESKTOP_VERSION |
544 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 544 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
545 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 545 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
546 | #else | 546 | #else |
547 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 547 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
548 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 548 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
549 | #endif | 549 | #endif |
550 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 550 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
551 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 551 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
552 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 552 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
553 | } else { | 553 | } else { |
554 | QPEMenuBar *menuBar1; | 554 | QPEMenuBar *menuBar1; |
555 | menuBar1 = new QPEMenuBar( iconToolBar ); | 555 | menuBar1 = new QPEMenuBar( iconToolBar ); |
556 | QPopupMenu *menuBar = new QPopupMenu( this ); | 556 | QPopupMenu *menuBar = new QPopupMenu( this ); |
557 | icon = loadPixmap( pathString + "z_menu" ); | 557 | icon = loadPixmap( pathString + "z_menu" ); |
558 | menuBar1->insertItem( icon.pixmap(), menuBar); | 558 | menuBar1->insertItem( icon.pixmap(), menuBar); |
559 | //menuBar1->insertItem( i18n("ME"), menuBar); | 559 | //menuBar1->insertItem( i18n("ME"), menuBar); |
560 | menuBar->insertItem( i18n("File"), importMenu ); | 560 | menuBar->insertItem( i18n("File"), importMenu ); |
561 | menuBar->insertItem( i18n("View"), viewMenu ); | 561 | menuBar->insertItem( i18n("View"), viewMenu ); |
562 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 562 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
563 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 563 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
564 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 564 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
565 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 565 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
566 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 566 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
567 | menuBar->insertItem( i18n("Help"), helpMenu ); | 567 | menuBar->insertItem( i18n("Help"), helpMenu ); |
568 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 568 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
569 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 569 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
570 | } | 570 | } |
571 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 571 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
572 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 572 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
573 | mWeekBgColor = iconToolBar->backgroundColor(); | 573 | mWeekBgColor = iconToolBar->backgroundColor(); |
574 | mWeekPixmap.resize( pixWid , pixHei ); | 574 | mWeekPixmap.resize( pixWid , pixHei ); |
575 | mWeekPixmap.fill( mWeekBgColor ); | 575 | mWeekPixmap.fill( mWeekBgColor ); |
576 | icon = mWeekPixmap; | 576 | icon = mWeekPixmap; |
577 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 577 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
578 | if ( p-> mShowIconWeekNum ) | 578 | if ( p-> mShowIconWeekNum ) |
579 | mWeekAction->addTo( iconToolBar ); | 579 | mWeekAction->addTo( iconToolBar ); |
580 | mWeekFont = font(); | 580 | mWeekFont = font(); |
581 | 581 | ||
582 | int fontPoint = mWeekFont.pointSize(); | 582 | int fontPoint = mWeekFont.pointSize(); |
583 | QFontMetrics f( mWeekFont ); | 583 | QFontMetrics f( mWeekFont ); |
584 | int fontWid = f.width( "30" ); | 584 | int fontWid = f.width( "30" ); |
585 | while ( fontWid > pixWid ) { | 585 | while ( fontWid > pixWid ) { |
586 | --fontPoint; | 586 | --fontPoint; |
587 | mWeekFont.setPointSize( fontPoint ); | 587 | mWeekFont.setPointSize( fontPoint ); |
588 | QFontMetrics f( mWeekFont ); | 588 | QFontMetrics f( mWeekFont ); |
589 | fontWid = f.width( "30" ); | 589 | fontWid = f.width( "30" ); |
590 | qDebug("dec-- "); | 590 | qDebug("dec-- "); |
591 | } | 591 | } |
592 | 592 | ||
593 | connect( mWeekAction, SIGNAL( activated() ), | 593 | connect( mWeekAction, SIGNAL( activated() ), |
594 | this, SLOT( weekAction() ) ); | 594 | this, SLOT( weekAction() ) ); |
595 | 595 | ||
596 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 596 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
597 | 597 | ||
598 | //#endif | 598 | //#endif |
599 | // ****************** | 599 | // ****************** |
600 | QAction *action; | 600 | QAction *action; |
601 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 601 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
602 | configureToolBarMenu->setCheckable( true ); | 602 | configureToolBarMenu->setCheckable( true ); |
603 | 603 | ||
604 | 604 | ||
605 | configureAgendaMenu->setCheckable( true ); | 605 | configureAgendaMenu->setCheckable( true ); |
606 | int iii ; | 606 | int iii ; |
607 | for ( iii = 1;iii<= 10 ;++iii ){ | 607 | for ( iii = 1;iii<= 10 ;++iii ){ |
608 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 608 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
609 | } | 609 | } |
610 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 610 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
611 | 611 | ||
612 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 612 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
613 | this, SLOT( showConfigureAgenda( ) ) ); | 613 | this, SLOT( showConfigureAgenda( ) ) ); |
614 | 614 | ||
615 | icon = loadPixmap( pathString + "configure" ); | 615 | icon = loadPixmap( pathString + "configure" ); |
616 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 616 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
617 | action->addTo( actionMenu ); | 617 | action->addTo( actionMenu ); |
618 | connect( action, SIGNAL( activated() ), | 618 | connect( action, SIGNAL( activated() ), |
619 | mView, SLOT( edit_options() ) ); | 619 | mView, SLOT( edit_options() ) ); |
620 | actionMenu->insertSeparator(); | 620 | actionMenu->insertSeparator(); |
621 | 621 | ||
622 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 622 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
623 | action->addTo( actionMenu ); | 623 | action->addTo( actionMenu ); |
624 | connect( action, SIGNAL( activated() ), | 624 | connect( action, SIGNAL( activated() ), |
625 | mView, SLOT( undo_delete() ) ); | 625 | mView, SLOT( undo_delete() ) ); |
626 | actionMenu->insertSeparator(); | 626 | actionMenu->insertSeparator(); |
627 | 627 | ||
628 | icon = loadPixmap( pathString + "newevent" ); | 628 | icon = loadPixmap( pathString + "newevent" ); |
629 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 629 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
630 | configureToolBarMenu->insertSeparator(); | 630 | configureToolBarMenu->insertSeparator(); |
631 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 631 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
632 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 632 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
633 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 633 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
634 | ne_action->addTo( actionMenu ); | 634 | ne_action->addTo( actionMenu ); |
635 | connect( ne_action, SIGNAL( activated() ), | 635 | connect( ne_action, SIGNAL( activated() ), |
636 | mView, SLOT( newEvent() ) ); | 636 | mView, SLOT( newEvent() ) ); |
637 | icon = loadPixmap( pathString + "newtodo" ); | 637 | icon = loadPixmap( pathString + "newtodo" ); |
638 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 638 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
639 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 639 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
640 | nt_action->addTo( actionMenu ); | 640 | nt_action->addTo( actionMenu ); |
641 | connect( nt_action, SIGNAL( activated() ), | 641 | connect( nt_action, SIGNAL( activated() ), |
642 | mView, SLOT( newTodo() ) ); | 642 | mView, SLOT( newTodo() ) ); |
643 | 643 | ||
644 | icon = loadPixmap( pathString + "today" ); | 644 | icon = loadPixmap( pathString + "today" ); |
645 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 645 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
646 | today_action->addTo( viewMenu ); | 646 | today_action->addTo( viewMenu ); |
647 | connect( today_action, SIGNAL( activated() ), | 647 | connect( today_action, SIGNAL( activated() ), |
648 | mView, SLOT( goToday() ) ); | 648 | mView, SLOT( goToday() ) ); |
649 | viewMenu->insertSeparator(); | 649 | viewMenu->insertSeparator(); |
650 | 650 | ||
651 | icon = loadPixmap( pathString + "navi" ); | 651 | icon = loadPixmap( pathString + "navi" ); |
652 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 652 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
653 | action->addTo( viewMenu ); | 653 | action->addTo( viewMenu ); |
654 | connect( action, SIGNAL( activated() ), | 654 | connect( action, SIGNAL( activated() ), |
655 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 655 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
656 | mToggleNav = action ; | 656 | mToggleNav = action ; |
@@ -1343,771 +1343,784 @@ void MainWindow::aboutAutoSaving() | |||
1343 | } | 1343 | } |
1344 | void MainWindow::aboutKnownBugs() | 1344 | void MainWindow::aboutKnownBugs() |
1345 | { | 1345 | { |
1346 | QMessageBox* msg; | 1346 | QMessageBox* msg; |
1347 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1347 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1348 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1348 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1349 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1349 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1350 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1350 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1351 | i18n("\nor report them in the bugtracker on\n") + | 1351 | i18n("\nor report them in the bugtracker on\n") + |
1352 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1352 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1353 | QMessageBox::NoIcon, | 1353 | QMessageBox::NoIcon, |
1354 | QMessageBox::Ok, | 1354 | QMessageBox::Ok, |
1355 | QMessageBox::NoButton, | 1355 | QMessageBox::NoButton, |
1356 | QMessageBox::NoButton); | 1356 | QMessageBox::NoButton); |
1357 | msg->exec(); | 1357 | msg->exec(); |
1358 | delete msg; | 1358 | delete msg; |
1359 | 1359 | ||
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | QString MainWindow::defaultFileName() | 1362 | QString MainWindow::defaultFileName() |
1363 | { | 1363 | { |
1364 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1364 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1365 | } | 1365 | } |
1366 | QString MainWindow::syncFileName() | 1366 | QString MainWindow::syncFileName() |
1367 | { | 1367 | { |
1368 | #ifdef DESKTOP_VERSION | 1368 | #ifdef DESKTOP_VERSION |
1369 | return locateLocal( "tmp", "synccalendar.ics" ); | 1369 | return locateLocal( "tmp", "synccalendar.ics" ); |
1370 | #else | 1370 | #else |
1371 | return QString( "/tmp/synccalendar.ics" ); | 1371 | return QString( "/tmp/synccalendar.ics" ); |
1372 | #endif | 1372 | #endif |
1373 | } | 1373 | } |
1374 | void MainWindow::updateWeek(QDate seda) | 1374 | void MainWindow::updateWeek(QDate seda) |
1375 | { | 1375 | { |
1376 | int weekNum = 0; | 1376 | int weekNum = 0; |
1377 | QDate d = QDate ( seda.year(), 1,1); | 1377 | QDate d = QDate ( seda.year(), 1,1); |
1378 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday | 1378 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday |
1379 | if ( seda.addDays(6).year() != seda.year() ) { | 1379 | if ( seda.addDays(6).year() != seda.year() ) { |
1380 | if ( seda.year() != d.year() ) { | 1380 | if ( seda.year() != d.year() ) { |
1381 | if ( d.dayOfWeek() > 4 ) | 1381 | if ( d.dayOfWeek() > 4 ) |
1382 | d = QDate ( seda.year(), 1,1); | 1382 | d = QDate ( seda.year(), 1,1); |
1383 | else | 1383 | else |
1384 | weekNum = 1; | 1384 | weekNum = 1; |
1385 | } else { | 1385 | } else { |
1386 | QDate dd( seda.year()+1, 1,1); | 1386 | QDate dd( seda.year()+1, 1,1); |
1387 | if ( dd.dayOfWeek() <= 4 ) | 1387 | if ( dd.dayOfWeek() <= 4 ) |
1388 | weekNum = 1; | 1388 | weekNum = 1; |
1389 | } | 1389 | } |
1390 | } | 1390 | } |
1391 | if ( weekNum == 0 ){ | 1391 | if ( weekNum == 0 ){ |
1392 | int dow = d.dayOfWeek(); | 1392 | int dow = d.dayOfWeek(); |
1393 | if ( dow <= 4 ) | 1393 | if ( dow <= 4 ) |
1394 | d = d.addDays( 1-dow ); | 1394 | d = d.addDays( 1-dow ); |
1395 | else // 5,6,7 | 1395 | else // 5,6,7 |
1396 | d = d.addDays( 8-dow ); | 1396 | d = d.addDays( 8-dow ); |
1397 | // we have the first week of the year.we are on monday | 1397 | // we have the first week of the year.we are on monday |
1398 | weekNum = d.daysTo( seda ) / 7 +1; | 1398 | weekNum = d.daysTo( seda ) / 7 +1; |
1399 | } | 1399 | } |
1400 | 1400 | ||
1401 | mWeekPixmap.fill( mWeekBgColor ); | 1401 | mWeekPixmap.fill( mWeekBgColor ); |
1402 | QPainter p ( &mWeekPixmap ); | 1402 | QPainter p ( &mWeekPixmap ); |
1403 | p.setFont( mWeekFont ); | 1403 | p.setFont( mWeekFont ); |
1404 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1404 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1405 | p.end(); | 1405 | p.end(); |
1406 | QIconSet icon3 ( mWeekPixmap ); | 1406 | QIconSet icon3 ( mWeekPixmap ); |
1407 | mWeekAction->setIconSet ( icon3 ); | 1407 | mWeekAction->setIconSet ( icon3 ); |
1408 | 1408 | ||
1409 | } | 1409 | } |
1410 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1410 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1411 | { | 1411 | { |
1412 | updateWeek( selectedDates.first() ); | 1412 | updateWeek( selectedDates.first() ); |
1413 | } | 1413 | } |
1414 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1414 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1415 | { | 1415 | { |
1416 | 1416 | ||
1417 | if ( !incidence ) { | 1417 | if ( !incidence ) { |
1418 | enableIncidenceActions( false ); | 1418 | enableIncidenceActions( false ); |
1419 | 1419 | ||
1420 | mNewSubTodoAction->setEnabled( false ); | 1420 | mNewSubTodoAction->setEnabled( false ); |
1421 | setCaptionToDates(); | 1421 | setCaptionToDates(); |
1422 | return; | 1422 | return; |
1423 | 1423 | ||
1424 | } | 1424 | } |
1425 | 1425 | ||
1426 | //KGlobal::locale()->formatDateTime(nextA, true); | 1426 | //KGlobal::locale()->formatDateTime(nextA, true); |
1427 | QString startString = ""; | 1427 | QString startString = ""; |
1428 | if ( incidence->type() != "Todo" ) { | 1428 | if ( incidence->type() != "Todo" ) { |
1429 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1429 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1430 | if ( incidence->doesFloat() ) { | 1430 | if ( incidence->doesFloat() ) { |
1431 | startString += ": "+incidence->dtStartDateStr( true ); | 1431 | startString += ": "+incidence->dtStartDateStr( true ); |
1432 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1432 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1433 | 1433 | ||
1434 | } else { | 1434 | } else { |
1435 | startString = ": "+incidence->dtStartStr(true); | 1435 | startString = ": "+incidence->dtStartStr(true); |
1436 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1436 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1437 | 1437 | ||
1438 | } | 1438 | } |
1439 | 1439 | ||
1440 | } else { | 1440 | } else { |
1441 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1441 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1442 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1442 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1443 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1443 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1444 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { | 1444 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1445 | bool ok; | 1445 | bool ok; |
1446 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1446 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1447 | if ( ok ) { | 1447 | if ( ok ) { |
1448 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1448 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1449 | startString += i18n(" (%1 y.)"). arg( years ); | 1449 | startString += i18n(" (%1 y.)"). arg( years ); |
1450 | } | 1450 | } |
1451 | } | 1451 | } |
1452 | else | 1452 | else |
1453 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1453 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1454 | } | 1454 | } |
1455 | 1455 | ||
1456 | } | 1456 | } |
1457 | else | 1457 | else |
1458 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1458 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1459 | if ( !incidence->location().isEmpty() ) | 1459 | if ( !incidence->location().isEmpty() ) |
1460 | startString += " (" +incidence->location()+")"; | 1460 | startString += " (" +incidence->location()+")"; |
1461 | setCaption( incidence->summary()+startString); | 1461 | setCaption( incidence->summary()+startString); |
1462 | 1462 | ||
1463 | enableIncidenceActions( true ); | 1463 | enableIncidenceActions( true ); |
1464 | 1464 | ||
1465 | if ( incidence->type() == "Event" ) { | 1465 | if ( incidence->type() == "Event" ) { |
1466 | mShowAction->setText( i18n("Show Event...") ); | 1466 | mShowAction->setText( i18n("Show Event...") ); |
1467 | mEditAction->setText( i18n("Edit Event...") ); | 1467 | mEditAction->setText( i18n("Edit Event...") ); |
1468 | mDeleteAction->setText( i18n("Delete Event...") ); | 1468 | mDeleteAction->setText( i18n("Delete Event...") ); |
1469 | 1469 | ||
1470 | mNewSubTodoAction->setEnabled( false ); | 1470 | mNewSubTodoAction->setEnabled( false ); |
1471 | } else if ( incidence->type() == "Todo" ) { | 1471 | } else if ( incidence->type() == "Todo" ) { |
1472 | mShowAction->setText( i18n("Show Todo...") ); | 1472 | mShowAction->setText( i18n("Show Todo...") ); |
1473 | mEditAction->setText( i18n("Edit Todo...") ); | 1473 | mEditAction->setText( i18n("Edit Todo...") ); |
1474 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1474 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1475 | 1475 | ||
1476 | mNewSubTodoAction->setEnabled( true ); | 1476 | mNewSubTodoAction->setEnabled( true ); |
1477 | } else { | 1477 | } else { |
1478 | mShowAction->setText( i18n("Show...") ); | 1478 | mShowAction->setText( i18n("Show...") ); |
1479 | mShowAction->setText( i18n("Edit...") ); | 1479 | mShowAction->setText( i18n("Edit...") ); |
1480 | mShowAction->setText( i18n("Delete...") ); | 1480 | mShowAction->setText( i18n("Delete...") ); |
1481 | 1481 | ||
1482 | mNewSubTodoAction->setEnabled( false ); | 1482 | mNewSubTodoAction->setEnabled( false ); |
1483 | } | 1483 | } |
1484 | } | 1484 | } |
1485 | 1485 | ||
1486 | void MainWindow::enableIncidenceActions( bool enabled ) | 1486 | void MainWindow::enableIncidenceActions( bool enabled ) |
1487 | { | 1487 | { |
1488 | mShowAction->setEnabled( enabled ); | 1488 | mShowAction->setEnabled( enabled ); |
1489 | mEditAction->setEnabled( enabled ); | 1489 | mEditAction->setEnabled( enabled ); |
1490 | mDeleteAction->setEnabled( enabled ); | 1490 | mDeleteAction->setEnabled( enabled ); |
1491 | 1491 | ||
1492 | mCloneAction->setEnabled( enabled ); | 1492 | mCloneAction->setEnabled( enabled ); |
1493 | mMoveAction->setEnabled( enabled ); | 1493 | mMoveAction->setEnabled( enabled ); |
1494 | mBeamAction->setEnabled( enabled ); | 1494 | mBeamAction->setEnabled( enabled ); |
1495 | mCancelAction->setEnabled( enabled ); | 1495 | mCancelAction->setEnabled( enabled ); |
1496 | } | 1496 | } |
1497 | 1497 | ||
1498 | void MainWindow::importOL() | 1498 | void MainWindow::importOL() |
1499 | { | 1499 | { |
1500 | #ifdef _OL_IMPORT_ | 1500 | #ifdef _OL_IMPORT_ |
1501 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1501 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1502 | id->exec(); | 1502 | id->exec(); |
1503 | delete id; | 1503 | delete id; |
1504 | mView->updateView(); | 1504 | mView->updateView(); |
1505 | #endif | 1505 | #endif |
1506 | } | 1506 | } |
1507 | void MainWindow::importBday() | 1507 | void MainWindow::importBday() |
1508 | { | 1508 | { |
1509 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1509 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1510 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1510 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1511 | i18n("Import!"), i18n("Cancel"), 0, | 1511 | i18n("Import!"), i18n("Cancel"), 0, |
1512 | 0, 1 ); | 1512 | 0, 1 ); |
1513 | if ( result == 0 ) { | 1513 | if ( result == 0 ) { |
1514 | mView->importBday(); | 1514 | mView->importBday(); |
1515 | 1515 | ||
1516 | } | 1516 | } |
1517 | 1517 | ||
1518 | 1518 | ||
1519 | } | 1519 | } |
1520 | void MainWindow::importQtopia() | 1520 | void MainWindow::importQtopia() |
1521 | { | 1521 | { |
1522 | //#ifndef DESKTOP_VERSION | 1522 | //#ifndef DESKTOP_VERSION |
1523 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1523 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1524 | #ifdef DESKTOP_VERSION | 1524 | #ifdef DESKTOP_VERSION |
1525 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1525 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1526 | #endif | 1526 | #endif |
1527 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1527 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1528 | i18n("Import!"), i18n("Cancel"), 0, | 1528 | i18n("Import!"), i18n("Cancel"), 0, |
1529 | 0, 1 ); | 1529 | 0, 1 ); |
1530 | if ( result == 0 ) { | 1530 | if ( result == 0 ) { |
1531 | #ifndef DESKTOP_VERSION | 1531 | #ifndef DESKTOP_VERSION |
1532 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1532 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1533 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1533 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1534 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1534 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1535 | #else | 1535 | #else |
1536 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1536 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1537 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1537 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1538 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1538 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1539 | #endif | 1539 | #endif |
1540 | mView->importQtopia( categories, datebook, todolist ); | 1540 | mView->importQtopia( categories, datebook, todolist ); |
1541 | } | 1541 | } |
1542 | #if 0 | 1542 | #if 0 |
1543 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1543 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1544 | i18n("Not supported \non desktop!\n"), | 1544 | i18n("Not supported \non desktop!\n"), |
1545 | i18n("Ok"), i18n("Cancel"), 0, | 1545 | i18n("Ok"), i18n("Cancel"), 0, |
1546 | 0, 1 ); | 1546 | 0, 1 ); |
1547 | 1547 | ||
1548 | #endif | 1548 | #endif |
1549 | } | 1549 | } |
1550 | 1550 | ||
1551 | void MainWindow::saveOnClose() | 1551 | void MainWindow::saveOnClose() |
1552 | { | 1552 | { |
1553 | KOPrefs *p = KOPrefs::instance(); | 1553 | KOPrefs *p = KOPrefs::instance(); |
1554 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1554 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1555 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1555 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1556 | iconToolBar->y() > height()/2; | 1556 | iconToolBar->y() > height()/2; |
1557 | mView->writeSettings(); | 1557 | mView->writeSettings(); |
1558 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1558 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1559 | save(); | 1559 | save(); |
1560 | } | 1560 | } |
1561 | void MainWindow::slotModifiedChanged( bool changed ) | 1561 | void MainWindow::slotModifiedChanged( bool changed ) |
1562 | { | 1562 | { |
1563 | if ( mBlockAtStartup ) | 1563 | if ( mBlockAtStartup ) |
1564 | return; | 1564 | return; |
1565 | 1565 | ||
1566 | int msec; | 1566 | int msec; |
1567 | // we store the changes after 1 minute, | 1567 | // we store the changes after 1 minute, |
1568 | // and for safety reasons after 10 minutes again | 1568 | // and for safety reasons after 10 minutes again |
1569 | if ( !mSyncManager->blockSave() ) | 1569 | if ( !mSyncManager->blockSave() ) |
1570 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1570 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1571 | else | 1571 | else |
1572 | msec = 1000 * 600; | 1572 | msec = 1000 * 600; |
1573 | mSaveTimer.start( msec, true ); // 1 minute | 1573 | mSaveTimer.start( msec, true ); // 1 minute |
1574 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1574 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1575 | mCalendarModifiedFlag = true; | 1575 | mCalendarModifiedFlag = true; |
1576 | } | 1576 | } |
1577 | void MainWindow::saveStopTimer() | 1577 | void MainWindow::saveStopTimer() |
1578 | { | 1578 | { |
1579 | mSaveTimer.stop(); | 1579 | mSaveTimer.stop(); |
1580 | if (mSaveTimer.isActive() ) | 1580 | if (mSaveTimer.isActive() ) |
1581 | qDebug("ti active "); | 1581 | qDebug("ti active "); |
1582 | else | 1582 | else |
1583 | qDebug("KO: Save timer stopped"); | 1583 | qDebug("KO: Save timer stopped"); |
1584 | } | 1584 | } |
1585 | void MainWindow::save() | 1585 | void MainWindow::save() |
1586 | { | 1586 | { |
1587 | if ( !mCalendarModifiedFlag ) { | 1587 | if ( !mCalendarModifiedFlag ) { |
1588 | qDebug("KO: Calendar not modified. Nothing saved."); | 1588 | qDebug("KO: Calendar not modified. Nothing saved."); |
1589 | return; | 1589 | return; |
1590 | } | 1590 | } |
1591 | if ( mSyncManager->blockSave() ) | 1591 | if ( mSyncManager->blockSave() ) |
1592 | return; | 1592 | return; |
1593 | mSyncManager->setBlockSave(true); | 1593 | mSyncManager->setBlockSave(true); |
1594 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1594 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1595 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1595 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1596 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1596 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1597 | qDebug("KO: Start saving data to file!"); | 1597 | qDebug("KO: Start saving data to file!"); |
1598 | mView->saveCalendar( defaultFileName() ); | 1598 | mView->saveCalendar( defaultFileName() ); |
1599 | mCalendarModifiedFlag = false; | 1599 | mCalendarModifiedFlag = false; |
1600 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1600 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1601 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1601 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1602 | QString savemes; | 1602 | QString savemes; |
1603 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1603 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1604 | setCaption(savemes); | 1604 | setCaption(savemes); |
1605 | } else | 1605 | } else |
1606 | setCaption(i18n("Saving cancelled!")); | 1606 | setCaption(i18n("Saving cancelled!")); |
1607 | mSyncManager->setBlockSave( false ); | 1607 | mSyncManager->setBlockSave( false ); |
1608 | } | 1608 | } |
1609 | 1609 | ||
1610 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1610 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1611 | { | 1611 | { |
1612 | if ( !e->isAutoRepeat() ) { | 1612 | if ( !e->isAutoRepeat() ) { |
1613 | mFlagKeyPressed = false; | 1613 | mFlagKeyPressed = false; |
1614 | } | 1614 | } |
1615 | } | 1615 | } |
1616 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1616 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1617 | { | 1617 | { |
1618 | qApp->processEvents(); | 1618 | qApp->processEvents(); |
1619 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1619 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1620 | e->ignore(); | 1620 | e->ignore(); |
1621 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1621 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1622 | return; | 1622 | return; |
1623 | } | 1623 | } |
1624 | if (! e->isAutoRepeat() ) | 1624 | if (! e->isAutoRepeat() ) |
1625 | mFlagKeyPressed = true; | 1625 | mFlagKeyPressed = true; |
1626 | KOPrefs *p = KOPrefs::instance(); | 1626 | KOPrefs *p = KOPrefs::instance(); |
1627 | bool showSelectedDates = false; | 1627 | bool showSelectedDates = false; |
1628 | int size; | 1628 | int size; |
1629 | int pro = 0; | 1629 | int pro = 0; |
1630 | //qDebug("MainWindow::keyPressEvent "); | 1630 | //qDebug("MainWindow::keyPressEvent "); |
1631 | switch ( e->key() ) { | 1631 | switch ( e->key() ) { |
1632 | case Qt::Key_Right: | 1632 | case Qt::Key_Right: |
1633 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1633 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1634 | mView->goNextMonth(); | 1634 | mView->goNextMonth(); |
1635 | else | 1635 | else |
1636 | mView->goNext(); | 1636 | mView->goNext(); |
1637 | showSelectedDates = true; | 1637 | showSelectedDates = true; |
1638 | break; | 1638 | break; |
1639 | case Qt::Key_Left: | 1639 | case Qt::Key_Left: |
1640 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1640 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1641 | mView->goPreviousMonth(); | 1641 | mView->goPreviousMonth(); |
1642 | else | 1642 | else |
1643 | mView->goPrevious(); | 1643 | mView->goPrevious(); |
1644 | showSelectedDates = true; | 1644 | showSelectedDates = true; |
1645 | break; | 1645 | break; |
1646 | case Qt::Key_Down: | 1646 | case Qt::Key_Down: |
1647 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1647 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1648 | break; | 1648 | break; |
1649 | case Qt::Key_Up: | 1649 | case Qt::Key_Up: |
1650 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1650 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1651 | break; | 1651 | break; |
1652 | case Qt::Key_K: | 1652 | case Qt::Key_K: |
1653 | mView->viewManager()->showMonthViewWeek(); | 1653 | mView->viewManager()->showMonthViewWeek(); |
1654 | break; | 1654 | break; |
1655 | case Qt::Key_I: | 1655 | case Qt::Key_I: |
1656 | mView->showIncidence(); | 1656 | mView->showIncidence(); |
1657 | break; | 1657 | break; |
1658 | case Qt::Key_Delete: | 1658 | case Qt::Key_Delete: |
1659 | case Qt::Key_Backspace: | 1659 | case Qt::Key_Backspace: |
1660 | mView->deleteIncidence(); | 1660 | mView->deleteIncidence(); |
1661 | break; | 1661 | break; |
1662 | case Qt::Key_D: | 1662 | case Qt::Key_D: |
1663 | mView->viewManager()->showDayView(); | 1663 | mView->viewManager()->showDayView(); |
1664 | showSelectedDates = true; | 1664 | showSelectedDates = true; |
1665 | break; | 1665 | break; |
1666 | case Qt::Key_O: | 1666 | case Qt::Key_O: |
1667 | mView->toggleFilerEnabled( ); | 1667 | mView->toggleFilerEnabled( ); |
1668 | break; | 1668 | break; |
1669 | case Qt::Key_0: | 1669 | case Qt::Key_0: |
1670 | case Qt::Key_1: | 1670 | case Qt::Key_1: |
1671 | case Qt::Key_2: | 1671 | case Qt::Key_2: |
1672 | case Qt::Key_3: | 1672 | case Qt::Key_3: |
1673 | case Qt::Key_4: | 1673 | case Qt::Key_4: |
1674 | case Qt::Key_5: | 1674 | case Qt::Key_5: |
1675 | case Qt::Key_6: | 1675 | case Qt::Key_6: |
1676 | case Qt::Key_7: | 1676 | case Qt::Key_7: |
1677 | case Qt::Key_8: | 1677 | case Qt::Key_8: |
1678 | case Qt::Key_9: | 1678 | case Qt::Key_9: |
1679 | pro = e->key()-48; | 1679 | pro = e->key()-48; |
1680 | if ( pro == 0 ) | 1680 | if ( pro == 0 ) |
1681 | pro = 10; | 1681 | pro = 10; |
1682 | if ( e->state() == Qt::ControlButton) | 1682 | if ( e->state() == Qt::ControlButton) |
1683 | pro += 10; | 1683 | pro += 10; |
1684 | break; | 1684 | break; |
1685 | case Qt::Key_M: | 1685 | case Qt::Key_M: |
1686 | mView->viewManager()->showMonthView(); | 1686 | mView->viewManager()->showMonthView(); |
1687 | showSelectedDates = true; | 1687 | showSelectedDates = true; |
1688 | break; | 1688 | break; |
1689 | case Qt::Key_Insert: | 1689 | case Qt::Key_Insert: |
1690 | mView->newEvent(); | 1690 | mView->newEvent(); |
1691 | break; | 1691 | break; |
1692 | case Qt::Key_S : | 1692 | case Qt::Key_S : |
1693 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1693 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1694 | mView->newSubTodo(); | 1694 | mView->newSubTodo(); |
1695 | else | 1695 | else |
1696 | mView->dialogManager()->showSearchDialog(); | 1696 | mView->dialogManager()->showSearchDialog(); |
1697 | break; | 1697 | break; |
1698 | case Qt::Key_Y : | 1698 | case Qt::Key_Y : |
1699 | case Qt::Key_Z : | 1699 | case Qt::Key_Z : |
1700 | mView->viewManager()->showWorkWeekView(); | 1700 | mView->viewManager()->showWorkWeekView(); |
1701 | showSelectedDates = true; | 1701 | showSelectedDates = true; |
1702 | break; | 1702 | break; |
1703 | case Qt::Key_U : | 1703 | case Qt::Key_U : |
1704 | mView->viewManager()->showWeekView(); | 1704 | mView->viewManager()->showWeekView(); |
1705 | showSelectedDates = true; | 1705 | showSelectedDates = true; |
1706 | break; | 1706 | break; |
1707 | case Qt::Key_H : | 1707 | case Qt::Key_H : |
1708 | keyBindings(); | 1708 | keyBindings(); |
1709 | break; | 1709 | break; |
1710 | case Qt::Key_W: | 1710 | case Qt::Key_W: |
1711 | mView->viewManager()->showWhatsNextView(); | 1711 | mView->viewManager()->showWhatsNextView(); |
1712 | break; | 1712 | break; |
1713 | case Qt::Key_L: | 1713 | case Qt::Key_L: |
1714 | mView->viewManager()->showListView(); | 1714 | mView->viewManager()->showListView(); |
1715 | break; | 1715 | break; |
1716 | case Qt::Key_N: | 1716 | case Qt::Key_N: |
1717 | mView->viewManager()->showNextXView(); | 1717 | mView->viewManager()->showNextXView(); |
1718 | showSelectedDates = true; | 1718 | showSelectedDates = true; |
1719 | break; | 1719 | break; |
1720 | case Qt::Key_V: | 1720 | case Qt::Key_V: |
1721 | mView->viewManager()->showTodoView(); | 1721 | mView->viewManager()->showTodoView(); |
1722 | break; | 1722 | break; |
1723 | case Qt::Key_C: | 1723 | case Qt::Key_C: |
1724 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1724 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1725 | break; | 1725 | break; |
1726 | case Qt::Key_P: | 1726 | case Qt::Key_P: |
1727 | mView->showDatePicker( ); | 1727 | mView->showDatePicker( ); |
1728 | break; | 1728 | break; |
1729 | case Qt::Key_F: | 1729 | case Qt::Key_F: |
1730 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1730 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1731 | mView->editFilters(); | 1731 | mView->editFilters(); |
1732 | else | 1732 | else |
1733 | mView->toggleFilter(); | 1733 | mView->toggleFilter(); |
1734 | break; | 1734 | break; |
1735 | case Qt::Key_X: | 1735 | case Qt::Key_X: |
1736 | mView->toggleDateNavigatorWidget(); | 1736 | mView->toggleDateNavigatorWidget(); |
1737 | break; | 1737 | break; |
1738 | case Qt::Key_Space: | 1738 | case Qt::Key_Space: |
1739 | mView->toggleExpand(); | 1739 | mView->toggleExpand(); |
1740 | break; | 1740 | break; |
1741 | case Qt::Key_A: | 1741 | case Qt::Key_A: |
1742 | mView->toggleAllDaySize(); | 1742 | mView->toggleAllDaySize(); |
1743 | break; | 1743 | break; |
1744 | case Qt::Key_T: | 1744 | case Qt::Key_T: |
1745 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1745 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1746 | mView->newTodo(); | 1746 | mView->newTodo(); |
1747 | else { | 1747 | else { |
1748 | mView->goToday(); | 1748 | mView->goToday(); |
1749 | showSelectedDates = true; | 1749 | showSelectedDates = true; |
1750 | } | 1750 | } |
1751 | break; | 1751 | break; |
1752 | case Qt::Key_J: | 1752 | case Qt::Key_J: |
1753 | mView->viewManager()->showJournalView(); | 1753 | mView->viewManager()->showJournalView(); |
1754 | break; | 1754 | break; |
1755 | case Qt::Key_B: | 1755 | case Qt::Key_B: |
1756 | mView->editIncidenceDescription();; | 1756 | mView->editIncidenceDescription();; |
1757 | break; | 1757 | break; |
1758 | // case Qt::Key_Return: | 1758 | // case Qt::Key_Return: |
1759 | case Qt::Key_E: | 1759 | case Qt::Key_E: |
1760 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1760 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1761 | mView->newEvent(); | 1761 | mView->newEvent(); |
1762 | else | 1762 | else |
1763 | mView->editIncidence(); | 1763 | mView->editIncidence(); |
1764 | break; | 1764 | break; |
1765 | case Qt::Key_Plus: | 1765 | case Qt::Key_Plus: |
1766 | size = p->mHourSize +2; | 1766 | size = p->mHourSize +2; |
1767 | if ( size <= 22 ) | 1767 | if ( size <= 22 ) |
1768 | configureAgenda( size ); | 1768 | configureAgenda( size ); |
1769 | break; | 1769 | break; |
1770 | case Qt::Key_Minus: | 1770 | case Qt::Key_Minus: |
1771 | size = p->mHourSize - 2; | 1771 | size = p->mHourSize - 2; |
1772 | if ( size >= 4 ) | 1772 | if ( size >= 4 ) |
1773 | configureAgenda( size ); | 1773 | configureAgenda( size ); |
1774 | break; | 1774 | break; |
1775 | 1775 | ||
1776 | 1776 | ||
1777 | default: | 1777 | default: |
1778 | e->ignore(); | 1778 | e->ignore(); |
1779 | } | 1779 | } |
1780 | if ( pro > 0 ) { | 1780 | if ( pro > 0 ) { |
1781 | mView->selectFilter( pro-1 ); | 1781 | mView->selectFilter( pro-1 ); |
1782 | } | 1782 | } |
1783 | if ( showSelectedDates ) { | 1783 | if ( showSelectedDates ) { |
1784 | ;// setCaptionToDates(); | 1784 | ;// setCaptionToDates(); |
1785 | } | 1785 | } |
1786 | 1786 | ||
1787 | } | 1787 | } |
1788 | 1788 | ||
1789 | void MainWindow::fillFilterMenu() | 1789 | void MainWindow::fillFilterMenu() |
1790 | { | 1790 | { |
1791 | selectFilterMenu->clear(); | 1791 | selectFilterMenu->clear(); |
1792 | bool disable = false; | 1792 | bool disable = false; |
1793 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 1793 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
1794 | selectFilterMenu->insertSeparator(); | 1794 | selectFilterMenu->insertSeparator(); |
1795 | if ( mView->filterView()->filtersEnabled() ) { | 1795 | if ( mView->filterView()->filtersEnabled() ) { |
1796 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); | 1796 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); |
1797 | } | 1797 | } |
1798 | else { | 1798 | else { |
1799 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); | 1799 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); |
1800 | disable = true; | 1800 | disable = true; |
1801 | } | 1801 | } |
1802 | selectFilterMenu->insertSeparator(); | 1802 | selectFilterMenu->insertSeparator(); |
1803 | QPtrList<CalFilter> fili = mView->filters(); | 1803 | QPtrList<CalFilter> fili = mView->filters(); |
1804 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1804 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1805 | CalFilter *filter = fili.first(); | 1805 | CalFilter *filter = fili.first(); |
1806 | int iii = 2; | 1806 | int iii = 2; |
1807 | while(filter) { | 1807 | while(filter) { |
1808 | selectFilterMenu->insertItem( filter->name(), iii ); | 1808 | selectFilterMenu->insertItem( filter->name(), iii ); |
1809 | if ( filter == curfilter) | 1809 | if ( filter == curfilter) |
1810 | selectFilterMenu->setItemChecked( iii, true ); | 1810 | selectFilterMenu->setItemChecked( iii, true ); |
1811 | if ( disable ) | 1811 | if ( disable ) |
1812 | selectFilterMenu->setItemEnabled( iii, false ); | 1812 | selectFilterMenu->setItemEnabled( iii, false ); |
1813 | filter = fili.next(); | 1813 | filter = fili.next(); |
1814 | ++iii; | 1814 | ++iii; |
1815 | } | 1815 | } |
1816 | } | 1816 | } |
1817 | void MainWindow::selectFilter( int fil ) | 1817 | void MainWindow::selectFilter( int fil ) |
1818 | { | 1818 | { |
1819 | if ( fil == 0 ) { | 1819 | if ( fil == 0 ) { |
1820 | mView->editFilters( ); | 1820 | mView->editFilters( ); |
1821 | } else if ( fil == 1 ){ | 1821 | } else if ( fil == 1 ){ |
1822 | mView->toggleFilerEnabled( ); | 1822 | mView->toggleFilerEnabled( ); |
1823 | } else { | 1823 | } else { |
1824 | mView->selectFilter( fil-2 ); | 1824 | mView->selectFilter( fil-2 ); |
1825 | } | 1825 | } |
1826 | } | 1826 | } |
1827 | void MainWindow::configureToolBar( int item ) | 1827 | void MainWindow::configureToolBar( int item ) |
1828 | { | 1828 | { |
1829 | 1829 | ||
1830 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1830 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1831 | KOPrefs *p = KOPrefs::instance(); | 1831 | KOPrefs *p = KOPrefs::instance(); |
1832 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1832 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1833 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1833 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1834 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1834 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1835 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1835 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1836 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1836 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1837 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1837 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1838 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1838 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1839 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 1839 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
1840 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1840 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1841 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1841 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1842 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1842 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1843 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1843 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1844 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1844 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1845 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1845 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1846 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1846 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1847 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1847 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1848 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1848 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1849 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1849 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1850 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1850 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1851 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1851 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1852 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 1852 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
1853 | // initActions(); | 1853 | // initActions(); |
1854 | } | 1854 | } |
1855 | 1855 | void MainWindow::setCaption ( const QString & c ) | |
1856 | { | ||
1857 | QString cap = c; | ||
1858 | cap.replace( QRegExp("\n"), " " ); | ||
1859 | cap = cap.stripWhiteSpace(); | ||
1860 | if ( cap.isEmpty() ) | ||
1861 | cap = "KO/Pi"; | ||
1862 | QWidget::setCaption( cap ); | ||
1863 | } | ||
1856 | void MainWindow::setCaptionToDates() | 1864 | void MainWindow::setCaptionToDates() |
1857 | { | 1865 | { |
1858 | QString selDates; | 1866 | QString selDates; |
1859 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1867 | QDate date = mView->startDate(); |
1868 | if ( ! date.isValid() ) { | ||
1869 | setCaption(""); | ||
1870 | return; | ||
1871 | } | ||
1872 | selDates = KGlobal::locale()->formatDate( date, true); | ||
1860 | if (mView->startDate() < mView->endDate() ) | 1873 | if (mView->startDate() < mView->endDate() ) |
1861 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1874 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1862 | else { | 1875 | else { |
1863 | QString addString; | 1876 | QString addString; |
1864 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) | 1877 | if ( date == QDateTime::currentDateTime().date() ) |
1865 | addString = i18n("Today"); | 1878 | addString = i18n("Today"); |
1866 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) | 1879 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
1867 | addString = i18n("Tomorrow"); | 1880 | addString = i18n("Tomorrow"); |
1868 | if ( !addString.isEmpty() ) | 1881 | if ( !addString.isEmpty() ) |
1869 | selDates = addString+", "+selDates ; | 1882 | selDates = addString+", "+selDates ; |
1870 | } | 1883 | } |
1871 | setCaption( i18n("Dates: ") + selDates ); | 1884 | setCaption( i18n("Dates: ") + selDates ); |
1872 | 1885 | ||
1873 | } | 1886 | } |
1874 | void MainWindow::showConfigureAgenda( ) | 1887 | void MainWindow::showConfigureAgenda( ) |
1875 | { | 1888 | { |
1876 | int iii; | 1889 | int iii; |
1877 | for ( iii = 1;iii<= 10 ;++iii ){ | 1890 | for ( iii = 1;iii<= 10 ;++iii ){ |
1878 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 1891 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
1879 | } | 1892 | } |
1880 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 1893 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
1881 | } | 1894 | } |
1882 | void MainWindow::configureAgenda( int item ) | 1895 | void MainWindow::configureAgenda( int item ) |
1883 | { | 1896 | { |
1884 | if ( KOPrefs::instance()->mHourSize == item ) | 1897 | if ( KOPrefs::instance()->mHourSize == item ) |
1885 | return; | 1898 | return; |
1886 | KOPrefs::instance()->mHourSize=item; | 1899 | KOPrefs::instance()->mHourSize=item; |
1887 | mView->viewManager()->agendaView()->updateConfig(); | 1900 | mView->viewManager()->agendaView()->updateConfig(); |
1888 | } | 1901 | } |
1889 | 1902 | ||
1890 | void MainWindow::saveCalendar() | 1903 | void MainWindow::saveCalendar() |
1891 | { | 1904 | { |
1892 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1905 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1893 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1906 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1894 | 1907 | ||
1895 | if ( fn == "" ) | 1908 | if ( fn == "" ) |
1896 | return; | 1909 | return; |
1897 | QFileInfo info; | 1910 | QFileInfo info; |
1898 | info.setFile( fn ); | 1911 | info.setFile( fn ); |
1899 | QString mes; | 1912 | QString mes; |
1900 | bool createbup = true; | 1913 | bool createbup = true; |
1901 | if ( info. exists() ) { | 1914 | if ( info. exists() ) { |
1902 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1915 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1903 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1916 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1904 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1917 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1905 | 0, 1 ); | 1918 | 0, 1 ); |
1906 | if ( result != 0 ) { | 1919 | if ( result != 0 ) { |
1907 | createbup = false; | 1920 | createbup = false; |
1908 | } | 1921 | } |
1909 | } | 1922 | } |
1910 | if ( createbup ) { | 1923 | if ( createbup ) { |
1911 | mView->saveCalendar( fn ); | 1924 | mView->saveCalendar( fn ); |
1912 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1925 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1913 | KOPrefs::instance()->mLastSaveFile = fn; | 1926 | KOPrefs::instance()->mLastSaveFile = fn; |
1914 | setCaption(mes); | 1927 | setCaption(mes); |
1915 | } | 1928 | } |
1916 | } | 1929 | } |
1917 | void MainWindow::loadCalendar() | 1930 | void MainWindow::loadCalendar() |
1918 | { | 1931 | { |
1919 | 1932 | ||
1920 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1933 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1921 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1934 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1922 | 1935 | ||
1923 | if ( fn == "" ) | 1936 | if ( fn == "" ) |
1924 | return; | 1937 | return; |
1925 | QFileInfo info; | 1938 | QFileInfo info; |
1926 | info.setFile( fn ); | 1939 | info.setFile( fn ); |
1927 | QString mess; | 1940 | QString mess; |
1928 | bool loadbup = true; | 1941 | bool loadbup = true; |
1929 | if ( info. exists() ) { | 1942 | if ( info. exists() ) { |
1930 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1943 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1931 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1944 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1932 | mess, | 1945 | mess, |
1933 | i18n("Load!"), i18n("Cancel"), 0, | 1946 | i18n("Load!"), i18n("Cancel"), 0, |
1934 | 0, 1 ); | 1947 | 0, 1 ); |
1935 | if ( result != 0 ) { | 1948 | if ( result != 0 ) { |
1936 | loadbup = false; | 1949 | loadbup = false; |
1937 | } | 1950 | } |
1938 | } else { | 1951 | } else { |
1939 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1952 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1940 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1953 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1941 | 0, 1 ); | 1954 | 0, 1 ); |
1942 | 1955 | ||
1943 | return; | 1956 | return; |
1944 | } | 1957 | } |
1945 | if ( loadbup ) { | 1958 | if ( loadbup ) { |
1946 | mView->openCalendar( fn ); | 1959 | mView->openCalendar( fn ); |
1947 | KOPrefs::instance()->mLastLoadFile = fn; | 1960 | KOPrefs::instance()->mLastLoadFile = fn; |
1948 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1961 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1949 | setCaption(mess); | 1962 | setCaption(mess); |
1950 | } | 1963 | } |
1951 | 1964 | ||
1952 | } | 1965 | } |
1953 | void MainWindow::quickImportIcal() | 1966 | void MainWindow::quickImportIcal() |
1954 | { | 1967 | { |
1955 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1968 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1956 | } | 1969 | } |
1957 | void MainWindow::importFile( QString fn, bool quick ) | 1970 | void MainWindow::importFile( QString fn, bool quick ) |
1958 | { | 1971 | { |
1959 | QFileInfo info; | 1972 | QFileInfo info; |
1960 | info.setFile( fn ); | 1973 | info.setFile( fn ); |
1961 | QString mess; | 1974 | QString mess; |
1962 | bool loadbup = true; | 1975 | bool loadbup = true; |
1963 | if ( !info. exists() ) { | 1976 | if ( !info. exists() ) { |
1964 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1977 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1965 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1978 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1966 | mess ); | 1979 | mess ); |
1967 | return; | 1980 | return; |
1968 | } | 1981 | } |
1969 | int result = 0; | 1982 | int result = 0; |
1970 | if ( !quick ) { | 1983 | if ( !quick ) { |
1971 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1984 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1972 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1985 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1973 | mess, | 1986 | mess, |
1974 | "Import", "Cancel", 0, | 1987 | "Import", "Cancel", 0, |
1975 | 0, 1 ); | 1988 | 0, 1 ); |
1976 | } | 1989 | } |
1977 | if ( result == 0 ) { | 1990 | if ( result == 0 ) { |
1978 | if ( mView->openCalendar( fn, true )) { | 1991 | if ( mView->openCalendar( fn, true )) { |
1979 | KOPrefs::instance()->mLastImportFile = fn; | 1992 | KOPrefs::instance()->mLastImportFile = fn; |
1980 | setCaption(i18n("Imported file successfully")); | 1993 | setCaption(i18n("Imported file successfully")); |
1981 | } else { | 1994 | } else { |
1982 | setCaption(i18n("Error importing file")); | 1995 | setCaption(i18n("Error importing file")); |
1983 | } | 1996 | } |
1984 | } | 1997 | } |
1985 | } | 1998 | } |
1986 | 1999 | ||
1987 | void MainWindow::importIcal() | 2000 | void MainWindow::importIcal() |
1988 | { | 2001 | { |
1989 | 2002 | ||
1990 | QString fn =KOPrefs::instance()->mLastImportFile; | 2003 | QString fn =KOPrefs::instance()->mLastImportFile; |
1991 | 2004 | ||
1992 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 2005 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1993 | if ( fn == "" ) | 2006 | if ( fn == "" ) |
1994 | return; | 2007 | return; |
1995 | importFile( fn, true ); | 2008 | importFile( fn, true ); |
1996 | 2009 | ||
1997 | } | 2010 | } |
1998 | 2011 | ||
1999 | void MainWindow::exportVCalendar() | 2012 | void MainWindow::exportVCalendar() |
2000 | { | 2013 | { |
2001 | QString fn = KOPrefs::instance()->mLastVcalFile; | 2014 | QString fn = KOPrefs::instance()->mLastVcalFile; |
2002 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 2015 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
2003 | if ( fn == "" ) | 2016 | if ( fn == "" ) |
2004 | return; | 2017 | return; |
2005 | QFileInfo info; | 2018 | QFileInfo info; |
2006 | info.setFile( fn ); | 2019 | info.setFile( fn ); |
2007 | QString mes; | 2020 | QString mes; |
2008 | bool createbup = true; | 2021 | bool createbup = true; |
2009 | if ( info. exists() ) { | 2022 | if ( info. exists() ) { |
2010 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 2023 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
2011 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2024 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2012 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2025 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2013 | 0, 1 ); | 2026 | 0, 1 ); |
2014 | if ( result != 0 ) { | 2027 | if ( result != 0 ) { |
2015 | createbup = false; | 2028 | createbup = false; |
2016 | } | 2029 | } |
2017 | } | 2030 | } |
2018 | if ( createbup ) { | 2031 | if ( createbup ) { |
2019 | if ( mView->exportVCalendar( fn ) ) { | 2032 | if ( mView->exportVCalendar( fn ) ) { |
2020 | KOPrefs::instance()->mLastVcalFile = fn; | 2033 | KOPrefs::instance()->mLastVcalFile = fn; |
2021 | if ( fn.length() > 20 ) | 2034 | if ( fn.length() > 20 ) |
2022 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 2035 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
2023 | else | 2036 | else |
2024 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 2037 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
2025 | setCaption(mes); | 2038 | setCaption(mes); |
2026 | } | 2039 | } |
2027 | } | 2040 | } |
2028 | 2041 | ||
2029 | } | 2042 | } |
2030 | QString MainWindow::sentSyncFile() | 2043 | QString MainWindow::sentSyncFile() |
2031 | { | 2044 | { |
2032 | #ifdef DESKTOP_VERSION | 2045 | #ifdef DESKTOP_VERSION |
2033 | return locateLocal( "tmp", "copysynccal.ics" ); | 2046 | return locateLocal( "tmp", "copysynccal.ics" ); |
2034 | #else | 2047 | #else |
2035 | return QString( "/tmp/copysynccal.ics" ); | 2048 | return QString( "/tmp/copysynccal.ics" ); |
2036 | #endif | 2049 | #endif |
2037 | } | 2050 | } |
2038 | 2051 | ||
2039 | void MainWindow::syncFileRequest() | 2052 | void MainWindow::syncFileRequest() |
2040 | { | 2053 | { |
2041 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2054 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2042 | mSyncManager->slotSyncMenu( 999 ); | 2055 | mSyncManager->slotSyncMenu( 999 ); |
2043 | } | 2056 | } |
2044 | 2057 | ||
2045 | setCaption(i18n("Saving Data to temp file ..." )); | 2058 | setCaption(i18n("Saving Data to temp file ..." )); |
2046 | mView->saveCalendar( sentSyncFile() ); | 2059 | mView->saveCalendar( sentSyncFile() ); |
2047 | setCaption(i18n("Data saved to temp file!" )); | 2060 | setCaption(i18n("Data saved to temp file!" )); |
2048 | 2061 | ||
2049 | } | 2062 | } |
2050 | void MainWindow::getFile( bool success ) | 2063 | void MainWindow::getFile( bool success ) |
2051 | { | 2064 | { |
2052 | if ( ! success ) { | 2065 | if ( ! success ) { |
2053 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2066 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2054 | return; | 2067 | return; |
2055 | } | 2068 | } |
2056 | mView->openCalendar( sentSyncFile() ); | 2069 | mView->openCalendar( sentSyncFile() ); |
2057 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2070 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2058 | mSyncManager->slotSyncMenu( 999 ); | 2071 | mSyncManager->slotSyncMenu( 999 ); |
2059 | } | 2072 | } |
2060 | setCaption( i18n("Pi-Sync successful!") ); | 2073 | setCaption( i18n("Pi-Sync successful!") ); |
2061 | } | 2074 | } |
2062 | 2075 | ||
2063 | void MainWindow::printSel( ) | 2076 | void MainWindow::printSel( ) |
2064 | { | 2077 | { |
2065 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2078 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2066 | } | 2079 | } |
2067 | 2080 | ||
2068 | void MainWindow::printCal() | 2081 | void MainWindow::printCal() |
2069 | { | 2082 | { |
2070 | mView->print();//mCp->showDialog(); | 2083 | mView->print();//mCp->showDialog(); |
2071 | } | 2084 | } |
2072 | 2085 | ||
2073 | 2086 | ||
2074 | #include "libkdepim/kdatepicker.h" | 2087 | #include "libkdepim/kdatepicker.h" |
2075 | #include <kdatetbl.h> | 2088 | #include <kdatetbl.h> |
2076 | void MainWindow::weekAction() | 2089 | void MainWindow::weekAction() |
2077 | { | 2090 | { |
2078 | int month; | 2091 | int month; |
2079 | KPopupFrame* popup = new KPopupFrame(this); | 2092 | KPopupFrame* popup = new KPopupFrame(this); |
2080 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2093 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2081 | // ----- | 2094 | // ----- |
2082 | picker->resize(picker->sizeHint()); | 2095 | picker->resize(picker->sizeHint()); |
2083 | popup->setMainWidget(picker); | 2096 | popup->setMainWidget(picker); |
2084 | picker->setFocus(); | 2097 | picker->setFocus(); |
2085 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2098 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2086 | int x = 0; | 2099 | int x = 0; |
2087 | int y = iconToolBar->height(); | 2100 | int y = iconToolBar->height(); |
2088 | int dX = 0; | 2101 | int dX = 0; |
2089 | int dY = 0; | 2102 | int dY = 0; |
2090 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2103 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2091 | if ( iconToolBar->y() > height()/2 ) { | 2104 | if ( iconToolBar->y() > height()/2 ) { |
2092 | dY = picker->sizeHint().height()+8; | 2105 | dY = picker->sizeHint().height()+8; |
2093 | y = 0; | 2106 | y = 0; |
2094 | } | 2107 | } |
2095 | } else { | 2108 | } else { |
2096 | if ( iconToolBar->x() > width()/2 ) { // right side | 2109 | if ( iconToolBar->x() > width()/2 ) { // right side |
2097 | x=0; | 2110 | x=0; |
2098 | dX= picker->sizeHint().width()+8; | 2111 | dX= picker->sizeHint().width()+8; |
2099 | y = 0; | 2112 | y = 0; |
2100 | } else { | 2113 | } else { |
2101 | x= iconToolBar->width(); | 2114 | x= iconToolBar->width(); |
2102 | y = 0; | 2115 | y = 0; |
2103 | } | 2116 | } |
2104 | } | 2117 | } |
2105 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2118 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2106 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2119 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2107 | { | 2120 | { |
2108 | month = picker->getResult(); | 2121 | month = picker->getResult(); |
2109 | emit selectWeek ( month ); | 2122 | emit selectWeek ( month ); |
2110 | //qDebug("weekSelected %d ", month); | 2123 | //qDebug("weekSelected %d ", month); |
2111 | } | 2124 | } |
2112 | delete popup; | 2125 | delete popup; |
2113 | } | 2126 | } |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 5808700..7604529 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,159 +1,160 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qmenubar.h> | 8 | #include <qmenubar.h> |
9 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
10 | #include <qregexp.h> | 10 | #include <qregexp.h> |
11 | 11 | ||
12 | #include <libkcal/incidence.h> | 12 | #include <libkcal/incidence.h> |
13 | #include "simplealarmclient.h" | 13 | #include "simplealarmclient.h" |
14 | #include <ksyncmanager.h> | 14 | #include <ksyncmanager.h> |
15 | #ifndef DESKTOP_VERSION | 15 | #ifndef DESKTOP_VERSION |
16 | #include <qcopchannel_qws.h> | 16 | #include <qcopchannel_qws.h> |
17 | #endif | 17 | #endif |
18 | class QAction; | 18 | class QAction; |
19 | class CalendarView; | 19 | class CalendarView; |
20 | class KSyncProfile; | 20 | class KSyncProfile; |
21 | #ifdef DESKTOP_VERSION | 21 | #ifdef DESKTOP_VERSION |
22 | 22 | ||
23 | #define QPEToolBar QToolBar | 23 | #define QPEToolBar QToolBar |
24 | #define QPEMenuBar QMenuBar | 24 | #define QPEMenuBar QMenuBar |
25 | #endif | 25 | #endif |
26 | class QPEToolBar; | 26 | class QPEToolBar; |
27 | 27 | ||
28 | 28 | ||
29 | namespace KCal { | 29 | namespace KCal { |
30 | class CalendarLocal; | 30 | class CalendarLocal; |
31 | } | 31 | } |
32 | 32 | ||
33 | class KOMenuBar : public QMenuBar | 33 | class KOMenuBar : public QMenuBar |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} | 36 | KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} |
37 | QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} | 37 | QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} |
38 | }; | 38 | }; |
39 | 39 | ||
40 | using namespace KCal; | 40 | using namespace KCal; |
41 | 41 | ||
42 | class MainWindow : public QMainWindow | 42 | class MainWindow : public QMainWindow |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 46 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
47 | ~MainWindow(); | 47 | ~MainWindow(); |
48 | bool beamReceiveEnabled(); | 48 | bool beamReceiveEnabled(); |
49 | static QString defaultFileName(); | 49 | static QString defaultFileName(); |
50 | static QString syncFileName(); | 50 | static QString syncFileName(); |
51 | static QString resourcePath(); | 51 | static QString resourcePath(); |
52 | public slots: | 52 | public slots: |
53 | void setCaption ( const QString & ); | ||
53 | void updateWeekNum(const KCal::DateList &); | 54 | void updateWeekNum(const KCal::DateList &); |
54 | void updateWeek(QDate); | 55 | void updateWeek(QDate); |
55 | virtual void showMaximized (); | 56 | virtual void showMaximized (); |
56 | void configureAgenda( int ); | 57 | void configureAgenda( int ); |
57 | void recieve( const QCString& msg, const QByteArray& data ); | 58 | void recieve( const QCString& msg, const QByteArray& data ); |
58 | protected slots: | 59 | protected slots: |
59 | void setCaptionToDates(); | 60 | void setCaptionToDates(); |
60 | void weekAction(); | 61 | void weekAction(); |
61 | void about(); | 62 | void about(); |
62 | void licence(); | 63 | void licence(); |
63 | void faq(); | 64 | void faq(); |
64 | void usertrans(); | 65 | void usertrans(); |
65 | void features(); | 66 | void features(); |
66 | void synchowto(); | 67 | void synchowto(); |
67 | void kdesynchowto(); | 68 | void kdesynchowto(); |
68 | void multisynchowto(); | 69 | void multisynchowto(); |
69 | void whatsNew(); | 70 | void whatsNew(); |
70 | void keyBindings(); | 71 | void keyBindings(); |
71 | void aboutAutoSaving();; | 72 | void aboutAutoSaving();; |
72 | void aboutKnownBugs(); | 73 | void aboutKnownBugs(); |
73 | 74 | ||
74 | void processIncidenceSelection( Incidence * ); | 75 | void processIncidenceSelection( Incidence * ); |
75 | 76 | ||
76 | void importQtopia(); | 77 | void importQtopia(); |
77 | void importBday(); | 78 | void importBday(); |
78 | void importOL(); | 79 | void importOL(); |
79 | void importIcal(); | 80 | void importIcal(); |
80 | void importFile( QString, bool ); | 81 | void importFile( QString, bool ); |
81 | void quickImportIcal(); | 82 | void quickImportIcal(); |
82 | 83 | ||
83 | void slotModifiedChanged( bool ); | 84 | void slotModifiedChanged( bool ); |
84 | 85 | ||
85 | void save(); | 86 | void save(); |
86 | void saveStopTimer(); | 87 | void saveStopTimer(); |
87 | void configureToolBar( int ); | 88 | void configureToolBar( int ); |
88 | void printSel(); | 89 | void printSel(); |
89 | void printCal(); | 90 | void printCal(); |
90 | void saveCalendar(); | 91 | void saveCalendar(); |
91 | void loadCalendar(); | 92 | void loadCalendar(); |
92 | void exportVCalendar(); | 93 | void exportVCalendar(); |
93 | void fillFilterMenu(); | 94 | void fillFilterMenu(); |
94 | void selectFilter( int ); | 95 | void selectFilter( int ); |
95 | void exportToPhone( int ); | 96 | void exportToPhone( int ); |
96 | void toggleBeamReceive(); | 97 | void toggleBeamReceive(); |
97 | void disableBR(bool); | 98 | void disableBR(bool); |
98 | signals: | 99 | signals: |
99 | void selectWeek ( int ); | 100 | void selectWeek ( int ); |
100 | private slots: | 101 | private slots: |
101 | void showConfigureAgenda(); | 102 | void showConfigureAgenda(); |
102 | void getFile( bool ); | 103 | void getFile( bool ); |
103 | void syncFileRequest(); | 104 | void syncFileRequest(); |
104 | 105 | ||
105 | protected: | 106 | protected: |
106 | QString sentSyncFile(); | 107 | QString sentSyncFile(); |
107 | void displayText( QString, QString); | 108 | void displayText( QString, QString); |
108 | void enableIncidenceActions( bool ); | 109 | void enableIncidenceActions( bool ); |
109 | 110 | ||
110 | private: | 111 | private: |
111 | bool mBRdisabled; | 112 | bool mBRdisabled; |
112 | #ifndef DESKTOP_VERSION | 113 | #ifndef DESKTOP_VERSION |
113 | QCopChannel* infrared; | 114 | QCopChannel* infrared; |
114 | #endif | 115 | #endif |
115 | QAction* brAction; | 116 | QAction* brAction; |
116 | KSyncManager* mSyncManager; | 117 | KSyncManager* mSyncManager; |
117 | bool mClosed; | 118 | bool mClosed; |
118 | void saveOnClose(); | 119 | void saveOnClose(); |
119 | bool mFlagKeyPressed; | 120 | bool mFlagKeyPressed; |
120 | bool mBlockAtStartup; | 121 | bool mBlockAtStartup; |
121 | QPEToolBar *iconToolBar; | 122 | QPEToolBar *iconToolBar; |
122 | void initActions(); | 123 | void initActions(); |
123 | void setDefaultPreferences(); | 124 | void setDefaultPreferences(); |
124 | void keyPressEvent ( QKeyEvent * ) ; | 125 | void keyPressEvent ( QKeyEvent * ) ; |
125 | void keyReleaseEvent ( QKeyEvent * ) ; | 126 | void keyReleaseEvent ( QKeyEvent * ) ; |
126 | QPopupMenu *configureToolBarMenu; | 127 | QPopupMenu *configureToolBarMenu; |
127 | QPopupMenu *selectFilterMenu; | 128 | QPopupMenu *selectFilterMenu; |
128 | QPopupMenu *configureAgendaMenu, *syncMenu; | 129 | QPopupMenu *configureAgendaMenu, *syncMenu; |
129 | CalendarLocal *mCalendar; | 130 | CalendarLocal *mCalendar; |
130 | CalendarView *mView; | 131 | CalendarView *mView; |
131 | QAction *mNewSubTodoAction; | 132 | QAction *mNewSubTodoAction; |
132 | QAction *mWeekAction; | 133 | QAction *mWeekAction; |
133 | QFont mWeekFont; | 134 | QFont mWeekFont; |
134 | QPixmap mWeekPixmap; | 135 | QPixmap mWeekPixmap; |
135 | QColor mWeekBgColor; | 136 | QColor mWeekBgColor; |
136 | 137 | ||
137 | QAction *mShowAction; | 138 | QAction *mShowAction; |
138 | QAction *mEditAction; | 139 | QAction *mEditAction; |
139 | QAction *mDeleteAction; | 140 | QAction *mDeleteAction; |
140 | QAction *mCloneAction; | 141 | QAction *mCloneAction; |
141 | QAction *mMoveAction; | 142 | QAction *mMoveAction; |
142 | QAction *mBeamAction; | 143 | QAction *mBeamAction; |
143 | QAction *mCancelAction; | 144 | QAction *mCancelAction; |
144 | 145 | ||
145 | QAction *mToggleNav; | 146 | QAction *mToggleNav; |
146 | QAction *mToggleFilter; | 147 | QAction *mToggleFilter; |
147 | QAction *mToggleAllday; | 148 | QAction *mToggleAllday; |
148 | 149 | ||
149 | 150 | ||
150 | void closeEvent( QCloseEvent* ce ); | 151 | void closeEvent( QCloseEvent* ce ); |
151 | SimpleAlarmClient mAlarmClient; | 152 | SimpleAlarmClient mAlarmClient; |
152 | QTimer mSaveTimer; | 153 | QTimer mSaveTimer; |
153 | //bool mBlockSaveFlag; | 154 | //bool mBlockSaveFlag; |
154 | bool mCalendarModifiedFlag; | 155 | bool mCalendarModifiedFlag; |
155 | QPixmap loadPixmap( QString ); | 156 | QPixmap loadPixmap( QString ); |
156 | }; | 157 | }; |
157 | 158 | ||
158 | 159 | ||
159 | #endif | 160 | #endif |