summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp11
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/koeventviewer.cpp29
-rw-r--r--korganizer/koeventviewer.h1
-rw-r--r--korganizer/koeventviewerdialog.cpp14
-rw-r--r--korganizer/koeventviewerdialog.h1
-rw-r--r--korganizer/koviewmanager.cpp7
-rw-r--r--korganizer/koviewmanager.h1
-rw-r--r--korganizer/mainwindow.cpp16
-rw-r--r--korganizer/navigatorbar.cpp15
10 files changed, 86 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index a330414..0015bd6 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3174,513 +3174,522 @@ void CalendarView::action_mail()
3174 KMessageBox::sorry(this, 3174 KMessageBox::sorry(this,
3175 i18n("Can't generate mail:\nNo attendees defined.\n")); 3175 i18n("Can't generate mail:\nNo attendees defined.\n"));
3176 return; 3176 return;
3177 } 3177 }
3178 3178
3179 CalendarLocal cal_tmp; 3179 CalendarLocal cal_tmp;
3180 Event *event = 0; 3180 Event *event = 0;
3181 Event *ev = 0; 3181 Event *ev = 0;
3182 if ( incidence && incidence->type() == "Event" ) { 3182 if ( incidence && incidence->type() == "Event" ) {
3183 event = static_cast<Event *>(incidence); 3183 event = static_cast<Event *>(incidence);
3184 ev = new Event(*event); 3184 ev = new Event(*event);
3185 cal_tmp.addEvent(ev); 3185 cal_tmp.addEvent(ev);
3186 } 3186 }
3187 ICalFormat mForm(); 3187 ICalFormat mForm();
3188 QString attachment = mForm.toString( &cal_tmp ); 3188 QString attachment = mForm.toString( &cal_tmp );
3189 if (ev) delete(ev); 3189 if (ev) delete(ev);
3190 3190
3191 mailClient.mailAttendees(currentSelection(), attachment); 3191 mailClient.mailAttendees(currentSelection(), attachment);
3192 3192
3193#endif 3193#endif
3194 3194
3195#if 0 3195#if 0
3196 Event *anEvent = 0; 3196 Event *anEvent = 0;
3197 if (mViewManager->currentView()->isEventView()) { 3197 if (mViewManager->currentView()->isEventView()) {
3198 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); 3198 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
3199 } 3199 }
3200 3200
3201 if (!anEvent) { 3201 if (!anEvent) {
3202 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3202 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3203 return; 3203 return;
3204 } 3204 }
3205 if(anEvent->attendeeCount() == 0 ) { 3205 if(anEvent->attendeeCount() == 0 ) {
3206 KMessageBox::sorry(this, 3206 KMessageBox::sorry(this,
3207 i18n("Can't generate mail:\nNo attendees defined.\n")); 3207 i18n("Can't generate mail:\nNo attendees defined.\n"));
3208 return; 3208 return;
3209 } 3209 }
3210 3210
3211 mailobject.emailEvent(anEvent); 3211 mailobject.emailEvent(anEvent);
3212#endif 3212#endif
3213} 3213}
3214 3214
3215 3215
3216void CalendarView::schedule_publish(Incidence *incidence) 3216void CalendarView::schedule_publish(Incidence *incidence)
3217{ 3217{
3218 Event *event = 0; 3218 Event *event = 0;
3219 Todo *todo = 0; 3219 Todo *todo = 0;
3220 3220
3221 if (incidence == 0) { 3221 if (incidence == 0) {
3222 incidence = mViewManager->currentView()->selectedIncidences().first(); 3222 incidence = mViewManager->currentView()->selectedIncidences().first();
3223 if (incidence == 0) { 3223 if (incidence == 0) {
3224 incidence = mTodoList->selectedIncidences().first(); 3224 incidence = mTodoList->selectedIncidences().first();
3225 } 3225 }
3226 } 3226 }
3227 if ( incidence && incidence->type() == "Event" ) { 3227 if ( incidence && incidence->type() == "Event" ) {
3228 event = static_cast<Event *>(incidence); 3228 event = static_cast<Event *>(incidence);
3229 } else { 3229 } else {
3230 if ( incidence && incidence->type() == "Todo" ) { 3230 if ( incidence && incidence->type() == "Todo" ) {
3231 todo = static_cast<Todo *>(incidence); 3231 todo = static_cast<Todo *>(incidence);
3232 } 3232 }
3233 } 3233 }
3234 3234
3235 if (!event && !todo) { 3235 if (!event && !todo) {
3236 KMessageBox::sorry(this,i18n("No event selected.")); 3236 KMessageBox::sorry(this,i18n("No event selected."));
3237 return; 3237 return;
3238 } 3238 }
3239 3239
3240 PublishDialog *publishdlg = new PublishDialog(); 3240 PublishDialog *publishdlg = new PublishDialog();
3241 if (incidence->attendeeCount()>0) { 3241 if (incidence->attendeeCount()>0) {
3242 QPtrList<Attendee> attendees = incidence->attendees(); 3242 QPtrList<Attendee> attendees = incidence->attendees();
3243 attendees.first(); 3243 attendees.first();
3244 while ( attendees.current()!=0 ) { 3244 while ( attendees.current()!=0 ) {
3245 publishdlg->addAttendee(attendees.current()); 3245 publishdlg->addAttendee(attendees.current());
3246 attendees.next(); 3246 attendees.next();
3247 } 3247 }
3248 } 3248 }
3249 bool send = true; 3249 bool send = true;
3250 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 3250 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
3251 if ( publishdlg->exec() != QDialog::Accepted ) 3251 if ( publishdlg->exec() != QDialog::Accepted )
3252 send = false; 3252 send = false;
3253 } 3253 }
3254 if ( send ) { 3254 if ( send ) {
3255 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3255 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3256 if ( event ) { 3256 if ( event ) {
3257 Event *ev = new Event(*event); 3257 Event *ev = new Event(*event);
3258 ev->registerObserver(0); 3258 ev->registerObserver(0);
3259 ev->clearAttendees(); 3259 ev->clearAttendees();
3260 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3260 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3261 delete(ev); 3261 delete(ev);
3262 } 3262 }
3263 } else { 3263 } else {
3264 if ( todo ) { 3264 if ( todo ) {
3265 Todo *ev = new Todo(*todo); 3265 Todo *ev = new Todo(*todo);
3266 ev->registerObserver(0); 3266 ev->registerObserver(0);
3267 ev->clearAttendees(); 3267 ev->clearAttendees();
3268 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3268 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3269 delete(ev); 3269 delete(ev);
3270 } 3270 }
3271 } 3271 }
3272 } 3272 }
3273 } 3273 }
3274 delete publishdlg; 3274 delete publishdlg;
3275} 3275}
3276 3276
3277void CalendarView::schedule_request(Incidence *incidence) 3277void CalendarView::schedule_request(Incidence *incidence)
3278{ 3278{
3279 schedule(Scheduler::Request,incidence); 3279 schedule(Scheduler::Request,incidence);
3280} 3280}
3281 3281
3282void CalendarView::schedule_refresh(Incidence *incidence) 3282void CalendarView::schedule_refresh(Incidence *incidence)
3283{ 3283{
3284 schedule(Scheduler::Refresh,incidence); 3284 schedule(Scheduler::Refresh,incidence);
3285} 3285}
3286 3286
3287void CalendarView::schedule_cancel(Incidence *incidence) 3287void CalendarView::schedule_cancel(Incidence *incidence)
3288{ 3288{
3289 schedule(Scheduler::Cancel,incidence); 3289 schedule(Scheduler::Cancel,incidence);
3290} 3290}
3291 3291
3292void CalendarView::schedule_add(Incidence *incidence) 3292void CalendarView::schedule_add(Incidence *incidence)
3293{ 3293{
3294 schedule(Scheduler::Add,incidence); 3294 schedule(Scheduler::Add,incidence);
3295} 3295}
3296 3296
3297void CalendarView::schedule_reply(Incidence *incidence) 3297void CalendarView::schedule_reply(Incidence *incidence)
3298{ 3298{
3299 schedule(Scheduler::Reply,incidence); 3299 schedule(Scheduler::Reply,incidence);
3300} 3300}
3301 3301
3302void CalendarView::schedule_counter(Incidence *incidence) 3302void CalendarView::schedule_counter(Incidence *incidence)
3303{ 3303{
3304 schedule(Scheduler::Counter,incidence); 3304 schedule(Scheduler::Counter,incidence);
3305} 3305}
3306 3306
3307void CalendarView::schedule_declinecounter(Incidence *incidence) 3307void CalendarView::schedule_declinecounter(Incidence *incidence)
3308{ 3308{
3309 schedule(Scheduler::Declinecounter,incidence); 3309 schedule(Scheduler::Declinecounter,incidence);
3310} 3310}
3311 3311
3312void CalendarView::schedule_publish_freebusy(int daysToPublish) 3312void CalendarView::schedule_publish_freebusy(int daysToPublish)
3313{ 3313{
3314 QDateTime start = QDateTime::currentDateTime(); 3314 QDateTime start = QDateTime::currentDateTime();
3315 QDateTime end = start.addDays(daysToPublish); 3315 QDateTime end = start.addDays(daysToPublish);
3316 3316
3317 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 3317 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
3318 freebusy->setOrganizer(KOPrefs::instance()->email()); 3318 freebusy->setOrganizer(KOPrefs::instance()->email());
3319 3319
3320 3320
3321 PublishDialog *publishdlg = new PublishDialog(); 3321 PublishDialog *publishdlg = new PublishDialog();
3322 if ( publishdlg->exec() == QDialog::Accepted ) { 3322 if ( publishdlg->exec() == QDialog::Accepted ) {
3323 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3323 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3324 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 3324 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
3325 delete(freebusy); 3325 delete(freebusy);
3326 } 3326 }
3327 } 3327 }
3328 delete publishdlg; 3328 delete publishdlg;
3329} 3329}
3330 3330
3331void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 3331void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3332{ 3332{
3333 Event *event = 0; 3333 Event *event = 0;
3334 Todo *todo = 0; 3334 Todo *todo = 0;
3335 3335
3336 if (incidence == 0) { 3336 if (incidence == 0) {
3337 incidence = mViewManager->currentView()->selectedIncidences().first(); 3337 incidence = mViewManager->currentView()->selectedIncidences().first();
3338 if (incidence == 0) { 3338 if (incidence == 0) {
3339 incidence = mTodoList->selectedIncidences().first(); 3339 incidence = mTodoList->selectedIncidences().first();
3340 } 3340 }
3341 } 3341 }
3342 if ( incidence && incidence->type() == "Event" ) { 3342 if ( incidence && incidence->type() == "Event" ) {
3343 event = static_cast<Event *>(incidence); 3343 event = static_cast<Event *>(incidence);
3344 } 3344 }
3345 if ( incidence && incidence->type() == "Todo" ) { 3345 if ( incidence && incidence->type() == "Todo" ) {
3346 todo = static_cast<Todo *>(incidence); 3346 todo = static_cast<Todo *>(incidence);
3347 } 3347 }
3348 3348
3349 if (!event && !todo) { 3349 if (!event && !todo) {
3350 KMessageBox::sorry(this,i18n("No event selected.")); 3350 KMessageBox::sorry(this,i18n("No event selected."));
3351 return; 3351 return;
3352 } 3352 }
3353 3353
3354 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 3354 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
3355 KMessageBox::sorry(this,i18n("The event has no attendees.")); 3355 KMessageBox::sorry(this,i18n("The event has no attendees."));
3356 return; 3356 return;
3357 } 3357 }
3358 3358
3359 Event *ev = 0; 3359 Event *ev = 0;
3360 if (event) ev = new Event(*event); 3360 if (event) ev = new Event(*event);
3361 Todo *to = 0; 3361 Todo *to = 0;
3362 if (todo) to = new Todo(*todo); 3362 if (todo) to = new Todo(*todo);
3363 3363
3364 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 3364 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
3365 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 3365 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
3366 if (!me) { 3366 if (!me) {
3367 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 3367 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
3368 return; 3368 return;
3369 } 3369 }
3370 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { 3370 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) {
3371 StatusDialog *statdlg = new StatusDialog(this); 3371 StatusDialog *statdlg = new StatusDialog(this);
3372 if (!statdlg->exec()==QDialog::Accepted) return; 3372 if (!statdlg->exec()==QDialog::Accepted) return;
3373 me->setStatus( statdlg->status() ); 3373 me->setStatus( statdlg->status() );
3374 delete(statdlg); 3374 delete(statdlg);
3375 } 3375 }
3376 Attendee *menew = new Attendee(*me); 3376 Attendee *menew = new Attendee(*me);
3377 if (ev) { 3377 if (ev) {
3378 ev->clearAttendees(); 3378 ev->clearAttendees();
3379 ev->addAttendee(menew,false); 3379 ev->addAttendee(menew,false);
3380 } else { 3380 } else {
3381 if (to) { 3381 if (to) {
3382 todo->clearAttendees(); 3382 todo->clearAttendees();
3383 todo->addAttendee(menew,false); 3383 todo->addAttendee(menew,false);
3384 } 3384 }
3385 } 3385 }
3386 } 3386 }
3387 3387
3388 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3388 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3389 if (ev) { 3389 if (ev) {
3390 if ( !dlg->addMessage(ev,method) ) delete(ev); 3390 if ( !dlg->addMessage(ev,method) ) delete(ev);
3391 } else { 3391 } else {
3392 if (to) { 3392 if (to) {
3393 if ( !dlg->addMessage(to,method) ) delete(to); 3393 if ( !dlg->addMessage(to,method) ) delete(to);
3394 } 3394 }
3395 } 3395 }
3396} 3396}
3397 3397
3398void CalendarView::openAddressbook() 3398void CalendarView::openAddressbook()
3399{ 3399{
3400 KRun::runCommand("kaddressbook"); 3400 KRun::runCommand("kaddressbook");
3401} 3401}
3402 3402
3403void CalendarView::setModified(bool modified) 3403void CalendarView::setModified(bool modified)
3404{ 3404{
3405 if ( modified ) 3405 if ( modified )
3406 emit signalmodified(); 3406 emit signalmodified();
3407 if (mModified != modified) { 3407 if (mModified != modified) {
3408 mModified = modified; 3408 mModified = modified;
3409 emit modifiedChanged(mModified); 3409 emit modifiedChanged(mModified);
3410 } 3410 }
3411} 3411}
3412 3412
3413bool CalendarView::isReadOnly() 3413bool CalendarView::isReadOnly()
3414{ 3414{
3415 return mReadOnly; 3415 return mReadOnly;
3416} 3416}
3417 3417
3418void CalendarView::setReadOnly(bool readOnly) 3418void CalendarView::setReadOnly(bool readOnly)
3419{ 3419{
3420 if (mReadOnly != readOnly) { 3420 if (mReadOnly != readOnly) {
3421 mReadOnly = readOnly; 3421 mReadOnly = readOnly;
3422 emit readOnlyChanged(mReadOnly); 3422 emit readOnlyChanged(mReadOnly);
3423 } 3423 }
3424} 3424}
3425 3425
3426bool CalendarView::isModified() 3426bool CalendarView::isModified()
3427{ 3427{
3428 return mModified; 3428 return mModified;
3429} 3429}
3430 3430void CalendarView::slotprintSelInc()
3431{
3432 if ( currentSelection() == 0 ) {
3433 KMessageBox::sorry(this,i18n("There is nothing selected!"));
3434 return;
3435 }
3436 showIncidence();
3437 getEventViewerDialog()->print();
3438
3439}
3431void CalendarView::printSetup() 3440void CalendarView::printSetup()
3432{ 3441{
3433#ifndef KORG_NOPRINTER 3442#ifndef KORG_NOPRINTER
3434 createPrinter(); 3443 createPrinter();
3435 3444
3436 mCalPrinter->setupPrinter(); 3445 mCalPrinter->setupPrinter();
3437#endif 3446#endif
3438} 3447}
3439 3448
3440void CalendarView::print() 3449void CalendarView::print()
3441{ 3450{
3442#ifndef KORG_NOPRINTER 3451#ifndef KORG_NOPRINTER
3443 createPrinter(); 3452 createPrinter();
3444 3453
3445 DateList tmpDateList = mNavigator->selectedDates(); 3454 DateList tmpDateList = mNavigator->selectedDates();
3446 mCalPrinter->print(CalPrinter::Month, 3455 mCalPrinter->print(CalPrinter::Month,
3447 tmpDateList.first(), tmpDateList.last()); 3456 tmpDateList.first(), tmpDateList.last());
3448#endif 3457#endif
3449} 3458}
3450 3459
3451void CalendarView::printPreview() 3460void CalendarView::printPreview()
3452{ 3461{
3453#ifndef KORG_NOPRINTER 3462#ifndef KORG_NOPRINTER
3454 kdDebug() << "CalendarView::printPreview()" << endl; 3463 kdDebug() << "CalendarView::printPreview()" << endl;
3455 3464
3456 createPrinter(); 3465 createPrinter();
3457 3466
3458 DateList tmpDateList = mNavigator->selectedDates(); 3467 DateList tmpDateList = mNavigator->selectedDates();
3459 3468
3460 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3469 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3461 tmpDateList.last()); 3470 tmpDateList.last());
3462#endif 3471#endif
3463} 3472}
3464 3473
3465void CalendarView::exportICalendar() 3474void CalendarView::exportICalendar()
3466{ 3475{
3467 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3476 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3468 3477
3469 // Force correct extension 3478 // Force correct extension
3470 if (filename.right(4) != ".ics") filename += ".ics"; 3479 if (filename.right(4) != ".ics") filename += ".ics";
3471 3480
3472 FileStorage storage( mCalendar, filename, new ICalFormat() ); 3481 FileStorage storage( mCalendar, filename, new ICalFormat() );
3473 storage.save(); 3482 storage.save();
3474} 3483}
3475 3484
3476bool CalendarView::exportVCalendar( QString filename ) 3485bool CalendarView::exportVCalendar( QString filename )
3477{ 3486{
3478 if (mCalendar->journals().count() > 0) { 3487 if (mCalendar->journals().count() > 0) {
3479 int result = KMessageBox::warningContinueCancel(this, 3488 int result = KMessageBox::warningContinueCancel(this,
3480 i18n("The journal entries can not be\nexported to a vCalendar file."), 3489 i18n("The journal entries can not be\nexported to a vCalendar file."),
3481 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3490 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3482 true); 3491 true);
3483 if (result != KMessageBox::Continue) return false; 3492 if (result != KMessageBox::Continue) return false;
3484 } 3493 }
3485 3494
3486 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3495 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3487 3496
3488 // Force correct extension 3497 // Force correct extension
3489 if (filename.right(4) != ".vcs") filename += ".vcs"; 3498 if (filename.right(4) != ".vcs") filename += ".vcs";
3490 3499
3491 FileStorage storage( mCalendar, filename, new VCalFormat ); 3500 FileStorage storage( mCalendar, filename, new VCalFormat );
3492 return storage.save(); 3501 return storage.save();
3493 3502
3494} 3503}
3495 3504
3496void CalendarView::eventUpdated(Incidence *) 3505void CalendarView::eventUpdated(Incidence *)
3497{ 3506{
3498 setModified(); 3507 setModified();
3499 // Don't call updateView here. The code, which has caused the update of the 3508 // Don't call updateView here. The code, which has caused the update of the
3500 // event is responsible for updating the view. 3509 // event is responsible for updating the view.
3501 // updateView(); 3510 // updateView();
3502} 3511}
3503 3512
3504void CalendarView::adaptNavigationUnits() 3513void CalendarView::adaptNavigationUnits()
3505{ 3514{
3506 if (mViewManager->currentView()->isEventView()) { 3515 if (mViewManager->currentView()->isEventView()) {
3507 int days = mViewManager->currentView()->currentDateCount(); 3516 int days = mViewManager->currentView()->currentDateCount();
3508 if (days == 1) { 3517 if (days == 1) {
3509 emit changeNavStringPrev(i18n("&Previous Day")); 3518 emit changeNavStringPrev(i18n("&Previous Day"));
3510 emit changeNavStringNext(i18n("&Next Day")); 3519 emit changeNavStringNext(i18n("&Next Day"));
3511 } else { 3520 } else {
3512 emit changeNavStringPrev(i18n("&Previous Week")); 3521 emit changeNavStringPrev(i18n("&Previous Week"));
3513 emit changeNavStringNext(i18n("&Next Week")); 3522 emit changeNavStringNext(i18n("&Next Week"));
3514 } 3523 }
3515 } 3524 }
3516} 3525}
3517 3526
3518void CalendarView::processMainViewSelection( Incidence *incidence ) 3527void CalendarView::processMainViewSelection( Incidence *incidence )
3519{ 3528{
3520 if ( incidence ) mTodoList->clearSelection(); 3529 if ( incidence ) mTodoList->clearSelection();
3521 processIncidenceSelection( incidence ); 3530 processIncidenceSelection( incidence );
3522} 3531}
3523 3532
3524void CalendarView::processTodoListSelection( Incidence *incidence ) 3533void CalendarView::processTodoListSelection( Incidence *incidence )
3525{ 3534{
3526 if ( incidence && mViewManager->currentView() ) { 3535 if ( incidence && mViewManager->currentView() ) {
3527 mViewManager->currentView()->clearSelection(); 3536 mViewManager->currentView()->clearSelection();
3528 } 3537 }
3529 processIncidenceSelection( incidence ); 3538 processIncidenceSelection( incidence );
3530} 3539}
3531 3540
3532void CalendarView::processIncidenceSelection( Incidence *incidence ) 3541void CalendarView::processIncidenceSelection( Incidence *incidence )
3533{ 3542{
3534 if ( incidence == mSelectedIncidence ) return; 3543 if ( incidence == mSelectedIncidence ) return;
3535 3544
3536 mSelectedIncidence = incidence; 3545 mSelectedIncidence = incidence;
3537 3546
3538 emit incidenceSelected( mSelectedIncidence ); 3547 emit incidenceSelected( mSelectedIncidence );
3539 3548
3540 if ( incidence && incidence->type() == "Event" ) { 3549 if ( incidence && incidence->type() == "Event" ) {
3541 Event *event = static_cast<Event *>( incidence ); 3550 Event *event = static_cast<Event *>( incidence );
3542 if ( event->organizer() == KOPrefs::instance()->email() ) { 3551 if ( event->organizer() == KOPrefs::instance()->email() ) {
3543 emit organizerEventsSelected( true ); 3552 emit organizerEventsSelected( true );
3544 } else { 3553 } else {
3545 emit organizerEventsSelected(false); 3554 emit organizerEventsSelected(false);
3546 } 3555 }
3547 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3556 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3548 KOPrefs::instance()->email() ) ) { 3557 KOPrefs::instance()->email() ) ) {
3549 emit groupEventsSelected( true ); 3558 emit groupEventsSelected( true );
3550 } else { 3559 } else {
3551 emit groupEventsSelected(false); 3560 emit groupEventsSelected(false);
3552 } 3561 }
3553 return; 3562 return;
3554 } else { 3563 } else {
3555 if ( incidence && incidence->type() == "Todo" ) { 3564 if ( incidence && incidence->type() == "Todo" ) {
3556 emit todoSelected( true ); 3565 emit todoSelected( true );
3557 Todo *event = static_cast<Todo *>( incidence ); 3566 Todo *event = static_cast<Todo *>( incidence );
3558 if ( event->organizer() == KOPrefs::instance()->email() ) { 3567 if ( event->organizer() == KOPrefs::instance()->email() ) {
3559 emit organizerEventsSelected( true ); 3568 emit organizerEventsSelected( true );
3560 } else { 3569 } else {
3561 emit organizerEventsSelected(false); 3570 emit organizerEventsSelected(false);
3562 } 3571 }
3563 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3572 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3564 KOPrefs::instance()->email() ) ) { 3573 KOPrefs::instance()->email() ) ) {
3565 emit groupEventsSelected( true ); 3574 emit groupEventsSelected( true );
3566 } else { 3575 } else {
3567 emit groupEventsSelected(false); 3576 emit groupEventsSelected(false);
3568 } 3577 }
3569 return; 3578 return;
3570 } else { 3579 } else {
3571 emit todoSelected( false ); 3580 emit todoSelected( false );
3572 emit organizerEventsSelected(false); 3581 emit organizerEventsSelected(false);
3573 emit groupEventsSelected(false); 3582 emit groupEventsSelected(false);
3574 } 3583 }
3575 return; 3584 return;
3576 } 3585 }
3577 3586
3578 /* if ( incidence && incidence->type() == "Todo" ) { 3587 /* if ( incidence && incidence->type() == "Todo" ) {
3579 emit todoSelected( true ); 3588 emit todoSelected( true );
3580 } else { 3589 } else {
3581 emit todoSelected( false ); 3590 emit todoSelected( false );
3582 }*/ 3591 }*/
3583} 3592}
3584 3593
3585 3594
3586void CalendarView::checkClipboard() 3595void CalendarView::checkClipboard()
3587{ 3596{
3588#ifndef KORG_NODND 3597#ifndef KORG_NODND
3589 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3598 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3590 emit pasteEnabled(true); 3599 emit pasteEnabled(true);
3591 } else { 3600 } else {
3592 emit pasteEnabled(false); 3601 emit pasteEnabled(false);
3593 } 3602 }
3594#endif 3603#endif
3595} 3604}
3596 3605
3597void CalendarView::showDates(const DateList &selectedDates) 3606void CalendarView::showDates(const DateList &selectedDates)
3598{ 3607{
3599 // kdDebug() << "CalendarView::selectDates()" << endl; 3608 // kdDebug() << "CalendarView::selectDates()" << endl;
3600 3609
3601 3610
3602 if ( !mBlockShowDates ) { 3611 if ( !mBlockShowDates ) {
3603 if ( mViewManager->currentView() ) { 3612 if ( mViewManager->currentView() ) {
3604 updateView( selectedDates.first(), selectedDates.last() ); 3613 updateView( selectedDates.first(), selectedDates.last() );
3605 } else { 3614 } else {
3606 mViewManager->showAgendaView(); 3615 mViewManager->showAgendaView();
3607 } 3616 }
3608 } 3617 }
3609 3618
3610 QDate date = selectedDates.first(); 3619 QDate date = selectedDates.first();
3611 if ( ! date.isValid() ) { 3620 if ( ! date.isValid() ) {
3612 topLevelWidget()->setCaption(""); 3621 topLevelWidget()->setCaption("");
3613 return; 3622 return;
3614 } 3623 }
3615 3624
3616 QString selDates; 3625 QString selDates;
3617 selDates = KGlobal::locale()->formatDate( date, true); 3626 selDates = KGlobal::locale()->formatDate( date, true);
3618 if (selectedDates.first() < selectedDates.last() ) 3627 if (selectedDates.first() < selectedDates.last() )
3619 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3628 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3620 else { 3629 else {
3621 QString addString; 3630 QString addString;
3622 if ( date == QDateTime::currentDateTime().date() ) 3631 if ( date == QDateTime::currentDateTime().date() )
3623 addString = i18n("Today"); 3632 addString = i18n("Today");
3624 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 3633 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
3625 addString = i18n("Tomorrow"); 3634 addString = i18n("Tomorrow");
3626 else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) 3635 else if ( date == QDateTime::currentDateTime().date().addDays(-1) )
3627 addString = i18n("Yesterday"); 3636 addString = i18n("Yesterday");
3628 else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) 3637 else if ( date == QDateTime::currentDateTime().date().addDays(-2) )
3629 addString = i18n("Day before yesterday"); 3638 addString = i18n("Day before yesterday");
3630 else if ( date == QDateTime::currentDateTime().date().addDays(2) ) 3639 else if ( date == QDateTime::currentDateTime().date().addDays(2) )
3631 addString = i18n("Day after tomorrow"); 3640 addString = i18n("Day after tomorrow");
3632 if ( !addString.isEmpty() ) { 3641 if ( !addString.isEmpty() ) {
3633 topLevelWidget()->setCaption( addString+", " + selDates ); 3642 topLevelWidget()->setCaption( addString+", " + selDates );
3634 return; 3643 return;
3635 } 3644 }
3636 } 3645 }
3637 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3646 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3638 3647
3639} 3648}
3640 3649
3641QPtrList<CalFilter> CalendarView::filters() 3650QPtrList<CalFilter> CalendarView::filters()
3642{ 3651{
3643 return mFilters; 3652 return mFilters;
3644 3653
3645} 3654}
3646void CalendarView::editFilters() 3655void CalendarView::editFilters()
3647{ 3656{
3648 // kdDebug() << "CalendarView::editFilters()" << endl; 3657 // kdDebug() << "CalendarView::editFilters()" << endl;
3649 3658
3650 CalFilter *filter = mFilters.first(); 3659 CalFilter *filter = mFilters.first();
3651 while(filter) { 3660 while(filter) {
3652 kdDebug() << " Filter: " << filter->name() << endl; 3661 kdDebug() << " Filter: " << filter->name() << endl;
3653 filter = mFilters.next(); 3662 filter = mFilters.next();
3654 } 3663 }
3655 3664
3656 mDialogManager->showFilterEditDialog(&mFilters); 3665 mDialogManager->showFilterEditDialog(&mFilters);
3657} 3666}
3658void CalendarView::toggleFilter() 3667void CalendarView::toggleFilter()
3659{ 3668{
3660 showFilter(! mFilterView->isVisible()); 3669 showFilter(! mFilterView->isVisible());
3661} 3670}
3662 3671
3663KOFilterView *CalendarView::filterView() 3672KOFilterView *CalendarView::filterView()
3664{ 3673{
3665 return mFilterView; 3674 return mFilterView;
3666} 3675}
3667void CalendarView::selectFilter( int fil ) 3676void CalendarView::selectFilter( int fil )
3668{ 3677{
3669 mFilterView->setSelectedFilter( fil ); 3678 mFilterView->setSelectedFilter( fil );
3670} 3679}
3671void CalendarView::showFilter(bool visible) 3680void CalendarView::showFilter(bool visible)
3672{ 3681{
3673 if (visible) mFilterView->show(); 3682 if (visible) mFilterView->show();
3674 else mFilterView->hide(); 3683 else mFilterView->hide();
3675} 3684}
3676void CalendarView::toggleFilerEnabled( ) 3685void CalendarView::toggleFilerEnabled( )
3677{ 3686{
3678 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 3687 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
3679 if ( !mFilterView->filtersEnabled() ) 3688 if ( !mFilterView->filtersEnabled() )
3680 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 3689 topLevelWidget()->setCaption( i18n("Filter disabled ") );
3681 3690
3682} 3691}
3683void CalendarView::updateFilter() 3692void CalendarView::updateFilter()
3684{ 3693{
3685 CalFilter *filter = mFilterView->selectedFilter(); 3694 CalFilter *filter = mFilterView->selectedFilter();
3686 if (filter) { 3695 if (filter) {
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 9782ffe..05a34b4 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,434 +1,435 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 3 Copyright (c) 2000, 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/scheduler.h> 39#include <libkcal/scheduler.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42#include <KDGanttMinimizeSplitter.h> 42#include <KDGanttMinimizeSplitter.h>
43 43
44#include <korganizer/calendarviewbase.h> 44#include <korganizer/calendarviewbase.h>
45 45
46#include <ksyncmanager.h> 46#include <ksyncmanager.h>
47 47
48class QWidgetStack; 48class QWidgetStack;
49class QSplitter; 49class QSplitter;
50 50
51class CalPrinter; 51class CalPrinter;
52class KOFilterView; 52class KOFilterView;
53class KOViewManager; 53class KOViewManager;
54class KODialogManager; 54class KODialogManager;
55class KOTodoView; 55class KOTodoView;
56class KDateNavigator; 56class KDateNavigator;
57class DateNavigatorContainer; 57class DateNavigatorContainer;
58class DateNavigator; 58class DateNavigator;
59class KOIncidenceEditor; 59class KOIncidenceEditor;
60class KDatePicker; 60class KDatePicker;
61class ResourceView; 61class ResourceView;
62class KOEventEditor; 62class KOEventEditor;
63class KOTodoEditor ; 63class KOTodoEditor ;
64class KOEventViewerDialog; 64class KOEventViewerDialog;
65class KOBeamPrefs; 65class KOBeamPrefs;
66class KSyncProfile; 66class KSyncProfile;
67class AlarmDialog; 67class AlarmDialog;
68class KCal::Attendee; 68class KCal::Attendee;
69 69
70namespace KCal { class FileStorage; } 70namespace KCal { class FileStorage; }
71 71
72using namespace KCal; 72using namespace KCal;
73 73
74/** 74/**
75 This is the main calendar widget. It provides the different vies on t he 75 This is the main calendar widget. It provides the different vies on t he
76 calendar data as well as the date navigator. It also handles synchronisation 76 calendar data as well as the date navigator. It also handles synchronisation
77 of the different views and controls the different dialogs like preferences, 77 of the different views and controls the different dialogs like preferences,
78 event editor, search dialog etc. 78 event editor, search dialog etc.
79 79
80 @short main calendar view widget 80 @short main calendar view widget
81 @author Cornelius Schumacher 81 @author Cornelius Schumacher
82*/ 82*/
83class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 83class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
84{ 84{
85 Q_OBJECT 85 Q_OBJECT
86 public: 86 public:
87 /** 87 /**
88 Constructs a new calendar view widget. 88 Constructs a new calendar view widget.
89 89
90 @param calendar calendar document 90 @param calendar calendar document
91 @param parent parent window 91 @param parent parent window
92 @param name Qt internal widget object name 92 @param name Qt internal widget object name
93 */ 93 */
94 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 94 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
95 const char *name = 0 ); 95 const char *name = 0 );
96 CalendarView( Calendar *calendar, QWidget *parent = 0, 96 CalendarView( Calendar *calendar, QWidget *parent = 0,
97 const char *name = 0 ); 97 const char *name = 0 );
98 virtual ~CalendarView(); 98 virtual ~CalendarView();
99 99
100 Calendar *calendar() { return mCalendar; } 100 Calendar *calendar() { return mCalendar; }
101 101
102 KOViewManager *viewManager(); 102 KOViewManager *viewManager();
103 KODialogManager *dialogManager(); 103 KODialogManager *dialogManager();
104 104
105 QDate startDate(); 105 QDate startDate();
106 QDate endDate(); 106 QDate endDate();
107 107
108 QWidgetStack *viewStack(); 108 QWidgetStack *viewStack();
109 QWidget *leftFrame(); 109 QWidget *leftFrame();
110 110
111 DateNavigator *dateNavigator(); 111 DateNavigator *dateNavigator();
112 KDateNavigator *dateNavigatorWidget(); 112 KDateNavigator *dateNavigatorWidget();
113 113
114 void addView(KOrg::BaseView *); 114 void addView(KOrg::BaseView *);
115 void showView(KOrg::BaseView *); 115 void showView(KOrg::BaseView *);
116 KOEventViewerDialog* getEventViewerDialog(); 116 KOEventViewerDialog* getEventViewerDialog();
117 Incidence *currentSelection(); 117 Incidence *currentSelection();
118 118
119 signals: 119 signals:
120 void save (); 120 void save ();
121 void saveStopTimer (); 121 void saveStopTimer ();
122 void tempDisableBR(bool); 122 void tempDisableBR(bool);
123 /** This todo has been modified */ 123 /** This todo has been modified */
124 void todoModified(Todo *, int); 124 void todoModified(Todo *, int);
125 125
126 /** when change is made to options dialog, the topwidget will catch this 126 /** when change is made to options dialog, the topwidget will catch this
127 * and emit this signal which notifies all widgets which have registered 127 * and emit this signal which notifies all widgets which have registered
128 * for notification to update their settings. */ 128 * for notification to update their settings. */
129 void configChanged(); 129 void configChanged();
130 /** emitted when the topwidget is closing down, so that any attached 130 /** emitted when the topwidget is closing down, so that any attached
131 child windows can also close. */ 131 child windows can also close. */
132 void closingDown(); 132 void closingDown();
133 /** emitted right before we die */ 133 /** emitted right before we die */
134 void closed(QWidget *); 134 void closed(QWidget *);
135 135
136 /** Emitted when state of modified flag changes */ 136 /** Emitted when state of modified flag changes */
137 void modifiedChanged(bool); 137 void modifiedChanged(bool);
138 void signalmodified(); 138 void signalmodified();
139 139
140 /** Emitted when state of read-only flag changes */ 140 /** Emitted when state of read-only flag changes */
141 void readOnlyChanged(bool); 141 void readOnlyChanged(bool);
142 142
143 /** Emitted when the unit of navigation changes */ 143 /** Emitted when the unit of navigation changes */
144 void changeNavStringPrev(const QString &); 144 void changeNavStringPrev(const QString &);
145 void changeNavStringNext(const QString &); 145 void changeNavStringNext(const QString &);
146 146
147 /** Emitted when state of events selection has changed and user is organizer*/ 147 /** Emitted when state of events selection has changed and user is organizer*/
148 void organizerEventsSelected(bool); 148 void organizerEventsSelected(bool);
149 /** Emitted when state of events selection has changed and user is attendee*/ 149 /** Emitted when state of events selection has changed and user is attendee*/
150 void groupEventsSelected(bool); 150 void groupEventsSelected(bool);
151 /** 151 /**
152 Emitted when an incidence gets selected. If the selection is cleared the 152 Emitted when an incidence gets selected. If the selection is cleared the
153 signal is emitted with 0 as argument. 153 signal is emitted with 0 as argument.
154 */ 154 */
155 void incidenceSelected( Incidence * ); 155 void incidenceSelected( Incidence * );
156 /** Emitted, when a todoitem is selected or deselected. */ 156 /** Emitted, when a todoitem is selected or deselected. */
157 void todoSelected( bool ); 157 void todoSelected( bool );
158 158
159 /** 159 /**
160 Emitted, when clipboard content changes. Parameter indicates if paste 160 Emitted, when clipboard content changes. Parameter indicates if paste
161 is possible or not. 161 is possible or not.
162 */ 162 */
163 void pasteEnabled(bool); 163 void pasteEnabled(bool);
164 164
165 /** Emitted, when the number of incoming messages has changed. */ 165 /** Emitted, when the number of incoming messages has changed. */
166 void numIncomingChanged(int); 166 void numIncomingChanged(int);
167 167
168 /** Emitted, when the number of outgoing messages has changed. */ 168 /** Emitted, when the number of outgoing messages has changed. */
169 void numOutgoingChanged(int); 169 void numOutgoingChanged(int);
170 170
171 /** Send status message, which can e.g. be displayed in the status bar. */ 171 /** Send status message, which can e.g. be displayed in the status bar. */
172 void statusMessage(const QString &); 172 void statusMessage(const QString &);
173 173
174 void calendarViewExpanded( bool ); 174 void calendarViewExpanded( bool );
175 void updateSearchDialog(); 175 void updateSearchDialog();
176 176
177 177
178 public slots: 178 public slots:
179 void slotprintSelInc();
179 void showNextAlarms(); 180 void showNextAlarms();
180 void showOpenError(); 181 void showOpenError();
181 void watchSavedFile(); 182 void watchSavedFile();
182 void recheckTimerAlarm(); 183 void recheckTimerAlarm();
183 void checkNextTimerAlarm(); 184 void checkNextTimerAlarm();
184 void addAlarm(const QDateTime &qdt, const QString &noti ); 185 void addAlarm(const QDateTime &qdt, const QString &noti );
185 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 186 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
186 void removeAlarm(const QDateTime &qdt, const QString &noti ); 187 void removeAlarm(const QDateTime &qdt, const QString &noti );
187 188
188 /** options dialog made a changed to the configuration. we catch this 189 /** options dialog made a changed to the configuration. we catch this
189 * and notify all widgets which need to update their configuration. */ 190 * and notify all widgets which need to update their configuration. */
190 void updateConfig(); 191 void updateConfig();
191 192
192 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 193 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
193 const QStringList& anniversaryList, const QStringList& realNameList, 194 const QStringList& anniversaryList, const QStringList& realNameList,
194 const QStringList& emailList, const QStringList& assembledNameList, 195 const QStringList& emailList, const QStringList& assembledNameList,
195 const QStringList& uidList); 196 const QStringList& uidList);
196 197
197 /** 198 /**
198 Load calendar from file \a filename. If \a merge is true, load 199 Load calendar from file \a filename. If \a merge is true, load
199 calendar into existing one, if it is false, clear calendar, before 200 calendar into existing one, if it is false, clear calendar, before
200 loading. Return true, if calendar could be successfully loaded. 201 loading. Return true, if calendar could be successfully loaded.
201 */ 202 */
202 bool openCalendar(QString filename, bool merge=false); 203 bool openCalendar(QString filename, bool merge=false);
203 bool syncCalendar(QString filename,int mode = 0 ); 204 bool syncCalendar(QString filename,int mode = 0 );
204 205
205 /** 206 /**
206 Save calendar data to file. Return true if calendar could be 207 Save calendar data to file. Return true if calendar could be
207 successfully saved. 208 successfully saved.
208 */ 209 */
209 bool saveCalendar(QString filename); 210 bool saveCalendar(QString filename);
210 211
211 /** 212 /**
212 Close calendar. Clear calendar data and reset views to display an empty 213 Close calendar. Clear calendar data and reset views to display an empty
213 calendar. 214 calendar.
214 */ 215 */
215 void closeCalendar(); 216 void closeCalendar();
216 217
217 /** Archive old events of calendar */ 218 /** Archive old events of calendar */
218 void archiveCalendar(); 219 void archiveCalendar();
219 220
220 void showIncidence(); 221 void showIncidence();
221 void editIncidence(); 222 void editIncidence();
222 void editIncidenceDescription(); 223 void editIncidenceDescription();
223 void deleteIncidence(); 224 void deleteIncidence();
224 void cloneIncidence(); 225 void cloneIncidence();
225 void moveIncidence(); 226 void moveIncidence();
226 void beamIncidence(); 227 void beamIncidence();
227 void toggleCancelIncidence(); 228 void toggleCancelIncidence();
228 229
229 /** create an editeventwin with supplied date/time, and if bool is true, 230 /** create an editeventwin with supplied date/time, and if bool is true,
230 * make the event take all day. */ 231 * make the event take all day. */
231 void newEvent(QDateTime, QDateTime, bool allDay ); 232 void newEvent(QDateTime, QDateTime, bool allDay );
232 void newEvent(QDateTime, QDateTime); 233 void newEvent(QDateTime, QDateTime);
233 void newEvent(QDateTime fh); 234 void newEvent(QDateTime fh);
234 void newEvent(QDate dt); 235 void newEvent(QDate dt);
235 /** create new event without having a date hint. Takes current date as 236 /** create new event without having a date hint. Takes current date as
236 default hint. */ 237 default hint. */
237 void newEvent(); 238 void newEvent();
238 void newFloatingEvent(); 239 void newFloatingEvent();
239 240
240 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 241 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
241 void showIncidence(Incidence *); 242 void showIncidence(Incidence *);
242 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 243 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
243 void editIncidence(Incidence *); 244 void editIncidence(Incidence *);
244 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 245 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
245 void deleteIncidence(Incidence *); 246 void deleteIncidence(Incidence *);
246 void cloneIncidence(Incidence *); 247 void cloneIncidence(Incidence *);
247 void cancelIncidence(Incidence *); 248 void cancelIncidence(Incidence *);
248 /** Create an editor for the supplied event. */ 249 /** Create an editor for the supplied event. */
249 void editEvent(Event *); 250 void editEvent(Event *);
250 /** Delete the supplied event. */ 251 /** Delete the supplied event. */
251 void deleteEvent(Event *); 252 void deleteEvent(Event *);
252 /** Delete the event with the given unique ID. Returns false, if event wasn't 253 /** Delete the event with the given unique ID. Returns false, if event wasn't
253 found. */ 254 found. */
254 bool deleteEvent(const QString &uid); 255 bool deleteEvent(const QString &uid);
255 /** Create a read-only viewer dialog for the supplied event. */ 256 /** Create a read-only viewer dialog for the supplied event. */
256 void showEvent(Event *); 257 void showEvent(Event *);
257 258
258 void editJournal(Journal *); 259 void editJournal(Journal *);
259 void showJournal(Journal *); 260 void showJournal(Journal *);
260 void deleteJournal(Journal *); 261 void deleteJournal(Journal *);
261 /** Create an editor dialog for a todo */ 262 /** Create an editor dialog for a todo */
262 void editTodo(Todo *); 263 void editTodo(Todo *);
263 /** Create a read-only viewer dialog for the supplied todo */ 264 /** Create a read-only viewer dialog for the supplied todo */
264 void showTodo(Todo *); 265 void showTodo(Todo *);
265 /** create new todo */ 266 /** create new todo */
266 void newTodo(); 267 void newTodo();
267 void newTodoDateTime(QDateTime, bool allday); 268 void newTodoDateTime(QDateTime, bool allday);
268 /** create new todo with a parent todo */ 269 /** create new todo with a parent todo */
269 void newSubTodo(); 270 void newSubTodo();
270 /** create new todo with a parent todo */ 271 /** create new todo with a parent todo */
271 void newSubTodo(Todo *); 272 void newSubTodo(Todo *);
272 /** Delete todo */ 273 /** Delete todo */
273 void deleteTodo(Todo *); 274 void deleteTodo(Todo *);
274 275
275 276
276 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 277 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
277 * emitted as result. */ 278 * emitted as result. */
278 void checkClipboard(); 279 void checkClipboard();
279 280
280 /** using the KConfig associated with the kapp variable, read in the 281 /** using the KConfig associated with the kapp variable, read in the
281 * settings from the config file. 282 * settings from the config file.
282 */ 283 */
283 void readSettings(); 284 void readSettings();
284 285
285 /** write current state to config file. */ 286 /** write current state to config file. */
286 void writeSettings(); 287 void writeSettings();
287 288
288 /** read settings for calendar filters */ 289 /** read settings for calendar filters */
289 void readFilterSettings(KConfig *config); 290 void readFilterSettings(KConfig *config);
290 291
291 /** write settings for calendar filters */ 292 /** write settings for calendar filters */
292 void writeFilterSettings(KConfig *config); 293 void writeFilterSettings(KConfig *config);
293 294
294 /** passes on the message that an event has changed to the currently 295 /** passes on the message that an event has changed to the currently
295 * activated view so that it can make appropriate display changes. */ 296 * activated view so that it can make appropriate display changes. */
296 void changeEventDisplay(Event *, int); 297 void changeEventDisplay(Event *, int);
297 void changeIncidenceDisplay(Incidence *, int); 298 void changeIncidenceDisplay(Incidence *, int);
298 void changeTodoDisplay(Todo *, int); 299 void changeTodoDisplay(Todo *, int);
299 300
300 void eventAdded(Event *); 301 void eventAdded(Event *);
301 void eventChanged(Event *); 302 void eventChanged(Event *);
302 void eventToBeDeleted(Event *); 303 void eventToBeDeleted(Event *);
303 void eventDeleted(); 304 void eventDeleted();
304 305
305 void todoAdded(Todo *); 306 void todoAdded(Todo *);
306 void todoChanged(Todo *); 307 void todoChanged(Todo *);
307 void todoToBeDeleted(Todo *); 308 void todoToBeDeleted(Todo *);
308 void todoDeleted(); 309 void todoDeleted();
309 310
310 void updateView(const QDate &start, const QDate &end); 311 void updateView(const QDate &start, const QDate &end);
311 void updateView(); 312 void updateView();
312 313
313 /** Full update of visible todo views */ 314 /** Full update of visible todo views */
314 void updateTodoViews(); 315 void updateTodoViews();
315 316
316 void updateUnmanagedViews(); 317 void updateUnmanagedViews();
317 318
318 /** cut the current appointment to the clipboard */ 319 /** cut the current appointment to the clipboard */
319 void edit_cut(); 320 void edit_cut();
320 321
321 /** copy the current appointment(s) to the clipboard */ 322 /** copy the current appointment(s) to the clipboard */
322 void edit_copy(); 323 void edit_copy();
323 324
324 /** paste the current vobject(s) in the clipboard buffer into calendar */ 325 /** paste the current vobject(s) in the clipboard buffer into calendar */
325 void edit_paste(); 326 void edit_paste();
326 327
327 /** edit viewing and configuration options. */ 328 /** edit viewing and configuration options. */
328 void edit_options(); 329 void edit_options();
329 /** 330 /**
330 Functions for printing, previewing a print, and setting up printing 331 Functions for printing, previewing a print, and setting up printing
331 parameters. 332 parameters.
332 */ 333 */
333 void print(); 334 void print();
334 void printSetup(); 335 void printSetup();
335 void printPreview(); 336 void printPreview();
336 337
337 /** Export as iCalendar file */ 338 /** Export as iCalendar file */
338 void exportICalendar(); 339 void exportICalendar();
339 340
340 /** Export as vCalendar file */ 341 /** Export as vCalendar file */
341 bool exportVCalendar( QString fn); 342 bool exportVCalendar( QString fn);
342 343
343 /** pop up a dialog to show an existing appointment. */ 344 /** pop up a dialog to show an existing appointment. */
344 void appointment_show(); 345 void appointment_show();
345 /** 346 /**
346 * pop up an Appointment Dialog to edit an existing appointment.Get 347 * pop up an Appointment Dialog to edit an existing appointment.Get
347 * information on the appointment from the list of unique IDs that is 348 * information on the appointment from the list of unique IDs that is
348 * currently in the View, called currIds. 349 * currently in the View, called currIds.
349 */ 350 */
350 void appointment_edit(); 351 void appointment_edit();
351 /** 352 /**
352 * pop up dialog confirming deletion of currently selected event in the 353 * pop up dialog confirming deletion of currently selected event in the
353 * View. 354 * View.
354 */ 355 */
355 void appointment_delete(); 356 void appointment_delete();
356 357
357 /** mails the currently selected event to a particular user as a vCalendar 358 /** mails the currently selected event to a particular user as a vCalendar
358 attachment. */ 359 attachment. */
359 void action_mail(); 360 void action_mail();
360 361
361 /* frees a subtodo from it's relation */ 362 /* frees a subtodo from it's relation */
362 void todo_unsub( Todo * ); 363 void todo_unsub( Todo * );
363 void todo_resub( Todo * parent, Todo * sub ); 364 void todo_resub( Todo * parent, Todo * sub );
364 365
365 /** Take ownership of selected event. */ 366 /** Take ownership of selected event. */
366 void takeOverEvent(); 367 void takeOverEvent();
367 368
368 /** Take ownership of all events in calendar. */ 369 /** Take ownership of all events in calendar. */
369 void takeOverCalendar(); 370 void takeOverCalendar();
370 371
371 /** query whether or not the calendar is "dirty". */ 372 /** query whether or not the calendar is "dirty". */
372 bool isModified(); 373 bool isModified();
373 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 374 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
374 void setModified(bool modified=true); 375 void setModified(bool modified=true);
375 376
376 /** query if the calendar is read-only. */ 377 /** query if the calendar is read-only. */
377 bool isReadOnly(); 378 bool isReadOnly();
378 /** set state of calendar to read-only */ 379 /** set state of calendar to read-only */
379 void setReadOnly(bool readOnly=true); 380 void setReadOnly(bool readOnly=true);
380 381
381 void eventUpdated(Incidence *); 382 void eventUpdated(Incidence *);
382 383
383 /* iTIP scheduling actions */ 384 /* iTIP scheduling actions */
384 void schedule_publish(Incidence *incidence = 0); 385 void schedule_publish(Incidence *incidence = 0);
385 void schedule_request(Incidence *incidence = 0); 386 void schedule_request(Incidence *incidence = 0);
386 void schedule_refresh(Incidence *incidence = 0); 387 void schedule_refresh(Incidence *incidence = 0);
387 void schedule_cancel(Incidence *incidence = 0); 388 void schedule_cancel(Incidence *incidence = 0);
388 void schedule_add(Incidence *incidence = 0); 389 void schedule_add(Incidence *incidence = 0);
389 void schedule_reply(Incidence *incidence = 0); 390 void schedule_reply(Incidence *incidence = 0);
390 void schedule_counter(Incidence *incidence = 0); 391 void schedule_counter(Incidence *incidence = 0);
391 void schedule_declinecounter(Incidence *incidence = 0); 392 void schedule_declinecounter(Incidence *incidence = 0);
392 void schedule_publish_freebusy(int daysToPublish = 30); 393 void schedule_publish_freebusy(int daysToPublish = 30);
393 394
394 void openAddressbook(); 395 void openAddressbook();
395 396
396 void editFilters(); 397 void editFilters();
397 void toggleFilerEnabled(); 398 void toggleFilerEnabled();
398 QPtrList<CalFilter> filters(); 399 QPtrList<CalFilter> filters();
399 void toggleFilter(); 400 void toggleFilter();
400 void showFilter(bool visible); 401 void showFilter(bool visible);
401 void updateFilter(); 402 void updateFilter();
402 void filterEdited(); 403 void filterEdited();
403 void selectFilter( int ); 404 void selectFilter( int );
404 KOFilterView *filterView(); 405 KOFilterView *filterView();
405 406
406 void showIntro(); 407 void showIntro();
407 408
408 /** Move the curdatepient view date to today */ 409 /** Move the curdatepient view date to today */
409 void goToday(); 410 void goToday();
410 411
411 /** Move to the next date(s) in the current view */ 412 /** Move to the next date(s) in the current view */
412 void goNext(); 413 void goNext();
413 414
414 /** Move to the previous date(s) in the current view */ 415 /** Move to the previous date(s) in the current view */
415 void goPrevious(); 416 void goPrevious();
416 /** Move to the next date(s) in the current view */ 417 /** Move to the next date(s) in the current view */
417 void goNextMonth(); 418 void goNextMonth();
418 419
419 /** Move to the previous date(s) in the current view */ 420 /** Move to the previous date(s) in the current view */
420 void goPreviousMonth(); 421 void goPreviousMonth();
421 422
422 void toggleExpand(); 423 void toggleExpand();
423 void toggleDateNavigatorWidget(); 424 void toggleDateNavigatorWidget();
424 void toggleAllDaySize(); 425 void toggleAllDaySize();
425 void dialogClosing(Incidence *); 426 void dialogClosing(Incidence *);
426 427
427 /** Look for new messages in the inbox */ 428 /** Look for new messages in the inbox */
428 void lookForIncomingMessages(); 429 void lookForIncomingMessages();
429 /** Look for new messages in the outbox */ 430 /** Look for new messages in the outbox */
430 void lookForOutgoingMessages(); 431 void lookForOutgoingMessages();
431 432
432 void processMainViewSelection( Incidence * ); 433 void processMainViewSelection( Incidence * );
433 void processTodoListSelection( Incidence * ); 434 void processTodoListSelection( Incidence * );
434 435
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 1508638..445fc86 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -1,327 +1,356 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qcstring.h> 20#include <qcstring.h>
21#include <qwhatsthis.h> 21#include <qwhatsthis.h>
22#include <qdialog.h> 22#include <qdialog.h>
23#include <qapplication.h> 23#include <qapplication.h>
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qlayout.h> 25#include <qlayout.h>
26 26
27#include <klocale.h> 27#include <klocale.h>
28#include <kapplication.h> 28#include <kapplication.h>
29#include <libkcal/event.h> 29#include <libkcal/event.h>
30#include <libkcal/todo.h> 30#include <libkcal/todo.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kiconloader.h> 32#include <kiconloader.h>
33#include <krun.h> 33#include <krun.h>
34#include <kglobal.h> 34#include <kglobal.h>
35#include <kprocess.h> 35#include <kprocess.h>
36#include "koprefs.h" 36#include "koprefs.h"
37 37
38#include <kabc/stdaddressbook.h> 38#include <kabc/stdaddressbook.h>
39 39
40#ifndef KORG_NODCOP 40#ifndef KORG_NODCOP
41#include <dcopclient.h> 41#include <dcopclient.h>
42#include "korganizer.h" 42#include "korganizer.h"
43#include "koprefs.h" 43#include "koprefs.h"
44#include "actionmanager.h" 44#include "actionmanager.h"
45#endif 45#endif
46 46
47#include "koeventviewer.h" 47#include "koeventviewer.h"
48//#ifndef KORG_NOKABC 48//#ifndef KORG_NOKABC
49//#include <kabc/stdaddressbook.h> 49//#include <kabc/stdaddressbook.h>
50//#define size count 50//#define size count
51//#endif 51//#endif
52 52
53#ifdef DESKTOP_VERSION 53#ifdef DESKTOP_VERSION
54#include <kabc/addresseedialog.h> 54#include <kabc/addresseedialog.h>
55#include <kabc/addresseeview.h> 55#include <kabc/addresseeview.h>
56#include <qprinter.h>
57#include <qpainter.h>
58#include <qpaintdevicemetrics.h>
56#else //DESKTOP_VERSION 59#else //DESKTOP_VERSION
57#include <externalapphandler.h> 60#include <externalapphandler.h>
58#include <qtopia/qcopenvelope_qws.h> 61#include <qtopia/qcopenvelope_qws.h>
59#endif //DESKTOP_VERSION 62#endif //DESKTOP_VERSION
60 63
61KOEventViewer::KOEventViewer(QWidget *parent,const char *name) 64KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
62 : QTextBrowser(parent,name) 65 : QTextBrowser(parent,name)
63{ 66{
64 mSyncMode = false; 67 mSyncMode = false;
65 mColorMode = 0; 68 mColorMode = 0;
66} 69}
67 70
68KOEventViewer::~KOEventViewer() 71KOEventViewer::~KOEventViewer()
69{ 72{
70} 73}
71 74
75void KOEventViewer::printMe()
76{
77#ifdef DESKTOP_VERSION
78 QPrinter printer;
79 if (!printer.setup() )
80 return;
81 QPainter p;
82 p.begin ( &printer );
83 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
84 float dx, dy;
85 int wid = (m.width() * 9)/10;
86 dx = (float) wid/(float)contentsWidth ();
87 dy = (float)(m.height()) / (float)contentsHeight ();
88 float scale;
89 // scale to fit the width or height of the paper
90 if ( dx < dy )
91 scale = dx;
92 else
93 scale = dy;
94 p.translate( m.width()/10,0 );
95 p.scale( scale, scale );
96 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
97 p.end();
98#endif
99
100}
72void KOEventViewer::setSource(const QString& n) 101void KOEventViewer::setSource(const QString& n)
73{ 102{
74 103
75 if ( n.left(3) == "uid" ) 104 if ( n.left(3) == "uid" )
76#ifdef DESKTOP_VERSION 105#ifdef DESKTOP_VERSION
77 { 106 {
78 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 107 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
79 KABC::AddressBook::Iterator it; 108 KABC::AddressBook::Iterator it;
80 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 109 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
81 // LR I do not understand, why the uid string is different on zaurus and desktop 110 // LR I do not understand, why the uid string is different on zaurus and desktop
82 QString uid = "uid://"+(*it).uid(); 111 QString uid = "uid://"+(*it).uid();
83 112
84 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); 113 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
85 if (n == uid ) { 114 if (n == uid ) {
86 //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); 115 //qDebug("found %s ",(*it).mobileHomePhone().latin1() );
87 QDialog dia( this,"dia123", true ); 116 QDialog dia( this,"dia123", true );
88 dia.setCaption( i18n("Details of attendee") ); 117 dia.setCaption( i18n("Details of attendee") );
89 QVBoxLayout lay ( &dia ); 118 QVBoxLayout lay ( &dia );
90 KABC::AddresseeView av ( &dia ); 119 KABC::AddresseeView av ( &dia );
91 av.setAddressee( (*it) ); 120 av.setAddressee( (*it) );
92 lay.addWidget( &av ); 121 lay.addWidget( &av );
93 if ( QApplication::desktop()->width() < 480 ) 122 if ( QApplication::desktop()->width() < 480 )
94 dia.resize( 220, 240); 123 dia.resize( 220, 240);
95 else { 124 else {
96 dia.resize( 400,400); 125 dia.resize( 400,400);
97 } 126 }
98 dia.exec(); 127 dia.exec();
99 break; 128 break;
100 } 129 }
101 } 130 }
102 return; 131 return;
103 } 132 }
104#else 133#else
105 { 134 {
106 if ( "uid:organizer" == n ) { 135 if ( "uid:organizer" == n ) {
107 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); 136 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),"");
108 return; 137 return;
109 } 138 }
110 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 139 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
111 if (attendees.count()) { 140 if (attendees.count()) {
112 Attendee *a; 141 Attendee *a;
113 for(a=attendees.first();a;a=attendees.next()) { 142 for(a=attendees.first();a;a=attendees.next()) {
114 if ( "uid:"+a->uid() == n ) { 143 if ( "uid:"+a->uid() == n ) {
115 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); 144 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid());
116 return; 145 return;
117 } 146 }
118 } 147 }
119 } 148 }
120 return; 149 return;
121 } 150 }
122 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 151 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
123 // the result should now arrive through method insertAttendees 152 // the result should now arrive through method insertAttendees
124 //QString uid = "uid:"+(*it).uid(); 153 //QString uid = "uid:"+(*it).uid();
125#endif 154#endif
126 if ( n.left(6) == "mailto" ) { 155 if ( n.left(6) == "mailto" ) {
127 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); 156 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
128#ifndef DESKTOP_VERSION 157#ifndef DESKTOP_VERSION
129 if ( n.mid(7,3) == "ALL" ) { 158 if ( n.mid(7,3) == "ALL" ) {
130 qDebug("all "); 159 qDebug("all ");
131 mailToAttendees( true ); 160 mailToAttendees( true );
132 } else if ( n.mid(7,4) == "RSVP" ) { 161 } else if ( n.mid(7,4) == "RSVP" ) {
133 mailToAttendees( false ); 162 mailToAttendees( false );
134 qDebug("rsvp "); 163 qDebug("rsvp ");
135 } else { 164 } else {
136 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); 165 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" );
137 e << n.mid(7); 166 e << n.mid(7);
138 } 167 }
139#endif 168#endif
140 169
141 } 170 }
142 171
143 172
144#ifndef KORG_NODCOP 173#ifndef KORG_NODCOP
145 kdDebug() << "KOEventViewer::setSource(): " << n << endl; 174 kdDebug() << "KOEventViewer::setSource(): " << n << endl;
146 QString tmpStr; 175 QString tmpStr;
147 if (n.startsWith("mailto:")) { 176 if (n.startsWith("mailto:")) {
148 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); 177 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
149 //emit showIncidence(n); 178 //emit showIncidence(n);
150 return; 179 return;
151 } else if (n.startsWith("uid:")) { 180 } else if (n.startsWith("uid:")) {
152 DCOPClient *client = KApplication::kApplication()->dcopClient(); 181 DCOPClient *client = KApplication::kApplication()->dcopClient();
153 const QByteArray noParamData; 182 const QByteArray noParamData;
154 const QByteArray paramData; 183 const QByteArray paramData;
155 QByteArray replyData; 184 QByteArray replyData;
156 QCString replyTypeStr; 185 QCString replyTypeStr;
157#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) 186#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
158 bool foundAbbrowser = PING_ABBROWSER; 187 bool foundAbbrowser = PING_ABBROWSER;
159 188
160 if (foundAbbrowser) { 189 if (foundAbbrowser) {
161 //KAddressbook is already running, so just DCOP to it to bring up the contact editor 190 //KAddressbook is already running, so just DCOP to it to bring up the contact editor
162 //client->send("kaddressbook","KAddressBookIface", 191 //client->send("kaddressbook","KAddressBookIface",
163 QDataStream arg(paramData, IO_WriteOnly); 192 QDataStream arg(paramData, IO_WriteOnly);
164 arg << n.mid(6); 193 arg << n.mid(6);
165 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); 194 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData);
166 return; 195 return;
167 } else { 196 } else {
168 /* 197 /*
169 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. 198 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
170 We start it without its main interface 199 We start it without its main interface
171 */ 200 */
172 KIconLoader* iconLoader = new KIconLoader(); 201 KIconLoader* iconLoader = new KIconLoader();
173 QString iconPath = iconLoader->iconPath("go",KIcon::Small); 202 QString iconPath = iconLoader->iconPath("go",KIcon::Small);
174 ActionManager::setStartedKAddressBook(true); 203 ActionManager::setStartedKAddressBook(true);
175 tmpStr = "kaddressbook --editor-only --uid "; 204 tmpStr = "kaddressbook --editor-only --uid ";
176 tmpStr += KProcess::quote(n.mid(6)); 205 tmpStr += KProcess::quote(n.mid(6));
177 KRun::runCommand(tmpStr,"KAddressBook",iconPath); 206 KRun::runCommand(tmpStr,"KAddressBook",iconPath);
178 return; 207 return;
179 } 208 }
180 } else { 209 } else {
181 //QTextBrowser::setSource(n); 210 //QTextBrowser::setSource(n);
182 } 211 }
183#endif 212#endif
184} 213}
185void KOEventViewer::mailToAttendees( bool all ) 214void KOEventViewer::mailToAttendees( bool all )
186{ 215{
187 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 216 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
188 if (attendees.count() == 0) return; 217 if (attendees.count() == 0) return;
189 QStringList nameList; 218 QStringList nameList;
190 QStringList emailList; 219 QStringList emailList;
191 QStringList uidList; 220 QStringList uidList;
192 Attendee* a; 221 Attendee* a;
193 for(a=attendees.first();a;a=attendees.next()) { 222 for(a=attendees.first();a;a=attendees.next()) {
194 if ( !all && !a->RSVP() ) continue; 223 if ( !all && !a->RSVP() ) continue;
195 if (!a->email().isEmpty()) { 224 if (!a->email().isEmpty()) {
196 nameList.append (a->name() ); 225 nameList.append (a->name() );
197 emailList.append (a->email() ); 226 emailList.append (a->email() );
198 uidList.append (a->uid() ); 227 uidList.append (a->uid() );
199 } 228 }
200 } 229 }
201 QString uid = "ComposeMailUIpick2"+mMailSubject; 230 QString uid = "ComposeMailUIpick2"+mMailSubject;
202#ifndef DESKTOP_VERSION 231#ifndef DESKTOP_VERSION
203 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 232 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
204#endif 233#endif
205 234
206} 235}
207void KOEventViewer::addTag(const QString & tag,const QString & text) 236void KOEventViewer::addTag(const QString & tag,const QString & text)
208{ 237{
209 int number=text.contains("\n"); 238 int number=text.contains("\n");
210 QString str = "<" + tag + ">"; 239 QString str = "<" + tag + ">";
211 QString tmpText=text; 240 QString tmpText=text;
212 QString tmpStr=str; 241 QString tmpStr=str;
213 if(number !=-1) 242 if(number !=-1)
214 { 243 {
215 if (number > 0) { 244 if (number > 0) {
216 int pos=0; 245 int pos=0;
217 QString tmp; 246 QString tmp;
218 for(int i=0;i<=number;i++) { 247 for(int i=0;i<=number;i++) {
219 pos=tmpText.find("\n"); 248 pos=tmpText.find("\n");
220 tmp=tmpText.left(pos); 249 tmp=tmpText.left(pos);
221 tmpText=tmpText.right(tmpText.length()-pos-1); 250 tmpText=tmpText.right(tmpText.length()-pos-1);
222 tmpStr+=tmp+"<br>"; 251 tmpStr+=tmp+"<br>";
223 } 252 }
224 } 253 }
225 else tmpStr += tmpText; 254 else tmpStr += tmpText;
226 tmpStr+="</" + tag + ">"; 255 tmpStr+="</" + tag + ">";
227 mText.append(tmpStr); 256 mText.append(tmpStr);
228 } 257 }
229 else 258 else
230 { 259 {
231 str += text + "</" + tag + ">"; 260 str += text + "</" + tag + ">";
232 mText.append(str); 261 mText.append(str);
233 } 262 }
234} 263}
235 264
236void KOEventViewer::setColorMode( int m ) 265void KOEventViewer::setColorMode( int m )
237{ 266{
238 mColorMode = m; 267 mColorMode = m;
239} 268}
240void KOEventViewer::appendEvent(Event *event, int mode ) 269void KOEventViewer::appendEvent(Event *event, int mode )
241{ 270{
242 mMailSubject = ""; 271 mMailSubject = "";
243 mCurrentIncidence = event; 272 mCurrentIncidence = event;
244 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 273 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
245 topLevelWidget()->setCaption(i18n("Event Viewer")); 274 topLevelWidget()->setCaption(i18n("Event Viewer"));
246 if ( mode == 0 ) { 275 if ( mode == 0 ) {
247 addTag("h2",deTag(event->summary())); 276 addTag("h2",deTag(event->summary()));
248 } 277 }
249 else { 278 else {
250 if ( mColorMode == 1 ) { 279 if ( mColorMode == 1 ) {
251 mText +="<font color=\"#00A000\">"; 280 mText +="<font color=\"#00A000\">";
252 } 281 }
253 if ( mColorMode == 2 ) { 282 if ( mColorMode == 2 ) {
254 mText +="<font color=\"#C00000\">"; 283 mText +="<font color=\"#C00000\">";
255 } 284 }
256 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 285 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
257 if ( mode == 1 ) { 286 if ( mode == 1 ) {
258 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 287 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
259 } else { 288 } else {
260 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 289 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
261 } 290 }
262 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 291 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
263 if ( mColorMode ) 292 if ( mColorMode )
264 mText += "</font>"; 293 mText += "</font>";
265 } 294 }
266 mMailSubject += i18n( "Meeting " )+ event->summary(); 295 mMailSubject += i18n( "Meeting " )+ event->summary();
267 if (event->cancelled ()) { 296 if (event->cancelled ()) {
268 mText +="<font color=\"#B00000\">"; 297 mText +="<font color=\"#B00000\">";
269 addTag("i",i18n("This event has been cancelled!")); 298 addTag("i",i18n("This event has been cancelled!"));
270 mText.append("<br>"); 299 mText.append("<br>");
271 mText += "</font>"; 300 mText += "</font>";
272 mMailSubject += i18n("(cancelled)"); 301 mMailSubject += i18n("(cancelled)");
273 } 302 }
274 if (!event->location().isEmpty()) { 303 if (!event->location().isEmpty()) {
275 addTag("b",i18n("Location: ")); 304 addTag("b",i18n("Location: "));
276 mText.append(deTag(event->location())+"<br>"); 305 mText.append(deTag(event->location())+"<br>");
277 mMailSubject += i18n(" at ") + event->location(); 306 mMailSubject += i18n(" at ") + event->location();
278 } 307 }
279 if (event->doesFloat()) { 308 if (event->doesFloat()) {
280 if (event->isMultiDay()) { 309 if (event->isMultiDay()) {
281 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 310 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
282 .arg(event->dtStartDateStr(shortDate)) 311 .arg(event->dtStartDateStr(shortDate))
283 .arg(event->dtEndDateStr(shortDate))); 312 .arg(event->dtEndDateStr(shortDate)));
284 } else { 313 } else {
285 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 314 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
286 } 315 }
287 } else { 316 } else {
288 if (event->isMultiDay()) { 317 if (event->isMultiDay()) {
289 mText.append(i18n("<p><b>From:</b> %1</p> ") 318 mText.append(i18n("<p><b>From:</b> %1</p> ")
290 .arg(event->dtStartStr( shortDate))); 319 .arg(event->dtStartStr( shortDate)));
291 mText.append(i18n("<p><b>To:</b> %1</p>") 320 mText.append(i18n("<p><b>To:</b> %1</p>")
292 .arg(event->dtEndStr(shortDate))); 321 .arg(event->dtEndStr(shortDate)));
293 } else { 322 } else {
294 mText.append(i18n("<p><b>On:</b> %1</p> ") 323 mText.append(i18n("<p><b>On:</b> %1</p> ")
295 .arg(event->dtStartDateStr( shortDate ))); 324 .arg(event->dtStartDateStr( shortDate )));
296 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 325 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
297 .arg(event->dtStartTimeStr()) 326 .arg(event->dtStartTimeStr())
298 .arg(event->dtEndTimeStr())); 327 .arg(event->dtEndTimeStr()));
299 } 328 }
300 } 329 }
301 330
302 if (event->recurrence()->doesRecur()) { 331 if (event->recurrence()->doesRecur()) {
303 332
304 QString recurText = event->recurrence()->recurrenceText(); 333 QString recurText = event->recurrence()->recurrenceText();
305 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 334 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
306 bool ok; 335 bool ok;
307 QDate start = QDate::currentDate(); 336 QDate start = QDate::currentDate();
308 QDateTime next; 337 QDateTime next;
309 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 338 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
310 if ( ok ) { 339 if ( ok ) {
311 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 340 addTag("p",i18n("<b>Next recurrence is on:</b>") );
312 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 341 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
313 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); 342 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true );
314 343
315 } else { 344 } else {
316 bool last; 345 bool last;
317 QDate nextd; 346 QDate nextd;
318 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 347 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
319 if ( last ) { 348 if ( last ) {
320 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 349 addTag("p",i18n("<b>Last recurrence was on:</b>") );
321 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 350 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
322 } 351 }
323 } 352 }
324 } else { 353 } else {
325 mMailSubject += i18n(" - " )+event->dtStartStr( true ); 354 mMailSubject += i18n(" - " )+event->dtStartStr( true );
326 355
327 } 356 }
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h
index 47cc5e9..ca5bc15 100644
--- a/korganizer/koeventviewer.h
+++ b/korganizer/koeventviewer.h
@@ -1,77 +1,78 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19#ifndef KOEVENTVIEWER_H 19#ifndef KOEVENTVIEWER_H
20#define KOEVENTVIEWER_H 20#define KOEVENTVIEWER_H
21// 21//
22// Viewer widget for events. 22// Viewer widget for events.
23// 23//
24 24
25#include <qtextbrowser.h> 25#include <qtextbrowser.h>
26 26
27#include <libkcal/event.h> 27#include <libkcal/event.h>
28#include <libkcal/journal.h> 28#include <libkcal/journal.h>
29 29
30 30
31using namespace KCal; 31using namespace KCal;
32 32
33class KOEventViewer : public QTextBrowser { 33class KOEventViewer : public QTextBrowser {
34 Q_OBJECT 34 Q_OBJECT
35 public: 35 public:
36 KOEventViewer(QWidget *parent=0,const char *name=0); 36 KOEventViewer(QWidget *parent=0,const char *name=0);
37 virtual ~KOEventViewer(); 37 virtual ~KOEventViewer();
38 38
39 void setSource(const QString &); 39 void setSource(const QString &);
40 void setEvent(Event *event); 40 void setEvent(Event *event);
41 void addEvent(Event *event); 41 void addEvent(Event *event);
42 void setTodo(Todo *event, bool clearV = true ); 42 void setTodo(Todo *event, bool clearV = true );
43 void setJournal(Journal *jour, bool clearV = true ); 43 void setJournal(Journal *jour, bool clearV = true );
44 44
45 void appendEvent(Event *event, int mode = 0 ); 45 void appendEvent(Event *event, int mode = 0 );
46 void appendTodo(Todo *event, int mode = 0 ); 46 void appendTodo(Todo *event, int mode = 0 );
47 void appendJournal(Journal *jour, int mode = 0 ); 47 void appendJournal(Journal *jour, int mode = 0 );
48 48
49 void clearEvents(bool now=false); 49 void clearEvents(bool now=false);
50 50
51 void addText(QString text); 51 void addText(QString text);
52 void setSyncMode( bool ); 52 void setSyncMode( bool );
53 void setColorMode( int ); 53 void setColorMode( int );
54 void mailToAttendees( bool all ); 54 void mailToAttendees( bool all );
55 void printMe();
55 56
56 protected: 57 protected:
57 int mColorMode; 58 int mColorMode;
58 void addTag(const QString & tag,const QString & text); 59 void addTag(const QString & tag,const QString & text);
59 60
60 void formatCategories(Incidence *event); 61 void formatCategories(Incidence *event);
61 void formatAttendees(Incidence *event); 62 void formatAttendees(Incidence *event);
62 void formatReadOnly(Incidence *event); 63 void formatReadOnly(Incidence *event);
63 void keyPressEvent ( QKeyEvent * e ); 64 void keyPressEvent ( QKeyEvent * e );
64 65
65 private: 66 private:
66 QTextBrowser *mEventTextView; 67 QTextBrowser *mEventTextView;
67 bool mSyncMode; 68 bool mSyncMode;
68 QString deTag(QString text); 69 QString deTag(QString text);
69 70
70 QString mText; 71 QString mText;
71 QString mMailSubject; 72 QString mMailSubject;
72 Incidence* mCurrentIncidence; 73 Incidence* mCurrentIncidence;
73 signals: 74 signals:
74 void launchaddressbook(QString uid); 75 void launchaddressbook(QString uid);
75}; 76};
76 77
77#endif 78#endif
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index f734696..ec55cca 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -1,302 +1,316 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <klocale.h> 20#include <klocale.h>
21 21
22#include <libkcal/event.h> 22#include <libkcal/event.h>
23#include <qtimer.h> 23#include <qtimer.h>
24#include <qpushbutton.h> 24#include <qpushbutton.h>
25 25
26#include "koeventviewer.h" 26#include "koeventviewer.h"
27#include <kmessagebox.h>
27#include "koprefs.h" 28#include "koprefs.h"
28#include <libkcal/todo.h> 29#include <libkcal/todo.h>
29#include "qapp.h" 30#include "qapp.h"
30 31
31#include "koeventviewerdialog.h" 32#include "koeventviewerdialog.h"
32extern int globalFlagBlockAgenda; 33extern int globalFlagBlockAgenda;
33 34
34KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) 35KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name)
35 : KDialogBase(parent,name, 36 : KDialogBase(parent,name,
36#ifndef DESKTOP_VERSION 37#ifndef DESKTOP_VERSION
37 true , 38 true ,
38#else 39#else
39 false, 40 false,
40#endif 41#endif
41 i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) 42 i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda"))
42{ 43{
43 sendSignalViewerClosed = true; 44 sendSignalViewerClosed = true;
44 mEventViewer = new KOEventViewer(this); 45 mEventViewer = new KOEventViewer(this);
45 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); 46 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont );
46 setMainWidget(mEventViewer); 47 setMainWidget(mEventViewer);
47 setButtonText(Ok, i18n("Edit") ); 48 setButtonText(Ok, i18n("Edit") );
48 49
49 QObject::connect(findButton( Ok ),SIGNAL(clicked()), 50 QObject::connect(findButton( Ok ),SIGNAL(clicked()),
50 SLOT(editIncidence())); 51 SLOT(editIncidence()));
51 QObject::connect(this,SIGNAL(user1Clicked()), 52 QObject::connect(this,SIGNAL(user1Clicked()),
52 SLOT(showIncidence())); 53 SLOT(showIncidence()));
53 mIncidence = 0; 54 mIncidence = 0;
54 // TODO: Set a sensible size (based on the content?). 55 // TODO: Set a sensible size (based on the content?).
55 //showMaximized(); 56 //showMaximized();
56 //qDebug("++++++++++++KOEventViewerDialog() "); 57 //qDebug("++++++++++++KOEventViewerDialog() ");
57 // if ( KOPrefs::instance()->mCompactDialogs ) { 58 // if ( KOPrefs::instance()->mCompactDialogs ) {
58// setFixedSize( 240,284 ); 59// setFixedSize( 240,284 );
59// move( 0, 15 ); 60// move( 0, 15 );
60// } else { 61// } else {
61// setMinimumSize(300,200); 62// setMinimumSize(300,200);
62// resize(320,300); 63// resize(320,300);
63// } 64// }
64 mSyncMode = false; 65 mSyncMode = false;
65 mSyncResult = 0; 66 mSyncResult = 0;
66 67
67} 68}
68 69
69KOEventViewerDialog::~KOEventViewerDialog() 70KOEventViewerDialog::~KOEventViewerDialog()
70{ 71{
71 //qDebug("-------~KOEventViewerDialog() "); 72 //qDebug("-------~KOEventViewerDialog() ");
72} 73}
73void KOEventViewerDialog::showMe() 74void KOEventViewerDialog::showMe()
74{ 75{
75 76
76#ifdef DESKTOP_VERSION 77#ifdef DESKTOP_VERSION
77 int x,y,w,h; 78 int x,y,w,h;
78 x = geometry().x(); 79 x = geometry().x();
79 y = geometry().y(); 80 y = geometry().y();
80 w = width(); 81 w = width();
81 h = height(); 82 h = height();
82 show(); 83 show();
83 setGeometry(x,y,w,h); 84 setGeometry(x,y,w,h);
84#else 85#else
85 showMaximized(); 86 showMaximized();
86#endif 87#endif
87 raise(); 88 raise();
88 setActiveWindow(); 89 setActiveWindow();
89 mEventViewer->setFocus(); 90 mEventViewer->setFocus();
90 //raise(); 91 //raise();
91 92
92} 93}
94void KOEventViewerDialog::print()
95{
96 qDebug("PRINT ");
97 int km = KMessageBox::warningContinueCancel(this,mIncidence->summary().left(35) +
98 i18n("\n\nDo you really want to print this item?"),
99 i18n("KO/Pi Print Confirmation"),i18n("Print"));
100 if ( km != KMessageBox::Continue ) {
101 qDebug("cancel ");
102 return;
103 }
104 mEventViewer->printMe();
105
106}
93void KOEventViewerDialog::setSyncMode( bool b ) 107void KOEventViewerDialog::setSyncMode( bool b )
94{ 108{
95 mSyncMode = b; 109 mSyncMode = b;
96 //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); 110 //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode );
97 if ( mSyncMode ) { 111 if ( mSyncMode ) {
98 findButton( Close )->setText( i18n("Cancel Sync")); 112 findButton( Close )->setText( i18n("Cancel Sync"));
99 findButton( Ok )->setText( i18n("Remote")); 113 findButton( Ok )->setText( i18n("Remote"));
100 findButton( User1 )->setText( i18n("Local")); 114 findButton( User1 )->setText( i18n("Local"));
101 } else { 115 } else {
102 findButton( Close )->setText( i18n("Close")); 116 findButton( Close )->setText( i18n("Close"));
103 findButton( Ok )->setText( i18n("Edit")); 117 findButton( Ok )->setText( i18n("Edit"));
104 findButton( User1 )->setText( i18n("Agenda")); 118 findButton( User1 )->setText( i18n("Agenda"));
105 } 119 }
106 mEventViewer->setSyncMode( b ); 120 mEventViewer->setSyncMode( b );
107} 121}
108void KOEventViewerDialog::setColorMode( int m ) 122void KOEventViewerDialog::setColorMode( int m )
109{ 123{
110 mEventViewer->setColorMode( m ); 124 mEventViewer->setColorMode( m );
111} 125}
112int KOEventViewerDialog::executeS( bool local ) 126int KOEventViewerDialog::executeS( bool local )
113{ 127{
114 mSyncResult = 3; 128 mSyncResult = 3;
115 if ( local ) 129 if ( local )
116 findButton( User1 )->setFocus(); 130 findButton( User1 )->setFocus();
117 else 131 else
118 findButton( Ok )->setFocus(); 132 findButton( Ok )->setFocus();
119 exec(); 133 exec();
120 return mSyncResult; 134 return mSyncResult;
121} 135}
122 136
123void KOEventViewerDialog::updateConfig() 137void KOEventViewerDialog::updateConfig()
124{ 138{
125 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); 139 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont );
126 140
127} 141}
128void KOEventViewerDialog::setEvent(Event *event) 142void KOEventViewerDialog::setEvent(Event *event)
129{ 143{
130 mEventViewer->setEvent(event); 144 mEventViewer->setEvent(event);
131 mIncidence = event; 145 mIncidence = event;
132 mEventViewer->setFocus(); 146 mEventViewer->setFocus();
133 //findButton( Close )->setFocus(); 147 //findButton( Close )->setFocus();
134 if ( !mSyncMode ) { 148 if ( !mSyncMode ) {
135 findButton( User1 )->setText( i18n("Agenda")); 149 findButton( User1 )->setText( i18n("Agenda"));
136 } 150 }
137} 151}
138void KOEventViewerDialog::setIncidence(Incidence *in ) 152void KOEventViewerDialog::setIncidence(Incidence *in )
139{ 153{
140 if ( in->type() == "Event" ) 154 if ( in->type() == "Event" )
141 setEvent( (Event*) in ); 155 setEvent( (Event*) in );
142 else if ( in->type() =="Todo" ) 156 else if ( in->type() =="Todo" )
143 setTodo( (Todo*) in ); 157 setTodo( (Todo*) in );
144 else if ( in->type() =="Journal" ) 158 else if ( in->type() =="Journal" )
145 setJournal( (Journal*) in ); 159 setJournal( (Journal*) in );
146} 160}
147void KOEventViewerDialog::addIncidence(Incidence *in) 161void KOEventViewerDialog::addIncidence(Incidence *in)
148{ 162{
149 if ( in->type() == "Event" ) 163 if ( in->type() == "Event" )
150 addEvent( (Event*) in ); 164 addEvent( (Event*) in );
151 else if ( in->type() =="Todo" ) 165 else if ( in->type() =="Todo" )
152 mEventViewer->setTodo( (Todo*) in, false ); 166 mEventViewer->setTodo( (Todo*) in, false );
153 else if ( in->type() =="Journal" ) 167 else if ( in->type() =="Journal" )
154 mEventViewer->setJournal( (Journal*) in, false ); 168 mEventViewer->setJournal( (Journal*) in, false );
155 if ( mSyncMode ) { 169 if ( mSyncMode ) {
156 findButton( User1 )->setFocus(); 170 findButton( User1 )->setFocus();
157 setCaption(i18n("Conflict! Please choose entry")); 171 setCaption(i18n("Conflict! Please choose entry"));
158 } 172 }
159} 173}
160 174
161void KOEventViewerDialog::addEvent(Event *event) 175void KOEventViewerDialog::addEvent(Event *event)
162{ 176{
163 mEventViewer->addEvent(event); 177 mEventViewer->addEvent(event);
164 mIncidence = event; 178 mIncidence = event;
165 mEventViewer->setFocus(); 179 mEventViewer->setFocus();
166 //findButton( Close )->setFocus(); 180 //findButton( Close )->setFocus();
167 if ( !mSyncMode ) { 181 if ( !mSyncMode ) {
168 findButton( User1 )->setText( i18n("Agenda")); 182 findButton( User1 )->setText( i18n("Agenda"));
169 } 183 }
170} 184}
171 185
172void KOEventViewerDialog::setTodo(Todo *event) 186void KOEventViewerDialog::setTodo(Todo *event)
173{ 187{
174 mEventViewer->setTodo(event); 188 mEventViewer->setTodo(event);
175 mIncidence = (Incidence*)event; 189 mIncidence = (Incidence*)event;
176 mEventViewer->setFocus(); 190 mEventViewer->setFocus();
177 //findButton( Close )->setFocus(); 191 //findButton( Close )->setFocus();
178 if ( !mSyncMode ) { 192 if ( !mSyncMode ) {
179 findButton( User1 )->setText( i18n("Set complete")); 193 findButton( User1 )->setText( i18n("Set complete"));
180 } 194 }
181} 195}
182void KOEventViewerDialog::setJournal(Journal *j) 196void KOEventViewerDialog::setJournal(Journal *j)
183{ 197{
184 mEventViewer->setJournal(j); 198 mEventViewer->setJournal(j);
185 mIncidence = (Incidence*)j; 199 mIncidence = (Incidence*)j;
186 mEventViewer->setFocus(); 200 mEventViewer->setFocus();
187 //findButton( Close )->setFocus(); 201 //findButton( Close )->setFocus();
188 if ( !mSyncMode ) { 202 if ( !mSyncMode ) {
189 findButton( User1 )->setText( i18n("Agenda")); 203 findButton( User1 )->setText( i18n("Agenda"));
190 } 204 }
191} 205}
192 206
193void KOEventViewerDialog::addText(QString text) 207void KOEventViewerDialog::addText(QString text)
194{ 208{
195 mEventViewer->addText(text); 209 mEventViewer->addText(text);
196 mEventViewer->setFocus(); 210 mEventViewer->setFocus();
197 //findButton( Close )->setFocus(); 211 //findButton( Close )->setFocus();
198} 212}
199void KOEventViewerDialog::editIncidence() 213void KOEventViewerDialog::editIncidence()
200{ 214{
201 sendSignalViewerClosed = false; 215 sendSignalViewerClosed = false;
202 if ( mSyncMode ) { 216 if ( mSyncMode ) {
203 mSyncResult = 2; 217 mSyncResult = 2;
204 accept(); 218 accept();
205 return; 219 return;
206 } 220 }
207 if ( mIncidence ){ 221 if ( mIncidence ){
208#ifndef DESKTOP_VERSION 222#ifndef DESKTOP_VERSION
209 hide(); 223 hide();
210#endif 224#endif
211 emit editIncidence( mIncidence ); 225 emit editIncidence( mIncidence );
212 } 226 }
213} 227}
214void KOEventViewerDialog::showIncidence() 228void KOEventViewerDialog::showIncidence()
215{ 229{
216 sendSignalViewerClosed = false; 230 sendSignalViewerClosed = false;
217 if ( mSyncMode ) { 231 if ( mSyncMode ) {
218 mSyncResult = 1; 232 mSyncResult = 1;
219 accept(); 233 accept();
220 return; 234 return;
221 } 235 }
222 236
223 if ( mIncidence ){ 237 if ( mIncidence ){
224#ifndef DESKTOP_VERSION 238#ifndef DESKTOP_VERSION
225 hide(); 239 hide();
226#endif 240#endif
227 QDate date; 241 QDate date;
228 if ( mIncidence->type() == "Todo" ) { 242 if ( mIncidence->type() == "Todo" ) {
229 /* 243 /*
230 if ( ((Todo*)mIncidence)->hasDueDate() ) 244 if ( ((Todo*)mIncidence)->hasDueDate() )
231 date = ((Todo*)mIncidence)->dtDue().date(); 245 date = ((Todo*)mIncidence)->dtDue().date();
232 else { 246 else {
233 globalFlagBlockAgenda = 2; 247 globalFlagBlockAgenda = 2;
234 emit showAgendaView( false ); 248 emit showAgendaView( false );
235 return; 249 return;
236 } 250 }
237 */ 251 */
238 ((Todo*)mIncidence)->setCompleted( true ); 252 ((Todo*)mIncidence)->setCompleted( true );
239 ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); 253 ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() );
240 hide(); 254 hide();
241 emit todoCompleted(((Todo*)mIncidence)); 255 emit todoCompleted(((Todo*)mIncidence));
242 return; 256 return;
243 257
244 } else 258 } else
245 date = mIncidence->dtStart().date(); 259 date = mIncidence->dtStart().date();
246 globalFlagBlockAgenda = 1; 260 globalFlagBlockAgenda = 1;
247 emit showAgendaView( false ); 261 emit showAgendaView( false );
248 globalFlagBlockAgenda = 2; 262 globalFlagBlockAgenda = 2;
249 emit jumpToTime( date ); 263 emit jumpToTime( date );
250 } 264 }
251} 265}
252void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) 266void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e )
253{ 267{
254 switch ( e->key() ) { 268 switch ( e->key() ) {
255 269
256 case Qt::Key_A : 270 case Qt::Key_A :
257 case Qt::Key_L : 271 case Qt::Key_L :
258 showIncidence(); 272 showIncidence();
259 break; 273 break;
260 case Qt::Key_E : 274 case Qt::Key_E :
261 case Qt::Key_R : 275 case Qt::Key_R :
262 editIncidence(); 276 editIncidence();
263 break; 277 break;
264 case Qt::Key_C: 278 case Qt::Key_C:
265 case Qt::Key_Escape: 279 case Qt::Key_Escape:
266 sendSignalViewerClosed = true; 280 sendSignalViewerClosed = true;
267 close(); 281 close();
268 break; 282 break;
269 case Qt::Key_I: 283 case Qt::Key_I:
270#ifndef DESKTOP_VERSION 284#ifndef DESKTOP_VERSION
271 sendSignalViewerClosed = true; 285 sendSignalViewerClosed = true;
272 close(); 286 close();
273#else 287#else
274 sendSignalViewerClosed = true; 288 sendSignalViewerClosed = true;
275 slotViewerClosed(); 289 slotViewerClosed();
276 //accept(); 290 //accept();
277#endif 291#endif
278 break; 292 break;
279 default: 293 default:
280 KDialogBase::keyPressEvent ( e ); 294 KDialogBase::keyPressEvent ( e );
281 break; 295 break;
282 } 296 }
283 297
284} 298}
285void KOEventViewerDialog::hideEvent ( QHideEvent * e ) 299void KOEventViewerDialog::hideEvent ( QHideEvent * e )
286{ 300{
287 KDialogBase::hideEvent ( e ); 301 KDialogBase::hideEvent ( e );
288 QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); 302 QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) );
289} 303}
290 304
291void KOEventViewerDialog::slotViewerClosed() 305void KOEventViewerDialog::slotViewerClosed()
292{ 306{
293 if ( mSyncMode ) 307 if ( mSyncMode )
294 return; 308 return;
295 309
296 if ( sendSignalViewerClosed ) { 310 if ( sendSignalViewerClosed ) {
297 //qDebug("KOEventViewerDialog::hideEvent "); 311 //qDebug("KOEventViewerDialog::hideEvent ");
298 emit signalViewerClosed(); 312 emit signalViewerClosed();
299 } 313 }
300 sendSignalViewerClosed = true; 314 sendSignalViewerClosed = true;
301} 315}
302 316
diff --git a/korganizer/koeventviewerdialog.h b/korganizer/koeventviewerdialog.h
index 36431ad..8e1cd44 100644
--- a/korganizer/koeventviewerdialog.h
+++ b/korganizer/koeventviewerdialog.h
@@ -1,75 +1,76 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19#ifndef KOEVENTVIEWERDIALOG_H 19#ifndef KOEVENTVIEWERDIALOG_H
20#define KOEVENTVIEWERDIALOG_H 20#define KOEVENTVIEWERDIALOG_H
21// 21//
22// Viewer dialog for events. 22// Viewer dialog for events.
23// 23//
24 24
25#include <qtextview.h> 25#include <qtextview.h>
26 26
27#include <kdialogbase.h> 27#include <kdialogbase.h>
28 28
29#include <libkcal/event.h> 29#include <libkcal/event.h>
30 30
31using namespace KCal; 31using namespace KCal;
32 32
33class KOEventViewer; 33class KOEventViewer;
34 34
35class KOEventViewerDialog : public KDialogBase { 35class KOEventViewerDialog : public KDialogBase {
36 Q_OBJECT 36 Q_OBJECT
37 public: 37 public:
38 KOEventViewerDialog(QWidget *parent=0,const char *name=0); 38 KOEventViewerDialog(QWidget *parent=0,const char *name=0);
39 virtual ~KOEventViewerDialog(); 39 virtual ~KOEventViewerDialog();
40 40
41 void setEvent(Event *event); 41 void setEvent(Event *event);
42 void addEvent(Event *event); 42 void addEvent(Event *event);
43 void setTodo(Todo *event); 43 void setTodo(Todo *event);
44 void setJournal(Journal *journal); 44 void setJournal(Journal *journal);
45 void setIncidence(Incidence *inc); 45 void setIncidence(Incidence *inc);
46 void addIncidence(Incidence *inc); 46 void addIncidence(Incidence *inc);
47 void addText(QString text); 47 void addText(QString text);
48 void showMe(); 48 void showMe();
49 void setSyncMode( bool ); 49 void setSyncMode( bool );
50 void setColorMode( int m ); 50 void setColorMode( int m );
51 int executeS( bool ); 51 int executeS( bool );
52 public slots: 52 public slots:
53 void updateConfig(); 53 void updateConfig();
54 void print();
54 signals: 55 signals:
55 void editIncidence( Incidence* ); 56 void editIncidence( Incidence* );
56 void jumpToTime( const QDate &); 57 void jumpToTime( const QDate &);
57 void showAgendaView( bool ); 58 void showAgendaView( bool );
58 void todoCompleted(Todo*); 59 void todoCompleted(Todo*);
59 void signalViewerClosed(); 60 void signalViewerClosed();
60private slots: 61private slots:
61 void slotViewerClosed(); 62 void slotViewerClosed();
62 void editIncidence(); 63 void editIncidence();
63 void showIncidence(); 64 void showIncidence();
64 protected: 65 protected:
65 void hideEvent ( QHideEvent * e ); 66 void hideEvent ( QHideEvent * e );
66 private: 67 private:
67 bool sendSignalViewerClosed; 68 bool sendSignalViewerClosed;
68 bool mSyncMode; 69 bool mSyncMode;
69 int mSyncResult; 70 int mSyncResult;
70 KOEventViewer *mEventViewer; 71 KOEventViewer *mEventViewer;
71 Incidence* mIncidence; 72 Incidence* mIncidence;
72 void keyPressEvent ( QKeyEvent * e ); 73 void keyPressEvent ( QKeyEvent * e );
73}; 74};
74 75
75#endif 76#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index e80b3fc..8752636 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -129,512 +129,519 @@ void KOViewManager::showDateView( int view, QDate date)
129 lastCount = mMainView->dateNavigator()->selectedDates().count(); 129 lastCount = mMainView->dateNavigator()->selectedDates().count();
130 lastNDMode = savemFlagShowNextxDays; 130 lastNDMode = savemFlagShowNextxDays;
131 mMainView->dateNavigator()->selectDate( date ); 131 mMainView->dateNavigator()->selectDate( date );
132 lastMode = 1; 132 lastMode = 1;
133 mCurrentAgendaView = 1 ; 133 mCurrentAgendaView = 1 ;
134 } else if (view == 4 ) { 134 } else if (view == 4 ) {
135 mCurrentAgendaView = 7 ; 135 mCurrentAgendaView = 7 ;
136 mMainView->dateNavigator()->selectDates( date, 7 ); 136 mMainView->dateNavigator()->selectDates( date, 7 );
137 } else if (view == 5 ) { 137 } else if (view == 5 ) {
138 mCurrentAgendaView = 14 ; 138 mCurrentAgendaView = 14 ;
139 mMainView->dateNavigator()->selectDates( date, 14); 139 mMainView->dateNavigator()->selectDates( date, 14);
140 } else if (view == 6 ) { 140 } else if (view == 6 ) {
141 //mMainView->dateNavigator()->selectDates( date, 7 ); 141 //mMainView->dateNavigator()->selectDates( date, 7 );
142 showMonthView(); 142 showMonthView();
143 } else if (view == 7 ) { 143 } else if (view == 7 ) {
144 mMainView->dateNavigator()->selectDate( date ); 144 mMainView->dateNavigator()->selectDate( date );
145 showJournalView(); 145 showJournalView();
146 } else if (view == 8 ) { 146 } else if (view == 8 ) {
147 globalFlagBlockAgenda = 1; 147 globalFlagBlockAgenda = 1;
148 if ( mCurrentAgendaView != 3 ) 148 if ( mCurrentAgendaView != 3 )
149 mCurrentAgendaView = -1; 149 mCurrentAgendaView = -1;
150 showAgendaView(KOPrefs::instance()->mFullViewMonth); 150 showAgendaView(KOPrefs::instance()->mFullViewMonth);
151 globalFlagBlockAgenda = 2; 151 globalFlagBlockAgenda = 2;
152 mMainView->dateNavigator()->selectDates( date , 152 mMainView->dateNavigator()->selectDates( date ,
153 KOPrefs::instance()->mNextXDays ); 153 KOPrefs::instance()->mNextXDays );
154 mFlagShowNextxDays = true; 154 mFlagShowNextxDays = true;
155 mCurrentAgendaView = 3 ; 155 mCurrentAgendaView = 3 ;
156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) 156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
157 if ( lastMode ) { 157 if ( lastMode ) {
158 mCurrentAgendaView = lastCount ; 158 mCurrentAgendaView = lastCount ;
159 mMainView->dateNavigator()->selectDates( lastDate, lastCount); 159 mMainView->dateNavigator()->selectDates( lastDate, lastCount);
160 mFlagShowNextxDays = lastNDMode; 160 mFlagShowNextxDays = lastNDMode;
161 if ( mFlagShowNextxDays ) { 161 if ( mFlagShowNextxDays ) {
162 mCurrentAgendaView = 3 ; 162 mCurrentAgendaView = 3 ;
163 } 163 }
164 } else 164 } else
165 showWeekView(); 165 showWeekView();
166 } else if (view == 10) { 166 } else if (view == 10) {
167 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); 167 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
168 } 168 }
169} 169}
170 170
171 171
172 172
173void KOViewManager::writeSettings(KConfig *config) 173void KOViewManager::writeSettings(KConfig *config)
174{ 174{
175 config->setGroup("General"); 175 config->setGroup("General");
176 176
177 QString view; 177 QString view;
178 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 178 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
179 else if (mCurrentView == mMonthView) view = "Month"; 179 else if (mCurrentView == mMonthView) view = "Month";
180 else if (mCurrentView == mListView) view = "List"; 180 else if (mCurrentView == mListView) view = "List";
181 else if (mCurrentView == mJournalView) view = "Journal"; 181 else if (mCurrentView == mJournalView) view = "Journal";
182 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 182 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
183 else if (mCurrentView == mTodoView) view = "Todo"; 183 else if (mCurrentView == mTodoView) view = "Todo";
184 else view = "Agenda"; 184 else view = "Agenda";
185 185
186 config->writeEntry("Current View",view); 186 config->writeEntry("Current View",view);
187 187
188 if (mAgendaView) { 188 if (mAgendaView) {
189 mAgendaView->writeSettings(config); 189 mAgendaView->writeSettings(config);
190 } 190 }
191 if (mTimeSpanView) { 191 if (mTimeSpanView) {
192 mTimeSpanView->writeSettings(config); 192 mTimeSpanView->writeSettings(config);
193 } 193 }
194 if (mListView) { 194 if (mListView) {
195 mListView->writeSettings(config); 195 mListView->writeSettings(config);
196 } 196 }
197 if (mTodoView) { 197 if (mTodoView) {
198 mTodoView->saveLayout(config,"Todo View"); 198 mTodoView->saveLayout(config,"Todo View");
199 } 199 }
200} 200}
201void KOViewManager::showNextView() 201void KOViewManager::showNextView()
202{ 202{
203 if (mCurrentView == mWhatsNextView) goto NEXT_X; 203 if (mCurrentView == mWhatsNextView) goto NEXT_X;
204 204
205 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; 205 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL;
206 206
207 if (mCurrentView == mJournalView ) goto DAY_1; 207 if (mCurrentView == mJournalView ) goto DAY_1;
208 208
209 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; 209 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5;
210 210
211 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; 211 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7;
212 212
213 if (mCurrentView == mAgendaView ) goto DAY_6; 213 if (mCurrentView == mAgendaView ) goto DAY_6;
214 214
215 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; 215 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH;
216 216
217 if (mCurrentView == mMonthView ) goto LIST; 217 if (mCurrentView == mMonthView ) goto LIST;
218 218
219 if (mCurrentView == mListView ) goto TODO; 219 if (mCurrentView == mListView ) goto TODO;
220 220
221 // if (mCurrentView == mTodoView ) goto LIST; 221 // if (mCurrentView == mTodoView ) goto LIST;
222 222
223 223
224 NEXT: 224 NEXT:
225 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} 225 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;}
226 NEXT_X: 226 NEXT_X:
227 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} 227 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;}
228 JOURNAL: 228 JOURNAL:
229 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;} 229 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;}
230 DAY_1: 230 DAY_1:
231 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} 231 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;}
232 DAY_5: 232 DAY_5:
233 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} 233 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;}
234 DAY_7: 234 DAY_7:
235 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} 235 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;}
236 DAY_6: 236 DAY_6:
237 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} 237 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;}
238 MONTH: 238 MONTH:
239 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} 239 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;}
240 LIST: 240 LIST:
241 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;} 241 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;}
242 TODO: 242 TODO:
243 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} 243 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;}
244 244
245 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} 245 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;}
246 246
247 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} 247 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;}
248 248
249 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;} 249 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;}
250 250
251 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} 251 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;}
252 252
253 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} 253 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;}
254 254
255 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} 255 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;}
256 256
257 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} 257 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;}
258 258
259 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} 259 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;}
260 260
261 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;} 261 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;}
262 262
263 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} 263 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;}
264 264
265 265
266 266
267} 267}
268void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 268void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
269{ 269{
270 270
271 //mFlagShowNextxDays = false; 271 //mFlagShowNextxDays = false;
272 //if(view == mCurrentView) return; 272 //if(view == mCurrentView) return;
273 if ( view == 0 ) { 273 if ( view == 0 ) {
274 view = mCurrentView; 274 view = mCurrentView;
275 if ( view == 0 ) 275 if ( view == 0 )
276 return; 276 return;
277 } 277 }
278 bool callupdate = !(view == mCurrentView); 278 bool callupdate = !(view == mCurrentView);
279 bool full = fullScreen; 279 bool full = fullScreen;
280 if(view == mCurrentView && view != mWhatsNextView ) { 280 if(view == mCurrentView && view != mWhatsNextView ) {
281 if ( mCurrentAgendaView < 0 ) 281 if ( mCurrentAgendaView < 0 )
282 return; 282 return;
283 if ( view != mMonthView ) 283 if ( view != mMonthView )
284 full = mMainView->leftFrame()->isVisible(); 284 full = mMainView->leftFrame()->isVisible();
285 } else { 285 } else {
286 if ( view == mMonthView && mMonthView) 286 if ( view == mMonthView && mMonthView)
287 ;//mMonthView->skipResize = true ; 287 ;//mMonthView->skipResize = true ;
288 mCurrentView = view; 288 mCurrentView = view;
289 // bool full = fullScreen; 289 // bool full = fullScreen;
290 bool isFull = !mMainView->leftFrame()->isVisible(); 290 bool isFull = !mMainView->leftFrame()->isVisible();
291 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 291 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
292 full = true; 292 full = true;
293 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 293 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
294 full = false; 294 full = false;
295 } 295 }
296 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 296 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
297 //raiseCurrentView( full ); 297 //raiseCurrentView( full );
298 mMainView->processIncidenceSelection( 0 ); 298 mMainView->processIncidenceSelection( 0 );
299 //mMainView->updateView(); 299 //mMainView->updateView();
300 raiseCurrentView( full, callupdate ); 300 raiseCurrentView( full, callupdate );
301 mMainView->adaptNavigationUnits(); 301 mMainView->adaptNavigationUnits();
302} 302}
303 303
304void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 304void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
305{ 305{
306 mCurrentAgendaView = 0; 306 mCurrentAgendaView = 0;
307 if ( fullScreen ) { 307 if ( fullScreen ) {
308 mMainView->leftFrame()->hide(); 308 mMainView->leftFrame()->hide();
309 } else { 309 } else {
310 mMainView->leftFrame()->show(); 310 mMainView->leftFrame()->show();
311 } 311 }
312 //if ( mCurrentView == mMonthView ) qApp->processEvents(); 312 //if ( mCurrentView == mMonthView ) qApp->processEvents();
313 emit signalFullScreen( !fullScreen ); 313 emit signalFullScreen( !fullScreen );
314 if ( callUpdateView ) 314 if ( callUpdateView )
315 mMainView->updateView(); 315 mMainView->updateView();
316 316
317 if ( globalFlagBlockAgenda == 5 ) { 317 if ( globalFlagBlockAgenda == 5 ) {
318 globalFlagBlockAgenda = 4; 318 globalFlagBlockAgenda = 4;
319 globalFlagBlockAgendaItemPaint = 1; 319 globalFlagBlockAgendaItemPaint = 1;
320 } 320 }
321 mMainView->viewStack()->raiseWidget(mCurrentView); 321 mMainView->viewStack()->raiseWidget(mCurrentView);
322 if ( globalFlagBlockAgenda == 4 ) { 322 if ( globalFlagBlockAgenda == 4 ) {
323 if ( mCurrentView == mAgendaView ) { 323 if ( mCurrentView == mAgendaView ) {
324 //globalFlagBlockAgenda =1 ; 324 //globalFlagBlockAgenda =1 ;
325 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 325 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
326 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 326 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
327 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 327 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
328 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 328 mAgendaView->setStartHour( QTime::currentTime ().hour() );
329 qApp->processEvents(); 329 qApp->processEvents();
330 //qDebug("qApp->processEvents() "); 330 //qDebug("qApp->processEvents() ");
331 globalFlagBlockAgenda = 0; 331 globalFlagBlockAgenda = 0;
332 mAgendaView->repaintAgenda(); 332 mAgendaView->repaintAgenda();
333 333
334 } 334 }
335 globalFlagBlockAgenda = 0; 335 globalFlagBlockAgenda = 0;
336 } 336 }
337 emit signalAgendaView( mCurrentView == mAgendaView ); 337 emit signalAgendaView( mCurrentView == mAgendaView );
338 //qDebug("raiseCurrentView ende "); 338 //qDebug("raiseCurrentView ende ");
339 339
340} 340}
341 341
342void KOViewManager::updateView() 342void KOViewManager::updateView()
343{ 343{
344 // qDebug("KOViewManager::updateView() "); 344 // qDebug("KOViewManager::updateView() ");
345 // if we are updating mTodoView, we get endless recursion 345 // if we are updating mTodoView, we get endless recursion
346 if ( mTodoView == mCurrentView ) 346 if ( mTodoView == mCurrentView )
347 return; 347 return;
348 if ( mCurrentView ) mCurrentView->updateView(); 348 if ( mCurrentView ) mCurrentView->updateView();
349 349
350} 350}
351 351
352void KOViewManager::updateView(const QDate &start, const QDate &end) 352void KOViewManager::updateView(const QDate &start, const QDate &end)
353{ 353{
354 // kdDebug() << "KOViewManager::updateView()" << endl; 354 // kdDebug() << "KOViewManager::updateView()" << endl;
355 355
356 if (mCurrentView) mCurrentView->showDates(start, end); 356 if (mCurrentView) mCurrentView->showDates(start, end);
357 357
358 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 358 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
359} 359}
360 360
361 361
362void KOViewManager::updateWNview() 362void KOViewManager::updateWNview()
363{ 363{
364 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 364 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
365 mWhatsNextView->updateView(); 365 mWhatsNextView->updateView();
366 366
367} 367}
368void KOViewManager::showWhatsNextView() 368void KOViewManager::showWhatsNextView()
369{ 369{
370 if (!mWhatsNextView) { 370 if (!mWhatsNextView) {
371 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 371 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
372 "KOViewManager::WhatsNextView"); 372 "KOViewManager::WhatsNextView");
373 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 373 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
374 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 374 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
375 addView(mWhatsNextView); 375 addView(mWhatsNextView);
376 connect(this, SIGNAL( printWNV() ), 376 connect(this, SIGNAL( printWNV() ),
377 mWhatsNextView, SLOT( printMe() ) ); 377 mWhatsNextView, SLOT( printMe() ) );
378 } 378 }
379 globalFlagBlockAgenda = 1; 379 globalFlagBlockAgenda = 1;
380 showView(mWhatsNextView, true ); 380 showView(mWhatsNextView, true );
381 //mWhatsNextView->updateView(); 381 //mWhatsNextView->updateView();
382 382
383} 383}
384 384
385void KOViewManager::slotprintWNV()
386{
387 if (!mWhatsNextView)
388 showWhatsNextView();
389 emit printWNV();
390
391}
385void KOViewManager::showListView() 392void KOViewManager::showListView()
386{ 393{
387 if (!mListView) { 394 if (!mListView) {
388 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 395 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
389 addView(mListView); 396 addView(mListView);
390 397
391 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 398 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
392 mMainView, SLOT(showIncidence(Incidence *))); 399 mMainView, SLOT(showIncidence(Incidence *)));
393 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 400 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
394 mMainView, SLOT(editIncidence(Incidence *))); 401 mMainView, SLOT(editIncidence(Incidence *)));
395 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 402 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
396 mMainView, SLOT(deleteIncidence(Incidence *))); 403 mMainView, SLOT(deleteIncidence(Incidence *)));
397 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 404 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
398 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 405 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
399 connect( mListView, SIGNAL( signalNewEvent() ), 406 connect( mListView, SIGNAL( signalNewEvent() ),
400 mMainView, SLOT( newEvent() ) ); 407 mMainView, SLOT( newEvent() ) );
401 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 408 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
402 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 409 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
403 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 410 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
404 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 411 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
405 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 412 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
406 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 413 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
407 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 414 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
408 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 415 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
409 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 416 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
410 } 417 }
411 // bool temp = mFlagShowNextxDays; 418 // bool temp = mFlagShowNextxDays;
412 //globalFlagBlockPainting = true; 419 //globalFlagBlockPainting = true;
413 globalFlagBlockAgenda = 1; 420 globalFlagBlockAgenda = 1;
414 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 421 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
415 mMainView->setBlockShowDates( true ); 422 mMainView->setBlockShowDates( true );
416 mMainView->dateNavigator()->selectMonth(); 423 mMainView->dateNavigator()->selectMonth();
417 mMainView->setBlockShowDates( false ); 424 mMainView->setBlockShowDates( false );
418 } 425 }
419 showView(mListView, KOPrefs::instance()->mFullViewTodo); 426 showView(mListView, KOPrefs::instance()->mFullViewTodo);
420 //mFlagShowNextxDays = temp; 427 //mFlagShowNextxDays = temp;
421} 428}
422 429
423void KOViewManager::showAgendaView( bool fullScreen ) 430void KOViewManager::showAgendaView( bool fullScreen )
424{ 431{
425 432
426 mMainView->dialogManager()->hideSearchDialog(); 433 mMainView->dialogManager()->hideSearchDialog();
427 // qDebug("KOViewManager::showAgendaView "); 434 // qDebug("KOViewManager::showAgendaView ");
428 bool full; 435 bool full;
429 full = fullScreen; 436 full = fullScreen;
430 if (!mAgendaView) { 437 if (!mAgendaView) {
431 full = false; 438 full = false;
432 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 439 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
433 addView(mAgendaView); 440 addView(mAgendaView);
434#ifndef DESKTOP_VERSION 441#ifndef DESKTOP_VERSION
435 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 442 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
436#endif 443#endif
437 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 444 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
438 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 445 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
439 446
440 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 447 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
441 448
442 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); 449 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate )));
443 450
444 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), 451 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)),
445 mMainView, SLOT(newTodoDateTime(QDateTime,bool))); 452 mMainView, SLOT(newTodoDateTime(QDateTime,bool)));
446 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 453 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
447 mMainView, SLOT(newEvent(QDateTime))); 454 mMainView, SLOT(newEvent(QDateTime)));
448 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 455 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
449 mMainView, SLOT(newEvent(QDateTime,QDateTime))); 456 mMainView, SLOT(newEvent(QDateTime,QDateTime)));
450 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 457 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
451 mMainView, SLOT(newEvent(QDate))); 458 mMainView, SLOT(newEvent(QDate)));
452 459
453 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 460 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
454 mMainView, SLOT(editIncidence(Incidence *))); 461 mMainView, SLOT(editIncidence(Incidence *)));
455 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 462 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
456 mMainView, SLOT(showIncidence(Incidence *))); 463 mMainView, SLOT(showIncidence(Incidence *)));
457 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 464 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
458 mMainView, SLOT(deleteIncidence(Incidence *))); 465 mMainView, SLOT(deleteIncidence(Incidence *)));
459 466
460 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 467 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
461 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 468 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
462 469
463 connect(mAgendaView, SIGNAL( toggleExpand() ), 470 connect(mAgendaView, SIGNAL( toggleExpand() ),
464 mMainView, SLOT( toggleExpand() ) ); 471 mMainView, SLOT( toggleExpand() ) );
465 472
466 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 473 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
467 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 474 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
468 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 475 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
469 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 476 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
470 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 477 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
471 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 478 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
472 SLOT( updateTodo( Todo *, int ) ) ); 479 SLOT( updateTodo( Todo *, int ) ) );
473 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 480 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
474 mMainView, SIGNAL( todoModified( Todo *, int ))); 481 mMainView, SIGNAL( todoModified( Todo *, int )));
475 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 482 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
476 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 483 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
477 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 484 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
478 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 485 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
479 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), 486 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
480 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 487 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
481 mAgendaView->readSettings(); 488 mAgendaView->readSettings();
482 mAgendaView->updateConfig(); 489 mAgendaView->updateConfig();
483 } 490 }
484 491
485 showView( mAgendaView, full); 492 showView( mAgendaView, full);
486 493
487} 494}
488 495
489void KOViewManager::showDayView() 496void KOViewManager::showDayView()
490{ 497{
491 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 498 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
492 mFlagShowNextxDays = false; 499 mFlagShowNextxDays = false;
493 globalFlagBlockLabel = 1; 500 globalFlagBlockLabel = 1;
494 globalFlagBlockAgenda = 1; 501 globalFlagBlockAgenda = 1;
495 if ( mCurrentAgendaView != 1 ) 502 if ( mCurrentAgendaView != 1 )
496 mCurrentAgendaView = -1; 503 mCurrentAgendaView = -1;
497 showAgendaView(); 504 showAgendaView();
498 qApp->processEvents(); 505 qApp->processEvents();
499 globalFlagBlockAgenda = 2; 506 globalFlagBlockAgenda = 2;
500 globalFlagBlockLabel = 0; 507 globalFlagBlockLabel = 0;
501 mMainView->dateNavigator()->selectDates( 1 ); 508 mMainView->dateNavigator()->selectDates( 1 );
502 mCurrentAgendaView = 1 ; 509 mCurrentAgendaView = 1 ;
503 510
504} 511}
505 512
506void KOViewManager::showWorkWeekView() 513void KOViewManager::showWorkWeekView()
507{ 514{
508 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 515 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
509 mFlagShowNextxDays = false; 516 mFlagShowNextxDays = false;
510 globalFlagBlockAgenda = 1; 517 globalFlagBlockAgenda = 1;
511 globalFlagBlockLabel = 1; 518 globalFlagBlockLabel = 1;
512 if ( mCurrentAgendaView != 5 ) 519 if ( mCurrentAgendaView != 5 )
513 mCurrentAgendaView = -1; 520 mCurrentAgendaView = -1;
514 showAgendaView(); 521 showAgendaView();
515 qApp->processEvents(); 522 qApp->processEvents();
516 globalFlagBlockAgenda = 2; 523 globalFlagBlockAgenda = 2;
517 globalFlagBlockLabel = 0; 524 globalFlagBlockLabel = 0;
518 mMainView->dateNavigator()->selectWorkWeek(); 525 mMainView->dateNavigator()->selectWorkWeek();
519 mCurrentAgendaView = 5 ; 526 mCurrentAgendaView = 5 ;
520 527
521} 528}
522 529
523void KOViewManager::showWeekView() 530void KOViewManager::showWeekView()
524{ 531{
525 /* 532 /*
526 globalFlagBlockAgenda = 2; 533 globalFlagBlockAgenda = 2;
527 qDebug("4globalFlagBlockAgenda = 2; "); 534 qDebug("4globalFlagBlockAgenda = 2; ");
528 //globalFlagBlockPainting = true; 535 //globalFlagBlockPainting = true;
529 mMainView->dateNavigator()->selectWeek(); 536 mMainView->dateNavigator()->selectWeek();
530 showAgendaView(); 537 showAgendaView();
531 */ 538 */
532 539
533 540
534 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 541 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
535 mFlagShowNextxDays = false; 542 mFlagShowNextxDays = false;
536 globalFlagBlockAgenda = 1; 543 globalFlagBlockAgenda = 1;
537 globalFlagBlockLabel = 1; 544 globalFlagBlockLabel = 1;
538 if ( mCurrentAgendaView != 7 ) 545 if ( mCurrentAgendaView != 7 )
539 mCurrentAgendaView = -1; 546 mCurrentAgendaView = -1;
540 showAgendaView(); 547 showAgendaView();
541 qApp->processEvents(); 548 qApp->processEvents();
542 globalFlagBlockAgenda = 2; 549 globalFlagBlockAgenda = 2;
543 globalFlagBlockLabel = 0; 550 globalFlagBlockLabel = 0;
544 mMainView->dateNavigator()->selectWeek(); 551 mMainView->dateNavigator()->selectWeek();
545 mCurrentAgendaView = 7 ; 552 mCurrentAgendaView = 7 ;
546} 553}
547 554
548void KOViewManager::showNextXView() 555void KOViewManager::showNextXView()
549{ 556{
550 557
551 globalFlagBlockAgenda = 1; 558 globalFlagBlockAgenda = 1;
552 if ( mCurrentAgendaView != 3 ) 559 if ( mCurrentAgendaView != 3 )
553 mCurrentAgendaView = -1; 560 mCurrentAgendaView = -1;
554 showAgendaView(KOPrefs::instance()->mFullViewMonth); 561 showAgendaView(KOPrefs::instance()->mFullViewMonth);
555 globalFlagBlockAgenda = 2; 562 globalFlagBlockAgenda = 2;
556 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 563 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
557 KOPrefs::instance()->mNextXDays ); 564 KOPrefs::instance()->mNextXDays );
558 mFlagShowNextxDays = true; 565 mFlagShowNextxDays = true;
559 mCurrentAgendaView = 3 ; 566 mCurrentAgendaView = 3 ;
560} 567}
561bool KOViewManager::showsNextDays() 568bool KOViewManager::showsNextDays()
562{ 569{
563 return mFlagShowNextxDays; 570 return mFlagShowNextxDays;
564} 571}
565void KOViewManager::createMonthView() 572void KOViewManager::createMonthView()
566{ 573{
567if (!mMonthView) { 574if (!mMonthView) {
568 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 575 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
569 576
570 addView(mMonthView); 577 addView(mMonthView);
571 // mMonthView->show(); 578 // mMonthView->show();
572 // SIGNALS/SLOTS FOR MONTH VIEW 579 // SIGNALS/SLOTS FOR MONTH VIEW
573 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 580 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
574 mMainView, SLOT(newEvent(QDateTime))); 581 mMainView, SLOT(newEvent(QDateTime)));
575 582
576 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 583 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
577 mMainView, SLOT(showIncidence(Incidence *))); 584 mMainView, SLOT(showIncidence(Incidence *)));
578 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 585 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
579 mMainView, SLOT(editIncidence(Incidence *))); 586 mMainView, SLOT(editIncidence(Incidence *)));
580 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 587 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
581 mMainView, SLOT(deleteIncidence(Incidence *))); 588 mMainView, SLOT(deleteIncidence(Incidence *)));
582 589
583 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 590 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
584 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 591 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
585 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 592 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
586 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 593 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
587 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 594 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
588 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 595 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
589 596
590 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 597 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
591 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 598 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
592 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 599 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
593 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 600 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
594 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 601 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
595 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); 602 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) );
596 connect( mMonthView, SIGNAL( selectMonth() ), 603 connect( mMonthView, SIGNAL( selectMonth() ),
597 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); 604 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) );
598 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 605 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
599 mMainView, SLOT ( showDay( QDate ) ) ); 606 mMainView, SLOT ( showDay( QDate ) ) );
600 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 607 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
601 connect( mMonthView, SIGNAL(nextMonth() ), 608 connect( mMonthView, SIGNAL(nextMonth() ),
602 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); 609 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) );
603 connect( mMonthView, SIGNAL(prevMonth() ), 610 connect( mMonthView, SIGNAL(prevMonth() ),
604 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 611 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) );
605 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), 612 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ),
606 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); 613 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) );
607 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), 614 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ),
608 mMainView->dateNavigator(), SLOT( selectNextYear() ) ); 615 mMainView->dateNavigator(), SLOT( selectNextYear() ) );
609 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), 616 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ),
610 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); 617 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) );
611 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), 618 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ),
612 mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); 619 mMainView->dateNavigator(), SLOT( selectNextMonth() ) );
613 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), 620 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ),
614 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); 621 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) );
615 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), 622 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ),
616 mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); 623 mMainView->dateNavigator(), SLOT( selectNextWeek() ) );
617 624
618 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 625 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
619 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); 626 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) );
620 627
621 628
622 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), 629 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
623 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); 630 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
624 631
625 } 632 }
626} 633}
627void KOViewManager::showMonthViewWeek() 634void KOViewManager::showMonthViewWeek()
628{ 635{
629 createMonthView(); 636 createMonthView();
630 globalFlagBlockAgenda = 1; 637 globalFlagBlockAgenda = 1;
631 bool full = true; 638 bool full = true;
632 if ( mCurrentView == mMonthView) 639 if ( mCurrentView == mMonthView)
633 full = mMainView->leftFrame()->isVisible(); 640 full = mMainView->leftFrame()->isVisible();
634 if ( !KOPrefs::instance()->mMonthViewWeek ) { 641 if ( !KOPrefs::instance()->mMonthViewWeek ) {
635 mMonthView->switchView(); 642 mMonthView->switchView();
636 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 643 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
637 full = false; 644 full = false;
638 else 645 else
639 full = true; 646 full = true;
640 } 647 }
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index d829f14..1d565a6 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -1,122 +1,123 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 3 Copyright (c) 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef KOVIEWMANAGER_H 24#ifndef KOVIEWMANAGER_H
25#define KOVIEWMANAGER_H 25#define KOVIEWMANAGER_H
26 26
27#include <qobject.h> 27#include <qobject.h>
28 28
29#include <korganizer/baseview.h> 29#include <korganizer/baseview.h>
30 30
31class CalendarView; 31class CalendarView;
32 32
33class KOListView; 33class KOListView;
34class KOAgendaView; 34class KOAgendaView;
35class KOMonthView; 35class KOMonthView;
36class KOTimeSpanView; 36class KOTimeSpanView;
37class KOTodoView; 37class KOTodoView;
38class KOWhatsNextView; 38class KOWhatsNextView;
39class KOJournalView; 39class KOJournalView;
40 40
41using namespace KCal; 41using namespace KCal;
42 42
43/** 43/**
44 This class manages the views of the calendar. It owns the objects and handles 44 This class manages the views of the calendar. It owns the objects and handles
45 creation and selection. 45 creation and selection.
46*/ 46*/
47class KOViewManager : public QObject 47class KOViewManager : public QObject
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOViewManager( CalendarView * ); 51 KOViewManager( CalendarView * );
52 virtual ~KOViewManager(); 52 virtual ~KOViewManager();
53 53
54 /** changes the view to be the currently selected view */ 54 /** changes the view to be the currently selected view */
55 void showView(KOrg::BaseView *, bool fullScreen = false ); 55 void showView(KOrg::BaseView *, bool fullScreen = false );
56 void updateWNview(); 56 void updateWNview();
57 void readSettings(KConfig *config); 57 void readSettings(KConfig *config);
58 void writeSettings(KConfig *config); 58 void writeSettings(KConfig *config);
59 bool showsNextDays(); 59 bool showsNextDays();
60 /** Read which view was shown last from config file */ 60 /** Read which view was shown last from config file */
61 void readCurrentView(KConfig *); 61 void readCurrentView(KConfig *);
62 /** Write which view is currently shown to config file */ 62 /** Write which view is currently shown to config file */
63 void writeCurrentView(KConfig *); 63 void writeCurrentView(KConfig *);
64 64
65 KOrg::BaseView *currentView(); 65 KOrg::BaseView *currentView();
66 66
67 void setDocumentId( const QString & ); 67 void setDocumentId( const QString & );
68 68
69 void updateView( const QDate &start, const QDate &end ); 69 void updateView( const QDate &start, const QDate &end );
70 70
71 void raiseCurrentView( bool fullScreen = false , bool updateView = false); 71 void raiseCurrentView( bool fullScreen = false , bool updateView = false);
72 72
73 void addView(KOrg::BaseView *); 73 void addView(KOrg::BaseView *);
74 74
75 Incidence *currentSelection(); 75 Incidence *currentSelection();
76 QDate currentSelectionDate(); 76 QDate currentSelectionDate();
77 77
78 KOAgendaView *agendaView() const { return mAgendaView; } 78 KOAgendaView *agendaView() const { return mAgendaView; }
79 79
80 signals: 80 signals:
81 void printWNV(); 81 void printWNV();
82 void signalFullScreen( bool ); 82 void signalFullScreen( bool );
83 void signalAgendaView( bool ); 83 void signalAgendaView( bool );
84 public slots: 84 public slots:
85 void slotprintWNV();
85 void showNextView(); 86 void showNextView();
86 void showMonth( const QDate & ); 87 void showMonth( const QDate & );
87 void showDateView( int, QDate ); 88 void showDateView( int, QDate );
88 void updateView(); 89 void updateView();
89 void showWhatsNextView(); 90 void showWhatsNextView();
90 void showListView(); 91 void showListView();
91 void showAgendaView( bool fullScreen = false ); 92 void showAgendaView( bool fullScreen = false );
92 void showDayView(); 93 void showDayView();
93 void showWorkWeekView(); 94 void showWorkWeekView();
94 void showWeekView(); 95 void showWeekView();
95 void showNextXView(); 96 void showNextXView();
96 void showMonthView(); 97 void showMonthView();
97 void showMonthViewWeek(); 98 void showMonthViewWeek();
98 void showTodoView(); 99 void showTodoView();
99 void showJournalView(); 100 void showJournalView();
100 void showTimeSpanView(); 101 void showTimeSpanView();
101 102
102 private: 103 private:
103 void createMonthView(); 104 void createMonthView();
104 CalendarView *mMainView; 105 CalendarView *mMainView;
105 106
106 int mCurrentAgendaView; 107 int mCurrentAgendaView;
107 KOAgendaView *mAgendaView; 108 KOAgendaView *mAgendaView;
108 KOListView *mListView; 109 KOListView *mListView;
109 KOMonthView *mMonthView; 110 KOMonthView *mMonthView;
110 KOTodoView *mTodoView; 111 KOTodoView *mTodoView;
111 KOWhatsNextView *mWhatsNextView; 112 KOWhatsNextView *mWhatsNextView;
112 KOJournalView *mJournalView; 113 KOJournalView *mJournalView;
113 KOTimeSpanView *mTimeSpanView; 114 KOTimeSpanView *mTimeSpanView;
114 115
115 KOrg::BaseView *mCurrentView; // currently active event view 116 KOrg::BaseView *mCurrentView; // currently active event view
116 117
117 int mAgendaViewMode; 118 int mAgendaViewMode;
118 bool mFlagShowNextxDays; 119 bool mFlagShowNextxDays;
119 120
120}; 121};
121 122
122#endif 123#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index a4e0834..ad1c0cd 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,606 +1,611 @@
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 "ktoolbar.h" 60#include "ktoolbar.h"
61#include "klocale.h" 61#include "klocale.h"
62#include "kconfig.h" 62#include "kconfig.h"
63#include "simplealarmclient.h" 63#include "simplealarmclient.h"
64#include "externalapphandler.h" 64#include "externalapphandler.h"
65 65
66using namespace KCal; 66using namespace KCal;
67#ifndef _WIN32_ 67#ifndef _WIN32_
68#include <unistd.h> 68#include <unistd.h>
69#else 69#else
70#ifdef _OL_IMPORT_ 70#ifdef _OL_IMPORT_
71#include "koimportoldialog.h" 71#include "koimportoldialog.h"
72#endif 72#endif
73#endif 73#endif
74#include "mainwindow.h" 74#include "mainwindow.h"
75 75
76 76
77class KOex2phonePrefs : public QDialog 77class KOex2phonePrefs : public QDialog
78{ 78{
79 public: 79 public:
80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
81 QDialog( parent, name, true ) 81 QDialog( parent, name, true )
82 { 82 {
83 setCaption( i18n("Export to phone options") ); 83 setCaption( i18n("Export to phone options") );
84 QVBoxLayout* lay = new QVBoxLayout( this ); 84 QVBoxLayout* lay = new QVBoxLayout( this );
85 lay->setSpacing( 3 ); 85 lay->setSpacing( 3 );
86 lay->setMargin( 3 ); 86 lay->setMargin( 3 );
87 QLabel *lab; 87 QLabel *lab;
88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
89 lab->setAlignment (AlignHCenter ); 89 lab->setAlignment (AlignHCenter );
90 QHBox* temphb; 90 QHBox* temphb;
91 temphb = new QHBox( this ); 91 temphb = new QHBox( this );
92 new QLabel( i18n("I/O device: "), temphb ); 92 new QLabel( i18n("I/O device: "), temphb );
93 mPhoneDevice = new QLineEdit( temphb); 93 mPhoneDevice = new QLineEdit( temphb);
94 lay->addWidget( temphb ); 94 lay->addWidget( temphb );
95 temphb = new QHBox( this ); 95 temphb = new QHBox( this );
96 new QLabel( i18n("Connection: "), temphb ); 96 new QLabel( i18n("Connection: "), temphb );
97 mPhoneConnection = new QLineEdit( temphb); 97 mPhoneConnection = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 98 lay->addWidget( temphb );
99 temphb = new QHBox( this ); 99 temphb = new QHBox( this );
100 new QLabel( i18n("Model(opt.): "), temphb ); 100 new QLabel( i18n("Model(opt.): "), temphb );
101 mPhoneModel = new QLineEdit( temphb); 101 mPhoneModel = new QLineEdit( temphb);
102 lay->addWidget( temphb ); 102 lay->addWidget( temphb );
103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
104 mWriteBackFuture->setChecked( true ); 104 mWriteBackFuture->setChecked( true );
105 lay->addWidget( mWriteBackFuture ); 105 lay->addWidget( mWriteBackFuture );
106 temphb = new QHBox( this ); 106 temphb = new QHBox( this );
107 new QLabel( i18n("Max. weeks in future: ") , temphb ); 107 new QLabel( i18n("Max. weeks in future: ") , temphb );
108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
109 mWriteBackFutureWeeks->setValue( 8 ); 109 mWriteBackFutureWeeks->setValue( 8 );
110 lay->addWidget( temphb ); 110 lay->addWidget( temphb );
111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
112 lab->setAlignment (AlignHCenter ); 112 lab->setAlignment (AlignHCenter );
113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
114 lay->addWidget( ok ); 114 lay->addWidget( ok );
115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
116 lay->addWidget( cancel ); 116 lay->addWidget( cancel );
117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
119 resize( 220, 240 ); 119 resize( 220, 240 );
120 qApp->processEvents(); 120 qApp->processEvents();
121 int dw = QApplication::desktop()->width(); 121 int dw = QApplication::desktop()->width();
122 int dh = QApplication::desktop()->height(); 122 int dh = QApplication::desktop()->height();
123 move( (dw-width())/2, (dh - height() )/2 ); 123 move( (dw-width())/2, (dh - height() )/2 );
124 } 124 }
125 125
126public: 126public:
127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
128 QCheckBox* mWriteBackFuture; 128 QCheckBox* mWriteBackFuture;
129 QSpinBox* mWriteBackFutureWeeks; 129 QSpinBox* mWriteBackFutureWeeks;
130}; 130};
131 131
132int globalFlagBlockStartup; 132int globalFlagBlockStartup;
133MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 133MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
134 QMainWindow( parent, name ) 134 QMainWindow( parent, name )
135{ 135{
136 136
137 mClosed = false; 137 mClosed = false;
138 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 138 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
139 QString confFile = locateLocal("config","korganizerrc"); 139 QString confFile = locateLocal("config","korganizerrc");
140 QFileInfo finf ( confFile ); 140 QFileInfo finf ( confFile );
141 bool showWarning = !finf.exists(); 141 bool showWarning = !finf.exists();
142 setIcon(SmallIcon( "ko24" ) ); 142 setIcon(SmallIcon( "ko24" ) );
143 mBlockAtStartup = true; 143 mBlockAtStartup = true;
144 mFlagKeyPressed = false; 144 mFlagKeyPressed = false;
145 setCaption("KO/Pi"); 145 setCaption("KO/Pi");
146 KOPrefs *p = KOPrefs::instance(); 146 KOPrefs *p = KOPrefs::instance();
147 KPimGlobalPrefs::instance()->setGlobalConfig(); 147 KPimGlobalPrefs::instance()->setGlobalConfig();
148 if ( p->mHourSize > 22 ) 148 if ( p->mHourSize > 22 )
149 p->mHourSize = 22; 149 p->mHourSize = 22;
150 QMainWindow::ToolBarDock tbd; 150 QMainWindow::ToolBarDock tbd;
151 if ( p->mToolBarHor ) { 151 if ( p->mToolBarHor ) {
152 if ( p->mToolBarUp ) 152 if ( p->mToolBarUp )
153 tbd = Bottom; 153 tbd = Bottom;
154 else 154 else
155 tbd = Top; 155 tbd = Top;
156 } 156 }
157 else { 157 else {
158 if ( p->mToolBarUp ) 158 if ( p->mToolBarUp )
159 tbd = Right; 159 tbd = Right;
160 else 160 else
161 tbd = Left; 161 tbd = Left;
162 } 162 }
163 if ( KOPrefs::instance()->mUseAppColors ) 163 if ( KOPrefs::instance()->mUseAppColors )
164 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 164 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
165 globalFlagBlockStartup = 1; 165 globalFlagBlockStartup = 1;
166 iconToolBar = new QPEToolBar( this ); 166 iconToolBar = new QPEToolBar( this );
167 addToolBar (iconToolBar , tbd ); 167 addToolBar (iconToolBar , tbd );
168 168
169 if ( KOPrefs::instance()->mShowIconFilter ) { 169 if ( KOPrefs::instance()->mShowIconFilter ) {
170 if ( p->mToolBarHorF ) { 170 if ( p->mToolBarHorF ) {
171 if ( p->mToolBarUpF ) 171 if ( p->mToolBarUpF )
172 tbd = Bottom; 172 tbd = Bottom;
173 else 173 else
174 tbd = Top; 174 tbd = Top;
175 } 175 }
176 else { 176 else {
177 if ( p->mToolBarUpF ) 177 if ( p->mToolBarUpF )
178 tbd = Right; 178 tbd = Right;
179 else 179 else
180 tbd = Left; 180 tbd = Left;
181 } 181 }
182 filterToolBar = new QPEToolBar ( this ); 182 filterToolBar = new QPEToolBar ( this );
183 filterMenubar = new QPEMenuBar( filterToolBar ); 183 filterMenubar = new QPEMenuBar( filterToolBar );
184 QFontMetrics fm ( filterMenubar->font() ); 184 QFontMetrics fm ( filterMenubar->font() );
185 185
186 filterPopupMenu = new QPopupMenu( this ); 186 filterPopupMenu = new QPopupMenu( this );
187 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 187 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
188 filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+"Ax" ) ); 188 QString addTest = "Ax";
189#ifdef DESKTOP_VERSION
190 addTest = "AAAx";
191#endif
192 filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) );
189 addToolBar (filterToolBar , tbd ); 193 addToolBar (filterToolBar , tbd );
190 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 194 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
191 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 195 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
192 } else { 196 } else {
193 filterToolBar = 0; 197 filterToolBar = 0;
194 filterMenubar = 0; 198 filterMenubar = 0;
195 filterPopupMenu = 0; 199 filterPopupMenu = 0;
196 } 200 }
197 if ( p->mShowIconOnetoolbar ) { 201 if ( p->mShowIconOnetoolbar ) {
198 viewToolBar = iconToolBar ; 202 viewToolBar = iconToolBar ;
199 navigatorToolBar = iconToolBar ; 203 navigatorToolBar = iconToolBar ;
200 } else { 204 } else {
201 if ( p->mToolBarHorV ) { 205 if ( p->mToolBarHorV ) {
202 if ( p->mToolBarUpV ) 206 if ( p->mToolBarUpV )
203 tbd = Bottom; 207 tbd = Bottom;
204 else 208 else
205 tbd = Top; 209 tbd = Top;
206 } 210 }
207 else { 211 else {
208 if ( p->mToolBarUpV ) 212 if ( p->mToolBarUpV )
209 tbd = Right; 213 tbd = Right;
210 else 214 else
211 tbd = Left; 215 tbd = Left;
212 } 216 }
213 viewToolBar = new QPEToolBar( this ); 217 viewToolBar = new QPEToolBar( this );
214 addToolBar (viewToolBar , tbd ); 218 addToolBar (viewToolBar , tbd );
215 if ( p->mToolBarHorN ) { 219 if ( p->mToolBarHorN ) {
216 if ( p->mToolBarUpN ) 220 if ( p->mToolBarUpN )
217 tbd = Bottom; 221 tbd = Bottom;
218 else 222 else
219 tbd = Top; 223 tbd = Top;
220 } 224 }
221 else { 225 else {
222 if ( p->mToolBarUpN ) 226 if ( p->mToolBarUpN )
223 tbd = Right; 227 tbd = Right;
224 else 228 else
225 tbd = Left; 229 tbd = Left;
226 } 230 }
227 navigatorToolBar = new QPEToolBar( this ); 231 navigatorToolBar = new QPEToolBar( this );
228 addToolBar (navigatorToolBar , tbd ); 232 addToolBar (navigatorToolBar , tbd );
229 } 233 }
230 234
231 235
232 236
233 mCalendarModifiedFlag = false; 237 mCalendarModifiedFlag = false;
234 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 238 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
235 splash->setAlignment ( AlignCenter ); 239 splash->setAlignment ( AlignCenter );
236 setCentralWidget( splash ); 240 setCentralWidget( splash );
237#ifndef DESKTOP_VERSION 241#ifndef DESKTOP_VERSION
238 showMaximized(); 242 showMaximized();
239#endif 243#endif
240 244
241 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 245 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
242 setDefaultPreferences(); 246 setDefaultPreferences();
243 mCalendar = new CalendarLocal(); 247 mCalendar = new CalendarLocal();
244 mView = new CalendarView( mCalendar, this,"mCalendar " ); 248 mView = new CalendarView( mCalendar, this,"mCalendar " );
245 mView->hide(); 249 mView->hide();
246 //mView->resize(splash->size() ); 250 //mView->resize(splash->size() );
247 initActions(); 251 initActions();
248 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 252 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
249 mSyncManager->setBlockSave(false); 253 mSyncManager->setBlockSave(false);
250 mView->setSyncManager(mSyncManager); 254 mView->setSyncManager(mSyncManager);
251#ifndef DESKTOP_VERSION 255#ifndef DESKTOP_VERSION
252 iconToolBar->show(); 256 iconToolBar->show();
253 qApp->processEvents(); 257 qApp->processEvents();
254#endif 258#endif
255 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 259 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
256 int vh = height() ; 260 int vh = height() ;
257 int vw = width(); 261 int vw = width();
258 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 262 //qDebug("Toolbar hei %d ",iconToolBar->height() );
259 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 263 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
260 vh -= iconToolBar->height(); 264 vh -= iconToolBar->height();
261 } else { 265 } else {
262 vw -= iconToolBar->height(); 266 vw -= iconToolBar->height();
263 } 267 }
264 //mView->setMaximumSize( splash->size() ); 268 //mView->setMaximumSize( splash->size() );
265 //mView->resize( splash->size() ); 269 //mView->resize( splash->size() );
266 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 270 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
267 mView->readSettings(); 271 mView->readSettings();
268 bool newFile = false; 272 bool newFile = false;
269 if( !QFile::exists( defaultFileName() ) ) { 273 if( !QFile::exists( defaultFileName() ) ) {
270 QFileInfo finfo ( defaultFileName() ); 274 QFileInfo finfo ( defaultFileName() );
271 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 275 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
272 qDebug("oldfile %s ", oldFile.latin1()); 276 qDebug("oldfile %s ", oldFile.latin1());
273 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"; 277 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";
274 finfo.setFile( oldFile ); 278 finfo.setFile( oldFile );
275 if (finfo.exists() ) { 279 if (finfo.exists() ) {
276 KMessageBox::information( this, message); 280 KMessageBox::information( this, message);
277 mView->openCalendar( oldFile ); 281 mView->openCalendar( oldFile );
278 qApp->processEvents(); 282 qApp->processEvents();
279 } else { 283 } else {
280 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 284 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
281 finfo.setFile( oldFile ); 285 finfo.setFile( oldFile );
282 if (finfo.exists() ) { 286 if (finfo.exists() ) {
283 KMessageBox::information( this, message); 287 KMessageBox::information( this, message);
284 mView->openCalendar( oldFile ); 288 mView->openCalendar( oldFile );
285 qApp->processEvents(); 289 qApp->processEvents();
286 } 290 }
287 } 291 }
288 mView->saveCalendar( defaultFileName() ); 292 mView->saveCalendar( defaultFileName() );
289 newFile = true; 293 newFile = true;
290 } 294 }
291 295
292 QTime neededSaveTime = QDateTime::currentDateTime().time(); 296 QTime neededSaveTime = QDateTime::currentDateTime().time();
293 mView->openCalendar( defaultFileName() ); 297 mView->openCalendar( defaultFileName() );
294 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 298 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
295 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 299 qDebug("KO: Calendar loading time: %d ms",msNeeded );
296 300
297 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 301 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
298 KOPrefs::instance()->setAllDefaults(); 302 KOPrefs::instance()->setAllDefaults();
299 int count = mView->addCategories(); 303 int count = mView->addCategories();
300 } 304 }
301 processIncidenceSelection( 0 ); 305 processIncidenceSelection( 0 );
302 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 306 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
303 SLOT( processIncidenceSelection( Incidence * ) ) ); 307 SLOT( processIncidenceSelection( Incidence * ) ) );
304 connect( mView, SIGNAL( modifiedChanged( bool ) ), 308 connect( mView, SIGNAL( modifiedChanged( bool ) ),
305 SLOT( slotModifiedChanged( bool ) ) ); 309 SLOT( slotModifiedChanged( bool ) ) );
306 310
307 311
308 connect( mView, SIGNAL( tempDisableBR(bool) ), 312 connect( mView, SIGNAL( tempDisableBR(bool) ),
309 SLOT( disableBR(bool) ) ); 313 SLOT( disableBR(bool) ) );
310 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 314 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
311 mView->setModified( false ); 315 mView->setModified( false );
312 mBlockAtStartup = false; 316 mBlockAtStartup = false;
313 mView->setModified( false ); 317 mView->setModified( false );
314 setCentralWidget( mView ); 318 setCentralWidget( mView );
315 globalFlagBlockStartup = 0; 319 globalFlagBlockStartup = 0;
316 mView->show(); 320 mView->show();
317 delete splash; 321 delete splash;
318 if ( newFile ) 322 if ( newFile )
319 mView->updateConfig(); 323 mView->updateConfig();
320 // qApp->processEvents(); 324 // qApp->processEvents();
321 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 325 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
322 //fillSyncMenu(); 326 //fillSyncMenu();
323 327
324 328
325 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 329 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
326 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 330 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
327 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 331 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
328 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 332 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
329 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 333 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
330 mSyncManager->setDefaultFileName( sentSyncFile()); 334 mSyncManager->setDefaultFileName( sentSyncFile());
331 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 335 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
332 mSyncManager->fillSyncMenu(); 336 mSyncManager->fillSyncMenu();
333 337
334 338
335 339
336 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 340 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
337 if ( showWarning ) { 341 if ( showWarning ) {
338 KMessageBox::information( this, 342 KMessageBox::information( this,
339 "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"); 343 "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");
340 qApp->processEvents(); 344 qApp->processEvents();
341 mView->dialogManager()->showSyncOptions(); 345 mView->dialogManager()->showSyncOptions();
342 } 346 }
343 347
344 //US listen for result adressed from Ka/Pi 348 //US listen for result adressed from Ka/Pi
345#ifndef DESKTOP_VERSION 349#ifndef DESKTOP_VERSION
346 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 350 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
347#endif 351#endif
348#ifndef DESKTOP_VERSION 352#ifndef DESKTOP_VERSION
349 infrared = 0; 353 infrared = 0;
350#endif 354#endif
355 updateFilterToolbar();
351 updateWeek( mView->startDate() ); 356 updateWeek( mView->startDate() );
352 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 357 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
353 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 358 SLOT( updateWeekNum( const KCal::DateList & ) ) );
354 mBRdisabled = false; 359 mBRdisabled = false;
355 //toggleBeamReceive(); 360 //toggleBeamReceive();
356} 361}
357MainWindow::~MainWindow() 362MainWindow::~MainWindow()
358{ 363{
359 //qDebug("MainWindow::~MainWindow() "); 364 //qDebug("MainWindow::~MainWindow() ");
360 //save toolbar location 365 //save toolbar location
361 delete mCalendar; 366 delete mCalendar;
362 delete mSyncManager; 367 delete mSyncManager;
363#ifndef DESKTOP_VERSION 368#ifndef DESKTOP_VERSION
364 if ( infrared ) 369 if ( infrared )
365 delete infrared; 370 delete infrared;
366#endif 371#endif
367 372
368 373
369} 374}
370 375
371void MainWindow::disableBR(bool b) 376void MainWindow::disableBR(bool b)
372{ 377{
373#ifndef DESKTOP_VERSION 378#ifndef DESKTOP_VERSION
374 if ( b ) { 379 if ( b ) {
375 if ( infrared ) { 380 if ( infrared ) {
376 toggleBeamReceive(); 381 toggleBeamReceive();
377 mBRdisabled = true; 382 mBRdisabled = true;
378 } 383 }
379 mBRdisabled = true; 384 mBRdisabled = true;
380 } else { 385 } else {
381 if ( mBRdisabled ) { 386 if ( mBRdisabled ) {
382 mBRdisabled = false; 387 mBRdisabled = false;
383 //makes no sense,because other cal ap is probably running 388 //makes no sense,because other cal ap is probably running
384 // toggleBeamReceive(); 389 // toggleBeamReceive();
385 } 390 }
386 } 391 }
387#endif 392#endif
388 393
389} 394}
390bool MainWindow::beamReceiveEnabled() 395bool MainWindow::beamReceiveEnabled()
391{ 396{
392#ifndef DESKTOP_VERSION 397#ifndef DESKTOP_VERSION
393 return ( infrared != 0 ); 398 return ( infrared != 0 );
394#endif 399#endif
395 return false; 400 return false;
396} 401}
397 402
398void MainWindow::toggleBeamReceive() 403void MainWindow::toggleBeamReceive()
399{ 404{
400 if ( mBRdisabled ) 405 if ( mBRdisabled )
401 return; 406 return;
402#ifndef DESKTOP_VERSION 407#ifndef DESKTOP_VERSION
403 if ( infrared ) { 408 if ( infrared ) {
404 qDebug("disable BeamReceive "); 409 qDebug("disable BeamReceive ");
405 delete infrared; 410 delete infrared;
406 infrared = 0; 411 infrared = 0;
407 brAction->setOn(false); 412 brAction->setOn(false);
408 return; 413 return;
409 } 414 }
410 qDebug("enable BeamReceive "); 415 qDebug("enable BeamReceive ");
411 brAction->setOn(true); 416 brAction->setOn(true);
412 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 417 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
413 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 418 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
414#endif 419#endif
415} 420}
416void MainWindow::showMaximized () 421void MainWindow::showMaximized ()
417{ 422{
418#ifndef DESKTOP_VERSION 423#ifndef DESKTOP_VERSION
419 if ( ! globalFlagBlockStartup ) 424 if ( ! globalFlagBlockStartup )
420 if ( mClosed ) 425 if ( mClosed )
421 mView->goToday(); 426 mView->goToday();
422#endif 427#endif
423 QWidget::showMaximized () ; 428 QWidget::showMaximized () ;
424 mClosed = false; 429 mClosed = false;
425} 430}
426void MainWindow::closeEvent( QCloseEvent* ce ) 431void MainWindow::closeEvent( QCloseEvent* ce )
427{ 432{
428 433
429 434
430 435
431 if ( ! KOPrefs::instance()->mAskForQuit ) { 436 if ( ! KOPrefs::instance()->mAskForQuit ) {
432 saveOnClose(); 437 saveOnClose();
433 mClosed = true; 438 mClosed = true;
434 ce->accept(); 439 ce->accept();
435 return; 440 return;
436 441
437 } 442 }
438 443
439 switch( QMessageBox::information( this, "KO/Pi", 444 switch( QMessageBox::information( this, "KO/Pi",
440 i18n("Do you really want\nto close KO/Pi?"), 445 i18n("Do you really want\nto close KO/Pi?"),
441 i18n("Close"), i18n("No"), 446 i18n("Close"), i18n("No"),
442 0, 0 ) ) { 447 0, 0 ) ) {
443 case 0: 448 case 0:
444 saveOnClose(); 449 saveOnClose();
445 mClosed = true; 450 mClosed = true;
446 ce->accept(); 451 ce->accept();
447 break; 452 break;
448 case 1: 453 case 1:
449 ce->ignore(); 454 ce->ignore();
450 break; 455 break;
451 case 2: 456 case 2:
452 457
453 default: 458 default:
454 break; 459 break;
455 } 460 }
456 461
457 462
458} 463}
459 464
460void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 465void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
461{ 466{
462 QDataStream stream( data, IO_ReadOnly ); 467 QDataStream stream( data, IO_ReadOnly );
463 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 468 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
464 //QString datamess; 469 //QString datamess;
465 //qDebug("message "); 470 //qDebug("message ");
466 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 471 qDebug("KO: QCOP message received: %s ", cmsg.data() );
467 472
468 if ( cmsg == "setDocument(QString)" ) { 473 if ( cmsg == "setDocument(QString)" ) {
469 QDataStream stream( data, IO_ReadOnly ); 474 QDataStream stream( data, IO_ReadOnly );
470 QString fileName; 475 QString fileName;
471 stream >> fileName; 476 stream >> fileName;
472 //qDebug("filename %s ", fileName.latin1()); 477 //qDebug("filename %s ", fileName.latin1());
473 showMaximized(); 478 showMaximized();
474 raise(); 479 raise();
475 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 480 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
476 mSyncManager->slotSyncMenu( 1002 ); 481 mSyncManager->slotSyncMenu( 1002 );
477 return; 482 return;
478 } 483 }
479 484
480 if ( cmsg == "-writeFile" ) { 485 if ( cmsg == "-writeFile" ) {
481 // I made from the "-writeFile" an "-writeAlarm" 486 // I made from the "-writeFile" an "-writeAlarm"
482 mView->viewManager()->showWhatsNextView(); 487 mView->viewManager()->showWhatsNextView();
483 mCalendar->checkAlarmForIncidence( 0, true); 488 mCalendar->checkAlarmForIncidence( 0, true);
484 showMaximized(); 489 showMaximized();
485 raise(); 490 raise();
486 return; 491 return;
487 492
488 } 493 }
489 if ( cmsg == "-writeFileSilent" ) { 494 if ( cmsg == "-writeFileSilent" ) {
490 // I made from the "-writeFile" an "-writeAlarm" 495 // I made from the "-writeFile" an "-writeAlarm"
491 // mView->viewManager()->showWhatsNextView(); 496 // mView->viewManager()->showWhatsNextView();
492 mCalendar->checkAlarmForIncidence( 0, true); 497 mCalendar->checkAlarmForIncidence( 0, true);
493 //showMaximized(); 498 //showMaximized();
494 //raise(); 499 //raise();
495 hide(); 500 hide();
496 return; 501 return;
497 } 502 }
498 if ( cmsg == "-newCountdown" ) { 503 if ( cmsg == "-newCountdown" ) {
499 qDebug("newCountdown "); 504 qDebug("newCountdown ");
500 505
501 } 506 }
502 QString msg ; 507 QString msg ;
503 QString allmsg = cmsg; 508 QString allmsg = cmsg;
504 while ( allmsg.length() > 0 ) { 509 while ( allmsg.length() > 0 ) {
505 int nextC = allmsg.find( "-", 1 ); 510 int nextC = allmsg.find( "-", 1 );
506 if ( nextC == -1 ) { 511 if ( nextC == -1 ) {
507 msg = allmsg; 512 msg = allmsg;
508 allmsg = ""; 513 allmsg = "";
509 } else{ 514 } else{
510 msg = allmsg.left( nextC ); 515 msg = allmsg.left( nextC );
511 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 516 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
512 } 517 }
513 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 518 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
514 if ( msg == "-newEvent" ) { 519 if ( msg == "-newEvent" ) {
515 mView->newEvent(); 520 mView->newEvent();
516 } 521 }
517 if ( msg == "-newTodo" ) { 522 if ( msg == "-newTodo" ) {
518 mView->newTodo(); 523 mView->newTodo();
519 524
520 } 525 }
521 if ( msg == "-showWN" ) { 526 if ( msg == "-showWN" ) {
522 mView->viewManager()->showWhatsNextView(); 527 mView->viewManager()->showWhatsNextView();
523 } 528 }
524 if ( msg == "-showTodo" ) { 529 if ( msg == "-showTodo" ) {
525 mView->viewManager()->showTodoView(); 530 mView->viewManager()->showTodoView();
526 } 531 }
527 if ( msg == "-showList" ) { 532 if ( msg == "-showList" ) {
528 mView->viewManager()->showListView(); 533 mView->viewManager()->showListView();
529 } 534 }
530 else if ( msg == "-showDay" ) { 535 else if ( msg == "-showDay" ) {
531 mView->viewManager()->showDayView(); 536 mView->viewManager()->showDayView();
532 } 537 }
533 else if ( msg == "-showWWeek" ) { 538 else if ( msg == "-showWWeek" ) {
534 mView->viewManager()->showWorkWeekView(); 539 mView->viewManager()->showWorkWeekView();
535 } 540 }
536 else if ( msg == "-ringSync" ) { 541 else if ( msg == "-ringSync" ) {
537 mSyncManager->multiSync( false ); 542 mSyncManager->multiSync( false );
538 } 543 }
539 else if ( msg == "-showWeek" ) { 544 else if ( msg == "-showWeek" ) {
540 mView->viewManager()->showWeekView(); 545 mView->viewManager()->showWeekView();
541 } 546 }
542 else if ( msg == "-showTodo" ) { 547 else if ( msg == "-showTodo" ) {
543 mView->viewManager()->showTodoView(); 548 mView->viewManager()->showTodoView();
544 } 549 }
545 else if ( msg == "-showJournal" ) { 550 else if ( msg == "-showJournal" ) {
546 mView->dateNavigator()->selectDates( 1 ); 551 mView->dateNavigator()->selectDates( 1 );
547 mView->dateNavigator()->selectToday(); 552 mView->dateNavigator()->selectToday();
548 mView->viewManager()->showJournalView(); 553 mView->viewManager()->showJournalView();
549 } 554 }
550 else if ( msg == "-showKO" ) { 555 else if ( msg == "-showKO" ) {
551 mView->viewManager()->showNextXView(); 556 mView->viewManager()->showNextXView();
552 } 557 }
553 else if ( msg == "-showWNext" ) { 558 else if ( msg == "-showWNext" ) {
554 mView->viewManager()->showWhatsNextView(); 559 mView->viewManager()->showWhatsNextView();
555 } 560 }
556 else if ( msg == "nextView()" ) { 561 else if ( msg == "nextView()" ) {
557 mView->viewManager()->showNextView(); 562 mView->viewManager()->showNextView();
558 } 563 }
559 else if ( msg == "-showNextXView" ) { 564 else if ( msg == "-showNextXView" ) {
560 mView->viewManager()->showNextXView(); 565 mView->viewManager()->showNextXView();
561 } 566 }
562 567
563 568
564 } 569 }
565 570
566 showMaximized(); 571 showMaximized();
567 raise(); 572 raise();
568} 573}
569 574
570QPixmap MainWindow::loadPixmap( QString name ) 575QPixmap MainWindow::loadPixmap( QString name )
571{ 576{
572 return SmallIcon( name ); 577 return SmallIcon( name );
573 578
574} 579}
575void MainWindow::initActions() 580void MainWindow::initActions()
576{ 581{
577 //KOPrefs::instance()->mShowFullMenu 582 //KOPrefs::instance()->mShowFullMenu
578 iconToolBar->clear(); 583 iconToolBar->clear();
579 KOPrefs *p = KOPrefs::instance(); 584 KOPrefs *p = KOPrefs::instance();
580 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 585 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
581 586
582 QPopupMenu *viewMenu = new QPopupMenu( this ); 587 QPopupMenu *viewMenu = new QPopupMenu( this );
583 QPopupMenu *actionMenu = new QPopupMenu( this ); 588 QPopupMenu *actionMenu = new QPopupMenu( this );
584 QPopupMenu *importMenu = new QPopupMenu( this ); 589 QPopupMenu *importMenu = new QPopupMenu( this );
585 QPopupMenu *importMenu_X = new QPopupMenu( this ); 590 QPopupMenu *importMenu_X = new QPopupMenu( this );
586 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 591 QPopupMenu *exportMenu_X = new QPopupMenu( this );
587 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 592 QPopupMenu *beamMenu_X = new QPopupMenu( this );
588 selectFilterMenu = new QPopupMenu( this ); 593 selectFilterMenu = new QPopupMenu( this );
589 selectFilterMenu->setCheckable( true ); 594 selectFilterMenu->setCheckable( true );
590 syncMenu = new QPopupMenu( this ); 595 syncMenu = new QPopupMenu( this );
591 configureAgendaMenu = new QPopupMenu( this ); 596 configureAgendaMenu = new QPopupMenu( this );
592 configureToolBarMenu = new QPopupMenu( this ); 597 configureToolBarMenu = new QPopupMenu( this );
593 QPopupMenu *helpMenu = new QPopupMenu( this ); 598 QPopupMenu *helpMenu = new QPopupMenu( this );
594 QIconSet icon; 599 QIconSet icon;
595 int pixWid = 22, pixHei = 22; 600 int pixWid = 22, pixHei = 22;
596 QString pathString = ""; 601 QString pathString = "";
597 if ( !p->mToolBarMiniIcons ) { 602 if ( !p->mToolBarMiniIcons ) {
598 if ( QApplication::desktop()->width() < 480 ) { 603 if ( QApplication::desktop()->width() < 480 ) {
599 pathString += "icons16/"; 604 pathString += "icons16/";
600 pixWid = 18; pixHei = 16; 605 pixWid = 18; pixHei = 16;
601 } 606 }
602 } else { 607 } else {
603 pathString += "iconsmini/"; 608 pathString += "iconsmini/";
604 pixWid = 18; pixHei = 16; 609 pixWid = 18; pixHei = 16;
605 } 610 }
606 if ( KOPrefs::instance()->mShowFullMenu ) { 611 if ( KOPrefs::instance()->mShowFullMenu ) {
@@ -739,513 +744,520 @@ void MainWindow::initActions()
739 mView, SLOT( toggleAllDaySize() ) ); 744 mView, SLOT( toggleAllDaySize() ) );
740 mToggleAllday = action; 745 mToggleAllday = action;
741 746
742 747
743 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 748 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
744 mToggleNav, SLOT( setEnabled ( bool ) ) ); 749 mToggleNav, SLOT( setEnabled ( bool ) ) );
745 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 750 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
746 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 751 mToggleFilter, SLOT( setEnabled ( bool ) ) );
747 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 752 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
748 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 753 mToggleAllday, SLOT( setEnabled ( bool ) ) );
749 754
750 viewMenu->insertSeparator(); 755 viewMenu->insertSeparator();
751 icon = loadPixmap( pathString + "picker" ); 756 icon = loadPixmap( pathString + "picker" );
752 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 757 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
753 action->addTo( viewMenu ); 758 action->addTo( viewMenu );
754 connect( action, SIGNAL( activated() ), 759 connect( action, SIGNAL( activated() ),
755 mView, SLOT( showDatePicker() ) ); 760 mView, SLOT( showDatePicker() ) );
756 action->addTo( iconToolBar ); 761 action->addTo( iconToolBar );
757 viewMenu->insertSeparator(); 762 viewMenu->insertSeparator();
758 763
759 764
760 icon = loadPixmap( pathString + "whatsnext" ); 765 icon = loadPixmap( pathString + "whatsnext" );
761 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 766 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
762 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 767 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
763 whatsnext_action->addTo( viewMenu ); 768 whatsnext_action->addTo( viewMenu );
764 connect( whatsnext_action, SIGNAL( activated() ), 769 connect( whatsnext_action, SIGNAL( activated() ),
765 mView->viewManager(), SLOT( showWhatsNextView() ) ); 770 mView->viewManager(), SLOT( showWhatsNextView() ) );
766 771
767 icon = loadPixmap( pathString + "xdays" ); 772 icon = loadPixmap( pathString + "xdays" );
768 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 773 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
769 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 774 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
770 xdays_action->addTo( viewMenu ); 775 xdays_action->addTo( viewMenu );
771 connect( xdays_action, SIGNAL( activated() ), 776 connect( xdays_action, SIGNAL( activated() ),
772 mView->viewManager(), SLOT( showNextXView() ) ); 777 mView->viewManager(), SLOT( showNextXView() ) );
773 778
774 779
775 icon = loadPixmap( pathString + "journal" ); 780 icon = loadPixmap( pathString + "journal" );
776 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 781 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
777 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 782 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
778 viewjournal_action->addTo( viewMenu ); 783 viewjournal_action->addTo( viewMenu );
779 connect( viewjournal_action, SIGNAL( activated() ), 784 connect( viewjournal_action, SIGNAL( activated() ),
780 mView->viewManager(), SLOT( showJournalView() ) ); 785 mView->viewManager(), SLOT( showJournalView() ) );
781 786
782 787
783 icon = loadPixmap( pathString + "day" ); 788 icon = loadPixmap( pathString + "day" );
784 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 789 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
785 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 790 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
786 day1_action->addTo( viewMenu ); 791 day1_action->addTo( viewMenu );
787 // action->addTo( toolBar ); 792 // action->addTo( toolBar );
788 connect( day1_action, SIGNAL( activated() ), 793 connect( day1_action, SIGNAL( activated() ),
789 mView->viewManager(), SLOT( showDayView() ) ); 794 mView->viewManager(), SLOT( showDayView() ) );
790 795
791 icon = loadPixmap( pathString + "workweek" ); 796 icon = loadPixmap( pathString + "workweek" );
792 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 797 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
793 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 798 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
794 day5_action->addTo( viewMenu ); 799 day5_action->addTo( viewMenu );
795 connect( day5_action, SIGNAL( activated() ), 800 connect( day5_action, SIGNAL( activated() ),
796 mView->viewManager(), SLOT( showWorkWeekView() ) ); 801 mView->viewManager(), SLOT( showWorkWeekView() ) );
797 802
798 icon = loadPixmap( pathString + "week" ); 803 icon = loadPixmap( pathString + "week" );
799 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 804 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
800 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 805 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
801 day7_action->addTo( viewMenu ); 806 day7_action->addTo( viewMenu );
802 connect( day7_action, SIGNAL( activated() ), 807 connect( day7_action, SIGNAL( activated() ),
803 mView->viewManager(), SLOT( showWeekView() ) ); 808 mView->viewManager(), SLOT( showWeekView() ) );
804 809
805 icon = loadPixmap( pathString + "workweek2" ); 810 icon = loadPixmap( pathString + "workweek2" );
806 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 811 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
807 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 812 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
808 day6_action->addTo( viewMenu ); 813 day6_action->addTo( viewMenu );
809 connect( day6_action, SIGNAL( activated() ), 814 connect( day6_action, SIGNAL( activated() ),
810 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 815 mView->viewManager(), SLOT( showMonthViewWeek() ) );
811 816
812 icon = loadPixmap( pathString + "month" ); 817 icon = loadPixmap( pathString + "month" );
813 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 818 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
814 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 819 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
815 month_action->addTo( viewMenu ); 820 month_action->addTo( viewMenu );
816 connect( month_action, SIGNAL( activated() ), 821 connect( month_action, SIGNAL( activated() ),
817 mView->viewManager(), SLOT( showMonthView() ) ); 822 mView->viewManager(), SLOT( showMonthView() ) );
818 823
819 icon = loadPixmap( pathString + "list" ); 824 icon = loadPixmap( pathString + "list" );
820 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 825 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
821 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 826 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
822 showlist_action->addTo( viewMenu ); 827 showlist_action->addTo( viewMenu );
823 connect( showlist_action, SIGNAL( activated() ), 828 connect( showlist_action, SIGNAL( activated() ),
824 mView->viewManager(), SLOT( showListView() ) ); 829 mView->viewManager(), SLOT( showListView() ) );
825 830
826 icon = loadPixmap( pathString + "todo" ); 831 icon = loadPixmap( pathString + "todo" );
827 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 832 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
828 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 833 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
829 todoview_action->addTo( viewMenu ); 834 todoview_action->addTo( viewMenu );
830 connect( todoview_action, SIGNAL( activated() ), 835 connect( todoview_action, SIGNAL( activated() ),
831 mView->viewManager(), SLOT( showTodoView() ) ); 836 mView->viewManager(), SLOT( showTodoView() ) );
832 837
833 838
834 839
835#if 0 840#if 0
836 action = new QAction( "view_timespan", "Time Span", 0, this ); 841 action = new QAction( "view_timespan", "Time Span", 0, this );
837 action->addTo( viewMenu ); 842 action->addTo( viewMenu );
838 connect( action, SIGNAL( activated() ), 843 connect( action, SIGNAL( activated() ),
839 mView->viewManager(), SLOT( showTimeSpanView() ) ); 844 mView->viewManager(), SLOT( showTimeSpanView() ) );
840#endif 845#endif
841 846
842 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 847 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
843 this ); 848 this );
844 mNewSubTodoAction->addTo( actionMenu ); 849 mNewSubTodoAction->addTo( actionMenu );
845 connect( mNewSubTodoAction, SIGNAL( activated() ), 850 connect( mNewSubTodoAction, SIGNAL( activated() ),
846 mView, SLOT( newSubTodo() ) ); 851 mView, SLOT( newSubTodo() ) );
847 852
848 actionMenu->insertSeparator(); 853 actionMenu->insertSeparator();
849 854
850 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 855 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
851 mShowAction->addTo( actionMenu ); 856 mShowAction->addTo( actionMenu );
852 connect( mShowAction, SIGNAL( activated() ), 857 connect( mShowAction, SIGNAL( activated() ),
853 mView, SLOT( showIncidence() ) ); 858 mView, SLOT( showIncidence() ) );
854 859
855 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 860 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
856 mEditAction->addTo( actionMenu ); 861 mEditAction->addTo( actionMenu );
857 connect( mEditAction, SIGNAL( activated() ), 862 connect( mEditAction, SIGNAL( activated() ),
858 mView, SLOT( editIncidence() ) ); 863 mView, SLOT( editIncidence() ) );
859 864
860 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 865 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
861 mDeleteAction->addTo( actionMenu ); 866 mDeleteAction->addTo( actionMenu );
862 connect( mDeleteAction, SIGNAL( activated() ), 867 connect( mDeleteAction, SIGNAL( activated() ),
863 mView, SLOT( deleteIncidence() ) ); 868 mView, SLOT( deleteIncidence() ) );
864 869
865 870
866 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 871 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
867 mCloneAction->addTo( actionMenu ); 872 mCloneAction->addTo( actionMenu );
868 connect( mCloneAction, SIGNAL( activated() ), 873 connect( mCloneAction, SIGNAL( activated() ),
869 mView, SLOT( cloneIncidence() ) ); 874 mView, SLOT( cloneIncidence() ) );
870 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 875 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
871 mMoveAction->addTo( actionMenu ); 876 mMoveAction->addTo( actionMenu );
872 connect( mMoveAction, SIGNAL( activated() ), 877 connect( mMoveAction, SIGNAL( activated() ),
873 mView, SLOT( moveIncidence() ) ); 878 mView, SLOT( moveIncidence() ) );
874 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 879 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
875 mBeamAction->addTo( actionMenu ); 880 mBeamAction->addTo( actionMenu );
876 connect( mBeamAction, SIGNAL( activated() ), 881 connect( mBeamAction, SIGNAL( activated() ),
877 mView, SLOT( beamIncidence() ) ); 882 mView, SLOT( beamIncidence() ) );
878 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 883 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
879 mCancelAction->addTo( actionMenu ); 884 mCancelAction->addTo( actionMenu );
880 connect( mCancelAction, SIGNAL( activated() ), 885 connect( mCancelAction, SIGNAL( activated() ),
881 mView, SLOT( toggleCancelIncidence() ) ); 886 mView, SLOT( toggleCancelIncidence() ) );
882 887
883 actionMenu->insertSeparator(); 888 actionMenu->insertSeparator();
884 889
885 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 890 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
886 this ); 891 this );
887 action->addTo( actionMenu ); 892 action->addTo( actionMenu );
888 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 893 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
889 894
890 icon = loadPixmap( pathString + "search" ); 895 icon = loadPixmap( pathString + "search" );
891 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 896 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
892 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 897 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
893 search_action->addTo( actionMenu ); 898 search_action->addTo( actionMenu );
894 connect( search_action, SIGNAL( activated() ), 899 connect( search_action, SIGNAL( activated() ),
895 mView->dialogManager(), SLOT( showSearchDialog() ) ); 900 mView->dialogManager(), SLOT( showSearchDialog() ) );
896 901
897 902
898 903
899 if ( KOPrefs::instance()->mShowFullMenu ) { 904 if ( KOPrefs::instance()->mShowFullMenu ) {
900 actionMenu->insertSeparator(); 905 actionMenu->insertSeparator();
901 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 906 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
902 907
903 } 908 }
904 // actionMenu->insertSeparator(); 909 // actionMenu->insertSeparator();
905 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 910 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
906 this ); 911 this );
907 action->addTo( importMenu_X ); 912 action->addTo( importMenu_X );
908 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 913 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
909 action = new QAction( "import_quick", i18n("Import last file"), 0, 914 action = new QAction( "import_quick", i18n("Import last file"), 0,
910 this ); 915 this );
911 action->addTo( importMenu_X ); 916 action->addTo( importMenu_X );
912 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 917 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
913 importMenu_X->insertSeparator(); 918 importMenu_X->insertSeparator();
914 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 919 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
915 this ); 920 this );
916 action->addTo( importMenu_X ); 921 action->addTo( importMenu_X );
917 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 922 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
918 //#ifndef DESKTOP_VERSION 923 //#ifndef DESKTOP_VERSION
919 importMenu_X->insertSeparator(); 924 importMenu_X->insertSeparator();
920 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 925 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
921 this ); 926 this );
922 action->addTo( importMenu_X ); 927 action->addTo( importMenu_X );
923 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 928 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
924 //#else 929 //#else
925#ifdef _OL_IMPORT_ 930#ifdef _OL_IMPORT_
926 importMenu_X->insertSeparator(); 931 importMenu_X->insertSeparator();
927 action = new QAction( "import_ol", i18n("Import from OL"), 0, 932 action = new QAction( "import_ol", i18n("Import from OL"), 0,
928 this ); 933 this );
929 action->addTo( importMenu_X ); 934 action->addTo( importMenu_X );
930 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 935 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
931#endif 936#endif
932 //#endif 937 //#endif
933 938
934 //importMenu->insertSeparator(); 939 //importMenu->insertSeparator();
935 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 940 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
936 this ); 941 this );
937 action->addTo( importMenu ); 942 action->addTo( importMenu );
938 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 943 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
939 944
940 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 945 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
941 this ); 946 this );
942 action->addTo( importMenu ); 947 action->addTo( importMenu );
943 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 948 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
944 importMenu->insertSeparator(); 949 importMenu->insertSeparator();
945 importMenu->insertItem( i18n("Import"), importMenu_X ); 950 importMenu->insertItem( i18n("Import"), importMenu_X );
946 //importMenu->insertSeparator(); 951 //importMenu->insertSeparator();
947 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 952 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
948 this ); 953 this );
949 action->addTo( exportMenu_X ); 954 action->addTo( exportMenu_X );
950 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 955 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
951 956
952 957
953 //LR 958 //LR
954 QPopupMenu *ex2phone = new QPopupMenu( this ); 959 QPopupMenu *ex2phone = new QPopupMenu( this );
955 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 960 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
956 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 961 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
957 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 962 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
958 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 963 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
959 964
960 importMenu->insertItem( i18n("Export"), exportMenu_X ); 965 importMenu->insertItem( i18n("Export"), exportMenu_X );
961#ifndef DESKTOP_VERSION 966#ifndef DESKTOP_VERSION
962 //importMenu->insertSeparator(); 967 //importMenu->insertSeparator();
963 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 968 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
964 this ); 969 this );
965 brAction->addTo( beamMenu_X ); 970 brAction->addTo( beamMenu_X );
966 brAction->setToggleAction (true ) ; 971 brAction->setToggleAction (true ) ;
967 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 972 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
968 973
969 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 974 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
970 this ); 975 this );
971 action->addTo( beamMenu_X ); 976 action->addTo( beamMenu_X );
972 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 977 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
973 978
974 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 979 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
975 this ); 980 this );
976 action->addTo( beamMenu_X ); 981 action->addTo( beamMenu_X );
977 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 982 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
978 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 983 importMenu->insertItem( i18n("Beam"), beamMenu_X );
979#else 984#else
980 //importMenu->insertSeparator(); 985 //importMenu->insertSeparator();
981 icon = loadPixmap( pathString + "print" ); 986 icon = loadPixmap( pathString + "print" );
982 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 987 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
983 action->addTo( beamMenu_X ); 988 action->addTo( beamMenu_X );
984 connect( action, SIGNAL( activated() ), 989 connect( action, SIGNAL( activated() ),
985 this, SLOT( printCal() ) ); 990 this, SLOT( printCal() ) );
986 991
987 icon = loadPixmap( pathString + "print" ); 992 icon = loadPixmap( pathString + "print" );
988 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 993 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
989 action->addTo( beamMenu_X ); 994 action->addTo( beamMenu_X );
990 connect( action, SIGNAL( activated() ), 995 connect( action, SIGNAL( activated() ),
991 this, SLOT( printSel() ) ); 996 this, SLOT( printSel() ) );
992 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 997 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
993 action->addTo( beamMenu_X ); 998 action->addTo( beamMenu_X );
994 connect( action, SIGNAL( activated() ), 999 connect( action, SIGNAL( activated() ),
995 mView->viewManager(), SIGNAL( printWNV() ) ); 1000 mView->viewManager(), SLOT( slotprintWNV() ) );
1001
1002 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1003 action->addTo( beamMenu_X );
1004 connect( action, SIGNAL( activated() ),
1005 mView, SLOT( slotprintSelInc() ) );
1006
1007
996 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1008 importMenu->insertItem( i18n("Print"), beamMenu_X );
997#endif 1009#endif
998 importMenu->insertSeparator(); 1010 importMenu->insertSeparator();
999 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1011 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1000 this ); 1012 this );
1001 action->addTo( importMenu ); 1013 action->addTo( importMenu );
1002 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1014 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1003 importMenu->insertSeparator(); 1015 importMenu->insertSeparator();
1004 action = new QAction( "beam all", i18n("Save"), 0, 1016 action = new QAction( "beam all", i18n("Save"), 0,
1005 this ); 1017 this );
1006 action->addTo( importMenu ); 1018 action->addTo( importMenu );
1007 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1019 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1008 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1020 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1009 this ); 1021 this );
1010 action->addTo( importMenu ); 1022 action->addTo( importMenu );
1011 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1023 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1012 1024
1013 //menuBar->insertItem( "Configure",configureMenu ); 1025 //menuBar->insertItem( "Configure",configureMenu );
1014 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1026 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1015 icon = loadPixmap( "korganizer/korganizer" ); 1027 icon = loadPixmap( "korganizer/korganizer" );
1016 1028
1017 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1029 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1018 action->addTo( helpMenu ); 1030 action->addTo( helpMenu );
1019 connect( action, SIGNAL( activated() ), 1031 connect( action, SIGNAL( activated() ),
1020 SLOT( whatsNew() ) ); 1032 SLOT( whatsNew() ) );
1021 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1033 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1022 action->addTo( helpMenu ); 1034 action->addTo( helpMenu );
1023 connect( action, SIGNAL( activated() ), 1035 connect( action, SIGNAL( activated() ),
1024 SLOT( features() ) ); 1036 SLOT( features() ) );
1025 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1037 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1026 action->addTo( helpMenu ); 1038 action->addTo( helpMenu );
1027 connect( action, SIGNAL( activated() ), 1039 connect( action, SIGNAL( activated() ),
1028 SLOT( keyBindings() ) ); 1040 SLOT( keyBindings() ) );
1029 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1041 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1030 action->addTo( helpMenu ); 1042 action->addTo( helpMenu );
1031 connect( action, SIGNAL( activated() ), 1043 connect( action, SIGNAL( activated() ),
1032 SLOT( synchowto() ) ); 1044 SLOT( synchowto() ) );
1033 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1045 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1034 action->addTo( helpMenu ); 1046 action->addTo( helpMenu );
1035 connect( action, SIGNAL( activated() ), 1047 connect( action, SIGNAL( activated() ),
1036 SLOT( kdesynchowto() ) ); 1048 SLOT( kdesynchowto() ) );
1037 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1049 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1038 action->addTo( helpMenu ); 1050 action->addTo( helpMenu );
1039 connect( action, SIGNAL( activated() ), 1051 connect( action, SIGNAL( activated() ),
1040 SLOT( multisynchowto() ) ); 1052 SLOT( multisynchowto() ) );
1041 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1053 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1042 action->addTo( helpMenu ); 1054 action->addTo( helpMenu );
1043 connect( action, SIGNAL( activated() ), 1055 connect( action, SIGNAL( activated() ),
1044 SLOT( aboutAutoSaving() ) ); 1056 SLOT( aboutAutoSaving() ) );
1045 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1057 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1046 action->addTo( helpMenu ); 1058 action->addTo( helpMenu );
1047 connect( action, SIGNAL( activated() ), 1059 connect( action, SIGNAL( activated() ),
1048 SLOT( aboutKnownBugs() ) ); 1060 SLOT( aboutKnownBugs() ) );
1049 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1061 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1050 action->addTo( helpMenu ); 1062 action->addTo( helpMenu );
1051 connect( action, SIGNAL( activated() ), 1063 connect( action, SIGNAL( activated() ),
1052 SLOT( usertrans() ) ); 1064 SLOT( usertrans() ) );
1053 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1065 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1054 action->addTo( helpMenu ); 1066 action->addTo( helpMenu );
1055 connect( action, SIGNAL( activated() ), 1067 connect( action, SIGNAL( activated() ),
1056 SLOT( faq() ) ); 1068 SLOT( faq() ) );
1057 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1069 action = new QAction( "licence", i18n("Licence..."), 0, this );
1058 action->addTo( helpMenu ); 1070 action->addTo( helpMenu );
1059 connect( action, SIGNAL( activated() ), 1071 connect( action, SIGNAL( activated() ),
1060 SLOT( licence() ) ); 1072 SLOT( licence() ) );
1061 action = new QAction( "about", i18n("About..."), 0, this ); 1073 action = new QAction( "about", i18n("About..."), 0, this );
1062 action->addTo( helpMenu ); 1074 action->addTo( helpMenu );
1063 connect( action, SIGNAL( activated() ), 1075 connect( action, SIGNAL( activated() ),
1064 SLOT( about() ) ); 1076 SLOT( about() ) );
1065 //menuBar->insertSeparator(); 1077 //menuBar->insertSeparator();
1066 1078
1067 // ****************************************************** 1079 // ******************************************************
1068 // menubar icons 1080 // menubar icons
1069 1081
1070 1082
1071 1083
1072 //menuBar->insertItem( iconToolBar ); 1084 //menuBar->insertItem( iconToolBar );
1073 //xdays_action 1085 //xdays_action
1074 if (p-> mShowIconNewEvent) 1086 if (p-> mShowIconNewEvent)
1075 ne_action->addTo( iconToolBar ); 1087 ne_action->addTo( iconToolBar );
1076 if (p->mShowIconNewTodo ) 1088 if (p->mShowIconNewTodo )
1077 nt_action->addTo( iconToolBar ); 1089 nt_action->addTo( iconToolBar );
1078 if (p-> mShowIconSearch) 1090 if (p-> mShowIconSearch)
1079 search_action->addTo( iconToolBar ); 1091 search_action->addTo( iconToolBar );
1080 if (p-> mShowIconWhatsThis) 1092 if (p-> mShowIconWhatsThis)
1081 QWhatsThis::whatsThisButton ( iconToolBar ); 1093 QWhatsThis::whatsThisButton ( iconToolBar );
1082 if (p-> mShowIconNext) 1094 if (p-> mShowIconNext)
1083 whatsnext_action->addTo( viewToolBar ); 1095 whatsnext_action->addTo( viewToolBar );
1084 if (p-> mShowIconNextDays) 1096 if (p-> mShowIconNextDays)
1085 xdays_action->addTo( viewToolBar ); 1097 xdays_action->addTo( viewToolBar );
1086 if (p-> mShowIconJournal) 1098 if (p-> mShowIconJournal)
1087 viewjournal_action->addTo( viewToolBar ); 1099 viewjournal_action->addTo( viewToolBar );
1088 if (p-> mShowIconDay1) 1100 if (p-> mShowIconDay1)
1089 day1_action->addTo( viewToolBar ); 1101 day1_action->addTo( viewToolBar );
1090 if (p-> mShowIconDay5) 1102 if (p-> mShowIconDay5)
1091 day5_action->addTo( viewToolBar ); 1103 day5_action->addTo( viewToolBar );
1092 if (p-> mShowIconDay7) 1104 if (p-> mShowIconDay7)
1093 day7_action->addTo( viewToolBar ); 1105 day7_action->addTo( viewToolBar );
1094 if (p-> mShowIconDay6) 1106 if (p-> mShowIconDay6)
1095 day6_action->addTo( viewToolBar ); 1107 day6_action->addTo( viewToolBar );
1096 if (p-> mShowIconMonth) 1108 if (p-> mShowIconMonth)
1097 month_action->addTo( viewToolBar ); 1109 month_action->addTo( viewToolBar );
1098 if (p-> mShowIconList) 1110 if (p-> mShowIconList)
1099 showlist_action->addTo( viewToolBar ); 1111 showlist_action->addTo( viewToolBar );
1100 if (p-> mShowIconTodoview) 1112 if (p-> mShowIconTodoview)
1101 todoview_action->addTo( viewToolBar ); 1113 todoview_action->addTo( viewToolBar );
1102 1114
1103 icon = loadPixmap( pathString + "2leftarrowB" ); 1115 icon = loadPixmap( pathString + "2leftarrowB" );
1104 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1116 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1105 if (p-> mShowIconBackFast) { 1117 if (p-> mShowIconBackFast) {
1106 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1118 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1107 connect( action, SIGNAL( activated() ), 1119 connect( action, SIGNAL( activated() ),
1108 mView, SLOT( goPreviousMonth() ) ); 1120 mView, SLOT( goPreviousMonth() ) );
1109 action->addTo( navigatorToolBar ); 1121 action->addTo( navigatorToolBar );
1110 } 1122 }
1111 icon = loadPixmap( pathString + "1leftarrowB" ); 1123 icon = loadPixmap( pathString + "1leftarrowB" );
1112 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1124 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1113 if (p-> mShowIconBack) { 1125 if (p-> mShowIconBack) {
1114 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1126 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1115 connect( action, SIGNAL( activated() ), 1127 connect( action, SIGNAL( activated() ),
1116 mView, SLOT( goPrevious() ) ); 1128 mView, SLOT( goPrevious() ) );
1117 action->addTo( navigatorToolBar ); 1129 action->addTo( navigatorToolBar );
1118 } 1130 }
1119 icon = loadPixmap( pathString + "today" ); 1131 icon = loadPixmap( pathString + "today" );
1120 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1132 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1121 if (p-> mShowIconToday) 1133 if (p-> mShowIconToday)
1122 today_action->addTo( navigatorToolBar ); 1134 today_action->addTo( navigatorToolBar );
1123 icon = loadPixmap( pathString + "1rightarrowB" ); 1135 icon = loadPixmap( pathString + "1rightarrowB" );
1124 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1136 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1125 if (p-> mShowIconForward) { 1137 if (p-> mShowIconForward) {
1126 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1138 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1127 connect( action, SIGNAL( activated() ), 1139 connect( action, SIGNAL( activated() ),
1128 mView, SLOT( goNext() ) ); 1140 mView, SLOT( goNext() ) );
1129 action->addTo( navigatorToolBar ); 1141 action->addTo( navigatorToolBar );
1130 } 1142 }
1131 icon = loadPixmap( pathString + "2rightarrowB" ); 1143 icon = loadPixmap( pathString + "2rightarrowB" );
1132 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1144 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1133 if (p-> mShowIconForwardFast) { 1145 if (p-> mShowIconForwardFast) {
1134 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1146 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1135 connect( action, SIGNAL( activated() ), 1147 connect( action, SIGNAL( activated() ),
1136 mView, SLOT( goNextMonth() ) ); 1148 mView, SLOT( goNextMonth() ) );
1137 action->addTo( navigatorToolBar ); 1149 action->addTo( navigatorToolBar );
1138 } 1150 }
1139 1151
1140 1152
1141 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1153 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1142 1154
1143 if (p-> mShowIconNewEvent) 1155 if (p-> mShowIconNewEvent)
1144 configureToolBarMenu->setItemChecked( 10, true ); 1156 configureToolBarMenu->setItemChecked( 10, true );
1145 if (p->mShowIconNewTodo ) 1157 if (p->mShowIconNewTodo )
1146 configureToolBarMenu->setItemChecked( 20, true ); 1158 configureToolBarMenu->setItemChecked( 20, true );
1147 if (p-> mShowIconSearch) 1159 if (p-> mShowIconSearch)
1148 configureToolBarMenu->setItemChecked( 120, true ); 1160 configureToolBarMenu->setItemChecked( 120, true );
1149 if (p-> mShowIconList) 1161 if (p-> mShowIconList)
1150 configureToolBarMenu->setItemChecked( 30, true ); 1162 configureToolBarMenu->setItemChecked( 30, true );
1151 if (p-> mShowIconDay1) 1163 if (p-> mShowIconDay1)
1152 configureToolBarMenu->setItemChecked( 40, true ); 1164 configureToolBarMenu->setItemChecked( 40, true );
1153 if (p-> mShowIconDay5) 1165 if (p-> mShowIconDay5)
1154 configureToolBarMenu->setItemChecked( 50, true ); 1166 configureToolBarMenu->setItemChecked( 50, true );
1155 if (p-> mShowIconDay6) 1167 if (p-> mShowIconDay6)
1156 configureToolBarMenu->setItemChecked( 75, true ); 1168 configureToolBarMenu->setItemChecked( 75, true );
1157 if (p-> mShowIconDay7) 1169 if (p-> mShowIconDay7)
1158 configureToolBarMenu->setItemChecked( 60, true ); 1170 configureToolBarMenu->setItemChecked( 60, true );
1159 if (p-> mShowIconMonth) 1171 if (p-> mShowIconMonth)
1160 configureToolBarMenu->setItemChecked( 70, true ); 1172 configureToolBarMenu->setItemChecked( 70, true );
1161 if (p-> mShowIconTodoview) 1173 if (p-> mShowIconTodoview)
1162 configureToolBarMenu->setItemChecked( 80, true ); 1174 configureToolBarMenu->setItemChecked( 80, true );
1163 if (p-> mShowIconBackFast) 1175 if (p-> mShowIconBackFast)
1164 configureToolBarMenu->setItemChecked( 200, true ); 1176 configureToolBarMenu->setItemChecked( 200, true );
1165 if (p-> mShowIconBack) 1177 if (p-> mShowIconBack)
1166 configureToolBarMenu->setItemChecked( 210, true ); 1178 configureToolBarMenu->setItemChecked( 210, true );
1167 if (p-> mShowIconToday) 1179 if (p-> mShowIconToday)
1168 configureToolBarMenu->setItemChecked( 130, true ); 1180 configureToolBarMenu->setItemChecked( 130, true );
1169 if (p-> mShowIconForward) 1181 if (p-> mShowIconForward)
1170 configureToolBarMenu->setItemChecked( 220, true ); 1182 configureToolBarMenu->setItemChecked( 220, true );
1171 if (p-> mShowIconForwardFast) 1183 if (p-> mShowIconForwardFast)
1172 configureToolBarMenu->setItemChecked( 230, true ); 1184 configureToolBarMenu->setItemChecked( 230, true );
1173 if (p-> mShowIconNextDays) 1185 if (p-> mShowIconNextDays)
1174 configureToolBarMenu->setItemChecked( 100, true ); 1186 configureToolBarMenu->setItemChecked( 100, true );
1175 if (p-> mShowIconNext) 1187 if (p-> mShowIconNext)
1176 configureToolBarMenu->setItemChecked( 110, true ); 1188 configureToolBarMenu->setItemChecked( 110, true );
1177 if (p-> mShowIconJournal) 1189 if (p-> mShowIconJournal)
1178 configureToolBarMenu->setItemChecked( 90, true ); 1190 configureToolBarMenu->setItemChecked( 90, true );
1179 if (p-> mShowIconWhatsThis) 1191 if (p-> mShowIconWhatsThis)
1180 configureToolBarMenu->setItemChecked( 300, true ); 1192 configureToolBarMenu->setItemChecked( 300, true );
1181 if (p-> mShowIconWeekNum) 1193 if (p-> mShowIconWeekNum)
1182 configureToolBarMenu->setItemChecked( 400, true ); 1194 configureToolBarMenu->setItemChecked( 400, true );
1183 if (!p-> mShowIconStretch) { 1195 if (!p-> mShowIconStretch) {
1184 QLabel* dummy = new QLabel( iconToolBar ); 1196 QLabel* dummy = new QLabel( iconToolBar );
1185 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1197 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1186 dummy->setMinimumWidth( 0 ); 1198 dummy->setMinimumWidth( 0 );
1187 iconToolBar->setStretchableWidget ( dummy ) ; 1199 iconToolBar->setStretchableWidget ( dummy ) ;
1188 } 1200 }
1189 else { 1201 else {
1190 iconToolBar->setHorizontalStretchable (true ); 1202 iconToolBar->setHorizontalStretchable (true );
1191 viewToolBar->setHorizontalStretchable (true ); 1203 viewToolBar->setHorizontalStretchable (true );
1192 navigatorToolBar->setHorizontalStretchable (true ); 1204 navigatorToolBar->setHorizontalStretchable (true );
1193 iconToolBar->setVerticalStretchable (true ); 1205 iconToolBar->setVerticalStretchable (true );
1194 viewToolBar->setVerticalStretchable (true ); 1206 viewToolBar->setVerticalStretchable (true );
1195 navigatorToolBar->setVerticalStretchable (true ); 1207 navigatorToolBar->setVerticalStretchable (true );
1196 configureToolBarMenu->setItemChecked( 5, true ); 1208 configureToolBarMenu->setItemChecked( 5, true );
1197 } 1209 }
1198 if (p-> mShowIconFilter) 1210 if (p-> mShowIconFilter)
1199 configureToolBarMenu->setItemChecked( 7, true ); 1211 configureToolBarMenu->setItemChecked( 7, true );
1200 if (p-> mShowIconOnetoolbar) 1212 if (p-> mShowIconOnetoolbar)
1201 configureToolBarMenu->setItemChecked( 6, true ); 1213 configureToolBarMenu->setItemChecked( 6, true );
1202 1214
1203 1215
1204 if ( filterMenubar ) 1216 if ( filterMenubar )
1205 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); 1217 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) );
1206 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1218 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1207 configureAgenda( p->mHourSize ); 1219 configureAgenda( p->mHourSize );
1208 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1220 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1209} 1221}
1210 1222
1211void MainWindow::exportToPhone( int mode ) 1223void MainWindow::exportToPhone( int mode )
1212{ 1224{
1213 1225
1214 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1226 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1215 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1227 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1216 KOex2phonePrefs ex2phone; 1228 KOex2phonePrefs ex2phone;
1217 1229
1218 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1230 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1219 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1231 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1220 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1232 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1221 if ( mode == 1 ) 1233 if ( mode == 1 )
1222 ex2phone.setCaption(i18n("Export complete calendar")); 1234 ex2phone.setCaption(i18n("Export complete calendar"));
1223 if ( mode == 2 ) 1235 if ( mode == 2 )
1224 ex2phone.setCaption(i18n("Export filtered calendar")); 1236 ex2phone.setCaption(i18n("Export filtered calendar"));
1225 1237
1226 if ( !ex2phone.exec() ) { 1238 if ( !ex2phone.exec() ) {
1227 return; 1239 return;
1228 } 1240 }
1229 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1241 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1230 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1242 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1231 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1243 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1232 1244
1233 int inFuture = 0; 1245 int inFuture = 0;
1234 if ( ex2phone.mWriteBackFuture->isChecked() ) 1246 if ( ex2phone.mWriteBackFuture->isChecked() )
1235 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1247 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1236 QPtrList<Incidence> delSel; 1248 QPtrList<Incidence> delSel;
1237 if ( mode == 1 ) 1249 if ( mode == 1 )
1238 delSel = mCalendar->rawIncidences(); 1250 delSel = mCalendar->rawIncidences();
1239 if ( mode == 2 ) 1251 if ( mode == 2 )
1240 delSel = mCalendar->incidences(); 1252 delSel = mCalendar->incidences();
1241 CalendarLocal* cal = new CalendarLocal(); 1253 CalendarLocal* cal = new CalendarLocal();
1242 cal->setLocalTime(); 1254 cal->setLocalTime();
1243 Incidence *incidence = delSel.first(); 1255 Incidence *incidence = delSel.first();
1244 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1256 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1245 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1257 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1246 while ( incidence ) { 1258 while ( incidence ) {
1247 if ( incidence->type() != "Journal" ) { 1259 if ( incidence->type() != "Journal" ) {
1248 bool add = true; 1260 bool add = true;
1249 if ( inFuture ) { 1261 if ( inFuture ) {
1250 QDateTime dt; 1262 QDateTime dt;
1251 if ( incidence->type() == "Todo" ) { 1263 if ( incidence->type() == "Todo" ) {
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 49149f2..0610d55 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -1,278 +1,279 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qstring.h> 25#include <qstring.h>
26#include <qtooltip.h> 26#include <qtooltip.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qframe.h> 29#include <qframe.h>
30#include <qlabel.h> 30#include <qlabel.h>
31#include <qpopupmenu.h> 31#include <qpopupmenu.h>
32#include <qapplication.h> 32#include <qapplication.h>
33 33
34#include <kdebug.h> 34#include <kdebug.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kglobal.h> 36#include <kglobal.h>
37#include <kiconloader.h> 37#include <kiconloader.h>
38#include "libkdepim/kdatepicker.h" 38#include "libkdepim/kdatepicker.h"
39#include <knotifyclient.h> 39#include <knotifyclient.h>
40#include "kdatetbl.h" 40#include "kdatetbl.h"
41 41
42#include "koglobals.h" 42#include "koglobals.h"
43#include <kglobalsettings.h> 43#include <kglobalsettings.h>
44#include "koprefs.h" 44#include "koprefs.h"
45#ifndef KORG_NOPLUGINS 45#ifndef KORG_NOPLUGINS
46#include "kocore.h" 46#include "kocore.h"
47#endif 47#endif
48 48
49#include <kcalendarsystem.h> 49#include <kcalendarsystem.h>
50 50
51#include "navigatorbar.h" 51#include "navigatorbar.h"
52 52
53NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) 53NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name )
54 : QWidget( parent, name ) 54 : QWidget( parent, name )
55{ 55{
56 QBoxLayout *topLayout = new QHBoxLayout( this ); 56 QBoxLayout *topLayout = new QHBoxLayout( this );
57 57
58 // Set up the control buttons and date label 58 // Set up the control buttons and date label
59 mCtrlFrame = new QFrame( this ); 59 mCtrlFrame = new QFrame( this );
60 mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); 60 mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised);
61 mCtrlFrame->setLineWidth(1); 61 mCtrlFrame->setLineWidth(1);
62 62
63 topLayout->addWidget( mCtrlFrame ); 63 topLayout->addWidget( mCtrlFrame );
64 64
65 65
66 66
67 bool isRTL = KOGlobals::self()->reverseLayout(); 67 bool isRTL = KOGlobals::self()->reverseLayout();
68#ifndef DESKTOP_VERSION 68#ifndef DESKTOP_VERSION
69 bool isDesktop = false; 69 bool isDesktop = false;
70#else 70#else
71 bool isDesktop = true; 71 bool isDesktop = true;
72#endif 72#endif
73 if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) 73 if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 )
74 isDesktop = true; 74 isDesktop = true;
75 // Create backward navigation buttons 75 // Create backward navigation buttons
76 mPrevYear = new QPushButton( mCtrlFrame ); 76 mPrevYear = new QPushButton( mCtrlFrame );
77 mPrevYear->setPixmap( SmallIcon( isDesktop ? "3leftarrowB" : "3leftarrow" ) ); 77 mPrevYear->setPixmap( SmallIcon( isDesktop ? "3leftarrowB" : "3leftarrow" ) );
78 QToolTip::add( mPrevYear, i18n("Previous Year") ); 78 QToolTip::add( mPrevYear, i18n("Previous Year") );
79 79
80 mPrevMonth = new QPushButton( mCtrlFrame ); 80 mPrevMonth = new QPushButton( mCtrlFrame );
81 mPrevMonth->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow") ); 81 mPrevMonth->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow") );
82 QToolTip::add( mPrevMonth, i18n("Previous Month") ); 82 QToolTip::add( mPrevMonth, i18n("Previous Month") );
83 83
84 // Create forward navigation buttons 84 // Create forward navigation buttons
85 mNextMonth = new QPushButton( mCtrlFrame ); 85 mNextMonth = new QPushButton( mCtrlFrame );
86 mNextMonth->setPixmap( SmallIcon( isDesktop ? "2rightarrowB" : "2rightarrow") ); 86 mNextMonth->setPixmap( SmallIcon( isDesktop ? "2rightarrowB" : "2rightarrow") );
87 QToolTip::add( mNextMonth, i18n("Next Month") ); 87 QToolTip::add( mNextMonth, i18n("Next Month") );
88 88
89 mPrevWeek = new QPushButton( mCtrlFrame ); 89 mPrevWeek = new QPushButton( mCtrlFrame );
90 mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); 90 mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") );
91 QToolTip::add( mPrevWeek, i18n("Previous Week") ); 91 QToolTip::add( mPrevWeek, i18n("Previous Week") );
92 92
93 // Create forward navigation buttons 93 // Create forward navigation buttons
94 mNextWeek = new QPushButton( mCtrlFrame ); 94 mNextWeek = new QPushButton( mCtrlFrame );
95 mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); 95 mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") );
96 QToolTip::add( mNextWeek, i18n("Next Week") ); 96 QToolTip::add( mNextWeek, i18n("Next Week") );
97 97
98 mNextYear = new QPushButton( mCtrlFrame ); 98 mNextYear = new QPushButton( mCtrlFrame );
99 mNextYear->setPixmap( SmallIcon( isDesktop ? "3rightarrowB": "3rightarrow") ); 99 mNextYear->setPixmap( SmallIcon( isDesktop ? "3rightarrowB": "3rightarrow") );
100 QToolTip::add( mNextYear, i18n("Next Year") ); 100 QToolTip::add( mNextYear, i18n("Next Year") );
101 mSelectMonth = new QPushButton( mCtrlFrame ); 101 mSelectMonth = new QPushButton( mCtrlFrame );
102 // Create month name label 102 // Create month name label
103 //selectMonth->setFont( tfont ); 103 //selectMonth->setFont( tfont );
104 // selectMonth->setAlignment( AlignCenter ); 104 // selectMonth->setAlignment( AlignCenter );
105 //mDateLabel = new QLabel( selectMonth ); 105 //mDateLabel = new QLabel( selectMonth );
106 //mDateLabel->setFont( tfont ); 106 //mDateLabel->setFont( tfont );
107 //mDateLabel->setAlignment( AlignCenter ); 107 //mDateLabel->setAlignment( AlignCenter );
108 if ( QString ( name ) == QString("useBigPixmaps") ) { 108 if ( QString ( name ) == QString("useBigPixmaps") ) {
109 mNextMonth->setFlat( true); 109 mNextMonth->setFlat( true);
110 mNextWeek->setFlat( true); 110 mNextWeek->setFlat( true);
111 mNextYear->setFlat( true); 111 mNextYear->setFlat( true);
112 mSelectMonth->setFlat( true); 112 mSelectMonth->setFlat( true);
113 mPrevYear->setFlat( true); 113 mPrevYear->setFlat( true);
114 mPrevMonth->setFlat( true); 114 mPrevMonth->setFlat( true);
115 mPrevWeek->setFlat( true); 115 mPrevWeek->setFlat( true);
116
117 mPrevYear->setAutoRepeat( true );
118 mPrevMonth->setAutoRepeat( true );
119 mNextMonth->setAutoRepeat( true );
120 mPrevWeek->setAutoRepeat( true );
121 mNextWeek->setAutoRepeat( true );
122 mNextYear->setAutoRepeat( true );
116 } else { 123 } else {
117 mPrevWeek->hide(); 124 mPrevWeek->hide();
118 mNextWeek->hide(); 125 mNextWeek->hide();
119 } 126 }
120 127
121 resetFont( font() ); 128 resetFont( font() );
122 129
123 130
124 // set up control frame layout 131 // set up control frame layout
125 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); 132 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 );
126 ctrlLayout->addWidget( mPrevYear, 3 ); 133 ctrlLayout->addWidget( mPrevYear, 3 );
127 ctrlLayout->addWidget( mPrevMonth, 3 ); 134 ctrlLayout->addWidget( mPrevMonth, 3 );
128 ctrlLayout->addWidget( mPrevWeek, 3 ); 135 ctrlLayout->addWidget( mPrevWeek, 3 );
129 //ctrlLayout->addStretch( 1 ); 136 //ctrlLayout->addStretch( 1 );
130 // ctrlLayout->addSpacing( 1 ); 137 // ctrlLayout->addSpacing( 1 );
131 // ctrlLayout->addWidget( mDateLabel ); 138 // ctrlLayout->addWidget( mDateLabel );
132 ctrlLayout->addWidget( mSelectMonth ); 139 ctrlLayout->addWidget( mSelectMonth );
133 // ctrlLayout->addSpacing( 1 ); 140 // ctrlLayout->addSpacing( 1 );
134 // ctrlLayout->addStretch( 1 ); 141 // ctrlLayout->addStretch( 1 );
135 ctrlLayout->addWidget( mNextWeek, 3 ); 142 ctrlLayout->addWidget( mNextWeek, 3 );
136 ctrlLayout->addWidget( mNextMonth, 3 ); 143 ctrlLayout->addWidget( mNextMonth, 3 );
137 ctrlLayout->addWidget( mNextYear, 3 ); 144 ctrlLayout->addWidget( mNextYear, 3 );
138 145
139 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); 146 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) );
140 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); 147 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) );
141 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); 148 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) );
142 connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); 149 connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) );
143 connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); 150 connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) );
144 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); 151 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) );
145 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); 152 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) );
146 mPrevYear->setFocusPolicy(NoFocus); 153 mPrevYear->setFocusPolicy(NoFocus);
147 mPrevMonth->setFocusPolicy(NoFocus); 154 mPrevMonth->setFocusPolicy(NoFocus);
148 mNextMonth->setFocusPolicy(NoFocus); 155 mNextMonth->setFocusPolicy(NoFocus);
149 mPrevWeek->setFocusPolicy(NoFocus); 156 mPrevWeek->setFocusPolicy(NoFocus);
150 mNextWeek->setFocusPolicy(NoFocus); 157 mNextWeek->setFocusPolicy(NoFocus);
151 mNextYear->setFocusPolicy(NoFocus); 158 mNextYear->setFocusPolicy(NoFocus);
152 mSelectMonth->setFocusPolicy(NoFocus); 159 mSelectMonth->setFocusPolicy(NoFocus);
153 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); 160 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
154 mPrevYear->setAutoRepeat( true ); 161
155 mPrevMonth->setAutoRepeat( true );
156 mNextMonth->setAutoRepeat( true );
157 mPrevWeek->setAutoRepeat( true );
158 mNextWeek->setAutoRepeat( true );
159 mNextYear->setAutoRepeat( true );
160
161} 162}
162 163
163NavigatorBar::~NavigatorBar() 164NavigatorBar::~NavigatorBar()
164{ 165{
165} 166}
166QSize NavigatorBar::sizeHint() const 167QSize NavigatorBar::sizeHint() const
167{ 168{
168 int wid = mCurrentMinWid ; 169 int wid = mCurrentMinWid ;
169 if ( mPrevYear->isVisible() ) 170 if ( mPrevYear->isVisible() )
170 wid += mCurrentButtonMinWid; 171 wid += mCurrentButtonMinWid;
171 if ( mPrevMonth->isVisible() ) 172 if ( mPrevMonth->isVisible() )
172 wid += mCurrentButtonMinWid; 173 wid += mCurrentButtonMinWid;
173 if ( mPrevWeek->isVisible() ) 174 if ( mPrevWeek->isVisible() )
174 wid += mCurrentButtonMinWid; 175 wid += mCurrentButtonMinWid;
175 if ( mNextMonth->isVisible() ) 176 if ( mNextMonth->isVisible() )
176 wid += mCurrentButtonMinWid; 177 wid += mCurrentButtonMinWid;
177 if ( mNextWeek->isVisible() ) 178 if ( mNextWeek->isVisible() )
178 wid += mCurrentButtonMinWid; 179 wid += mCurrentButtonMinWid;
179 if ( mNextYear->isVisible() ) 180 if ( mNextYear->isVisible() )
180 wid += mCurrentButtonMinWid; 181 wid += mCurrentButtonMinWid;
181 //qDebug("ret %d %d ", wid, mCurrentHei); 182 //qDebug("ret %d %d ", wid, mCurrentHei);
182 return QSize ( wid, mCurrentHei ); 183 return QSize ( wid, mCurrentHei );
183} 184}
184QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const 185QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const
185{ 186{
186 return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei ); 187 return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei );
187} 188}
188void NavigatorBar::resetFont ( QFont fo ) 189void NavigatorBar::resetFont ( QFont fo )
189{ 190{
190 191
191 QFont tfont = fo; 192 QFont tfont = fo;
192 if ( QApplication::desktop()->width() >= 480 ) 193 if ( QApplication::desktop()->width() >= 480 )
193 tfont.setPointSize(tfont.pointSize()+2); 194 tfont.setPointSize(tfont.pointSize()+2);
194 tfont.setBold(true); 195 tfont.setBold(true);
195 196
196 mSelectMonth->setFont( tfont ); 197 mSelectMonth->setFont( tfont );
197 // Set minimum width to width of widest month name label 198 // Set minimum width to width of widest month name label
198 int i; 199 int i;
199 int maxwidth = 0; 200 int maxwidth = 0;
200 QFontMetrics fm ( mSelectMonth->font() ); 201 QFontMetrics fm ( mSelectMonth->font() );
201 int width = fm.width("September '00" ); 202 int width = fm.width("September '00" );
202 maxwidth = width+2; 203 maxwidth = width+2;
203 int size = fm.height()+2; 204 int size = fm.height()+2;
204 if ( QApplication::desktop()->width() >= 480 ) { 205 if ( QApplication::desktop()->width() >= 480 ) {
205 size += 6; 206 size += 6;
206 maxwidth+= 6; 207 maxwidth+= 6;
207 } 208 }
208 mSelectMonth->setMinimumWidth( maxwidth ); 209 mSelectMonth->setMinimumWidth( maxwidth );
209 mSelectMonth->setFixedHeight( size ); 210 mSelectMonth->setFixedHeight( size );
210 mPrevYear->setFixedHeight( size ); 211 mPrevYear->setFixedHeight( size );
211 mPrevMonth->setFixedHeight( size ); 212 mPrevMonth->setFixedHeight( size );
212 mPrevWeek->setFixedHeight( size ); 213 mPrevWeek->setFixedHeight( size );
213 mNextMonth->setFixedHeight( size ); 214 mNextMonth->setFixedHeight( size );
214 mNextWeek->setFixedHeight( size ); 215 mNextWeek->setFixedHeight( size );
215 mNextYear->setFixedHeight ( size ); 216 mNextYear->setFixedHeight ( size );
216 mCurrentHei = size +2; 217 mCurrentHei = size +2;
217 mCurrentMinWid = maxwidth+2; 218 mCurrentMinWid = maxwidth+2;
218 mCurrentButtonMinWid = mPrevYear->sizeHint().width()+2; 219 mCurrentButtonMinWid = mPrevYear->sizeHint().width()+2;
219} 220}
220 221
221void NavigatorBar::showButtons( bool left, bool right ) 222void NavigatorBar::showButtons( bool left, bool right )
222{ 223{
223 if ( left ) { 224 if ( left ) {
224 mPrevYear->show(); 225 mPrevYear->show();
225 mPrevMonth->show(); 226 mPrevMonth->show();
226 } else { 227 } else {
227 mPrevYear->hide(); 228 mPrevYear->hide();
228 mPrevMonth->hide(); 229 mPrevMonth->hide();
229 } 230 }
230 231
231 if ( right ) { 232 if ( right ) {
232 mNextYear->show(); 233 mNextYear->show();
233 mNextMonth->show(); 234 mNextMonth->show();
234 } else { 235 } else {
235 mNextYear->hide(); 236 mNextYear->hide();
236 mNextMonth->hide(); 237 mNextMonth->hide();
237 } 238 }
238 if ( !left && !right ) { 239 if ( !left && !right ) {
239 //mSelectMonth->setMaximumWidth( 1024 ); 240 //mSelectMonth->setMaximumWidth( 1024 );
240 mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); 241 mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
241 } 242 }
242} 243}
243 244
244void NavigatorBar::selectMonth() 245void NavigatorBar::selectMonth()
245{ 246{
246 247
247 int month; 248 int month;
248 KPopupFrame* popup = new KPopupFrame(this); 249 KPopupFrame* popup = new KPopupFrame(this);
249 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); 250 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup);
250 // ----- 251 // -----
251 picker->resize(picker->sizeHint()); 252 picker->resize(picker->sizeHint());
252 popup->setMainWidget(picker); 253 popup->setMainWidget(picker);
253 picker->setFocus(); 254 picker->setFocus();
254 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 255 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
255 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) 256 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height()))))
256 { 257 {
257 month = picker->getResult(); 258 month = picker->getResult();
258 emit monthSelected ( month ); 259 emit monthSelected ( month );
259 } else { 260 } else {
260 KNotifyClient::beep(); 261 KNotifyClient::beep();
261 } 262 }
262 delete popup; 263 delete popup;
263} 264}
264void NavigatorBar::selectDates( const KCal::DateList &dateList ) 265void NavigatorBar::selectDates( const KCal::DateList &dateList )
265{ 266{
266 if (dateList.count() > 0) { 267 if (dateList.count() > 0) {
267 QDate date = dateList.first(); 268 QDate date = dateList.first();
268 269
269 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); 270 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem();
270 271
271 // compute the label at the top of the navigator 272 // compute the label at the top of the navigator
272 QString dtstr = i18n(calSys->monthName( date )) + " '" + 273 QString dtstr = i18n(calSys->monthName( date )) + " '" +
273 QString::number( calSys->year( date ) ).right(2); 274 QString::number( calSys->year( date ) ).right(2);
274 275
275 mSelectMonth->setText( dtstr ); 276 mSelectMonth->setText( dtstr );
276 } 277 }
277} 278}
278 279