author | zautrix <zautrix> | 2004-08-06 15:59:14 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-06 15:59:14 (UTC) |
commit | f3307379ea27ad1394c9107c0129ecd3efd6bca6 (patch) (unidiff) | |
tree | fdfebbebf84b2e86812165fac2bec09f95008ee2 | |
parent | fc862590cffbef8429bb8804dadfa61a21a52c7b (diff) | |
download | kdepimpi-f3307379ea27ad1394c9107c0129ecd3efd6bca6.zip kdepimpi-f3307379ea27ad1394c9107c0129ecd3efd6bca6.tar.gz kdepimpi-f3307379ea27ad1394c9107c0129ecd3efd6bca6.tar.bz2 |
Added qick filter selection to kopi menu
-rw-r--r-- | korganizer/calendarview.cpp | 9 | ||||
-rw-r--r-- | korganizer/calendarview.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 47 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 3 |
4 files changed, 59 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 53c079c..fab4540 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3033,273 +3033,282 @@ bool CalendarView::exportVCalendar( QString filename ) | |||
3033 | 3033 | ||
3034 | // Force correct extension | 3034 | // Force correct extension |
3035 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 3035 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
3036 | 3036 | ||
3037 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 3037 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
3038 | return storage.save(); | 3038 | return storage.save(); |
3039 | 3039 | ||
3040 | } | 3040 | } |
3041 | 3041 | ||
3042 | void CalendarView::eventUpdated(Incidence *) | 3042 | void CalendarView::eventUpdated(Incidence *) |
3043 | { | 3043 | { |
3044 | setModified(); | 3044 | setModified(); |
3045 | // Don't call updateView here. The code, which has caused the update of the | 3045 | // Don't call updateView here. The code, which has caused the update of the |
3046 | // event is responsible for updating the view. | 3046 | // event is responsible for updating the view. |
3047 | // updateView(); | 3047 | // updateView(); |
3048 | } | 3048 | } |
3049 | 3049 | ||
3050 | void CalendarView::adaptNavigationUnits() | 3050 | void CalendarView::adaptNavigationUnits() |
3051 | { | 3051 | { |
3052 | if (mViewManager->currentView()->isEventView()) { | 3052 | if (mViewManager->currentView()->isEventView()) { |
3053 | int days = mViewManager->currentView()->currentDateCount(); | 3053 | int days = mViewManager->currentView()->currentDateCount(); |
3054 | if (days == 1) { | 3054 | if (days == 1) { |
3055 | emit changeNavStringPrev(i18n("&Previous Day")); | 3055 | emit changeNavStringPrev(i18n("&Previous Day")); |
3056 | emit changeNavStringNext(i18n("&Next Day")); | 3056 | emit changeNavStringNext(i18n("&Next Day")); |
3057 | } else { | 3057 | } else { |
3058 | emit changeNavStringPrev(i18n("&Previous Week")); | 3058 | emit changeNavStringPrev(i18n("&Previous Week")); |
3059 | emit changeNavStringNext(i18n("&Next Week")); | 3059 | emit changeNavStringNext(i18n("&Next Week")); |
3060 | } | 3060 | } |
3061 | } | 3061 | } |
3062 | } | 3062 | } |
3063 | 3063 | ||
3064 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 3064 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
3065 | { | 3065 | { |
3066 | if ( incidence ) mTodoList->clearSelection(); | 3066 | if ( incidence ) mTodoList->clearSelection(); |
3067 | processIncidenceSelection( incidence ); | 3067 | processIncidenceSelection( incidence ); |
3068 | } | 3068 | } |
3069 | 3069 | ||
3070 | void CalendarView::processTodoListSelection( Incidence *incidence ) | 3070 | void CalendarView::processTodoListSelection( Incidence *incidence ) |
3071 | { | 3071 | { |
3072 | if ( incidence && mViewManager->currentView() ) { | 3072 | if ( incidence && mViewManager->currentView() ) { |
3073 | mViewManager->currentView()->clearSelection(); | 3073 | mViewManager->currentView()->clearSelection(); |
3074 | } | 3074 | } |
3075 | processIncidenceSelection( incidence ); | 3075 | processIncidenceSelection( incidence ); |
3076 | } | 3076 | } |
3077 | 3077 | ||
3078 | void CalendarView::processIncidenceSelection( Incidence *incidence ) | 3078 | void CalendarView::processIncidenceSelection( Incidence *incidence ) |
3079 | { | 3079 | { |
3080 | if ( incidence == mSelectedIncidence ) return; | 3080 | if ( incidence == mSelectedIncidence ) return; |
3081 | 3081 | ||
3082 | mSelectedIncidence = incidence; | 3082 | mSelectedIncidence = incidence; |
3083 | 3083 | ||
3084 | emit incidenceSelected( mSelectedIncidence ); | 3084 | emit incidenceSelected( mSelectedIncidence ); |
3085 | 3085 | ||
3086 | if ( incidence && incidence->type() == "Event" ) { | 3086 | if ( incidence && incidence->type() == "Event" ) { |
3087 | Event *event = static_cast<Event *>( incidence ); | 3087 | Event *event = static_cast<Event *>( incidence ); |
3088 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3088 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3089 | emit organizerEventsSelected( true ); | 3089 | emit organizerEventsSelected( true ); |
3090 | } else { | 3090 | } else { |
3091 | emit organizerEventsSelected(false); | 3091 | emit organizerEventsSelected(false); |
3092 | } | 3092 | } |
3093 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3093 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3094 | KOPrefs::instance()->email() ) ) { | 3094 | KOPrefs::instance()->email() ) ) { |
3095 | emit groupEventsSelected( true ); | 3095 | emit groupEventsSelected( true ); |
3096 | } else { | 3096 | } else { |
3097 | emit groupEventsSelected(false); | 3097 | emit groupEventsSelected(false); |
3098 | } | 3098 | } |
3099 | return; | 3099 | return; |
3100 | } else { | 3100 | } else { |
3101 | if ( incidence && incidence->type() == "Todo" ) { | 3101 | if ( incidence && incidence->type() == "Todo" ) { |
3102 | emit todoSelected( true ); | 3102 | emit todoSelected( true ); |
3103 | Todo *event = static_cast<Todo *>( incidence ); | 3103 | Todo *event = static_cast<Todo *>( incidence ); |
3104 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3104 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3105 | emit organizerEventsSelected( true ); | 3105 | emit organizerEventsSelected( true ); |
3106 | } else { | 3106 | } else { |
3107 | emit organizerEventsSelected(false); | 3107 | emit organizerEventsSelected(false); |
3108 | } | 3108 | } |
3109 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3109 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3110 | KOPrefs::instance()->email() ) ) { | 3110 | KOPrefs::instance()->email() ) ) { |
3111 | emit groupEventsSelected( true ); | 3111 | emit groupEventsSelected( true ); |
3112 | } else { | 3112 | } else { |
3113 | emit groupEventsSelected(false); | 3113 | emit groupEventsSelected(false); |
3114 | } | 3114 | } |
3115 | return; | 3115 | return; |
3116 | } else { | 3116 | } else { |
3117 | emit todoSelected( false ); | 3117 | emit todoSelected( false ); |
3118 | emit organizerEventsSelected(false); | 3118 | emit organizerEventsSelected(false); |
3119 | emit groupEventsSelected(false); | 3119 | emit groupEventsSelected(false); |
3120 | } | 3120 | } |
3121 | return; | 3121 | return; |
3122 | } | 3122 | } |
3123 | 3123 | ||
3124 | /* if ( incidence && incidence->type() == "Todo" ) { | 3124 | /* if ( incidence && incidence->type() == "Todo" ) { |
3125 | emit todoSelected( true ); | 3125 | emit todoSelected( true ); |
3126 | } else { | 3126 | } else { |
3127 | emit todoSelected( false ); | 3127 | emit todoSelected( false ); |
3128 | }*/ | 3128 | }*/ |
3129 | } | 3129 | } |
3130 | 3130 | ||
3131 | 3131 | ||
3132 | void CalendarView::checkClipboard() | 3132 | void CalendarView::checkClipboard() |
3133 | { | 3133 | { |
3134 | #ifndef KORG_NODND | 3134 | #ifndef KORG_NODND |
3135 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 3135 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
3136 | emit pasteEnabled(true); | 3136 | emit pasteEnabled(true); |
3137 | } else { | 3137 | } else { |
3138 | emit pasteEnabled(false); | 3138 | emit pasteEnabled(false); |
3139 | } | 3139 | } |
3140 | #endif | 3140 | #endif |
3141 | } | 3141 | } |
3142 | 3142 | ||
3143 | void CalendarView::showDates(const DateList &selectedDates) | 3143 | void CalendarView::showDates(const DateList &selectedDates) |
3144 | { | 3144 | { |
3145 | // kdDebug() << "CalendarView::selectDates()" << endl; | 3145 | // kdDebug() << "CalendarView::selectDates()" << endl; |
3146 | 3146 | ||
3147 | if ( mViewManager->currentView() ) { | 3147 | if ( mViewManager->currentView() ) { |
3148 | updateView( selectedDates.first(), selectedDates.last() ); | 3148 | updateView( selectedDates.first(), selectedDates.last() ); |
3149 | } else { | 3149 | } else { |
3150 | mViewManager->showAgendaView(); | 3150 | mViewManager->showAgendaView(); |
3151 | } | 3151 | } |
3152 | 3152 | ||
3153 | QString selDates; | 3153 | QString selDates; |
3154 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); | 3154 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); |
3155 | if (selectedDates.first() < selectedDates.last() ) | 3155 | if (selectedDates.first() < selectedDates.last() ) |
3156 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3156 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3157 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 3157 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
3158 | 3158 | ||
3159 | } | 3159 | } |
3160 | 3160 | ||
3161 | QPtrList<CalFilter> CalendarView::filters() | ||
3162 | { | ||
3163 | return mFilters; | ||
3164 | |||
3165 | } | ||
3161 | void CalendarView::editFilters() | 3166 | void CalendarView::editFilters() |
3162 | { | 3167 | { |
3163 | // kdDebug() << "CalendarView::editFilters()" << endl; | 3168 | // kdDebug() << "CalendarView::editFilters()" << endl; |
3164 | 3169 | ||
3165 | CalFilter *filter = mFilters.first(); | 3170 | CalFilter *filter = mFilters.first(); |
3166 | while(filter) { | 3171 | while(filter) { |
3167 | kdDebug() << " Filter: " << filter->name() << endl; | 3172 | kdDebug() << " Filter: " << filter->name() << endl; |
3168 | filter = mFilters.next(); | 3173 | filter = mFilters.next(); |
3169 | } | 3174 | } |
3170 | 3175 | ||
3171 | mDialogManager->showFilterEditDialog(&mFilters); | 3176 | mDialogManager->showFilterEditDialog(&mFilters); |
3172 | } | 3177 | } |
3173 | void CalendarView::toggleFilter() | 3178 | void CalendarView::toggleFilter() |
3174 | { | 3179 | { |
3175 | showFilter(! mFilterView->isVisible()); | 3180 | showFilter(! mFilterView->isVisible()); |
3176 | } | 3181 | } |
3177 | 3182 | ||
3183 | KOFilterView *CalendarView::filterView() | ||
3184 | { | ||
3185 | return mFilterView; | ||
3186 | } | ||
3178 | void CalendarView::selectFilter( int fil ) | 3187 | void CalendarView::selectFilter( int fil ) |
3179 | { | 3188 | { |
3180 | mFilterView->setSelectedFilter( fil ); | 3189 | mFilterView->setSelectedFilter( fil ); |
3181 | } | 3190 | } |
3182 | void CalendarView::showFilter(bool visible) | 3191 | void CalendarView::showFilter(bool visible) |
3183 | { | 3192 | { |
3184 | if (visible) mFilterView->show(); | 3193 | if (visible) mFilterView->show(); |
3185 | else mFilterView->hide(); | 3194 | else mFilterView->hide(); |
3186 | } | 3195 | } |
3187 | void CalendarView::toggleFilerEnabled( ) | 3196 | void CalendarView::toggleFilerEnabled( ) |
3188 | { | 3197 | { |
3189 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 3198 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
3190 | if ( !mFilterView->filtersEnabled() ) | 3199 | if ( !mFilterView->filtersEnabled() ) |
3191 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 3200 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
3192 | 3201 | ||
3193 | } | 3202 | } |
3194 | void CalendarView::updateFilter() | 3203 | void CalendarView::updateFilter() |
3195 | { | 3204 | { |
3196 | CalFilter *filter = mFilterView->selectedFilter(); | 3205 | CalFilter *filter = mFilterView->selectedFilter(); |
3197 | if (filter) { | 3206 | if (filter) { |
3198 | if (mFilterView->filtersEnabled()) { | 3207 | if (mFilterView->filtersEnabled()) { |
3199 | topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); | 3208 | topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); |
3200 | filter->setEnabled(true); | 3209 | filter->setEnabled(true); |
3201 | } | 3210 | } |
3202 | else filter->setEnabled(false); | 3211 | else filter->setEnabled(false); |
3203 | mCalendar->setFilter(filter); | 3212 | mCalendar->setFilter(filter); |
3204 | updateView(); | 3213 | updateView(); |
3205 | } | 3214 | } |
3206 | } | 3215 | } |
3207 | 3216 | ||
3208 | void CalendarView::filterEdited() | 3217 | void CalendarView::filterEdited() |
3209 | { | 3218 | { |
3210 | mFilterView->updateFilters(); | 3219 | mFilterView->updateFilters(); |
3211 | updateFilter(); | 3220 | updateFilter(); |
3212 | writeSettings(); | 3221 | writeSettings(); |
3213 | } | 3222 | } |
3214 | 3223 | ||
3215 | 3224 | ||
3216 | void CalendarView::takeOverEvent() | 3225 | void CalendarView::takeOverEvent() |
3217 | { | 3226 | { |
3218 | Incidence *incidence = currentSelection(); | 3227 | Incidence *incidence = currentSelection(); |
3219 | 3228 | ||
3220 | if (!incidence) return; | 3229 | if (!incidence) return; |
3221 | 3230 | ||
3222 | incidence->setOrganizer(KOPrefs::instance()->email()); | 3231 | incidence->setOrganizer(KOPrefs::instance()->email()); |
3223 | incidence->recreate(); | 3232 | incidence->recreate(); |
3224 | incidence->setReadOnly(false); | 3233 | incidence->setReadOnly(false); |
3225 | 3234 | ||
3226 | updateView(); | 3235 | updateView(); |
3227 | } | 3236 | } |
3228 | 3237 | ||
3229 | void CalendarView::takeOverCalendar() | 3238 | void CalendarView::takeOverCalendar() |
3230 | { | 3239 | { |
3231 | // TODO: Create Calendar::allIncidences() function and use it here | 3240 | // TODO: Create Calendar::allIncidences() function and use it here |
3232 | 3241 | ||
3233 | QPtrList<Event> events = mCalendar->events(); | 3242 | QPtrList<Event> events = mCalendar->events(); |
3234 | for(uint i=0; i<events.count(); ++i) { | 3243 | for(uint i=0; i<events.count(); ++i) { |
3235 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3244 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3236 | events.at(i)->recreate(); | 3245 | events.at(i)->recreate(); |
3237 | events.at(i)->setReadOnly(false); | 3246 | events.at(i)->setReadOnly(false); |
3238 | } | 3247 | } |
3239 | 3248 | ||
3240 | QPtrList<Todo> todos = mCalendar->todos(); | 3249 | QPtrList<Todo> todos = mCalendar->todos(); |
3241 | for(uint i=0; i<todos.count(); ++i) { | 3250 | for(uint i=0; i<todos.count(); ++i) { |
3242 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3251 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3243 | todos.at(i)->recreate(); | 3252 | todos.at(i)->recreate(); |
3244 | todos.at(i)->setReadOnly(false); | 3253 | todos.at(i)->setReadOnly(false); |
3245 | } | 3254 | } |
3246 | 3255 | ||
3247 | QPtrList<Journal> journals = mCalendar->journals(); | 3256 | QPtrList<Journal> journals = mCalendar->journals(); |
3248 | for(uint i=0; i<journals.count(); ++i) { | 3257 | for(uint i=0; i<journals.count(); ++i) { |
3249 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3258 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3250 | journals.at(i)->recreate(); | 3259 | journals.at(i)->recreate(); |
3251 | journals.at(i)->setReadOnly(false); | 3260 | journals.at(i)->setReadOnly(false); |
3252 | } | 3261 | } |
3253 | 3262 | ||
3254 | updateView(); | 3263 | updateView(); |
3255 | } | 3264 | } |
3256 | 3265 | ||
3257 | void CalendarView::showIntro() | 3266 | void CalendarView::showIntro() |
3258 | { | 3267 | { |
3259 | kdDebug() << "To be implemented." << endl; | 3268 | kdDebug() << "To be implemented." << endl; |
3260 | } | 3269 | } |
3261 | 3270 | ||
3262 | QWidgetStack *CalendarView::viewStack() | 3271 | QWidgetStack *CalendarView::viewStack() |
3263 | { | 3272 | { |
3264 | return mRightFrame; | 3273 | return mRightFrame; |
3265 | } | 3274 | } |
3266 | 3275 | ||
3267 | QWidget *CalendarView::leftFrame() | 3276 | QWidget *CalendarView::leftFrame() |
3268 | { | 3277 | { |
3269 | return mLeftFrame; | 3278 | return mLeftFrame; |
3270 | } | 3279 | } |
3271 | 3280 | ||
3272 | DateNavigator *CalendarView::dateNavigator() | 3281 | DateNavigator *CalendarView::dateNavigator() |
3273 | { | 3282 | { |
3274 | return mNavigator; | 3283 | return mNavigator; |
3275 | } | 3284 | } |
3276 | 3285 | ||
3277 | KDateNavigator* CalendarView::dateNavigatorWidget() | 3286 | KDateNavigator* CalendarView::dateNavigatorWidget() |
3278 | { | 3287 | { |
3279 | return mDateNavigator; | 3288 | return mDateNavigator; |
3280 | } | 3289 | } |
3281 | void CalendarView::toggleDateNavigatorWidget() | 3290 | void CalendarView::toggleDateNavigatorWidget() |
3282 | { | 3291 | { |
3283 | if (mDateNavigator->isVisible()) | 3292 | if (mDateNavigator->isVisible()) |
3284 | mDateNavigator->hide(); | 3293 | mDateNavigator->hide(); |
3285 | else | 3294 | else |
3286 | mDateNavigator->show(); | 3295 | mDateNavigator->show(); |
3287 | } | 3296 | } |
3288 | void CalendarView::addView(KOrg::BaseView *view) | 3297 | void CalendarView::addView(KOrg::BaseView *view) |
3289 | { | 3298 | { |
3290 | mViewManager->addView(view); | 3299 | mViewManager->addView(view); |
3291 | } | 3300 | } |
3292 | 3301 | ||
3293 | void CalendarView::showView(KOrg::BaseView *view) | 3302 | void CalendarView::showView(KOrg::BaseView *view) |
3294 | { | 3303 | { |
3295 | mViewManager->showView(view, mLeftFrame->isVisible()); | 3304 | mViewManager->showView(view, mLeftFrame->isVisible()); |
3296 | } | 3305 | } |
3297 | 3306 | ||
3298 | Incidence *CalendarView::currentSelection() | 3307 | Incidence *CalendarView::currentSelection() |
3299 | { | 3308 | { |
3300 | return mViewManager->currentSelection(); | 3309 | return mViewManager->currentSelection(); |
3301 | } | 3310 | } |
3302 | void CalendarView::toggleAllDaySize() | 3311 | void CalendarView::toggleAllDaySize() |
3303 | { | 3312 | { |
3304 | /* | 3313 | /* |
3305 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 3314 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index f7a1213..d564473 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -252,262 +252,263 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
252 | /** create new todo with a parent todo */ | 252 | /** create new todo with a parent todo */ |
253 | void newSubTodo(Todo *); | 253 | void newSubTodo(Todo *); |
254 | /** Delete todo */ | 254 | /** Delete todo */ |
255 | void deleteTodo(Todo *); | 255 | void deleteTodo(Todo *); |
256 | 256 | ||
257 | 257 | ||
258 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 258 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
259 | * emitted as result. */ | 259 | * emitted as result. */ |
260 | void checkClipboard(); | 260 | void checkClipboard(); |
261 | 261 | ||
262 | /** using the KConfig associated with the kapp variable, read in the | 262 | /** using the KConfig associated with the kapp variable, read in the |
263 | * settings from the config file. | 263 | * settings from the config file. |
264 | */ | 264 | */ |
265 | void readSettings(); | 265 | void readSettings(); |
266 | 266 | ||
267 | /** write current state to config file. */ | 267 | /** write current state to config file. */ |
268 | void writeSettings(); | 268 | void writeSettings(); |
269 | 269 | ||
270 | /** read settings for calendar filters */ | 270 | /** read settings for calendar filters */ |
271 | void readFilterSettings(KConfig *config); | 271 | void readFilterSettings(KConfig *config); |
272 | 272 | ||
273 | /** write settings for calendar filters */ | 273 | /** write settings for calendar filters */ |
274 | void writeFilterSettings(KConfig *config); | 274 | void writeFilterSettings(KConfig *config); |
275 | 275 | ||
276 | /** passes on the message that an event has changed to the currently | 276 | /** passes on the message that an event has changed to the currently |
277 | * activated view so that it can make appropriate display changes. */ | 277 | * activated view so that it can make appropriate display changes. */ |
278 | void changeEventDisplay(Event *, int); | 278 | void changeEventDisplay(Event *, int); |
279 | void changeIncidenceDisplay(Incidence *, int); | 279 | void changeIncidenceDisplay(Incidence *, int); |
280 | void changeTodoDisplay(Todo *, int); | 280 | void changeTodoDisplay(Todo *, int); |
281 | 281 | ||
282 | void eventAdded(Event *); | 282 | void eventAdded(Event *); |
283 | void eventChanged(Event *); | 283 | void eventChanged(Event *); |
284 | void eventToBeDeleted(Event *); | 284 | void eventToBeDeleted(Event *); |
285 | void eventDeleted(); | 285 | void eventDeleted(); |
286 | 286 | ||
287 | void todoAdded(Todo *); | 287 | void todoAdded(Todo *); |
288 | void todoChanged(Todo *); | 288 | void todoChanged(Todo *); |
289 | void todoToBeDeleted(Todo *); | 289 | void todoToBeDeleted(Todo *); |
290 | void todoDeleted(); | 290 | void todoDeleted(); |
291 | 291 | ||
292 | void updateView(const QDate &start, const QDate &end); | 292 | void updateView(const QDate &start, const QDate &end); |
293 | void updateView(); | 293 | void updateView(); |
294 | 294 | ||
295 | /** Full update of visible todo views */ | 295 | /** Full update of visible todo views */ |
296 | void updateTodoViews(); | 296 | void updateTodoViews(); |
297 | 297 | ||
298 | void updateUnmanagedViews(); | 298 | void updateUnmanagedViews(); |
299 | 299 | ||
300 | /** cut the current appointment to the clipboard */ | 300 | /** cut the current appointment to the clipboard */ |
301 | void edit_cut(); | 301 | void edit_cut(); |
302 | 302 | ||
303 | /** copy the current appointment(s) to the clipboard */ | 303 | /** copy the current appointment(s) to the clipboard */ |
304 | void edit_copy(); | 304 | void edit_copy(); |
305 | 305 | ||
306 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 306 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
307 | void edit_paste(); | 307 | void edit_paste(); |
308 | 308 | ||
309 | /** edit viewing and configuration options. */ | 309 | /** edit viewing and configuration options. */ |
310 | void edit_options(); | 310 | void edit_options(); |
311 | void edit_sync_options(); | 311 | void edit_sync_options(); |
312 | /** | 312 | /** |
313 | Functions for printing, previewing a print, and setting up printing | 313 | Functions for printing, previewing a print, and setting up printing |
314 | parameters. | 314 | parameters. |
315 | */ | 315 | */ |
316 | void print(); | 316 | void print(); |
317 | void printSetup(); | 317 | void printSetup(); |
318 | void printPreview(); | 318 | void printPreview(); |
319 | 319 | ||
320 | /** Export as iCalendar file */ | 320 | /** Export as iCalendar file */ |
321 | void exportICalendar(); | 321 | void exportICalendar(); |
322 | 322 | ||
323 | /** Export as vCalendar file */ | 323 | /** Export as vCalendar file */ |
324 | bool exportVCalendar( QString fn); | 324 | bool exportVCalendar( QString fn); |
325 | 325 | ||
326 | /** pop up a dialog to show an existing appointment. */ | 326 | /** pop up a dialog to show an existing appointment. */ |
327 | void appointment_show(); | 327 | void appointment_show(); |
328 | /** | 328 | /** |
329 | * pop up an Appointment Dialog to edit an existing appointment.Get | 329 | * pop up an Appointment Dialog to edit an existing appointment.Get |
330 | * information on the appointment from the list of unique IDs that is | 330 | * information on the appointment from the list of unique IDs that is |
331 | * currently in the View, called currIds. | 331 | * currently in the View, called currIds. |
332 | */ | 332 | */ |
333 | void appointment_edit(); | 333 | void appointment_edit(); |
334 | /** | 334 | /** |
335 | * pop up dialog confirming deletion of currently selected event in the | 335 | * pop up dialog confirming deletion of currently selected event in the |
336 | * View. | 336 | * View. |
337 | */ | 337 | */ |
338 | void appointment_delete(); | 338 | void appointment_delete(); |
339 | 339 | ||
340 | /** mails the currently selected event to a particular user as a vCalendar | 340 | /** mails the currently selected event to a particular user as a vCalendar |
341 | attachment. */ | 341 | attachment. */ |
342 | void action_mail(); | 342 | void action_mail(); |
343 | 343 | ||
344 | /* frees a subtodo from it's relation */ | 344 | /* frees a subtodo from it's relation */ |
345 | void todo_unsub( Todo * ); | 345 | void todo_unsub( Todo * ); |
346 | 346 | ||
347 | /** Take ownership of selected event. */ | 347 | /** Take ownership of selected event. */ |
348 | void takeOverEvent(); | 348 | void takeOverEvent(); |
349 | 349 | ||
350 | /** Take ownership of all events in calendar. */ | 350 | /** Take ownership of all events in calendar. */ |
351 | void takeOverCalendar(); | 351 | void takeOverCalendar(); |
352 | 352 | ||
353 | /** query whether or not the calendar is "dirty". */ | 353 | /** query whether or not the calendar is "dirty". */ |
354 | bool isModified(); | 354 | bool isModified(); |
355 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 355 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
356 | void setModified(bool modified=true); | 356 | void setModified(bool modified=true); |
357 | 357 | ||
358 | /** query if the calendar is read-only. */ | 358 | /** query if the calendar is read-only. */ |
359 | bool isReadOnly(); | 359 | bool isReadOnly(); |
360 | /** set state of calendar to read-only */ | 360 | /** set state of calendar to read-only */ |
361 | void setReadOnly(bool readOnly=true); | 361 | void setReadOnly(bool readOnly=true); |
362 | 362 | ||
363 | void eventUpdated(Incidence *); | 363 | void eventUpdated(Incidence *); |
364 | 364 | ||
365 | /* iTIP scheduling actions */ | 365 | /* iTIP scheduling actions */ |
366 | void schedule_publish(Incidence *incidence = 0); | 366 | void schedule_publish(Incidence *incidence = 0); |
367 | void schedule_request(Incidence *incidence = 0); | 367 | void schedule_request(Incidence *incidence = 0); |
368 | void schedule_refresh(Incidence *incidence = 0); | 368 | void schedule_refresh(Incidence *incidence = 0); |
369 | void schedule_cancel(Incidence *incidence = 0); | 369 | void schedule_cancel(Incidence *incidence = 0); |
370 | void schedule_add(Incidence *incidence = 0); | 370 | void schedule_add(Incidence *incidence = 0); |
371 | void schedule_reply(Incidence *incidence = 0); | 371 | void schedule_reply(Incidence *incidence = 0); |
372 | void schedule_counter(Incidence *incidence = 0); | 372 | void schedule_counter(Incidence *incidence = 0); |
373 | void schedule_declinecounter(Incidence *incidence = 0); | 373 | void schedule_declinecounter(Incidence *incidence = 0); |
374 | void schedule_publish_freebusy(int daysToPublish = 30); | 374 | void schedule_publish_freebusy(int daysToPublish = 30); |
375 | 375 | ||
376 | void openAddressbook(); | 376 | void openAddressbook(); |
377 | 377 | ||
378 | void editFilters(); | 378 | void editFilters(); |
379 | void toggleFilerEnabled(); | 379 | void toggleFilerEnabled(); |
380 | 380 | QPtrList<CalFilter> filters(); | |
381 | void toggleFilter(); | 381 | void toggleFilter(); |
382 | void showFilter(bool visible); | 382 | void showFilter(bool visible); |
383 | void updateFilter(); | 383 | void updateFilter(); |
384 | void filterEdited(); | 384 | void filterEdited(); |
385 | void selectFilter( int ); | 385 | void selectFilter( int ); |
386 | KOFilterView *filterView(); | ||
386 | 387 | ||
387 | void showIntro(); | 388 | void showIntro(); |
388 | 389 | ||
389 | /** Move the curdatepient view date to today */ | 390 | /** Move the curdatepient view date to today */ |
390 | void goToday(); | 391 | void goToday(); |
391 | 392 | ||
392 | /** Move to the next date(s) in the current view */ | 393 | /** Move to the next date(s) in the current view */ |
393 | void goNext(); | 394 | void goNext(); |
394 | 395 | ||
395 | /** Move to the previous date(s) in the current view */ | 396 | /** Move to the previous date(s) in the current view */ |
396 | void goPrevious(); | 397 | void goPrevious(); |
397 | /** Move to the next date(s) in the current view */ | 398 | /** Move to the next date(s) in the current view */ |
398 | void goNextMonth(); | 399 | void goNextMonth(); |
399 | 400 | ||
400 | /** Move to the previous date(s) in the current view */ | 401 | /** Move to the previous date(s) in the current view */ |
401 | void goPreviousMonth(); | 402 | void goPreviousMonth(); |
402 | 403 | ||
403 | void toggleExpand(); | 404 | void toggleExpand(); |
404 | void toggleDateNavigatorWidget(); | 405 | void toggleDateNavigatorWidget(); |
405 | void toggleAllDaySize(); | 406 | void toggleAllDaySize(); |
406 | void dialogClosing(Incidence *); | 407 | void dialogClosing(Incidence *); |
407 | 408 | ||
408 | /** Look for new messages in the inbox */ | 409 | /** Look for new messages in the inbox */ |
409 | void lookForIncomingMessages(); | 410 | void lookForIncomingMessages(); |
410 | /** Look for new messages in the outbox */ | 411 | /** Look for new messages in the outbox */ |
411 | void lookForOutgoingMessages(); | 412 | void lookForOutgoingMessages(); |
412 | 413 | ||
413 | void processMainViewSelection( Incidence * ); | 414 | void processMainViewSelection( Incidence * ); |
414 | void processTodoListSelection( Incidence * ); | 415 | void processTodoListSelection( Incidence * ); |
415 | 416 | ||
416 | void processIncidenceSelection( Incidence * ); | 417 | void processIncidenceSelection( Incidence * ); |
417 | 418 | ||
418 | void purgeCompleted(); | 419 | void purgeCompleted(); |
419 | bool removeCompletedSubTodos( Todo* ); | 420 | bool removeCompletedSubTodos( Todo* ); |
420 | void slotCalendarChanged(); | 421 | void slotCalendarChanged(); |
421 | bool importBday(); | 422 | bool importBday(); |
422 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 423 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
423 | bool importQtopia( const QString &categoriesFile, | 424 | bool importQtopia( const QString &categoriesFile, |
424 | const QString &datebookFile, | 425 | const QString &datebookFile, |
425 | const QString &tasklistFile ); | 426 | const QString &tasklistFile ); |
426 | void syncSharp( ); | 427 | void syncSharp( ); |
427 | void slotSelectPickerDate( QDate ) ; | 428 | void slotSelectPickerDate( QDate ) ; |
428 | void showDatePicker( ) ; | 429 | void showDatePicker( ) ; |
429 | void moveIncidence(Incidence *) ; | 430 | void moveIncidence(Incidence *) ; |
430 | void beamIncidence(Incidence *) ; | 431 | void beamIncidence(Incidence *) ; |
431 | void beamCalendar() ; | 432 | void beamCalendar() ; |
432 | void beamFilteredCalendar() ; | 433 | void beamFilteredCalendar() ; |
433 | void beamIncidenceList(QPtrList<Incidence>) ; | 434 | void beamIncidenceList(QPtrList<Incidence>) ; |
434 | void manageCategories(); | 435 | void manageCategories(); |
435 | int addCategories(); | 436 | int addCategories(); |
436 | void removeCategories(); | 437 | void removeCategories(); |
437 | void setSyncDevice( QString ); | 438 | void setSyncDevice( QString ); |
438 | void setSyncName( QString ); | 439 | void setSyncName( QString ); |
439 | protected slots: | 440 | protected slots: |
440 | void timerAlarm(); | 441 | void timerAlarm(); |
441 | void suspendAlarm(); | 442 | void suspendAlarm(); |
442 | void beamDone( Ir *ir ); | 443 | void beamDone( Ir *ir ); |
443 | /** Select a view or adapt the current view to display the specified dates. */ | 444 | /** Select a view or adapt the current view to display the specified dates. */ |
444 | void showDates( const KCal::DateList & ); | 445 | void showDates( const KCal::DateList & ); |
445 | void selectWeekNum ( int ); | 446 | void selectWeekNum ( int ); |
446 | 447 | ||
447 | public: | 448 | public: |
448 | // show a standard warning | 449 | // show a standard warning |
449 | // returns KMsgBox::yesNoCancel() | 450 | // returns KMsgBox::yesNoCancel() |
450 | int msgCalModified(); | 451 | int msgCalModified(); |
451 | void confSync(); | 452 | void confSync(); |
452 | void setLoadedFileVersion(QDateTime); | 453 | void setLoadedFileVersion(QDateTime); |
453 | bool checkFileVersion(QString fn); | 454 | bool checkFileVersion(QString fn); |
454 | bool checkFileChanged(QString fn); | 455 | bool checkFileChanged(QString fn); |
455 | Event* getLastSyncEvent(); | 456 | Event* getLastSyncEvent(); |
456 | /** Adapt navigation units correpsonding to step size of navigation of the | 457 | /** Adapt navigation units correpsonding to step size of navigation of the |
457 | * current view. | 458 | * current view. |
458 | */ | 459 | */ |
459 | void adaptNavigationUnits(); | 460 | void adaptNavigationUnits(); |
460 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 461 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
461 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 462 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
462 | //Attendee* getYourAttendee(Event *event); | 463 | //Attendee* getYourAttendee(Event *event); |
463 | protected: | 464 | protected: |
464 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 465 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
465 | 466 | ||
466 | // returns KMsgBox::OKCandel() | 467 | // returns KMsgBox::OKCandel() |
467 | int msgItemDelete(); | 468 | int msgItemDelete(); |
468 | void showEventEditor(); | 469 | void showEventEditor(); |
469 | void showTodoEditor(); | 470 | void showTodoEditor(); |
470 | void writeLocale(); | 471 | void writeLocale(); |
471 | Todo *selectedTodo(); | 472 | Todo *selectedTodo(); |
472 | 473 | ||
473 | private: | 474 | private: |
474 | AlarmDialog * mAlarmDialog; | 475 | AlarmDialog * mAlarmDialog; |
475 | QString mAlarmNotification; | 476 | QString mAlarmNotification; |
476 | QString mSuspendAlarmNotification; | 477 | QString mSuspendAlarmNotification; |
477 | QTimer* mSuspendTimer; | 478 | QTimer* mSuspendTimer; |
478 | QTimer* mAlarmTimer; | 479 | QTimer* mAlarmTimer; |
479 | QTimer* mRecheckAlarmTimer; | 480 | QTimer* mRecheckAlarmTimer; |
480 | void computeAlarm( QString ); | 481 | void computeAlarm( QString ); |
481 | void startAlarm( QString, QString ); | 482 | void startAlarm( QString, QString ); |
482 | void setSyncEventsReadOnly(); | 483 | void setSyncEventsReadOnly(); |
483 | 484 | ||
484 | QDateTime loadedFileVersion; | 485 | QDateTime loadedFileVersion; |
485 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 486 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
486 | void checkExternalId( Incidence * inc ); | 487 | void checkExternalId( Incidence * inc ); |
487 | int mGlobalSyncMode; | 488 | int mGlobalSyncMode; |
488 | QString mCurrentSyncDevice; | 489 | QString mCurrentSyncDevice; |
489 | QString mCurrentSyncName; | 490 | QString mCurrentSyncName; |
490 | KOBeamPrefs* beamDialog; | 491 | KOBeamPrefs* beamDialog; |
491 | void init(); | 492 | void init(); |
492 | int mDatePickerMode; | 493 | int mDatePickerMode; |
493 | bool mFlagEditDescription; | 494 | bool mFlagEditDescription; |
494 | QDateTime mLastCalendarSync; | 495 | QDateTime mLastCalendarSync; |
495 | void createPrinter(); | 496 | void createPrinter(); |
496 | 497 | ||
497 | void calendarModified( bool, Calendar * ); | 498 | void calendarModified( bool, Calendar * ); |
498 | 499 | ||
499 | CalPrinter *mCalPrinter; | 500 | CalPrinter *mCalPrinter; |
500 | 501 | ||
501 | QSplitter *mPanner; | 502 | QSplitter *mPanner; |
502 | QSplitter *mLeftSplitter; | 503 | QSplitter *mLeftSplitter; |
503 | QWidget *mLeftFrame; | 504 | QWidget *mLeftFrame; |
504 | QWidgetStack *mRightFrame; | 505 | QWidgetStack *mRightFrame; |
505 | 506 | ||
506 | KDatePicker* mDatePicker; | 507 | KDatePicker* mDatePicker; |
507 | QVBox* mDateFrame; | 508 | QVBox* mDateFrame; |
508 | NavigatorBar *mNavigatorBar; | 509 | NavigatorBar *mNavigatorBar; |
509 | 510 | ||
510 | KDateNavigator *mDateNavigator; // widget showing small month view. | 511 | KDateNavigator *mDateNavigator; // widget showing small month view. |
511 | 512 | ||
512 | KOFilterView *mFilterView; | 513 | KOFilterView *mFilterView; |
513 | 514 | ||
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 57b299f..a93d8e5 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,172 +1,173 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qapp.h> | 11 | #include <qapp.h> |
12 | #include <qfileinfo.h> | 12 | #include <qfileinfo.h> |
13 | #include <qlabel.h> | 13 | #include <qlabel.h> |
14 | #include <qwmatrix.h> | 14 | #include <qwmatrix.h> |
15 | #include <qtextbrowser.h> | 15 | #include <qtextbrowser.h> |
16 | #include <qtextstream.h> | 16 | #include <qtextstream.h> |
17 | #ifndef DESKTOP_VERSION | 17 | #ifndef DESKTOP_VERSION |
18 | #include <qpe/global.h> | 18 | #include <qpe/global.h> |
19 | #include <qpe/qpemenubar.h> | 19 | #include <qpe/qpemenubar.h> |
20 | #include <qpe/qpetoolbar.h> | 20 | #include <qpe/qpetoolbar.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <qtopia/alarmserver.h> | 23 | #include <qtopia/alarmserver.h> |
24 | #include <qtopia/qcopenvelope_qws.h> | 24 | #include <qtopia/qcopenvelope_qws.h> |
25 | #else | 25 | #else |
26 | #include <qmenubar.h> | 26 | #include <qmenubar.h> |
27 | #include <qtoolbar.h> | 27 | #include <qtoolbar.h> |
28 | #include <qapplication.h> | 28 | #include <qapplication.h> |
29 | //#include <resource.h> | 29 | //#include <resource.h> |
30 | 30 | ||
31 | #endif | 31 | #endif |
32 | #include <libkcal/calendarlocal.h> | 32 | #include <libkcal/calendarlocal.h> |
33 | #include <libkcal/todo.h> | 33 | #include <libkcal/todo.h> |
34 | #include <libkdepim/ksyncprofile.h> | 34 | #include <libkdepim/ksyncprofile.h> |
35 | #include <libkdepim/kincidenceformatter.h> | 35 | #include <libkdepim/kincidenceformatter.h> |
36 | 36 | ||
37 | #include "calendarview.h" | 37 | #include "calendarview.h" |
38 | #include "koviewmanager.h" | 38 | #include "koviewmanager.h" |
39 | #include "datenavigator.h" | 39 | #include "datenavigator.h" |
40 | #include "koagendaview.h" | 40 | #include "koagendaview.h" |
41 | #include "koagenda.h" | 41 | #include "koagenda.h" |
42 | #include "kodialogmanager.h" | 42 | #include "kodialogmanager.h" |
43 | #include "kdialogbase.h" | 43 | #include "kdialogbase.h" |
44 | #include "kapplication.h" | 44 | #include "kapplication.h" |
45 | #include "kofilterview.h" | ||
45 | #include "kstandarddirs.h" | 46 | #include "kstandarddirs.h" |
46 | #include "koprefs.h" | 47 | #include "koprefs.h" |
47 | #include "kfiledialog.h" | 48 | #include "kfiledialog.h" |
48 | #include "koglobals.h" | 49 | #include "koglobals.h" |
49 | #include "kglobal.h" | 50 | #include "kglobal.h" |
50 | #include "klocale.h" | 51 | #include "klocale.h" |
51 | #include "kconfig.h" | 52 | #include "kconfig.h" |
52 | #include "simplealarmclient.h" | 53 | #include "simplealarmclient.h" |
53 | using namespace KCal; | 54 | using namespace KCal; |
54 | #ifndef _WIN32_ | 55 | #ifndef _WIN32_ |
55 | #include <unistd.h> | 56 | #include <unistd.h> |
56 | #else | 57 | #else |
57 | #include "koimportoldialog.h" | 58 | #include "koimportoldialog.h" |
58 | #endif | 59 | #endif |
59 | #include "mainwindow.h" | 60 | #include "mainwindow.h" |
60 | 61 | ||
61 | int globalFlagBlockStartup; | 62 | int globalFlagBlockStartup; |
62 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 63 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
63 | QMainWindow( parent, name ) | 64 | QMainWindow( parent, name ) |
64 | { | 65 | { |
65 | 66 | ||
66 | #ifdef DESKTOP_VERSION | 67 | #ifdef DESKTOP_VERSION |
67 | setFont( QFont("Arial"), 14 ); | 68 | setFont( QFont("Arial"), 14 ); |
68 | #endif | 69 | #endif |
69 | 70 | ||
70 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 71 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
71 | QString confFile = locateLocal("config","korganizerrc"); | 72 | QString confFile = locateLocal("config","korganizerrc"); |
72 | QFileInfo finf ( confFile ); | 73 | QFileInfo finf ( confFile ); |
73 | bool showWarning = !finf.exists(); | 74 | bool showWarning = !finf.exists(); |
74 | setIcon(SmallIcon( "ko24" ) ); | 75 | setIcon(SmallIcon( "ko24" ) ); |
75 | mBlockAtStartup = true; | 76 | mBlockAtStartup = true; |
76 | mFlagKeyPressed = false; | 77 | mFlagKeyPressed = false; |
77 | setCaption("KOrganizer/Pi"); | 78 | setCaption("KOrganizer/Pi"); |
78 | KOPrefs *p = KOPrefs::instance(); | 79 | KOPrefs *p = KOPrefs::instance(); |
79 | // if ( QApplication::desktop()->height() > 480 ) { | 80 | // if ( QApplication::desktop()->height() > 480 ) { |
80 | // if ( p->mHourSize == 4 ) | 81 | // if ( p->mHourSize == 4 ) |
81 | // p->mHourSize = 6; | 82 | // p->mHourSize = 6; |
82 | // } | 83 | // } |
83 | if ( p->mHourSize > 18 ) | 84 | if ( p->mHourSize > 18 ) |
84 | p->mHourSize = 18; | 85 | p->mHourSize = 18; |
85 | QMainWindow::ToolBarDock tbd; | 86 | QMainWindow::ToolBarDock tbd; |
86 | if ( p->mToolBarHor ) { | 87 | if ( p->mToolBarHor ) { |
87 | if ( p->mToolBarUp ) | 88 | if ( p->mToolBarUp ) |
88 | tbd = Bottom; | 89 | tbd = Bottom; |
89 | else | 90 | else |
90 | tbd = Top; | 91 | tbd = Top; |
91 | } | 92 | } |
92 | else { | 93 | else { |
93 | if ( p->mToolBarUp ) | 94 | if ( p->mToolBarUp ) |
94 | tbd = Right; | 95 | tbd = Right; |
95 | else | 96 | else |
96 | tbd = Left; | 97 | tbd = Left; |
97 | } | 98 | } |
98 | if ( KOPrefs::instance()->mUseAppColors ) | 99 | if ( KOPrefs::instance()->mUseAppColors ) |
99 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 100 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
100 | globalFlagBlockStartup = 1; | 101 | globalFlagBlockStartup = 1; |
101 | iconToolBar = new QPEToolBar( this ); | 102 | iconToolBar = new QPEToolBar( this ); |
102 | addToolBar (iconToolBar , tbd ); | 103 | addToolBar (iconToolBar , tbd ); |
103 | mBlockSaveFlag = false; | 104 | mBlockSaveFlag = false; |
104 | mCalendarModifiedFlag = false; | 105 | mCalendarModifiedFlag = false; |
105 | 106 | ||
106 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 107 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
107 | splash->setAlignment ( AlignCenter ); | 108 | splash->setAlignment ( AlignCenter ); |
108 | setCentralWidget( splash ); | 109 | setCentralWidget( splash ); |
109 | #ifndef DESKTOP_VERSION | 110 | #ifndef DESKTOP_VERSION |
110 | showMaximized(); | 111 | showMaximized(); |
111 | #endif | 112 | #endif |
112 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 113 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
113 | setDefaultPreferences(); | 114 | setDefaultPreferences(); |
114 | mCalendar = new CalendarLocal(); | 115 | mCalendar = new CalendarLocal(); |
115 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 116 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
116 | mView->hide(); | 117 | mView->hide(); |
117 | //mView->resize(splash->size() ); | 118 | //mView->resize(splash->size() ); |
118 | initActions(); | 119 | initActions(); |
119 | #ifndef DESKTOP_VERSION | 120 | #ifndef DESKTOP_VERSION |
120 | iconToolBar->show(); | 121 | iconToolBar->show(); |
121 | qApp->processEvents(); | 122 | qApp->processEvents(); |
122 | #endif | 123 | #endif |
123 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 124 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
124 | int vh = height() ; | 125 | int vh = height() ; |
125 | int vw = width(); | 126 | int vw = width(); |
126 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 127 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
127 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 128 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
128 | vh -= iconToolBar->height(); | 129 | vh -= iconToolBar->height(); |
129 | } else { | 130 | } else { |
130 | vw -= iconToolBar->height(); | 131 | vw -= iconToolBar->height(); |
131 | } | 132 | } |
132 | //mView->setMaximumSize( splash->size() ); | 133 | //mView->setMaximumSize( splash->size() ); |
133 | //mView->resize( splash->size() ); | 134 | //mView->resize( splash->size() ); |
134 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 135 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
135 | mView->readSettings(); | 136 | mView->readSettings(); |
136 | bool oldOpened = false; | 137 | bool oldOpened = false; |
137 | bool newFile = false; | 138 | bool newFile = false; |
138 | if( !QFile::exists( defaultFileName() ) ) { | 139 | if( !QFile::exists( defaultFileName() ) ) { |
139 | QFileInfo finfo ( defaultFileName() ); | 140 | QFileInfo finfo ( defaultFileName() ); |
140 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 141 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
141 | qDebug("oldfile %s ", oldFile.latin1()); | 142 | qDebug("oldfile %s ", oldFile.latin1()); |
142 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 143 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
143 | finfo.setFile( oldFile ); | 144 | finfo.setFile( oldFile ); |
144 | if (finfo.exists() ) { | 145 | if (finfo.exists() ) { |
145 | KMessageBox::information( this, message); | 146 | KMessageBox::information( this, message); |
146 | mView->openCalendar( oldFile ); | 147 | mView->openCalendar( oldFile ); |
147 | qApp->processEvents(); | 148 | qApp->processEvents(); |
148 | } else { | 149 | } else { |
149 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 150 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
150 | finfo.setFile( oldFile ); | 151 | finfo.setFile( oldFile ); |
151 | if (finfo.exists() ) { | 152 | if (finfo.exists() ) { |
152 | KMessageBox::information( this, message); | 153 | KMessageBox::information( this, message); |
153 | mView->openCalendar( oldFile ); | 154 | mView->openCalendar( oldFile ); |
154 | qApp->processEvents(); | 155 | qApp->processEvents(); |
155 | } | 156 | } |
156 | } | 157 | } |
157 | mView->saveCalendar( defaultFileName() ); | 158 | mView->saveCalendar( defaultFileName() ); |
158 | newFile = true; | 159 | newFile = true; |
159 | } | 160 | } |
160 | 161 | ||
161 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 162 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
162 | if ( ! oldOpened ) | 163 | if ( ! oldOpened ) |
163 | mView->openCalendar( defaultFileName() ); | 164 | mView->openCalendar( defaultFileName() ); |
164 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 165 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
165 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 166 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
166 | 167 | ||
167 | if ( KOPrefs::instance()->mLanguageChanged ) { | 168 | if ( KOPrefs::instance()->mLanguageChanged ) { |
168 | KOPrefs::instance()->setCategoryDefaults(); | 169 | KOPrefs::instance()->setCategoryDefaults(); |
169 | int count = mView->addCategories(); | 170 | int count = mView->addCategories(); |
170 | KOPrefs::instance()->mLanguageChanged = false; | 171 | KOPrefs::instance()->mLanguageChanged = false; |
171 | } | 172 | } |
172 | processIncidenceSelection( 0 ); | 173 | processIncidenceSelection( 0 ); |
@@ -224,287 +225,293 @@ void MainWindow::closeEvent( QCloseEvent* ce ) | |||
224 | i18n("Do you really want\nto close KO/Pi?"), | 225 | i18n("Do you really want\nto close KO/Pi?"), |
225 | i18n("Close"), i18n("No"), | 226 | i18n("Close"), i18n("No"), |
226 | 0, 0 ) ) { | 227 | 0, 0 ) ) { |
227 | case 0: | 228 | case 0: |
228 | saveOnClose(); | 229 | saveOnClose(); |
229 | ce->accept(); | 230 | ce->accept(); |
230 | break; | 231 | break; |
231 | case 1: | 232 | case 1: |
232 | ce->ignore(); | 233 | ce->ignore(); |
233 | break; | 234 | break; |
234 | case 2: | 235 | case 2: |
235 | 236 | ||
236 | default: | 237 | default: |
237 | break; | 238 | break; |
238 | } | 239 | } |
239 | 240 | ||
240 | 241 | ||
241 | } | 242 | } |
242 | 243 | ||
243 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 244 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
244 | { | 245 | { |
245 | QDataStream stream( data, IO_ReadOnly ); | 246 | QDataStream stream( data, IO_ReadOnly ); |
246 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 247 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
247 | //QString datamess; | 248 | //QString datamess; |
248 | //qDebug("message "); | 249 | //qDebug("message "); |
249 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 250 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
250 | if ( cmsg == "-writeFile" ) { | 251 | if ( cmsg == "-writeFile" ) { |
251 | // I made from the "-writeFile" an "-writeAlarm" | 252 | // I made from the "-writeFile" an "-writeAlarm" |
252 | mView->viewManager()->showWhatsNextView(); | 253 | mView->viewManager()->showWhatsNextView(); |
253 | mCalendar->checkAlarmForIncidence( 0, true); | 254 | mCalendar->checkAlarmForIncidence( 0, true); |
254 | showMaximized(); | 255 | showMaximized(); |
255 | raise(); | 256 | raise(); |
256 | return; | 257 | return; |
257 | 258 | ||
258 | } | 259 | } |
259 | if ( cmsg == "-writeFileSilent" ) { | 260 | if ( cmsg == "-writeFileSilent" ) { |
260 | // I made from the "-writeFile" an "-writeAlarm" | 261 | // I made from the "-writeFile" an "-writeAlarm" |
261 | // mView->viewManager()->showWhatsNextView(); | 262 | // mView->viewManager()->showWhatsNextView(); |
262 | mCalendar->checkAlarmForIncidence( 0, true); | 263 | mCalendar->checkAlarmForIncidence( 0, true); |
263 | //showMaximized(); | 264 | //showMaximized(); |
264 | //raise(); | 265 | //raise(); |
265 | hide(); | 266 | hide(); |
266 | return; | 267 | return; |
267 | } | 268 | } |
268 | if ( cmsg == "-newCountdown" ) { | 269 | if ( cmsg == "-newCountdown" ) { |
269 | qDebug("newCountdown "); | 270 | qDebug("newCountdown "); |
270 | 271 | ||
271 | } | 272 | } |
272 | QString msg ; | 273 | QString msg ; |
273 | QString allmsg = cmsg; | 274 | QString allmsg = cmsg; |
274 | while ( allmsg.length() > 0 ) { | 275 | while ( allmsg.length() > 0 ) { |
275 | int nextC = allmsg.find( "-", 1 ); | 276 | int nextC = allmsg.find( "-", 1 ); |
276 | if ( nextC == -1 ) { | 277 | if ( nextC == -1 ) { |
277 | msg = allmsg; | 278 | msg = allmsg; |
278 | allmsg = ""; | 279 | allmsg = ""; |
279 | } else{ | 280 | } else{ |
280 | msg = allmsg.left( nextC ); | 281 | msg = allmsg.left( nextC ); |
281 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 282 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
282 | } | 283 | } |
283 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 284 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
284 | if ( msg == "-newEvent" ) { | 285 | if ( msg == "-newEvent" ) { |
285 | mView->newEvent(); | 286 | mView->newEvent(); |
286 | } | 287 | } |
287 | if ( msg == "-newTodo" ) { | 288 | if ( msg == "-newTodo" ) { |
288 | mView->newTodo(); | 289 | mView->newTodo(); |
289 | 290 | ||
290 | } | 291 | } |
291 | if ( msg == "-showWN" ) { | 292 | if ( msg == "-showWN" ) { |
292 | mView->viewManager()->showWhatsNextView(); | 293 | mView->viewManager()->showWhatsNextView(); |
293 | } | 294 | } |
294 | if ( msg == "-showTodo" ) { | 295 | if ( msg == "-showTodo" ) { |
295 | mView->viewManager()->showTodoView(); | 296 | mView->viewManager()->showTodoView(); |
296 | } | 297 | } |
297 | if ( msg == "-showList" ) { | 298 | if ( msg == "-showList" ) { |
298 | mView->viewManager()->showListView(); | 299 | mView->viewManager()->showListView(); |
299 | } | 300 | } |
300 | else if ( msg == "-showDay" ) { | 301 | else if ( msg == "-showDay" ) { |
301 | mView->viewManager()->showDayView(); | 302 | mView->viewManager()->showDayView(); |
302 | } | 303 | } |
303 | else if ( msg == "-showWWeek" ) { | 304 | else if ( msg == "-showWWeek" ) { |
304 | mView->viewManager()->showWorkWeekView(); | 305 | mView->viewManager()->showWorkWeekView(); |
305 | } | 306 | } |
306 | else if ( msg == "-ringSync" ) { | 307 | else if ( msg == "-ringSync" ) { |
307 | multiSync( false ); | 308 | multiSync( false ); |
308 | } | 309 | } |
309 | else if ( msg == "-showWeek" ) { | 310 | else if ( msg == "-showWeek" ) { |
310 | mView->viewManager()->showWeekView(); | 311 | mView->viewManager()->showWeekView(); |
311 | } | 312 | } |
312 | else if ( msg == "-showTodo" ) { | 313 | else if ( msg == "-showTodo" ) { |
313 | mView->viewManager()->showTodoView(); | 314 | mView->viewManager()->showTodoView(); |
314 | } | 315 | } |
315 | else if ( msg == "-showJournal" ) { | 316 | else if ( msg == "-showJournal" ) { |
316 | mView->dateNavigator()->selectDates( 1 ); | 317 | mView->dateNavigator()->selectDates( 1 ); |
317 | mView->dateNavigator()->selectToday(); | 318 | mView->dateNavigator()->selectToday(); |
318 | mView->viewManager()->showJournalView(); | 319 | mView->viewManager()->showJournalView(); |
319 | } | 320 | } |
320 | else if ( msg == "-showKO" ) { | 321 | else if ( msg == "-showKO" ) { |
321 | mView->viewManager()->showNextXView(); | 322 | mView->viewManager()->showNextXView(); |
322 | } | 323 | } |
323 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 324 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
324 | mView->viewManager()->showWhatsNextView(); | 325 | mView->viewManager()->showWhatsNextView(); |
325 | } | 326 | } |
326 | else if ( msg == "-showNextXView" ) { | 327 | else if ( msg == "-showNextXView" ) { |
327 | mView->viewManager()->showNextXView(); | 328 | mView->viewManager()->showNextXView(); |
328 | } | 329 | } |
329 | 330 | ||
330 | 331 | ||
331 | } | 332 | } |
332 | 333 | ||
333 | showMaximized(); | 334 | showMaximized(); |
334 | raise(); | 335 | raise(); |
335 | } | 336 | } |
336 | 337 | ||
337 | QPixmap MainWindow::loadPixmap( QString name ) | 338 | QPixmap MainWindow::loadPixmap( QString name ) |
338 | { | 339 | { |
339 | return SmallIcon( name ); | 340 | return SmallIcon( name ); |
340 | 341 | ||
341 | } | 342 | } |
342 | void MainWindow::initActions() | 343 | void MainWindow::initActions() |
343 | { | 344 | { |
344 | //KOPrefs::instance()->mShowFullMenu | 345 | //KOPrefs::instance()->mShowFullMenu |
345 | iconToolBar->clear(); | 346 | iconToolBar->clear(); |
346 | KOPrefs *p = KOPrefs::instance(); | 347 | KOPrefs *p = KOPrefs::instance(); |
347 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 348 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
348 | 349 | ||
349 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 350 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
350 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 351 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
351 | QPopupMenu *importMenu = new QPopupMenu( this ); | 352 | QPopupMenu *importMenu = new QPopupMenu( this ); |
352 | 353 | selectFilterMenu = new QPopupMenu( this ); | |
354 | selectFilterMenu->setCheckable( true ); | ||
353 | syncMenu = new QPopupMenu( this ); | 355 | syncMenu = new QPopupMenu( this ); |
354 | configureAgendaMenu = new QPopupMenu( this ); | 356 | configureAgendaMenu = new QPopupMenu( this ); |
355 | configureToolBarMenu = new QPopupMenu( this ); | 357 | configureToolBarMenu = new QPopupMenu( this ); |
356 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 358 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
357 | if ( KOPrefs::instance()->mShowFullMenu ) { | 359 | if ( KOPrefs::instance()->mShowFullMenu ) { |
358 | QMenuBar *menuBar1; | 360 | QMenuBar *menuBar1; |
359 | menuBar1 = menuBar(); | 361 | menuBar1 = menuBar(); |
360 | menuBar1->insertItem( i18n("File"), importMenu ); | 362 | menuBar1->insertItem( i18n("File"), importMenu ); |
361 | menuBar1->insertItem( i18n("View"), viewMenu ); | 363 | menuBar1->insertItem( i18n("View"), viewMenu ); |
362 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 364 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
363 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 365 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
364 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 366 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
365 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 367 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
368 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | ||
366 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 369 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
367 | } else { | 370 | } else { |
368 | QPEMenuBar *menuBar1; | 371 | QPEMenuBar *menuBar1; |
369 | menuBar1 = new QPEMenuBar( iconToolBar ); | 372 | menuBar1 = new QPEMenuBar( iconToolBar ); |
370 | QPopupMenu *menuBar = new QPopupMenu( this ); | 373 | QPopupMenu *menuBar = new QPopupMenu( this ); |
371 | menuBar1->insertItem( i18n("ME"), menuBar); | 374 | menuBar1->insertItem( i18n("ME"), menuBar); |
372 | menuBar->insertItem( i18n("File"), importMenu ); | 375 | menuBar->insertItem( i18n("File"), importMenu ); |
373 | menuBar->insertItem( i18n("View"), viewMenu ); | 376 | menuBar->insertItem( i18n("View"), viewMenu ); |
374 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 377 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
375 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 378 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
376 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 379 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
377 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 380 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
381 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | ||
378 | menuBar->insertItem( i18n("Help"), helpMenu ); | 382 | menuBar->insertItem( i18n("Help"), helpMenu ); |
379 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 383 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
380 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 384 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
381 | } | 385 | } |
382 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); | 386 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); |
387 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | ||
388 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); | ||
389 | |||
383 | // ****************** | 390 | // ****************** |
384 | QAction *action; | 391 | QAction *action; |
385 | QIconSet icon; | 392 | QIconSet icon; |
386 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 393 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
387 | configureToolBarMenu->setCheckable( true ); | 394 | configureToolBarMenu->setCheckable( true ); |
388 | 395 | ||
389 | QString pathString = ""; | 396 | QString pathString = ""; |
390 | if ( !p->mToolBarMiniIcons ) { | 397 | if ( !p->mToolBarMiniIcons ) { |
391 | if ( QApplication::desktop()->width() < 480 ) | 398 | if ( QApplication::desktop()->width() < 480 ) |
392 | pathString += "icons16/"; | 399 | pathString += "icons16/"; |
393 | } else | 400 | } else |
394 | pathString += "iconsmini/"; | 401 | pathString += "iconsmini/"; |
395 | configureAgendaMenu->setCheckable( true ); | 402 | configureAgendaMenu->setCheckable( true ); |
396 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); | 403 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); |
397 | configureAgendaMenu->insertSeparator(); | 404 | configureAgendaMenu->insertSeparator(); |
398 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); | 405 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); |
399 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); | 406 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); |
400 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); | 407 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); |
401 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); | 408 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); |
402 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); | 409 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); |
403 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); | 410 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); |
404 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); | 411 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); |
405 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); | 412 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); |
406 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 413 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
407 | 414 | ||
408 | icon = loadPixmap( pathString + "configure" ); | 415 | icon = loadPixmap( pathString + "configure" ); |
409 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 416 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
410 | action->addTo( actionMenu ); | 417 | action->addTo( actionMenu ); |
411 | connect( action, SIGNAL( activated() ), | 418 | connect( action, SIGNAL( activated() ), |
412 | mView, SLOT( edit_options() ) ); | 419 | mView, SLOT( edit_options() ) ); |
413 | actionMenu->insertSeparator(); | 420 | actionMenu->insertSeparator(); |
414 | icon = loadPixmap( pathString + "newevent" ); | 421 | icon = loadPixmap( pathString + "newevent" ); |
415 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 422 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
416 | configureToolBarMenu->insertSeparator(); | 423 | configureToolBarMenu->insertSeparator(); |
417 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 424 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
418 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 425 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
419 | ne_action->addTo( actionMenu ); | 426 | ne_action->addTo( actionMenu ); |
420 | connect( ne_action, SIGNAL( activated() ), | 427 | connect( ne_action, SIGNAL( activated() ), |
421 | mView, SLOT( newEvent() ) ); | 428 | mView, SLOT( newEvent() ) ); |
422 | icon = loadPixmap( pathString + "newtodo" ); | 429 | icon = loadPixmap( pathString + "newtodo" ); |
423 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 430 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
424 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 431 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
425 | nt_action->addTo( actionMenu ); | 432 | nt_action->addTo( actionMenu ); |
426 | connect( nt_action, SIGNAL( activated() ), | 433 | connect( nt_action, SIGNAL( activated() ), |
427 | mView, SLOT( newTodo() ) ); | 434 | mView, SLOT( newTodo() ) ); |
428 | icon = loadPixmap( pathString + "navi" ); | 435 | icon = loadPixmap( pathString + "navi" ); |
429 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 436 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
430 | action->addTo( viewMenu ); | 437 | action->addTo( viewMenu ); |
431 | connect( action, SIGNAL( activated() ), | 438 | connect( action, SIGNAL( activated() ), |
432 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 439 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
433 | icon = loadPixmap( pathString + "filter" ); | 440 | icon = loadPixmap( pathString + "filter" ); |
434 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 441 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
435 | action->addTo( viewMenu ); | 442 | action->addTo( viewMenu ); |
436 | connect( action, SIGNAL( activated() ), | 443 | connect( action, SIGNAL( activated() ), |
437 | mView, SLOT( toggleFilter() ) ); | 444 | mView, SLOT( toggleFilter() ) ); |
438 | 445 | ||
439 | 446 | ||
440 | viewMenu->insertSeparator(); | 447 | viewMenu->insertSeparator(); |
441 | icon = loadPixmap( pathString + "picker" ); | 448 | icon = loadPixmap( pathString + "picker" ); |
442 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 449 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
443 | action->addTo( viewMenu ); | 450 | action->addTo( viewMenu ); |
444 | connect( action, SIGNAL( activated() ), | 451 | connect( action, SIGNAL( activated() ), |
445 | mView, SLOT( showDatePicker() ) ); | 452 | mView, SLOT( showDatePicker() ) ); |
446 | action->addTo( iconToolBar ); | 453 | action->addTo( iconToolBar ); |
447 | viewMenu->insertSeparator(); | 454 | viewMenu->insertSeparator(); |
448 | icon = loadPixmap( pathString + "list" ); | 455 | icon = loadPixmap( pathString + "list" ); |
449 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 456 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
450 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 457 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
451 | showlist_action->addTo( viewMenu ); | 458 | showlist_action->addTo( viewMenu ); |
452 | connect( showlist_action, SIGNAL( activated() ), | 459 | connect( showlist_action, SIGNAL( activated() ), |
453 | mView->viewManager(), SLOT( showListView() ) ); | 460 | mView->viewManager(), SLOT( showListView() ) ); |
454 | 461 | ||
455 | 462 | ||
456 | icon = loadPixmap( pathString + "day" ); | 463 | icon = loadPixmap( pathString + "day" ); |
457 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 464 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
458 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 465 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
459 | day1_action->addTo( viewMenu ); | 466 | day1_action->addTo( viewMenu ); |
460 | // action->addTo( toolBar ); | 467 | // action->addTo( toolBar ); |
461 | connect( day1_action, SIGNAL( activated() ), | 468 | connect( day1_action, SIGNAL( activated() ), |
462 | mView->viewManager(), SLOT( showDayView() ) ); | 469 | mView->viewManager(), SLOT( showDayView() ) ); |
463 | 470 | ||
464 | icon = loadPixmap( pathString + "workweek" ); | 471 | icon = loadPixmap( pathString + "workweek" ); |
465 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 472 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
466 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 473 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
467 | day5_action->addTo( viewMenu ); | 474 | day5_action->addTo( viewMenu ); |
468 | connect( day5_action, SIGNAL( activated() ), | 475 | connect( day5_action, SIGNAL( activated() ), |
469 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 476 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
470 | 477 | ||
471 | icon = loadPixmap( pathString + "week" ); | 478 | icon = loadPixmap( pathString + "week" ); |
472 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 479 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
473 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 480 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
474 | day7_action->addTo( viewMenu ); | 481 | day7_action->addTo( viewMenu ); |
475 | connect( day7_action, SIGNAL( activated() ), | 482 | connect( day7_action, SIGNAL( activated() ), |
476 | mView->viewManager(), SLOT( showWeekView() ) ); | 483 | mView->viewManager(), SLOT( showWeekView() ) ); |
477 | 484 | ||
478 | icon = loadPixmap( pathString + "month" ); | 485 | icon = loadPixmap( pathString + "month" ); |
479 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 486 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
480 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 487 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
481 | month_action->addTo( viewMenu ); | 488 | month_action->addTo( viewMenu ); |
482 | connect( month_action, SIGNAL( activated() ), | 489 | connect( month_action, SIGNAL( activated() ), |
483 | mView->viewManager(), SLOT( showMonthView() ) ); | 490 | mView->viewManager(), SLOT( showMonthView() ) ); |
484 | 491 | ||
485 | icon = loadPixmap( pathString + "todo" ); | 492 | icon = loadPixmap( pathString + "todo" ); |
486 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 493 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
487 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 494 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
488 | todoview_action->addTo( viewMenu ); | 495 | todoview_action->addTo( viewMenu ); |
489 | connect( todoview_action, SIGNAL( activated() ), | 496 | connect( todoview_action, SIGNAL( activated() ), |
490 | mView->viewManager(), SLOT( showTodoView() ) ); | 497 | mView->viewManager(), SLOT( showTodoView() ) ); |
491 | 498 | ||
492 | icon = loadPixmap( pathString + "journal" ); | 499 | icon = loadPixmap( pathString + "journal" ); |
493 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 500 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
494 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 501 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
495 | viewjournal_action->addTo( viewMenu ); | 502 | viewjournal_action->addTo( viewMenu ); |
496 | connect( viewjournal_action, SIGNAL( activated() ), | 503 | connect( viewjournal_action, SIGNAL( activated() ), |
497 | mView->viewManager(), SLOT( showJournalView() ) ); | 504 | mView->viewManager(), SLOT( showJournalView() ) ); |
498 | 505 | ||
499 | icon = loadPixmap( pathString + "xdays" ); | 506 | icon = loadPixmap( pathString + "xdays" ); |
500 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); | 507 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); |
501 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 508 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
502 | xdays_action->addTo( viewMenu ); | 509 | xdays_action->addTo( viewMenu ); |
503 | connect( xdays_action, SIGNAL( activated() ), | 510 | connect( xdays_action, SIGNAL( activated() ), |
504 | mView->viewManager(), SLOT( showNextXView() ) ); | 511 | mView->viewManager(), SLOT( showNextXView() ) ); |
505 | 512 | ||
506 | icon = loadPixmap( pathString + "whatsnext" ); | 513 | icon = loadPixmap( pathString + "whatsnext" ); |
507 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); | 514 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); |
508 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 515 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
509 | whatsnext_action->addTo( viewMenu ); | 516 | whatsnext_action->addTo( viewMenu ); |
510 | connect( whatsnext_action, SIGNAL( activated() ), | 517 | connect( whatsnext_action, SIGNAL( activated() ), |
@@ -1390,256 +1397,292 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) | |||
1390 | break; | 1397 | break; |
1391 | case Qt::Key_D: | 1398 | case Qt::Key_D: |
1392 | mView->viewManager()->showDayView(); | 1399 | mView->viewManager()->showDayView(); |
1393 | showSelectedDates = true; | 1400 | showSelectedDates = true; |
1394 | break; | 1401 | break; |
1395 | case Qt::Key_O: | 1402 | case Qt::Key_O: |
1396 | mView->toggleFilerEnabled( ); | 1403 | mView->toggleFilerEnabled( ); |
1397 | break; | 1404 | break; |
1398 | case Qt::Key_0: | 1405 | case Qt::Key_0: |
1399 | case Qt::Key_1: | 1406 | case Qt::Key_1: |
1400 | case Qt::Key_2: | 1407 | case Qt::Key_2: |
1401 | case Qt::Key_3: | 1408 | case Qt::Key_3: |
1402 | case Qt::Key_4: | 1409 | case Qt::Key_4: |
1403 | case Qt::Key_5: | 1410 | case Qt::Key_5: |
1404 | case Qt::Key_6: | 1411 | case Qt::Key_6: |
1405 | case Qt::Key_7: | 1412 | case Qt::Key_7: |
1406 | case Qt::Key_8: | 1413 | case Qt::Key_8: |
1407 | case Qt::Key_9: | 1414 | case Qt::Key_9: |
1408 | pro = e->key()-48; | 1415 | pro = e->key()-48; |
1409 | if ( pro == 0 ) | 1416 | if ( pro == 0 ) |
1410 | pro = 10; | 1417 | pro = 10; |
1411 | if ( e->state() == Qt::ControlButton) | 1418 | if ( e->state() == Qt::ControlButton) |
1412 | pro += 10; | 1419 | pro += 10; |
1413 | break; | 1420 | break; |
1414 | case Qt::Key_M: | 1421 | case Qt::Key_M: |
1415 | mView->viewManager()->showMonthView(); | 1422 | mView->viewManager()->showMonthView(); |
1416 | showSelectedDates = true; | 1423 | showSelectedDates = true; |
1417 | break; | 1424 | break; |
1418 | case Qt::Key_Insert: | 1425 | case Qt::Key_Insert: |
1419 | mView->newEvent(); | 1426 | mView->newEvent(); |
1420 | break; | 1427 | break; |
1421 | case Qt::Key_S : | 1428 | case Qt::Key_S : |
1422 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1429 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1423 | mView->newSubTodo(); | 1430 | mView->newSubTodo(); |
1424 | else | 1431 | else |
1425 | mView->dialogManager()->showSearchDialog(); | 1432 | mView->dialogManager()->showSearchDialog(); |
1426 | break; | 1433 | break; |
1427 | case Qt::Key_Y : | 1434 | case Qt::Key_Y : |
1428 | case Qt::Key_Z : | 1435 | case Qt::Key_Z : |
1429 | mView->viewManager()->showWorkWeekView(); | 1436 | mView->viewManager()->showWorkWeekView(); |
1430 | showSelectedDates = true; | 1437 | showSelectedDates = true; |
1431 | break; | 1438 | break; |
1432 | case Qt::Key_U : | 1439 | case Qt::Key_U : |
1433 | mView->viewManager()->showWeekView(); | 1440 | mView->viewManager()->showWeekView(); |
1434 | showSelectedDates = true; | 1441 | showSelectedDates = true; |
1435 | break; | 1442 | break; |
1436 | case Qt::Key_H : | 1443 | case Qt::Key_H : |
1437 | keyBindings(); | 1444 | keyBindings(); |
1438 | break; | 1445 | break; |
1439 | case Qt::Key_W: | 1446 | case Qt::Key_W: |
1440 | mView->viewManager()->showWhatsNextView(); | 1447 | mView->viewManager()->showWhatsNextView(); |
1441 | break; | 1448 | break; |
1442 | case Qt::Key_L: | 1449 | case Qt::Key_L: |
1443 | mView->viewManager()->showListView(); | 1450 | mView->viewManager()->showListView(); |
1444 | break; | 1451 | break; |
1445 | case Qt::Key_N: | 1452 | case Qt::Key_N: |
1446 | mView->viewManager()->showNextXView(); | 1453 | mView->viewManager()->showNextXView(); |
1447 | showSelectedDates = true; | 1454 | showSelectedDates = true; |
1448 | break; | 1455 | break; |
1449 | case Qt::Key_V: | 1456 | case Qt::Key_V: |
1450 | mView->viewManager()->showTodoView(); | 1457 | mView->viewManager()->showTodoView(); |
1451 | break; | 1458 | break; |
1452 | case Qt::Key_C: | 1459 | case Qt::Key_C: |
1453 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1460 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1454 | break; | 1461 | break; |
1455 | case Qt::Key_P: | 1462 | case Qt::Key_P: |
1456 | mView->showDatePicker( ); | 1463 | mView->showDatePicker( ); |
1457 | break; | 1464 | break; |
1458 | case Qt::Key_F: | 1465 | case Qt::Key_F: |
1459 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1466 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1460 | mView->editFilters(); | 1467 | mView->editFilters(); |
1461 | else | 1468 | else |
1462 | mView->toggleFilter(); | 1469 | mView->toggleFilter(); |
1463 | break; | 1470 | break; |
1464 | case Qt::Key_X: | 1471 | case Qt::Key_X: |
1465 | mView->toggleDateNavigatorWidget(); | 1472 | mView->toggleDateNavigatorWidget(); |
1466 | break; | 1473 | break; |
1467 | case Qt::Key_Space: | 1474 | case Qt::Key_Space: |
1468 | mView->toggleExpand(); | 1475 | mView->toggleExpand(); |
1469 | break; | 1476 | break; |
1470 | case Qt::Key_A: | 1477 | case Qt::Key_A: |
1471 | mView->toggleAllDaySize(); | 1478 | mView->toggleAllDaySize(); |
1472 | break; | 1479 | break; |
1473 | case Qt::Key_T: | 1480 | case Qt::Key_T: |
1474 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1481 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1475 | mView->newTodo(); | 1482 | mView->newTodo(); |
1476 | else { | 1483 | else { |
1477 | mView->goToday(); | 1484 | mView->goToday(); |
1478 | showSelectedDates = true; | 1485 | showSelectedDates = true; |
1479 | } | 1486 | } |
1480 | break; | 1487 | break; |
1481 | case Qt::Key_J: | 1488 | case Qt::Key_J: |
1482 | mView->viewManager()->showJournalView(); | 1489 | mView->viewManager()->showJournalView(); |
1483 | break; | 1490 | break; |
1484 | case Qt::Key_B: | 1491 | case Qt::Key_B: |
1485 | mView->editIncidenceDescription();; | 1492 | mView->editIncidenceDescription();; |
1486 | break; | 1493 | break; |
1487 | // case Qt::Key_Return: | 1494 | // case Qt::Key_Return: |
1488 | case Qt::Key_E: | 1495 | case Qt::Key_E: |
1489 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1496 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1490 | mView->newEvent(); | 1497 | mView->newEvent(); |
1491 | else | 1498 | else |
1492 | mView->editIncidence(); | 1499 | mView->editIncidence(); |
1493 | break; | 1500 | break; |
1494 | case Qt::Key_Plus: | 1501 | case Qt::Key_Plus: |
1495 | size = p->mHourSize +2; | 1502 | size = p->mHourSize +2; |
1496 | if ( size <= 18 ) | 1503 | if ( size <= 18 ) |
1497 | configureAgenda( size ); | 1504 | configureAgenda( size ); |
1498 | break; | 1505 | break; |
1499 | case Qt::Key_Minus: | 1506 | case Qt::Key_Minus: |
1500 | size = p->mHourSize - 2; | 1507 | size = p->mHourSize - 2; |
1501 | if ( size >= 4 ) | 1508 | if ( size >= 4 ) |
1502 | configureAgenda( size ); | 1509 | configureAgenda( size ); |
1503 | break; | 1510 | break; |
1504 | 1511 | ||
1505 | 1512 | ||
1506 | default: | 1513 | default: |
1507 | e->ignore(); | 1514 | e->ignore(); |
1508 | } | 1515 | } |
1509 | if ( pro > 0 ) { | 1516 | if ( pro > 0 ) { |
1510 | mView->selectFilter( pro-1 ); | 1517 | mView->selectFilter( pro-1 ); |
1511 | } | 1518 | } |
1512 | if ( showSelectedDates ) { | 1519 | if ( showSelectedDates ) { |
1513 | ;// setCaptionToDates(); | 1520 | ;// setCaptionToDates(); |
1514 | } | 1521 | } |
1515 | 1522 | ||
1516 | } | 1523 | } |
1517 | 1524 | ||
1525 | void MainWindow::fillFilterMenu() | ||
1526 | { | ||
1527 | selectFilterMenu->clear(); | ||
1528 | bool disable = false; | ||
1529 | if ( mView->filterView()->filtersEnabled() ) { | ||
1530 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); | ||
1531 | } | ||
1532 | else { | ||
1533 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); | ||
1534 | disable = true; | ||
1535 | } | ||
1536 | selectFilterMenu->insertSeparator(); | ||
1537 | QPtrList<CalFilter> fili = mView->filters(); | ||
1538 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | ||
1539 | CalFilter *filter = fili.first(); | ||
1540 | int iii = 1; | ||
1541 | while(filter) { | ||
1542 | selectFilterMenu->insertItem( filter->name(), iii ); | ||
1543 | if ( filter == curfilter) | ||
1544 | selectFilterMenu->setItemChecked( iii, true ); | ||
1545 | if ( disable ) | ||
1546 | selectFilterMenu->setItemEnabled( iii, false ); | ||
1547 | filter = fili.next(); | ||
1548 | ++iii; | ||
1549 | } | ||
1550 | qDebug("rettich "); | ||
1551 | } | ||
1552 | void MainWindow::selectFilter( int fil ) | ||
1553 | { | ||
1554 | qDebug("selectFilter %d ", fil); | ||
1555 | if ( fil == 0 ) { | ||
1556 | mView->toggleFilerEnabled( ); | ||
1557 | } else { | ||
1558 | mView->selectFilter( fil-1 ); | ||
1559 | } | ||
1560 | } | ||
1518 | void MainWindow::configureToolBar( int item ) | 1561 | void MainWindow::configureToolBar( int item ) |
1519 | { | 1562 | { |
1520 | 1563 | ||
1521 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1564 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1522 | KOPrefs *p = KOPrefs::instance(); | 1565 | KOPrefs *p = KOPrefs::instance(); |
1523 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1566 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1524 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1567 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1525 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1568 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1526 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1569 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1527 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1570 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1528 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1571 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1529 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1572 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1530 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1573 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1531 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1574 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1532 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1575 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1533 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1576 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1534 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1577 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1535 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1578 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1536 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1579 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1537 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1580 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1538 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1581 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1539 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1582 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1540 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1583 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1541 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1584 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1542 | // initActions(); | 1585 | // initActions(); |
1543 | } | 1586 | } |
1544 | 1587 | ||
1545 | void MainWindow::setCaptionToDates() | 1588 | void MainWindow::setCaptionToDates() |
1546 | { | 1589 | { |
1547 | QString selDates; | 1590 | QString selDates; |
1548 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1591 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1549 | if (mView->startDate() < mView->endDate() ) | 1592 | if (mView->startDate() < mView->endDate() ) |
1550 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1593 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1551 | setCaption( i18n("Dates: ") + selDates ); | 1594 | setCaption( i18n("Dates: ") + selDates ); |
1552 | 1595 | ||
1553 | } | 1596 | } |
1554 | // parameter item == 0: reinit | 1597 | // parameter item == 0: reinit |
1555 | void MainWindow::configureAgenda( int item ) | 1598 | void MainWindow::configureAgenda( int item ) |
1556 | { | 1599 | { |
1557 | 1600 | ||
1558 | KOPrefs *p = KOPrefs::instance(); | 1601 | KOPrefs *p = KOPrefs::instance(); |
1559 | 1602 | ||
1560 | int i; | 1603 | int i; |
1561 | if ( item == 1 ) { | 1604 | if ( item == 1 ) { |
1562 | mView->toggleAllDaySize(); | 1605 | mView->toggleAllDaySize(); |
1563 | return; | 1606 | return; |
1564 | } | 1607 | } |
1565 | // do not allow 4 for widgets higher than 480 | 1608 | // do not allow 4 for widgets higher than 480 |
1566 | // if ( QApplication::desktop()->height() > 480 ) { | 1609 | // if ( QApplication::desktop()->height() > 480 ) { |
1567 | // if ( item == 4 ) | 1610 | // if ( item == 4 ) |
1568 | // item = 6; | 1611 | // item = 6; |
1569 | // } | 1612 | // } |
1570 | for ( i = 4; i <= 18; i= i+2 ) | 1613 | for ( i = 4; i <= 18; i= i+2 ) |
1571 | configureAgendaMenu->setItemChecked( i, false ); | 1614 | configureAgendaMenu->setItemChecked( i, false ); |
1572 | configureAgendaMenu->setItemChecked( item, true ); | 1615 | configureAgendaMenu->setItemChecked( item, true ); |
1573 | if ( p->mHourSize == item ) | 1616 | if ( p->mHourSize == item ) |
1574 | return; | 1617 | return; |
1575 | p->mHourSize=item; | 1618 | p->mHourSize=item; |
1576 | mView->viewManager()->agendaView()->updateConfig(); | 1619 | mView->viewManager()->agendaView()->updateConfig(); |
1577 | } | 1620 | } |
1578 | 1621 | ||
1579 | void MainWindow::saveCalendar() | 1622 | void MainWindow::saveCalendar() |
1580 | { | 1623 | { |
1581 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1624 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1582 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1625 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1583 | 1626 | ||
1584 | if ( fn == "" ) | 1627 | if ( fn == "" ) |
1585 | return; | 1628 | return; |
1586 | QFileInfo info; | 1629 | QFileInfo info; |
1587 | info.setFile( fn ); | 1630 | info.setFile( fn ); |
1588 | QString mes; | 1631 | QString mes; |
1589 | bool createbup = true; | 1632 | bool createbup = true; |
1590 | if ( info. exists() ) { | 1633 | if ( info. exists() ) { |
1591 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1634 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1592 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1635 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1593 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1636 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1594 | 0, 1 ); | 1637 | 0, 1 ); |
1595 | if ( result != 0 ) { | 1638 | if ( result != 0 ) { |
1596 | createbup = false; | 1639 | createbup = false; |
1597 | } | 1640 | } |
1598 | } | 1641 | } |
1599 | if ( createbup ) { | 1642 | if ( createbup ) { |
1600 | mView->saveCalendar( fn ); | 1643 | mView->saveCalendar( fn ); |
1601 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1644 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1602 | KOPrefs::instance()->mLastSaveFile = fn; | 1645 | KOPrefs::instance()->mLastSaveFile = fn; |
1603 | setCaption(mes); | 1646 | setCaption(mes); |
1604 | } | 1647 | } |
1605 | } | 1648 | } |
1606 | void MainWindow::loadCalendar() | 1649 | void MainWindow::loadCalendar() |
1607 | { | 1650 | { |
1608 | 1651 | ||
1609 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1652 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1610 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1653 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1611 | 1654 | ||
1612 | if ( fn == "" ) | 1655 | if ( fn == "" ) |
1613 | return; | 1656 | return; |
1614 | QFileInfo info; | 1657 | QFileInfo info; |
1615 | info.setFile( fn ); | 1658 | info.setFile( fn ); |
1616 | QString mess; | 1659 | QString mess; |
1617 | bool loadbup = true; | 1660 | bool loadbup = true; |
1618 | if ( info. exists() ) { | 1661 | if ( info. exists() ) { |
1619 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1662 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1620 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1663 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1621 | mess, | 1664 | mess, |
1622 | i18n("Load!"), i18n("Cancel"), 0, | 1665 | i18n("Load!"), i18n("Cancel"), 0, |
1623 | 0, 1 ); | 1666 | 0, 1 ); |
1624 | if ( result != 0 ) { | 1667 | if ( result != 0 ) { |
1625 | loadbup = false; | 1668 | loadbup = false; |
1626 | } | 1669 | } |
1627 | } else { | 1670 | } else { |
1628 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1671 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1629 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1672 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1630 | 0, 1 ); | 1673 | 0, 1 ); |
1631 | 1674 | ||
1632 | return; | 1675 | return; |
1633 | } | 1676 | } |
1634 | if ( loadbup ) { | 1677 | if ( loadbup ) { |
1635 | mView->openCalendar( fn ); | 1678 | mView->openCalendar( fn ); |
1636 | KOPrefs::instance()->mLastLoadFile = fn; | 1679 | KOPrefs::instance()->mLastLoadFile = fn; |
1637 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1680 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1638 | setCaption(mess); | 1681 | setCaption(mess); |
1639 | } | 1682 | } |
1640 | 1683 | ||
1641 | } | 1684 | } |
1642 | void MainWindow::quickImportIcal() | 1685 | void MainWindow::quickImportIcal() |
1643 | { | 1686 | { |
1644 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1687 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1645 | } | 1688 | } |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 8a3f7b3..fba8c52 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,117 +1,120 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | 7 | ||
8 | #include <libkcal/incidence.h> | 8 | #include <libkcal/incidence.h> |
9 | #include "simplealarmclient.h" | 9 | #include "simplealarmclient.h" |
10 | 10 | ||
11 | class QAction; | 11 | class QAction; |
12 | class CalendarView; | 12 | class CalendarView; |
13 | class KSyncProfile; | 13 | class KSyncProfile; |
14 | #ifdef DESKTOP_VERSION | 14 | #ifdef DESKTOP_VERSION |
15 | 15 | ||
16 | #define QPEToolBar QToolBar | 16 | #define QPEToolBar QToolBar |
17 | #define QPEMenuBar QMenuBar | 17 | #define QPEMenuBar QMenuBar |
18 | #endif | 18 | #endif |
19 | class QPEToolBar; | 19 | class QPEToolBar; |
20 | 20 | ||
21 | namespace KCal { | 21 | namespace KCal { |
22 | class CalendarLocal; | 22 | class CalendarLocal; |
23 | } | 23 | } |
24 | 24 | ||
25 | using namespace KCal; | 25 | using namespace KCal; |
26 | 26 | ||
27 | class MainWindow : public QMainWindow | 27 | class MainWindow : public QMainWindow |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 31 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
32 | ~MainWindow(); | 32 | ~MainWindow(); |
33 | public slots: | 33 | public slots: |
34 | void configureAgenda( int ); | 34 | void configureAgenda( int ); |
35 | void recieve( const QCString& msg, const QByteArray& data ); | 35 | void recieve( const QCString& msg, const QByteArray& data ); |
36 | static QString defaultFileName(); | 36 | static QString defaultFileName(); |
37 | static QString resourcePath(); | 37 | static QString resourcePath(); |
38 | protected slots: | 38 | protected slots: |
39 | void setCaptionToDates(); | 39 | void setCaptionToDates(); |
40 | int ringSync(); | 40 | int ringSync(); |
41 | void multiSync( bool askforPrefs = false ); | 41 | void multiSync( bool askforPrefs = false ); |
42 | void about(); | 42 | void about(); |
43 | void licence(); | 43 | void licence(); |
44 | void faq(); | 44 | void faq(); |
45 | void usertrans(); | 45 | void usertrans(); |
46 | void features(); | 46 | void features(); |
47 | void synchowto(); | 47 | void synchowto(); |
48 | void whatsNew(); | 48 | void whatsNew(); |
49 | void keyBindings(); | 49 | void keyBindings(); |
50 | void aboutAutoSaving();; | 50 | void aboutAutoSaving();; |
51 | void aboutKnownBugs(); | 51 | void aboutKnownBugs(); |
52 | 52 | ||
53 | void processIncidenceSelection( Incidence * ); | 53 | void processIncidenceSelection( Incidence * ); |
54 | 54 | ||
55 | void importQtopia(); | 55 | void importQtopia(); |
56 | void importBday(); | 56 | void importBday(); |
57 | void importOL(); | 57 | void importOL(); |
58 | void importIcal(); | 58 | void importIcal(); |
59 | void importFile( QString, bool ); | 59 | void importFile( QString, bool ); |
60 | void quickImportIcal(); | 60 | void quickImportIcal(); |
61 | 61 | ||
62 | void slotModifiedChanged( bool ); | 62 | void slotModifiedChanged( bool ); |
63 | 63 | ||
64 | void save(); | 64 | void save(); |
65 | void configureToolBar( int ); | 65 | void configureToolBar( int ); |
66 | void printSel(); | 66 | void printSel(); |
67 | void printCal(); | 67 | void printCal(); |
68 | void saveCalendar(); | 68 | void saveCalendar(); |
69 | void loadCalendar(); | 69 | void loadCalendar(); |
70 | void exportVCalendar(); | 70 | void exportVCalendar(); |
71 | void fillFilterMenu(); | ||
72 | void selectFilter( int ); | ||
71 | 73 | ||
72 | void slotSyncMenu( int ); | 74 | void slotSyncMenu( int ); |
73 | void syncSSH(); | 75 | void syncSSH(); |
74 | void confSync(); | 76 | void confSync(); |
75 | void syncSharp(); | 77 | void syncSharp(); |
76 | void syncLocalFile(); | 78 | void syncLocalFile(); |
77 | bool syncWithFile( QString, bool ); | 79 | bool syncWithFile( QString, bool ); |
78 | void quickSyncLocalFile(); | 80 | void quickSyncLocalFile(); |
79 | 81 | ||
80 | 82 | ||
81 | protected: | 83 | protected: |
82 | void displayText( QString, QString); | 84 | void displayText( QString, QString); |
83 | void displayFile( QString, QString); | 85 | void displayFile( QString, QString); |
84 | 86 | ||
85 | void enableIncidenceActions( bool ); | 87 | void enableIncidenceActions( bool ); |
86 | 88 | ||
87 | private: | 89 | private: |
88 | void saveOnClose(); | 90 | void saveOnClose(); |
89 | int mCurrentSyncProfile; | 91 | int mCurrentSyncProfile; |
90 | void syncRemote( KSyncProfile* , bool ask = true); | 92 | void syncRemote( KSyncProfile* , bool ask = true); |
91 | void fillSyncMenu(); | 93 | void fillSyncMenu(); |
92 | bool mFlagKeyPressed; | 94 | bool mFlagKeyPressed; |
93 | bool mBlockAtStartup; | 95 | bool mBlockAtStartup; |
94 | QPEToolBar *iconToolBar; | 96 | QPEToolBar *iconToolBar; |
95 | void initActions(); | 97 | void initActions(); |
96 | void setDefaultPreferences(); | 98 | void setDefaultPreferences(); |
97 | void keyPressEvent ( QKeyEvent * ) ; | 99 | void keyPressEvent ( QKeyEvent * ) ; |
98 | void keyReleaseEvent ( QKeyEvent * ) ; | 100 | void keyReleaseEvent ( QKeyEvent * ) ; |
99 | QPopupMenu *configureToolBarMenu; | 101 | QPopupMenu *configureToolBarMenu; |
102 | QPopupMenu *selectFilterMenu; | ||
100 | QPopupMenu *configureAgendaMenu, *syncMenu; | 103 | QPopupMenu *configureAgendaMenu, *syncMenu; |
101 | CalendarLocal *mCalendar; | 104 | CalendarLocal *mCalendar; |
102 | CalendarView *mView; | 105 | CalendarView *mView; |
103 | QString getPassword(); | 106 | QString getPassword(); |
104 | QAction *mNewSubTodoAction; | 107 | QAction *mNewSubTodoAction; |
105 | 108 | ||
106 | QAction *mShowAction; | 109 | QAction *mShowAction; |
107 | QAction *mEditAction; | 110 | QAction *mEditAction; |
108 | QAction *mDeleteAction; | 111 | QAction *mDeleteAction; |
109 | void closeEvent( QCloseEvent* ce ); | 112 | void closeEvent( QCloseEvent* ce ); |
110 | SimpleAlarmClient mAlarmClient; | 113 | SimpleAlarmClient mAlarmClient; |
111 | QTimer mSaveTimer; | 114 | QTimer mSaveTimer; |
112 | bool mBlockSaveFlag; | 115 | bool mBlockSaveFlag; |
113 | bool mCalendarModifiedFlag; | 116 | bool mCalendarModifiedFlag; |
114 | QPixmap loadPixmap( QString ); | 117 | QPixmap loadPixmap( QString ); |
115 | }; | 118 | }; |
116 | 119 | ||
117 | #endif | 120 | #endif |