summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp5
-rw-r--r--korganizer/koprefs.cpp6
-rw-r--r--korganizer/mainwindow.cpp4
3 files changed, 6 insertions, 9 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 290c0b9..884c61a 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1922,770 +1922,773 @@ void CalendarView::readFilterSettings(KConfig *config)
1922 1922
1923 if (mFilters.count() == 0) { 1923 if (mFilters.count() == 0) {
1924 CalFilter *filter = new CalFilter(i18n("Default")); 1924 CalFilter *filter = new CalFilter(i18n("Default"));
1925 mFilters.append(filter); 1925 mFilters.append(filter);
1926 } 1926 }
1927 mFilterView->updateFilters(); 1927 mFilterView->updateFilters();
1928 config->setGroup("FilterView"); 1928 config->setGroup("FilterView");
1929 1929
1930 mFilterView->blockSignals(true); 1930 mFilterView->blockSignals(true);
1931 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 1931 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
1932 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 1932 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
1933 mFilterView->blockSignals(false); 1933 mFilterView->blockSignals(false);
1934 // We do it manually to avoid it being done twice by the above calls 1934 // We do it manually to avoid it being done twice by the above calls
1935 updateFilter(); 1935 updateFilter();
1936} 1936}
1937 1937
1938void CalendarView::writeFilterSettings(KConfig *config) 1938void CalendarView::writeFilterSettings(KConfig *config)
1939{ 1939{
1940 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 1940 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
1941 1941
1942 QStringList filterList; 1942 QStringList filterList;
1943 1943
1944 CalFilter *filter = mFilters.first(); 1944 CalFilter *filter = mFilters.first();
1945 while(filter) { 1945 while(filter) {
1946 // kdDebug() << " fn: " << filter->name() << endl; 1946 // kdDebug() << " fn: " << filter->name() << endl;
1947 filterList << filter->name(); 1947 filterList << filter->name();
1948 config->setGroup("Filter_" + filter->name()); 1948 config->setGroup("Filter_" + filter->name());
1949 config->writeEntry("Criteria",filter->criteria()); 1949 config->writeEntry("Criteria",filter->criteria());
1950 config->writeEntry("CategoryList",filter->categoryList()); 1950 config->writeEntry("CategoryList",filter->categoryList());
1951 filter = mFilters.next(); 1951 filter = mFilters.next();
1952 } 1952 }
1953 config->setGroup("General"); 1953 config->setGroup("General");
1954 config->writeEntry("CalendarFilters",filterList); 1954 config->writeEntry("CalendarFilters",filterList);
1955 1955
1956 config->setGroup("FilterView"); 1956 config->setGroup("FilterView");
1957 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 1957 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
1958 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 1958 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
1959} 1959}
1960 1960
1961 1961
1962void CalendarView::goToday() 1962void CalendarView::goToday()
1963{ 1963{
1964 mNavigator->selectToday(); 1964 mNavigator->selectToday();
1965} 1965}
1966 1966
1967void CalendarView::goNext() 1967void CalendarView::goNext()
1968{ 1968{
1969 mNavigator->selectNext(); 1969 mNavigator->selectNext();
1970} 1970}
1971 1971
1972void CalendarView::goPrevious() 1972void CalendarView::goPrevious()
1973{ 1973{
1974 mNavigator->selectPrevious(); 1974 mNavigator->selectPrevious();
1975} 1975}
1976void CalendarView::goNextMonth() 1976void CalendarView::goNextMonth()
1977{ 1977{
1978 mNavigator->selectNextMonth(); 1978 mNavigator->selectNextMonth();
1979} 1979}
1980 1980
1981void CalendarView::goPreviousMonth() 1981void CalendarView::goPreviousMonth()
1982{ 1982{
1983 mNavigator->selectPreviousMonth(); 1983 mNavigator->selectPreviousMonth();
1984} 1984}
1985void CalendarView::writeLocale() 1985void CalendarView::writeLocale()
1986{ 1986{
1987 //KPimGlobalPrefs::instance()->setGlobalConfig(); 1987 //KPimGlobalPrefs::instance()->setGlobalConfig();
1988#if 0 1988#if 0
1989 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 1989 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
1990 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 1990 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
1991 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 1991 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
1992 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 1992 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
1993 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1993 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1994 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 1994 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
1995 dummy = KOPrefs::instance()->mUserDateFormatShort; 1995 dummy = KOPrefs::instance()->mUserDateFormatShort;
1996 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 1996 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
1997 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 1997 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
1998 KOPrefs::instance()->mDaylightsavingStart, 1998 KOPrefs::instance()->mDaylightsavingStart,
1999 KOPrefs::instance()->mDaylightsavingEnd ); 1999 KOPrefs::instance()->mDaylightsavingEnd );
2000 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); 2000 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId );
2001#endif 2001#endif
2002} 2002}
2003void CalendarView::updateConfig() 2003void CalendarView::updateConfig()
2004{ 2004{
2005 writeLocale(); 2005 writeLocale();
2006 if ( KOPrefs::instance()->mUseAppColors ) 2006 if ( KOPrefs::instance()->mUseAppColors )
2007 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2007 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2008 emit configChanged(); 2008 emit configChanged();
2009 mTodoList->updateConfig(); 2009 mTodoList->updateConfig();
2010 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2010 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2011 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 2011 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
2012 // To make the "fill window" configurations work 2012 // To make the "fill window" configurations work
2013 //mViewManager->raiseCurrentView(); 2013 //mViewManager->raiseCurrentView();
2014} 2014}
2015 2015
2016 2016
2017void CalendarView::eventChanged(Event *event) 2017void CalendarView::eventChanged(Event *event)
2018{ 2018{
2019 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2019 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2020 //updateUnmanagedViews(); 2020 //updateUnmanagedViews();
2021} 2021}
2022 2022
2023void CalendarView::eventAdded(Event *event) 2023void CalendarView::eventAdded(Event *event)
2024{ 2024{
2025 changeEventDisplay(event,KOGlobals::EVENTADDED); 2025 changeEventDisplay(event,KOGlobals::EVENTADDED);
2026} 2026}
2027 2027
2028void CalendarView::eventToBeDeleted(Event *) 2028void CalendarView::eventToBeDeleted(Event *)
2029{ 2029{
2030 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2030 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2031} 2031}
2032 2032
2033void CalendarView::eventDeleted() 2033void CalendarView::eventDeleted()
2034{ 2034{
2035 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2035 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2036} 2036}
2037void CalendarView::changeTodoDisplay(Todo *which, int action) 2037void CalendarView::changeTodoDisplay(Todo *which, int action)
2038{ 2038{
2039 changeIncidenceDisplay((Incidence *)which, action); 2039 changeIncidenceDisplay((Incidence *)which, action);
2040 mDateNavigator->updateView(); //LR 2040 mDateNavigator->updateView(); //LR
2041 //mDialogManager->updateSearchDialog(); 2041 //mDialogManager->updateSearchDialog();
2042 2042
2043 if (which) { 2043 if (which) {
2044 mViewManager->updateWNview(); 2044 mViewManager->updateWNview();
2045 //mTodoList->updateView(); 2045 //mTodoList->updateView();
2046 } 2046 }
2047 2047
2048} 2048}
2049 2049
2050void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2050void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2051{ 2051{
2052 updateUnmanagedViews(); 2052 updateUnmanagedViews();
2053 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2053 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2054 if ( action == KOGlobals::EVENTDELETED ) { //delete 2054 if ( action == KOGlobals::EVENTDELETED ) { //delete
2055 mCalendar->checkAlarmForIncidence( 0, true ); 2055 mCalendar->checkAlarmForIncidence( 0, true );
2056 if ( mEventViewerDialog ) 2056 if ( mEventViewerDialog )
2057 mEventViewerDialog->hide(); 2057 mEventViewerDialog->hide();
2058 } 2058 }
2059 else 2059 else
2060 mCalendar->checkAlarmForIncidence( which , false ); 2060 mCalendar->checkAlarmForIncidence( which , false );
2061} 2061}
2062 2062
2063// most of the changeEventDisplays() right now just call the view's 2063// most of the changeEventDisplays() right now just call the view's
2064// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2064// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2065void CalendarView::changeEventDisplay(Event *which, int action) 2065void CalendarView::changeEventDisplay(Event *which, int action)
2066{ 2066{
2067 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2067 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2068 changeIncidenceDisplay((Incidence *)which, action); 2068 changeIncidenceDisplay((Incidence *)which, action);
2069 mDateNavigator->updateView(); 2069 mDateNavigator->updateView();
2070 //mDialogManager->updateSearchDialog(); 2070 //mDialogManager->updateSearchDialog();
2071 2071
2072 if (which) { 2072 if (which) {
2073 // If there is an event view visible update the display 2073 // If there is an event view visible update the display
2074 mViewManager->currentView()->changeEventDisplay(which,action); 2074 mViewManager->currentView()->changeEventDisplay(which,action);
2075 // TODO: check, if update needed 2075 // TODO: check, if update needed
2076 // if (which->getTodoStatus()) { 2076 // if (which->getTodoStatus()) {
2077 mTodoList->updateView(); 2077 mTodoList->updateView();
2078 // } 2078 // }
2079 } else { 2079 } else {
2080 mViewManager->currentView()->updateView(); 2080 mViewManager->currentView()->updateView();
2081 } 2081 }
2082} 2082}
2083 2083
2084 2084
2085void CalendarView::updateTodoViews() 2085void CalendarView::updateTodoViews()
2086{ 2086{
2087 2087
2088 mTodoList->updateView(); 2088 mTodoList->updateView();
2089 mViewManager->currentView()->updateView(); 2089 mViewManager->currentView()->updateView();
2090 2090
2091} 2091}
2092 2092
2093 2093
2094void CalendarView::updateView(const QDate &start, const QDate &end) 2094void CalendarView::updateView(const QDate &start, const QDate &end)
2095{ 2095{
2096 mTodoList->updateView(); 2096 mTodoList->updateView();
2097 mViewManager->updateView(start, end); 2097 mViewManager->updateView(start, end);
2098 //mDateNavigator->updateView(); 2098 //mDateNavigator->updateView();
2099} 2099}
2100 2100
2101void CalendarView::updateView() 2101void CalendarView::updateView()
2102{ 2102{
2103 DateList tmpList = mNavigator->selectedDates(); 2103 DateList tmpList = mNavigator->selectedDates();
2104 2104
2105 // We assume that the navigator only selects consecutive days. 2105 // We assume that the navigator only selects consecutive days.
2106 updateView( tmpList.first(), tmpList.last() ); 2106 updateView( tmpList.first(), tmpList.last() );
2107} 2107}
2108 2108
2109void CalendarView::updateUnmanagedViews() 2109void CalendarView::updateUnmanagedViews()
2110{ 2110{
2111 mDateNavigator->updateDayMatrix(); 2111 mDateNavigator->updateDayMatrix();
2112} 2112}
2113 2113
2114int CalendarView::msgItemDelete() 2114int CalendarView::msgItemDelete()
2115{ 2115{
2116 return KMessageBox::warningContinueCancel(this, 2116 return KMessageBox::warningContinueCancel(this,
2117 i18n("This item will be\npermanently deleted."), 2117 i18n("This item will be\npermanently deleted."),
2118 i18n("KO/Pi Confirmation"),i18n("Delete")); 2118 i18n("KO/Pi Confirmation"),i18n("Delete"));
2119} 2119}
2120 2120
2121 2121
2122void CalendarView::edit_cut() 2122void CalendarView::edit_cut()
2123{ 2123{
2124 Event *anEvent=0; 2124 Event *anEvent=0;
2125 2125
2126 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2126 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2127 2127
2128 if (mViewManager->currentView()->isEventView()) { 2128 if (mViewManager->currentView()->isEventView()) {
2129 if ( incidence && incidence->type() == "Event" ) { 2129 if ( incidence && incidence->type() == "Event" ) {
2130 anEvent = static_cast<Event *>(incidence); 2130 anEvent = static_cast<Event *>(incidence);
2131 } 2131 }
2132 } 2132 }
2133 2133
2134 if (!anEvent) { 2134 if (!anEvent) {
2135 KNotifyClient::beep(); 2135 KNotifyClient::beep();
2136 return; 2136 return;
2137 } 2137 }
2138 DndFactory factory( mCalendar ); 2138 DndFactory factory( mCalendar );
2139 factory.cutEvent(anEvent); 2139 factory.cutEvent(anEvent);
2140 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2140 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2141} 2141}
2142 2142
2143void CalendarView::edit_copy() 2143void CalendarView::edit_copy()
2144{ 2144{
2145 Event *anEvent=0; 2145 Event *anEvent=0;
2146 2146
2147 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2147 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2148 2148
2149 if (mViewManager->currentView()->isEventView()) { 2149 if (mViewManager->currentView()->isEventView()) {
2150 if ( incidence && incidence->type() == "Event" ) { 2150 if ( incidence && incidence->type() == "Event" ) {
2151 anEvent = static_cast<Event *>(incidence); 2151 anEvent = static_cast<Event *>(incidence);
2152 } 2152 }
2153 } 2153 }
2154 2154
2155 if (!anEvent) { 2155 if (!anEvent) {
2156 KNotifyClient::beep(); 2156 KNotifyClient::beep();
2157 return; 2157 return;
2158 } 2158 }
2159 DndFactory factory( mCalendar ); 2159 DndFactory factory( mCalendar );
2160 factory.copyEvent(anEvent); 2160 factory.copyEvent(anEvent);
2161} 2161}
2162 2162
2163void CalendarView::edit_paste() 2163void CalendarView::edit_paste()
2164{ 2164{
2165 QDate date = mNavigator->selectedDates().first(); 2165 QDate date = mNavigator->selectedDates().first();
2166 2166
2167 DndFactory factory( mCalendar ); 2167 DndFactory factory( mCalendar );
2168 Event *pastedEvent = factory.pasteEvent( date ); 2168 Event *pastedEvent = factory.pasteEvent( date );
2169 2169
2170 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2170 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2171} 2171}
2172 2172
2173void CalendarView::edit_options() 2173void CalendarView::edit_options()
2174{ 2174{
2175 mDialogManager->showOptionsDialog(); 2175 mDialogManager->showOptionsDialog();
2176 //writeSettings(); 2176 //writeSettings();
2177} 2177}
2178 2178
2179void CalendarView::slotSelectPickerDate( QDate d) 2179void CalendarView::slotSelectPickerDate( QDate d)
2180{ 2180{
2181 mDateFrame->hide(); 2181 mDateFrame->hide();
2182 if ( mDatePickerMode == 1 ) { 2182 if ( mDatePickerMode == 1 ) {
2183 mNavigator->slotDaySelect( d ); 2183 mNavigator->slotDaySelect( d );
2184 } else if ( mDatePickerMode == 2 ) { 2184 } else if ( mDatePickerMode == 2 ) {
2185 if ( mMoveIncidence->type() == "Todo" ) { 2185 if ( mMoveIncidence->type() == "Todo" ) {
2186 Todo * to = (Todo *) mMoveIncidence; 2186 Todo * to = (Todo *) mMoveIncidence;
2187 QTime tim; 2187 QTime tim;
2188 if ( to->hasDueDate() ) 2188 if ( to->hasDueDate() )
2189 tim = to->dtDue().time(); 2189 tim = to->dtDue().time();
2190 else { 2190 else {
2191 tim = QTime ( 0,0,0 ); 2191 tim = QTime ( 0,0,0 );
2192 to->setFloats( true ); 2192 to->setFloats( true );
2193 to->setHasDueDate( true ); 2193 to->setHasDueDate( true );
2194 } 2194 }
2195 QDateTime dt ( d,tim ); 2195 QDateTime dt ( d,tim );
2196 to->setDtDue( dt ); 2196 to->setDtDue( dt );
2197 todoChanged( to ); 2197 todoChanged( to );
2198 } else { 2198 } else {
2199 QTime tim = mMoveIncidence->dtStart().time(); 2199 QTime tim = mMoveIncidence->dtStart().time();
2200 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2200 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2201 QDateTime dt ( d,tim ); 2201 QDateTime dt ( d,tim );
2202 mMoveIncidence->setDtStart( dt ); 2202 mMoveIncidence->setDtStart( dt );
2203 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2203 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2204 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2204 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2205 } 2205 }
2206 2206
2207 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2207 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2208 } 2208 }
2209} 2209}
2210 2210
2211void CalendarView::removeCategories() 2211void CalendarView::removeCategories()
2212{ 2212{
2213 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2213 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2214 QStringList catList = KOPrefs::instance()->mCustomCategories; 2214 QStringList catList = KOPrefs::instance()->mCustomCategories;
2215 QStringList catIncList; 2215 QStringList catIncList;
2216 QStringList newCatList; 2216 QStringList newCatList;
2217 Incidence* inc = incList.first(); 2217 Incidence* inc = incList.first();
2218 int i; 2218 int i;
2219 int count = 0; 2219 int count = 0;
2220 while ( inc ) { 2220 while ( inc ) {
2221 newCatList.clear(); 2221 newCatList.clear();
2222 catIncList = inc->categories() ; 2222 catIncList = inc->categories() ;
2223 for( i = 0; i< catIncList.count(); ++i ) { 2223 for( i = 0; i< catIncList.count(); ++i ) {
2224 if ( catList.contains (catIncList[i])) 2224 if ( catList.contains (catIncList[i]))
2225 newCatList.append( catIncList[i] ); 2225 newCatList.append( catIncList[i] );
2226 } 2226 }
2227 newCatList.sort(); 2227 newCatList.sort();
2228 inc->setCategories( newCatList.join(",") ); 2228 inc->setCategories( newCatList.join(",") );
2229 inc = incList.next(); 2229 inc = incList.next();
2230 } 2230 }
2231} 2231}
2232 2232
2233int CalendarView::addCategories() 2233int CalendarView::addCategories()
2234{ 2234{
2235 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2235 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2236 QStringList catList = KOPrefs::instance()->mCustomCategories; 2236 QStringList catList = KOPrefs::instance()->mCustomCategories;
2237 QStringList catIncList; 2237 QStringList catIncList;
2238 Incidence* inc = incList.first(); 2238 Incidence* inc = incList.first();
2239 int i; 2239 int i;
2240 int count = 0; 2240 int count = 0;
2241 while ( inc ) { 2241 while ( inc ) {
2242 catIncList = inc->categories() ; 2242 catIncList = inc->categories() ;
2243 for( i = 0; i< catIncList.count(); ++i ) { 2243 for( i = 0; i< catIncList.count(); ++i ) {
2244 if ( !catList.contains (catIncList[i])) { 2244 if ( !catList.contains (catIncList[i])) {
2245 catList.append( catIncList[i] ); 2245 catList.append( catIncList[i] );
2246 //qDebug("add cat %s ", catIncList[i].latin1()); 2246 //qDebug("add cat %s ", catIncList[i].latin1());
2247 ++count; 2247 ++count;
2248 } 2248 }
2249 } 2249 }
2250 inc = incList.next(); 2250 inc = incList.next();
2251 } 2251 }
2252 catList.sort(); 2252 catList.sort();
2253 KOPrefs::instance()->mCustomCategories = catList; 2253 KOPrefs::instance()->mCustomCategories = catList;
2254 return count; 2254 return count;
2255} 2255}
2256 2256
2257void CalendarView::manageCategories() 2257void CalendarView::manageCategories()
2258{ 2258{
2259 KOCatPrefs* cp = new KOCatPrefs(); 2259 KOCatPrefs* cp = new KOCatPrefs();
2260 cp->show(); 2260 cp->show();
2261 int w =cp->sizeHint().width() ; 2261 int w =cp->sizeHint().width() ;
2262 int h = cp->sizeHint().height() ; 2262 int h = cp->sizeHint().height() ;
2263 int dw = QApplication::desktop()->width(); 2263 int dw = QApplication::desktop()->width();
2264 int dh = QApplication::desktop()->height(); 2264 int dh = QApplication::desktop()->height();
2265 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2265 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2266 if ( !cp->exec() ) { 2266 if ( !cp->exec() ) {
2267 delete cp; 2267 delete cp;
2268 return; 2268 return;
2269 } 2269 }
2270 int count = 0; 2270 int count = 0;
2271 if ( cp->addCat() ) { 2271 if ( cp->addCat() ) {
2272 count = addCategories(); 2272 count = addCategories();
2273 if ( count ) { 2273 if ( count ) {
2274 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2274 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2275 writeSettings(); 2275 writeSettings();
2276 } 2276 }
2277 } else { 2277 } else {
2278 removeCategories(); 2278 removeCategories();
2279 updateView(); 2279 updateView();
2280 } 2280 }
2281 delete cp; 2281 delete cp;
2282} 2282}
2283 2283
2284void CalendarView::beamIncidence(Incidence * Inc) 2284void CalendarView::beamIncidence(Incidence * Inc)
2285{ 2285{
2286 QPtrList<Incidence> delSel ; 2286 QPtrList<Incidence> delSel ;
2287 delSel.append(Inc); 2287 delSel.append(Inc);
2288 beamIncidenceList( delSel ); 2288 beamIncidenceList( delSel );
2289} 2289}
2290void CalendarView::beamCalendar() 2290void CalendarView::beamCalendar()
2291{ 2291{
2292 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2292 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2293 //qDebug("beamCalendar() "); 2293 //qDebug("beamCalendar() ");
2294 beamIncidenceList( delSel ); 2294 beamIncidenceList( delSel );
2295} 2295}
2296void CalendarView::beamFilteredCalendar() 2296void CalendarView::beamFilteredCalendar()
2297{ 2297{
2298 QPtrList<Incidence> delSel = mCalendar->incidences(); 2298 QPtrList<Incidence> delSel = mCalendar->incidences();
2299 //qDebug("beamFilteredCalendar() "); 2299 //qDebug("beamFilteredCalendar() ");
2300 beamIncidenceList( delSel ); 2300 beamIncidenceList( delSel );
2301} 2301}
2302void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2302void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2303{ 2303{
2304 if ( beamDialog->exec () == QDialog::Rejected ) 2304 if ( beamDialog->exec () == QDialog::Rejected )
2305 return; 2305 return;
2306 2306#ifdef DESKTOP_VERSION
2307 QString fn = locateLocal( "tmp", "kopibeamfile" );
2308#else
2307 QString fn = "/tmp/kopibeamfile"; 2309 QString fn = "/tmp/kopibeamfile";
2310#endif
2308 QString mes; 2311 QString mes;
2309 bool createbup = true; 2312 bool createbup = true;
2310 if ( createbup ) { 2313 if ( createbup ) {
2311 QString description = "\n"; 2314 QString description = "\n";
2312 CalendarLocal* cal = new CalendarLocal(); 2315 CalendarLocal* cal = new CalendarLocal();
2313 if ( beamDialog->beamLocal() ) 2316 if ( beamDialog->beamLocal() )
2314 cal->setLocalTime(); 2317 cal->setLocalTime();
2315 else 2318 else
2316 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 2319 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
2317 Incidence *incidence = delSel.first(); 2320 Incidence *incidence = delSel.first();
2318 bool addText = false; 2321 bool addText = false;
2319 if ( delSel.count() < 10 ) 2322 if ( delSel.count() < 10 )
2320 addText = true; 2323 addText = true;
2321 else { 2324 else {
2322 description.sprintf(i18n(" %d items?"),delSel.count() ); 2325 description.sprintf(i18n(" %d items?"),delSel.count() );
2323 } 2326 }
2324 while ( incidence ) { 2327 while ( incidence ) {
2325 Incidence *in = incidence->clone(); 2328 Incidence *in = incidence->clone();
2326 if ( ! in->summary().isEmpty() ) { 2329 if ( ! in->summary().isEmpty() ) {
2327 in->setDescription(""); 2330 in->setDescription("");
2328 } else { 2331 } else {
2329 in->setSummary( in->description().left(20)); 2332 in->setSummary( in->description().left(20));
2330 in->setDescription(""); 2333 in->setDescription("");
2331 } 2334 }
2332 if ( addText ) 2335 if ( addText )
2333 description += in->summary() + "\n"; 2336 description += in->summary() + "\n";
2334 cal->addIncidence( in ); 2337 cal->addIncidence( in );
2335 incidence = delSel.next(); 2338 incidence = delSel.next();
2336 } 2339 }
2337 if ( beamDialog->beamVcal() ) { 2340 if ( beamDialog->beamVcal() ) {
2338 fn += ".vcs"; 2341 fn += ".vcs";
2339 FileStorage storage( cal, fn, new VCalFormat ); 2342 FileStorage storage( cal, fn, new VCalFormat );
2340 storage.save(); 2343 storage.save();
2341 } else { 2344 } else {
2342 fn += ".ics"; 2345 fn += ".ics";
2343 FileStorage storage( cal, fn, new ICalFormat( ) ); 2346 FileStorage storage( cal, fn, new ICalFormat( ) );
2344 storage.save(); 2347 storage.save();
2345 } 2348 }
2346 delete cal; 2349 delete cal;
2347 mes = i18n("KO/Pi: Ready for beaming"); 2350 mes = i18n("KO/Pi: Ready for beaming");
2348 topLevelWidget()->setCaption(mes); 2351 topLevelWidget()->setCaption(mes);
2349 KApplication::convert2latin1( fn ); 2352 KApplication::convert2latin1( fn );
2350#ifndef DESKTOP_VERSION 2353#ifndef DESKTOP_VERSION
2351 Ir *ir = new Ir( this ); 2354 Ir *ir = new Ir( this );
2352 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2355 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2353 ir->send( fn, description, "text/x-vCalendar" ); 2356 ir->send( fn, description, "text/x-vCalendar" );
2354#endif 2357#endif
2355 } 2358 }
2356} 2359}
2357void CalendarView::beamDone( Ir *ir ) 2360void CalendarView::beamDone( Ir *ir )
2358{ 2361{
2359#ifndef DESKTOP_VERSION 2362#ifndef DESKTOP_VERSION
2360 delete ir; 2363 delete ir;
2361#endif 2364#endif
2362 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2365 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2363 topLevelWidget()->raise(); 2366 topLevelWidget()->raise();
2364} 2367}
2365 2368
2366void CalendarView::moveIncidence(Incidence * inc ) 2369void CalendarView::moveIncidence(Incidence * inc )
2367{ 2370{
2368 if ( !inc ) return; 2371 if ( !inc ) return;
2369 // qDebug("showDatePickerForIncidence( ) "); 2372 // qDebug("showDatePickerForIncidence( ) ");
2370 if ( mDateFrame->isVisible() ) 2373 if ( mDateFrame->isVisible() )
2371 mDateFrame->hide(); 2374 mDateFrame->hide();
2372 else { 2375 else {
2373 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2376 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2374 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2377 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2375 int dw = QApplication::desktop()->width(); 2378 int dw = QApplication::desktop()->width();
2376 int dh = QApplication::desktop()->height(); 2379 int dh = QApplication::desktop()->height();
2377 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2380 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2378 mDateFrame->show(); 2381 mDateFrame->show();
2379 } 2382 }
2380 mDatePickerMode = 2; 2383 mDatePickerMode = 2;
2381 mMoveIncidence = inc ; 2384 mMoveIncidence = inc ;
2382 QDate da; 2385 QDate da;
2383 if ( mMoveIncidence->type() == "Todo" ) { 2386 if ( mMoveIncidence->type() == "Todo" ) {
2384 Todo * to = (Todo *) mMoveIncidence; 2387 Todo * to = (Todo *) mMoveIncidence;
2385 if ( to->hasDueDate() ) 2388 if ( to->hasDueDate() )
2386 da = to->dtDue().date(); 2389 da = to->dtDue().date();
2387 else 2390 else
2388 da = QDate::currentDate(); 2391 da = QDate::currentDate();
2389 } else { 2392 } else {
2390 da = mMoveIncidence->dtStart().date(); 2393 da = mMoveIncidence->dtStart().date();
2391 } 2394 }
2392 mDatePicker->setDate( da ); 2395 mDatePicker->setDate( da );
2393} 2396}
2394void CalendarView::showDatePicker( ) 2397void CalendarView::showDatePicker( )
2395{ 2398{
2396 //qDebug("CalendarView::showDatePicker( ) "); 2399 //qDebug("CalendarView::showDatePicker( ) ");
2397 if ( mDateFrame->isVisible() ) 2400 if ( mDateFrame->isVisible() )
2398 mDateFrame->hide(); 2401 mDateFrame->hide();
2399 else { 2402 else {
2400 int w =mDatePicker->sizeHint().width() ; 2403 int w =mDatePicker->sizeHint().width() ;
2401 int h = mDatePicker->sizeHint().height() ; 2404 int h = mDatePicker->sizeHint().height() ;
2402 int dw = QApplication::desktop()->width(); 2405 int dw = QApplication::desktop()->width();
2403 int dh = QApplication::desktop()->height(); 2406 int dh = QApplication::desktop()->height();
2404 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2407 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2405 mDateFrame->show(); 2408 mDateFrame->show();
2406 } 2409 }
2407 mDatePickerMode = 1; 2410 mDatePickerMode = 1;
2408 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2411 mDatePicker->setDate( mNavigator->selectedDates().first() );
2409} 2412}
2410 2413
2411void CalendarView::showEventEditor() 2414void CalendarView::showEventEditor()
2412{ 2415{
2413#ifdef DESKTOP_VERSION 2416#ifdef DESKTOP_VERSION
2414 mEventEditor->show(); 2417 mEventEditor->show();
2415#else 2418#else
2416 mEventEditor->showMaximized(); 2419 mEventEditor->showMaximized();
2417#endif 2420#endif
2418} 2421}
2419void CalendarView::showTodoEditor() 2422void CalendarView::showTodoEditor()
2420{ 2423{
2421#ifdef DESKTOP_VERSION 2424#ifdef DESKTOP_VERSION
2422 mTodoEditor->show(); 2425 mTodoEditor->show();
2423#else 2426#else
2424 mTodoEditor->showMaximized(); 2427 mTodoEditor->showMaximized();
2425#endif 2428#endif
2426} 2429}
2427 2430
2428void CalendarView::cloneIncidence() 2431void CalendarView::cloneIncidence()
2429{ 2432{
2430 Incidence *incidence = currentSelection(); 2433 Incidence *incidence = currentSelection();
2431 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2434 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2432 if ( incidence ) { 2435 if ( incidence ) {
2433 cloneIncidence(incidence); 2436 cloneIncidence(incidence);
2434 } 2437 }
2435} 2438}
2436void CalendarView::moveIncidence() 2439void CalendarView::moveIncidence()
2437{ 2440{
2438 Incidence *incidence = currentSelection(); 2441 Incidence *incidence = currentSelection();
2439 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2442 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2440 if ( incidence ) { 2443 if ( incidence ) {
2441 moveIncidence(incidence); 2444 moveIncidence(incidence);
2442 } 2445 }
2443} 2446}
2444void CalendarView::beamIncidence() 2447void CalendarView::beamIncidence()
2445{ 2448{
2446 Incidence *incidence = currentSelection(); 2449 Incidence *incidence = currentSelection();
2447 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2450 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2448 if ( incidence ) { 2451 if ( incidence ) {
2449 beamIncidence(incidence); 2452 beamIncidence(incidence);
2450 } 2453 }
2451} 2454}
2452void CalendarView::toggleCancelIncidence() 2455void CalendarView::toggleCancelIncidence()
2453{ 2456{
2454 Incidence *incidence = currentSelection(); 2457 Incidence *incidence = currentSelection();
2455 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2458 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2456 if ( incidence ) { 2459 if ( incidence ) {
2457 cancelIncidence(incidence); 2460 cancelIncidence(incidence);
2458 } 2461 }
2459} 2462}
2460 2463
2461 2464
2462void CalendarView::cancelIncidence(Incidence * inc ) 2465void CalendarView::cancelIncidence(Incidence * inc )
2463{ 2466{
2464 inc->setCancelled( ! inc->cancelled() ); 2467 inc->setCancelled( ! inc->cancelled() );
2465 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2468 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2466 updateView(); 2469 updateView();
2467} 2470}
2468void CalendarView::cloneIncidence(Incidence * orgInc ) 2471void CalendarView::cloneIncidence(Incidence * orgInc )
2469{ 2472{
2470 Incidence * newInc = orgInc->clone(); 2473 Incidence * newInc = orgInc->clone();
2471 newInc->recreate(); 2474 newInc->recreate();
2472 2475
2473 if ( newInc->type() == "Todo" ) { 2476 if ( newInc->type() == "Todo" ) {
2474 Todo* t = (Todo*) newInc; 2477 Todo* t = (Todo*) newInc;
2475 mTodoEditor->editTodo( t ); 2478 mTodoEditor->editTodo( t );
2476 showTodoEditor(); 2479 showTodoEditor();
2477 if ( mTodoEditor->exec() ) { 2480 if ( mTodoEditor->exec() ) {
2478 mCalendar->addTodo( t ); 2481 mCalendar->addTodo( t );
2479 updateView(); 2482 updateView();
2480 } else { 2483 } else {
2481 delete t; 2484 delete t;
2482 } 2485 }
2483 } 2486 }
2484 else { 2487 else {
2485 Event* e = (Event*) newInc; 2488 Event* e = (Event*) newInc;
2486 mEventEditor->editEvent( e ); 2489 mEventEditor->editEvent( e );
2487 showEventEditor(); 2490 showEventEditor();
2488 if ( mEventEditor->exec() ) { 2491 if ( mEventEditor->exec() ) {
2489 mCalendar->addEvent( e ); 2492 mCalendar->addEvent( e );
2490 updateView(); 2493 updateView();
2491 } else { 2494 } else {
2492 delete e; 2495 delete e;
2493 } 2496 }
2494 } 2497 }
2495} 2498}
2496 2499
2497void CalendarView::newEvent() 2500void CalendarView::newEvent()
2498{ 2501{
2499 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2502 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2500 KOAgendaView *aView = mViewManager->agendaView(); 2503 KOAgendaView *aView = mViewManager->agendaView();
2501 if (aView) { 2504 if (aView) {
2502 if (aView->selectionStart().isValid()) { 2505 if (aView->selectionStart().isValid()) {
2503 if (aView->selectedIsAllDay()) { 2506 if (aView->selectedIsAllDay()) {
2504 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2507 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2505 } else { 2508 } else {
2506 newEvent(aView->selectionStart(),aView->selectionEnd()); 2509 newEvent(aView->selectionStart(),aView->selectionEnd());
2507 } 2510 }
2508 return; 2511 return;
2509 } 2512 }
2510 } 2513 }
2511 2514
2512 QDate date = mNavigator->selectedDates().first(); 2515 QDate date = mNavigator->selectedDates().first();
2513 QDateTime current = QDateTime::currentDateTime(); 2516 QDateTime current = QDateTime::currentDateTime();
2514 if ( date <= current.date() ) { 2517 if ( date <= current.date() ) {
2515 int hour = current.time().hour() +1; 2518 int hour = current.time().hour() +1;
2516 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2519 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2517 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2520 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2518 } else 2521 } else
2519 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2522 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2520 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2523 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2521 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2524 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2522} 2525}
2523 2526
2524void CalendarView::newEvent(QDateTime fh) 2527void CalendarView::newEvent(QDateTime fh)
2525{ 2528{
2526 newEvent(fh, 2529 newEvent(fh,
2527 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2530 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2528} 2531}
2529 2532
2530void CalendarView::newEvent(QDate dt) 2533void CalendarView::newEvent(QDate dt)
2531{ 2534{
2532 newEvent(QDateTime(dt, QTime(0,0,0)), 2535 newEvent(QDateTime(dt, QTime(0,0,0)),
2533 QDateTime(dt, QTime(0,0,0)), true); 2536 QDateTime(dt, QTime(0,0,0)), true);
2534} 2537}
2535 2538
2536void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2539void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2537{ 2540{
2538 2541
2539 mEventEditor->newEvent(fromHint,toHint,allDay); 2542 mEventEditor->newEvent(fromHint,toHint,allDay);
2540 if ( mFilterView->filtersEnabled() ) { 2543 if ( mFilterView->filtersEnabled() ) {
2541 CalFilter *filter = mFilterView->selectedFilter(); 2544 CalFilter *filter = mFilterView->selectedFilter();
2542 if (filter && filter->showCategories()) { 2545 if (filter && filter->showCategories()) {
2543 mEventEditor->setCategories(filter->categoryList().join(",") ); 2546 mEventEditor->setCategories(filter->categoryList().join(",") );
2544 } 2547 }
2545 if ( filter ) 2548 if ( filter )
2546 mEventEditor->setSecrecy( filter->getSecrecy() ); 2549 mEventEditor->setSecrecy( filter->getSecrecy() );
2547 } 2550 }
2548 showEventEditor(); 2551 showEventEditor();
2549} 2552}
2550void CalendarView::todoAdded(Todo * t) 2553void CalendarView::todoAdded(Todo * t)
2551{ 2554{
2552 2555
2553 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 2556 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
2554 updateTodoViews(); 2557 updateTodoViews();
2555} 2558}
2556void CalendarView::todoChanged(Todo * t) 2559void CalendarView::todoChanged(Todo * t)
2557{ 2560{
2558 emit todoModified( t, 4 ); 2561 emit todoModified( t, 4 );
2559 // updateTodoViews(); 2562 // updateTodoViews();
2560} 2563}
2561void CalendarView::todoToBeDeleted(Todo *) 2564void CalendarView::todoToBeDeleted(Todo *)
2562{ 2565{
2563 //qDebug("todoToBeDeleted(Todo *) "); 2566 //qDebug("todoToBeDeleted(Todo *) ");
2564 updateTodoViews(); 2567 updateTodoViews();
2565} 2568}
2566void CalendarView::todoDeleted() 2569void CalendarView::todoDeleted()
2567{ 2570{
2568 //qDebug(" todoDeleted()"); 2571 //qDebug(" todoDeleted()");
2569 updateTodoViews(); 2572 updateTodoViews();
2570} 2573}
2571 2574
2572 2575
2573 2576
2574void CalendarView::newTodo() 2577void CalendarView::newTodo()
2575{ 2578{
2576 2579
2577 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); 2580 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true);
2578 if ( mFilterView->filtersEnabled() ) { 2581 if ( mFilterView->filtersEnabled() ) {
2579 CalFilter *filter = mFilterView->selectedFilter(); 2582 CalFilter *filter = mFilterView->selectedFilter();
2580 if (filter && filter->showCategories()) { 2583 if (filter && filter->showCategories()) {
2581 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2584 mTodoEditor->setCategories(filter->categoryList().join(",") );
2582 } 2585 }
2583 if ( filter ) 2586 if ( filter )
2584 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2587 mTodoEditor->setSecrecy( filter->getSecrecy() );
2585 } 2588 }
2586 showTodoEditor(); 2589 showTodoEditor();
2587} 2590}
2588 2591
2589void CalendarView::newSubTodo() 2592void CalendarView::newSubTodo()
2590{ 2593{
2591 Todo *todo = selectedTodo(); 2594 Todo *todo = selectedTodo();
2592 if ( todo ) newSubTodo( todo ); 2595 if ( todo ) newSubTodo( todo );
2593} 2596}
2594 2597
2595void CalendarView::newSubTodo(Todo *parentEvent) 2598void CalendarView::newSubTodo(Todo *parentEvent)
2596{ 2599{
2597 2600
2598 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); 2601 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
2599 showTodoEditor(); 2602 showTodoEditor();
2600} 2603}
2601 2604
2602void CalendarView::newFloatingEvent() 2605void CalendarView::newFloatingEvent()
2603{ 2606{
2604 DateList tmpList = mNavigator->selectedDates(); 2607 DateList tmpList = mNavigator->selectedDates();
2605 QDate date = tmpList.first(); 2608 QDate date = tmpList.first();
2606 2609
2607 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 2610 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
2608 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 2611 QDateTime( date, QTime( 12, 0, 0 ) ), true );
2609} 2612}
2610 2613
2611 2614
2612void CalendarView::editEvent( Event *event ) 2615void CalendarView::editEvent( Event *event )
2613{ 2616{
2614 2617
2615 if ( !event ) return; 2618 if ( !event ) return;
2616 if ( event->isReadOnly() ) { 2619 if ( event->isReadOnly() ) {
2617 showEvent( event ); 2620 showEvent( event );
2618 return; 2621 return;
2619 } 2622 }
2620 mEventEditor->editEvent( event , mFlagEditDescription); 2623 mEventEditor->editEvent( event , mFlagEditDescription);
2621 showEventEditor(); 2624 showEventEditor();
2622} 2625}
2623void CalendarView::editJournal( Journal *jour ) 2626void CalendarView::editJournal( Journal *jour )
2624{ 2627{
2625 if ( !jour ) return; 2628 if ( !jour ) return;
2626 mDialogManager->hideSearchDialog(); 2629 mDialogManager->hideSearchDialog();
2627 mViewManager->showJournalView(); 2630 mViewManager->showJournalView();
2628 mNavigator->slotDaySelect( jour->dtStart().date() ); 2631 mNavigator->slotDaySelect( jour->dtStart().date() );
2629} 2632}
2630void CalendarView::editTodo( Todo *todo ) 2633void CalendarView::editTodo( Todo *todo )
2631{ 2634{
2632 if ( !todo ) return; 2635 if ( !todo ) return;
2633 2636
2634 if ( todo->isReadOnly() ) { 2637 if ( todo->isReadOnly() ) {
2635 showTodo( todo ); 2638 showTodo( todo );
2636 return; 2639 return;
2637 } 2640 }
2638 mTodoEditor->editTodo( todo ,mFlagEditDescription); 2641 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2639 showTodoEditor(); 2642 showTodoEditor();
2640 2643
2641} 2644}
2642 2645
2643KOEventViewerDialog* CalendarView::getEventViewerDialog() 2646KOEventViewerDialog* CalendarView::getEventViewerDialog()
2644{ 2647{
2645 if ( !mEventViewerDialog ) { 2648 if ( !mEventViewerDialog ) {
2646 mEventViewerDialog = new KOEventViewerDialog(this); 2649 mEventViewerDialog = new KOEventViewerDialog(this);
2647 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2650 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
2648 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 2651 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
2649 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 2652 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
2650 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 2653 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
2651 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 2654 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
2652 viewManager(), SLOT( showAgendaView( bool ) ) ); 2655 viewManager(), SLOT( showAgendaView( bool ) ) );
2653 mEventViewerDialog->resize( 640, 480 ); 2656 mEventViewerDialog->resize( 640, 480 );
2654 2657
2655 } 2658 }
2656 return mEventViewerDialog; 2659 return mEventViewerDialog;
2657} 2660}
2658void CalendarView::showEvent(Event *event) 2661void CalendarView::showEvent(Event *event)
2659{ 2662{
2660 getEventViewerDialog()->setEvent(event); 2663 getEventViewerDialog()->setEvent(event);
2661 getEventViewerDialog()->showMe(); 2664 getEventViewerDialog()->showMe();
2662} 2665}
2663 2666
2664void CalendarView::showTodo(Todo *event) 2667void CalendarView::showTodo(Todo *event)
2665{ 2668{
2666 getEventViewerDialog()->setTodo(event); 2669 getEventViewerDialog()->setTodo(event);
2667 getEventViewerDialog()->showMe(); 2670 getEventViewerDialog()->showMe();
2668} 2671}
2669void CalendarView::showJournal( Journal *jour ) 2672void CalendarView::showJournal( Journal *jour )
2670{ 2673{
2671 getEventViewerDialog()->setJournal(jour); 2674 getEventViewerDialog()->setJournal(jour);
2672 getEventViewerDialog()->showMe(); 2675 getEventViewerDialog()->showMe();
2673 2676
2674} 2677}
2675// void CalendarView::todoModified (Todo *event, int changed) 2678// void CalendarView::todoModified (Todo *event, int changed)
2676// { 2679// {
2677// // if (mDialogList.find (event) != mDialogList.end ()) { 2680// // if (mDialogList.find (event) != mDialogList.end ()) {
2678// // kdDebug() << "Todo modified and open" << endl; 2681// // kdDebug() << "Todo modified and open" << endl;
2679// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 2682// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
2680// // temp->modified (changed); 2683// // temp->modified (changed);
2681 2684
2682// // } 2685// // }
2683 2686
2684// mViewManager->updateView(); 2687// mViewManager->updateView();
2685// } 2688// }
2686 2689
2687void CalendarView::appointment_show() 2690void CalendarView::appointment_show()
2688{ 2691{
2689 Event *anEvent = 0; 2692 Event *anEvent = 0;
2690 2693
2691 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2694 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 651442b..258f738 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,572 +1,566 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <kemailsettings.h> 42#include <kemailsettings.h>
43#include <kstaticdeleter.h> 43#include <kstaticdeleter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "koprefs.h" 46#include "koprefs.h"
47#include "mainwindow.h" 47#include "mainwindow.h"
48 48
49const char *germanwords[][2] = { 49const char *germanwords[][2] = {
50#include "wordsgerman.h" 50#include "wordsgerman.h"
51 "", "" 51 "", ""
52}; 52};
53 53
54KOPrefs *KOPrefs::mInstance = 0; 54KOPrefs *KOPrefs::mInstance = 0;
55static KStaticDeleter<KOPrefs> insd; 55static KStaticDeleter<KOPrefs> insd;
56 56
57KOPrefs::KOPrefs() : 57KOPrefs::KOPrefs() :
58 KPimPrefs("korganizerrc") 58 KPimPrefs("korganizerrc")
59{ 59{
60 mCategoryColors.setAutoDelete(true); 60 mCategoryColors.setAutoDelete(true);
61 mLocaleDict = 0; 61 mLocaleDict = 0;
62 fillMailDefaults(); 62 fillMailDefaults();
63 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 63 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
64 QColor defaultHolidayColor = QColor(255,0,0); 64 QColor defaultHolidayColor = QColor(255,0,0);
65 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 65 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
66 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 66 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
67 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 67 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
68 QColor defaultTodoDueTodayColor = QColor(255,220,100); 68 QColor defaultTodoDueTodayColor = QColor(255,220,100);
69 QColor defaultTodoOverdueColor = QColor(255,153,125); 69 QColor defaultTodoOverdueColor = QColor(255,153,125);
70 70
71 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); 71 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
72 mDefaultViewFont = QFont("helvetica",10); 72 mDefaultViewFont = QFont("helvetica",10);
73 mDefaultMonthViewFont = QFont("helvetica",8); 73 mDefaultMonthViewFont = QFont("helvetica",8);
74 mMarcusBainsFont= QFont("helvetica",10); 74 mMarcusBainsFont= QFont("helvetica",10);
75 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); 75 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold);
76 mEditBoxFont = QFont("helvetica",12); 76 mEditBoxFont = QFont("helvetica",12);
77 mJornalViewFont = QFont("helvetica",12); 77 mJornalViewFont = QFont("helvetica",12);
78 78
79 KPrefs::setCurrentGroup("General"); 79 KPrefs::setCurrentGroup("General");
80 80
81 81
82 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 82 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
83 83
84 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 84 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
85 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 85 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
86 addItemBool("ShowIconSearch",&mShowIconSearch,true); 86 addItemBool("ShowIconSearch",&mShowIconSearch,true);
87 addItemBool("ShowIconList",&mShowIconList,true); 87 addItemBool("ShowIconList",&mShowIconList,true);
88 addItemBool("ShowIconDay1",&mShowIconDay1,true); 88 addItemBool("ShowIconDay1",&mShowIconDay1,true);
89 addItemBool("ShowIconDay5",&mShowIconDay5,true); 89 addItemBool("ShowIconDay5",&mShowIconDay5,true);
90 addItemBool("ShowIconDay7",&mShowIconDay7,true); 90 addItemBool("ShowIconDay7",&mShowIconDay7,true);
91 addItemBool("ShowIconMonth",&mShowIconMonth,true); 91 addItemBool("ShowIconMonth",&mShowIconMonth,true);
92 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 92 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
93 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 93 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
94 addItemBool("ShowIconBack",&mShowIconBack,true); 94 addItemBool("ShowIconBack",&mShowIconBack,true);
95 addItemBool("ShowIconToday",&mShowIconToday,true); 95 addItemBool("ShowIconToday",&mShowIconToday,true);
96 addItemBool("ShowIconForward",&mShowIconForward,true); 96 addItemBool("ShowIconForward",&mShowIconForward,true);
97 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 97 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
98 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); 98 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
99 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 99 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
100 addItemBool("ShowIconNext",&mShowIconNext,true); 100 addItemBool("ShowIconNext",&mShowIconNext,true);
101 addItemBool("ShowIconJournal",&mShowIconJournal,true); 101 addItemBool("ShowIconJournal",&mShowIconJournal,true);
102 addItemBool("ShowIconStretch",&mShowIconStretch,true); 102 addItemBool("ShowIconStretch",&mShowIconStretch,true);
103 addItemBool("LanguageChanged",&mLanguageChanged,false); 103 addItemBool("LanguageChanged",&mLanguageChanged,false);
104 104
105 addItemBool("AskForQuit",&mAskForQuit,false); 105 addItemBool("AskForQuit",&mAskForQuit,false);
106 106
107#ifndef DESKTOP_VERSION 107#ifndef DESKTOP_VERSION
108 addItemBool("ShowFullMenu",&mShowFullMenu,false); 108 addItemBool("ShowFullMenu",&mShowFullMenu,false);
109#else 109#else
110 addItemBool("ShowFullMenu",&mShowFullMenu,true); 110 addItemBool("ShowFullMenu",&mShowFullMenu,true);
111#endif 111#endif
112 addItemBool("ToolBarHor",&mToolBarHor, true ); 112 addItemBool("ToolBarHor",&mToolBarHor, true );
113 addItemBool("ToolBarUp",&mToolBarUp, false ); 113 addItemBool("ToolBarUp",&mToolBarUp, false );
114 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 114 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
115 addItemInt("Whats Next Days",&mWhatsNextDays,3); 115 addItemInt("Whats Next Days",&mWhatsNextDays,3);
116 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 116 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
117 117
118 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 118 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
119 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 119 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
120 addItemInt("AllDay Size",&mAllDaySize,28); 120 addItemInt("AllDay Size",&mAllDaySize,28);
121 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 121 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
122 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 122 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
123 123
124 addItemStringList("LocationDefaults",&mLocationDefaults ); 124 addItemStringList("LocationDefaults",&mLocationDefaults );
125 addItemStringList("EventSummary User",&mEventSummaryUser); 125 addItemStringList("EventSummary User",&mEventSummaryUser);
126 addItemStringList("TodoSummary User",&mTodoSummaryUser); 126 addItemStringList("TodoSummary User",&mTodoSummaryUser);
127 127
128 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 128 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
129 addItemBool("Enable Project View",&mEnableProjectView,false); 129 addItemBool("Enable Project View",&mEnableProjectView,false);
130 addItemBool("Auto Save",&mAutoSave,false); 130 addItemBool("Auto Save",&mAutoSave,false);
131 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 131 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
132 addItemBool("Confirm Deletes",&mConfirm,true); 132 addItemBool("Confirm Deletes",&mConfirm,true);
133 addItemString("Archive File",&mArchiveFile); 133 addItemString("Archive File",&mArchiveFile);
134 addItemString("Html Export File",&mHtmlExportFile, 134 addItemString("Html Export File",&mHtmlExportFile,
135 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 135 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
136 addItemBool("Html With Save",&mHtmlWithSave,false); 136 addItemBool("Html With Save",&mHtmlWithSave,false);
137 137
138 KPrefs::setCurrentGroup("Personal Settings"); 138 KPrefs::setCurrentGroup("Personal Settings");
139 139
140 addItemInt("Mail Client",&mMailClient,MailClientKMail); 140 addItemInt("Mail Client",&mMailClient,MailClientKMail);
141 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 141 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
142 addItemBool("Bcc",&mBcc,false); 142 addItemBool("Bcc",&mBcc,false);
143 143
144 KPrefs::setCurrentGroup("Time & Date"); 144 KPrefs::setCurrentGroup("Time & Date");
145 145
146 // addItemString("Time Zone",&mTimeZone,"+0100"); 146 // addItemString("Time Zone",&mTimeZone,"+0100");
147 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); 147 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
148 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); 148 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60);
149 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 149 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
150 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 150 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
151 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 151 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
152 152
153 153
154 addItemInt("Default Start Time",&mStartTime,10); 154 addItemInt("Default Start Time",&mStartTime,10);
155 addItemInt("Default Duration",&mDefaultDuration,2); 155 addItemInt("Default Duration",&mDefaultDuration,2);
156 addItemInt("Default Alarm Time",&mAlarmTime,3); 156 addItemInt("Default Alarm Time",&mAlarmTime,3);
157 addItemInt("Daylight Savings",&mDaylightSavings,0); 157 addItemInt("Daylight Savings",&mDaylightSavings,0);
158 KPrefs::setCurrentGroup("AlarmSettings"); 158 KPrefs::setCurrentGroup("AlarmSettings");
159 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 159 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
160 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 160 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
161 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 161 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
162 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 162 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
163 163
164 164
165 KPrefs::setCurrentGroup("Calendar"); 165 KPrefs::setCurrentGroup("Calendar");
166 166
167 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 167 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
168 168
169 KPrefs::setCurrentGroup("Fonts"); 169 KPrefs::setCurrentGroup("Fonts");
170 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 170 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
171 addItemFont("TimeBar Font",&mTimeBarFont); 171 addItemFont("TimeBar Font",&mTimeBarFont);
172 addItemFont("MonthView Font",&mMonthViewFont); 172 addItemFont("MonthView Font",&mMonthViewFont);
173 addItemFont("AgendaView Font",&mAgendaViewFont); 173 addItemFont("AgendaView Font",&mAgendaViewFont);
174 addItemFont("MarcusBains Font",&mMarcusBainsFont); 174 addItemFont("MarcusBains Font",&mMarcusBainsFont);
175 addItemFont("TimeLabels Font",&mTimeLabelsFont); 175 addItemFont("TimeLabels Font",&mTimeLabelsFont);
176 addItemFont("TodoView Font",&mTodoViewFont); 176 addItemFont("TodoView Font",&mTodoViewFont);
177 addItemFont("ListView Font",&mListViewFont); 177 addItemFont("ListView Font",&mListViewFont);
178 addItemFont("DateNavigator Font",&mDateNavigatorFont); 178 addItemFont("DateNavigator Font",&mDateNavigatorFont);
179 addItemFont("EditBox Font",&mEditBoxFont); 179 addItemFont("EditBox Font",&mEditBoxFont);
180 addItemFont("JournalView Font",&mJornalViewFont); 180 addItemFont("JournalView Font",&mJornalViewFont);
181 addItemFont("WhatsNextView Font",&mWhatsNextFont); 181 addItemFont("WhatsNextView Font",&mWhatsNextFont);
182 addItemFont("EventView Font",&mEventViewFont); 182 addItemFont("EventView Font",&mEventViewFont);
183 183
184// KPrefs::setCurrentGroup("SyncProfiles"); 184// KPrefs::setCurrentGroup("SyncProfiles");
185// addItemString("LocalMachineName",&mLocalMachineName, "undefined"); 185// addItemString("LocalMachineName",&mLocalMachineName, "undefined");
186// addItemStringList("SyncProfileNames",&mSyncProfileNames); 186// addItemStringList("SyncProfileNames",&mSyncProfileNames);
187// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); 187// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames);
188 188
189 KPrefs::setCurrentGroup("RemoteSyncing"); 189 KPrefs::setCurrentGroup("RemoteSyncing");
190// addItemBool("UsePasswd",&mUsePassWd,false); 190// addItemBool("UsePasswd",&mUsePassWd,false);
191// addItemBool("WriteBackFile",&mWriteBackFile,true); 191// addItemBool("WriteBackFile",&mWriteBackFile,true);
192// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); 192// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
193// addItemBool("AskForPreferences",&mAskForPreferences,true); 193// addItemBool("AskForPreferences",&mAskForPreferences,true);
194// addItemBool("ShowSyncSummary",&mShowSyncSummary,true); 194// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
195 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 195 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
196 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 196 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
197 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 197 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
198 addItemInt("LastSyncTime",&mLastSyncTime,0); 198 addItemInt("LastSyncTime",&mLastSyncTime,0);
199 199
200#ifdef _WIN32_ 200#ifdef _WIN32_
201 QString hdp= locateLocal("data","korganizer")+"\\\\"; 201 QString hdp= locateLocal("data","korganizer")+"\\\\";
202#else 202#else
203 QString hdp= locateLocal("data","korganizer")+"/"; 203 QString hdp= locateLocal("data","korganizer")+"/";
204#endif 204#endif
205// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65");
206// addItemString("RemoteUser",&mRemoteUser, "zaurus");
207// addItemString("RemotePassWd",&mRemotePassWd, "");
208// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics");
209// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" );
210
211 205
212 KPrefs::setCurrentGroup("LoadSaveFileNames"); 206 KPrefs::setCurrentGroup("LoadSaveFileNames");
213 207
214 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 208 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
215 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 209 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
216 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 210 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
217 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 211 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
218 212
219 213
220 KPrefs::setCurrentGroup("Locale"); 214 KPrefs::setCurrentGroup("Locale");
221 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 215 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
222 addItemInt("PreferredTime",&mPreferredTime,0); 216 addItemInt("PreferredTime",&mPreferredTime,0);
223 addItemInt("PreferredDate",&mPreferredDate,0); 217 addItemInt("PreferredDate",&mPreferredDate,0);
224 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 218 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
225 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 219 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
226 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 220 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
227 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 221 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
228 222
229 223
230 KPrefs::setCurrentGroup("Colors"); 224 KPrefs::setCurrentGroup("Colors");
231 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 225 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
232 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 226 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
233 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 227 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
234 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 228 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
235 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 229 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
236 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 230 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
237 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 231 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
238 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 232 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
239 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 233 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
240 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 234 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
241 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 235 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
242 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 236 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
243 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 237 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
244 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 238 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
245 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 239 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
246 addItemBool("UseAppColors",&mUseAppColors,false); 240 addItemBool("UseAppColors",&mUseAppColors,false);
247 241
248 242
249 243
250 KPrefs::setCurrentGroup("Views"); 244 KPrefs::setCurrentGroup("Views");
251 addItemInt("Hour Size",&mHourSize,8); 245 addItemInt("Hour Size",&mHourSize,8);
252 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 246 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
253 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 247 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
254 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 248 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
255 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 249 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
256 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 250 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
257 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 251 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
258 addItemBool("Enable ToolTips",&mEnableToolTips,false); 252 addItemBool("Enable ToolTips",&mEnableToolTips,false);
259 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 253 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
260 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 254 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
261 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 255 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
262 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 256 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
263 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); 257 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false);
264 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 258 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
265 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 259 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
266 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 260 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
267 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 261 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
268 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); 262 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);
269 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 263 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
270 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 264 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
271 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 265 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
272 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 266 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
273 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 267 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
274 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); 268 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false);
275 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 269 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
276 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 270 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
277#ifdef DESKTOP_VERSION 271#ifdef DESKTOP_VERSION
278 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 272 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
279#else 273#else
280 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 274 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
281#endif 275#endif
282 addItemInt("Day Begins",&mDayBegins,7); 276 addItemInt("Day Begins",&mDayBegins,7);
283 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 277 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
284 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 278 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
285 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 279 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
286 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 280 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
287 281
288 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 282 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
289 addItemBool("Full View Month",&mFullViewMonth,true); 283 addItemBool("Full View Month",&mFullViewMonth,true);
290 addItemBool("Full View Todo",&mFullViewTodo,true); 284 addItemBool("Full View Todo",&mFullViewTodo,true);
291 addItemBool("Quick Todo",&mEnableQuickTodo,false); 285 addItemBool("Quick Todo",&mEnableQuickTodo,false);
292 286
293 addItemInt("Next X Days",&mNextXDays,3); 287 addItemInt("Next X Days",&mNextXDays,3);
294 288
295 KPrefs::setCurrentGroup("Printer"); 289 KPrefs::setCurrentGroup("Printer");
296 290
297 KPrefs::setCurrentGroup("Layout"); 291 KPrefs::setCurrentGroup("Layout");
298 292
299 addItemBool("CompactDialogs",&mCompactDialogs,false); 293 addItemBool("CompactDialogs",&mCompactDialogs,false);
300 addItemBool("VerticalScreen",&mVerticalScreen,true); 294 addItemBool("VerticalScreen",&mVerticalScreen,true);
301 295
302 KPrefs::setCurrentGroup("KOrganizer Plugins"); 296 KPrefs::setCurrentGroup("KOrganizer Plugins");
303 297
304 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 298 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
305 299
306 KPrefs::setCurrentGroup("Group Scheduling"); 300 KPrefs::setCurrentGroup("Group Scheduling");
307 301
308 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 302 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
309 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 303 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
310 addItemStringList("AdditionalMails",&mAdditionalMails,""); 304 addItemStringList("AdditionalMails",&mAdditionalMails,"");
311 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 305 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
312 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 306 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
313 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 307 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
314 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 308 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
315 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 309 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
316 310
317 KPrefs::setCurrentGroup( "Editors" ); 311 KPrefs::setCurrentGroup( "Editors" );
318 312
319 addItemStringList( "EventTemplates", &mEventTemplates ); 313 addItemStringList( "EventTemplates", &mEventTemplates );
320 addItemStringList( "TodoTemplates", &mTodoTemplates ); 314 addItemStringList( "TodoTemplates", &mTodoTemplates );
321 315
322 addItemInt("DestinationPolicy",&mDestination,standardDestination); 316 addItemInt("DestinationPolicy",&mDestination,standardDestination);
323 317
324 318
325 319
326} 320}
327 321
328 322
329KOPrefs::~KOPrefs() 323KOPrefs::~KOPrefs()
330{ 324{
331 if (mInstance == this) 325 if (mInstance == this)
332 mInstance = insd.setObject(0); 326 mInstance = insd.setObject(0);
333 setLocaleDict( 0 ); 327 setLocaleDict( 0 );
334 if ( mLocaleDict ) 328 if ( mLocaleDict )
335 delete mLocaleDict; 329 delete mLocaleDict;
336 //qDebug("KOPrefs::~KOPrefs() "); 330 //qDebug("KOPrefs::~KOPrefs() ");
337} 331}
338 332
339 333
340KOPrefs *KOPrefs::instance() 334KOPrefs *KOPrefs::instance()
341{ 335{
342 if (!mInstance) { 336 if (!mInstance) {
343 mInstance = insd.setObject(new KOPrefs()); 337 mInstance = insd.setObject(new KOPrefs());
344 mInstance->readConfig(); 338 mInstance->readConfig();
345 } 339 }
346 340
347 return mInstance; 341 return mInstance;
348} 342}
349 343
350void KOPrefs::usrSetDefaults() 344void KOPrefs::usrSetDefaults()
351{ 345{
352 346
353} 347}
354 348
355void KOPrefs::fillMailDefaults() 349void KOPrefs::fillMailDefaults()
356{ 350{
357 if (mName.isEmpty()) mName = i18n("Anonymous"); 351 if (mName.isEmpty()) mName = i18n("Anonymous");
358 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 352 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
359} 353}
360 354
361void KOPrefs::setTimeZoneIdDefault() 355void KOPrefs::setTimeZoneIdDefault()
362{ 356{
363 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); 357 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)");
364} 358}
365 359
366void KOPrefs::setCategoryDefaults() 360void KOPrefs::setCategoryDefaults()
367{ 361{
368 mCustomCategories.clear(); 362 mCustomCategories.clear();
369 mCustomCategories = getDefaultList(); 363 mCustomCategories = getDefaultList();
370 364
371 QStringList::Iterator it; 365 QStringList::Iterator it;
372 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 366 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
373 setCategoryColor(*it,mDefaultCategoryColor); 367 setCategoryColor(*it,mDefaultCategoryColor);
374 } 368 }
375} 369}
376 370
377QStringList KOPrefs::getDefaultList() 371QStringList KOPrefs::getDefaultList()
378{ 372{
379 QStringList retval ; 373 QStringList retval ;
380 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") 374 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
381 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") 375 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
382 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 376 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
383 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") 377 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
384 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") 378 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
385 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") 379 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
386 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") 380 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
387 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 381 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
388 retval.sort(); 382 retval.sort();
389 return retval; 383 return retval;
390} 384}
391 385
392void KOPrefs::usrReadConfig() 386void KOPrefs::usrReadConfig()
393{ 387{
394 mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; 388 mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
395 mLocaleDict = 0; 389 mLocaleDict = 0;
396 // pending LR fix translation 390 // pending LR fix translation
397 // qDebug("KOPrefs::usrReadConfig() fix translation "); 391 // qDebug("KOPrefs::usrReadConfig() fix translation ");
398 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { 392 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
399 if ( mPreferredLanguage == 1 ) { 393 if ( mPreferredLanguage == 1 ) {
400 mLocaleDict = new QDict<QString>; 394 mLocaleDict = new QDict<QString>;
401 int i = 0; 395 int i = 0;
402 QString fw ( germanwords[i] [0]); 396 QString fw ( germanwords[i] [0]);
403 while ( !fw.isEmpty() ) { 397 while ( !fw.isEmpty() ) {
404 mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); 398 mLocaleDict->insert( fw, new QString (germanwords[i] [1] ));
405 ++i; 399 ++i;
406 fw = germanwords[i] [0]; 400 fw = germanwords[i] [0];
407 } 401 }
408 402
409 setLocaleDict( mLocaleDict ); 403 setLocaleDict( mLocaleDict );
410 } else { 404 } else {
411 QString fileName ; 405 QString fileName ;
412 if ( mPreferredLanguage == 4 ) 406 if ( mPreferredLanguage == 4 )
413 fileName = MainWindow::resourcePath()+"usertranslation.txt"; 407 fileName = MainWindow::resourcePath()+"usertranslation.txt";
414 else if ( mPreferredLanguage == 2 ) 408 else if ( mPreferredLanguage == 2 )
415 fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; 409 fileName = MainWindow::resourcePath()+"frenchtranslation.txt";
416 else if ( mPreferredLanguage == 3 ) 410 else if ( mPreferredLanguage == 3 )
417 fileName = MainWindow::resourcePath()+"italiantranslation.txt"; 411 fileName = MainWindow::resourcePath()+"italiantranslation.txt";
418 QFile file( fileName ); 412 QFile file( fileName );
419 if (file.open( IO_ReadOnly ) ) { 413 if (file.open( IO_ReadOnly ) ) {
420 QTextStream ts( &file ); 414 QTextStream ts( &file );
421 ts.setEncoding( QTextStream::Latin1 ); 415 ts.setEncoding( QTextStream::Latin1 );
422 //ts.setCodec( QTextCodec::latin1 ); 416 //ts.setCodec( QTextCodec::latin1 );
423 QString text = ts.read(); 417 QString text = ts.read();
424 file.close(); 418 file.close();
425 text.replace( QRegExp("\\\\n"), "\n" ); 419 text.replace( QRegExp("\\\\n"), "\n" );
426 QString line; 420 QString line;
427 QString we; 421 QString we;
428 QString wt; 422 QString wt;
429 int br = 0; 423 int br = 0;
430 int nbr; 424 int nbr;
431 nbr = text.find ( "},", br ); 425 nbr = text.find ( "},", br );
432 line = text.mid( br, nbr - br ); 426 line = text.mid( br, nbr - br );
433 br = nbr+1; 427 br = nbr+1;
434 int se, ee, st, et; 428 int se, ee, st, et;
435 mLocaleDict = new QDict<QString>; 429 mLocaleDict = new QDict<QString>;
436 QString end = "{ \"\",\"\" }"; 430 QString end = "{ \"\",\"\" }";
437 while ( (line != end) && (br > 1) ) { 431 while ( (line != end) && (br > 1) ) {
438 //qDebug("%d *%s* ", br, line.latin1()); 432 //qDebug("%d *%s* ", br, line.latin1());
439 se = line.find("\"")+1; 433 se = line.find("\"")+1;
440 et = line.findRev("\"",-1); 434 et = line.findRev("\"",-1);
441 ee = line.find("\",\""); 435 ee = line.find("\",\"");
442 st = ee+3; 436 st = ee+3;
443 we = line.mid( se, ee-se ); 437 we = line.mid( se, ee-se );
444 wt = line.mid( st, et-st ); 438 wt = line.mid( st, et-st );
445 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); 439 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
446 mLocaleDict->insert( we, new QString (wt) ); 440 mLocaleDict->insert( we, new QString (wt) );
447 nbr = text.find ( "}", br ); 441 nbr = text.find ( "}", br );
448 line = text.mid( br, nbr - br ); 442 line = text.mid( br, nbr - br );
449 br = nbr+1; 443 br = nbr+1;
450 } 444 }
451 //qDebug("end *%s* ", end.latin1()); 445 //qDebug("end *%s* ", end.latin1());
452 446
453 setLocaleDict( mLocaleDict ); 447 setLocaleDict( mLocaleDict );
454 } else { 448 } else {
455 qDebug("KO: Cannot find translation file %s",fileName.latin1() ); 449 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
456 } 450 }
457 451
458 } 452 }
459 } 453 }
460 config()->setGroup("General"); 454 config()->setGroup("General");
461 455
462 mCustomCategories = config()->readListEntry("Custom Categories"); 456 mCustomCategories = config()->readListEntry("Custom Categories");
463 if ( KOPrefs::instance()->mLanguageChanged ) { 457 if ( KOPrefs::instance()->mLanguageChanged ) {
464 mLocationDefaults.clear(); 458 mLocationDefaults.clear();
465 mEventSummaryUser.clear(); 459 mEventSummaryUser.clear();
466 mTodoSummaryUser.clear(); 460 mTodoSummaryUser.clear();
467 } 461 }
468 if (mLocationDefaults.isEmpty()) { 462 if (mLocationDefaults.isEmpty()) {
469 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 463 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
470 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 464 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
471 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 465 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
472 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 466 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
473 mLocationDefaults.sort(); 467 mLocationDefaults.sort();
474 } 468 }
475 469
476 if (mEventSummaryUser.isEmpty()) { 470 if (mEventSummaryUser.isEmpty()) {
477 mEventSummaryUser = getDefaultList() ; 471 mEventSummaryUser = getDefaultList() ;
478 } 472 }
479 if (mTodoSummaryUser.isEmpty()) { 473 if (mTodoSummaryUser.isEmpty()) {
480 mTodoSummaryUser = getDefaultList() ; 474 mTodoSummaryUser = getDefaultList() ;
481 } 475 }
482 476
483 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 477 if (mCustomCategories.isEmpty()) setCategoryDefaults();
484 478
485 config()->setGroup("Personal Settings"); 479 config()->setGroup("Personal Settings");
486 mName = config()->readEntry("user_name",""); 480 mName = config()->readEntry("user_name","");
487 mEmail = config()->readEntry("user_email",""); 481 mEmail = config()->readEntry("user_email","");
488 fillMailDefaults(); 482 fillMailDefaults();
489 483
490 config()->setGroup("Category Colors"); 484 config()->setGroup("Category Colors");
491 QStringList::Iterator it; 485 QStringList::Iterator it;
492 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 486 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
493 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 487 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
494 488
495 } 489 }
496 490
497 if (mTimeZoneId.isEmpty()) { 491 if (mTimeZoneId.isEmpty()) {
498 setTimeZoneIdDefault(); 492 setTimeZoneIdDefault();
499 } 493 }
500 KPimPrefs::usrReadConfig(); 494 KPimPrefs::usrReadConfig();
501} 495}
502 496
503 497
504void KOPrefs::usrWriteConfig() 498void KOPrefs::usrWriteConfig()
505{ 499{
506 config()->setGroup("General"); 500 config()->setGroup("General");
507 config()->writeEntry("Custom Categories",mCustomCategories); 501 config()->writeEntry("Custom Categories",mCustomCategories);
508 502
509 config()->setGroup("Personal Settings"); 503 config()->setGroup("Personal Settings");
510 config()->writeEntry("user_name",mName); 504 config()->writeEntry("user_name",mName);
511 config()->writeEntry("user_email",mEmail); 505 config()->writeEntry("user_email",mEmail);
512 506
513 config()->setGroup("Category Colors"); 507 config()->setGroup("Category Colors");
514 QDictIterator<QColor> it(mCategoryColors); 508 QDictIterator<QColor> it(mCategoryColors);
515 while (it.current()) { 509 while (it.current()) {
516 config()->writeEntry(it.currentKey(),*(it.current())); 510 config()->writeEntry(it.currentKey(),*(it.current()));
517 ++it; 511 ++it;
518 } 512 }
519 513
520 514
521 KPimPrefs::usrWriteConfig(); 515 KPimPrefs::usrWriteConfig();
522} 516}
523 517
524void KOPrefs::setCategoryColor(QString cat,const QColor & color) 518void KOPrefs::setCategoryColor(QString cat,const QColor & color)
525{ 519{
526 mCategoryColors.replace(cat,new QColor(color)); 520 mCategoryColors.replace(cat,new QColor(color));
527} 521}
528 522
529QColor *KOPrefs::categoryColor(QString cat) 523QColor *KOPrefs::categoryColor(QString cat)
530{ 524{
531 QColor *color = 0; 525 QColor *color = 0;
532 526
533 if (!cat.isEmpty()) color = mCategoryColors[cat]; 527 if (!cat.isEmpty()) color = mCategoryColors[cat];
534 528
535 if (color) return color; 529 if (color) return color;
536 else return &mDefaultCategoryColor; 530 else return &mDefaultCategoryColor;
537} 531}
538 532
539void KOPrefs::setFullName(const QString &name) 533void KOPrefs::setFullName(const QString &name)
540{ 534{
541 mName = name; 535 mName = name;
542} 536}
543 537
544void KOPrefs::setEmail(const QString &email) 538void KOPrefs::setEmail(const QString &email)
545{ 539{
546 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 540 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
547 mEmail = email; 541 mEmail = email;
548} 542}
549 543
550QString KOPrefs::fullName() 544QString KOPrefs::fullName()
551{ 545{
552 if (mEmailControlCenter) { 546 if (mEmailControlCenter) {
553 KEMailSettings settings; 547 KEMailSettings settings;
554 return settings.getSetting(KEMailSettings::RealName); 548 return settings.getSetting(KEMailSettings::RealName);
555 } else { 549 } else {
556 return mName; 550 return mName;
557 } 551 }
558} 552}
559 553
560QString KOPrefs::email() 554QString KOPrefs::email()
561{ 555{
562 if (mEmailControlCenter) { 556 if (mEmailControlCenter) {
563 KEMailSettings settings; 557 KEMailSettings settings;
564 return settings.getSetting(KEMailSettings::EmailAddress); 558 return settings.getSetting(KEMailSettings::EmailAddress);
565 } else { 559 } else {
566 return mEmail; 560 return mEmail;
567 } 561 }
568} 562}
569KConfig* KOPrefs::getConfig() 563KConfig* KOPrefs::getConfig()
570{ 564{
571 return config(); 565 return config();
572} 566}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 06470b8..c3e9f75 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -833,772 +833,772 @@ void MainWindow::initActions()
833 833
834 // ****************************************************** 834 // ******************************************************
835 // menubar icons 835 // menubar icons
836 836
837 837
838 iconToolBar->setHorizontalStretchable (true ); 838 iconToolBar->setHorizontalStretchable (true );
839 //menuBar->insertItem( iconToolBar ); 839 //menuBar->insertItem( iconToolBar );
840 //xdays_action 840 //xdays_action
841 if (p-> mShowIconNewEvent) 841 if (p-> mShowIconNewEvent)
842 ne_action->addTo( iconToolBar ); 842 ne_action->addTo( iconToolBar );
843 if (p->mShowIconNewTodo ) 843 if (p->mShowIconNewTodo )
844 nt_action->addTo( iconToolBar ); 844 nt_action->addTo( iconToolBar );
845 if (p-> mShowIconSearch) 845 if (p-> mShowIconSearch)
846 search_action->addTo( iconToolBar ); 846 search_action->addTo( iconToolBar );
847 if (p-> mShowIconNext) 847 if (p-> mShowIconNext)
848 whatsnext_action->addTo( iconToolBar ); 848 whatsnext_action->addTo( iconToolBar );
849 if (p-> mShowIconNextDays) 849 if (p-> mShowIconNextDays)
850 xdays_action->addTo( iconToolBar ); 850 xdays_action->addTo( iconToolBar );
851 if (p-> mShowIconList) 851 if (p-> mShowIconList)
852 showlist_action->addTo( iconToolBar ); 852 showlist_action->addTo( iconToolBar );
853 if (p-> mShowIconDay1) 853 if (p-> mShowIconDay1)
854 day1_action->addTo( iconToolBar ); 854 day1_action->addTo( iconToolBar );
855 if (p-> mShowIconDay5) 855 if (p-> mShowIconDay5)
856 day5_action->addTo( iconToolBar ); 856 day5_action->addTo( iconToolBar );
857 if (p-> mShowIconDay7) 857 if (p-> mShowIconDay7)
858 day7_action->addTo( iconToolBar ); 858 day7_action->addTo( iconToolBar );
859 if (p-> mShowIconMonth) 859 if (p-> mShowIconMonth)
860 month_action->addTo( iconToolBar ); 860 month_action->addTo( iconToolBar );
861 if (p-> mShowIconTodoview) 861 if (p-> mShowIconTodoview)
862 todoview_action->addTo( iconToolBar ); 862 todoview_action->addTo( iconToolBar );
863 if (p-> mShowIconJournal) 863 if (p-> mShowIconJournal)
864 viewjournal_action->addTo( iconToolBar ); 864 viewjournal_action->addTo( iconToolBar );
865 icon = loadPixmap( pathString + "2leftarrowB" ); 865 icon = loadPixmap( pathString + "2leftarrowB" );
866 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 866 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
867 if (p-> mShowIconBackFast) { 867 if (p-> mShowIconBackFast) {
868 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 868 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
869 connect( action, SIGNAL( activated() ), 869 connect( action, SIGNAL( activated() ),
870 mView, SLOT( goPreviousMonth() ) ); 870 mView, SLOT( goPreviousMonth() ) );
871 action->addTo( iconToolBar ); 871 action->addTo( iconToolBar );
872 } 872 }
873 icon = loadPixmap( pathString + "1leftarrowB" ); 873 icon = loadPixmap( pathString + "1leftarrowB" );
874 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 874 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
875 if (p-> mShowIconBack) { 875 if (p-> mShowIconBack) {
876 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 876 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
877 connect( action, SIGNAL( activated() ), 877 connect( action, SIGNAL( activated() ),
878 mView, SLOT( goPrevious() ) ); 878 mView, SLOT( goPrevious() ) );
879 action->addTo( iconToolBar ); 879 action->addTo( iconToolBar );
880 } 880 }
881 if (p-> mShowIconToday) 881 if (p-> mShowIconToday)
882 today_action->addTo( iconToolBar ); 882 today_action->addTo( iconToolBar );
883 icon = loadPixmap( pathString + "1rightarrowB" ); 883 icon = loadPixmap( pathString + "1rightarrowB" );
884 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 884 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
885 if (p-> mShowIconForward) { 885 if (p-> mShowIconForward) {
886 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 886 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
887 connect( action, SIGNAL( activated() ), 887 connect( action, SIGNAL( activated() ),
888 mView, SLOT( goNext() ) ); 888 mView, SLOT( goNext() ) );
889 action->addTo( iconToolBar ); 889 action->addTo( iconToolBar );
890 } 890 }
891 icon = loadPixmap( pathString + "2rightarrowB" ); 891 icon = loadPixmap( pathString + "2rightarrowB" );
892 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 892 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
893 if (p-> mShowIconForwardFast) { 893 if (p-> mShowIconForwardFast) {
894 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 894 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
895 connect( action, SIGNAL( activated() ), 895 connect( action, SIGNAL( activated() ),
896 mView, SLOT( goNextMonth() ) ); 896 mView, SLOT( goNextMonth() ) );
897 action->addTo( iconToolBar ); 897 action->addTo( iconToolBar );
898 } 898 }
899 899
900 900
901 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 901 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
902 902
903 if (p-> mShowIconNewEvent) 903 if (p-> mShowIconNewEvent)
904 configureToolBarMenu->setItemChecked( 10, true ); 904 configureToolBarMenu->setItemChecked( 10, true );
905 if (p->mShowIconNewTodo ) 905 if (p->mShowIconNewTodo )
906 configureToolBarMenu->setItemChecked( 20, true ); 906 configureToolBarMenu->setItemChecked( 20, true );
907 if (p-> mShowIconSearch) 907 if (p-> mShowIconSearch)
908 configureToolBarMenu->setItemChecked( 120, true ); 908 configureToolBarMenu->setItemChecked( 120, true );
909 if (p-> mShowIconList) 909 if (p-> mShowIconList)
910 configureToolBarMenu->setItemChecked( 30, true ); 910 configureToolBarMenu->setItemChecked( 30, true );
911 if (p-> mShowIconDay1) 911 if (p-> mShowIconDay1)
912 configureToolBarMenu->setItemChecked( 40, true ); 912 configureToolBarMenu->setItemChecked( 40, true );
913 if (p-> mShowIconDay5) 913 if (p-> mShowIconDay5)
914 configureToolBarMenu->setItemChecked( 50, true ); 914 configureToolBarMenu->setItemChecked( 50, true );
915 if (p-> mShowIconDay7) 915 if (p-> mShowIconDay7)
916 configureToolBarMenu->setItemChecked( 60, true ); 916 configureToolBarMenu->setItemChecked( 60, true );
917 if (p-> mShowIconMonth) 917 if (p-> mShowIconMonth)
918 configureToolBarMenu->setItemChecked( 70, true ); 918 configureToolBarMenu->setItemChecked( 70, true );
919 if (p-> mShowIconTodoview) 919 if (p-> mShowIconTodoview)
920 configureToolBarMenu->setItemChecked( 80, true ); 920 configureToolBarMenu->setItemChecked( 80, true );
921 if (p-> mShowIconBackFast) 921 if (p-> mShowIconBackFast)
922 configureToolBarMenu->setItemChecked( 200, true ); 922 configureToolBarMenu->setItemChecked( 200, true );
923 if (p-> mShowIconBack) 923 if (p-> mShowIconBack)
924 configureToolBarMenu->setItemChecked( 210, true ); 924 configureToolBarMenu->setItemChecked( 210, true );
925 if (p-> mShowIconToday) 925 if (p-> mShowIconToday)
926 configureToolBarMenu->setItemChecked( 130, true ); 926 configureToolBarMenu->setItemChecked( 130, true );
927 if (p-> mShowIconForward) 927 if (p-> mShowIconForward)
928 configureToolBarMenu->setItemChecked( 220, true ); 928 configureToolBarMenu->setItemChecked( 220, true );
929 if (p-> mShowIconForwardFast) 929 if (p-> mShowIconForwardFast)
930 configureToolBarMenu->setItemChecked( 230, true ); 930 configureToolBarMenu->setItemChecked( 230, true );
931 if (p-> mShowIconNextDays) 931 if (p-> mShowIconNextDays)
932 configureToolBarMenu->setItemChecked( 100, true ); 932 configureToolBarMenu->setItemChecked( 100, true );
933 if (p-> mShowIconNext) 933 if (p-> mShowIconNext)
934 configureToolBarMenu->setItemChecked( 110, true ); 934 configureToolBarMenu->setItemChecked( 110, true );
935 if (p-> mShowIconJournal) 935 if (p-> mShowIconJournal)
936 configureToolBarMenu->setItemChecked( 90, true ); 936 configureToolBarMenu->setItemChecked( 90, true );
937 if (p-> mShowIconWhatsThis) 937 if (p-> mShowIconWhatsThis)
938 configureToolBarMenu->setItemChecked( 300, true ); 938 configureToolBarMenu->setItemChecked( 300, true );
939 939
940 QLabel* dummy = new QLabel( iconToolBar ); 940 QLabel* dummy = new QLabel( iconToolBar );
941 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 941 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
942 if (!p-> mShowIconStretch) 942 if (!p-> mShowIconStretch)
943 iconToolBar->setStretchableWidget ( dummy ) ; 943 iconToolBar->setStretchableWidget ( dummy ) ;
944 else 944 else
945 configureToolBarMenu->setItemChecked( 5, true ); 945 configureToolBarMenu->setItemChecked( 5, true );
946 if (p-> mShowIconWhatsThis) 946 if (p-> mShowIconWhatsThis)
947 QWhatsThis::whatsThisButton ( iconToolBar ); 947 QWhatsThis::whatsThisButton ( iconToolBar );
948 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 948 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
949 configureAgenda( p->mHourSize ); 949 configureAgenda( p->mHourSize );
950 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 950 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
951} 951}
952 952
953void MainWindow::exportToPhone( int mode ) 953void MainWindow::exportToPhone( int mode )
954{ 954{
955 955
956 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 956 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
957 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 957 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
958 KOex2phonePrefs ex2phone; 958 KOex2phonePrefs ex2phone;
959 959
960 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 960 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
961 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 961 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
962 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 962 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
963 if ( mode == 1 ) 963 if ( mode == 1 )
964 ex2phone.setCaption(i18n("Export complete calendar")); 964 ex2phone.setCaption(i18n("Export complete calendar"));
965 if ( mode == 2 ) 965 if ( mode == 2 )
966 ex2phone.setCaption(i18n("Export filtered calendar")); 966 ex2phone.setCaption(i18n("Export filtered calendar"));
967 967
968 if ( !ex2phone.exec() ) { 968 if ( !ex2phone.exec() ) {
969 return; 969 return;
970 } 970 }
971 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 971 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
972 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 972 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
973 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 973 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
974 974
975 int inFuture = 0; 975 int inFuture = 0;
976 if ( ex2phone.mWriteBackFuture->isChecked() ) 976 if ( ex2phone.mWriteBackFuture->isChecked() )
977 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 977 inFuture = ex2phone.mWriteBackFutureWeeks->value();
978 QPtrList<Incidence> delSel; 978 QPtrList<Incidence> delSel;
979 if ( mode == 1 ) 979 if ( mode == 1 )
980 delSel = mCalendar->rawIncidences(); 980 delSel = mCalendar->rawIncidences();
981 if ( mode == 2 ) 981 if ( mode == 2 )
982 delSel = mCalendar->incidences(); 982 delSel = mCalendar->incidences();
983 CalendarLocal* cal = new CalendarLocal(); 983 CalendarLocal* cal = new CalendarLocal();
984 cal->setLocalTime(); 984 cal->setLocalTime();
985 Incidence *incidence = delSel.first(); 985 Incidence *incidence = delSel.first();
986 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 986 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
987 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 987 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
988 while ( incidence ) { 988 while ( incidence ) {
989 if ( incidence->type() != "Journal" ) { 989 if ( incidence->type() != "Journal" ) {
990 bool add = true; 990 bool add = true;
991 if ( inFuture ) { 991 if ( inFuture ) {
992 QDateTime dt; 992 QDateTime dt;
993 if ( incidence->type() == "Todo" ) { 993 if ( incidence->type() == "Todo" ) {
994 Todo * t = (Todo*)incidence; 994 Todo * t = (Todo*)incidence;
995 if ( t->hasDueDate() ) 995 if ( t->hasDueDate() )
996 dt = t->dtDue(); 996 dt = t->dtDue();
997 else 997 else
998 dt = cur.addSecs( 62 ); 998 dt = cur.addSecs( 62 );
999 } 999 }
1000 else { 1000 else {
1001 bool ok; 1001 bool ok;
1002 dt = incidence->getNextOccurence( cur, &ok ); 1002 dt = incidence->getNextOccurence( cur, &ok );
1003 if ( !ok ) 1003 if ( !ok )
1004 dt = cur.addSecs( -62 ); 1004 dt = cur.addSecs( -62 );
1005 } 1005 }
1006 if ( dt < cur || dt > end ) { 1006 if ( dt < cur || dt > end ) {
1007 add = false; 1007 add = false;
1008 } 1008 }
1009 } 1009 }
1010 if ( add ) { 1010 if ( add ) {
1011 Incidence *in = incidence->clone(); 1011 Incidence *in = incidence->clone();
1012 cal->addIncidence( in ); 1012 cal->addIncidence( in );
1013 } 1013 }
1014 } 1014 }
1015 incidence = delSel.next(); 1015 incidence = delSel.next();
1016 } 1016 }
1017 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1017 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1018 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1018 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1019 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1019 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1020 1020
1021 setCaption( i18n("Writing to phone...")); 1021 setCaption( i18n("Writing to phone..."));
1022 if ( PhoneFormat::writeToPhone( cal ) ) 1022 if ( PhoneFormat::writeToPhone( cal ) )
1023 setCaption( i18n("Export to phone successful!")); 1023 setCaption( i18n("Export to phone successful!"));
1024 else 1024 else
1025 setCaption( i18n("Error exporting to phone!")); 1025 setCaption( i18n("Error exporting to phone!"));
1026 delete cal; 1026 delete cal;
1027} 1027}
1028 1028
1029 1029
1030void MainWindow::setDefaultPreferences() 1030void MainWindow::setDefaultPreferences()
1031{ 1031{
1032 KOPrefs *p = KOPrefs::instance(); 1032 KOPrefs *p = KOPrefs::instance();
1033 1033
1034 p->mCompactDialogs = true; 1034 p->mCompactDialogs = true;
1035 p->mConfirm = true; 1035 p->mConfirm = true;
1036 // p->mEnableQuickTodo = false; 1036 // p->mEnableQuickTodo = false;
1037 1037
1038} 1038}
1039 1039
1040QString MainWindow::resourcePath() 1040QString MainWindow::resourcePath()
1041{ 1041{
1042 return KGlobal::iconLoader()->iconPath(); 1042 return KGlobal::iconLoader()->iconPath();
1043} 1043}
1044 1044
1045void MainWindow::displayText( QString text ,QString cap ) 1045void MainWindow::displayText( QString text ,QString cap )
1046{ 1046{
1047 QDialog dia( this, "name", true ); ; 1047 QDialog dia( this, "name", true ); ;
1048 dia.setCaption( cap ); 1048 dia.setCaption( cap );
1049 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1049 QVBoxLayout* lay = new QVBoxLayout( &dia );
1050 lay->setSpacing( 3 ); 1050 lay->setSpacing( 3 );
1051 lay->setMargin( 3 ); 1051 lay->setMargin( 3 );
1052 QTextBrowser tb ( &dia ); 1052 QTextBrowser tb ( &dia );
1053 lay->addWidget( &tb ); 1053 lay->addWidget( &tb );
1054 tb.setText( text ); 1054 tb.setText( text );
1055#ifdef DESKTOP_VERSION 1055#ifdef DESKTOP_VERSION
1056 dia.resize( 640, 480); 1056 dia.resize( 640, 480);
1057#else 1057#else
1058 dia.showMaximized(); 1058 dia.showMaximized();
1059#endif 1059#endif
1060 dia.exec(); 1060 dia.exec();
1061} 1061}
1062void MainWindow::displayFile( QString fn, QString cap ) 1062void MainWindow::displayFile( QString fn, QString cap )
1063{ 1063{
1064 QString fileName = resourcePath() + fn; 1064 QString fileName = resourcePath() + fn;
1065 QString text; 1065 QString text;
1066 QFile file( fileName ); 1066 QFile file( fileName );
1067 if (!file.open( IO_ReadOnly ) ) { 1067 if (!file.open( IO_ReadOnly ) ) {
1068 return ; 1068 return ;
1069 1069
1070 } 1070 }
1071 QTextStream ts( &file ); 1071 QTextStream ts( &file );
1072 text = ts.read(); 1072 text = ts.read();
1073 file.close(); 1073 file.close();
1074 displayText( text, cap); 1074 displayText( text, cap);
1075} 1075}
1076void MainWindow::features() 1076void MainWindow::features()
1077{ 1077{
1078 1078
1079 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1079 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1080} 1080}
1081 1081
1082void MainWindow::usertrans() 1082void MainWindow::usertrans()
1083{ 1083{
1084 1084
1085 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1085 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1086} 1086}
1087 1087
1088void MainWindow::synchowto() 1088void MainWindow::synchowto()
1089{ 1089{
1090 1090
1091 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1091 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1092} 1092}
1093void MainWindow::faq() 1093void MainWindow::faq()
1094{ 1094{
1095 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1095 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1096 1096
1097} 1097}
1098void MainWindow::whatsNew() 1098void MainWindow::whatsNew()
1099{ 1099{
1100 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1100 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1101 1101
1102} 1102}
1103void MainWindow::licence() 1103void MainWindow::licence()
1104{ 1104{
1105 KApplication::showLicence(); 1105 KApplication::showLicence();
1106 1106
1107} 1107}
1108void MainWindow::about() 1108void MainWindow::about()
1109{ 1109{
1110 QString version; 1110 QString version;
1111#include <../version> 1111#include <../version>
1112 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1112 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1113 i18n("KOrganizer/Platform-independent\n") + 1113 i18n("KOrganizer/Platform-independent\n") +
1114 "(KO/Pi) " + version + " - " + 1114 "(KO/Pi) " + version + " - " +
1115 1115
1116#ifdef DESKTOP_VERSION 1116#ifdef DESKTOP_VERSION
1117 i18n("Desktop Edition\n") + 1117 i18n("Desktop Edition\n") +
1118#else 1118#else
1119 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1119 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1120#endif 1120#endif
1121 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1121 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1122} 1122}
1123void MainWindow::keyBindings() 1123void MainWindow::keyBindings()
1124{ 1124{
1125 QString cap = i18n("Key bindings KOrganizer/Pi"); 1125 QString cap = i18n("Key bindings KOrganizer/Pi");
1126 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1126 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1127 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1127 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1128 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1128 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1129 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1129 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1130 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1130 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1131 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1131 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1132 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1132 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1133 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1133 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1134 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1134 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1135 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1135 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1136 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1136 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1137 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1137 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1138 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1138 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1139 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1139 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1140 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1140 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1141 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1141 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1142 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1142 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1143 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1143 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1144 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1144 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1145 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1145 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1146 i18n("<p><h3>In agenda view:</h3></p>\n") + 1146 i18n("<p><h3>In agenda view:</h3></p>\n") +
1147 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1147 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1148 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1148 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1149 i18n("<p><h3>In todo view:</h3></p>\n") + 1149 i18n("<p><h3>In todo view:</h3></p>\n") +
1150 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1150 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1151 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1151 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1152 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1152 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1153 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1153 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1154 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1154 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1155 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1155 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1156 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1156 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1157 i18n("<p><h3>In list view:</h3></p>\n") + 1157 i18n("<p><h3>In list view:</h3></p>\n") +
1158 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1158 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1159 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1159 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1160 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1160 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1161 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1161 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1162 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1162 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1163 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1163 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1164 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1164 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1165 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1165 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1166 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1166 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1167 i18n("<p><b>E</b>: Edit item</p>\n") + 1167 i18n("<p><b>E</b>: Edit item</p>\n") +
1168 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1168 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1169 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1169 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1170 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1170 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1171 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1171 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1172 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1172 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1173 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1173 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1174 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1174 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1175 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1175 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1176 i18n("<p><b>White</b>: Item readonly</p>\n"); 1176 i18n("<p><b>White</b>: Item readonly</p>\n");
1177 displayText( text, cap); 1177 displayText( text, cap);
1178 1178
1179} 1179}
1180void MainWindow::aboutAutoSaving() 1180void MainWindow::aboutAutoSaving()
1181{ 1181{
1182 QMessageBox* msg; 1182 QMessageBox* msg;
1183 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1183 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1184 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, 1184 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon,
1185 QMessageBox::Ok, 1185 QMessageBox::Ok,
1186 QMessageBox::NoButton, 1186 QMessageBox::NoButton,
1187 QMessageBox::NoButton); 1187 QMessageBox::NoButton);
1188 msg->exec(); 1188 msg->exec();
1189 delete msg; 1189 delete msg;
1190 1190
1191 1191
1192} 1192}
1193void MainWindow::aboutKnownBugs() 1193void MainWindow::aboutKnownBugs()
1194{ 1194{
1195 QMessageBox* msg; 1195 QMessageBox* msg;
1196 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1196 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1197 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1197 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1198 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1198 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1199 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1199 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1200 i18n("\nor report them in the bugtracker on\n") + 1200 i18n("\nor report them in the bugtracker on\n") +
1201 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1201 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1202 QMessageBox::NoIcon, 1202 QMessageBox::NoIcon,
1203 QMessageBox::Ok, 1203 QMessageBox::Ok,
1204 QMessageBox::NoButton, 1204 QMessageBox::NoButton,
1205 QMessageBox::NoButton); 1205 QMessageBox::NoButton);
1206 msg->exec(); 1206 msg->exec();
1207 delete msg; 1207 delete msg;
1208 1208
1209} 1209}
1210 1210
1211QString MainWindow::defaultFileName() 1211QString MainWindow::defaultFileName()
1212{ 1212{
1213 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1213 return locateLocal( "data", "korganizer/mycalendar.ics" );
1214} 1214}
1215QString MainWindow::syncFileName() 1215QString MainWindow::syncFileName()
1216{ 1216{
1217#ifdef _WIN32_ 1217#ifdef DESKTOP_VERSION
1218 return locateLocal( "tmp", "synccalendar.ics" ); 1218 return locateLocal( "tmp", "synccalendar.ics" );
1219#else 1219#else
1220 return QString( "/tmp/kopitempfile.ics" ); 1220 return QString( "/tmp/synccalendar.ics" );
1221#endif 1221#endif
1222} 1222}
1223 1223
1224void MainWindow::processIncidenceSelection( Incidence *incidence ) 1224void MainWindow::processIncidenceSelection( Incidence *incidence )
1225{ 1225{
1226 if ( !incidence ) { 1226 if ( !incidence ) {
1227 enableIncidenceActions( false ); 1227 enableIncidenceActions( false );
1228 1228
1229 mNewSubTodoAction->setEnabled( false ); 1229 mNewSubTodoAction->setEnabled( false );
1230 setCaptionToDates(); 1230 setCaptionToDates();
1231 return; 1231 return;
1232 1232
1233 } 1233 }
1234 1234
1235 //KGlobal::locale()->formatDateTime(nextA, true); 1235 //KGlobal::locale()->formatDateTime(nextA, true);
1236 QString startString = ""; 1236 QString startString = "";
1237 if ( incidence->type() != "Todo" ) { 1237 if ( incidence->type() != "Todo" ) {
1238 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1238 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1239 if ( incidence->doesFloat() ) { 1239 if ( incidence->doesFloat() ) {
1240 startString += ": "+incidence->dtStartDateStr( true ); 1240 startString += ": "+incidence->dtStartDateStr( true );
1241 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1241 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1242 1242
1243 } else { 1243 } else {
1244 startString = ": "+incidence->dtStartStr(true); 1244 startString = ": "+incidence->dtStartStr(true);
1245 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1245 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1246 1246
1247 } 1247 }
1248 1248
1249 } else { 1249 } else {
1250 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1250 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1251 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1251 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1252 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1252 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1253 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1253 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1254 } 1254 }
1255 1255
1256 } 1256 }
1257 else 1257 else
1258 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1258 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1259 if ( !incidence->location().isEmpty() ) 1259 if ( !incidence->location().isEmpty() )
1260 startString += " (" +incidence->location()+")"; 1260 startString += " (" +incidence->location()+")";
1261 setCaption( incidence->summary()+startString); 1261 setCaption( incidence->summary()+startString);
1262 1262
1263 enableIncidenceActions( true ); 1263 enableIncidenceActions( true );
1264 1264
1265 if ( incidence->type() == "Event" ) { 1265 if ( incidence->type() == "Event" ) {
1266 mShowAction->setText( i18n("Show Event...") ); 1266 mShowAction->setText( i18n("Show Event...") );
1267 mEditAction->setText( i18n("Edit Event...") ); 1267 mEditAction->setText( i18n("Edit Event...") );
1268 mDeleteAction->setText( i18n("Delete Event...") ); 1268 mDeleteAction->setText( i18n("Delete Event...") );
1269 1269
1270 mNewSubTodoAction->setEnabled( false ); 1270 mNewSubTodoAction->setEnabled( false );
1271 } else if ( incidence->type() == "Todo" ) { 1271 } else if ( incidence->type() == "Todo" ) {
1272 mShowAction->setText( i18n("Show Todo...") ); 1272 mShowAction->setText( i18n("Show Todo...") );
1273 mEditAction->setText( i18n("Edit Todo...") ); 1273 mEditAction->setText( i18n("Edit Todo...") );
1274 mDeleteAction->setText( i18n("Delete Todo...") ); 1274 mDeleteAction->setText( i18n("Delete Todo...") );
1275 1275
1276 mNewSubTodoAction->setEnabled( true ); 1276 mNewSubTodoAction->setEnabled( true );
1277 } else { 1277 } else {
1278 mShowAction->setText( i18n("Show...") ); 1278 mShowAction->setText( i18n("Show...") );
1279 mShowAction->setText( i18n("Edit...") ); 1279 mShowAction->setText( i18n("Edit...") );
1280 mShowAction->setText( i18n("Delete...") ); 1280 mShowAction->setText( i18n("Delete...") );
1281 1281
1282 mNewSubTodoAction->setEnabled( false ); 1282 mNewSubTodoAction->setEnabled( false );
1283 } 1283 }
1284} 1284}
1285 1285
1286void MainWindow::enableIncidenceActions( bool enabled ) 1286void MainWindow::enableIncidenceActions( bool enabled )
1287{ 1287{
1288 mShowAction->setEnabled( enabled ); 1288 mShowAction->setEnabled( enabled );
1289 mEditAction->setEnabled( enabled ); 1289 mEditAction->setEnabled( enabled );
1290 mDeleteAction->setEnabled( enabled ); 1290 mDeleteAction->setEnabled( enabled );
1291 1291
1292 mCloneAction->setEnabled( enabled ); 1292 mCloneAction->setEnabled( enabled );
1293 mMoveAction->setEnabled( enabled ); 1293 mMoveAction->setEnabled( enabled );
1294 mBeamAction->setEnabled( enabled ); 1294 mBeamAction->setEnabled( enabled );
1295 mCancelAction->setEnabled( enabled ); 1295 mCancelAction->setEnabled( enabled );
1296} 1296}
1297 1297
1298void MainWindow::importOL() 1298void MainWindow::importOL()
1299{ 1299{
1300#ifdef _WIN32_ 1300#ifdef _WIN32_
1301 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1301 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1302 id->exec(); 1302 id->exec();
1303 delete id; 1303 delete id;
1304 mView->updateView(); 1304 mView->updateView();
1305#endif 1305#endif
1306} 1306}
1307void MainWindow::importBday() 1307void MainWindow::importBday()
1308{ 1308{
1309 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1309 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1310 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1310 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1311 i18n("Import!"), i18n("Cancel"), 0, 1311 i18n("Import!"), i18n("Cancel"), 0,
1312 0, 1 ); 1312 0, 1 );
1313 if ( result == 0 ) { 1313 if ( result == 0 ) {
1314 mView->importBday(); 1314 mView->importBday();
1315 1315
1316 } 1316 }
1317 1317
1318 1318
1319} 1319}
1320void MainWindow::importQtopia() 1320void MainWindow::importQtopia()
1321{ 1321{
1322#ifndef DESKTOP_VERSION 1322#ifndef DESKTOP_VERSION
1323 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1323 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1324 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"), 1324 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"),
1325 i18n("Import!"), i18n("Cancel"), 0, 1325 i18n("Import!"), i18n("Cancel"), 0,
1326 0, 1 ); 1326 0, 1 );
1327 if ( result == 0 ) { 1327 if ( result == 0 ) {
1328 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1328 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1329 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1329 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1330 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1330 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1331 mView->importQtopia( categories, datebook, todolist ); 1331 mView->importQtopia( categories, datebook, todolist );
1332 } 1332 }
1333#else 1333#else
1334 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1334 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1335 i18n("Not supported \non desktop!\n"), 1335 i18n("Not supported \non desktop!\n"),
1336 i18n("Ok"), i18n("Cancel"), 0, 1336 i18n("Ok"), i18n("Cancel"), 0,
1337 0, 1 ); 1337 0, 1 );
1338 1338
1339#endif 1339#endif
1340} 1340}
1341 1341
1342void MainWindow::saveOnClose() 1342void MainWindow::saveOnClose()
1343{ 1343{
1344 KOPrefs *p = KOPrefs::instance(); 1344 KOPrefs *p = KOPrefs::instance();
1345 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1345 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1346 p->mToolBarUp = iconToolBar->x() > width()/2 || 1346 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1347 iconToolBar->y() > height()/2; 1347 iconToolBar->y() > height()/2;
1348 mView->writeSettings(); 1348 mView->writeSettings();
1349 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1349 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1350 save(); 1350 save();
1351} 1351}
1352void MainWindow::slotModifiedChanged( bool changed ) 1352void MainWindow::slotModifiedChanged( bool changed )
1353{ 1353{
1354 if ( mBlockAtStartup ) 1354 if ( mBlockAtStartup )
1355 return; 1355 return;
1356 int msec; 1356 int msec;
1357 // we store the changes after 1 minute, 1357 // we store the changes after 1 minute,
1358 // and for safety reasons after 10 minutes again 1358 // and for safety reasons after 10 minutes again
1359 if ( !mSyncManager->blockSave() ) 1359 if ( !mSyncManager->blockSave() )
1360 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1360 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1361 else 1361 else
1362 msec = 1000 * 600; 1362 msec = 1000 * 600;
1363 mSaveTimer.start( msec, true ); // 1 minute 1363 mSaveTimer.start( msec, true ); // 1 minute
1364 qDebug("KO: Saving File in %d secs!", msec/1000); 1364 qDebug("KO: Saving File in %d secs!", msec/1000);
1365 mCalendarModifiedFlag = true; 1365 mCalendarModifiedFlag = true;
1366} 1366}
1367void MainWindow::save() 1367void MainWindow::save()
1368{ 1368{
1369 if ( mSyncManager->blockSave() ) 1369 if ( mSyncManager->blockSave() )
1370 return; 1370 return;
1371 mSyncManager->setBlockSave(true); 1371 mSyncManager->setBlockSave(true);
1372 if ( mView->checkFileVersion( defaultFileName()) ) { 1372 if ( mView->checkFileVersion( defaultFileName()) ) {
1373 1373
1374 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1374 QTime neededSaveTime = QDateTime::currentDateTime().time();
1375 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1375 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1376 qDebug("KO: Start saving data to file!"); 1376 qDebug("KO: Start saving data to file!");
1377 mView->saveCalendar( defaultFileName() ); 1377 mView->saveCalendar( defaultFileName() );
1378 1378
1379 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1379 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1380 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1380 qDebug("KO: Needed %d ms for saving.",msNeeded );
1381 QString savemes; 1381 QString savemes;
1382 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1382 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1383 setCaption(savemes); 1383 setCaption(savemes);
1384 } else 1384 } else
1385 setCaption(i18n("Saving cancelled!")); 1385 setCaption(i18n("Saving cancelled!"));
1386 mCalendarModifiedFlag = false; 1386 mCalendarModifiedFlag = false;
1387 mSyncManager->setBlockSave( false ); 1387 mSyncManager->setBlockSave( false );
1388} 1388}
1389 1389
1390void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1390void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1391{ 1391{
1392 if ( !e->isAutoRepeat() ) { 1392 if ( !e->isAutoRepeat() ) {
1393 mFlagKeyPressed = false; 1393 mFlagKeyPressed = false;
1394 } 1394 }
1395} 1395}
1396void MainWindow::keyPressEvent ( QKeyEvent * e ) 1396void MainWindow::keyPressEvent ( QKeyEvent * e )
1397{ 1397{
1398 qApp->processEvents(); 1398 qApp->processEvents();
1399 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1399 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1400 e->ignore(); 1400 e->ignore();
1401 // qDebug(" ignore %d",e->isAutoRepeat() ); 1401 // qDebug(" ignore %d",e->isAutoRepeat() );
1402 return; 1402 return;
1403 } 1403 }
1404 if (! e->isAutoRepeat() ) 1404 if (! e->isAutoRepeat() )
1405 mFlagKeyPressed = true; 1405 mFlagKeyPressed = true;
1406 KOPrefs *p = KOPrefs::instance(); 1406 KOPrefs *p = KOPrefs::instance();
1407 bool showSelectedDates = false; 1407 bool showSelectedDates = false;
1408 int size; 1408 int size;
1409 int pro = 0; 1409 int pro = 0;
1410 //qDebug("MainWindow::keyPressEvent "); 1410 //qDebug("MainWindow::keyPressEvent ");
1411 switch ( e->key() ) { 1411 switch ( e->key() ) {
1412 case Qt::Key_Right: 1412 case Qt::Key_Right:
1413 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1413 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1414 mView->goNextMonth(); 1414 mView->goNextMonth();
1415 else 1415 else
1416 mView->goNext(); 1416 mView->goNext();
1417 showSelectedDates = true; 1417 showSelectedDates = true;
1418 break; 1418 break;
1419 case Qt::Key_Left: 1419 case Qt::Key_Left:
1420 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1420 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1421 mView->goPreviousMonth(); 1421 mView->goPreviousMonth();
1422 else 1422 else
1423 mView->goPrevious(); 1423 mView->goPrevious();
1424 showSelectedDates = true; 1424 showSelectedDates = true;
1425 break; 1425 break;
1426 case Qt::Key_Down: 1426 case Qt::Key_Down:
1427 mView->viewManager()->agendaView()->scrollOneHourDown(); 1427 mView->viewManager()->agendaView()->scrollOneHourDown();
1428 break; 1428 break;
1429 case Qt::Key_Up: 1429 case Qt::Key_Up:
1430 mView->viewManager()->agendaView()->scrollOneHourUp(); 1430 mView->viewManager()->agendaView()->scrollOneHourUp();
1431 break; 1431 break;
1432 case Qt::Key_I: 1432 case Qt::Key_I:
1433 mView->showIncidence(); 1433 mView->showIncidence();
1434 break; 1434 break;
1435 case Qt::Key_Delete: 1435 case Qt::Key_Delete:
1436 case Qt::Key_Backspace: 1436 case Qt::Key_Backspace:
1437 mView->deleteIncidence(); 1437 mView->deleteIncidence();
1438 break; 1438 break;
1439 case Qt::Key_D: 1439 case Qt::Key_D:
1440 mView->viewManager()->showDayView(); 1440 mView->viewManager()->showDayView();
1441 showSelectedDates = true; 1441 showSelectedDates = true;
1442 break; 1442 break;
1443 case Qt::Key_O: 1443 case Qt::Key_O:
1444 mView->toggleFilerEnabled( ); 1444 mView->toggleFilerEnabled( );
1445 break; 1445 break;
1446 case Qt::Key_0: 1446 case Qt::Key_0:
1447 case Qt::Key_1: 1447 case Qt::Key_1:
1448 case Qt::Key_2: 1448 case Qt::Key_2:
1449 case Qt::Key_3: 1449 case Qt::Key_3:
1450 case Qt::Key_4: 1450 case Qt::Key_4:
1451 case Qt::Key_5: 1451 case Qt::Key_5:
1452 case Qt::Key_6: 1452 case Qt::Key_6:
1453 case Qt::Key_7: 1453 case Qt::Key_7:
1454 case Qt::Key_8: 1454 case Qt::Key_8:
1455 case Qt::Key_9: 1455 case Qt::Key_9:
1456 pro = e->key()-48; 1456 pro = e->key()-48;
1457 if ( pro == 0 ) 1457 if ( pro == 0 )
1458 pro = 10; 1458 pro = 10;
1459 if ( e->state() == Qt::ControlButton) 1459 if ( e->state() == Qt::ControlButton)
1460 pro += 10; 1460 pro += 10;
1461 break; 1461 break;
1462 case Qt::Key_M: 1462 case Qt::Key_M:
1463 mView->viewManager()->showMonthView(); 1463 mView->viewManager()->showMonthView();
1464 showSelectedDates = true; 1464 showSelectedDates = true;
1465 break; 1465 break;
1466 case Qt::Key_Insert: 1466 case Qt::Key_Insert:
1467 mView->newEvent(); 1467 mView->newEvent();
1468 break; 1468 break;
1469 case Qt::Key_S : 1469 case Qt::Key_S :
1470 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1470 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1471 mView->newSubTodo(); 1471 mView->newSubTodo();
1472 else 1472 else
1473 mView->dialogManager()->showSearchDialog(); 1473 mView->dialogManager()->showSearchDialog();
1474 break; 1474 break;
1475 case Qt::Key_Y : 1475 case Qt::Key_Y :
1476 case Qt::Key_Z : 1476 case Qt::Key_Z :
1477 mView->viewManager()->showWorkWeekView(); 1477 mView->viewManager()->showWorkWeekView();
1478 showSelectedDates = true; 1478 showSelectedDates = true;
1479 break; 1479 break;
1480 case Qt::Key_U : 1480 case Qt::Key_U :
1481 mView->viewManager()->showWeekView(); 1481 mView->viewManager()->showWeekView();
1482 showSelectedDates = true; 1482 showSelectedDates = true;
1483 break; 1483 break;
1484 case Qt::Key_H : 1484 case Qt::Key_H :
1485 keyBindings(); 1485 keyBindings();
1486 break; 1486 break;
1487 case Qt::Key_W: 1487 case Qt::Key_W:
1488 mView->viewManager()->showWhatsNextView(); 1488 mView->viewManager()->showWhatsNextView();
1489 break; 1489 break;
1490 case Qt::Key_L: 1490 case Qt::Key_L:
1491 mView->viewManager()->showListView(); 1491 mView->viewManager()->showListView();
1492 break; 1492 break;
1493 case Qt::Key_N: 1493 case Qt::Key_N:
1494 mView->viewManager()->showNextXView(); 1494 mView->viewManager()->showNextXView();
1495 showSelectedDates = true; 1495 showSelectedDates = true;
1496 break; 1496 break;
1497 case Qt::Key_V: 1497 case Qt::Key_V:
1498 mView->viewManager()->showTodoView(); 1498 mView->viewManager()->showTodoView();
1499 break; 1499 break;
1500 case Qt::Key_C: 1500 case Qt::Key_C:
1501 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1501 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1502 break; 1502 break;
1503 case Qt::Key_P: 1503 case Qt::Key_P:
1504 mView->showDatePicker( ); 1504 mView->showDatePicker( );
1505 break; 1505 break;
1506 case Qt::Key_F: 1506 case Qt::Key_F:
1507 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1507 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1508 mView->editFilters(); 1508 mView->editFilters();
1509 else 1509 else
1510 mView->toggleFilter(); 1510 mView->toggleFilter();
1511 break; 1511 break;
1512 case Qt::Key_X: 1512 case Qt::Key_X:
1513 mView->toggleDateNavigatorWidget(); 1513 mView->toggleDateNavigatorWidget();
1514 break; 1514 break;
1515 case Qt::Key_Space: 1515 case Qt::Key_Space:
1516 mView->toggleExpand(); 1516 mView->toggleExpand();
1517 break; 1517 break;
1518 case Qt::Key_A: 1518 case Qt::Key_A:
1519 mView->toggleAllDaySize(); 1519 mView->toggleAllDaySize();
1520 break; 1520 break;
1521 case Qt::Key_T: 1521 case Qt::Key_T:
1522 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1522 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1523 mView->newTodo(); 1523 mView->newTodo();
1524 else { 1524 else {
1525 mView->goToday(); 1525 mView->goToday();
1526 showSelectedDates = true; 1526 showSelectedDates = true;
1527 } 1527 }
1528 break; 1528 break;
1529 case Qt::Key_J: 1529 case Qt::Key_J:
1530 mView->viewManager()->showJournalView(); 1530 mView->viewManager()->showJournalView();
1531 break; 1531 break;
1532 case Qt::Key_B: 1532 case Qt::Key_B:
1533 mView->editIncidenceDescription();; 1533 mView->editIncidenceDescription();;
1534 break; 1534 break;
1535 // case Qt::Key_Return: 1535 // case Qt::Key_Return:
1536 case Qt::Key_E: 1536 case Qt::Key_E:
1537 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1537 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1538 mView->newEvent(); 1538 mView->newEvent();
1539 else 1539 else
1540 mView->editIncidence(); 1540 mView->editIncidence();
1541 break; 1541 break;
1542 case Qt::Key_Plus: 1542 case Qt::Key_Plus:
1543 size = p->mHourSize +2; 1543 size = p->mHourSize +2;
1544 if ( size <= 18 ) 1544 if ( size <= 18 )
1545 configureAgenda( size ); 1545 configureAgenda( size );
1546 break; 1546 break;
1547 case Qt::Key_Minus: 1547 case Qt::Key_Minus:
1548 size = p->mHourSize - 2; 1548 size = p->mHourSize - 2;
1549 if ( size >= 4 ) 1549 if ( size >= 4 )
1550 configureAgenda( size ); 1550 configureAgenda( size );
1551 break; 1551 break;
1552 1552
1553 1553
1554 default: 1554 default:
1555 e->ignore(); 1555 e->ignore();
1556 } 1556 }
1557 if ( pro > 0 ) { 1557 if ( pro > 0 ) {
1558 mView->selectFilter( pro-1 ); 1558 mView->selectFilter( pro-1 );
1559 } 1559 }
1560 if ( showSelectedDates ) { 1560 if ( showSelectedDates ) {
1561 ;// setCaptionToDates(); 1561 ;// setCaptionToDates();
1562 } 1562 }
1563 1563
1564} 1564}
1565 1565
1566void MainWindow::fillFilterMenu() 1566void MainWindow::fillFilterMenu()
1567{ 1567{
1568 selectFilterMenu->clear(); 1568 selectFilterMenu->clear();
1569 bool disable = false; 1569 bool disable = false;
1570 if ( mView->filterView()->filtersEnabled() ) { 1570 if ( mView->filterView()->filtersEnabled() ) {
1571 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); 1571 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 );
1572 } 1572 }
1573 else { 1573 else {
1574 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); 1574 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 );
1575 disable = true; 1575 disable = true;
1576 } 1576 }
1577 selectFilterMenu->insertSeparator(); 1577 selectFilterMenu->insertSeparator();
1578 QPtrList<CalFilter> fili = mView->filters(); 1578 QPtrList<CalFilter> fili = mView->filters();
1579 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1579 CalFilter *curfilter = mView->filterView()->selectedFilter();
1580 CalFilter *filter = fili.first(); 1580 CalFilter *filter = fili.first();
1581 int iii = 1; 1581 int iii = 1;
1582 while(filter) { 1582 while(filter) {
1583 selectFilterMenu->insertItem( filter->name(), iii ); 1583 selectFilterMenu->insertItem( filter->name(), iii );
1584 if ( filter == curfilter) 1584 if ( filter == curfilter)
1585 selectFilterMenu->setItemChecked( iii, true ); 1585 selectFilterMenu->setItemChecked( iii, true );
1586 if ( disable ) 1586 if ( disable )
1587 selectFilterMenu->setItemEnabled( iii, false ); 1587 selectFilterMenu->setItemEnabled( iii, false );
1588 filter = fili.next(); 1588 filter = fili.next();
1589 ++iii; 1589 ++iii;
1590 } 1590 }
1591} 1591}
1592void MainWindow::selectFilter( int fil ) 1592void MainWindow::selectFilter( int fil )
1593{ 1593{
1594 if ( fil == 0 ) { 1594 if ( fil == 0 ) {
1595 mView->toggleFilerEnabled( ); 1595 mView->toggleFilerEnabled( );
1596 } else { 1596 } else {
1597 mView->selectFilter( fil-1 ); 1597 mView->selectFilter( fil-1 );
1598 } 1598 }
1599} 1599}
1600void MainWindow::configureToolBar( int item ) 1600void MainWindow::configureToolBar( int item )
1601{ 1601{
1602 1602
1603 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1603 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1604 KOPrefs *p = KOPrefs::instance(); 1604 KOPrefs *p = KOPrefs::instance();