-rw-r--r-- | korganizer/calendarview.cpp | 19 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 10 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 |
4 files changed, 28 insertions, 4 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 31e103d..8965d3b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1789,385 +1789,384 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1789 | 1789 | ||
1790 | } else { | 1790 | } else { |
1791 | checkExternSyncEvent(eventRSyncSharp, inR); | 1791 | checkExternSyncEvent(eventRSyncSharp, inR); |
1792 | remote->deleteIncidence( inR ); | 1792 | remote->deleteIncidence( inR ); |
1793 | ++deletedEventR; | 1793 | ++deletedEventR; |
1794 | } | 1794 | } |
1795 | } | 1795 | } |
1796 | } else { | 1796 | } else { |
1797 | ++filteredIN; | 1797 | ++filteredIN; |
1798 | } | 1798 | } |
1799 | } | 1799 | } |
1800 | } | 1800 | } |
1801 | inR = er.next(); | 1801 | inR = er.next(); |
1802 | } | 1802 | } |
1803 | QPtrList<Incidence> el = local->rawIncidences(); | 1803 | QPtrList<Incidence> el = local->rawIncidences(); |
1804 | inL = el.first(); | 1804 | inL = el.first(); |
1805 | modulo = (el.count()/10)+1; | 1805 | modulo = (el.count()/10)+1; |
1806 | bar.setCaption (i18n("Add / remove events") ); | 1806 | bar.setCaption (i18n("Add / remove events") ); |
1807 | bar.setTotalSteps ( el.count() ) ; | 1807 | bar.setTotalSteps ( el.count() ) ; |
1808 | bar.show(); | 1808 | bar.show(); |
1809 | incCounter = 0; | 1809 | incCounter = 0; |
1810 | 1810 | ||
1811 | while ( inL ) { | 1811 | while ( inL ) { |
1812 | 1812 | ||
1813 | qApp->processEvents(); | 1813 | qApp->processEvents(); |
1814 | if ( ! bar.isVisible() ) | 1814 | if ( ! bar.isVisible() ) |
1815 | return false; | 1815 | return false; |
1816 | if ( incCounter % modulo == 0 ) | 1816 | if ( incCounter % modulo == 0 ) |
1817 | bar.setProgress( incCounter ); | 1817 | bar.setProgress( incCounter ); |
1818 | ++incCounter; | 1818 | ++incCounter; |
1819 | uid = inL->uid(); | 1819 | uid = inL->uid(); |
1820 | bool skipIncidence = false; | 1820 | bool skipIncidence = false; |
1821 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1821 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1822 | skipIncidence = true; | 1822 | skipIncidence = true; |
1823 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) | 1823 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) |
1824 | skipIncidence = true; | 1824 | skipIncidence = true; |
1825 | if ( !skipIncidence ) { | 1825 | if ( !skipIncidence ) { |
1826 | inR = remote->incidenceForUid( uid , true ); | 1826 | inR = remote->incidenceForUid( uid , true ); |
1827 | if ( ! inR ) { | 1827 | if ( ! inR ) { |
1828 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ | 1828 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ |
1829 | // no conflict ********** add or delete local | 1829 | // no conflict ********** add or delete local |
1830 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1830 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1831 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1831 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1832 | checkExternSyncEvent(eventLSyncSharp, inL); | 1832 | checkExternSyncEvent(eventLSyncSharp, inL); |
1833 | local->deleteIncidence( inL ); | 1833 | local->deleteIncidence( inL ); |
1834 | ++deletedEventL; | 1834 | ++deletedEventL; |
1835 | } else { | 1835 | } else { |
1836 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1836 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1837 | inL->removeID(mCurrentSyncDevice ); | 1837 | inL->removeID(mCurrentSyncDevice ); |
1838 | ++addedEventR; | 1838 | ++addedEventR; |
1839 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1839 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1840 | inL->setLastModified( modifiedCalendar ); | 1840 | inL->setLastModified( modifiedCalendar ); |
1841 | inR = inL->clone(); | 1841 | inR = inL->clone(); |
1842 | inR->setIDStr( ":" ); | 1842 | inR->setIDStr( ":" ); |
1843 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1843 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1844 | inR->setCalID( 0 );// add to default cal | 1844 | inR->setCalID( 0 );// add to default cal |
1845 | remote->addIncidence( inR ); | 1845 | remote->addIncidence( inR ); |
1846 | } | 1846 | } |
1847 | } | 1847 | } |
1848 | } else { | 1848 | } else { |
1849 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1849 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1850 | checkExternSyncEvent(eventLSyncSharp, inL); | 1850 | checkExternSyncEvent(eventLSyncSharp, inL); |
1851 | local->deleteIncidence( inL ); | 1851 | local->deleteIncidence( inL ); |
1852 | ++deletedEventL; | 1852 | ++deletedEventL; |
1853 | } else { | 1853 | } else { |
1854 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1854 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1855 | ++addedEventR; | 1855 | ++addedEventR; |
1856 | inL->setLastModified( modifiedCalendar ); | 1856 | inL->setLastModified( modifiedCalendar ); |
1857 | inR = inL->clone(); | 1857 | inR = inL->clone(); |
1858 | inR->setIDStr( ":" ); | 1858 | inR->setIDStr( ":" ); |
1859 | inR->setCalID( 0 );// add to default cal | 1859 | inR->setCalID( 0 );// add to default cal |
1860 | remote->addIncidence( inR ); | 1860 | remote->addIncidence( inR ); |
1861 | } | 1861 | } |
1862 | } | 1862 | } |
1863 | } | 1863 | } |
1864 | } else { | 1864 | } else { |
1865 | ++filteredOUT; | 1865 | ++filteredOUT; |
1866 | } | 1866 | } |
1867 | } | 1867 | } |
1868 | } | 1868 | } |
1869 | inL = el.next(); | 1869 | inL = el.next(); |
1870 | } | 1870 | } |
1871 | int delFut = 0; | 1871 | int delFut = 0; |
1872 | int remRem = 0; | 1872 | int remRem = 0; |
1873 | if ( mSyncManager->mWriteBackInFuture ) { | 1873 | if ( mSyncManager->mWriteBackInFuture ) { |
1874 | er = remote->rawIncidences(); | 1874 | er = remote->rawIncidences(); |
1875 | remRem = er.count(); | 1875 | remRem = er.count(); |
1876 | inR = er.first(); | 1876 | inR = er.first(); |
1877 | QDateTime dt; | 1877 | QDateTime dt; |
1878 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); | 1878 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); |
1879 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); | 1879 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); |
1880 | while ( inR ) { | 1880 | while ( inR ) { |
1881 | if ( inR->typeID() == todoID ) { | 1881 | if ( inR->typeID() == todoID ) { |
1882 | Todo * t = (Todo*)inR; | 1882 | Todo * t = (Todo*)inR; |
1883 | if ( t->hasDueDate() ) | 1883 | if ( t->hasDueDate() ) |
1884 | dt = t->dtDue(); | 1884 | dt = t->dtDue(); |
1885 | else | 1885 | else |
1886 | dt = cur.addSecs( 62 ); | 1886 | dt = cur.addSecs( 62 ); |
1887 | } | 1887 | } |
1888 | else if (inR->typeID() == eventID ) { | 1888 | else if (inR->typeID() == eventID ) { |
1889 | bool ok; | 1889 | bool ok; |
1890 | dt = inR->getNextOccurence( cur, &ok ); | 1890 | dt = inR->getNextOccurence( cur, &ok ); |
1891 | if ( !ok ) | 1891 | if ( !ok ) |
1892 | dt = cur.addSecs( -62 ); | 1892 | dt = cur.addSecs( -62 ); |
1893 | } | 1893 | } |
1894 | else | 1894 | else |
1895 | dt = inR->dtStart(); | 1895 | dt = inR->dtStart(); |
1896 | if ( dt < cur || dt > end ) { | 1896 | if ( dt < cur || dt > end ) { |
1897 | remote->deleteIncidence( inR ); | 1897 | remote->deleteIncidence( inR ); |
1898 | ++delFut; | 1898 | ++delFut; |
1899 | } | 1899 | } |
1900 | inR = er.next(); | 1900 | inR = er.next(); |
1901 | } | 1901 | } |
1902 | } | 1902 | } |
1903 | bar.hide(); | 1903 | bar.hide(); |
1904 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1904 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1905 | eventLSync->setReadOnly( false ); | 1905 | eventLSync->setReadOnly( false ); |
1906 | eventLSync->setDtStart( mLastCalendarSync ); | 1906 | eventLSync->setDtStart( mLastCalendarSync ); |
1907 | eventRSync->setDtStart( mLastCalendarSync ); | 1907 | eventRSync->setDtStart( mLastCalendarSync ); |
1908 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1908 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1909 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1909 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1910 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1910 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1911 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1911 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1912 | eventLSync->setReadOnly( true ); | 1912 | eventLSync->setReadOnly( true ); |
1913 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); | 1913 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); |
1914 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... | 1914 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... |
1915 | remote->addEvent( eventRSync ); | 1915 | remote->addEvent( eventRSync ); |
1916 | else | 1916 | else |
1917 | delete eventRSync; | 1917 | delete eventRSync; |
1918 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); | 1918 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); |
1919 | QString mes; | 1919 | QString mes; |
1920 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); | 1920 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); |
1921 | QString delmess; | 1921 | QString delmess; |
1922 | if ( delFut ) { | 1922 | if ( delFut ) { |
1923 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); | 1923 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); |
1924 | mes += delmess; | 1924 | mes += delmess; |
1925 | } | 1925 | } |
1926 | mes = i18n("Local calendar changed!\n") +mes; | 1926 | mes = i18n("Local calendar changed!\n") +mes; |
1927 | mCalendar->checkAlarmForIncidence( 0, true ); | 1927 | mCalendar->checkAlarmForIncidence( 0, true ); |
1928 | qDebug( mes ); | 1928 | qDebug( mes ); |
1929 | if ( mSyncManager->mShowSyncSummary ) { | 1929 | if ( mSyncManager->mShowSyncSummary ) { |
1930 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 1930 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
1931 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { | 1931 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { |
1932 | qDebug("KO: WB cancelled "); | 1932 | qDebug("KO: WB cancelled "); |
1933 | mSyncManager->mWriteBackFile = false; | 1933 | mSyncManager->mWriteBackFile = false; |
1934 | return syncOK; | 1934 | return syncOK; |
1935 | } | 1935 | } |
1936 | } | 1936 | } |
1937 | return syncOK; | 1937 | return syncOK; |
1938 | } | 1938 | } |
1939 | 1939 | ||
1940 | void CalendarView::setSyncDevice( QString s ) | 1940 | void CalendarView::setSyncDevice( QString s ) |
1941 | { | 1941 | { |
1942 | mCurrentSyncDevice= s; | 1942 | mCurrentSyncDevice= s; |
1943 | } | 1943 | } |
1944 | void CalendarView::setSyncName( QString s ) | 1944 | void CalendarView::setSyncName( QString s ) |
1945 | { | 1945 | { |
1946 | mCurrentSyncName= s; | 1946 | mCurrentSyncName= s; |
1947 | } | 1947 | } |
1948 | bool CalendarView::syncCalendar(QString filename, int mode) | 1948 | bool CalendarView::syncCalendar(QString filename, int mode) |
1949 | { | 1949 | { |
1950 | //qDebug("syncCalendar %s ", filename.latin1()); | 1950 | //qDebug("syncCalendar %s ", filename.latin1()); |
1951 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1951 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1952 | CalendarLocal* calendar = new CalendarLocal(); | 1952 | CalendarLocal* calendar = new CalendarLocal(); |
1953 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1953 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1954 | FileStorage* storage = new FileStorage( calendar ); | 1954 | FileStorage* storage = new FileStorage( calendar ); |
1955 | bool syncOK = false; | 1955 | bool syncOK = false; |
1956 | storage->setFileName( filename ); | 1956 | storage->setFileName( filename ); |
1957 | // qDebug("loading ... "); | 1957 | // qDebug("loading ... "); |
1958 | if ( storage->load() ) { | 1958 | if ( storage->load() ) { |
1959 | getEventViewerDialog()->setSyncMode( true ); | 1959 | getEventViewerDialog()->setSyncMode( true ); |
1960 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1960 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1961 | getEventViewerDialog()->setSyncMode( false ); | 1961 | getEventViewerDialog()->setSyncMode( false ); |
1962 | if ( syncOK ) { | 1962 | if ( syncOK ) { |
1963 | if ( mSyncManager->mWriteBackFile ) | 1963 | if ( mSyncManager->mWriteBackFile ) |
1964 | { | 1964 | { |
1965 | storage->setSaveFormat( new ICalFormat() ); | 1965 | storage->setSaveFormat( new ICalFormat() ); |
1966 | storage->save(); | 1966 | storage->save(); |
1967 | } | 1967 | } |
1968 | } | 1968 | } |
1969 | setModified( true ); | 1969 | setModified( true ); |
1970 | } | 1970 | } |
1971 | delete storage; | 1971 | delete storage; |
1972 | delete calendar; | 1972 | delete calendar; |
1973 | if ( syncOK ) | 1973 | if ( syncOK ) |
1974 | updateView(); | 1974 | updateView(); |
1975 | return syncOK; | 1975 | return syncOK; |
1976 | } | 1976 | } |
1977 | 1977 | ||
1978 | void CalendarView::syncExternal( int mode ) | 1978 | void CalendarView::syncExternal( int mode ) |
1979 | { | 1979 | { |
1980 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1980 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1981 | |||
1982 | qApp->processEvents(); | 1981 | qApp->processEvents(); |
1983 | CalendarLocal* calendar = new CalendarLocal(); | 1982 | CalendarLocal* calendar = new CalendarLocal(); |
1984 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1983 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1985 | bool syncOK = false; | 1984 | bool syncOK = false; |
1986 | bool loadSuccess = false; | 1985 | bool loadSuccess = false; |
1987 | PhoneFormat* phoneFormat = 0; | 1986 | PhoneFormat* phoneFormat = 0; |
1988 | emit tempDisableBR(true); | 1987 | emit tempDisableBR(true); |
1989 | #ifndef DESKTOP_VERSION | 1988 | #ifndef DESKTOP_VERSION |
1990 | SharpFormat* sharpFormat = 0; | 1989 | SharpFormat* sharpFormat = 0; |
1991 | if ( mode == 0 ) { // sharp | 1990 | if ( mode == 0 ) { // sharp |
1992 | sharpFormat = new SharpFormat () ; | 1991 | sharpFormat = new SharpFormat () ; |
1993 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1992 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1994 | 1993 | ||
1995 | } else | 1994 | } else |
1996 | #endif | 1995 | #endif |
1997 | if ( mode == 1 ) { // phone | 1996 | if ( mode == 1 ) { // phone |
1998 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1997 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1999 | mSyncManager->mPhoneDevice, | 1998 | mSyncManager->mPhoneDevice, |
2000 | mSyncManager->mPhoneConnection, | 1999 | mSyncManager->mPhoneConnection, |
2001 | mSyncManager->mPhoneModel); | 2000 | mSyncManager->mPhoneModel); |
2002 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 2001 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
2003 | 2002 | ||
2004 | } else { | 2003 | } else { |
2005 | emit tempDisableBR(false); | 2004 | emit tempDisableBR(false); |
2006 | return; | 2005 | return; |
2007 | } | 2006 | } |
2008 | if ( loadSuccess ) { | 2007 | if ( loadSuccess ) { |
2009 | getEventViewerDialog()->setSyncMode( true ); | 2008 | getEventViewerDialog()->setSyncMode( true ); |
2010 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 2009 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
2011 | getEventViewerDialog()->setSyncMode( false ); | 2010 | getEventViewerDialog()->setSyncMode( false ); |
2012 | qApp->processEvents(); | 2011 | qApp->processEvents(); |
2013 | if ( syncOK ) { | 2012 | if ( syncOK ) { |
2014 | if ( mSyncManager->mWriteBackFile ) | 2013 | if ( mSyncManager->mWriteBackFile ) |
2015 | { | 2014 | { |
2016 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 2015 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
2017 | Incidence* inc = iL.first(); | 2016 | Incidence* inc = iL.first(); |
2018 | if ( phoneFormat ) { | 2017 | if ( phoneFormat ) { |
2019 | while ( inc ) { | 2018 | while ( inc ) { |
2020 | inc->removeID(mCurrentSyncDevice); | 2019 | inc->removeID(mCurrentSyncDevice); |
2021 | inc = iL.next(); | 2020 | inc = iL.next(); |
2022 | } | 2021 | } |
2023 | } | 2022 | } |
2024 | #ifndef DESKTOP_VERSION | 2023 | #ifndef DESKTOP_VERSION |
2025 | if ( sharpFormat ) | 2024 | if ( sharpFormat ) |
2026 | sharpFormat->save(calendar); | 2025 | sharpFormat->save(calendar); |
2027 | #endif | 2026 | #endif |
2028 | if ( phoneFormat ) | 2027 | if ( phoneFormat ) |
2029 | phoneFormat->save(calendar); | 2028 | phoneFormat->save(calendar); |
2030 | iL = calendar->rawIncidences(); | 2029 | iL = calendar->rawIncidences(); |
2031 | inc = iL.first(); | 2030 | inc = iL.first(); |
2032 | Incidence* loc; | 2031 | Incidence* loc; |
2033 | while ( inc ) { | 2032 | while ( inc ) { |
2034 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 2033 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
2035 | loc = mCalendar->incidence(inc->uid() ); | 2034 | loc = mCalendar->incidence(inc->uid() ); |
2036 | if ( loc ) { | 2035 | if ( loc ) { |
2037 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 2036 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
2038 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 2037 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
2039 | } | 2038 | } |
2040 | } | 2039 | } |
2041 | inc = iL.next(); | 2040 | inc = iL.next(); |
2042 | } | 2041 | } |
2043 | Incidence* lse = getLastSyncEvent(); | 2042 | Incidence* lse = getLastSyncEvent(); |
2044 | if ( lse ) { | 2043 | if ( lse ) { |
2045 | lse->setReadOnly( false ); | 2044 | lse->setReadOnly( false ); |
2046 | lse->setDescription( "" ); | 2045 | lse->setDescription( "" ); |
2047 | lse->setReadOnly( true ); | 2046 | lse->setReadOnly( true ); |
2048 | } | 2047 | } |
2049 | } | 2048 | } |
2050 | } else { | 2049 | } else { |
2051 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 2050 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
2052 | } | 2051 | } |
2053 | setModified( true ); | 2052 | setModified( true ); |
2054 | } else { | 2053 | } else { |
2055 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 2054 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
2056 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 2055 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
2057 | question, i18n("Ok")) ; | 2056 | question, i18n("Ok")) ; |
2058 | 2057 | ||
2059 | } | 2058 | } |
2060 | delete calendar; | 2059 | delete calendar; |
2061 | updateView(); | 2060 | updateView(); |
2062 | emit tempDisableBR(false); | 2061 | emit tempDisableBR(false); |
2063 | return ;//syncOK; | 2062 | return ;//syncOK; |
2064 | 2063 | ||
2065 | } | 2064 | } |
2066 | 2065 | ||
2067 | bool CalendarView::importBday() | 2066 | bool CalendarView::importBday() |
2068 | { | 2067 | { |
2069 | #ifndef KORG_NOKABC | 2068 | #ifndef KORG_NOKABC |
2070 | 2069 | ||
2071 | #ifdef DESKTOP_VERSION | 2070 | #ifdef DESKTOP_VERSION |
2072 | int curCal = mCalendar->defaultCalendar(); | 2071 | int curCal = mCalendar->defaultCalendar(); |
2073 | int bd = mCalEditView->getBirtdayID(); | 2072 | int bd = mCalEditView->getBirtdayID(); |
2074 | if ( bd == 0 ) | 2073 | if ( bd == 0 ) |
2075 | return false; | 2074 | return false; |
2076 | mCalendar->setDefaultCalendar( bd ); | 2075 | mCalendar->setDefaultCalendar( bd ); |
2077 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 2076 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
2078 | KABC::AddressBook::Iterator it; | 2077 | KABC::AddressBook::Iterator it; |
2079 | int count = 0; | 2078 | int count = 0; |
2080 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 2079 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
2081 | ++count; | 2080 | ++count; |
2082 | } | 2081 | } |
2083 | QProgressBar bar(count,0 ); | 2082 | QProgressBar bar(count,0 ); |
2084 | int w = 300; | 2083 | int w = 300; |
2085 | if ( QApplication::desktop()->width() < 320 ) | 2084 | if ( QApplication::desktop()->width() < 320 ) |
2086 | w = 220; | 2085 | w = 220; |
2087 | int h = bar.sizeHint().height() ; | 2086 | int h = bar.sizeHint().height() ; |
2088 | int dw = QApplication::desktop()->width(); | 2087 | int dw = QApplication::desktop()->width(); |
2089 | int dh = QApplication::desktop()->height(); | 2088 | int dh = QApplication::desktop()->height(); |
2090 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2089 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2091 | bar.show(); | 2090 | bar.show(); |
2092 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 2091 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
2093 | qApp->processEvents(); | 2092 | qApp->processEvents(); |
2094 | count = 0; | 2093 | count = 0; |
2095 | int addCount = 0; | 2094 | int addCount = 0; |
2096 | KCal::Attendee* a = 0; | 2095 | KCal::Attendee* a = 0; |
2097 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 2096 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
2098 | if ( ! bar.isVisible() ) | 2097 | if ( ! bar.isVisible() ) |
2099 | return false; | 2098 | return false; |
2100 | bar.setProgress( count++ ); | 2099 | bar.setProgress( count++ ); |
2101 | qApp->processEvents(); | 2100 | qApp->processEvents(); |
2102 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 2101 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
2103 | if ( (*it).birthday().date().isValid() ){ | 2102 | if ( (*it).birthday().date().isValid() ){ |
2104 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 2103 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
2105 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 2104 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
2106 | ++addCount; | 2105 | ++addCount; |
2107 | } | 2106 | } |
2108 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 2107 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
2109 | if ( anni.isValid() ){ | 2108 | if ( anni.isValid() ){ |
2110 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 2109 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
2111 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 2110 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
2112 | ++addCount; | 2111 | ++addCount; |
2113 | } | 2112 | } |
2114 | } | 2113 | } |
2115 | mCalendar->setDefaultCalendar( curCal ); | 2114 | mCalendar->setDefaultCalendar( curCal ); |
2116 | updateView(); | 2115 | updateView(); |
2117 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 2116 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
2118 | #else //DESKTOP_VERSION | 2117 | #else //DESKTOP_VERSION |
2119 | 2118 | ||
2120 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 2119 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
2121 | // the result should now arrive through method insertBirthdays | 2120 | // the result should now arrive through method insertBirthdays |
2122 | 2121 | ||
2123 | #endif //DESKTOP_VERSION | 2122 | #endif //DESKTOP_VERSION |
2124 | 2123 | ||
2125 | #endif //KORG_NOKABC | 2124 | #endif //KORG_NOKABC |
2126 | 2125 | ||
2127 | 2126 | ||
2128 | return true; | 2127 | return true; |
2129 | } | 2128 | } |
2130 | 2129 | ||
2131 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | 2130 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI |
2132 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 2131 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, |
2133 | const QStringList& anniversaryList, const QStringList& realNameList, | 2132 | const QStringList& anniversaryList, const QStringList& realNameList, |
2134 | const QStringList& emailList, const QStringList& assembledNameList, | 2133 | const QStringList& emailList, const QStringList& assembledNameList, |
2135 | const QStringList& uidList) | 2134 | const QStringList& uidList) |
2136 | { | 2135 | { |
2137 | 2136 | ||
2138 | //qDebug("KO::CalendarView::insertBirthdays"); | 2137 | //qDebug("KO::CalendarView::insertBirthdays"); |
2139 | if (uid == this->name()) | 2138 | if (uid == this->name()) |
2140 | { | 2139 | { |
2141 | int curCal = mCalendar->defaultCalendar(); | 2140 | int curCal = mCalendar->defaultCalendar(); |
2142 | int bd = mCalEditView->getBirtdayID(); | 2141 | int bd = mCalEditView->getBirtdayID(); |
2143 | if ( bd == 0 ) | 2142 | if ( bd == 0 ) |
2144 | return; | 2143 | return; |
2145 | mCalendar->setDefaultCalendar( bd ); | 2144 | mCalendar->setDefaultCalendar( bd ); |
2146 | 2145 | ||
2147 | 2146 | ||
2148 | int count = birthdayList.count(); | 2147 | int count = birthdayList.count(); |
2149 | int addCount = 0; | 2148 | int addCount = 0; |
2150 | KCal::Attendee* a = 0; | 2149 | KCal::Attendee* a = 0; |
2151 | 2150 | ||
2152 | //qDebug("CalView 1 %i", count); | 2151 | //qDebug("CalView 1 %i", count); |
2153 | 2152 | ||
2154 | QProgressBar bar(count,0 ); | 2153 | QProgressBar bar(count,0 ); |
2155 | int w = 300; | 2154 | int w = 300; |
2156 | if ( QApplication::desktop()->width() < 320 ) | 2155 | if ( QApplication::desktop()->width() < 320 ) |
2157 | w = 220; | 2156 | w = 220; |
2158 | int h = bar.sizeHint().height() ; | 2157 | int h = bar.sizeHint().height() ; |
2159 | int dw = QApplication::desktop()->width(); | 2158 | int dw = QApplication::desktop()->width(); |
2160 | int dh = QApplication::desktop()->height(); | 2159 | int dh = QApplication::desktop()->height(); |
2161 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2160 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2162 | bar.show(); | 2161 | bar.show(); |
2163 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | 2162 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); |
2164 | qApp->processEvents(); | 2163 | qApp->processEvents(); |
2165 | 2164 | ||
2166 | QDate birthday; | 2165 | QDate birthday; |
2167 | QDate anniversary; | 2166 | QDate anniversary; |
2168 | QString realName; | 2167 | QString realName; |
2169 | QString email; | 2168 | QString email; |
2170 | QString assembledName; | 2169 | QString assembledName; |
2171 | QString uid; | 2170 | QString uid; |
2172 | bool ok = true; | 2171 | bool ok = true; |
2173 | for ( int i = 0; i < count; i++) | 2172 | for ( int i = 0; i < count; i++) |
@@ -4845,332 +4844,346 @@ void CalendarView::toggleAllDaySize() | |||
4845 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 4844 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
4846 | */ | 4845 | */ |
4847 | viewManager()->agendaView()->toggleAllDay(); | 4846 | viewManager()->agendaView()->toggleAllDay(); |
4848 | } | 4847 | } |
4849 | void CalendarView::toggleExpand() | 4848 | void CalendarView::toggleExpand() |
4850 | { | 4849 | { |
4851 | // if ( mLeftFrame->isHidden() ) { | 4850 | // if ( mLeftFrame->isHidden() ) { |
4852 | // mLeftFrame->show(); | 4851 | // mLeftFrame->show(); |
4853 | // emit calendarViewExpanded( false ); | 4852 | // emit calendarViewExpanded( false ); |
4854 | // } else { | 4853 | // } else { |
4855 | // mLeftFrame->hide(); | 4854 | // mLeftFrame->hide(); |
4856 | // emit calendarViewExpanded( true ); | 4855 | // emit calendarViewExpanded( true ); |
4857 | // } | 4856 | // } |
4858 | //qDebug(" CalendarView::toggleExpand()"); | 4857 | //qDebug(" CalendarView::toggleExpand()"); |
4859 | globalFlagBlockAgenda = 1; | 4858 | globalFlagBlockAgenda = 1; |
4860 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 4859 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
4861 | globalFlagBlockAgenda = 5; | 4860 | globalFlagBlockAgenda = 5; |
4862 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 4861 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
4863 | //mViewManager->showView( 0, true ); | 4862 | //mViewManager->showView( 0, true ); |
4864 | } | 4863 | } |
4865 | 4864 | ||
4866 | void CalendarView::calendarModified( bool modified, Calendar * ) | 4865 | void CalendarView::calendarModified( bool modified, Calendar * ) |
4867 | { | 4866 | { |
4868 | setModified( modified ); | 4867 | setModified( modified ); |
4869 | } | 4868 | } |
4870 | 4869 | ||
4871 | Todo *CalendarView::selectedTodo() | 4870 | Todo *CalendarView::selectedTodo() |
4872 | { | 4871 | { |
4873 | Incidence *incidence = currentSelection(); | 4872 | Incidence *incidence = currentSelection(); |
4874 | if ( incidence && incidence->typeID() == todoID ) { | 4873 | if ( incidence && incidence->typeID() == todoID ) { |
4875 | return static_cast<Todo *>( incidence ); | 4874 | return static_cast<Todo *>( incidence ); |
4876 | } | 4875 | } |
4877 | 4876 | ||
4878 | incidence = mTodoList->selectedIncidences().first(); | 4877 | incidence = mTodoList->selectedIncidences().first(); |
4879 | if ( incidence && incidence->typeID() == todoID ) { | 4878 | if ( incidence && incidence->typeID() == todoID ) { |
4880 | return static_cast<Todo *>( incidence ); | 4879 | return static_cast<Todo *>( incidence ); |
4881 | } | 4880 | } |
4882 | 4881 | ||
4883 | return 0; | 4882 | return 0; |
4884 | } | 4883 | } |
4885 | 4884 | ||
4886 | void CalendarView::showIncidence() | 4885 | void CalendarView::showIncidence() |
4887 | { | 4886 | { |
4888 | mViewerCallerIsSearchDialog = false; | 4887 | mViewerCallerIsSearchDialog = false; |
4889 | Incidence *incidence = currentSelection(); | 4888 | Incidence *incidence = currentSelection(); |
4890 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 4889 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
4891 | if ( incidence ) { | 4890 | if ( incidence ) { |
4892 | ShowIncidenceVisitor v; | 4891 | ShowIncidenceVisitor v; |
4893 | v.act( incidence, this ); | 4892 | v.act( incidence, this ); |
4894 | } | 4893 | } |
4895 | } | 4894 | } |
4896 | void CalendarView::editIncidenceDescription() | 4895 | void CalendarView::editIncidenceDescription() |
4897 | { | 4896 | { |
4898 | mFlagEditDescription = true; | 4897 | mFlagEditDescription = true; |
4899 | editIncidence(); | 4898 | editIncidence(); |
4900 | mFlagEditDescription = false; | 4899 | mFlagEditDescription = false; |
4901 | } | 4900 | } |
4902 | void CalendarView::editIncidence() | 4901 | void CalendarView::editIncidence() |
4903 | { | 4902 | { |
4904 | // qDebug("editIncidence() "); | 4903 | // qDebug("editIncidence() "); |
4905 | Incidence *incidence = currentSelection(); | 4904 | Incidence *incidence = currentSelection(); |
4906 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 4905 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
4907 | if ( incidence ) { | 4906 | if ( incidence ) { |
4908 | EditIncidenceVisitor v; | 4907 | EditIncidenceVisitor v; |
4909 | v.act( incidence, this ); | 4908 | v.act( incidence, this ); |
4910 | } | 4909 | } |
4911 | } | 4910 | } |
4912 | 4911 | ||
4913 | void CalendarView::deleteIncidence() | 4912 | void CalendarView::deleteIncidence() |
4914 | { | 4913 | { |
4915 | Incidence *incidence = currentSelection(); | 4914 | Incidence *incidence = currentSelection(); |
4916 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 4915 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
4917 | if ( incidence ) { | 4916 | if ( incidence ) { |
4918 | deleteIncidence(incidence); | 4917 | deleteIncidence(incidence); |
4919 | } | 4918 | } |
4920 | } | 4919 | } |
4921 | void CalendarView::showIncidence(QString uid) | 4920 | void CalendarView::showIncidence(QString uid) |
4922 | { | 4921 | { |
4923 | Incidence *inc = mCalendar->incidence( uid ); | 4922 | Incidence *inc = mCalendar->incidence( uid ); |
4924 | if ( inc ) | 4923 | if ( inc ) |
4925 | showIncidence( inc ); | 4924 | showIncidence( inc ); |
4926 | } | 4925 | } |
4927 | void CalendarView::showIncidence(Incidence *incidence) | 4926 | void CalendarView::showIncidence(Incidence *incidence) |
4928 | { | 4927 | { |
4929 | mViewerCallerIsSearchDialog = false; | 4928 | mViewerCallerIsSearchDialog = false; |
4930 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); | 4929 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); |
4931 | if ( sender() && mDialogManager->getSearchDialog() ) { | 4930 | if ( sender() && mDialogManager->getSearchDialog() ) { |
4932 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { | 4931 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { |
4933 | mViewerCallerIsSearchDialog = true; | 4932 | mViewerCallerIsSearchDialog = true; |
4934 | } | 4933 | } |
4935 | } | 4934 | } |
4936 | if ( incidence ) { | 4935 | if ( incidence ) { |
4937 | ShowIncidenceVisitor v; | 4936 | ShowIncidenceVisitor v; |
4938 | v.act( incidence, this ); | 4937 | v.act( incidence, this ); |
4939 | } | 4938 | } |
4940 | } | 4939 | } |
4941 | 4940 | ||
4942 | void CalendarView::editIncidence(Incidence *incidence) | 4941 | void CalendarView::editIncidence(Incidence *incidence) |
4943 | { | 4942 | { |
4944 | if ( incidence ) { | 4943 | if ( incidence ) { |
4945 | 4944 | ||
4946 | EditIncidenceVisitor v; | 4945 | EditIncidenceVisitor v; |
4947 | v.act( incidence, this ); | 4946 | v.act( incidence, this ); |
4948 | 4947 | ||
4949 | } | 4948 | } |
4950 | } | 4949 | } |
4951 | 4950 | ||
4952 | void CalendarView::deleteIncidence(Incidence *incidence) | 4951 | void CalendarView::deleteIncidence(Incidence *incidence) |
4953 | { | 4952 | { |
4954 | //qDebug(" CalendarView::deleteIncidence "); | 4953 | //qDebug(" CalendarView::deleteIncidence "); |
4955 | if ( incidence == 0 ) { | 4954 | if ( incidence == 0 ) { |
4956 | updateView(); | 4955 | updateView(); |
4957 | emit updateSearchDialog(); | 4956 | emit updateSearchDialog(); |
4958 | return; | 4957 | return; |
4959 | } | 4958 | } |
4960 | if ( incidence ) { | 4959 | if ( incidence ) { |
4961 | DeleteIncidenceVisitor v; | 4960 | DeleteIncidenceVisitor v; |
4962 | v.act( incidence, this ); | 4961 | v.act( incidence, this ); |
4963 | } | 4962 | } |
4964 | } | 4963 | } |
4965 | 4964 | ||
4966 | 4965 | ||
4967 | void CalendarView::lookForOutgoingMessages() | 4966 | void CalendarView::lookForOutgoingMessages() |
4968 | { | 4967 | { |
4969 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 4968 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
4970 | ogd->loadMessages(); | 4969 | ogd->loadMessages(); |
4971 | } | 4970 | } |
4972 | 4971 | ||
4973 | void CalendarView::lookForIncomingMessages() | 4972 | void CalendarView::lookForIncomingMessages() |
4974 | { | 4973 | { |
4975 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 4974 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
4976 | icd->retrieve(); | 4975 | icd->retrieve(); |
4977 | } | 4976 | } |
4978 | 4977 | ||
4979 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 4978 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
4980 | { | 4979 | { |
4981 | bool deleteTodo = true; | 4980 | bool deleteTodo = true; |
4982 | QPtrList<Incidence> subTodos; | 4981 | QPtrList<Incidence> subTodos; |
4983 | Incidence *aTodo; | 4982 | Incidence *aTodo; |
4984 | subTodos = t->relations(); | 4983 | subTodos = t->relations(); |
4985 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 4984 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
4986 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 4985 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
4987 | deleteTodo = false; | 4986 | deleteTodo = false; |
4988 | } | 4987 | } |
4989 | if ( deleteTodo ) { | 4988 | if ( deleteTodo ) { |
4990 | if ( t->isCompleted() && !t->doesRecur()) { | 4989 | if ( t->isCompleted() && !t->doesRecur()) { |
4991 | checkExternalId( t ); | 4990 | checkExternalId( t ); |
4992 | mCalendar->deleteTodo( t ); | 4991 | mCalendar->deleteTodo( t ); |
4993 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 4992 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
4994 | } | 4993 | } |
4995 | else | 4994 | else |
4996 | deleteTodo = false; | 4995 | deleteTodo = false; |
4997 | } | 4996 | } |
4998 | return deleteTodo; | 4997 | return deleteTodo; |
4999 | 4998 | ||
5000 | } | 4999 | } |
5001 | void CalendarView::purgeCompleted() | 5000 | void CalendarView::purgeCompleted() |
5002 | { | 5001 | { |
5003 | int result = KMessageBox::warningContinueCancel(this, | 5002 | int result = KMessageBox::warningContinueCancel(this, |
5004 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); | 5003 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); |
5005 | 5004 | ||
5006 | if (result == KMessageBox::Continue) { | 5005 | if (result == KMessageBox::Continue) { |
5007 | 5006 | ||
5008 | QPtrList<Todo> todoCal; | 5007 | QPtrList<Todo> todoCal; |
5009 | QPtrList<Todo> rootTodos; | 5008 | QPtrList<Todo> rootTodos; |
5010 | //QPtrList<Incidence> rel; | 5009 | //QPtrList<Incidence> rel; |
5011 | Todo *aTodo; | 5010 | Todo *aTodo; |
5012 | todoCal = calendar()->todos(); | 5011 | todoCal = calendar()->todos(); |
5013 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 5012 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
5014 | if ( !aTodo->relatedTo() ) | 5013 | if ( !aTodo->relatedTo() ) |
5015 | rootTodos.append( aTodo ); | 5014 | rootTodos.append( aTodo ); |
5016 | } | 5015 | } |
5017 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 5016 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
5018 | removeCompletedSubTodos( aTodo ); | 5017 | removeCompletedSubTodos( aTodo ); |
5019 | } | 5018 | } |
5020 | 5019 | ||
5021 | updateView(); | 5020 | updateView(); |
5022 | } | 5021 | } |
5023 | } | 5022 | } |
5024 | 5023 | ||
5025 | void CalendarView::slotCalendarChanged() | 5024 | void CalendarView::slotCalendarChanged() |
5026 | { | 5025 | { |
5027 | ; | 5026 | ; |
5028 | } | 5027 | } |
5029 | 5028 | ||
5030 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 5029 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
5031 | { | 5030 | { |
5032 | //qDebug("CalendarView::keyPressEvent "); | 5031 | //qDebug("CalendarView::keyPressEvent "); |
5033 | e->ignore(); | 5032 | e->ignore(); |
5034 | } | 5033 | } |
5035 | 5034 | ||
5036 | 5035 | ||
5037 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 5036 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode,QString resource) |
5038 | { | 5037 | { |
5039 | 5038 | ||
5040 | if ( manager != mSyncManager) | 5039 | if ( manager != mSyncManager) |
5041 | qDebug("KO: Internal error-1. SyncManager mismatch "); | 5040 | qDebug("KO: Internal error-1. SyncManager mismatch "); |
5042 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 5041 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
5043 | qDebug("KO: SyncKDE request detected!"); | 5042 | qDebug("KO: SyncKDE request detected!"); |
5044 | } | 5043 | } |
5045 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 5044 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
5046 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 5045 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
5047 | return syncCalendar( filename, mode ); | 5046 | if ( !resource.isEmpty() ) { |
5047 | int exclusiveSyncResource = KOPrefs::instance()->getFuzzyCalendarID( resource ); | ||
5048 | qDebug( "KO: Sync request for resource: %s", resource.latin1() ); | ||
5049 | |||
5050 | if ( !exclusiveSyncResource ) { | ||
5051 | qDebug( "KO: Requested sync resource not found: %s", resource.latin1() ); | ||
5052 | return false; | ||
5053 | } | ||
5054 | mCalendar->setDefaultCalendar( exclusiveSyncResource ); | ||
5055 | mCalendar->setDefaultCalendarEnabledOnly(); | ||
5056 | } | ||
5057 | bool result = syncCalendar( filename, mode ); | ||
5058 | if ( !resource.isEmpty() ) | ||
5059 | restoreCalendarSettings(); | ||
5060 | return result; | ||
5048 | } | 5061 | } |
5049 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 5062 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
5050 | { | 5063 | { |
5051 | //mSyncManager = manager; | 5064 | //mSyncManager = manager; |
5052 | if ( manager != mSyncManager) | 5065 | if ( manager != mSyncManager) |
5053 | qDebug("KO: Internal error-2. SyncManager mismatch "); | 5066 | qDebug("KO: Internal error-2. SyncManager mismatch "); |
5054 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 5067 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
5055 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 5068 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
5056 | if ( resource == "sharp" ) | 5069 | if ( resource == "sharp" ) |
5057 | syncExternal( 0 ); | 5070 | syncExternal( 0 ); |
5058 | if ( resource == "phone" ) | 5071 | if ( resource == "phone" ) |
5059 | syncExternal( 1 ); | 5072 | syncExternal( 1 ); |
5060 | // pending setmodified | 5073 | // pending setmodified |
5061 | return true; | 5074 | return true; |
5062 | } | 5075 | } |
5063 | void CalendarView::setSyncManager(KSyncManager* manager) | 5076 | void CalendarView::setSyncManager(KSyncManager* manager) |
5064 | { | 5077 | { |
5065 | mSyncManager = manager; | 5078 | mSyncManager = manager; |
5066 | } | 5079 | } |
5067 | 5080 | ||
5068 | void CalendarView::removeSyncInfo( QString syncProfile) | 5081 | void CalendarView::removeSyncInfo( QString syncProfile) |
5069 | { | 5082 | { |
5070 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 5083 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
5071 | mCalendar->removeSyncInfo( syncProfile ); | 5084 | mCalendar->removeSyncInfo( syncProfile ); |
5072 | 5085 | ||
5073 | } | 5086 | } |
5074 | 5087 | ||
5075 | void CalendarView::undo_delete() | 5088 | void CalendarView::undo_delete() |
5076 | { | 5089 | { |
5077 | //qDebug("undo_delete() "); | 5090 | //qDebug("undo_delete() "); |
5078 | Incidence* undo = mCalendar->undoIncidence(); | 5091 | Incidence* undo = mCalendar->undoIncidence(); |
5079 | if ( !undo ) { | 5092 | if ( !undo ) { |
5080 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 5093 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
5081 | i18n("KO/Pi")); | 5094 | i18n("KO/Pi")); |
5082 | return; | 5095 | return; |
5083 | } | 5096 | } |
5084 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( undo->summary(),0 ) + | 5097 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( undo->summary(),0 ) + |
5085 | i18n("\nAre you sure you want\nto restore this?"), | 5098 | i18n("\nAre you sure you want\nto restore this?"), |
5086 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 5099 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
5087 | mCalendar->undoDeleteIncidence(); | 5100 | mCalendar->undoDeleteIncidence(); |
5088 | updateView(); | 5101 | updateView(); |
5089 | } | 5102 | } |
5090 | } | 5103 | } |
5091 | 5104 | ||
5092 | void CalendarView::slotViewerClosed() | 5105 | void CalendarView::slotViewerClosed() |
5093 | { | 5106 | { |
5094 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); | 5107 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); |
5095 | } | 5108 | } |
5096 | 5109 | ||
5097 | void CalendarView::resetFocus() | 5110 | void CalendarView::resetFocus() |
5098 | { | 5111 | { |
5099 | if ( mViewerCallerIsSearchDialog ) { | 5112 | if ( mViewerCallerIsSearchDialog ) { |
5100 | if ( mDialogManager->getSearchDialog()->isVisible() ){ | 5113 | if ( mDialogManager->getSearchDialog()->isVisible() ){ |
5101 | mDialogManager->getSearchDialog()->raise(); | 5114 | mDialogManager->getSearchDialog()->raise(); |
5102 | mDialogManager->getSearchDialog()->setActiveWindow(); | 5115 | mDialogManager->getSearchDialog()->setActiveWindow(); |
5103 | mDialogManager->getSearchDialog()->listview()->resetFocus(); | 5116 | mDialogManager->getSearchDialog()->listview()->resetFocus(); |
5104 | } else | 5117 | } else |
5105 | mViewerCallerIsSearchDialog = false; | 5118 | mViewerCallerIsSearchDialog = false; |
5106 | } | 5119 | } |
5107 | if ( !mViewerCallerIsSearchDialog ) { | 5120 | if ( !mViewerCallerIsSearchDialog ) { |
5108 | //mViewManager->currentView()->setFocus(); | 5121 | //mViewManager->currentView()->setFocus(); |
5109 | //qDebug("sssssssssssssssset focus "); | 5122 | //qDebug("sssssssssssssssset focus "); |
5110 | topLevelWidget()->raise(); | 5123 | topLevelWidget()->raise(); |
5111 | setActiveWindow(); | 5124 | setActiveWindow(); |
5112 | //setFocus(); | 5125 | //setFocus(); |
5113 | } | 5126 | } |
5114 | mViewerCallerIsSearchDialog = false; | 5127 | mViewerCallerIsSearchDialog = false; |
5115 | } | 5128 | } |
5116 | 5129 | ||
5117 | void CalendarView::showNextAlarms() | 5130 | void CalendarView::showNextAlarms() |
5118 | { | 5131 | { |
5119 | QString message; | 5132 | QString message; |
5120 | QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); | 5133 | QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); |
5121 | if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { | 5134 | if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { |
5122 | QString sum = mCalendar->nextSummary(); | 5135 | QString sum = mCalendar->nextSummary(); |
5123 | QDateTime nextA = mNextAlarmDateTime; | 5136 | QDateTime nextA = mNextAlarmDateTime; |
5124 | QDateTime cur = QDateTime::currentDateTime(); | 5137 | QDateTime cur = QDateTime::currentDateTime(); |
5125 | int secs = cur.secsTo( nextA ); | 5138 | int secs = cur.secsTo( nextA ); |
5126 | int min = secs /60; | 5139 | int min = secs /60; |
5127 | int hours = min /60; | 5140 | int hours = min /60; |
5128 | min = min % 60; | 5141 | min = min % 60; |
5129 | int days = hours /24; | 5142 | int days = hours /24; |
5130 | hours = hours % 24; | 5143 | hours = hours % 24; |
5131 | 5144 | ||
5132 | //message = i18n("The next alarm is in:\n"); | 5145 | //message = i18n("The next alarm is in:\n"); |
5133 | if ( days > 1 ) | 5146 | if ( days > 1 ) |
5134 | message += i18n("%1 days\n").arg( days ); | 5147 | message += i18n("%1 days\n").arg( days ); |
5135 | else if ( days == 1 ) | 5148 | else if ( days == 1 ) |
5136 | message += i18n("1 day\n"); | 5149 | message += i18n("1 day\n"); |
5137 | if ( hours > 1 ) | 5150 | if ( hours > 1 ) |
5138 | message += i18n("%1 hours\n").arg( hours ); | 5151 | message += i18n("%1 hours\n").arg( hours ); |
5139 | else if ( hours == 1 ) | 5152 | else if ( hours == 1 ) |
5140 | message += i18n("1 hour\n"); | 5153 | message += i18n("1 hour\n"); |
5141 | if ( min > 1 ) | 5154 | if ( min > 1 ) |
5142 | message += i18n("%1 minutes\n").arg( min ); | 5155 | message += i18n("%1 minutes\n").arg( min ); |
5143 | else if ( min == 1 ) | 5156 | else if ( min == 1 ) |
5144 | message += i18n("1 minute\n"); | 5157 | message += i18n("1 minute\n"); |
5145 | if ( message.isEmpty() ) | 5158 | if ( message.isEmpty() ) |
5146 | message = i18n("The next alarm is in\nless than one minute!"); | 5159 | message = i18n("The next alarm is in\nless than one minute!"); |
5147 | else | 5160 | else |
5148 | message = i18n("The next alarm is in:\n") + message; | 5161 | message = i18n("The next alarm is in:\n") + message; |
5149 | message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; | 5162 | message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; |
5150 | } else { | 5163 | } else { |
5151 | message = i18n("There is no next alarm."); | 5164 | message = i18n("There is no next alarm."); |
5152 | 5165 | ||
5153 | } | 5166 | } |
5154 | #ifdef DESKTOP_VERSION | 5167 | #ifdef DESKTOP_VERSION |
5155 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 5168 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
5156 | message += i18n("\nThe internal alarm notification is disabled!\n"); | 5169 | message += i18n("\nThe internal alarm notification is disabled!\n"); |
5157 | message += i18n("Enable it in the settings menu, TAB alarm."); | 5170 | message += i18n("Enable it in the settings menu, TAB alarm."); |
5158 | } | 5171 | } |
5159 | 5172 | ||
5160 | #endif | 5173 | #endif |
5161 | KMessageBox::information( this, message); | 5174 | KMessageBox::information( this, message); |
5162 | } | 5175 | } |
5163 | 5176 | ||
5164 | void CalendarView::displayCalendarInfo( int id ) | 5177 | void CalendarView::displayCalendarInfo( int id ) |
5165 | { | 5178 | { |
5166 | int e, t,j; | 5179 | int e, t,j; |
5167 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); | 5180 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); |
5168 | QString name = kkf->mName; | 5181 | QString name = kkf->mName; |
5169 | mCalendar->getIncidenceCount( id, e, t, j ); | 5182 | mCalendar->getIncidenceCount( id, e, t, j ); |
5170 | QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); | 5183 | QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); |
5171 | QString mess = i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file); | 5184 | QString mess = i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file); |
5172 | mess += i18n("<br>The calendar contains<br><b>%1 events<br>%2 todos<br>%3 journals</b>").arg( e ).arg( t ).arg( j ); | 5185 | mess += i18n("<br>The calendar contains<br><b>%1 events<br>%2 todos<br>%3 journals</b>").arg( e ).arg( t ).arg( j ); |
5173 | KMessageBox::information( this, mess ); | 5186 | KMessageBox::information( this, mess ); |
5174 | 5187 | ||
5175 | 5188 | ||
5176 | } | 5189 | } |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 80f7ed4..f85b6a3 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -329,347 +329,347 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
329 | void readFilterSettings(KConfig *config); | 329 | void readFilterSettings(KConfig *config); |
330 | 330 | ||
331 | /** write settings for calendar filters */ | 331 | /** write settings for calendar filters */ |
332 | void writeFilterSettings(KConfig *config); | 332 | void writeFilterSettings(KConfig *config); |
333 | 333 | ||
334 | /** passes on the message that an event has changed to the currently | 334 | /** passes on the message that an event has changed to the currently |
335 | * activated view so that it can make appropriate display changes. */ | 335 | * activated view so that it can make appropriate display changes. */ |
336 | void changeEventDisplay(Event *, int); | 336 | void changeEventDisplay(Event *, int); |
337 | void changeIncidenceDisplay(Incidence *, int); | 337 | void changeIncidenceDisplay(Incidence *, int); |
338 | void changeTodoDisplay(Todo *, int); | 338 | void changeTodoDisplay(Todo *, int); |
339 | 339 | ||
340 | void eventAdded(Event *); | 340 | void eventAdded(Event *); |
341 | void eventChanged(Event *); | 341 | void eventChanged(Event *); |
342 | void eventToBeDeleted(Event *); | 342 | void eventToBeDeleted(Event *); |
343 | void eventDeleted(); | 343 | void eventDeleted(); |
344 | 344 | ||
345 | void todoAdded(Todo *); | 345 | void todoAdded(Todo *); |
346 | void todoChanged(Todo *); | 346 | void todoChanged(Todo *); |
347 | void todoToBeDeleted(Todo *); | 347 | void todoToBeDeleted(Todo *); |
348 | void todoDeleted(); | 348 | void todoDeleted(); |
349 | 349 | ||
350 | void updateView(const QDate &start, const QDate &end); | 350 | void updateView(const QDate &start, const QDate &end); |
351 | void updateView(); | 351 | void updateView(); |
352 | void clearAllViews(); | 352 | void clearAllViews(); |
353 | 353 | ||
354 | /** Full update of visible todo views */ | 354 | /** Full update of visible todo views */ |
355 | void updateTodoViews(); | 355 | void updateTodoViews(); |
356 | 356 | ||
357 | void updateUnmanagedViews(); | 357 | void updateUnmanagedViews(); |
358 | 358 | ||
359 | /** cut the current appointment to the clipboard */ | 359 | /** cut the current appointment to the clipboard */ |
360 | void edit_cut(); | 360 | void edit_cut(); |
361 | 361 | ||
362 | /** copy the current appointment(s) to the clipboard */ | 362 | /** copy the current appointment(s) to the clipboard */ |
363 | void edit_copy(); | 363 | void edit_copy(); |
364 | 364 | ||
365 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 365 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
366 | void edit_paste(); | 366 | void edit_paste(); |
367 | 367 | ||
368 | /** edit viewing and configuration options. */ | 368 | /** edit viewing and configuration options. */ |
369 | void edit_options(); | 369 | void edit_options(); |
370 | void edit_global_options(); | 370 | void edit_global_options(); |
371 | /** | 371 | /** |
372 | Functions for printing, previewing a print, and setting up printing | 372 | Functions for printing, previewing a print, and setting up printing |
373 | parameters. | 373 | parameters. |
374 | */ | 374 | */ |
375 | void print(); | 375 | void print(); |
376 | void printSetup(); | 376 | void printSetup(); |
377 | void printPreview(); | 377 | void printPreview(); |
378 | 378 | ||
379 | /** Export as iCalendar file */ | 379 | /** Export as iCalendar file */ |
380 | bool exportICalendar(); | 380 | bool exportICalendar(); |
381 | bool exportICalendar( QString fn ); | 381 | bool exportICalendar( QString fn ); |
382 | 382 | ||
383 | /** Export as vCalendar file */ | 383 | /** Export as vCalendar file */ |
384 | bool exportVCalendar( QString fn); | 384 | bool exportVCalendar( QString fn); |
385 | 385 | ||
386 | /** pop up a dialog to show an existing appointment. */ | 386 | /** pop up a dialog to show an existing appointment. */ |
387 | void appointment_show(); | 387 | void appointment_show(); |
388 | /** | 388 | /** |
389 | * pop up an Appointment Dialog to edit an existing appointment.Get | 389 | * pop up an Appointment Dialog to edit an existing appointment.Get |
390 | * information on the appointment from the list of unique IDs that is | 390 | * information on the appointment from the list of unique IDs that is |
391 | * currently in the View, called currIds. | 391 | * currently in the View, called currIds. |
392 | */ | 392 | */ |
393 | void appointment_edit(); | 393 | void appointment_edit(); |
394 | /** | 394 | /** |
395 | * pop up dialog confirming deletion of currently selected event in the | 395 | * pop up dialog confirming deletion of currently selected event in the |
396 | * View. | 396 | * View. |
397 | */ | 397 | */ |
398 | void appointment_delete(); | 398 | void appointment_delete(); |
399 | 399 | ||
400 | /** mails the currently selected event to a particular user as a vCalendar | 400 | /** mails the currently selected event to a particular user as a vCalendar |
401 | attachment. */ | 401 | attachment. */ |
402 | void action_mail(); | 402 | void action_mail(); |
403 | 403 | ||
404 | /* frees a subtodo from it's relation */ | 404 | /* frees a subtodo from it's relation */ |
405 | void todo_unsub( Todo * ); | 405 | void todo_unsub( Todo * ); |
406 | void todo_resub( Todo * parent, Todo * sub ); | 406 | void todo_resub( Todo * parent, Todo * sub ); |
407 | 407 | ||
408 | /** Take ownership of selected event. */ | 408 | /** Take ownership of selected event. */ |
409 | void takeOverEvent(); | 409 | void takeOverEvent(); |
410 | 410 | ||
411 | /** Take ownership of all events in calendar. */ | 411 | /** Take ownership of all events in calendar. */ |
412 | void takeOverCalendar(); | 412 | void takeOverCalendar(); |
413 | 413 | ||
414 | /** query whether or not the calendar is "dirty". */ | 414 | /** query whether or not the calendar is "dirty". */ |
415 | bool isModified(); | 415 | bool isModified(); |
416 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 416 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
417 | void setModified(bool modified=true); | 417 | void setModified(bool modified=true); |
418 | 418 | ||
419 | /** query if the calendar is read-only. */ | 419 | /** query if the calendar is read-only. */ |
420 | bool isReadOnly(); | 420 | bool isReadOnly(); |
421 | /** set state of calendar to read-only */ | 421 | /** set state of calendar to read-only */ |
422 | void setReadOnly(bool readOnly=true); | 422 | void setReadOnly(bool readOnly=true); |
423 | 423 | ||
424 | void eventUpdated(Incidence *); | 424 | void eventUpdated(Incidence *); |
425 | 425 | ||
426 | /* iTIP scheduling actions */ | 426 | /* iTIP scheduling actions */ |
427 | void schedule_publish(Incidence *incidence = 0); | 427 | void schedule_publish(Incidence *incidence = 0); |
428 | void schedule_request(Incidence *incidence = 0); | 428 | void schedule_request(Incidence *incidence = 0); |
429 | void schedule_refresh(Incidence *incidence = 0); | 429 | void schedule_refresh(Incidence *incidence = 0); |
430 | void schedule_cancel(Incidence *incidence = 0); | 430 | void schedule_cancel(Incidence *incidence = 0); |
431 | void schedule_add(Incidence *incidence = 0); | 431 | void schedule_add(Incidence *incidence = 0); |
432 | void schedule_reply(Incidence *incidence = 0); | 432 | void schedule_reply(Incidence *incidence = 0); |
433 | void schedule_counter(Incidence *incidence = 0); | 433 | void schedule_counter(Incidence *incidence = 0); |
434 | void schedule_declinecounter(Incidence *incidence = 0); | 434 | void schedule_declinecounter(Incidence *incidence = 0); |
435 | void schedule_publish_freebusy(int daysToPublish = 30); | 435 | void schedule_publish_freebusy(int daysToPublish = 30); |
436 | 436 | ||
437 | void openAddressbook(); | 437 | void openAddressbook(); |
438 | 438 | ||
439 | void editFilters(); | 439 | void editFilters(); |
440 | void toggleFilerEnabled(); | 440 | void toggleFilerEnabled(); |
441 | QPtrList<CalFilter> filters(); | 441 | QPtrList<CalFilter> filters(); |
442 | void toggleFilter(); | 442 | void toggleFilter(); |
443 | void showFilter(bool visible); | 443 | void showFilter(bool visible); |
444 | void updateFilter(); | 444 | void updateFilter(); |
445 | void filterEdited(); | 445 | void filterEdited(); |
446 | void selectFilter( int ); | 446 | void selectFilter( int ); |
447 | KOFilterView *filterView(); | 447 | KOFilterView *filterView(); |
448 | 448 | ||
449 | void showIntro(); | 449 | void showIntro(); |
450 | 450 | ||
451 | /** Move the curdatepient view date to today */ | 451 | /** Move the curdatepient view date to today */ |
452 | void goToday(); | 452 | void goToday(); |
453 | 453 | ||
454 | /** Move to the next date(s) in the current view */ | 454 | /** Move to the next date(s) in the current view */ |
455 | void goNext(); | 455 | void goNext(); |
456 | 456 | ||
457 | /** Move to the previous date(s) in the current view */ | 457 | /** Move to the previous date(s) in the current view */ |
458 | void goPrevious(); | 458 | void goPrevious(); |
459 | /** Move to the next date(s) in the current view */ | 459 | /** Move to the next date(s) in the current view */ |
460 | void goNextMonth(); | 460 | void goNextMonth(); |
461 | 461 | ||
462 | /** Move to the previous date(s) in the current view */ | 462 | /** Move to the previous date(s) in the current view */ |
463 | void goPreviousMonth(); | 463 | void goPreviousMonth(); |
464 | 464 | ||
465 | void toggleExpand(); | 465 | void toggleExpand(); |
466 | void toggleDateNavigatorWidget(); | 466 | void toggleDateNavigatorWidget(); |
467 | void toggleAllDaySize(); | 467 | void toggleAllDaySize(); |
468 | 468 | ||
469 | /** Look for new messages in the inbox */ | 469 | /** Look for new messages in the inbox */ |
470 | void lookForIncomingMessages(); | 470 | void lookForIncomingMessages(); |
471 | /** Look for new messages in the outbox */ | 471 | /** Look for new messages in the outbox */ |
472 | void lookForOutgoingMessages(); | 472 | void lookForOutgoingMessages(); |
473 | 473 | ||
474 | void processMainViewSelection( Incidence * ); | 474 | void processMainViewSelection( Incidence * ); |
475 | void processTodoListSelection( Incidence * ); | 475 | void processTodoListSelection( Incidence * ); |
476 | 476 | ||
477 | void processIncidenceSelection( Incidence * ); | 477 | void processIncidenceSelection( Incidence * ); |
478 | 478 | ||
479 | void purgeCompleted(); | 479 | void purgeCompleted(); |
480 | bool removeCompletedSubTodos( Todo* ); | 480 | bool removeCompletedSubTodos( Todo* ); |
481 | void slotCalendarChanged(); | 481 | void slotCalendarChanged(); |
482 | bool importBday(); | 482 | bool importBday(); |
483 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 483 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
484 | bool importQtopia( const QString &categoriesFile, | 484 | bool importQtopia( const QString &categoriesFile, |
485 | const QString &datebookFile, | 485 | const QString &datebookFile, |
486 | const QString &tasklistFile ); | 486 | const QString &tasklistFile ); |
487 | void syncExternal( int mode ); | 487 | void syncExternal( int mode ); |
488 | void slotSelectPickerDate( QDate ) ; | 488 | void slotSelectPickerDate( QDate ) ; |
489 | void showDatePicker() ; | 489 | void showDatePicker() ; |
490 | void showDatePickerPopup() ; | 490 | void showDatePickerPopup() ; |
491 | void moveIncidence(Incidence *) ; | 491 | void moveIncidence(Incidence *) ; |
492 | void beamIncidence(Incidence *) ; | 492 | void beamIncidence(Incidence *) ; |
493 | void beamCalendar() ; | 493 | void beamCalendar() ; |
494 | void beamFilteredCalendar() ; | 494 | void beamFilteredCalendar() ; |
495 | void beamIncidenceList(QPtrList<Incidence>) ; | 495 | void beamIncidenceList(QPtrList<Incidence>) ; |
496 | void manageCategories(); | 496 | void manageCategories(); |
497 | void editCategories(); | 497 | void editCategories(); |
498 | int addCategories(); | 498 | int addCategories(); |
499 | void removeCategories(); | 499 | void removeCategories(); |
500 | void setSyncDevice( QString ); | 500 | void setSyncDevice( QString ); |
501 | void setSyncName( QString ); | 501 | void setSyncName( QString ); |
502 | void showDay( QDate ); | 502 | void showDay( QDate ); |
503 | void undo_delete(); | 503 | void undo_delete(); |
504 | protected slots: | 504 | protected slots: |
505 | void resetFocus(); | 505 | void resetFocus(); |
506 | void scrollBarValue(int); | 506 | void scrollBarValue(int); |
507 | void slotViewerClosed(); | 507 | void slotViewerClosed(); |
508 | void timerAlarm(); | 508 | void timerAlarm(); |
509 | void suspendAlarm(); | 509 | void suspendAlarm(); |
510 | void beamDone( Ir *ir ); | 510 | void beamDone( Ir *ir ); |
511 | /** Select a view or adapt the current view to display the specified dates. */ | 511 | /** Select a view or adapt the current view to display the specified dates. */ |
512 | void showDates( const KCal::DateList & ); | 512 | void showDates( const KCal::DateList & ); |
513 | void selectWeekNum ( int ); | 513 | void selectWeekNum ( int ); |
514 | void checkConflictForEvent(); | 514 | void checkConflictForEvent(); |
515 | 515 | ||
516 | public: | 516 | public: |
517 | void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval ); | 517 | void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval ); |
518 | // show a standard warning | 518 | // show a standard warning |
519 | // returns KMsgBox::yesNoCancel() | 519 | // returns KMsgBox::yesNoCancel() |
520 | int msgCalModified(); | 520 | int msgCalModified(); |
521 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 521 | virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource); |
522 | 522 | ||
523 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 523 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
524 | virtual void removeSyncInfo( QString syncProfile); | 524 | virtual void removeSyncInfo( QString syncProfile); |
525 | void setSyncManager(KSyncManager* manager); | 525 | void setSyncManager(KSyncManager* manager); |
526 | void setLoadedFileVersion(QDateTime); | 526 | void setLoadedFileVersion(QDateTime); |
527 | bool checkFileVersion(QString fn); | 527 | bool checkFileVersion(QString fn); |
528 | bool checkAllFileVersions(); | 528 | bool checkAllFileVersions(); |
529 | bool checkFileChanged(QString fn); | 529 | bool checkFileChanged(QString fn); |
530 | Event* getLastSyncEvent(); | 530 | Event* getLastSyncEvent(); |
531 | /** Adapt navigation units correpsonding to step size of navigation of the | 531 | /** Adapt navigation units correpsonding to step size of navigation of the |
532 | * current view. | 532 | * current view. |
533 | */ | 533 | */ |
534 | void adaptNavigationUnits(); | 534 | void adaptNavigationUnits(); |
535 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 535 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
536 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 536 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
537 | //Attendee* getYourAttendee(Event *event); | 537 | //Attendee* getYourAttendee(Event *event); |
538 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 538 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
539 | void setScrollBarStep(int val ); | 539 | void setScrollBarStep(int val ); |
540 | 540 | ||
541 | protected: | 541 | protected: |
542 | Event *mConflictingEvent; | 542 | Event *mConflictingEvent; |
543 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 543 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
544 | 544 | ||
545 | // returns KMsgBox::OKCandel() | 545 | // returns KMsgBox::OKCandel() |
546 | int msgItemDelete(const QString name); | 546 | int msgItemDelete(const QString name); |
547 | void showEventEditor(); | 547 | void showEventEditor(); |
548 | void showTodoEditor(); | 548 | void showTodoEditor(); |
549 | Todo *selectedTodo(); | 549 | Todo *selectedTodo(); |
550 | private: | 550 | private: |
551 | #ifdef DESKTOP_VERSION | 551 | #ifdef DESKTOP_VERSION |
552 | QScrollBar * mDateScrollBar; | 552 | QScrollBar * mDateScrollBar; |
553 | #endif | 553 | #endif |
554 | bool flag_blockConflict; | 554 | bool flag_blockConflict; |
555 | bool flag_blockScrollBar; | 555 | bool flag_blockScrollBar; |
556 | bool flag_checkFileFirsttime; | 556 | bool flag_checkFileFirsttime; |
557 | bool flag_clearallviewsEventDisplay; | 557 | bool flag_clearallviewsEventDisplay; |
558 | bool flag_clearallviewsupdateView; | 558 | bool flag_clearallviewsupdateView; |
559 | QDateTime mNextAlarmDateTime; | 559 | QDateTime mNextAlarmDateTime; |
560 | bool mViewerCallerIsSearchDialog; | 560 | bool mViewerCallerIsSearchDialog; |
561 | bool mBlockShowDates; | 561 | bool mBlockShowDates; |
562 | KSyncManager* mSyncManager; | 562 | KSyncManager* mSyncManager; |
563 | AlarmDialog * mAlarmDialog; | 563 | AlarmDialog * mAlarmDialog; |
564 | QString mAlarmNotification; | 564 | QString mAlarmNotification; |
565 | QString mSuspendAlarmNotification; | 565 | QString mSuspendAlarmNotification; |
566 | QTimer* mSuspendTimer; | 566 | QTimer* mSuspendTimer; |
567 | QTimer* mAlarmTimer; | 567 | QTimer* mAlarmTimer; |
568 | QTimer* mRecheckAlarmTimer; | 568 | QTimer* mRecheckAlarmTimer; |
569 | void computeAlarm( QString ); | 569 | void computeAlarm( QString ); |
570 | void startAlarm( QString, QString ); | 570 | void startAlarm( QString, QString ); |
571 | void setSyncEventsReadOnly(); | 571 | void setSyncEventsReadOnly(); |
572 | 572 | ||
573 | QDateTime loadedFileVersion; | 573 | QDateTime loadedFileVersion; |
574 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 574 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
575 | void checkExternalId( Incidence * inc ); | 575 | void checkExternalId( Incidence * inc ); |
576 | int mGlobalSyncMode; | 576 | int mGlobalSyncMode; |
577 | QString mCurrentSyncDevice; | 577 | QString mCurrentSyncDevice; |
578 | QString mCurrentSyncName; | 578 | QString mCurrentSyncName; |
579 | void init(); | 579 | void init(); |
580 | int mDatePickerMode; | 580 | int mDatePickerMode; |
581 | bool mFlagEditDescription; | 581 | bool mFlagEditDescription; |
582 | QDateTime mLastCalendarSync; | 582 | QDateTime mLastCalendarSync; |
583 | void createPrinter(); | 583 | void createPrinter(); |
584 | 584 | ||
585 | void calendarModified( bool, Calendar * ); | 585 | void calendarModified( bool, Calendar * ); |
586 | 586 | ||
587 | CalPrinter *mCalPrinter; | 587 | CalPrinter *mCalPrinter; |
588 | 588 | ||
589 | QSplitter *mPanner; | 589 | QSplitter *mPanner; |
590 | QSplitter *mLeftSplitter; | 590 | QSplitter *mLeftSplitter; |
591 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; | 591 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; |
592 | QWidgetStack *mRightFrame; | 592 | QWidgetStack *mRightFrame; |
593 | 593 | ||
594 | KDatePicker* mDatePicker; | 594 | KDatePicker* mDatePicker; |
595 | QVBox* mDateFrame; | 595 | QVBox* mDateFrame; |
596 | 596 | ||
597 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. | 597 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. |
598 | 598 | ||
599 | KOFilterView *mFilterView; | 599 | KOFilterView *mFilterView; |
600 | KOCalEditView *mCalEditView; | 600 | KOCalEditView *mCalEditView; |
601 | 601 | ||
602 | ResourceView *mResourceView; | 602 | ResourceView *mResourceView; |
603 | 603 | ||
604 | // calendar object for this viewing instance | 604 | // calendar object for this viewing instance |
605 | Calendar *mCalendar; | 605 | Calendar *mCalendar; |
606 | 606 | ||
607 | CalendarResourceManager *mResourceManager; | 607 | CalendarResourceManager *mResourceManager; |
608 | 608 | ||
609 | FileStorage *mStorage; | 609 | FileStorage *mStorage; |
610 | 610 | ||
611 | DateNavigator *mNavigator; | 611 | DateNavigator *mNavigator; |
612 | 612 | ||
613 | KOViewManager *mViewManager; | 613 | KOViewManager *mViewManager; |
614 | KODialogManager *mDialogManager; | 614 | KODialogManager *mDialogManager; |
615 | 615 | ||
616 | // Calendar filters | 616 | // Calendar filters |
617 | QPtrList<CalFilter> mFilters; | 617 | QPtrList<CalFilter> mFilters; |
618 | 618 | ||
619 | // various housekeeping variables. | 619 | // various housekeeping variables. |
620 | bool mModified; // flag indicating if calendar is modified | 620 | bool mModified; // flag indicating if calendar is modified |
621 | bool mReadOnly; // flag indicating if calendar is read-only | 621 | bool mReadOnly; // flag indicating if calendar is read-only |
622 | QDate mSaveSingleDate; | 622 | QDate mSaveSingleDate; |
623 | 623 | ||
624 | Incidence *mSelectedIncidence; | 624 | Incidence *mSelectedIncidence; |
625 | Incidence *mMoveIncidence; | 625 | Incidence *mMoveIncidence; |
626 | QDate mMoveIncidenceOldDate; | 626 | QDate mMoveIncidenceOldDate; |
627 | KOTodoView *mTodoList; | 627 | KOTodoView *mTodoList; |
628 | KOEventEditor * mEventEditor; | 628 | KOEventEditor * mEventEditor; |
629 | KOTodoEditor * mTodoEditor; | 629 | KOTodoEditor * mTodoEditor; |
630 | KOEventViewerDialog * mEventViewerDialog; | 630 | KOEventViewerDialog * mEventViewerDialog; |
631 | void keyPressEvent ( QKeyEvent *e) ; | 631 | void keyPressEvent ( QKeyEvent *e) ; |
632 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 632 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
633 | }; | 633 | }; |
634 | 634 | ||
635 | 635 | ||
636 | class CalendarViewVisitor : public Incidence::Visitor | 636 | class CalendarViewVisitor : public Incidence::Visitor |
637 | { | 637 | { |
638 | public: | 638 | public: |
639 | CalendarViewVisitor() : mView( 0 ) {} | 639 | CalendarViewVisitor() : mView( 0 ) {} |
640 | 640 | ||
641 | bool act( Incidence *incidence, CalendarView *view ) | 641 | bool act( Incidence *incidence, CalendarView *view ) |
642 | { | 642 | { |
643 | mView = view; | 643 | mView = view; |
644 | return incidence->accept( *this ); | 644 | return incidence->accept( *this ); |
645 | } | 645 | } |
646 | 646 | ||
647 | protected: | 647 | protected: |
648 | CalendarView *mView; | 648 | CalendarView *mView; |
649 | }; | 649 | }; |
650 | 650 | ||
651 | class ShowIncidenceVisitor : public CalendarViewVisitor | 651 | class ShowIncidenceVisitor : public CalendarViewVisitor |
652 | { | 652 | { |
653 | protected: | 653 | protected: |
654 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 654 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
655 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 655 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
656 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 656 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
657 | }; | 657 | }; |
658 | 658 | ||
659 | class EditIncidenceVisitor : public CalendarViewVisitor | 659 | class EditIncidenceVisitor : public CalendarViewVisitor |
660 | { | 660 | { |
661 | protected: | 661 | protected: |
662 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 662 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
663 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 663 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
664 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 664 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
665 | }; | 665 | }; |
666 | 666 | ||
667 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 667 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
668 | { | 668 | { |
669 | protected: | 669 | protected: |
670 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 670 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
671 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 671 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
672 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 672 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
673 | }; | 673 | }; |
674 | 674 | ||
675 | #endif | 675 | #endif |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 1b0e5f4..31ef338 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -339,298 +339,308 @@ KOPrefs::KOPrefs() : | |||
339 | KOPrefs::~KOPrefs() | 339 | KOPrefs::~KOPrefs() |
340 | { | 340 | { |
341 | if (mInstance == this) | 341 | if (mInstance == this) |
342 | mInstance = insd.setObject(0); | 342 | mInstance = insd.setObject(0); |
343 | mCalendars.setAutoDelete( true ); | 343 | mCalendars.setAutoDelete( true ); |
344 | mCalendars.clear(); | 344 | mCalendars.clear(); |
345 | //qDebug("KOPrefs::~KOPrefs() "); | 345 | //qDebug("KOPrefs::~KOPrefs() "); |
346 | } | 346 | } |
347 | 347 | ||
348 | 348 | ||
349 | KOPrefs *KOPrefs::instance() | 349 | KOPrefs *KOPrefs::instance() |
350 | { | 350 | { |
351 | if (!mInstance) { | 351 | if (!mInstance) { |
352 | mInstance = insd.setObject(new KOPrefs()); | 352 | mInstance = insd.setObject(new KOPrefs()); |
353 | mInstance->readConfig(); | 353 | mInstance->readConfig(); |
354 | } | 354 | } |
355 | 355 | ||
356 | return mInstance; | 356 | return mInstance; |
357 | } | 357 | } |
358 | 358 | ||
359 | void KOPrefs::usrSetDefaults() | 359 | void KOPrefs::usrSetDefaults() |
360 | { | 360 | { |
361 | 361 | ||
362 | } | 362 | } |
363 | 363 | ||
364 | void KOPrefs::fillMailDefaults() | 364 | void KOPrefs::fillMailDefaults() |
365 | { | 365 | { |
366 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 366 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
367 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 367 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
368 | } | 368 | } |
369 | 369 | ||
370 | void KOPrefs::setTimeZoneIdDefault() | 370 | void KOPrefs::setTimeZoneIdDefault() |
371 | { | 371 | { |
372 | ; | 372 | ; |
373 | } | 373 | } |
374 | 374 | ||
375 | void KOPrefs::setAllDefaults() | 375 | void KOPrefs::setAllDefaults() |
376 | { | 376 | { |
377 | setCategoryDefaults(); | 377 | setCategoryDefaults(); |
378 | mEventSummaryUser = getDefaultList() ; | 378 | mEventSummaryUser = getDefaultList() ; |
379 | mTodoSummaryUser = getDefaultList() ; | 379 | mTodoSummaryUser = getDefaultList() ; |
380 | mJournalSummaryUser = getDefaultList() ; | 380 | mJournalSummaryUser = getDefaultList() ; |
381 | mLocationDefaults = getLocationDefaultList(); | 381 | mLocationDefaults = getLocationDefaultList(); |
382 | } | 382 | } |
383 | 383 | ||
384 | void KOPrefs::setCategoryDefaults() | 384 | void KOPrefs::setCategoryDefaults() |
385 | { | 385 | { |
386 | mCustomCategories.clear(); | 386 | mCustomCategories.clear(); |
387 | mCustomCategories = getDefaultList(); | 387 | mCustomCategories = getDefaultList(); |
388 | 388 | ||
389 | QStringList::Iterator it; | 389 | QStringList::Iterator it; |
390 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 390 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
391 | setCategoryColor(*it,mDefaultCategoryColor); | 391 | setCategoryColor(*it,mDefaultCategoryColor); |
392 | } | 392 | } |
393 | } | 393 | } |
394 | QStringList KOPrefs::getLocationDefaultList() | 394 | QStringList KOPrefs::getLocationDefaultList() |
395 | { | 395 | { |
396 | QStringList retval ; | 396 | QStringList retval ; |
397 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 397 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
398 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | 398 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") |
399 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 399 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
400 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 400 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
401 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 401 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
402 | 402 | ||
403 | retval.sort(); | 403 | retval.sort(); |
404 | return retval; | 404 | return retval; |
405 | } | 405 | } |
406 | QStringList KOPrefs::getDefaultList() | 406 | QStringList KOPrefs::getDefaultList() |
407 | { | 407 | { |
408 | QStringList retval ; | 408 | QStringList retval ; |
409 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer") | 409 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer") |
410 | << i18n("Break") | 410 | << i18n("Break") |
411 | << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts") | 411 | << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts") |
412 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") | 412 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") |
413 | << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") | 413 | << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") |
414 | << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping") | 414 | << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping") |
415 | << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV") | 415 | << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV") |
416 | << i18n("Vacation") ; | 416 | << i18n("Vacation") ; |
417 | retval.sort(); | 417 | retval.sort(); |
418 | //qDebug("cat %s ", retval.join("-").latin1()); | 418 | //qDebug("cat %s ", retval.join("-").latin1()); |
419 | return retval; | 419 | return retval; |
420 | } | 420 | } |
421 | // << i18n("Business Travel") << i18n("Education") << i18n("Hiking") << i18n("Hunting") << i18n("Recurring") << i18n("Personal Travel") << i18n("Speach") << i18n("Festival") << i18n("Competition")<< i18n("Party")<< i18n("Projects")<< i18n("Kids") << i18n("Special Occasion")<< i18n("Breakfast")<< i18n("Dinner") << i18n("Lunch")<< i18n("University")<< i18n("School")<< i18n("Flight")<< i18n("Key Customer") << i18n("VIP") << i18n("SyncEvent") << i18n("Cinema") | 421 | // << i18n("Business Travel") << i18n("Education") << i18n("Hiking") << i18n("Hunting") << i18n("Recurring") << i18n("Personal Travel") << i18n("Speach") << i18n("Festival") << i18n("Competition")<< i18n("Party")<< i18n("Projects")<< i18n("Kids") << i18n("Special Occasion")<< i18n("Breakfast")<< i18n("Dinner") << i18n("Lunch")<< i18n("University")<< i18n("School")<< i18n("Flight")<< i18n("Key Customer") << i18n("VIP") << i18n("SyncEvent") << i18n("Cinema") |
422 | void KOPrefs::usrReadConfig() | 422 | void KOPrefs::usrReadConfig() |
423 | { | 423 | { |
424 | config()->setGroup("General"); | 424 | config()->setGroup("General"); |
425 | 425 | ||
426 | //qDebug("KOPrefs::usrReadConfig() "); | 426 | //qDebug("KOPrefs::usrReadConfig() "); |
427 | mCustomCategories = config()->readListEntry("Custom Categories"); | 427 | mCustomCategories = config()->readListEntry("Custom Categories"); |
428 | mOldLoadedLanguage = mOldLanguage ; | 428 | mOldLoadedLanguage = mOldLanguage ; |
429 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 429 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
430 | if (mLocationDefaults.isEmpty()) { | 430 | if (mLocationDefaults.isEmpty()) { |
431 | mLocationDefaults = getLocationDefaultList(); | 431 | mLocationDefaults = getLocationDefaultList(); |
432 | } | 432 | } |
433 | 433 | ||
434 | if (mEventSummaryUser.isEmpty()) { | 434 | if (mEventSummaryUser.isEmpty()) { |
435 | mEventSummaryUser = getDefaultList() ; | 435 | mEventSummaryUser = getDefaultList() ; |
436 | } | 436 | } |
437 | if (mTodoSummaryUser.isEmpty()) { | 437 | if (mTodoSummaryUser.isEmpty()) { |
438 | mTodoSummaryUser = getDefaultList() ; | 438 | mTodoSummaryUser = getDefaultList() ; |
439 | } | 439 | } |
440 | 440 | ||
441 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 441 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
442 | 442 | ||
443 | config()->setGroup("Personal Settings"); | 443 | config()->setGroup("Personal Settings"); |
444 | mName = config()->readEntry("user_name",""); | 444 | mName = config()->readEntry("user_name",""); |
445 | mEmail = config()->readEntry("user_email",""); | 445 | mEmail = config()->readEntry("user_email",""); |
446 | fillMailDefaults(); | 446 | fillMailDefaults(); |
447 | 447 | ||
448 | config()->setGroup("Category Colors"); | 448 | config()->setGroup("Category Colors"); |
449 | QStringList::Iterator it; | 449 | QStringList::Iterator it; |
450 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 450 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
451 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 451 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
452 | 452 | ||
453 | } | 453 | } |
454 | KConfig fc (locateLocal("config","kopicalendarrc")); | 454 | KConfig fc (locateLocal("config","kopicalendarrc")); |
455 | fc.setGroup("CC"); | 455 | fc.setGroup("CC"); |
456 | int numCals = fc.readNumEntry("NumberCalendars",0 ); | 456 | int numCals = fc.readNumEntry("NumberCalendars",0 ); |
457 | mNextAvailableCalendar = 1; | 457 | mNextAvailableCalendar = 1; |
458 | if ( numCals == 0 ) { | 458 | if ( numCals == 0 ) { |
459 | KopiCalendarFile *kkf = getNewCalendar(); | 459 | KopiCalendarFile *kkf = getNewCalendar(); |
460 | kkf->isStandard = true; | 460 | kkf->isStandard = true; |
461 | kkf->mName = i18n("Standard"); | 461 | kkf->mName = i18n("Standard"); |
462 | kkf->mFileName = QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) ); | 462 | kkf->mFileName = QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) ); |
463 | } | 463 | } |
464 | while ( mNextAvailableCalendar <= numCals ) { | 464 | while ( mNextAvailableCalendar <= numCals ) { |
465 | //qDebug("Read cal #%d ", mNextAvailableCalendar ); | 465 | //qDebug("Read cal #%d ", mNextAvailableCalendar ); |
466 | QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); | 466 | QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); |
467 | KopiCalendarFile *kkf = getNewCalendar(); | 467 | KopiCalendarFile *kkf = getNewCalendar(); |
468 | kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); | 468 | kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); |
469 | kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); | 469 | kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); |
470 | kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false ); | 470 | kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false ); |
471 | kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); | 471 | kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); |
472 | kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); | 472 | kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); |
473 | kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); | 473 | kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); |
474 | kkf->mFileName = QDir::convertSeparators( fc.readEntry( prefix+"_FileName", kkf->mFileName) ); | 474 | kkf->mFileName = QDir::convertSeparators( fc.readEntry( prefix+"_FileName", kkf->mFileName) ); |
475 | kkf->mSavedFileName = QDir::convertSeparators( fc.readEntry( prefix+"_SavedFileName", kkf->mFileName) ); | 475 | kkf->mSavedFileName = QDir::convertSeparators( fc.readEntry( prefix+"_SavedFileName", kkf->mFileName) ); |
476 | kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); | 476 | kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); |
477 | if ( kkf->mCalNumber == 1 ) { | 477 | if ( kkf->mCalNumber == 1 ) { |
478 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); | 478 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); |
479 | } | 479 | } |
480 | //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); | 480 | //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); |
481 | if ( kkf->mName == i18n("Birthdays") ) { | 481 | if ( kkf->mName == i18n("Birthdays") ) { |
482 | kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); | 482 | kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); |
483 | } | 483 | } |
484 | if ( kkf->isRelative ) | 484 | if ( kkf->isRelative ) |
485 | kkf->mFileName = QDir::convertSeparators( KGlobalSettings::calendarDir() + kkf->mSavedFileName ); | 485 | kkf->mFileName = QDir::convertSeparators( KGlobalSettings::calendarDir() + kkf->mSavedFileName ); |
486 | } | 486 | } |
487 | 487 | ||
488 | KPimPrefs::usrReadConfig(); | 488 | KPimPrefs::usrReadConfig(); |
489 | } | 489 | } |
490 | 490 | ||
491 | KopiCalendarFile * KOPrefs::getCalendar( int num ) | 491 | KopiCalendarFile * KOPrefs::getCalendar( int num ) |
492 | { | 492 | { |
493 | return mDefCalColors[num-1]; | 493 | return mDefCalColors[num-1]; |
494 | } | 494 | } |
495 | 495 | ||
496 | KopiCalendarFile * KOPrefs::getNewCalendar() | 496 | KopiCalendarFile * KOPrefs::getNewCalendar() |
497 | { | 497 | { |
498 | KopiCalendarFile * kkf = new KopiCalendarFile(); | 498 | KopiCalendarFile * kkf = new KopiCalendarFile(); |
499 | kkf->mCalNumber = mNextAvailableCalendar; | 499 | kkf->mCalNumber = mNextAvailableCalendar; |
500 | mDefCalColors.resize( mNextAvailableCalendar ); | 500 | mDefCalColors.resize( mNextAvailableCalendar ); |
501 | mDefCalColors[mNextAvailableCalendar-1] = kkf; | 501 | mDefCalColors[mNextAvailableCalendar-1] = kkf; |
502 | ++mNextAvailableCalendar; | 502 | ++mNextAvailableCalendar; |
503 | kkf->mDefaultColor = mEventColor; | 503 | kkf->mDefaultColor = mEventColor; |
504 | kkf->mName = i18n("New Calendar"); | 504 | kkf->mName = i18n("New Calendar"); |
505 | mCalendars.append( kkf ); | 505 | mCalendars.append( kkf ); |
506 | return kkf; | 506 | return kkf; |
507 | } | 507 | } |
508 | void KOPrefs::deleteCalendar( int num ) | 508 | void KOPrefs::deleteCalendar( int num ) |
509 | { | 509 | { |
510 | KopiCalendarFile * kkf = mCalendars.first(); | 510 | KopiCalendarFile * kkf = mCalendars.first(); |
511 | while ( kkf ) { | 511 | while ( kkf ) { |
512 | if ( kkf->mCalNumber == num ) { | 512 | if ( kkf->mCalNumber == num ) { |
513 | qDebug("KOPrefs::deleteCalendar %d ", num ); | 513 | qDebug("KOPrefs::deleteCalendar %d ", num ); |
514 | mCalendars.remove( kkf ); | 514 | mCalendars.remove( kkf ); |
515 | delete kkf; | 515 | delete kkf; |
516 | return; | 516 | return; |
517 | } | 517 | } |
518 | kkf = mCalendars.next(); | 518 | kkf = mCalendars.next(); |
519 | } | 519 | } |
520 | } | 520 | } |
521 | int KOPrefs::getCalendarID( const QString & name ) | 521 | int KOPrefs::getCalendarID( const QString & name ) |
522 | { | 522 | { |
523 | KopiCalendarFile * kkf = mCalendars.first(); | 523 | KopiCalendarFile * kkf = mCalendars.first(); |
524 | while ( kkf ) { | 524 | while ( kkf ) { |
525 | if ( name == kkf->mName) | 525 | if ( name == kkf->mName) |
526 | return kkf->mCalNumber; | 526 | return kkf->mCalNumber; |
527 | kkf = mCalendars.next(); | 527 | kkf = mCalendars.next(); |
528 | } | 528 | } |
529 | return 1; | 529 | return 1; |
530 | } | 530 | } |
531 | int KOPrefs::getFuzzyCalendarID( const QString & name ) | ||
532 | { | ||
533 | KopiCalendarFile * kkf = mCalendars.first(); | ||
534 | while ( kkf ) { | ||
535 | if ( name.lower() == kkf->mName.lower()) | ||
536 | return kkf->mCalNumber; | ||
537 | kkf = mCalendars.next(); | ||
538 | } | ||
539 | return 0; | ||
540 | } | ||
531 | QString KOPrefs::calName( int calNum) const | 541 | QString KOPrefs::calName( int calNum) const |
532 | { | 542 | { |
533 | return (mDefCalColors[calNum-1])->mName; | 543 | return (mDefCalColors[calNum-1])->mName; |
534 | } | 544 | } |
535 | QColor KOPrefs::defaultColor( int calNum ) const | 545 | QColor KOPrefs::defaultColor( int calNum ) const |
536 | { | 546 | { |
537 | if ( calNum == 1 ) return mEventColor; | 547 | if ( calNum == 1 ) return mEventColor; |
538 | return (mDefCalColors[calNum-1])->mDefaultColor; | 548 | return (mDefCalColors[calNum-1])->mDefaultColor; |
539 | } | 549 | } |
540 | void KOPrefs::usrWriteConfig() | 550 | void KOPrefs::usrWriteConfig() |
541 | { | 551 | { |
542 | config()->setGroup("General"); | 552 | config()->setGroup("General"); |
543 | config()->writeEntry("Custom Categories",mCustomCategories); | 553 | config()->writeEntry("Custom Categories",mCustomCategories); |
544 | 554 | ||
545 | config()->setGroup("Personal Settings"); | 555 | config()->setGroup("Personal Settings"); |
546 | config()->writeEntry("user_name",mName); | 556 | config()->writeEntry("user_name",mName); |
547 | config()->writeEntry("user_email",mEmail); | 557 | config()->writeEntry("user_email",mEmail); |
548 | 558 | ||
549 | config()->setGroup("Category Colors"); | 559 | config()->setGroup("Category Colors"); |
550 | QDictIterator<QColor> it(mCategoryColors); | 560 | QDictIterator<QColor> it(mCategoryColors); |
551 | while (it.current()) { | 561 | while (it.current()) { |
552 | config()->writeEntry(it.currentKey(),*(it.current())); | 562 | config()->writeEntry(it.currentKey(),*(it.current())); |
553 | ++it; | 563 | ++it; |
554 | } | 564 | } |
555 | KConfig fc (locateLocal("config","kopicalendarrc")); | 565 | KConfig fc (locateLocal("config","kopicalendarrc")); |
556 | fc.setGroup("CC"); | 566 | fc.setGroup("CC"); |
557 | fc.deleteGroup( "CC"); | 567 | fc.deleteGroup( "CC"); |
558 | fc.setGroup("CC"); | 568 | fc.setGroup("CC"); |
559 | fc.writeEntry("NumberCalendars",mCalendars.count()); | 569 | fc.writeEntry("NumberCalendars",mCalendars.count()); |
560 | int numCal = 1; | 570 | int numCal = 1; |
561 | int writeCal = 0; | 571 | int writeCal = 0; |
562 | while ( numCal < mNextAvailableCalendar ) { | 572 | while ( numCal < mNextAvailableCalendar ) { |
563 | KopiCalendarFile * kkf = mCalendars.first(); | 573 | KopiCalendarFile * kkf = mCalendars.first(); |
564 | while ( kkf ) { | 574 | while ( kkf ) { |
565 | //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); | 575 | //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); |
566 | if ( kkf->mCalNumber == numCal ) { | 576 | if ( kkf->mCalNumber == numCal ) { |
567 | ++writeCal; | 577 | ++writeCal; |
568 | //qDebug("Write calendar %d %d ", numCal , writeCal); | 578 | //qDebug("Write calendar %d %d ", numCal , writeCal); |
569 | QString prefix = "Cal_" + QString::number( writeCal ); | 579 | QString prefix = "Cal_" + QString::number( writeCal ); |
570 | fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); | 580 | fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); |
571 | fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); | 581 | fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); |
572 | fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); | 582 | fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); |
573 | fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); | 583 | fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); |
574 | fc.writeEntry( prefix+"_isRelative", kkf->isRelative ); | 584 | fc.writeEntry( prefix+"_isRelative", kkf->isRelative ); |
575 | fc.writeEntry( prefix+"_Name", kkf->mName); | 585 | fc.writeEntry( prefix+"_Name", kkf->mName); |
576 | fc.writeEntry( prefix+"_FileName", kkf->mFileName); | 586 | fc.writeEntry( prefix+"_FileName", kkf->mFileName); |
577 | fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName); | 587 | fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName); |
578 | fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); | 588 | fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); |
579 | } | 589 | } |
580 | kkf = mCalendars.next(); | 590 | kkf = mCalendars.next(); |
581 | } | 591 | } |
582 | ++numCal; | 592 | ++numCal; |
583 | } | 593 | } |
584 | fc.sync(); | 594 | fc.sync(); |
585 | KPimPrefs::usrWriteConfig(); | 595 | KPimPrefs::usrWriteConfig(); |
586 | } | 596 | } |
587 | 597 | ||
588 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 598 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
589 | { | 599 | { |
590 | mCategoryColors.replace(cat,new QColor(color)); | 600 | mCategoryColors.replace(cat,new QColor(color)); |
591 | } | 601 | } |
592 | 602 | ||
593 | QColor *KOPrefs::categoryColor(QString cat) | 603 | QColor *KOPrefs::categoryColor(QString cat) |
594 | { | 604 | { |
595 | QColor *color = 0; | 605 | QColor *color = 0; |
596 | 606 | ||
597 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | 607 | if (!cat.isEmpty()) color = mCategoryColors[cat]; |
598 | 608 | ||
599 | if (color) return color; | 609 | if (color) return color; |
600 | else return &mDefaultCategoryColor; | 610 | else return &mDefaultCategoryColor; |
601 | } | 611 | } |
602 | 612 | ||
603 | void KOPrefs::setFullName(const QString &name) | 613 | void KOPrefs::setFullName(const QString &name) |
604 | { | 614 | { |
605 | mName = name; | 615 | mName = name; |
606 | } | 616 | } |
607 | 617 | ||
608 | void KOPrefs::setEmail(const QString &email) | 618 | void KOPrefs::setEmail(const QString &email) |
609 | { | 619 | { |
610 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | 620 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); |
611 | mEmail = email; | 621 | mEmail = email; |
612 | } | 622 | } |
613 | 623 | ||
614 | QString KOPrefs::fullName() | 624 | QString KOPrefs::fullName() |
615 | { | 625 | { |
616 | if (mEmailControlCenter) { | 626 | if (mEmailControlCenter) { |
617 | KEMailSettings settings; | 627 | KEMailSettings settings; |
618 | return settings.getSetting(KEMailSettings::RealName); | 628 | return settings.getSetting(KEMailSettings::RealName); |
619 | } else { | 629 | } else { |
620 | return mName; | 630 | return mName; |
621 | } | 631 | } |
622 | } | 632 | } |
623 | 633 | ||
624 | QString KOPrefs::email() | 634 | QString KOPrefs::email() |
625 | { | 635 | { |
626 | if (mEmailControlCenter) { | 636 | if (mEmailControlCenter) { |
627 | KEMailSettings settings; | 637 | KEMailSettings settings; |
628 | return settings.getSetting(KEMailSettings::EmailAddress); | 638 | return settings.getSetting(KEMailSettings::EmailAddress); |
629 | } else { | 639 | } else { |
630 | return mEmail; | 640 | return mEmail; |
631 | } | 641 | } |
632 | } | 642 | } |
633 | KConfig* KOPrefs::getConfig() | 643 | KConfig* KOPrefs::getConfig() |
634 | { | 644 | { |
635 | return config(); | 645 | return config(); |
636 | } | 646 | } |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index bac8010..70da096 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -1,299 +1,300 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,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 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | 26 | ||
27 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
28 | #include <qdict.h> | 28 | #include <qdict.h> |
29 | #include <qdir.h> | 29 | #include <qdir.h> |
30 | #include <qobject.h> | 30 | #include <qobject.h> |
31 | 31 | ||
32 | class KConfig; | 32 | class KConfig; |
33 | class QFont; | 33 | class QFont; |
34 | class QColor; | 34 | class QColor; |
35 | class QStringList; | 35 | class QStringList; |
36 | 36 | ||
37 | #define VIEW_WN_VIEW 1 | 37 | #define VIEW_WN_VIEW 1 |
38 | #define VIEW_NX_VIEW 2 | 38 | #define VIEW_NX_VIEW 2 |
39 | #define VIEW_J_VIEW 3 | 39 | #define VIEW_J_VIEW 3 |
40 | #define VIEW_A_VIEW 4 | 40 | #define VIEW_A_VIEW 4 |
41 | #define VIEW_ML_VIEW 5 | 41 | #define VIEW_ML_VIEW 5 |
42 | #define VIEW_M_VIEW 6 | 42 | #define VIEW_M_VIEW 6 |
43 | #define VIEW_L_VIEW 7 | 43 | #define VIEW_L_VIEW 7 |
44 | #define VIEW_T_VIEW 8 | 44 | #define VIEW_T_VIEW 8 |
45 | 45 | ||
46 | class KopiCalendarFile : public QObject | 46 | class KopiCalendarFile : public QObject |
47 | { | 47 | { |
48 | public: | 48 | public: |
49 | KopiCalendarFile( ) : QObject( ) | 49 | KopiCalendarFile( ) : QObject( ) |
50 | { | 50 | { |
51 | isStandard = false; | 51 | isStandard = false; |
52 | isEnabled = true; | 52 | isEnabled = true; |
53 | isAlarmEnabled = true; | 53 | isAlarmEnabled = true; |
54 | isReadOnly = false; | 54 | isReadOnly = false; |
55 | mName = "Calendar"; | 55 | mName = "Calendar"; |
56 | mFileName = QDir::homeDirPath() + "/icalfile.ics"; | 56 | mFileName = QDir::homeDirPath() + "/icalfile.ics"; |
57 | mSavedFileName = "icalfile.ics"; | 57 | mSavedFileName = "icalfile.ics"; |
58 | mCalNumber = 0; | 58 | mCalNumber = 0; |
59 | mDefaultColor = Qt::red; | 59 | mDefaultColor = Qt::red; |
60 | mErrorOnLoad = false; | 60 | mErrorOnLoad = false; |
61 | isRelative = false; | 61 | isRelative = false; |
62 | } | 62 | } |
63 | bool isStandard; | 63 | bool isStandard; |
64 | bool isEnabled; | 64 | bool isEnabled; |
65 | bool isAlarmEnabled; | 65 | bool isAlarmEnabled; |
66 | bool isReadOnly; | 66 | bool isReadOnly; |
67 | bool mErrorOnLoad; | 67 | bool mErrorOnLoad; |
68 | QString mName; | 68 | QString mName; |
69 | QString mFileName; | 69 | QString mFileName; |
70 | QString mSavedFileName; | 70 | QString mSavedFileName; |
71 | bool isRelative; | 71 | bool isRelative; |
72 | int mCalNumber; | 72 | int mCalNumber; |
73 | QColor mDefaultColor; | 73 | QColor mDefaultColor; |
74 | QDateTime mLoadDt; | 74 | QDateTime mLoadDt; |
75 | }; | 75 | }; |
76 | class KOPrefs : public KPimPrefs | 76 | class KOPrefs : public KPimPrefs |
77 | { | 77 | { |
78 | public: | 78 | public: |
79 | enum { FormatVCalendar, FormatICalendar }; | 79 | enum { FormatVCalendar, FormatICalendar }; |
80 | enum { MailClientKMail, MailClientSendmail }; | 80 | enum { MailClientKMail, MailClientSendmail }; |
81 | enum { IMIPDummy, IMIPKMail }; | 81 | enum { IMIPDummy, IMIPKMail }; |
82 | enum { IMIPOutbox, IMIPdirectsend }; | 82 | enum { IMIPOutbox, IMIPdirectsend }; |
83 | enum { neverAuto, addressbookAuto, selectedAuto }; | 83 | enum { neverAuto, addressbookAuto, selectedAuto }; |
84 | enum { standardDestination, askDestination }; | 84 | enum { standardDestination, askDestination }; |
85 | 85 | ||
86 | virtual ~KOPrefs(); | 86 | virtual ~KOPrefs(); |
87 | 87 | ||
88 | /** Get instance of KOPrefs. It is made sure that there is only one | 88 | /** Get instance of KOPrefs. It is made sure that there is only one |
89 | instance. */ | 89 | instance. */ |
90 | static KOPrefs *instance(); | 90 | static KOPrefs *instance(); |
91 | 91 | ||
92 | /** Set preferences to default values */ | 92 | /** Set preferences to default values */ |
93 | void usrSetDefaults(); | 93 | void usrSetDefaults(); |
94 | 94 | ||
95 | /** Read preferences from config file */ | 95 | /** Read preferences from config file */ |
96 | void usrReadConfig(); | 96 | void usrReadConfig(); |
97 | 97 | ||
98 | /** Write preferences to config file */ | 98 | /** Write preferences to config file */ |
99 | void usrWriteConfig(); | 99 | void usrWriteConfig(); |
100 | void setCategoryDefaults(); | 100 | void setCategoryDefaults(); |
101 | void setAllDefaults(); | 101 | void setAllDefaults(); |
102 | KopiCalendarFile * getNewCalendar(); | 102 | KopiCalendarFile * getNewCalendar(); |
103 | KopiCalendarFile * getCalendar( int ); | 103 | KopiCalendarFile * getCalendar( int ); |
104 | void deleteCalendar( int ); | 104 | void deleteCalendar( int ); |
105 | QColor defaultColor( int ) const; | 105 | QColor defaultColor( int ) const; |
106 | QString calName( int ) const; | 106 | QString calName( int ) const; |
107 | int getCalendarID( const QString & name ); | 107 | int getCalendarID( const QString & name ); |
108 | int getFuzzyCalendarID( const QString & name ); | ||
108 | protected: | 109 | protected: |
109 | void setTimeZoneIdDefault(); | 110 | void setTimeZoneIdDefault(); |
110 | 111 | ||
111 | /** Fill empty mail fields with default values. */ | 112 | /** Fill empty mail fields with default values. */ |
112 | void fillMailDefaults(); | 113 | void fillMailDefaults(); |
113 | 114 | ||
114 | private: | 115 | private: |
115 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 116 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
116 | object. */ | 117 | object. */ |
117 | KOPrefs(); | 118 | KOPrefs(); |
118 | 119 | ||
119 | static KOPrefs *mInstance; | 120 | static KOPrefs *mInstance; |
120 | QStringList getDefaultList(); | 121 | QStringList getDefaultList(); |
121 | QStringList getLocationDefaultList(); | 122 | QStringList getLocationDefaultList(); |
122 | public: | 123 | public: |
123 | // preferences data | 124 | // preferences data |
124 | KConfig* getConfig(); | 125 | KConfig* getConfig(); |
125 | void setFullName(const QString &); | 126 | void setFullName(const QString &); |
126 | QString fullName(); | 127 | QString fullName(); |
127 | void setEmail(const QString &); | 128 | void setEmail(const QString &); |
128 | QString email(); | 129 | QString email(); |
129 | 130 | ||
130 | QString mAdditional; | 131 | QString mAdditional; |
131 | 132 | ||
132 | bool mEmailControlCenter; | 133 | bool mEmailControlCenter; |
133 | 134 | ||
134 | bool mBcc; | 135 | bool mBcc; |
135 | bool mAutoSave; | 136 | bool mAutoSave; |
136 | int mAutoSaveInterval; | 137 | int mAutoSaveInterval; |
137 | bool mConfirm; | 138 | bool mConfirm; |
138 | 139 | ||
139 | bool mEnableGroupScheduling; | 140 | bool mEnableGroupScheduling; |
140 | bool mEnableProjectView; | 141 | bool mEnableProjectView; |
141 | 142 | ||
142 | int mDefaultFormat; | 143 | int mDefaultFormat; |
143 | int mMailClient; | 144 | int mMailClient; |
144 | 145 | ||
145 | int mStartTime; | 146 | int mStartTime; |
146 | int mDefaultDuration; | 147 | int mDefaultDuration; |
147 | int mAlarmTime; | 148 | int mAlarmTime; |
148 | 149 | ||
149 | int mWorkingHoursStart; | 150 | int mWorkingHoursStart; |
150 | int mWorkingHoursEnd; | 151 | int mWorkingHoursEnd; |
151 | bool mExcludeHolidays; | 152 | bool mExcludeHolidays; |
152 | bool mExcludeSaturdays; | 153 | bool mExcludeSaturdays; |
153 | bool mMarcusBainsShowSeconds; | 154 | bool mMarcusBainsShowSeconds; |
154 | 155 | ||
155 | QFont mTimeBarFont; | 156 | QFont mTimeBarFont; |
156 | QFont mMonthViewFont; | 157 | QFont mMonthViewFont; |
157 | QFont mAgendaViewFont; | 158 | QFont mAgendaViewFont; |
158 | QFont mMarcusBainsFont; | 159 | QFont mMarcusBainsFont; |
159 | QFont mTimeLabelsFont; | 160 | QFont mTimeLabelsFont; |
160 | QFont mTodoViewFont; | 161 | QFont mTodoViewFont; |
161 | QFont mListViewFont; | 162 | QFont mListViewFont; |
162 | QFont mDateNavigatorFont; | 163 | QFont mDateNavigatorFont; |
163 | QFont mEditBoxFont; | 164 | QFont mEditBoxFont; |
164 | QFont mJornalViewFont; | 165 | QFont mJornalViewFont; |
165 | QFont mWhatsNextFont; | 166 | QFont mWhatsNextFont; |
166 | QFont mEventViewFont; | 167 | QFont mEventViewFont; |
167 | 168 | ||
168 | 169 | ||
169 | 170 | ||
170 | 171 | ||
171 | QColor mHolidayColor; | 172 | QColor mHolidayColor; |
172 | QColor mHighlightColor; | 173 | QColor mHighlightColor; |
173 | QColor mEventColor; | 174 | QColor mEventColor; |
174 | QColor mTodoDoneColor; | 175 | QColor mTodoDoneColor; |
175 | QColor mAgendaBgColor; | 176 | QColor mAgendaBgColor; |
176 | QColor mWorkingHoursColor; | 177 | QColor mWorkingHoursColor; |
177 | QColor mTodoDueTodayColor; | 178 | QColor mTodoDueTodayColor; |
178 | QColor mTodoOverdueColor; | 179 | QColor mTodoOverdueColor; |
179 | QColor mTodoRunColor; | 180 | QColor mTodoRunColor; |
180 | QColor mMonthViewEvenColor; | 181 | QColor mMonthViewEvenColor; |
181 | QColor mMonthViewOddColor; | 182 | QColor mMonthViewOddColor; |
182 | QColor mMonthViewHolidayColor; | 183 | QColor mMonthViewHolidayColor; |
183 | bool mMonthViewUsesDayColors; | 184 | bool mMonthViewUsesDayColors; |
184 | bool mMonthViewSatSunTog; | 185 | bool mMonthViewSatSunTog; |
185 | bool mMonthViewWeek; | 186 | bool mMonthViewWeek; |
186 | bool mMonthViewWeekRowlayout; | 187 | bool mMonthViewWeekRowlayout; |
187 | QColor mAppColor1; | 188 | QColor mAppColor1; |
188 | QColor mAppColor2; | 189 | QColor mAppColor2; |
189 | bool mUseAppColors; | 190 | bool mUseAppColors; |
190 | 191 | ||
191 | int mDayBegins; | 192 | int mDayBegins; |
192 | int mHourSize; | 193 | int mHourSize; |
193 | int mAllDaySize; | 194 | int mAllDaySize; |
194 | bool mShowFullMenu; | 195 | bool mShowFullMenu; |
195 | bool mDailyRecur; | 196 | bool mDailyRecur; |
196 | bool mWeeklyRecur; | 197 | bool mWeeklyRecur; |
197 | bool mLongAllday; | 198 | bool mLongAllday; |
198 | bool mMonthDailyRecur; | 199 | bool mMonthDailyRecur; |
199 | bool mMonthWeeklyRecur; | 200 | bool mMonthWeeklyRecur; |
200 | bool mMonthShowIcons; | 201 | bool mMonthShowIcons; |
201 | bool mMonthShowTimes; | 202 | bool mMonthShowTimes; |
202 | bool mMonthShowShort; | 203 | bool mMonthShowShort; |
203 | bool mEnableToolTips; | 204 | bool mEnableToolTips; |
204 | bool mEnableMonthScroll; | 205 | bool mEnableMonthScroll; |
205 | bool mFullViewMonth; | 206 | bool mFullViewMonth; |
206 | bool mMonthViewUsesCategoryColor; | 207 | bool mMonthViewUsesCategoryColor; |
207 | bool mFullViewTodo; | 208 | bool mFullViewTodo; |
208 | bool mShowCompletedTodo; | 209 | bool mShowCompletedTodo; |
209 | bool mMarcusBainsEnabled; | 210 | bool mMarcusBainsEnabled; |
210 | int mNextXDays; | 211 | int mNextXDays; |
211 | int mWhatsNextDays; | 212 | int mWhatsNextDays; |
212 | bool mWhatsNextTime2Lines; | 213 | bool mWhatsNextTime2Lines; |
213 | int mWhatsNextPrios; | 214 | int mWhatsNextPrios; |
214 | bool mEnableQuickTodo; | 215 | bool mEnableQuickTodo; |
215 | 216 | ||
216 | bool mCompactDialogs; | 217 | bool mCompactDialogs; |
217 | bool mVerticalScreen; | 218 | bool mVerticalScreen; |
218 | 219 | ||
219 | bool mShowIconNewTodo; | 220 | bool mShowIconNewTodo; |
220 | bool mShowIconNewEvent; | 221 | bool mShowIconNewEvent; |
221 | bool mShowIconSearch; | 222 | bool mShowIconSearch; |
222 | bool mShowIconList; | 223 | bool mShowIconList; |
223 | bool mShowIconDay1; | 224 | bool mShowIconDay1; |
224 | bool mShowIconDay5; | 225 | bool mShowIconDay5; |
225 | bool mShowIconDay6; | 226 | bool mShowIconDay6; |
226 | bool mShowIconDay7; | 227 | bool mShowIconDay7; |
227 | bool mShowIconMonth; | 228 | bool mShowIconMonth; |
228 | bool mShowIconTodoview; | 229 | bool mShowIconTodoview; |
229 | bool mShowIconBackFast; | 230 | bool mShowIconBackFast; |
230 | bool mShowIconBack; | 231 | bool mShowIconBack; |
231 | bool mShowIconToday; | 232 | bool mShowIconToday; |
232 | bool mShowIconForward; | 233 | bool mShowIconForward; |
233 | bool mShowIconForwardFast; | 234 | bool mShowIconForwardFast; |
234 | bool mShowIconWhatsThis; | 235 | bool mShowIconWhatsThis; |
235 | bool mShowIconWeekNum; | 236 | bool mShowIconWeekNum; |
236 | bool mShowIconNextDays; | 237 | bool mShowIconNextDays; |
237 | bool mShowIconNext; | 238 | bool mShowIconNext; |
238 | bool mShowIconJournal; | 239 | bool mShowIconJournal; |
239 | bool mShowIconFilter; | 240 | bool mShowIconFilter; |
240 | bool mShowIconOnetoolbar; | 241 | bool mShowIconOnetoolbar; |
241 | bool mShowIconNavigator; | 242 | bool mShowIconNavigator; |
242 | bool mShowIconAllday; | 243 | bool mShowIconAllday; |
243 | bool mShowIconFilterview; | 244 | bool mShowIconFilterview; |
244 | bool mShowIconToggleFull; | 245 | bool mShowIconToggleFull; |
245 | 246 | ||
246 | bool mShowIconStretch; | 247 | bool mShowIconStretch; |
247 | 248 | ||
248 | bool mToolBarHor; | 249 | bool mToolBarHor; |
249 | bool mToolBarUp; | 250 | bool mToolBarUp; |
250 | bool mToolBarHorV; | 251 | bool mToolBarHorV; |
251 | bool mToolBarUpV; | 252 | bool mToolBarUpV; |
252 | bool mToolBarHorN; | 253 | bool mToolBarHorN; |
253 | bool mToolBarUpN; | 254 | bool mToolBarUpN; |
254 | bool mToolBarHorF; | 255 | bool mToolBarHorF; |
255 | bool mToolBarUpF; | 256 | bool mToolBarUpF; |
256 | bool mToolBarMiniIcons; | 257 | bool mToolBarMiniIcons; |
257 | 258 | ||
258 | bool mAskForQuit; | 259 | bool mAskForQuit; |
259 | bool mUsePassWd; | 260 | bool mUsePassWd; |
260 | bool mShowSyncEvents; | 261 | bool mShowSyncEvents; |
261 | bool mShowTodoInAgenda; | 262 | bool mShowTodoInAgenda; |
262 | bool mShowCompletedTodoInAgenda; | 263 | bool mShowCompletedTodoInAgenda; |
263 | bool mShowTimeInAgenda; | 264 | bool mShowTimeInAgenda; |
264 | bool mHideNonStartedTodos; | 265 | bool mHideNonStartedTodos; |
265 | 266 | ||
266 | bool mBlockPopupMenu; | 267 | bool mBlockPopupMenu; |
267 | 268 | ||
268 | int mLastSyncTime; | 269 | int mLastSyncTime; |
269 | void setCategoryColor(QString cat,const QColor & color); | 270 | void setCategoryColor(QString cat,const QColor & color); |
270 | QColor *categoryColor(QString cat); | 271 | QColor *categoryColor(QString cat); |
271 | 272 | ||
272 | QString mArchiveFile; | 273 | QString mArchiveFile; |
273 | QString mHtmlExportFile; | 274 | QString mHtmlExportFile; |
274 | bool mHtmlWithSave; | 275 | bool mHtmlWithSave; |
275 | 276 | ||
276 | QStringList mSelectedPlugins; | 277 | QStringList mSelectedPlugins; |
277 | 278 | ||
278 | QString mLastImportFile; | 279 | QString mLastImportFile; |
279 | QString mLastVcalFile; | 280 | QString mLastVcalFile; |
280 | QString mLastSaveFile; | 281 | QString mLastSaveFile; |
281 | QString mLastLoadFile; | 282 | QString mLastLoadFile; |
282 | 283 | ||
283 | 284 | ||
284 | QString mDefaultAlarmFile; | 285 | QString mDefaultAlarmFile; |
285 | int mIMIPScheduler; | 286 | int mIMIPScheduler; |
286 | int mIMIPSend; | 287 | int mIMIPSend; |
287 | QStringList mAdditionalMails; | 288 | QStringList mAdditionalMails; |
288 | int mIMIPAutoRefresh; | 289 | int mIMIPAutoRefresh; |
289 | int mIMIPAutoInsertReply; | 290 | int mIMIPAutoInsertReply; |
290 | int mIMIPAutoInsertRequest; | 291 | int mIMIPAutoInsertRequest; |
291 | int mIMIPAutoFreeBusy; | 292 | int mIMIPAutoFreeBusy; |
292 | int mIMIPAutoFreeBusyReply; | 293 | int mIMIPAutoFreeBusyReply; |
293 | 294 | ||
294 | QStringList mTodoTemplates; | 295 | QStringList mTodoTemplates; |
295 | QStringList mEventTemplates; | 296 | QStringList mEventTemplates; |
296 | 297 | ||
297 | int mDestination; | 298 | int mDestination; |
298 | 299 | ||
299 | 300 | ||