author | zautrix <zautrix> | 2005-01-22 10:18:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-22 10:18:16 (UTC) |
commit | 6946f6ab0ee6eeafee0c8ff5d33fffc0826c7452 (patch) (unidiff) | |
tree | 006248579ca44ad2e0c1a67db55b1a8013180ed7 /korganizer | |
parent | b715b109b70b8cd24a2d9da1d4863c44d79fb2a4 (diff) | |
download | kdepimpi-6946f6ab0ee6eeafee0c8ff5d33fffc0826c7452.zip kdepimpi-6946f6ab0ee6eeafee0c8ff5d33fffc0826c7452.tar.gz kdepimpi-6946f6ab0ee6eeafee0c8ff5d33fffc0826c7452.tar.bz2 |
some small fixes
-rw-r--r-- | korganizer/calendarview.cpp | 52 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 20 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.h | 1 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 5 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 11 |
6 files changed, 65 insertions, 26 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 8f05276..038da54 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2140,99 +2140,99 @@ void CalendarView::changeEventDisplay(Event *which, int action) | |||
2140 | changeIncidenceDisplay((Incidence *)which, action); | 2140 | changeIncidenceDisplay((Incidence *)which, action); |
2141 | mDateNavigator->updateView(); | 2141 | mDateNavigator->updateView(); |
2142 | //mDialogManager->updateSearchDialog(); | 2142 | //mDialogManager->updateSearchDialog(); |
2143 | 2143 | ||
2144 | if (which) { | 2144 | if (which) { |
2145 | // If there is an event view visible update the display | 2145 | // If there is an event view visible update the display |
2146 | mViewManager->currentView()->changeEventDisplay(which,action); | 2146 | mViewManager->currentView()->changeEventDisplay(which,action); |
2147 | // TODO: check, if update needed | 2147 | // TODO: check, if update needed |
2148 | // if (which->getTodoStatus()) { | 2148 | // if (which->getTodoStatus()) { |
2149 | mTodoList->updateView(); | 2149 | mTodoList->updateView(); |
2150 | // } | 2150 | // } |
2151 | } else { | 2151 | } else { |
2152 | mViewManager->currentView()->updateView(); | 2152 | mViewManager->currentView()->updateView(); |
2153 | } | 2153 | } |
2154 | } | 2154 | } |
2155 | 2155 | ||
2156 | 2156 | ||
2157 | void CalendarView::updateTodoViews() | 2157 | void CalendarView::updateTodoViews() |
2158 | { | 2158 | { |
2159 | 2159 | ||
2160 | mTodoList->updateView(); | 2160 | mTodoList->updateView(); |
2161 | mViewManager->currentView()->updateView(); | 2161 | mViewManager->currentView()->updateView(); |
2162 | 2162 | ||
2163 | } | 2163 | } |
2164 | 2164 | ||
2165 | 2165 | ||
2166 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2166 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2167 | { | 2167 | { |
2168 | mTodoList->updateView(); | 2168 | mTodoList->updateView(); |
2169 | mViewManager->updateView(start, end); | 2169 | mViewManager->updateView(start, end); |
2170 | //mDateNavigator->updateView(); | 2170 | //mDateNavigator->updateView(); |
2171 | } | 2171 | } |
2172 | 2172 | ||
2173 | void CalendarView::updateView() | 2173 | void CalendarView::updateView() |
2174 | { | 2174 | { |
2175 | DateList tmpList = mNavigator->selectedDates(); | 2175 | DateList tmpList = mNavigator->selectedDates(); |
2176 | 2176 | ||
2177 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2177 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2178 | mTodoList->updateView(); | 2178 | mTodoList->updateView(); |
2179 | // We assume that the navigator only selects consecutive days. | 2179 | // We assume that the navigator only selects consecutive days. |
2180 | updateView( tmpList.first(), tmpList.last() ); | 2180 | updateView( tmpList.first(), tmpList.last() ); |
2181 | } | 2181 | } |
2182 | 2182 | ||
2183 | void CalendarView::updateUnmanagedViews() | 2183 | void CalendarView::updateUnmanagedViews() |
2184 | { | 2184 | { |
2185 | mDateNavigator->updateDayMatrix(); | 2185 | mDateNavigator->updateDayMatrix(); |
2186 | } | 2186 | } |
2187 | 2187 | ||
2188 | int CalendarView::msgItemDelete() | 2188 | int CalendarView::msgItemDelete(const QString name) |
2189 | { | 2189 | { |
2190 | return KMessageBox::warningContinueCancel(this, | 2190 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2191 | i18n("This item will be\npermanently deleted."), | 2191 | i18n("This item will be\npermanently deleted."), |
2192 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2192 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2193 | } | 2193 | } |
2194 | 2194 | ||
2195 | 2195 | ||
2196 | void CalendarView::edit_cut() | 2196 | void CalendarView::edit_cut() |
2197 | { | 2197 | { |
2198 | Event *anEvent=0; | 2198 | Event *anEvent=0; |
2199 | 2199 | ||
2200 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2200 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2201 | 2201 | ||
2202 | if (mViewManager->currentView()->isEventView()) { | 2202 | if (mViewManager->currentView()->isEventView()) { |
2203 | if ( incidence && incidence->type() == "Event" ) { | 2203 | if ( incidence && incidence->type() == "Event" ) { |
2204 | anEvent = static_cast<Event *>(incidence); | 2204 | anEvent = static_cast<Event *>(incidence); |
2205 | } | 2205 | } |
2206 | } | 2206 | } |
2207 | 2207 | ||
2208 | if (!anEvent) { | 2208 | if (!anEvent) { |
2209 | KNotifyClient::beep(); | 2209 | KNotifyClient::beep(); |
2210 | return; | 2210 | return; |
2211 | } | 2211 | } |
2212 | DndFactory factory( mCalendar ); | 2212 | DndFactory factory( mCalendar ); |
2213 | factory.cutEvent(anEvent); | 2213 | factory.cutEvent(anEvent); |
2214 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2214 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2215 | } | 2215 | } |
2216 | 2216 | ||
2217 | void CalendarView::edit_copy() | 2217 | void CalendarView::edit_copy() |
2218 | { | 2218 | { |
2219 | Event *anEvent=0; | 2219 | Event *anEvent=0; |
2220 | 2220 | ||
2221 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2221 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2222 | 2222 | ||
2223 | if (mViewManager->currentView()->isEventView()) { | 2223 | if (mViewManager->currentView()->isEventView()) { |
2224 | if ( incidence && incidence->type() == "Event" ) { | 2224 | if ( incidence && incidence->type() == "Event" ) { |
2225 | anEvent = static_cast<Event *>(incidence); | 2225 | anEvent = static_cast<Event *>(incidence); |
2226 | } | 2226 | } |
2227 | } | 2227 | } |
2228 | 2228 | ||
2229 | if (!anEvent) { | 2229 | if (!anEvent) { |
2230 | KNotifyClient::beep(); | 2230 | KNotifyClient::beep(); |
2231 | return; | 2231 | return; |
2232 | } | 2232 | } |
2233 | DndFactory factory( mCalendar ); | 2233 | DndFactory factory( mCalendar ); |
2234 | factory.copyEvent(anEvent); | 2234 | factory.copyEvent(anEvent); |
2235 | } | 2235 | } |
2236 | 2236 | ||
2237 | void CalendarView::edit_paste() | 2237 | void CalendarView::edit_paste() |
2238 | { | 2238 | { |
@@ -2843,130 +2843,133 @@ void CalendarView::appointment_delete() | |||
2843 | if (mViewManager->currentView()->isEventView()) { | 2843 | if (mViewManager->currentView()->isEventView()) { |
2844 | if ( incidence && incidence->type() == "Event" ) { | 2844 | if ( incidence && incidence->type() == "Event" ) { |
2845 | anEvent = static_cast<Event *>(incidence); | 2845 | anEvent = static_cast<Event *>(incidence); |
2846 | } | 2846 | } |
2847 | } | 2847 | } |
2848 | 2848 | ||
2849 | if (!anEvent) { | 2849 | if (!anEvent) { |
2850 | KNotifyClient::beep(); | 2850 | KNotifyClient::beep(); |
2851 | return; | 2851 | return; |
2852 | } | 2852 | } |
2853 | 2853 | ||
2854 | deleteEvent(anEvent); | 2854 | deleteEvent(anEvent); |
2855 | } | 2855 | } |
2856 | 2856 | ||
2857 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 2857 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
2858 | { | 2858 | { |
2859 | if (!sub) return; | 2859 | if (!sub) return; |
2860 | if (!parent) return; | 2860 | if (!parent) return; |
2861 | if ( sub->relatedTo() ) | 2861 | if ( sub->relatedTo() ) |
2862 | sub->relatedTo()->removeRelation(sub); | 2862 | sub->relatedTo()->removeRelation(sub); |
2863 | sub->setRelatedTo(parent); | 2863 | sub->setRelatedTo(parent); |
2864 | sub->setRelatedToUid(parent->uid()); | 2864 | sub->setRelatedToUid(parent->uid()); |
2865 | parent->addRelation(sub); | 2865 | parent->addRelation(sub); |
2866 | sub->updated(); | 2866 | sub->updated(); |
2867 | parent->updated(); | 2867 | parent->updated(); |
2868 | setModified(true); | 2868 | setModified(true); |
2869 | updateView(); | 2869 | updateView(); |
2870 | } | 2870 | } |
2871 | void CalendarView::todo_unsub(Todo *anTodo ) | 2871 | void CalendarView::todo_unsub(Todo *anTodo ) |
2872 | { | 2872 | { |
2873 | // Todo *anTodo = selectedTodo(); | 2873 | // Todo *anTodo = selectedTodo(); |
2874 | if (!anTodo) return; | 2874 | if (!anTodo) return; |
2875 | if (!anTodo->relatedTo()) return; | 2875 | if (!anTodo->relatedTo()) return; |
2876 | anTodo->relatedTo()->removeRelation(anTodo); | 2876 | anTodo->relatedTo()->removeRelation(anTodo); |
2877 | anTodo->setRelatedTo(0); | 2877 | anTodo->setRelatedTo(0); |
2878 | anTodo->updated(); | 2878 | anTodo->updated(); |
2879 | anTodo->setRelatedToUid(""); | 2879 | anTodo->setRelatedToUid(""); |
2880 | setModified(true); | 2880 | setModified(true); |
2881 | updateView(); | 2881 | updateView(); |
2882 | } | 2882 | } |
2883 | 2883 | ||
2884 | void CalendarView::deleteTodo(Todo *todo) | 2884 | void CalendarView::deleteTodo(Todo *todo) |
2885 | { | 2885 | { |
2886 | if (!todo) { | 2886 | if (!todo) { |
2887 | KNotifyClient::beep(); | 2887 | KNotifyClient::beep(); |
2888 | return; | 2888 | return; |
2889 | } | 2889 | } |
2890 | if (KOPrefs::instance()->mConfirm) { | 2890 | if (KOPrefs::instance()->mConfirm) { |
2891 | switch (msgItemDelete()) { | 2891 | QString text = todo->summary().left(20); |
2892 | if (!todo->relations().isEmpty()) { | ||
2893 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); | ||
2894 | |||
2895 | } | ||
2896 | switch (msgItemDelete(text)) { | ||
2892 | case KMessageBox::Continue: // OK | 2897 | case KMessageBox::Continue: // OK |
2898 | bool deleteT = false; | ||
2893 | if (!todo->relations().isEmpty()) { | 2899 | if (!todo->relations().isEmpty()) { |
2894 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), | 2900 | deleteT = removeCompletedSubTodos( todo ); |
2895 | i18n("Delete To-Do")); | 2901 | } |
2896 | } else { | 2902 | // deleteT == true: todo already deleted in removeCompletedSubTodos |
2903 | if ( !deleteT ) { | ||
2897 | checkExternalId( todo ); | 2904 | checkExternalId( todo ); |
2898 | calendar()->deleteTodo(todo); | 2905 | calendar()->deleteTodo(todo); |
2899 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 2906 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2900 | updateView(); | 2907 | updateView(); |
2901 | } | 2908 | } |
2902 | break; | 2909 | break; |
2903 | } // switch | 2910 | } // switch |
2904 | } else { | 2911 | } else { |
2905 | if (!todo->relations().isEmpty()) { | 2912 | checkExternalId( todo ); |
2906 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), | 2913 | mCalendar->deleteTodo(todo); |
2907 | i18n("Delete To-Do")); | 2914 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2908 | } else { | 2915 | updateView(); |
2909 | checkExternalId( todo ); | ||
2910 | mCalendar->deleteTodo(todo); | ||
2911 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | ||
2912 | updateView(); | ||
2913 | } | ||
2914 | } | 2916 | } |
2917 | |||
2915 | emit updateSearchDialog(); | 2918 | emit updateSearchDialog(); |
2916 | } | 2919 | } |
2917 | void CalendarView::deleteJournal(Journal *jour) | 2920 | void CalendarView::deleteJournal(Journal *jour) |
2918 | { | 2921 | { |
2919 | if (!jour) { | 2922 | if (!jour) { |
2920 | KNotifyClient::beep(); | 2923 | KNotifyClient::beep(); |
2921 | return; | 2924 | return; |
2922 | } | 2925 | } |
2923 | if (KOPrefs::instance()->mConfirm) { | 2926 | if (KOPrefs::instance()->mConfirm) { |
2924 | switch (msgItemDelete()) { | 2927 | switch (msgItemDelete( jour->description().left(20))) { |
2925 | case KMessageBox::Continue: // OK | 2928 | case KMessageBox::Continue: // OK |
2926 | calendar()->deleteJournal(jour); | 2929 | calendar()->deleteJournal(jour); |
2927 | updateView(); | 2930 | updateView(); |
2928 | break; | 2931 | break; |
2929 | } // switch | 2932 | } // switch |
2930 | } else { | 2933 | } else { |
2931 | calendar()->deleteJournal(jour);; | 2934 | calendar()->deleteJournal(jour);; |
2932 | updateView(); | 2935 | updateView(); |
2933 | } | 2936 | } |
2934 | emit updateSearchDialog(); | 2937 | emit updateSearchDialog(); |
2935 | } | 2938 | } |
2936 | 2939 | ||
2937 | void CalendarView::deleteEvent(Event *anEvent) | 2940 | void CalendarView::deleteEvent(Event *anEvent) |
2938 | { | 2941 | { |
2939 | if (!anEvent) { | 2942 | if (!anEvent) { |
2940 | KNotifyClient::beep(); | 2943 | KNotifyClient::beep(); |
2941 | return; | 2944 | return; |
2942 | } | 2945 | } |
2943 | 2946 | ||
2944 | if (anEvent->recurrence()->doesRecur()) { | 2947 | if (anEvent->recurrence()->doesRecur()) { |
2945 | QDate itemDate = mViewManager->currentSelectionDate(); | 2948 | QDate itemDate = mViewManager->currentSelectionDate(); |
2946 | int km; | 2949 | int km; |
2947 | if (!itemDate.isValid()) { | 2950 | if (!itemDate.isValid()) { |
2948 | //kdDebug() << "Date Not Valid" << endl; | 2951 | //kdDebug() << "Date Not Valid" << endl; |
2949 | if (KOPrefs::instance()->mConfirm) { | 2952 | if (KOPrefs::instance()->mConfirm) { |
2950 | km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + | 2953 | km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + |
2951 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 2954 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
2952 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 2955 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
2953 | if ( km == KMessageBox::Continue ) | 2956 | if ( km == KMessageBox::Continue ) |
2954 | km = KMessageBox::No; // No = all below | 2957 | km = KMessageBox::No; // No = all below |
2955 | } else | 2958 | } else |
2956 | km = KMessageBox::No; | 2959 | km = KMessageBox::No; |
2957 | } else { | 2960 | } else { |
2958 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + | 2961 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + |
2959 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 2962 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
2960 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 2963 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
2961 | i18n("KO/Pi Confirmation"),i18n("Current"), | 2964 | i18n("KO/Pi Confirmation"),i18n("Current"), |
2962 | i18n("All")); | 2965 | i18n("All")); |
2963 | } | 2966 | } |
2964 | switch(km) { | 2967 | switch(km) { |
2965 | 2968 | ||
2966 | case KMessageBox::No: // Continue // all | 2969 | case KMessageBox::No: // Continue // all |
2967 | //qDebug("KMessageBox::No "); | 2970 | //qDebug("KMessageBox::No "); |
2968 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2971 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2969 | schedule(Scheduler::Cancel,anEvent); | 2972 | schedule(Scheduler::Cancel,anEvent); |
2970 | 2973 | ||
2971 | checkExternalId( anEvent); | 2974 | checkExternalId( anEvent); |
2972 | mCalendar->deleteEvent(anEvent); | 2975 | mCalendar->deleteEvent(anEvent); |
@@ -3438,96 +3441,113 @@ void CalendarView::processIncidenceSelection( Incidence *incidence ) | |||
3438 | } else { | 3441 | } else { |
3439 | emit groupEventsSelected(false); | 3442 | emit groupEventsSelected(false); |
3440 | } | 3443 | } |
3441 | return; | 3444 | return; |
3442 | } else { | 3445 | } else { |
3443 | emit todoSelected( false ); | 3446 | emit todoSelected( false ); |
3444 | emit organizerEventsSelected(false); | 3447 | emit organizerEventsSelected(false); |
3445 | emit groupEventsSelected(false); | 3448 | emit groupEventsSelected(false); |
3446 | } | 3449 | } |
3447 | return; | 3450 | return; |
3448 | } | 3451 | } |
3449 | 3452 | ||
3450 | /* if ( incidence && incidence->type() == "Todo" ) { | 3453 | /* if ( incidence && incidence->type() == "Todo" ) { |
3451 | emit todoSelected( true ); | 3454 | emit todoSelected( true ); |
3452 | } else { | 3455 | } else { |
3453 | emit todoSelected( false ); | 3456 | emit todoSelected( false ); |
3454 | }*/ | 3457 | }*/ |
3455 | } | 3458 | } |
3456 | 3459 | ||
3457 | 3460 | ||
3458 | void CalendarView::checkClipboard() | 3461 | void CalendarView::checkClipboard() |
3459 | { | 3462 | { |
3460 | #ifndef KORG_NODND | 3463 | #ifndef KORG_NODND |
3461 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 3464 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
3462 | emit pasteEnabled(true); | 3465 | emit pasteEnabled(true); |
3463 | } else { | 3466 | } else { |
3464 | emit pasteEnabled(false); | 3467 | emit pasteEnabled(false); |
3465 | } | 3468 | } |
3466 | #endif | 3469 | #endif |
3467 | } | 3470 | } |
3468 | 3471 | ||
3469 | void CalendarView::showDates(const DateList &selectedDates) | 3472 | void CalendarView::showDates(const DateList &selectedDates) |
3470 | { | 3473 | { |
3471 | // kdDebug() << "CalendarView::selectDates()" << endl; | 3474 | // kdDebug() << "CalendarView::selectDates()" << endl; |
3472 | 3475 | ||
3473 | 3476 | ||
3474 | if ( !mBlockShowDates ) { | 3477 | if ( !mBlockShowDates ) { |
3475 | if ( mViewManager->currentView() ) { | 3478 | if ( mViewManager->currentView() ) { |
3476 | updateView( selectedDates.first(), selectedDates.last() ); | 3479 | updateView( selectedDates.first(), selectedDates.last() ); |
3477 | } else { | 3480 | } else { |
3478 | mViewManager->showAgendaView(); | 3481 | mViewManager->showAgendaView(); |
3479 | } | 3482 | } |
3480 | } | 3483 | } |
3481 | 3484 | ||
3482 | QString selDates; | 3485 | QString selDates; |
3483 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); | 3486 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); |
3484 | if (selectedDates.first() < selectedDates.last() ) | 3487 | if (selectedDates.first() < selectedDates.last() ) |
3485 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3488 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3489 | else { | ||
3490 | QString addString; | ||
3491 | if ( selectedDates.first() == QDateTime::currentDateTime().date() ) | ||
3492 | addString = i18n("Today"); | ||
3493 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | ||
3494 | addString = i18n("Tomorrow"); | ||
3495 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | ||
3496 | addString = i18n("Yesterday"); | ||
3497 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | ||
3498 | addString = i18n("Day before yesterday"); | ||
3499 | else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | ||
3500 | addString = i18n("Day after tomorrow"); | ||
3501 | if ( !addString.isEmpty() ) { | ||
3502 | topLevelWidget()->setCaption( addString+", " + selDates ); | ||
3503 | return; | ||
3504 | } | ||
3505 | } | ||
3486 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 3506 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
3487 | 3507 | ||
3488 | } | 3508 | } |
3489 | 3509 | ||
3490 | QPtrList<CalFilter> CalendarView::filters() | 3510 | QPtrList<CalFilter> CalendarView::filters() |
3491 | { | 3511 | { |
3492 | return mFilters; | 3512 | return mFilters; |
3493 | 3513 | ||
3494 | } | 3514 | } |
3495 | void CalendarView::editFilters() | 3515 | void CalendarView::editFilters() |
3496 | { | 3516 | { |
3497 | // kdDebug() << "CalendarView::editFilters()" << endl; | 3517 | // kdDebug() << "CalendarView::editFilters()" << endl; |
3498 | 3518 | ||
3499 | CalFilter *filter = mFilters.first(); | 3519 | CalFilter *filter = mFilters.first(); |
3500 | while(filter) { | 3520 | while(filter) { |
3501 | kdDebug() << " Filter: " << filter->name() << endl; | 3521 | kdDebug() << " Filter: " << filter->name() << endl; |
3502 | filter = mFilters.next(); | 3522 | filter = mFilters.next(); |
3503 | } | 3523 | } |
3504 | 3524 | ||
3505 | mDialogManager->showFilterEditDialog(&mFilters); | 3525 | mDialogManager->showFilterEditDialog(&mFilters); |
3506 | } | 3526 | } |
3507 | void CalendarView::toggleFilter() | 3527 | void CalendarView::toggleFilter() |
3508 | { | 3528 | { |
3509 | showFilter(! mFilterView->isVisible()); | 3529 | showFilter(! mFilterView->isVisible()); |
3510 | } | 3530 | } |
3511 | 3531 | ||
3512 | KOFilterView *CalendarView::filterView() | 3532 | KOFilterView *CalendarView::filterView() |
3513 | { | 3533 | { |
3514 | return mFilterView; | 3534 | return mFilterView; |
3515 | } | 3535 | } |
3516 | void CalendarView::selectFilter( int fil ) | 3536 | void CalendarView::selectFilter( int fil ) |
3517 | { | 3537 | { |
3518 | mFilterView->setSelectedFilter( fil ); | 3538 | mFilterView->setSelectedFilter( fil ); |
3519 | } | 3539 | } |
3520 | void CalendarView::showFilter(bool visible) | 3540 | void CalendarView::showFilter(bool visible) |
3521 | { | 3541 | { |
3522 | if (visible) mFilterView->show(); | 3542 | if (visible) mFilterView->show(); |
3523 | else mFilterView->hide(); | 3543 | else mFilterView->hide(); |
3524 | } | 3544 | } |
3525 | void CalendarView::toggleFilerEnabled( ) | 3545 | void CalendarView::toggleFilerEnabled( ) |
3526 | { | 3546 | { |
3527 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 3547 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
3528 | if ( !mFilterView->filtersEnabled() ) | 3548 | if ( !mFilterView->filtersEnabled() ) |
3529 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 3549 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
3530 | 3550 | ||
3531 | } | 3551 | } |
3532 | void CalendarView::updateFilter() | 3552 | void CalendarView::updateFilter() |
3533 | { | 3553 | { |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index e27da9a..c8d6bdd 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -440,97 +440,97 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
440 | void syncExternal( int mode ); | 440 | void syncExternal( int mode ); |
441 | void slotSelectPickerDate( QDate ) ; | 441 | void slotSelectPickerDate( QDate ) ; |
442 | void showDatePicker( ) ; | 442 | void showDatePicker( ) ; |
443 | void moveIncidence(Incidence *) ; | 443 | void moveIncidence(Incidence *) ; |
444 | void beamIncidence(Incidence *) ; | 444 | void beamIncidence(Incidence *) ; |
445 | void beamCalendar() ; | 445 | void beamCalendar() ; |
446 | void beamFilteredCalendar() ; | 446 | void beamFilteredCalendar() ; |
447 | void beamIncidenceList(QPtrList<Incidence>) ; | 447 | void beamIncidenceList(QPtrList<Incidence>) ; |
448 | void manageCategories(); | 448 | void manageCategories(); |
449 | int addCategories(); | 449 | int addCategories(); |
450 | void removeCategories(); | 450 | void removeCategories(); |
451 | void setSyncDevice( QString ); | 451 | void setSyncDevice( QString ); |
452 | void setSyncName( QString ); | 452 | void setSyncName( QString ); |
453 | void showDay( QDate ); | 453 | void showDay( QDate ); |
454 | void undo_delete(); | 454 | void undo_delete(); |
455 | protected slots: | 455 | protected slots: |
456 | void timerAlarm(); | 456 | void timerAlarm(); |
457 | void suspendAlarm(); | 457 | void suspendAlarm(); |
458 | void beamDone( Ir *ir ); | 458 | void beamDone( Ir *ir ); |
459 | /** Select a view or adapt the current view to display the specified dates. */ | 459 | /** Select a view or adapt the current view to display the specified dates. */ |
460 | void showDates( const KCal::DateList & ); | 460 | void showDates( const KCal::DateList & ); |
461 | void selectWeekNum ( int ); | 461 | void selectWeekNum ( int ); |
462 | 462 | ||
463 | public: | 463 | public: |
464 | // show a standard warning | 464 | // show a standard warning |
465 | // returns KMsgBox::yesNoCancel() | 465 | // returns KMsgBox::yesNoCancel() |
466 | int msgCalModified(); | 466 | int msgCalModified(); |
467 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 467 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
468 | 468 | ||
469 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 469 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
470 | virtual void removeSyncInfo( QString syncProfile); | 470 | virtual void removeSyncInfo( QString syncProfile); |
471 | void setSyncManager(KSyncManager* manager); | 471 | void setSyncManager(KSyncManager* manager); |
472 | void setLoadedFileVersion(QDateTime); | 472 | void setLoadedFileVersion(QDateTime); |
473 | bool checkFileVersion(QString fn); | 473 | bool checkFileVersion(QString fn); |
474 | bool checkFileChanged(QString fn); | 474 | bool checkFileChanged(QString fn); |
475 | Event* getLastSyncEvent(); | 475 | Event* getLastSyncEvent(); |
476 | /** Adapt navigation units correpsonding to step size of navigation of the | 476 | /** Adapt navigation units correpsonding to step size of navigation of the |
477 | * current view. | 477 | * current view. |
478 | */ | 478 | */ |
479 | void adaptNavigationUnits(); | 479 | void adaptNavigationUnits(); |
480 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 480 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
481 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 481 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
482 | //Attendee* getYourAttendee(Event *event); | 482 | //Attendee* getYourAttendee(Event *event); |
483 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 483 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
484 | protected: | 484 | protected: |
485 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 485 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
486 | 486 | ||
487 | // returns KMsgBox::OKCandel() | 487 | // returns KMsgBox::OKCandel() |
488 | int msgItemDelete(); | 488 | int msgItemDelete(const QString name); |
489 | void showEventEditor(); | 489 | void showEventEditor(); |
490 | void showTodoEditor(); | 490 | void showTodoEditor(); |
491 | void writeLocale(); | 491 | void writeLocale(); |
492 | Todo *selectedTodo(); | 492 | Todo *selectedTodo(); |
493 | 493 | ||
494 | private: | 494 | private: |
495 | bool mBlockShowDates; | 495 | bool mBlockShowDates; |
496 | KSyncManager* mSyncManager; | 496 | KSyncManager* mSyncManager; |
497 | AlarmDialog * mAlarmDialog; | 497 | AlarmDialog * mAlarmDialog; |
498 | QString mAlarmNotification; | 498 | QString mAlarmNotification; |
499 | QString mSuspendAlarmNotification; | 499 | QString mSuspendAlarmNotification; |
500 | QTimer* mSuspendTimer; | 500 | QTimer* mSuspendTimer; |
501 | QTimer* mAlarmTimer; | 501 | QTimer* mAlarmTimer; |
502 | QTimer* mRecheckAlarmTimer; | 502 | QTimer* mRecheckAlarmTimer; |
503 | void computeAlarm( QString ); | 503 | void computeAlarm( QString ); |
504 | void startAlarm( QString, QString ); | 504 | void startAlarm( QString, QString ); |
505 | void setSyncEventsReadOnly(); | 505 | void setSyncEventsReadOnly(); |
506 | 506 | ||
507 | QDateTime loadedFileVersion; | 507 | QDateTime loadedFileVersion; |
508 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 508 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
509 | void checkExternalId( Incidence * inc ); | 509 | void checkExternalId( Incidence * inc ); |
510 | int mGlobalSyncMode; | 510 | int mGlobalSyncMode; |
511 | QString mCurrentSyncDevice; | 511 | QString mCurrentSyncDevice; |
512 | QString mCurrentSyncName; | 512 | QString mCurrentSyncName; |
513 | KOBeamPrefs* beamDialog; | 513 | KOBeamPrefs* beamDialog; |
514 | void init(); | 514 | void init(); |
515 | int mDatePickerMode; | 515 | int mDatePickerMode; |
516 | bool mFlagEditDescription; | 516 | bool mFlagEditDescription; |
517 | QDateTime mLastCalendarSync; | 517 | QDateTime mLastCalendarSync; |
518 | void createPrinter(); | 518 | void createPrinter(); |
519 | 519 | ||
520 | void calendarModified( bool, Calendar * ); | 520 | void calendarModified( bool, Calendar * ); |
521 | 521 | ||
522 | CalPrinter *mCalPrinter; | 522 | CalPrinter *mCalPrinter; |
523 | 523 | ||
524 | QSplitter *mPanner; | 524 | QSplitter *mPanner; |
525 | QSplitter *mLeftSplitter; | 525 | QSplitter *mLeftSplitter; |
526 | QWidget *mLeftFrame; | 526 | QWidget *mLeftFrame; |
527 | QWidgetStack *mRightFrame; | 527 | QWidgetStack *mRightFrame; |
528 | 528 | ||
529 | KDatePicker* mDatePicker; | 529 | KDatePicker* mDatePicker; |
530 | QVBox* mDateFrame; | 530 | QVBox* mDateFrame; |
531 | NavigatorBar *mNavigatorBar; | 531 | NavigatorBar *mNavigatorBar; |
532 | 532 | ||
533 | KDateNavigator *mDateNavigator; // widget showing small month view. | 533 | KDateNavigator *mDateNavigator; // widget showing small month view. |
534 | 534 | ||
535 | KOFilterView *mFilterView; | 535 | KOFilterView *mFilterView; |
536 | 536 | ||
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 94e1f4c..b4fe965 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -238,116 +238,130 @@ void KOEditorGeneral::pickAlarmSound() | |||
238 | mAlarmSound = fileName; | 238 | mAlarmSound = fileName; |
239 | QToolTip::remove(mAlarmSoundButton); | 239 | QToolTip::remove(mAlarmSoundButton); |
240 | QString dispStr = i18n("Playing '%1'").arg(fileName); | 240 | QString dispStr = i18n("Playing '%1'").arg(fileName); |
241 | QToolTip::add(mAlarmSoundButton, dispStr); | 241 | QToolTip::add(mAlarmSoundButton, dispStr); |
242 | mAlarmProgramButton->setOn(false); | 242 | mAlarmProgramButton->setOn(false); |
243 | mAlarmSoundButton->setOn(true); | 243 | mAlarmSoundButton->setOn(true); |
244 | } else { | 244 | } else { |
245 | mAlarmProgramButton->setOn(true); | 245 | mAlarmProgramButton->setOn(true); |
246 | mAlarmSoundButton->setOn(false); | 246 | mAlarmSoundButton->setOn(false); |
247 | 247 | ||
248 | } | 248 | } |
249 | } | 249 | } |
250 | 250 | ||
251 | if (mAlarmProgramButton->isOn()) | 251 | if (mAlarmProgramButton->isOn()) |
252 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + mAlarmProgram ); | 252 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + mAlarmProgram ); |
253 | if ( mAlarmSoundButton->isOn()) | 253 | if ( mAlarmSoundButton->isOn()) |
254 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio.Al.: ") + mAlarmSound ); | 254 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio.Al.: ") + mAlarmSound ); |
255 | } | 255 | } |
256 | 256 | ||
257 | void KOEditorGeneral::pickAlarmProgram() | 257 | void KOEditorGeneral::pickAlarmProgram() |
258 | { | 258 | { |
259 | if (!mAlarmProgramButton->isOn()) { | 259 | if (!mAlarmProgramButton->isOn()) { |
260 | //mAlarmProgram = ""; | 260 | //mAlarmProgram = ""; |
261 | QToolTip::remove(mAlarmProgramButton); | 261 | QToolTip::remove(mAlarmProgramButton); |
262 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); | 262 | QToolTip::add(mAlarmProgramButton, i18n("No program set")); |
263 | mAlarmProgramButton->setOn(false); | 263 | mAlarmProgramButton->setOn(false); |
264 | mAlarmSoundButton->setOn(true); | 264 | mAlarmSoundButton->setOn(true); |
265 | } else { | 265 | } else { |
266 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm.: ") , 0)); | 266 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm.: ") , 0)); |
267 | if (!fileName.isEmpty()) { | 267 | if (!fileName.isEmpty()) { |
268 | mAlarmProgram = fileName; | 268 | mAlarmProgram = fileName; |
269 | QToolTip::remove(mAlarmProgramButton); | 269 | QToolTip::remove(mAlarmProgramButton); |
270 | QString dispStr = i18n("Running '%1'").arg(fileName); | 270 | QString dispStr = i18n("Running '%1'").arg(fileName); |
271 | QToolTip::add(mAlarmProgramButton, dispStr); | 271 | QToolTip::add(mAlarmProgramButton, dispStr); |
272 | mAlarmSoundButton->setOn(false); | 272 | mAlarmSoundButton->setOn(false); |
273 | mAlarmProgramButton->setOn(true); | 273 | mAlarmProgramButton->setOn(true); |
274 | } else { | 274 | } else { |
275 | mAlarmProgramButton->setOn(false); | 275 | mAlarmProgramButton->setOn(false); |
276 | mAlarmSoundButton->setOn(true); | 276 | mAlarmSoundButton->setOn(true); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | if (mAlarmProgramButton->isOn()) | 279 | if (mAlarmProgramButton->isOn()) |
280 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + mAlarmProgram ); | 280 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + mAlarmProgram ); |
281 | if ( mAlarmSoundButton->isOn()) | 281 | if ( mAlarmSoundButton->isOn()) |
282 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Sound.Al.: ") + mAlarmSound ); | 282 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Sound.Al.: ") + mAlarmSound ); |
283 | } | 283 | } |
284 | 284 | ||
285 | 285 | ||
286 | QString KOEditorGeneral::getFittingPath( const QString s ) | ||
287 | { | ||
288 | int maxlen = 50; | ||
289 | if ( QApplication::desktop()->width() < 640 ) { | ||
290 | if ( QApplication::desktop()->width() < 320 ) | ||
291 | maxlen = 22; | ||
292 | else | ||
293 | maxlen = 35; | ||
294 | } | ||
295 | if ( s.length() > maxlen ) { | ||
296 | return "..."+s.right(maxlen -3); | ||
297 | } | ||
298 | return s; | ||
299 | } | ||
286 | 300 | ||
287 | void KOEditorGeneral::enableAlarmEdit(bool enable) | 301 | void KOEditorGeneral::enableAlarmEdit(bool enable) |
288 | { | 302 | { |
289 | if ( enable ) { | 303 | if ( enable ) { |
290 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { | 304 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { |
291 | mAlarmSoundButton->setOn( true ); | 305 | mAlarmSoundButton->setOn( true ); |
292 | if ( mAlarmSound.isEmpty() ) | 306 | if ( mAlarmSound.isEmpty() ) |
293 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 307 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
294 | else { | 308 | else { |
295 | if ( ! QFile::exists( mAlarmSound ) ) | 309 | if ( ! QFile::exists( mAlarmSound ) ) |
296 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 310 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
297 | } | 311 | } |
298 | } | 312 | } |
299 | if (mAlarmProgramButton->isOn()) | 313 | if (mAlarmProgramButton->isOn()) |
300 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + mAlarmProgram ); | 314 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
301 | if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) | 315 | if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) |
302 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Sound.Al.: ") + mAlarmSound ); | 316 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
303 | } | 317 | } |
304 | else { | 318 | else { |
305 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Alarm disabled")); | 319 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Alarm disabled for this item")); |
306 | 320 | ||
307 | } | 321 | } |
308 | mAlarmTimeEdit->setEnabled(enable); | 322 | mAlarmTimeEdit->setEnabled(enable); |
309 | mAlarmSoundButton->setEnabled(enable); | 323 | mAlarmSoundButton->setEnabled(enable); |
310 | mAlarmProgramButton->setEnabled(enable); | 324 | mAlarmProgramButton->setEnabled(enable); |
311 | mAlarmIncrCombo->setEnabled(enable); | 325 | mAlarmIncrCombo->setEnabled(enable); |
312 | } | 326 | } |
313 | 327 | ||
314 | void KOEditorGeneral::disableAlarmEdit(bool disable) | 328 | void KOEditorGeneral::disableAlarmEdit(bool disable) |
315 | { | 329 | { |
316 | enableAlarmEdit( !disable ); | 330 | enableAlarmEdit( !disable ); |
317 | } | 331 | } |
318 | 332 | ||
319 | void KOEditorGeneral::enableAlarm( bool enable ) | 333 | void KOEditorGeneral::enableAlarm( bool enable ) |
320 | { | 334 | { |
321 | enableAlarmEdit( enable ); | 335 | enableAlarmEdit( enable ); |
322 | } | 336 | } |
323 | 337 | ||
324 | void KOEditorGeneral::alarmDisable(bool disable) | 338 | void KOEditorGeneral::alarmDisable(bool disable) |
325 | { | 339 | { |
326 | if (!disable) { | 340 | if (!disable) { |
327 | //mAlarmBell->setEnabled(true); | 341 | //mAlarmBell->setEnabled(true); |
328 | mAlarmButton->setEnabled(true); | 342 | mAlarmButton->setEnabled(true); |
329 | } else { | 343 | } else { |
330 | //mAlarmBell->setEnabled(false); | 344 | //mAlarmBell->setEnabled(false); |
331 | mAlarmButton->setEnabled(false); | 345 | mAlarmButton->setEnabled(false); |
332 | mAlarmButton->setChecked(false); | 346 | mAlarmButton->setChecked(false); |
333 | mAlarmTimeEdit->setEnabled(false); | 347 | mAlarmTimeEdit->setEnabled(false); |
334 | mAlarmSoundButton->setEnabled(false); | 348 | mAlarmSoundButton->setEnabled(false); |
335 | mAlarmProgramButton->setEnabled(false); | 349 | mAlarmProgramButton->setEnabled(false); |
336 | mAlarmIncrCombo->setEnabled(false); | 350 | mAlarmIncrCombo->setEnabled(false); |
337 | } | 351 | } |
338 | } | 352 | } |
339 | 353 | ||
340 | void KOEditorGeneral::setCategories(const QString &str) | 354 | void KOEditorGeneral::setCategories(const QString &str) |
341 | { | 355 | { |
342 | mCategoriesLabel->setText(str); | 356 | mCategoriesLabel->setText(str); |
343 | } | 357 | } |
344 | 358 | ||
345 | void KOEditorGeneral::setDefaults(bool allDay) | 359 | void KOEditorGeneral::setDefaults(bool allDay) |
346 | { | 360 | { |
347 | #if 0 | 361 | #if 0 |
348 | mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); | 362 | mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); |
349 | #endif | 363 | #endif |
350 | 364 | ||
351 | enableAlarmEdit( !allDay ); | 365 | enableAlarmEdit( !allDay ); |
352 | 366 | ||
353 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. | 367 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. |
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h index c58335e..de8edaf 100644 --- a/korganizer/koeditorgeneral.h +++ b/korganizer/koeditorgeneral.h | |||
@@ -60,53 +60,54 @@ class KOEditorGeneral : public QObject | |||
60 | void initAlarm(QWidget *,QBoxLayout *); | 60 | void initAlarm(QWidget *,QBoxLayout *); |
61 | 61 | ||
62 | /** Set widgets to default values */ | 62 | /** Set widgets to default values */ |
63 | void setDefaults(bool allDay); | 63 | void setDefaults(bool allDay); |
64 | /** Read event object and setup widgets accordingly */ | 64 | /** Read event object and setup widgets accordingly */ |
65 | void readIncidence(Incidence *); | 65 | void readIncidence(Incidence *); |
66 | /** Write event settings to event object */ | 66 | /** Write event settings to event object */ |
67 | void writeIncidence(Incidence *); | 67 | void writeIncidence(Incidence *); |
68 | 68 | ||
69 | /** Check if the input is valid. */ | 69 | /** Check if the input is valid. */ |
70 | bool validateInput() { return true; } | 70 | bool validateInput() { return true; } |
71 | 71 | ||
72 | void enableAlarm( bool enable ); | 72 | void enableAlarm( bool enable ); |
73 | void setSecrecy( int num ); | 73 | void setSecrecy( int num ); |
74 | public slots: | 74 | public slots: |
75 | void setCategories(const QString &); | 75 | void setCategories(const QString &); |
76 | void editCategories(); | 76 | void editCategories(); |
77 | 77 | ||
78 | protected slots: | 78 | protected slots: |
79 | void enableAlarmEdit( bool enable ); | 79 | void enableAlarmEdit( bool enable ); |
80 | void disableAlarmEdit( bool disable ); | 80 | void disableAlarmEdit( bool disable ); |
81 | void alarmDisable( bool disable ); | 81 | void alarmDisable( bool disable ); |
82 | void pickAlarmSound(); | 82 | void pickAlarmSound(); |
83 | void pickAlarmProgram(); | 83 | void pickAlarmProgram(); |
84 | 84 | ||
85 | signals: | 85 | signals: |
86 | void openCategoryDialog(); | 86 | void openCategoryDialog(); |
87 | void allAccepted(); | 87 | void allAccepted(); |
88 | 88 | ||
89 | protected: | 89 | protected: |
90 | //QLineEdit *mSummaryEdit; | 90 | //QLineEdit *mSummaryEdit; |
91 | //QLineEdit *mLocationEdit; | 91 | //QLineEdit *mLocationEdit; |
92 | KOLocationBox *mSummaryEdit; | 92 | KOLocationBox *mSummaryEdit; |
93 | KOLocationBox *mLocationEdit; | 93 | KOLocationBox *mLocationEdit; |
94 | QLabel *mAlarmBell; | 94 | QLabel *mAlarmBell; |
95 | QCheckBox *mAlarmButton; | 95 | QCheckBox *mAlarmButton; |
96 | QSpinBox *mAlarmTimeEdit; | 96 | QSpinBox *mAlarmTimeEdit; |
97 | QPushButton *mAlarmSoundButton; | 97 | QPushButton *mAlarmSoundButton; |
98 | QPushButton *mAlarmProgramButton; | 98 | QPushButton *mAlarmProgramButton; |
99 | QComboBox *mAlarmIncrCombo; | 99 | QComboBox *mAlarmIncrCombo; |
100 | KTextEdit *mDescriptionEdit; | 100 | KTextEdit *mDescriptionEdit; |
101 | QLabel *mOwnerLabel; | 101 | QLabel *mOwnerLabel; |
102 | QComboBox *mSecrecyCombo; | 102 | QComboBox *mSecrecyCombo; |
103 | QCheckBox *mCancelBox; | 103 | QCheckBox *mCancelBox; |
104 | QPushButton *mCategoriesButton; | 104 | QPushButton *mCategoriesButton; |
105 | QLabel *mCategoriesLabel; | 105 | QLabel *mCategoriesLabel; |
106 | 106 | ||
107 | private: | 107 | private: |
108 | QString getFittingPath( const QString ) ; | ||
108 | QString mAlarmSound; | 109 | QString mAlarmSound; |
109 | QString mAlarmProgram; | 110 | QString mAlarmProgram; |
110 | }; | 111 | }; |
111 | 112 | ||
112 | #endif | 113 | #endif |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 97b4a03..30adb06 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -773,102 +773,97 @@ void KOTodoView::reparentTodo() | |||
773 | if (mActiveItem) { | 773 | if (mActiveItem) { |
774 | qDebug("KOTodoView::reparentTodo() "); | 774 | qDebug("KOTodoView::reparentTodo() "); |
775 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 775 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
776 | pendingSubtodo = mActiveItem; | 776 | pendingSubtodo = mActiveItem; |
777 | } | 777 | } |
778 | } | 778 | } |
779 | void KOTodoView::editTodo() | 779 | void KOTodoView::editTodo() |
780 | { | 780 | { |
781 | if (mActiveItem) { | 781 | if (mActiveItem) { |
782 | emit editTodoSignal(mActiveItem->todo()); | 782 | emit editTodoSignal(mActiveItem->todo()); |
783 | } | 783 | } |
784 | } | 784 | } |
785 | void KOTodoView::cloneTodo() | 785 | void KOTodoView::cloneTodo() |
786 | { | 786 | { |
787 | if (mActiveItem) { | 787 | if (mActiveItem) { |
788 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 788 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
789 | } | 789 | } |
790 | } | 790 | } |
791 | void KOTodoView::cancelTodo() | 791 | void KOTodoView::cancelTodo() |
792 | { | 792 | { |
793 | if (mActiveItem) { | 793 | if (mActiveItem) { |
794 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 794 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
795 | } | 795 | } |
796 | } | 796 | } |
797 | void KOTodoView::moveTodo() | 797 | void KOTodoView::moveTodo() |
798 | { | 798 | { |
799 | if (mActiveItem) { | 799 | if (mActiveItem) { |
800 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 800 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
801 | } | 801 | } |
802 | } | 802 | } |
803 | void KOTodoView::beamTodo() | 803 | void KOTodoView::beamTodo() |
804 | { | 804 | { |
805 | if (mActiveItem) { | 805 | if (mActiveItem) { |
806 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 806 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
807 | } | 807 | } |
808 | } | 808 | } |
809 | 809 | ||
810 | 810 | ||
811 | void KOTodoView::showTodo() | 811 | void KOTodoView::showTodo() |
812 | { | 812 | { |
813 | if (mActiveItem) { | 813 | if (mActiveItem) { |
814 | emit showTodoSignal(mActiveItem->todo()); | 814 | emit showTodoSignal(mActiveItem->todo()); |
815 | } | 815 | } |
816 | } | 816 | } |
817 | 817 | ||
818 | void KOTodoView::deleteTodo() | 818 | void KOTodoView::deleteTodo() |
819 | { | 819 | { |
820 | if (mActiveItem) { | 820 | if (mActiveItem) { |
821 | if (mActiveItem->childCount()) { | ||
822 | KMessageBox::sorry(this,i18n("Cannot delete To-Do which has children."), | ||
823 | i18n("Delete To-Do")); | ||
824 | } else { | ||
825 | emit deleteTodoSignal(mActiveItem->todo()); | 821 | emit deleteTodoSignal(mActiveItem->todo()); |
826 | } | ||
827 | } | 822 | } |
828 | } | 823 | } |
829 | 824 | ||
830 | void KOTodoView::setNewPriority(int index) | 825 | void KOTodoView::setNewPriority(int index) |
831 | { | 826 | { |
832 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 827 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
833 | mActiveItem->todo()->setPriority(mPriority[index]); | 828 | mActiveItem->todo()->setPriority(mPriority[index]); |
834 | mActiveItem->construct(); | 829 | mActiveItem->construct(); |
835 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 830 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
836 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 831 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
837 | } | 832 | } |
838 | } | 833 | } |
839 | 834 | ||
840 | void KOTodoView::setNewPercentage(int index) | 835 | void KOTodoView::setNewPercentage(int index) |
841 | { | 836 | { |
842 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 837 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
843 | if (mPercentage[index] == 100) { | 838 | if (mPercentage[index] == 100) { |
844 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 839 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
845 | } else { | 840 | } else { |
846 | mActiveItem->todo()->setCompleted(false); | 841 | mActiveItem->todo()->setCompleted(false); |
847 | } | 842 | } |
848 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 843 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
849 | mActiveItem->construct(); | 844 | mActiveItem->construct(); |
850 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 845 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
851 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 846 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
852 | } | 847 | } |
853 | } | 848 | } |
854 | 849 | ||
855 | 850 | ||
856 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 851 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
857 | { | 852 | { |
858 | QPopupMenu* tempMenu = new QPopupMenu (this); | 853 | QPopupMenu* tempMenu = new QPopupMenu (this); |
859 | QStringList checkedCategories = todoItem->todo()->categories (); | 854 | QStringList checkedCategories = todoItem->todo()->categories (); |
860 | 855 | ||
861 | tempMenu->setCheckable (true); | 856 | tempMenu->setCheckable (true); |
862 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 857 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
863 | it != KOPrefs::instance()->mCustomCategories.end (); | 858 | it != KOPrefs::instance()->mCustomCategories.end (); |
864 | ++it) { | 859 | ++it) { |
865 | int index = tempMenu->insertItem (*it); | 860 | int index = tempMenu->insertItem (*it); |
866 | mCategory[index] = *it; | 861 | mCategory[index] = *it; |
867 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 862 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); |
868 | } | 863 | } |
869 | 864 | ||
870 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 865 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
871 | return tempMenu; | 866 | return tempMenu; |
872 | 867 | ||
873 | 868 | ||
874 | } | 869 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 151b55b..7b07a2e 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1659,97 +1659,106 @@ void MainWindow::fillFilterMenu() | |||
1659 | if ( disable ) | 1659 | if ( disable ) |
1660 | selectFilterMenu->setItemEnabled( iii, false ); | 1660 | selectFilterMenu->setItemEnabled( iii, false ); |
1661 | filter = fili.next(); | 1661 | filter = fili.next(); |
1662 | ++iii; | 1662 | ++iii; |
1663 | } | 1663 | } |
1664 | } | 1664 | } |
1665 | void MainWindow::selectFilter( int fil ) | 1665 | void MainWindow::selectFilter( int fil ) |
1666 | { | 1666 | { |
1667 | if ( fil == 0 ) { | 1667 | if ( fil == 0 ) { |
1668 | mView->editFilters( ); | 1668 | mView->editFilters( ); |
1669 | } else if ( fil == 1 ){ | 1669 | } else if ( fil == 1 ){ |
1670 | mView->toggleFilerEnabled( ); | 1670 | mView->toggleFilerEnabled( ); |
1671 | } else { | 1671 | } else { |
1672 | mView->selectFilter( fil-2 ); | 1672 | mView->selectFilter( fil-2 ); |
1673 | } | 1673 | } |
1674 | } | 1674 | } |
1675 | void MainWindow::configureToolBar( int item ) | 1675 | void MainWindow::configureToolBar( int item ) |
1676 | { | 1676 | { |
1677 | 1677 | ||
1678 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1678 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1679 | KOPrefs *p = KOPrefs::instance(); | 1679 | KOPrefs *p = KOPrefs::instance(); |
1680 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1680 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1681 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1681 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1682 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1682 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1683 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1683 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1684 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1684 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1685 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1685 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1686 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1686 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1687 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1687 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1688 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1688 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1689 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1689 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1690 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1690 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1691 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1691 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1692 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1692 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1693 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1693 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1694 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1694 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1695 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1695 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1696 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1696 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1697 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1697 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1698 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1698 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1699 | // initActions(); | 1699 | // initActions(); |
1700 | } | 1700 | } |
1701 | 1701 | ||
1702 | void MainWindow::setCaptionToDates() | 1702 | void MainWindow::setCaptionToDates() |
1703 | { | 1703 | { |
1704 | QString selDates; | 1704 | QString selDates; |
1705 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1705 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1706 | if (mView->startDate() < mView->endDate() ) | 1706 | if (mView->startDate() < mView->endDate() ) |
1707 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1707 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1708 | else { | ||
1709 | QString addString; | ||
1710 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) | ||
1711 | addString = i18n("Today"); | ||
1712 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) | ||
1713 | addString = i18n("Tomorrow"); | ||
1714 | if ( !addString.isEmpty() ) | ||
1715 | selDates = addString+", "+selDates ; | ||
1716 | } | ||
1708 | setCaption( i18n("Dates: ") + selDates ); | 1717 | setCaption( i18n("Dates: ") + selDates ); |
1709 | 1718 | ||
1710 | } | 1719 | } |
1711 | // parameter item == 0: reinit | 1720 | // parameter item == 0: reinit |
1712 | void MainWindow::configureAgenda( int item ) | 1721 | void MainWindow::configureAgenda( int item ) |
1713 | { | 1722 | { |
1714 | 1723 | ||
1715 | KOPrefs *p = KOPrefs::instance(); | 1724 | KOPrefs *p = KOPrefs::instance(); |
1716 | 1725 | ||
1717 | int i; | 1726 | int i; |
1718 | // do not allow 4 for widgets higher than 480 | 1727 | // do not allow 4 for widgets higher than 480 |
1719 | // if ( QApplication::desktop()->height() > 480 ) { | 1728 | // if ( QApplication::desktop()->height() > 480 ) { |
1720 | // if ( item == 4 ) | 1729 | // if ( item == 4 ) |
1721 | // item = 6; | 1730 | // item = 6; |
1722 | // } | 1731 | // } |
1723 | for ( i = 4; i <= 18; i= i+2 ) | 1732 | for ( i = 4; i <= 18; i= i+2 ) |
1724 | configureAgendaMenu->setItemChecked( i, false ); | 1733 | configureAgendaMenu->setItemChecked( i, false ); |
1725 | configureAgendaMenu->setItemChecked( item, true ); | 1734 | configureAgendaMenu->setItemChecked( item, true ); |
1726 | if ( p->mHourSize == item ) | 1735 | if ( p->mHourSize == item ) |
1727 | return; | 1736 | return; |
1728 | p->mHourSize=item; | 1737 | p->mHourSize=item; |
1729 | mView->viewManager()->agendaView()->updateConfig(); | 1738 | mView->viewManager()->agendaView()->updateConfig(); |
1730 | } | 1739 | } |
1731 | 1740 | ||
1732 | void MainWindow::saveCalendar() | 1741 | void MainWindow::saveCalendar() |
1733 | { | 1742 | { |
1734 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1743 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1735 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1744 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1736 | 1745 | ||
1737 | if ( fn == "" ) | 1746 | if ( fn == "" ) |
1738 | return; | 1747 | return; |
1739 | QFileInfo info; | 1748 | QFileInfo info; |
1740 | info.setFile( fn ); | 1749 | info.setFile( fn ); |
1741 | QString mes; | 1750 | QString mes; |
1742 | bool createbup = true; | 1751 | bool createbup = true; |
1743 | if ( info. exists() ) { | 1752 | if ( info. exists() ) { |
1744 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1753 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1745 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1754 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1746 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1755 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1747 | 0, 1 ); | 1756 | 0, 1 ); |
1748 | if ( result != 0 ) { | 1757 | if ( result != 0 ) { |
1749 | createbup = false; | 1758 | createbup = false; |
1750 | } | 1759 | } |
1751 | } | 1760 | } |
1752 | if ( createbup ) { | 1761 | if ( createbup ) { |
1753 | mView->saveCalendar( fn ); | 1762 | mView->saveCalendar( fn ); |
1754 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1763 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1755 | KOPrefs::instance()->mLastSaveFile = fn; | 1764 | KOPrefs::instance()->mLastSaveFile = fn; |