-rw-r--r-- | korganizer/calendarview.cpp | 18 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 19 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 |
4 files changed, 36 insertions, 4 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index e0380fa..77de94f 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2158,194 +2158,210 @@ void CalendarView::changeEventDisplay(Event *which, int action) | |||
2158 | mViewManager->currentView()->updateView(); | 2158 | mViewManager->currentView()->updateView(); |
2159 | } | 2159 | } |
2160 | } | 2160 | } |
2161 | 2161 | ||
2162 | 2162 | ||
2163 | void CalendarView::updateTodoViews() | 2163 | void CalendarView::updateTodoViews() |
2164 | { | 2164 | { |
2165 | mTodoList->updateView(); | 2165 | mTodoList->updateView(); |
2166 | mViewManager->currentView()->updateView(); | 2166 | mViewManager->currentView()->updateView(); |
2167 | 2167 | ||
2168 | } | 2168 | } |
2169 | 2169 | ||
2170 | 2170 | ||
2171 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2171 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2172 | { | 2172 | { |
2173 | mTodoList->updateView(); | 2173 | mTodoList->updateView(); |
2174 | mViewManager->updateView(start, end); | 2174 | mViewManager->updateView(start, end); |
2175 | //mDateNavigator->updateView(); | 2175 | //mDateNavigator->updateView(); |
2176 | } | 2176 | } |
2177 | 2177 | ||
2178 | void CalendarView::updateView() | 2178 | void CalendarView::updateView() |
2179 | { | 2179 | { |
2180 | DateList tmpList = mNavigator->selectedDates(); | 2180 | DateList tmpList = mNavigator->selectedDates(); |
2181 | 2181 | ||
2182 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2182 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2183 | mTodoList->updateView(); | 2183 | mTodoList->updateView(); |
2184 | // We assume that the navigator only selects consecutive days. | 2184 | // We assume that the navigator only selects consecutive days. |
2185 | updateView( tmpList.first(), tmpList.last() ); | 2185 | updateView( tmpList.first(), tmpList.last() ); |
2186 | } | 2186 | } |
2187 | 2187 | ||
2188 | void CalendarView::updateUnmanagedViews() | 2188 | void CalendarView::updateUnmanagedViews() |
2189 | { | 2189 | { |
2190 | mDateNavigator->updateDayMatrix(); | 2190 | mDateNavigator->updateDayMatrix(); |
2191 | } | 2191 | } |
2192 | 2192 | ||
2193 | int CalendarView::msgItemDelete(const QString name) | 2193 | int CalendarView::msgItemDelete(const QString name) |
2194 | { | 2194 | { |
2195 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2195 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2196 | i18n("This item will be\npermanently deleted."), | 2196 | i18n("This item will be\npermanently deleted."), |
2197 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2197 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2198 | } | 2198 | } |
2199 | 2199 | ||
2200 | 2200 | ||
2201 | void CalendarView::edit_cut() | 2201 | void CalendarView::edit_cut() |
2202 | { | 2202 | { |
2203 | Event *anEvent=0; | 2203 | Event *anEvent=0; |
2204 | 2204 | ||
2205 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2205 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2206 | 2206 | ||
2207 | if (mViewManager->currentView()->isEventView()) { | 2207 | if (mViewManager->currentView()->isEventView()) { |
2208 | if ( incidence && incidence->type() == "Event" ) { | 2208 | if ( incidence && incidence->type() == "Event" ) { |
2209 | anEvent = static_cast<Event *>(incidence); | 2209 | anEvent = static_cast<Event *>(incidence); |
2210 | } | 2210 | } |
2211 | } | 2211 | } |
2212 | 2212 | ||
2213 | if (!anEvent) { | 2213 | if (!anEvent) { |
2214 | KNotifyClient::beep(); | 2214 | KNotifyClient::beep(); |
2215 | return; | 2215 | return; |
2216 | } | 2216 | } |
2217 | DndFactory factory( mCalendar ); | 2217 | DndFactory factory( mCalendar ); |
2218 | factory.cutIncidence(anEvent); | 2218 | factory.cutIncidence(anEvent); |
2219 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2219 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2220 | } | 2220 | } |
2221 | 2221 | ||
2222 | void CalendarView::edit_copy() | 2222 | void CalendarView::edit_copy() |
2223 | { | 2223 | { |
2224 | Event *anEvent=0; | 2224 | Event *anEvent=0; |
2225 | 2225 | ||
2226 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2226 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2227 | 2227 | ||
2228 | if (mViewManager->currentView()->isEventView()) { | 2228 | if (mViewManager->currentView()->isEventView()) { |
2229 | if ( incidence && incidence->type() == "Event" ) { | 2229 | if ( incidence && incidence->type() == "Event" ) { |
2230 | anEvent = static_cast<Event *>(incidence); | 2230 | anEvent = static_cast<Event *>(incidence); |
2231 | } | 2231 | } |
2232 | } | 2232 | } |
2233 | 2233 | ||
2234 | if (!anEvent) { | 2234 | if (!anEvent) { |
2235 | KNotifyClient::beep(); | 2235 | KNotifyClient::beep(); |
2236 | return; | 2236 | return; |
2237 | } | 2237 | } |
2238 | DndFactory factory( mCalendar ); | 2238 | DndFactory factory( mCalendar ); |
2239 | factory.copyIncidence(anEvent); | 2239 | factory.copyIncidence(anEvent); |
2240 | } | 2240 | } |
2241 | 2241 | ||
2242 | void CalendarView::edit_paste() | 2242 | void CalendarView::edit_paste() |
2243 | { | 2243 | { |
2244 | QDate date = mNavigator->selectedDates().first(); | 2244 | QDate date = mNavigator->selectedDates().first(); |
2245 | 2245 | ||
2246 | DndFactory factory( mCalendar ); | 2246 | DndFactory factory( mCalendar ); |
2247 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2247 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2248 | 2248 | ||
2249 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2249 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2250 | } | 2250 | } |
2251 | 2251 | ||
2252 | void CalendarView::edit_options() | 2252 | void CalendarView::edit_options() |
2253 | { | 2253 | { |
2254 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | ||
2255 | emit save(); | ||
2256 | emit saveStopTimer(); | ||
2254 | mDialogManager->showOptionsDialog(); | 2257 | mDialogManager->showOptionsDialog(); |
2255 | //writeSettings(); | 2258 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2259 | emit saveStopTimer(); | ||
2260 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | ||
2261 | i18n("Timezone settings"),i18n("Reload"))) { | ||
2262 | qDebug("KO: TZ reload cancelled "); | ||
2263 | return; | ||
2264 | } | ||
2265 | qDebug("KO: Timezone change "); | ||
2266 | openCalendar( MainWindow::defaultFileName() ); | ||
2267 | setModified(true); | ||
2268 | } | ||
2269 | else | ||
2270 | qDebug("KO: No tz change "); | ||
2271 | |||
2256 | } | 2272 | } |
2257 | 2273 | ||
2258 | 2274 | ||
2259 | void CalendarView::slotSelectPickerDate( QDate d) | 2275 | void CalendarView::slotSelectPickerDate( QDate d) |
2260 | { | 2276 | { |
2261 | mDateFrame->hide(); | 2277 | mDateFrame->hide(); |
2262 | if ( mDatePickerMode == 1 ) { | 2278 | if ( mDatePickerMode == 1 ) { |
2263 | mNavigator->slotDaySelect( d ); | 2279 | mNavigator->slotDaySelect( d ); |
2264 | } else if ( mDatePickerMode == 2 ) { | 2280 | } else if ( mDatePickerMode == 2 ) { |
2265 | if ( mMoveIncidence->type() == "Todo" ) { | 2281 | if ( mMoveIncidence->type() == "Todo" ) { |
2266 | Todo * to = (Todo *) mMoveIncidence; | 2282 | Todo * to = (Todo *) mMoveIncidence; |
2267 | QTime tim; | 2283 | QTime tim; |
2268 | if ( to->hasDueDate() ) | 2284 | if ( to->hasDueDate() ) |
2269 | tim = to->dtDue().time(); | 2285 | tim = to->dtDue().time(); |
2270 | else { | 2286 | else { |
2271 | tim = QTime ( 0,0,0 ); | 2287 | tim = QTime ( 0,0,0 ); |
2272 | to->setFloats( true ); | 2288 | to->setFloats( true ); |
2273 | to->setHasDueDate( true ); | 2289 | to->setHasDueDate( true ); |
2274 | } | 2290 | } |
2275 | QDateTime dt ( d,tim ); | 2291 | QDateTime dt ( d,tim ); |
2276 | to->setDtDue( dt ); | 2292 | to->setDtDue( dt ); |
2277 | todoChanged( to ); | 2293 | todoChanged( to ); |
2278 | } else { | 2294 | } else { |
2279 | if ( mMoveIncidence->doesRecur() ) { | 2295 | if ( mMoveIncidence->doesRecur() ) { |
2280 | #if 0 | 2296 | #if 0 |
2281 | // PENDING implement this | 2297 | // PENDING implement this |
2282 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 2298 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
2283 | mCalendar()->addIncidence( newInc ); | 2299 | mCalendar()->addIncidence( newInc ); |
2284 | if ( mMoveIncidence->type() == "Todo" ) | 2300 | if ( mMoveIncidence->type() == "Todo" ) |
2285 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 2301 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
2286 | else | 2302 | else |
2287 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 2303 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
2288 | mMoveIncidence = newInc; | 2304 | mMoveIncidence = newInc; |
2289 | 2305 | ||
2290 | #endif | 2306 | #endif |
2291 | } | 2307 | } |
2292 | QTime tim = mMoveIncidence->dtStart().time(); | 2308 | QTime tim = mMoveIncidence->dtStart().time(); |
2293 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2309 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2294 | QDateTime dt ( d,tim ); | 2310 | QDateTime dt ( d,tim ); |
2295 | mMoveIncidence->setDtStart( dt ); | 2311 | mMoveIncidence->setDtStart( dt ); |
2296 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2312 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2297 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2313 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2298 | } | 2314 | } |
2299 | 2315 | ||
2300 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2316 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2301 | } | 2317 | } |
2302 | } | 2318 | } |
2303 | 2319 | ||
2304 | void CalendarView::removeCategories() | 2320 | void CalendarView::removeCategories() |
2305 | { | 2321 | { |
2306 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2322 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2307 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2323 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2308 | QStringList catIncList; | 2324 | QStringList catIncList; |
2309 | QStringList newCatList; | 2325 | QStringList newCatList; |
2310 | Incidence* inc = incList.first(); | 2326 | Incidence* inc = incList.first(); |
2311 | int i; | 2327 | int i; |
2312 | int count = 0; | 2328 | int count = 0; |
2313 | while ( inc ) { | 2329 | while ( inc ) { |
2314 | newCatList.clear(); | 2330 | newCatList.clear(); |
2315 | catIncList = inc->categories() ; | 2331 | catIncList = inc->categories() ; |
2316 | for( i = 0; i< catIncList.count(); ++i ) { | 2332 | for( i = 0; i< catIncList.count(); ++i ) { |
2317 | if ( catList.contains (catIncList[i])) | 2333 | if ( catList.contains (catIncList[i])) |
2318 | newCatList.append( catIncList[i] ); | 2334 | newCatList.append( catIncList[i] ); |
2319 | } | 2335 | } |
2320 | newCatList.sort(); | 2336 | newCatList.sort(); |
2321 | inc->setCategories( newCatList.join(",") ); | 2337 | inc->setCategories( newCatList.join(",") ); |
2322 | inc = incList.next(); | 2338 | inc = incList.next(); |
2323 | } | 2339 | } |
2324 | } | 2340 | } |
2325 | 2341 | ||
2326 | int CalendarView::addCategories() | 2342 | int CalendarView::addCategories() |
2327 | { | 2343 | { |
2328 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2344 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2329 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2345 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2330 | QStringList catIncList; | 2346 | QStringList catIncList; |
2331 | Incidence* inc = incList.first(); | 2347 | Incidence* inc = incList.first(); |
2332 | int i; | 2348 | int i; |
2333 | int count = 0; | 2349 | int count = 0; |
2334 | while ( inc ) { | 2350 | while ( inc ) { |
2335 | catIncList = inc->categories() ; | 2351 | catIncList = inc->categories() ; |
2336 | for( i = 0; i< catIncList.count(); ++i ) { | 2352 | for( i = 0; i< catIncList.count(); ++i ) { |
2337 | if ( !catList.contains (catIncList[i])) { | 2353 | if ( !catList.contains (catIncList[i])) { |
2338 | catList.append( catIncList[i] ); | 2354 | catList.append( catIncList[i] ); |
2339 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2355 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2340 | ++count; | 2356 | ++count; |
2341 | } | 2357 | } |
2342 | } | 2358 | } |
2343 | inc = incList.next(); | 2359 | inc = incList.next(); |
2344 | } | 2360 | } |
2345 | catList.sort(); | 2361 | catList.sort(); |
2346 | KOPrefs::instance()->mCustomCategories = catList; | 2362 | KOPrefs::instance()->mCustomCategories = catList; |
2347 | return count; | 2363 | return count; |
2348 | } | 2364 | } |
2349 | 2365 | ||
2350 | void CalendarView::manageCategories() | 2366 | void CalendarView::manageCategories() |
2351 | { | 2367 | { |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 6ea8287..8d7ff36 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -24,192 +24,194 @@ | |||
24 | #ifndef CALENDARVIEW_H | 24 | #ifndef CALENDARVIEW_H |
25 | #define CALENDARVIEW_H | 25 | #define CALENDARVIEW_H |
26 | 26 | ||
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qptrlist.h> | 30 | #include <qptrlist.h> |
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #ifndef DESKTOP_VERSION | 33 | #ifndef DESKTOP_VERSION |
34 | #include <qtopia/ir.h> | 34 | #include <qtopia/ir.h> |
35 | #else | 35 | #else |
36 | #define Ir char | 36 | #define Ir char |
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/scheduler.h> | 39 | #include <libkcal/scheduler.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | 42 | ||
43 | #include <korganizer/calendarviewbase.h> | 43 | #include <korganizer/calendarviewbase.h> |
44 | 44 | ||
45 | #include <ksyncmanager.h> | 45 | #include <ksyncmanager.h> |
46 | 46 | ||
47 | class QWidgetStack; | 47 | class QWidgetStack; |
48 | class QSplitter; | 48 | class QSplitter; |
49 | 49 | ||
50 | class CalPrinter; | 50 | class CalPrinter; |
51 | class KOFilterView; | 51 | class KOFilterView; |
52 | class KOViewManager; | 52 | class KOViewManager; |
53 | class KODialogManager; | 53 | class KODialogManager; |
54 | class KOTodoView; | 54 | class KOTodoView; |
55 | class KDateNavigator; | 55 | class KDateNavigator; |
56 | class DateNavigator; | 56 | class DateNavigator; |
57 | class KOIncidenceEditor; | 57 | class KOIncidenceEditor; |
58 | class KDatePicker; | 58 | class KDatePicker; |
59 | class ResourceView; | 59 | class ResourceView; |
60 | class NavigatorBar; | 60 | class NavigatorBar; |
61 | class KOEventEditor; | 61 | class KOEventEditor; |
62 | class KOTodoEditor ; | 62 | class KOTodoEditor ; |
63 | class KOEventViewerDialog; | 63 | class KOEventViewerDialog; |
64 | class KOBeamPrefs; | 64 | class KOBeamPrefs; |
65 | class KSyncProfile; | 65 | class KSyncProfile; |
66 | class AlarmDialog; | 66 | class AlarmDialog; |
67 | class KCal::Attendee; | 67 | class KCal::Attendee; |
68 | 68 | ||
69 | namespace KCal { class FileStorage; } | 69 | namespace KCal { class FileStorage; } |
70 | 70 | ||
71 | using namespace KCal; | 71 | using namespace KCal; |
72 | 72 | ||
73 | /** | 73 | /** |
74 | This is the main calendar widget. It provides the different vies on t he | 74 | This is the main calendar widget. It provides the different vies on t he |
75 | calendar data as well as the date navigator. It also handles synchronisation | 75 | calendar data as well as the date navigator. It also handles synchronisation |
76 | of the different views and controls the different dialogs like preferences, | 76 | of the different views and controls the different dialogs like preferences, |
77 | event editor, search dialog etc. | 77 | event editor, search dialog etc. |
78 | 78 | ||
79 | @short main calendar view widget | 79 | @short main calendar view widget |
80 | @author Cornelius Schumacher | 80 | @author Cornelius Schumacher |
81 | */ | 81 | */ |
82 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface | 82 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface |
83 | { | 83 | { |
84 | Q_OBJECT | 84 | Q_OBJECT |
85 | public: | 85 | public: |
86 | /** | 86 | /** |
87 | Constructs a new calendar view widget. | 87 | Constructs a new calendar view widget. |
88 | 88 | ||
89 | @param calendar calendar document | 89 | @param calendar calendar document |
90 | @param parent parent window | 90 | @param parent parent window |
91 | @param name Qt internal widget object name | 91 | @param name Qt internal widget object name |
92 | */ | 92 | */ |
93 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 93 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
94 | const char *name = 0 ); | 94 | const char *name = 0 ); |
95 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 95 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
96 | const char *name = 0 ); | 96 | const char *name = 0 ); |
97 | virtual ~CalendarView(); | 97 | virtual ~CalendarView(); |
98 | 98 | ||
99 | Calendar *calendar() { return mCalendar; } | 99 | Calendar *calendar() { return mCalendar; } |
100 | 100 | ||
101 | KOViewManager *viewManager(); | 101 | KOViewManager *viewManager(); |
102 | KODialogManager *dialogManager(); | 102 | KODialogManager *dialogManager(); |
103 | 103 | ||
104 | QDate startDate(); | 104 | QDate startDate(); |
105 | QDate endDate(); | 105 | QDate endDate(); |
106 | 106 | ||
107 | QWidgetStack *viewStack(); | 107 | QWidgetStack *viewStack(); |
108 | QWidget *leftFrame(); | 108 | QWidget *leftFrame(); |
109 | NavigatorBar *navigatorBar(); | 109 | NavigatorBar *navigatorBar(); |
110 | 110 | ||
111 | DateNavigator *dateNavigator(); | 111 | DateNavigator *dateNavigator(); |
112 | KDateNavigator *dateNavigatorWidget(); | 112 | KDateNavigator *dateNavigatorWidget(); |
113 | 113 | ||
114 | void addView(KOrg::BaseView *); | 114 | void addView(KOrg::BaseView *); |
115 | void showView(KOrg::BaseView *); | 115 | void showView(KOrg::BaseView *); |
116 | KOEventViewerDialog* getEventViewerDialog(); | 116 | KOEventViewerDialog* getEventViewerDialog(); |
117 | Incidence *currentSelection(); | 117 | Incidence *currentSelection(); |
118 | 118 | ||
119 | signals: | 119 | signals: |
120 | void save (); | ||
121 | void saveStopTimer (); | ||
120 | void tempDisableBR(bool); | 122 | void tempDisableBR(bool); |
121 | /** This todo has been modified */ | 123 | /** This todo has been modified */ |
122 | void todoModified(Todo *, int); | 124 | void todoModified(Todo *, int); |
123 | 125 | ||
124 | /** when change is made to options dialog, the topwidget will catch this | 126 | /** when change is made to options dialog, the topwidget will catch this |
125 | * and emit this signal which notifies all widgets which have registered | 127 | * and emit this signal which notifies all widgets which have registered |
126 | * for notification to update their settings. */ | 128 | * for notification to update their settings. */ |
127 | void configChanged(); | 129 | void configChanged(); |
128 | /** emitted when the topwidget is closing down, so that any attached | 130 | /** emitted when the topwidget is closing down, so that any attached |
129 | child windows can also close. */ | 131 | child windows can also close. */ |
130 | void closingDown(); | 132 | void closingDown(); |
131 | /** emitted right before we die */ | 133 | /** emitted right before we die */ |
132 | void closed(QWidget *); | 134 | void closed(QWidget *); |
133 | 135 | ||
134 | /** Emitted when state of modified flag changes */ | 136 | /** Emitted when state of modified flag changes */ |
135 | void modifiedChanged(bool); | 137 | void modifiedChanged(bool); |
136 | void signalmodified(); | 138 | void signalmodified(); |
137 | 139 | ||
138 | /** Emitted when state of read-only flag changes */ | 140 | /** Emitted when state of read-only flag changes */ |
139 | void readOnlyChanged(bool); | 141 | void readOnlyChanged(bool); |
140 | 142 | ||
141 | /** Emitted when the unit of navigation changes */ | 143 | /** Emitted when the unit of navigation changes */ |
142 | void changeNavStringPrev(const QString &); | 144 | void changeNavStringPrev(const QString &); |
143 | void changeNavStringNext(const QString &); | 145 | void changeNavStringNext(const QString &); |
144 | 146 | ||
145 | /** Emitted when state of events selection has changed and user is organizer*/ | 147 | /** Emitted when state of events selection has changed and user is organizer*/ |
146 | void organizerEventsSelected(bool); | 148 | void organizerEventsSelected(bool); |
147 | /** Emitted when state of events selection has changed and user is attendee*/ | 149 | /** Emitted when state of events selection has changed and user is attendee*/ |
148 | void groupEventsSelected(bool); | 150 | void groupEventsSelected(bool); |
149 | /** | 151 | /** |
150 | Emitted when an incidence gets selected. If the selection is cleared the | 152 | Emitted when an incidence gets selected. If the selection is cleared the |
151 | signal is emitted with 0 as argument. | 153 | signal is emitted with 0 as argument. |
152 | */ | 154 | */ |
153 | void incidenceSelected( Incidence * ); | 155 | void incidenceSelected( Incidence * ); |
154 | /** Emitted, when a todoitem is selected or deselected. */ | 156 | /** Emitted, when a todoitem is selected or deselected. */ |
155 | void todoSelected( bool ); | 157 | void todoSelected( bool ); |
156 | 158 | ||
157 | /** | 159 | /** |
158 | Emitted, when clipboard content changes. Parameter indicates if paste | 160 | Emitted, when clipboard content changes. Parameter indicates if paste |
159 | is possible or not. | 161 | is possible or not. |
160 | */ | 162 | */ |
161 | void pasteEnabled(bool); | 163 | void pasteEnabled(bool); |
162 | 164 | ||
163 | /** Emitted, when the number of incoming messages has changed. */ | 165 | /** Emitted, when the number of incoming messages has changed. */ |
164 | void numIncomingChanged(int); | 166 | void numIncomingChanged(int); |
165 | 167 | ||
166 | /** Emitted, when the number of outgoing messages has changed. */ | 168 | /** Emitted, when the number of outgoing messages has changed. */ |
167 | void numOutgoingChanged(int); | 169 | void numOutgoingChanged(int); |
168 | 170 | ||
169 | /** Send status message, which can e.g. be displayed in the status bar. */ | 171 | /** Send status message, which can e.g. be displayed in the status bar. */ |
170 | void statusMessage(const QString &); | 172 | void statusMessage(const QString &); |
171 | 173 | ||
172 | void calendarViewExpanded( bool ); | 174 | void calendarViewExpanded( bool ); |
173 | void updateSearchDialog(); | 175 | void updateSearchDialog(); |
174 | 176 | ||
175 | 177 | ||
176 | public slots: | 178 | public slots: |
177 | void showNavigatorBar(bool); | 179 | void showNavigatorBar(bool); |
178 | void showOpenError(); | 180 | void showOpenError(); |
179 | void watchSavedFile(); | 181 | void watchSavedFile(); |
180 | void recheckTimerAlarm(); | 182 | void recheckTimerAlarm(); |
181 | void checkNextTimerAlarm(); | 183 | void checkNextTimerAlarm(); |
182 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 184 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
183 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 185 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
184 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 186 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
185 | 187 | ||
186 | /** options dialog made a changed to the configuration. we catch this | 188 | /** options dialog made a changed to the configuration. we catch this |
187 | * and notify all widgets which need to update their configuration. */ | 189 | * and notify all widgets which need to update their configuration. */ |
188 | void updateConfig(); | 190 | void updateConfig(); |
189 | 191 | ||
190 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, | 192 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, |
191 | const QStringList& anniversaryList, const QStringList& realNameList, | 193 | const QStringList& anniversaryList, const QStringList& realNameList, |
192 | const QStringList& emailList, const QStringList& assembledNameList, | 194 | const QStringList& emailList, const QStringList& assembledNameList, |
193 | const QStringList& uidList); | 195 | const QStringList& uidList); |
194 | 196 | ||
195 | /** | 197 | /** |
196 | Load calendar from file \a filename. If \a merge is true, load | 198 | Load calendar from file \a filename. If \a merge is true, load |
197 | calendar into existing one, if it is false, clear calendar, before | 199 | calendar into existing one, if it is false, clear calendar, before |
198 | loading. Return true, if calendar could be successfully loaded. | 200 | loading. Return true, if calendar could be successfully loaded. |
199 | */ | 201 | */ |
200 | bool openCalendar(QString filename, bool merge=false); | 202 | bool openCalendar(QString filename, bool merge=false); |
201 | bool syncCalendar(QString filename,int mode = 0 ); | 203 | bool syncCalendar(QString filename,int mode = 0 ); |
202 | 204 | ||
203 | /** | 205 | /** |
204 | Save calendar data to file. Return true if calendar could be | 206 | Save calendar data to file. Return true if calendar could be |
205 | successfully saved. | 207 | successfully saved. |
206 | */ | 208 | */ |
207 | bool saveCalendar(QString filename); | 209 | bool saveCalendar(QString filename); |
208 | 210 | ||
209 | /** | 211 | /** |
210 | Close calendar. Clear calendar data and reset views to display an empty | 212 | Close calendar. Clear calendar data and reset views to display an empty |
211 | calendar. | 213 | calendar. |
212 | */ | 214 | */ |
213 | void closeCalendar(); | 215 | void closeCalendar(); |
214 | 216 | ||
215 | /** Archive old events of calendar */ | 217 | /** Archive old events of calendar */ |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 3feb4ab..a2c20a8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -166,192 +166,194 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
166 | globalFlagBlockStartup = 1; | 166 | globalFlagBlockStartup = 1; |
167 | iconToolBar = new QPEToolBar( this ); | 167 | iconToolBar = new QPEToolBar( this ); |
168 | addToolBar (iconToolBar , tbd ); | 168 | addToolBar (iconToolBar , tbd ); |
169 | mCalendarModifiedFlag = false; | 169 | mCalendarModifiedFlag = false; |
170 | 170 | ||
171 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 171 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
172 | splash->setAlignment ( AlignCenter ); | 172 | splash->setAlignment ( AlignCenter ); |
173 | setCentralWidget( splash ); | 173 | setCentralWidget( splash ); |
174 | #ifndef DESKTOP_VERSION | 174 | #ifndef DESKTOP_VERSION |
175 | showMaximized(); | 175 | showMaximized(); |
176 | #endif | 176 | #endif |
177 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 177 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
178 | setDefaultPreferences(); | 178 | setDefaultPreferences(); |
179 | mCalendar = new CalendarLocal(); | 179 | mCalendar = new CalendarLocal(); |
180 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 180 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
181 | mView->hide(); | 181 | mView->hide(); |
182 | //mView->resize(splash->size() ); | 182 | //mView->resize(splash->size() ); |
183 | initActions(); | 183 | initActions(); |
184 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 184 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
185 | mSyncManager->setBlockSave(false); | 185 | mSyncManager->setBlockSave(false); |
186 | mView->setSyncManager(mSyncManager); | 186 | mView->setSyncManager(mSyncManager); |
187 | #ifndef DESKTOP_VERSION | 187 | #ifndef DESKTOP_VERSION |
188 | iconToolBar->show(); | 188 | iconToolBar->show(); |
189 | qApp->processEvents(); | 189 | qApp->processEvents(); |
190 | #endif | 190 | #endif |
191 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 191 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
192 | int vh = height() ; | 192 | int vh = height() ; |
193 | int vw = width(); | 193 | int vw = width(); |
194 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 194 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
195 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 195 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
196 | vh -= iconToolBar->height(); | 196 | vh -= iconToolBar->height(); |
197 | } else { | 197 | } else { |
198 | vw -= iconToolBar->height(); | 198 | vw -= iconToolBar->height(); |
199 | } | 199 | } |
200 | //mView->setMaximumSize( splash->size() ); | 200 | //mView->setMaximumSize( splash->size() ); |
201 | //mView->resize( splash->size() ); | 201 | //mView->resize( splash->size() ); |
202 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 202 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
203 | mView->readSettings(); | 203 | mView->readSettings(); |
204 | bool newFile = false; | 204 | bool newFile = false; |
205 | if( !QFile::exists( defaultFileName() ) ) { | 205 | if( !QFile::exists( defaultFileName() ) ) { |
206 | QFileInfo finfo ( defaultFileName() ); | 206 | QFileInfo finfo ( defaultFileName() ); |
207 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 207 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
208 | qDebug("oldfile %s ", oldFile.latin1()); | 208 | qDebug("oldfile %s ", oldFile.latin1()); |
209 | 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"; | 209 | 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"; |
210 | finfo.setFile( oldFile ); | 210 | finfo.setFile( oldFile ); |
211 | if (finfo.exists() ) { | 211 | if (finfo.exists() ) { |
212 | KMessageBox::information( this, message); | 212 | KMessageBox::information( this, message); |
213 | mView->openCalendar( oldFile ); | 213 | mView->openCalendar( oldFile ); |
214 | qApp->processEvents(); | 214 | qApp->processEvents(); |
215 | } else { | 215 | } else { |
216 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 216 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
217 | finfo.setFile( oldFile ); | 217 | finfo.setFile( oldFile ); |
218 | if (finfo.exists() ) { | 218 | if (finfo.exists() ) { |
219 | KMessageBox::information( this, message); | 219 | KMessageBox::information( this, message); |
220 | mView->openCalendar( oldFile ); | 220 | mView->openCalendar( oldFile ); |
221 | qApp->processEvents(); | 221 | qApp->processEvents(); |
222 | } | 222 | } |
223 | } | 223 | } |
224 | mView->saveCalendar( defaultFileName() ); | 224 | mView->saveCalendar( defaultFileName() ); |
225 | newFile = true; | 225 | newFile = true; |
226 | } | 226 | } |
227 | 227 | ||
228 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 228 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
229 | mView->openCalendar( defaultFileName() ); | 229 | mView->openCalendar( defaultFileName() ); |
230 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 230 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
231 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 231 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
232 | 232 | ||
233 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 233 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
234 | KOPrefs::instance()->setCategoryDefaults(); | 234 | KOPrefs::instance()->setCategoryDefaults(); |
235 | int count = mView->addCategories(); | 235 | int count = mView->addCategories(); |
236 | } | 236 | } |
237 | processIncidenceSelection( 0 ); | 237 | processIncidenceSelection( 0 ); |
238 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 238 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
239 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 239 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
240 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 240 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
241 | SLOT( slotModifiedChanged( bool ) ) ); | 241 | SLOT( slotModifiedChanged( bool ) ) ); |
242 | 242 | ||
243 | 243 | ||
244 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 244 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
245 | SLOT( disableBR(bool) ) ); | 245 | SLOT( disableBR(bool) ) ); |
246 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 246 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
247 | mView->setModified( false ); | 247 | mView->setModified( false ); |
248 | mBlockAtStartup = false; | 248 | mBlockAtStartup = false; |
249 | mView->setModified( false ); | 249 | mView->setModified( false ); |
250 | setCentralWidget( mView ); | 250 | setCentralWidget( mView ); |
251 | globalFlagBlockStartup = 0; | 251 | globalFlagBlockStartup = 0; |
252 | mView->show(); | 252 | mView->show(); |
253 | delete splash; | 253 | delete splash; |
254 | if ( newFile ) | 254 | if ( newFile ) |
255 | mView->updateConfig(); | 255 | mView->updateConfig(); |
256 | // qApp->processEvents(); | 256 | // qApp->processEvents(); |
257 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 257 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
258 | //fillSyncMenu(); | 258 | //fillSyncMenu(); |
259 | 259 | ||
260 | 260 | ||
261 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 261 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
262 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | ||
263 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | ||
262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 264 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 265 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
264 | mSyncManager->setDefaultFileName( defaultFileName()); | 266 | mSyncManager->setDefaultFileName( defaultFileName()); |
265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 267 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
266 | mSyncManager->fillSyncMenu(); | 268 | mSyncManager->fillSyncMenu(); |
267 | 269 | ||
268 | 270 | ||
269 | 271 | ||
270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 272 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
271 | if ( showWarning ) { | 273 | if ( showWarning ) { |
272 | KMessageBox::information( this, | 274 | KMessageBox::information( this, |
273 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 275 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
274 | qApp->processEvents(); | 276 | qApp->processEvents(); |
275 | mView->dialogManager()->showSyncOptions(); | 277 | mView->dialogManager()->showSyncOptions(); |
276 | } | 278 | } |
277 | 279 | ||
278 | //US listen for result adressed from Ka/Pi | 280 | //US listen for result adressed from Ka/Pi |
279 | #ifndef DESKTOP_VERSION | 281 | #ifndef DESKTOP_VERSION |
280 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 282 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
281 | #endif | 283 | #endif |
282 | #ifndef DESKTOP_VERSION | 284 | #ifndef DESKTOP_VERSION |
283 | infrared = 0; | 285 | infrared = 0; |
284 | #endif | 286 | #endif |
285 | 287 | ||
286 | mBRdisabled = false; | 288 | mBRdisabled = false; |
287 | //toggleBeamReceive(); | 289 | //toggleBeamReceive(); |
288 | } | 290 | } |
289 | MainWindow::~MainWindow() | 291 | MainWindow::~MainWindow() |
290 | { | 292 | { |
291 | //qDebug("MainWindow::~MainWindow() "); | 293 | //qDebug("MainWindow::~MainWindow() "); |
292 | //save toolbar location | 294 | //save toolbar location |
293 | delete mCalendar; | 295 | delete mCalendar; |
294 | delete mSyncManager; | 296 | delete mSyncManager; |
295 | #ifndef DESKTOP_VERSION | 297 | #ifndef DESKTOP_VERSION |
296 | if ( infrared ) | 298 | if ( infrared ) |
297 | delete infrared; | 299 | delete infrared; |
298 | #endif | 300 | #endif |
299 | 301 | ||
300 | 302 | ||
301 | } | 303 | } |
302 | 304 | ||
303 | void MainWindow::disableBR(bool b) | 305 | void MainWindow::disableBR(bool b) |
304 | { | 306 | { |
305 | #ifndef DESKTOP_VERSION | 307 | #ifndef DESKTOP_VERSION |
306 | if ( b ) { | 308 | if ( b ) { |
307 | if ( infrared ) { | 309 | if ( infrared ) { |
308 | toggleBeamReceive(); | 310 | toggleBeamReceive(); |
309 | mBRdisabled = true; | 311 | mBRdisabled = true; |
310 | } | 312 | } |
311 | mBRdisabled = true; | 313 | mBRdisabled = true; |
312 | } else { | 314 | } else { |
313 | if ( mBRdisabled ) { | 315 | if ( mBRdisabled ) { |
314 | mBRdisabled = false; | 316 | mBRdisabled = false; |
315 | //makes no sense,because other cal ap is probably running | 317 | //makes no sense,because other cal ap is probably running |
316 | // toggleBeamReceive(); | 318 | // toggleBeamReceive(); |
317 | } | 319 | } |
318 | } | 320 | } |
319 | #endif | 321 | #endif |
320 | 322 | ||
321 | } | 323 | } |
322 | bool MainWindow::beamReceiveEnabled() | 324 | bool MainWindow::beamReceiveEnabled() |
323 | { | 325 | { |
324 | #ifndef DESKTOP_VERSION | 326 | #ifndef DESKTOP_VERSION |
325 | return ( infrared != 0 ); | 327 | return ( infrared != 0 ); |
326 | #endif | 328 | #endif |
327 | return false; | 329 | return false; |
328 | } | 330 | } |
329 | 331 | ||
330 | void MainWindow::toggleBeamReceive() | 332 | void MainWindow::toggleBeamReceive() |
331 | { | 333 | { |
332 | if ( mBRdisabled ) | 334 | if ( mBRdisabled ) |
333 | return; | 335 | return; |
334 | #ifndef DESKTOP_VERSION | 336 | #ifndef DESKTOP_VERSION |
335 | if ( infrared ) { | 337 | if ( infrared ) { |
336 | qDebug("disable BeamReceive "); | 338 | qDebug("disable BeamReceive "); |
337 | delete infrared; | 339 | delete infrared; |
338 | infrared = 0; | 340 | infrared = 0; |
339 | brAction->setOn(false); | 341 | brAction->setOn(false); |
340 | return; | 342 | return; |
341 | } | 343 | } |
342 | qDebug("enable BeamReceive "); | 344 | qDebug("enable BeamReceive "); |
343 | brAction->setOn(true); | 345 | brAction->setOn(true); |
344 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
345 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 347 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
346 | #endif | 348 | #endif |
347 | } | 349 | } |
348 | void MainWindow::showMaximized () | 350 | void MainWindow::showMaximized () |
349 | { | 351 | { |
350 | #ifndef DESKTOP_VERSION | 352 | #ifndef DESKTOP_VERSION |
351 | if ( ! globalFlagBlockStartup ) | 353 | if ( ! globalFlagBlockStartup ) |
352 | if ( mClosed ) | 354 | if ( mClosed ) |
353 | mView->goToday(); | 355 | mView->goToday(); |
354 | #endif | 356 | #endif |
355 | QWidget::showMaximized () ; | 357 | QWidget::showMaximized () ; |
356 | mClosed = false; | 358 | mClosed = false; |
357 | } | 359 | } |
@@ -1354,223 +1356,234 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) | |||
1354 | startString += " (" +incidence->location()+")"; | 1356 | startString += " (" +incidence->location()+")"; |
1355 | setCaption( incidence->summary()+startString); | 1357 | setCaption( incidence->summary()+startString); |
1356 | 1358 | ||
1357 | enableIncidenceActions( true ); | 1359 | enableIncidenceActions( true ); |
1358 | 1360 | ||
1359 | if ( incidence->type() == "Event" ) { | 1361 | if ( incidence->type() == "Event" ) { |
1360 | mShowAction->setText( i18n("Show Event...") ); | 1362 | mShowAction->setText( i18n("Show Event...") ); |
1361 | mEditAction->setText( i18n("Edit Event...") ); | 1363 | mEditAction->setText( i18n("Edit Event...") ); |
1362 | mDeleteAction->setText( i18n("Delete Event...") ); | 1364 | mDeleteAction->setText( i18n("Delete Event...") ); |
1363 | 1365 | ||
1364 | mNewSubTodoAction->setEnabled( false ); | 1366 | mNewSubTodoAction->setEnabled( false ); |
1365 | } else if ( incidence->type() == "Todo" ) { | 1367 | } else if ( incidence->type() == "Todo" ) { |
1366 | mShowAction->setText( i18n("Show Todo...") ); | 1368 | mShowAction->setText( i18n("Show Todo...") ); |
1367 | mEditAction->setText( i18n("Edit Todo...") ); | 1369 | mEditAction->setText( i18n("Edit Todo...") ); |
1368 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1370 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1369 | 1371 | ||
1370 | mNewSubTodoAction->setEnabled( true ); | 1372 | mNewSubTodoAction->setEnabled( true ); |
1371 | } else { | 1373 | } else { |
1372 | mShowAction->setText( i18n("Show...") ); | 1374 | mShowAction->setText( i18n("Show...") ); |
1373 | mShowAction->setText( i18n("Edit...") ); | 1375 | mShowAction->setText( i18n("Edit...") ); |
1374 | mShowAction->setText( i18n("Delete...") ); | 1376 | mShowAction->setText( i18n("Delete...") ); |
1375 | 1377 | ||
1376 | mNewSubTodoAction->setEnabled( false ); | 1378 | mNewSubTodoAction->setEnabled( false ); |
1377 | } | 1379 | } |
1378 | } | 1380 | } |
1379 | 1381 | ||
1380 | void MainWindow::enableIncidenceActions( bool enabled ) | 1382 | void MainWindow::enableIncidenceActions( bool enabled ) |
1381 | { | 1383 | { |
1382 | mShowAction->setEnabled( enabled ); | 1384 | mShowAction->setEnabled( enabled ); |
1383 | mEditAction->setEnabled( enabled ); | 1385 | mEditAction->setEnabled( enabled ); |
1384 | mDeleteAction->setEnabled( enabled ); | 1386 | mDeleteAction->setEnabled( enabled ); |
1385 | 1387 | ||
1386 | mCloneAction->setEnabled( enabled ); | 1388 | mCloneAction->setEnabled( enabled ); |
1387 | mMoveAction->setEnabled( enabled ); | 1389 | mMoveAction->setEnabled( enabled ); |
1388 | mBeamAction->setEnabled( enabled ); | 1390 | mBeamAction->setEnabled( enabled ); |
1389 | mCancelAction->setEnabled( enabled ); | 1391 | mCancelAction->setEnabled( enabled ); |
1390 | } | 1392 | } |
1391 | 1393 | ||
1392 | void MainWindow::importOL() | 1394 | void MainWindow::importOL() |
1393 | { | 1395 | { |
1394 | #ifdef _OL_IMPORT_ | 1396 | #ifdef _OL_IMPORT_ |
1395 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1397 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1396 | id->exec(); | 1398 | id->exec(); |
1397 | delete id; | 1399 | delete id; |
1398 | mView->updateView(); | 1400 | mView->updateView(); |
1399 | #endif | 1401 | #endif |
1400 | } | 1402 | } |
1401 | void MainWindow::importBday() | 1403 | void MainWindow::importBday() |
1402 | { | 1404 | { |
1403 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1405 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1404 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1406 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1405 | i18n("Import!"), i18n("Cancel"), 0, | 1407 | i18n("Import!"), i18n("Cancel"), 0, |
1406 | 0, 1 ); | 1408 | 0, 1 ); |
1407 | if ( result == 0 ) { | 1409 | if ( result == 0 ) { |
1408 | mView->importBday(); | 1410 | mView->importBday(); |
1409 | 1411 | ||
1410 | } | 1412 | } |
1411 | 1413 | ||
1412 | 1414 | ||
1413 | } | 1415 | } |
1414 | void MainWindow::importQtopia() | 1416 | void MainWindow::importQtopia() |
1415 | { | 1417 | { |
1416 | #ifndef DESKTOP_VERSION | 1418 | #ifndef DESKTOP_VERSION |
1417 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1419 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1418 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1420 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1419 | i18n("Import!"), i18n("Cancel"), 0, | 1421 | i18n("Import!"), i18n("Cancel"), 0, |
1420 | 0, 1 ); | 1422 | 0, 1 ); |
1421 | if ( result == 0 ) { | 1423 | if ( result == 0 ) { |
1422 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1424 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1423 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1425 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1424 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1426 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1425 | mView->importQtopia( categories, datebook, todolist ); | 1427 | mView->importQtopia( categories, datebook, todolist ); |
1426 | } | 1428 | } |
1427 | #else | 1429 | #else |
1428 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1430 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1429 | i18n("Not supported \non desktop!\n"), | 1431 | i18n("Not supported \non desktop!\n"), |
1430 | i18n("Ok"), i18n("Cancel"), 0, | 1432 | i18n("Ok"), i18n("Cancel"), 0, |
1431 | 0, 1 ); | 1433 | 0, 1 ); |
1432 | 1434 | ||
1433 | #endif | 1435 | #endif |
1434 | } | 1436 | } |
1435 | 1437 | ||
1436 | void MainWindow::saveOnClose() | 1438 | void MainWindow::saveOnClose() |
1437 | { | 1439 | { |
1438 | KOPrefs *p = KOPrefs::instance(); | 1440 | KOPrefs *p = KOPrefs::instance(); |
1439 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1441 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1440 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1442 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1441 | iconToolBar->y() > height()/2; | 1443 | iconToolBar->y() > height()/2; |
1442 | mView->writeSettings(); | 1444 | mView->writeSettings(); |
1443 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1445 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1444 | save(); | 1446 | save(); |
1445 | } | 1447 | } |
1446 | void MainWindow::slotModifiedChanged( bool changed ) | 1448 | void MainWindow::slotModifiedChanged( bool changed ) |
1447 | { | 1449 | { |
1448 | if ( mBlockAtStartup ) | 1450 | if ( mBlockAtStartup ) |
1449 | return; | 1451 | return; |
1452 | |||
1450 | int msec; | 1453 | int msec; |
1451 | // we store the changes after 1 minute, | 1454 | // we store the changes after 1 minute, |
1452 | // and for safety reasons after 10 minutes again | 1455 | // and for safety reasons after 10 minutes again |
1453 | if ( !mSyncManager->blockSave() ) | 1456 | if ( !mSyncManager->blockSave() ) |
1454 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1457 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1455 | else | 1458 | else |
1456 | msec = 1000 * 600; | 1459 | msec = 1000 * 600; |
1457 | mSaveTimer.start( msec, true ); // 1 minute | 1460 | mSaveTimer.start( msec, true ); // 1 minute |
1458 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1461 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1459 | mCalendarModifiedFlag = true; | 1462 | mCalendarModifiedFlag = true; |
1460 | } | 1463 | } |
1464 | void MainWindow::saveStopTimer() | ||
1465 | { | ||
1466 | mSaveTimer.stop(); | ||
1467 | if (mSaveTimer.isActive() ) | ||
1468 | qDebug("ti active "); | ||
1469 | else | ||
1470 | qDebug("KO: Save timer stopped"); | ||
1471 | } | ||
1461 | void MainWindow::save() | 1472 | void MainWindow::save() |
1462 | { | 1473 | { |
1474 | if ( !mCalendarModifiedFlag ) { | ||
1475 | qDebug("KO: Calendar not modified. Nothing saved."); | ||
1476 | return; | ||
1477 | } | ||
1463 | if ( mSyncManager->blockSave() ) | 1478 | if ( mSyncManager->blockSave() ) |
1464 | return; | 1479 | return; |
1465 | mSyncManager->setBlockSave(true); | 1480 | mSyncManager->setBlockSave(true); |
1466 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1481 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1467 | |||
1468 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1482 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1469 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1483 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1470 | qDebug("KO: Start saving data to file!"); | 1484 | qDebug("KO: Start saving data to file!"); |
1471 | mView->saveCalendar( defaultFileName() ); | 1485 | mView->saveCalendar( defaultFileName() ); |
1472 | 1486 | mCalendarModifiedFlag = false; | |
1473 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1487 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1474 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1488 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1475 | QString savemes; | 1489 | QString savemes; |
1476 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1490 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1477 | setCaption(savemes); | 1491 | setCaption(savemes); |
1478 | } else | 1492 | } else |
1479 | setCaption(i18n("Saving cancelled!")); | 1493 | setCaption(i18n("Saving cancelled!")); |
1480 | mCalendarModifiedFlag = false; | ||
1481 | mSyncManager->setBlockSave( false ); | 1494 | mSyncManager->setBlockSave( false ); |
1482 | } | 1495 | } |
1483 | 1496 | ||
1484 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1497 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1485 | { | 1498 | { |
1486 | if ( !e->isAutoRepeat() ) { | 1499 | if ( !e->isAutoRepeat() ) { |
1487 | mFlagKeyPressed = false; | 1500 | mFlagKeyPressed = false; |
1488 | } | 1501 | } |
1489 | } | 1502 | } |
1490 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1503 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1491 | { | 1504 | { |
1492 | qApp->processEvents(); | 1505 | qApp->processEvents(); |
1493 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1506 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1494 | e->ignore(); | 1507 | e->ignore(); |
1495 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1508 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1496 | return; | 1509 | return; |
1497 | } | 1510 | } |
1498 | if (! e->isAutoRepeat() ) | 1511 | if (! e->isAutoRepeat() ) |
1499 | mFlagKeyPressed = true; | 1512 | mFlagKeyPressed = true; |
1500 | KOPrefs *p = KOPrefs::instance(); | 1513 | KOPrefs *p = KOPrefs::instance(); |
1501 | bool showSelectedDates = false; | 1514 | bool showSelectedDates = false; |
1502 | int size; | 1515 | int size; |
1503 | int pro = 0; | 1516 | int pro = 0; |
1504 | //qDebug("MainWindow::keyPressEvent "); | 1517 | //qDebug("MainWindow::keyPressEvent "); |
1505 | switch ( e->key() ) { | 1518 | switch ( e->key() ) { |
1506 | case Qt::Key_Right: | 1519 | case Qt::Key_Right: |
1507 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1520 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1508 | mView->goNextMonth(); | 1521 | mView->goNextMonth(); |
1509 | else | 1522 | else |
1510 | mView->goNext(); | 1523 | mView->goNext(); |
1511 | showSelectedDates = true; | 1524 | showSelectedDates = true; |
1512 | break; | 1525 | break; |
1513 | case Qt::Key_Left: | 1526 | case Qt::Key_Left: |
1514 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1527 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1515 | mView->goPreviousMonth(); | 1528 | mView->goPreviousMonth(); |
1516 | else | 1529 | else |
1517 | mView->goPrevious(); | 1530 | mView->goPrevious(); |
1518 | showSelectedDates = true; | 1531 | showSelectedDates = true; |
1519 | break; | 1532 | break; |
1520 | case Qt::Key_Down: | 1533 | case Qt::Key_Down: |
1521 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1534 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1522 | break; | 1535 | break; |
1523 | case Qt::Key_Up: | 1536 | case Qt::Key_Up: |
1524 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1537 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1525 | break; | 1538 | break; |
1526 | case Qt::Key_I: | 1539 | case Qt::Key_I: |
1527 | mView->showIncidence(); | 1540 | mView->showIncidence(); |
1528 | break; | 1541 | break; |
1529 | case Qt::Key_Delete: | 1542 | case Qt::Key_Delete: |
1530 | case Qt::Key_Backspace: | 1543 | case Qt::Key_Backspace: |
1531 | mView->deleteIncidence(); | 1544 | mView->deleteIncidence(); |
1532 | break; | 1545 | break; |
1533 | case Qt::Key_D: | 1546 | case Qt::Key_D: |
1534 | mView->viewManager()->showDayView(); | 1547 | mView->viewManager()->showDayView(); |
1535 | showSelectedDates = true; | 1548 | showSelectedDates = true; |
1536 | break; | 1549 | break; |
1537 | case Qt::Key_O: | 1550 | case Qt::Key_O: |
1538 | mView->toggleFilerEnabled( ); | 1551 | mView->toggleFilerEnabled( ); |
1539 | break; | 1552 | break; |
1540 | case Qt::Key_0: | 1553 | case Qt::Key_0: |
1541 | case Qt::Key_1: | 1554 | case Qt::Key_1: |
1542 | case Qt::Key_2: | 1555 | case Qt::Key_2: |
1543 | case Qt::Key_3: | 1556 | case Qt::Key_3: |
1544 | case Qt::Key_4: | 1557 | case Qt::Key_4: |
1545 | case Qt::Key_5: | 1558 | case Qt::Key_5: |
1546 | case Qt::Key_6: | 1559 | case Qt::Key_6: |
1547 | case Qt::Key_7: | 1560 | case Qt::Key_7: |
1548 | case Qt::Key_8: | 1561 | case Qt::Key_8: |
1549 | case Qt::Key_9: | 1562 | case Qt::Key_9: |
1550 | pro = e->key()-48; | 1563 | pro = e->key()-48; |
1551 | if ( pro == 0 ) | 1564 | if ( pro == 0 ) |
1552 | pro = 10; | 1565 | pro = 10; |
1553 | if ( e->state() == Qt::ControlButton) | 1566 | if ( e->state() == Qt::ControlButton) |
1554 | pro += 10; | 1567 | pro += 10; |
1555 | break; | 1568 | break; |
1556 | case Qt::Key_M: | 1569 | case Qt::Key_M: |
1557 | mView->viewManager()->showMonthView(); | 1570 | mView->viewManager()->showMonthView(); |
1558 | showSelectedDates = true; | 1571 | showSelectedDates = true; |
1559 | break; | 1572 | break; |
1560 | case Qt::Key_Insert: | 1573 | case Qt::Key_Insert: |
1561 | mView->newEvent(); | 1574 | mView->newEvent(); |
1562 | break; | 1575 | break; |
1563 | case Qt::Key_S : | 1576 | case Qt::Key_S : |
1564 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1577 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1565 | mView->newSubTodo(); | 1578 | mView->newSubTodo(); |
1566 | else | 1579 | else |
1567 | mView->dialogManager()->showSearchDialog(); | 1580 | mView->dialogManager()->showSearchDialog(); |
1568 | break; | 1581 | break; |
1569 | case Qt::Key_Y : | 1582 | case Qt::Key_Y : |
1570 | case Qt::Key_Z : | 1583 | case Qt::Key_Z : |
1571 | mView->viewManager()->showWorkWeekView(); | 1584 | mView->viewManager()->showWorkWeekView(); |
1572 | showSelectedDates = true; | 1585 | showSelectedDates = true; |
1573 | break; | 1586 | break; |
1574 | case Qt::Key_U : | 1587 | case Qt::Key_U : |
1575 | mView->viewManager()->showWeekView(); | 1588 | mView->viewManager()->showWeekView(); |
1576 | showSelectedDates = true; | 1589 | showSelectedDates = true; |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 6de0543..8dd55ac 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,141 +1,142 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qtextstream.h> | 8 | #include <qtextstream.h> |
9 | #include <qregexp.h> | 9 | #include <qregexp.h> |
10 | 10 | ||
11 | #include <libkcal/incidence.h> | 11 | #include <libkcal/incidence.h> |
12 | #include "simplealarmclient.h" | 12 | #include "simplealarmclient.h" |
13 | #include <ksyncmanager.h> | 13 | #include <ksyncmanager.h> |
14 | #ifndef DESKTOP_VERSION | 14 | #ifndef DESKTOP_VERSION |
15 | #include <qcopchannel_qws.h> | 15 | #include <qcopchannel_qws.h> |
16 | #endif | 16 | #endif |
17 | class QAction; | 17 | class QAction; |
18 | class CalendarView; | 18 | class CalendarView; |
19 | class KSyncProfile; | 19 | class KSyncProfile; |
20 | #ifdef DESKTOP_VERSION | 20 | #ifdef DESKTOP_VERSION |
21 | 21 | ||
22 | #define QPEToolBar QToolBar | 22 | #define QPEToolBar QToolBar |
23 | #define QPEMenuBar QMenuBar | 23 | #define QPEMenuBar QMenuBar |
24 | #endif | 24 | #endif |
25 | class QPEToolBar; | 25 | class QPEToolBar; |
26 | 26 | ||
27 | 27 | ||
28 | namespace KCal { | 28 | namespace KCal { |
29 | class CalendarLocal; | 29 | class CalendarLocal; |
30 | } | 30 | } |
31 | 31 | ||
32 | using namespace KCal; | 32 | using namespace KCal; |
33 | 33 | ||
34 | class MainWindow : public QMainWindow | 34 | class MainWindow : public QMainWindow |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 38 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
39 | ~MainWindow(); | 39 | ~MainWindow(); |
40 | bool beamReceiveEnabled(); | 40 | bool beamReceiveEnabled(); |
41 | static QString defaultFileName(); | 41 | static QString defaultFileName(); |
42 | static QString syncFileName(); | 42 | static QString syncFileName(); |
43 | static QString resourcePath(); | 43 | static QString resourcePath(); |
44 | public slots: | 44 | public slots: |
45 | virtual void showMaximized (); | 45 | virtual void showMaximized (); |
46 | void configureAgenda( int ); | 46 | void configureAgenda( int ); |
47 | void recieve( const QCString& msg, const QByteArray& data ); | 47 | void recieve( const QCString& msg, const QByteArray& data ); |
48 | protected slots: | 48 | protected slots: |
49 | void setCaptionToDates(); | 49 | void setCaptionToDates(); |
50 | void about(); | 50 | void about(); |
51 | void licence(); | 51 | void licence(); |
52 | void faq(); | 52 | void faq(); |
53 | void usertrans(); | 53 | void usertrans(); |
54 | void features(); | 54 | void features(); |
55 | void synchowto(); | 55 | void synchowto(); |
56 | void kdesynchowto(); | 56 | void kdesynchowto(); |
57 | void multisynchowto(); | 57 | void multisynchowto(); |
58 | void whatsNew(); | 58 | void whatsNew(); |
59 | void keyBindings(); | 59 | void keyBindings(); |
60 | void aboutAutoSaving();; | 60 | void aboutAutoSaving();; |
61 | void aboutKnownBugs(); | 61 | void aboutKnownBugs(); |
62 | 62 | ||
63 | void processIncidenceSelection( Incidence * ); | 63 | void processIncidenceSelection( Incidence * ); |
64 | 64 | ||
65 | void importQtopia(); | 65 | void importQtopia(); |
66 | void importBday(); | 66 | void importBday(); |
67 | void importOL(); | 67 | void importOL(); |
68 | void importIcal(); | 68 | void importIcal(); |
69 | void importFile( QString, bool ); | 69 | void importFile( QString, bool ); |
70 | void quickImportIcal(); | 70 | void quickImportIcal(); |
71 | 71 | ||
72 | void slotModifiedChanged( bool ); | 72 | void slotModifiedChanged( bool ); |
73 | 73 | ||
74 | void save(); | 74 | void save(); |
75 | void saveStopTimer(); | ||
75 | void configureToolBar( int ); | 76 | void configureToolBar( int ); |
76 | void printSel(); | 77 | void printSel(); |
77 | void printCal(); | 78 | void printCal(); |
78 | void saveCalendar(); | 79 | void saveCalendar(); |
79 | void loadCalendar(); | 80 | void loadCalendar(); |
80 | void exportVCalendar(); | 81 | void exportVCalendar(); |
81 | void fillFilterMenu(); | 82 | void fillFilterMenu(); |
82 | void selectFilter( int ); | 83 | void selectFilter( int ); |
83 | void exportToPhone( int ); | 84 | void exportToPhone( int ); |
84 | void toggleBeamReceive(); | 85 | void toggleBeamReceive(); |
85 | void disableBR(bool); | 86 | void disableBR(bool); |
86 | 87 | ||
87 | private slots: | 88 | private slots: |
88 | void showConfigureAgenda(); | 89 | void showConfigureAgenda(); |
89 | void getFile( bool ); | 90 | void getFile( bool ); |
90 | void syncFileRequest(); | 91 | void syncFileRequest(); |
91 | 92 | ||
92 | protected: | 93 | protected: |
93 | void displayText( QString, QString); | 94 | void displayText( QString, QString); |
94 | void enableIncidenceActions( bool ); | 95 | void enableIncidenceActions( bool ); |
95 | 96 | ||
96 | private: | 97 | private: |
97 | bool mBRdisabled; | 98 | bool mBRdisabled; |
98 | #ifndef DESKTOP_VERSION | 99 | #ifndef DESKTOP_VERSION |
99 | QCopChannel* infrared; | 100 | QCopChannel* infrared; |
100 | #endif | 101 | #endif |
101 | QAction* brAction; | 102 | QAction* brAction; |
102 | KSyncManager* mSyncManager; | 103 | KSyncManager* mSyncManager; |
103 | bool mClosed; | 104 | bool mClosed; |
104 | void saveOnClose(); | 105 | void saveOnClose(); |
105 | bool mFlagKeyPressed; | 106 | bool mFlagKeyPressed; |
106 | bool mBlockAtStartup; | 107 | bool mBlockAtStartup; |
107 | QPEToolBar *iconToolBar; | 108 | QPEToolBar *iconToolBar; |
108 | void initActions(); | 109 | void initActions(); |
109 | void setDefaultPreferences(); | 110 | void setDefaultPreferences(); |
110 | void keyPressEvent ( QKeyEvent * ) ; | 111 | void keyPressEvent ( QKeyEvent * ) ; |
111 | void keyReleaseEvent ( QKeyEvent * ) ; | 112 | void keyReleaseEvent ( QKeyEvent * ) ; |
112 | QPopupMenu *configureToolBarMenu; | 113 | QPopupMenu *configureToolBarMenu; |
113 | QPopupMenu *selectFilterMenu; | 114 | QPopupMenu *selectFilterMenu; |
114 | QPopupMenu *configureAgendaMenu, *syncMenu; | 115 | QPopupMenu *configureAgendaMenu, *syncMenu; |
115 | CalendarLocal *mCalendar; | 116 | CalendarLocal *mCalendar; |
116 | CalendarView *mView; | 117 | CalendarView *mView; |
117 | QAction *mNewSubTodoAction; | 118 | QAction *mNewSubTodoAction; |
118 | 119 | ||
119 | QAction *mShowAction; | 120 | QAction *mShowAction; |
120 | QAction *mEditAction; | 121 | QAction *mEditAction; |
121 | QAction *mDeleteAction; | 122 | QAction *mDeleteAction; |
122 | QAction *mCloneAction; | 123 | QAction *mCloneAction; |
123 | QAction *mMoveAction; | 124 | QAction *mMoveAction; |
124 | QAction *mBeamAction; | 125 | QAction *mBeamAction; |
125 | QAction *mCancelAction; | 126 | QAction *mCancelAction; |
126 | 127 | ||
127 | QAction *mToggleNav; | 128 | QAction *mToggleNav; |
128 | QAction *mToggleFilter; | 129 | QAction *mToggleFilter; |
129 | QAction *mToggleAllday; | 130 | QAction *mToggleAllday; |
130 | 131 | ||
131 | 132 | ||
132 | void closeEvent( QCloseEvent* ce ); | 133 | void closeEvent( QCloseEvent* ce ); |
133 | SimpleAlarmClient mAlarmClient; | 134 | SimpleAlarmClient mAlarmClient; |
134 | QTimer mSaveTimer; | 135 | QTimer mSaveTimer; |
135 | //bool mBlockSaveFlag; | 136 | //bool mBlockSaveFlag; |
136 | bool mCalendarModifiedFlag; | 137 | bool mCalendarModifiedFlag; |
137 | QPixmap loadPixmap( QString ); | 138 | QPixmap loadPixmap( QString ); |
138 | }; | 139 | }; |
139 | 140 | ||
140 | 141 | ||
141 | #endif | 142 | #endif |