summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp35
-rw-r--r--korganizer/calendarview.h4
-rw-r--r--korganizer/mainwindow.cpp25
-rw-r--r--korganizer/mainwindow.h6
4 files changed, 69 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index b1da144..38b55f7 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2354,96 +2354,131 @@ void CalendarView::moveIncidence(Incidence * inc )
2354 } 2354 }
2355 mDatePickerMode = 2; 2355 mDatePickerMode = 2;
2356 mMoveIncidence = inc ; 2356 mMoveIncidence = inc ;
2357 QDate da; 2357 QDate da;
2358 if ( mMoveIncidence->type() == "Todo" ) { 2358 if ( mMoveIncidence->type() == "Todo" ) {
2359 Todo * to = (Todo *) mMoveIncidence; 2359 Todo * to = (Todo *) mMoveIncidence;
2360 if ( to->hasDueDate() ) 2360 if ( to->hasDueDate() )
2361 da = to->dtDue().date(); 2361 da = to->dtDue().date();
2362 else 2362 else
2363 da = QDate::currentDate(); 2363 da = QDate::currentDate();
2364 } else { 2364 } else {
2365 da = mMoveIncidence->dtStart().date(); 2365 da = mMoveIncidence->dtStart().date();
2366 } 2366 }
2367 mDatePicker->setDate( da ); 2367 mDatePicker->setDate( da );
2368} 2368}
2369void CalendarView::showDatePicker( ) 2369void CalendarView::showDatePicker( )
2370{ 2370{
2371 //qDebug("CalendarView::showDatePicker( ) "); 2371 //qDebug("CalendarView::showDatePicker( ) ");
2372 if ( mDateFrame->isVisible() ) 2372 if ( mDateFrame->isVisible() )
2373 mDateFrame->hide(); 2373 mDateFrame->hide();
2374 else { 2374 else {
2375 int w =mDatePicker->sizeHint().width() ; 2375 int w =mDatePicker->sizeHint().width() ;
2376 int h = mDatePicker->sizeHint().height() ; 2376 int h = mDatePicker->sizeHint().height() ;
2377 int dw = QApplication::desktop()->width(); 2377 int dw = QApplication::desktop()->width();
2378 int dh = QApplication::desktop()->height(); 2378 int dh = QApplication::desktop()->height();
2379 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2379 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2380 mDateFrame->show(); 2380 mDateFrame->show();
2381 } 2381 }
2382 mDatePickerMode = 1; 2382 mDatePickerMode = 1;
2383 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2383 mDatePicker->setDate( mNavigator->selectedDates().first() );
2384} 2384}
2385 2385
2386void CalendarView::showEventEditor() 2386void CalendarView::showEventEditor()
2387{ 2387{
2388#ifdef DESKTOP_VERSION 2388#ifdef DESKTOP_VERSION
2389 mEventEditor->show(); 2389 mEventEditor->show();
2390#else 2390#else
2391 mEventEditor->showMaximized(); 2391 mEventEditor->showMaximized();
2392#endif 2392#endif
2393} 2393}
2394void CalendarView::showTodoEditor() 2394void CalendarView::showTodoEditor()
2395{ 2395{
2396#ifdef DESKTOP_VERSION 2396#ifdef DESKTOP_VERSION
2397 mTodoEditor->show(); 2397 mTodoEditor->show();
2398#else 2398#else
2399 mTodoEditor->showMaximized(); 2399 mTodoEditor->showMaximized();
2400#endif 2400#endif
2401} 2401}
2402
2403void CalendarView::cloneIncidence()
2404{
2405 Incidence *incidence = currentSelection();
2406 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2407 if ( incidence ) {
2408 cloneIncidence(incidence);
2409 }
2410}
2411void CalendarView::moveIncidence()
2412{
2413 Incidence *incidence = currentSelection();
2414 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2415 if ( incidence ) {
2416 moveIncidence(incidence);
2417 }
2418}
2419void CalendarView::beamIncidence()
2420{
2421 Incidence *incidence = currentSelection();
2422 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2423 if ( incidence ) {
2424 beamIncidence(incidence);
2425 }
2426}
2427void CalendarView::toggleCancelIncidence()
2428{
2429 Incidence *incidence = currentSelection();
2430 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2431 if ( incidence ) {
2432 cancelIncidence(incidence);
2433 }
2434}
2435
2436
2402void CalendarView::cancelIncidence(Incidence * inc ) 2437void CalendarView::cancelIncidence(Incidence * inc )
2403{ 2438{
2404 inc->setCancelled( ! inc->cancelled() ); 2439 inc->setCancelled( ! inc->cancelled() );
2405 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2440 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2406 updateView(); 2441 updateView();
2407} 2442}
2408void CalendarView::cloneIncidence(Incidence * orgInc ) 2443void CalendarView::cloneIncidence(Incidence * orgInc )
2409{ 2444{
2410 Incidence * newInc = orgInc->clone(); 2445 Incidence * newInc = orgInc->clone();
2411 newInc->recreate(); 2446 newInc->recreate();
2412 2447
2413 if ( newInc->type() == "Todo" ) { 2448 if ( newInc->type() == "Todo" ) {
2414 Todo* t = (Todo*) newInc; 2449 Todo* t = (Todo*) newInc;
2415 mTodoEditor->editTodo( t ); 2450 mTodoEditor->editTodo( t );
2416 showTodoEditor(); 2451 showTodoEditor();
2417 if ( mTodoEditor->exec() ) { 2452 if ( mTodoEditor->exec() ) {
2418 mCalendar->addTodo( t ); 2453 mCalendar->addTodo( t );
2419 updateView(); 2454 updateView();
2420 } else { 2455 } else {
2421 delete t; 2456 delete t;
2422 } 2457 }
2423 } 2458 }
2424 else { 2459 else {
2425 Event* e = (Event*) newInc; 2460 Event* e = (Event*) newInc;
2426 mEventEditor->editEvent( e ); 2461 mEventEditor->editEvent( e );
2427 showEventEditor(); 2462 showEventEditor();
2428 if ( mEventEditor->exec() ) { 2463 if ( mEventEditor->exec() ) {
2429 mCalendar->addEvent( e ); 2464 mCalendar->addEvent( e );
2430 updateView(); 2465 updateView();
2431 } else { 2466 } else {
2432 delete e; 2467 delete e;
2433 } 2468 }
2434 } 2469 }
2435} 2470}
2436 2471
2437void CalendarView::newEvent() 2472void CalendarView::newEvent()
2438{ 2473{
2439 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2474 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2440 KOAgendaView *aView = mViewManager->agendaView(); 2475 KOAgendaView *aView = mViewManager->agendaView();
2441 if (aView) { 2476 if (aView) {
2442 if (aView->selectionStart().isValid()) { 2477 if (aView->selectionStart().isValid()) {
2443 if (aView->selectedIsAllDay()) { 2478 if (aView->selectedIsAllDay()) {
2444 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2479 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2445 } else { 2480 } else {
2446 newEvent(aView->selectionStart(),aView->selectionEnd()); 2481 newEvent(aView->selectionStart(),aView->selectionEnd());
2447 } 2482 }
2448 return; 2483 return;
2449 } 2484 }
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index cd54685..a713c91 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -166,96 +166,100 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
166 166
167 /** Send status message, which can e.g. be displayed in the status bar. */ 167 /** Send status message, which can e.g. be displayed in the status bar. */
168 void statusMessage(const QString &); 168 void statusMessage(const QString &);
169 169
170 void calendarViewExpanded( bool ); 170 void calendarViewExpanded( bool );
171 void updateSearchDialog(); 171 void updateSearchDialog();
172 172
173 173
174 public slots: 174 public slots:
175 void showOpenError(); 175 void showOpenError();
176 void watchSavedFile(); 176 void watchSavedFile();
177 void recheckTimerAlarm(); 177 void recheckTimerAlarm();
178 void checkNextTimerAlarm(); 178 void checkNextTimerAlarm();
179 void addAlarm(const QDateTime &qdt, const QString &noti ); 179 void addAlarm(const QDateTime &qdt, const QString &noti );
180 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 180 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
181 void removeAlarm(const QDateTime &qdt, const QString &noti ); 181 void removeAlarm(const QDateTime &qdt, const QString &noti );
182 182
183 /** options dialog made a changed to the configuration. we catch this 183 /** options dialog made a changed to the configuration. we catch this
184 * and notify all widgets which need to update their configuration. */ 184 * and notify all widgets which need to update their configuration. */
185 void updateConfig(); 185 void updateConfig();
186 186
187 /** 187 /**
188 Load calendar from file \a filename. If \a merge is true, load 188 Load calendar from file \a filename. If \a merge is true, load
189 calendar into existing one, if it is false, clear calendar, before 189 calendar into existing one, if it is false, clear calendar, before
190 loading. Return true, if calendar could be successfully loaded. 190 loading. Return true, if calendar could be successfully loaded.
191 */ 191 */
192 bool openCalendar(QString filename, bool merge=false); 192 bool openCalendar(QString filename, bool merge=false);
193 bool syncCalendar(QString filename,int mode = 0 ); 193 bool syncCalendar(QString filename,int mode = 0 );
194 194
195 /** 195 /**
196 Save calendar data to file. Return true if calendar could be 196 Save calendar data to file. Return true if calendar could be
197 successfully saved. 197 successfully saved.
198 */ 198 */
199 bool saveCalendar(QString filename); 199 bool saveCalendar(QString filename);
200 200
201 /** 201 /**
202 Close calendar. Clear calendar data and reset views to display an empty 202 Close calendar. Clear calendar data and reset views to display an empty
203 calendar. 203 calendar.
204 */ 204 */
205 void closeCalendar(); 205 void closeCalendar();
206 206
207 /** Archive old events of calendar */ 207 /** Archive old events of calendar */
208 void archiveCalendar(); 208 void archiveCalendar();
209 209
210 void showIncidence(); 210 void showIncidence();
211 void editIncidence(); 211 void editIncidence();
212 void editIncidenceDescription(); 212 void editIncidenceDescription();
213 void deleteIncidence(); 213 void deleteIncidence();
214 void cloneIncidence();
215 void moveIncidence();
216 void beamIncidence();
217 void toggleCancelIncidence();
214 218
215 /** create an editeventwin with supplied date/time, and if bool is true, 219 /** create an editeventwin with supplied date/time, and if bool is true,
216 * make the event take all day. */ 220 * make the event take all day. */
217 void newEvent(QDateTime, QDateTime, bool allDay = false); 221 void newEvent(QDateTime, QDateTime, bool allDay = false);
218 void newEvent(QDateTime fh); 222 void newEvent(QDateTime fh);
219 void newEvent(QDate dt); 223 void newEvent(QDate dt);
220 /** create new event without having a date hint. Takes current date as 224 /** create new event without having a date hint. Takes current date as
221 default hint. */ 225 default hint. */
222 void newEvent(); 226 void newEvent();
223 void newFloatingEvent(); 227 void newFloatingEvent();
224 228
225 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 229 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
226 void showIncidence(Incidence *); 230 void showIncidence(Incidence *);
227 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 231 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
228 void editIncidence(Incidence *); 232 void editIncidence(Incidence *);
229 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 233 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
230 void deleteIncidence(Incidence *); 234 void deleteIncidence(Incidence *);
231 void cloneIncidence(Incidence *); 235 void cloneIncidence(Incidence *);
232 void cancelIncidence(Incidence *); 236 void cancelIncidence(Incidence *);
233 /** Create an editor for the supplied event. */ 237 /** Create an editor for the supplied event. */
234 void editEvent(Event *); 238 void editEvent(Event *);
235 /** Delete the supplied event. */ 239 /** Delete the supplied event. */
236 void deleteEvent(Event *); 240 void deleteEvent(Event *);
237 /** Delete the event with the given unique ID. Returns false, if event wasn't 241 /** Delete the event with the given unique ID. Returns false, if event wasn't
238 found. */ 242 found. */
239 bool deleteEvent(const QString &uid); 243 bool deleteEvent(const QString &uid);
240 /** Create a read-only viewer dialog for the supplied event. */ 244 /** Create a read-only viewer dialog for the supplied event. */
241 void showEvent(Event *); 245 void showEvent(Event *);
242 246
243 void editJournal(Journal *); 247 void editJournal(Journal *);
244 void showJournal(Journal *); 248 void showJournal(Journal *);
245 void deleteJournal(Journal *); 249 void deleteJournal(Journal *);
246 /** Create an editor dialog for a todo */ 250 /** Create an editor dialog for a todo */
247 void editTodo(Todo *); 251 void editTodo(Todo *);
248 /** Create a read-only viewer dialog for the supplied todo */ 252 /** Create a read-only viewer dialog for the supplied todo */
249 void showTodo(Todo *); 253 void showTodo(Todo *);
250 /** create new todo */ 254 /** create new todo */
251 void newTodo(); 255 void newTodo();
252 /** create new todo with a parent todo */ 256 /** create new todo with a parent todo */
253 void newSubTodo(); 257 void newSubTodo();
254 /** create new todo with a parent todo */ 258 /** create new todo with a parent todo */
255 void newSubTodo(Todo *); 259 void newSubTodo(Todo *);
256 /** Delete todo */ 260 /** Delete todo */
257 void deleteTodo(Todo *); 261 void deleteTodo(Todo *);
258 262
259 263
260 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 264 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
261 * emitted as result. */ 265 * emitted as result. */
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 6a9a2f1..bd14fbf 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -592,96 +592,114 @@ void MainWindow::initActions()
592 viewjournal_action->addTo( viewMenu ); 592 viewjournal_action->addTo( viewMenu );
593 connect( viewjournal_action, SIGNAL( activated() ), 593 connect( viewjournal_action, SIGNAL( activated() ),
594 mView->viewManager(), SLOT( showJournalView() ) ); 594 mView->viewManager(), SLOT( showJournalView() ) );
595 595
596 icon = loadPixmap( pathString + "xdays" ); 596 icon = loadPixmap( pathString + "xdays" );
597 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 597 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
598 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 598 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
599 xdays_action->addTo( viewMenu ); 599 xdays_action->addTo( viewMenu );
600 connect( xdays_action, SIGNAL( activated() ), 600 connect( xdays_action, SIGNAL( activated() ),
601 mView->viewManager(), SLOT( showNextXView() ) ); 601 mView->viewManager(), SLOT( showNextXView() ) );
602 602
603 icon = loadPixmap( pathString + "whatsnext" ); 603 icon = loadPixmap( pathString + "whatsnext" );
604 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 604 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
605 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 605 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
606 whatsnext_action->addTo( viewMenu ); 606 whatsnext_action->addTo( viewMenu );
607 connect( whatsnext_action, SIGNAL( activated() ), 607 connect( whatsnext_action, SIGNAL( activated() ),
608 mView->viewManager(), SLOT( showWhatsNextView() ) ); 608 mView->viewManager(), SLOT( showWhatsNextView() ) );
609 609
610#if 0 610#if 0
611 action = new QAction( "view_timespan", "Time Span", 0, this ); 611 action = new QAction( "view_timespan", "Time Span", 0, this );
612 action->addTo( viewMenu ); 612 action->addTo( viewMenu );
613 connect( action, SIGNAL( activated() ), 613 connect( action, SIGNAL( activated() ),
614 mView->viewManager(), SLOT( showTimeSpanView() ) ); 614 mView->viewManager(), SLOT( showTimeSpanView() ) );
615#endif 615#endif
616 616
617 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 617 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
618 this ); 618 this );
619 mNewSubTodoAction->addTo( actionMenu ); 619 mNewSubTodoAction->addTo( actionMenu );
620 connect( mNewSubTodoAction, SIGNAL( activated() ), 620 connect( mNewSubTodoAction, SIGNAL( activated() ),
621 mView, SLOT( newSubTodo() ) ); 621 mView, SLOT( newSubTodo() ) );
622 622
623 actionMenu->insertSeparator(); 623 actionMenu->insertSeparator();
624 624
625 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 625 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
626 mShowAction->addTo( actionMenu ); 626 mShowAction->addTo( actionMenu );
627 connect( mShowAction, SIGNAL( activated() ), 627 connect( mShowAction, SIGNAL( activated() ),
628 mView, SLOT( showIncidence() ) ); 628 mView, SLOT( showIncidence() ) );
629 629
630 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 630 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
631 mEditAction->addTo( actionMenu ); 631 mEditAction->addTo( actionMenu );
632 connect( mEditAction, SIGNAL( activated() ), 632 connect( mEditAction, SIGNAL( activated() ),
633 mView, SLOT( editIncidence() ) ); 633 mView, SLOT( editIncidence() ) );
634 634
635 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 635 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
636 mDeleteAction->addTo( actionMenu ); 636 mDeleteAction->addTo( actionMenu );
637 connect( mDeleteAction, SIGNAL( activated() ), 637 connect( mDeleteAction, SIGNAL( activated() ),
638 mView, SLOT( deleteIncidence() ) ); 638 mView, SLOT( deleteIncidence() ) );
639 639
640
641 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
642 mCloneAction->addTo( actionMenu );
643 connect( mCloneAction, SIGNAL( activated() ),
644 mView, SLOT( cloneIncidence() ) );
645 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
646 mMoveAction->addTo( actionMenu );
647 connect( mMoveAction, SIGNAL( activated() ),
648 mView, SLOT( moveIncidence() ) );
649 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
650 mBeamAction->addTo( actionMenu );
651 connect( mBeamAction, SIGNAL( activated() ),
652 mView, SLOT( beamIncidence() ) );
653 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
654 mCancelAction->addTo( actionMenu );
655 connect( mCancelAction, SIGNAL( activated() ),
656 mView, SLOT( toggleCancelIncidence() ) );
657
640 actionMenu->insertSeparator(); 658 actionMenu->insertSeparator();
641 659
642 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 660 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
643 this ); 661 this );
644 action->addTo( actionMenu ); 662 action->addTo( actionMenu );
645 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 663 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
646 664
647 icon = loadPixmap( pathString + "search" ); 665 icon = loadPixmap( pathString + "search" );
648 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 666 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
649 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 667 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
650 search_action->addTo( actionMenu ); 668 search_action->addTo( actionMenu );
651 connect( search_action, SIGNAL( activated() ), 669 connect( search_action, SIGNAL( activated() ),
652 mView->dialogManager(), SLOT( showSearchDialog() ) ); 670 mView->dialogManager(), SLOT( showSearchDialog() ) );
653 671
654 icon = loadPixmap( pathString + "today" ); 672 icon = loadPixmap( pathString + "today" );
655 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 673 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
656 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 674 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
657 today_action->addTo( actionMenu ); 675 today_action->addTo( actionMenu );
658 connect( today_action, SIGNAL( activated() ), 676 connect( today_action, SIGNAL( activated() ),
659 mView, SLOT( goToday() ) ); 677 mView, SLOT( goToday() ) );
660 678
661 if ( KOPrefs::instance()->mShowFullMenu ) { 679 if ( KOPrefs::instance()->mShowFullMenu ) {
662 actionMenu->insertSeparator(); 680 actionMenu->insertSeparator();
663 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 681 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
664 682
665 } 683 }
666 // actionMenu->insertSeparator(); 684 // actionMenu->insertSeparator();
667 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 685 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
668 this ); 686 this );
669 action->addTo( importMenu ); 687 action->addTo( importMenu );
670 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 688 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
671 action = new QAction( "import_quick", i18n("Import last file"), 0, 689 action = new QAction( "import_quick", i18n("Import last file"), 0,
672 this ); 690 this );
673 action->addTo( importMenu ); 691 action->addTo( importMenu );
674 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 692 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
675 importMenu->insertSeparator(); 693 importMenu->insertSeparator();
676 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 694 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
677 this ); 695 this );
678 action->addTo( importMenu ); 696 action->addTo( importMenu );
679 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 697 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
680#ifndef DESKTOP_VERSION 698#ifndef DESKTOP_VERSION
681 importMenu->insertSeparator(); 699 importMenu->insertSeparator();
682 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 700 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
683 this ); 701 this );
684 action->addTo( importMenu ); 702 action->addTo( importMenu );
685 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 703 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
686#else 704#else
687#ifdef _WIN32_ 705#ifdef _WIN32_
@@ -1141,97 +1159,97 @@ void MainWindow::slotSyncMenu( int action )
1141 } else if ( temp->getIsPiSync() ) { 1159 } else if ( temp->getIsPiSync() ) {
1142 mPassWordPiSync = temp->getRemotePw(); 1160 mPassWordPiSync = temp->getRemotePw();
1143 KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); 1161 KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort();
1144 KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); 1162 KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP();
1145 syncPi(); 1163 syncPi();
1146 } else 1164 } else
1147 syncRemote( temp ); 1165 syncRemote( temp );
1148 1166
1149 } 1167 }
1150 } 1168 }
1151 delete temp; 1169 delete temp;
1152 mBlockSaveFlag = false; 1170 mBlockSaveFlag = false;
1153} 1171}
1154void MainWindow::exportToPhone( int mode ) 1172void MainWindow::exportToPhone( int mode )
1155{ 1173{
1156 1174
1157 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1175 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1158 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1176 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1159 KOex2phonePrefs ex2phone; 1177 KOex2phonePrefs ex2phone;
1160 ex2phone.mPhoneConnection->setText( KOPrefs::instance()->mEx2PhoneConnection ); 1178 ex2phone.mPhoneConnection->setText( KOPrefs::instance()->mEx2PhoneConnection );
1161 ex2phone.mPhoneDevice->setText( KOPrefs::instance()->mEx2PhoneDevice ); 1179 ex2phone.mPhoneDevice->setText( KOPrefs::instance()->mEx2PhoneDevice );
1162 ex2phone.mPhoneModel->setText( KOPrefs::instance()->mEx2PhoneModel ); 1180 ex2phone.mPhoneModel->setText( KOPrefs::instance()->mEx2PhoneModel );
1163 if ( mode == 1 ) 1181 if ( mode == 1 )
1164 ex2phone.setCaption(i18n("Export complete calendar")); 1182 ex2phone.setCaption(i18n("Export complete calendar"));
1165 if ( mode == 2 ) 1183 if ( mode == 2 )
1166 ex2phone.setCaption(i18n("Export filtered calendar")); 1184 ex2phone.setCaption(i18n("Export filtered calendar"));
1167 1185
1168 if ( !ex2phone.exec() ) { 1186 if ( !ex2phone.exec() ) {
1169 return; 1187 return;
1170 } 1188 }
1171 KOPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1189 KOPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1172 KOPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1190 KOPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1173 KOPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1191 KOPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1174 1192
1175 int inFuture = 0; 1193 int inFuture = 0;
1176 if ( ex2phone.mWriteBackFuture->isChecked() ) 1194 if ( ex2phone.mWriteBackFuture->isChecked() )
1177 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1195 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1178 QPtrList<Incidence> delSel; 1196 QPtrList<Incidence> delSel;
1179 if ( mode == 1 ) 1197 if ( mode == 1 )
1180 delSel = mCalendar->rawIncidences(); 1198 delSel = mCalendar->rawIncidences();
1181 if ( mode == 2 ) 1199 if ( mode == 2 )
1182 delSel = mCalendar->incidences(); 1200 delSel = mCalendar->incidences();
1183 CalendarLocal* cal = new CalendarLocal(); 1201 CalendarLocal* cal = new CalendarLocal();
1184 cal->setLocalTime(); 1202 cal->setLocalTime();
1185 Incidence *incidence = delSel.first(); 1203 Incidence *incidence = delSel.first();
1186 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1204 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1187 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1205 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1188 while ( incidence ) { 1206 while ( incidence ) {
1189 if ( incidence->type() != "journal" ) { 1207 if ( incidence->type() != "Journal" ) {
1190 bool add = true; 1208 bool add = true;
1191 if ( inFuture ) { 1209 if ( inFuture ) {
1192 QDateTime dt; 1210 QDateTime dt;
1193 if ( incidence->type() == "Todo" ) { 1211 if ( incidence->type() == "Todo" ) {
1194 Todo * t = (Todo*)incidence; 1212 Todo * t = (Todo*)incidence;
1195 if ( t->hasDueDate() ) 1213 if ( t->hasDueDate() )
1196 dt = t->dtDue(); 1214 dt = t->dtDue();
1197 else 1215 else
1198 dt = cur.addSecs( 62 ); 1216 dt = cur.addSecs( 62 );
1199 } 1217 }
1200 else { 1218 else {
1201 bool ok; 1219 bool ok;
1202 dt = incidence->getNextOccurence( cur, &ok ); 1220 dt = incidence->getNextOccurence( cur, &ok );
1203 if ( !ok ) 1221 if ( !ok )
1204 dt = cur.addSecs( -62 ); 1222 dt = cur.addSecs( -62 );
1205 } 1223 }
1206 if ( dt < cur || dt > end ) { 1224 if ( dt < cur || dt > end ) {
1207 add = false; 1225 add = false;
1208 } 1226 }
1209 } 1227 }
1210 if ( add ) { 1228 if ( add ) {
1211 Incidence *in = incidence->clone(); 1229 Incidence *in = incidence->clone();
1212 cal->addIncidence( in ); 1230 cal->addIncidence( in );
1213 } 1231 }
1214 } 1232 }
1215 incidence = delSel.next(); 1233 incidence = delSel.next();
1216 } 1234 }
1217 PhoneFormat::writeConfig( KOPrefs::instance()->mEx2PhoneDevice, 1235 PhoneFormat::writeConfig( KOPrefs::instance()->mEx2PhoneDevice,
1218 KOPrefs::instance()->mEx2PhoneConnection, 1236 KOPrefs::instance()->mEx2PhoneConnection,
1219 KOPrefs::instance()->mEx2PhoneModel ); 1237 KOPrefs::instance()->mEx2PhoneModel );
1220 1238
1221 setCaption( i18n("Writing to phone...")); 1239 setCaption( i18n("Writing to phone..."));
1222 if ( PhoneFormat::writeToPhone( cal ) ) 1240 if ( PhoneFormat::writeToPhone( cal ) )
1223 setCaption( i18n("Export to phone successful!")); 1241 setCaption( i18n("Export to phone successful!"));
1224 else 1242 else
1225 setCaption( i18n("Error exporting to phone!")); 1243 setCaption( i18n("Error exporting to phone!"));
1226 delete cal; 1244 delete cal;
1227} 1245}
1228 1246
1229 1247
1230void MainWindow::setDefaultPreferences() 1248void MainWindow::setDefaultPreferences()
1231{ 1249{
1232 KOPrefs *p = KOPrefs::instance(); 1250 KOPrefs *p = KOPrefs::instance();
1233 1251
1234 p->mCompactDialogs = true; 1252 p->mCompactDialogs = true;
1235 p->mConfirm = true; 1253 p->mConfirm = true;
1236 // p->mEnableQuickTodo = false; 1254 // p->mEnableQuickTodo = false;
1237 1255
@@ -1453,96 +1471,101 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
1453 } else { 1471 } else {
1454 startString = ": "+incidence->dtStartStr(true); 1472 startString = ": "+incidence->dtStartStr(true);
1455 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1473 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1456 1474
1457 } 1475 }
1458 1476
1459 } else { 1477 } else {
1460 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1478 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1461 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1479 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1462 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1480 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1463 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1481 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1464 } 1482 }
1465 1483
1466 } 1484 }
1467 else 1485 else
1468 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1486 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1469 if ( !incidence->location().isEmpty() ) 1487 if ( !incidence->location().isEmpty() )
1470 startString += " (" +incidence->location()+")"; 1488 startString += " (" +incidence->location()+")";
1471 setCaption( incidence->summary()+startString); 1489 setCaption( incidence->summary()+startString);
1472 1490
1473 enableIncidenceActions( true ); 1491 enableIncidenceActions( true );
1474 1492
1475 if ( incidence->type() == "Event" ) { 1493 if ( incidence->type() == "Event" ) {
1476 mShowAction->setText( i18n("Show Event...") ); 1494 mShowAction->setText( i18n("Show Event...") );
1477 mEditAction->setText( i18n("Edit Event...") ); 1495 mEditAction->setText( i18n("Edit Event...") );
1478 mDeleteAction->setText( i18n("Delete Event...") ); 1496 mDeleteAction->setText( i18n("Delete Event...") );
1479 1497
1480 mNewSubTodoAction->setEnabled( false ); 1498 mNewSubTodoAction->setEnabled( false );
1481 } else if ( incidence->type() == "Todo" ) { 1499 } else if ( incidence->type() == "Todo" ) {
1482 mShowAction->setText( i18n("Show Todo...") ); 1500 mShowAction->setText( i18n("Show Todo...") );
1483 mEditAction->setText( i18n("Edit Todo...") ); 1501 mEditAction->setText( i18n("Edit Todo...") );
1484 mDeleteAction->setText( i18n("Delete Todo...") ); 1502 mDeleteAction->setText( i18n("Delete Todo...") );
1485 1503
1486 mNewSubTodoAction->setEnabled( true ); 1504 mNewSubTodoAction->setEnabled( true );
1487 } else { 1505 } else {
1488 mShowAction->setText( i18n("Show...") ); 1506 mShowAction->setText( i18n("Show...") );
1489 mShowAction->setText( i18n("Edit...") ); 1507 mShowAction->setText( i18n("Edit...") );
1490 mShowAction->setText( i18n("Delete...") ); 1508 mShowAction->setText( i18n("Delete...") );
1491 1509
1492 mNewSubTodoAction->setEnabled( false ); 1510 mNewSubTodoAction->setEnabled( false );
1493 } 1511 }
1494} 1512}
1495 1513
1496void MainWindow::enableIncidenceActions( bool enabled ) 1514void MainWindow::enableIncidenceActions( bool enabled )
1497{ 1515{
1498 mShowAction->setEnabled( enabled ); 1516 mShowAction->setEnabled( enabled );
1499 mEditAction->setEnabled( enabled ); 1517 mEditAction->setEnabled( enabled );
1500 mDeleteAction->setEnabled( enabled ); 1518 mDeleteAction->setEnabled( enabled );
1519
1520 mCloneAction->setEnabled( enabled );
1521 mMoveAction->setEnabled( enabled );
1522 mBeamAction->setEnabled( enabled );
1523 mCancelAction->setEnabled( enabled );
1501} 1524}
1502 1525
1503void MainWindow::importOL() 1526void MainWindow::importOL()
1504{ 1527{
1505#ifdef _WIN32_ 1528#ifdef _WIN32_
1506 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1529 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1507 id->exec(); 1530 id->exec();
1508 delete id; 1531 delete id;
1509 mView->updateView(); 1532 mView->updateView();
1510#endif 1533#endif
1511} 1534}
1512void MainWindow::importBday() 1535void MainWindow::importBday()
1513{ 1536{
1514 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1537 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1515 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1538 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1516 i18n("Import!"), i18n("Cancel"), 0, 1539 i18n("Import!"), i18n("Cancel"), 0,
1517 0, 1 ); 1540 0, 1 );
1518 if ( result == 0 ) { 1541 if ( result == 0 ) {
1519 mView->importBday(); 1542 mView->importBday();
1520 1543
1521 } 1544 }
1522 1545
1523 1546
1524} 1547}
1525void MainWindow::importQtopia() 1548void MainWindow::importQtopia()
1526{ 1549{
1527#ifndef DESKTOP_VERSION 1550#ifndef DESKTOP_VERSION
1528 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1551 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1529 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), 1552 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
1530 i18n("Import!"), i18n("Cancel"), 0, 1553 i18n("Import!"), i18n("Cancel"), 0,
1531 0, 1 ); 1554 0, 1 );
1532 if ( result == 0 ) { 1555 if ( result == 0 ) {
1533 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1556 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1534 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1557 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1535 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1558 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1536 mView->importQtopia( categories, datebook, todolist ); 1559 mView->importQtopia( categories, datebook, todolist );
1537 } 1560 }
1538#else 1561#else
1539 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1562 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1540 i18n("Not supported \non desktop!\n"), 1563 i18n("Not supported \non desktop!\n"),
1541 i18n("Ok"), i18n("Cancel"), 0, 1564 i18n("Ok"), i18n("Cancel"), 0,
1542 0, 1 ); 1565 0, 1 );
1543 1566
1544#endif 1567#endif
1545} 1568}
1546 1569
1547void MainWindow::saveOnClose() 1570void MainWindow::saveOnClose()
1548{ 1571{
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 74c7f45..4f89e03 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -152,59 +152,65 @@ class MainWindow : public QMainWindow
152 void syncPhone(); 152 void syncPhone();
153 void syncPi(); 153 void syncPi();
154 void syncLocalFile(); 154 void syncLocalFile();
155 bool syncWithFile( QString, bool ); 155 bool syncWithFile( QString, bool );
156 void quickSyncLocalFile(); 156 void quickSyncLocalFile();
157 157
158 158
159 protected: 159 protected:
160 void displayText( QString, QString); 160 void displayText( QString, QString);
161 void displayFile( QString, QString); 161 void displayFile( QString, QString);
162 162
163 void enableIncidenceActions( bool ); 163 void enableIncidenceActions( bool );
164 164
165 private slots: 165 private slots:
166 QSocket* piSocket; 166 QSocket* piSocket;
167 QString piFileString; 167 QString piFileString;
168 QTime piTime; 168 QTime piTime;
169 void deleteCommandSocket(KCommandSocket* s, int state ); 169 void deleteCommandSocket(KCommandSocket* s, int state );
170 void fillSyncMenu(); 170 void fillSyncMenu();
171 void getFile( bool ); 171 void getFile( bool );
172 void readFileFromSocket(); 172 void readFileFromSocket();
173 private: 173 private:
174 //QTimer* mTimerCommandSocket; 174 //QTimer* mTimerCommandSocket;
175 QString mPassWordPiSync; 175 QString mPassWordPiSync;
176 KServerSocket * mServerSocket; 176 KServerSocket * mServerSocket;
177 bool mClosed; 177 bool mClosed;
178 void saveOnClose(); 178 void saveOnClose();
179 int mCurrentSyncProfile; 179 int mCurrentSyncProfile;
180 void enableQuick(); 180 void enableQuick();
181 void syncRemote( KSyncProfile* , bool ask = true); 181 void syncRemote( KSyncProfile* , bool ask = true);
182 bool mFlagKeyPressed; 182 bool mFlagKeyPressed;
183 bool mBlockAtStartup; 183 bool mBlockAtStartup;
184 QPEToolBar *iconToolBar; 184 QPEToolBar *iconToolBar;
185 void initActions(); 185 void initActions();
186 void setDefaultPreferences(); 186 void setDefaultPreferences();
187 void keyPressEvent ( QKeyEvent * ) ; 187 void keyPressEvent ( QKeyEvent * ) ;
188 void keyReleaseEvent ( QKeyEvent * ) ; 188 void keyReleaseEvent ( QKeyEvent * ) ;
189 QPopupMenu *configureToolBarMenu; 189 QPopupMenu *configureToolBarMenu;
190 QPopupMenu *selectFilterMenu; 190 QPopupMenu *selectFilterMenu;
191 QPopupMenu *configureAgendaMenu, *syncMenu; 191 QPopupMenu *configureAgendaMenu, *syncMenu;
192 CalendarLocal *mCalendar; 192 CalendarLocal *mCalendar;
193 CalendarView *mView; 193 CalendarView *mView;
194 QString getPassword(); 194 QString getPassword();
195 QAction *mNewSubTodoAction; 195 QAction *mNewSubTodoAction;
196 196
197 QAction *mShowAction; 197 QAction *mShowAction;
198 QAction *mEditAction; 198 QAction *mEditAction;
199 QAction *mDeleteAction; 199 QAction *mDeleteAction;
200 QAction *mCloneAction;
201 QAction *mMoveAction;
202 QAction *mBeamAction;
203 QAction *mCancelAction;
204
205
200 void closeEvent( QCloseEvent* ce ); 206 void closeEvent( QCloseEvent* ce );
201 SimpleAlarmClient mAlarmClient; 207 SimpleAlarmClient mAlarmClient;
202 QTimer mSaveTimer; 208 QTimer mSaveTimer;
203 bool mBlockSaveFlag; 209 bool mBlockSaveFlag;
204 bool mCalendarModifiedFlag; 210 bool mCalendarModifiedFlag;
205 QPixmap loadPixmap( QString ); 211 QPixmap loadPixmap( QString );
206 QDialog * mSyncActionDialog; 212 QDialog * mSyncActionDialog;
207}; 213};
208 214
209 215
210#endif 216#endif