-rw-r--r-- | korganizer/calendarview.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 377a66f..2012e92 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1788,104 +1788,97 @@ bool CalendarView::importQtopia( const QString &categories, | |||
1788 | #if 0 | 1788 | #if 0 |
1789 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1789 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1790 | mCurrentSyncDevice = "qtopia-XML"; | 1790 | mCurrentSyncDevice = "qtopia-XML"; |
1791 | if ( mSyncManager->mAskForPreferences ) | 1791 | if ( mSyncManager->mAskForPreferences ) |
1792 | edit_sync_options(); | 1792 | edit_sync_options(); |
1793 | qApp->processEvents(); | 1793 | qApp->processEvents(); |
1794 | CalendarLocal* calendar = new CalendarLocal(); | 1794 | CalendarLocal* calendar = new CalendarLocal(); |
1795 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1795 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1796 | bool syncOK = false; | 1796 | bool syncOK = false; |
1797 | QtopiaFormat qtopiaFormat; | 1797 | QtopiaFormat qtopiaFormat; |
1798 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1798 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1799 | bool loadOk = true; | 1799 | bool loadOk = true; |
1800 | if ( !categories.isEmpty() ) | 1800 | if ( !categories.isEmpty() ) |
1801 | loadOk = qtopiaFormat.load( calendar, categories ); | 1801 | loadOk = qtopiaFormat.load( calendar, categories ); |
1802 | if ( loadOk && !datebook.isEmpty() ) | 1802 | if ( loadOk && !datebook.isEmpty() ) |
1803 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1803 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1804 | if ( loadOk && !todolist.isEmpty() ) | 1804 | if ( loadOk && !todolist.isEmpty() ) |
1805 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1805 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1806 | 1806 | ||
1807 | if ( loadOk ) { | 1807 | if ( loadOk ) { |
1808 | getEventViewerDialog()->setSyncMode( true ); | 1808 | getEventViewerDialog()->setSyncMode( true ); |
1809 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1809 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1810 | getEventViewerDialog()->setSyncMode( false ); | 1810 | getEventViewerDialog()->setSyncMode( false ); |
1811 | qApp->processEvents(); | 1811 | qApp->processEvents(); |
1812 | if ( syncOK ) { | 1812 | if ( syncOK ) { |
1813 | if ( mSyncManager->mWriteBackFile ) | 1813 | if ( mSyncManager->mWriteBackFile ) |
1814 | { | 1814 | { |
1815 | // write back XML file | 1815 | // write back XML file |
1816 | 1816 | ||
1817 | } | 1817 | } |
1818 | setModified( true ); | 1818 | setModified( true ); |
1819 | } | 1819 | } |
1820 | } else { | 1820 | } else { |
1821 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1821 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1822 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1822 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1823 | question, i18n("Ok")) ; | 1823 | question, i18n("Ok")) ; |
1824 | } | 1824 | } |
1825 | delete calendar; | 1825 | delete calendar; |
1826 | updateView(); | 1826 | updateView(); |
1827 | return syncOK; | 1827 | return syncOK; |
1828 | 1828 | ||
1829 | 1829 | ||
1830 | #endif | 1830 | #endif |
1831 | 1831 | ||
1832 | } | 1832 | } |
1833 | 1833 | ||
1834 | void CalendarView::setSyncEventsReadOnly() | 1834 | void CalendarView::setSyncEventsReadOnly() |
1835 | { | 1835 | { |
1836 | Event * ev; | 1836 | mCalendar->setSyncEventsReadOnly(); |
1837 | QPtrList<Event> eL = mCalendar->rawEvents(); | ||
1838 | ev = eL.first(); | ||
1839 | while ( ev ) { | ||
1840 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | ||
1841 | ev->setReadOnly( true ); | ||
1842 | ev = eL.next(); | ||
1843 | } | ||
1844 | } | 1837 | } |
1845 | 1838 | ||
1846 | bool CalendarView::loadCalendars() | 1839 | bool CalendarView::loadCalendars() |
1847 | { | 1840 | { |
1848 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1841 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1849 | KopiCalendarFile * cal = calendars.first(); | 1842 | KopiCalendarFile * cal = calendars.first(); |
1850 | mCalendar->setDefaultCalendar( 1 ); | 1843 | mCalendar->setDefaultCalendar( 1 ); |
1851 | openCalendar( MainWindow::defaultFileName(), false ); | 1844 | openCalendar( MainWindow::defaultFileName(), false ); |
1852 | cal = calendars.next(); | 1845 | cal = calendars.next(); |
1853 | while ( cal ) { | 1846 | while ( cal ) { |
1854 | addCalendar( cal ); | 1847 | addCalendar( cal ); |
1855 | cal = calendars.next(); | 1848 | cal = calendars.next(); |
1856 | } | 1849 | } |
1857 | restoreCalendarSettings(); | 1850 | restoreCalendarSettings(); |
1858 | return true; | 1851 | return true; |
1859 | } | 1852 | } |
1860 | bool CalendarView::restoreCalendarSettings() | 1853 | bool CalendarView::restoreCalendarSettings() |
1861 | { | 1854 | { |
1862 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1855 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1863 | KopiCalendarFile * cal = calendars.first(); | 1856 | KopiCalendarFile * cal = calendars.first(); |
1864 | while ( cal ) { | 1857 | while ( cal ) { |
1865 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 1858 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
1866 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 1859 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
1867 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 1860 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
1868 | if ( cal->isStandard ) | 1861 | if ( cal->isStandard ) |
1869 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 1862 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
1870 | cal = calendars.next(); | 1863 | cal = calendars.next(); |
1871 | } | 1864 | } |
1872 | setSyncEventsReadOnly(); | 1865 | setSyncEventsReadOnly(); |
1873 | mCalendar->reInitAlarmSettings(); | 1866 | mCalendar->reInitAlarmSettings(); |
1874 | updateUnmanagedViews(); | 1867 | updateUnmanagedViews(); |
1875 | updateView(); | 1868 | updateView(); |
1876 | return true; | 1869 | return true; |
1877 | } | 1870 | } |
1878 | void CalendarView::addCalendarId( int id ) | 1871 | void CalendarView::addCalendarId( int id ) |
1879 | { | 1872 | { |
1880 | KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); | 1873 | KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); |
1881 | addCalendar( cal ); | 1874 | addCalendar( cal ); |
1882 | } | 1875 | } |
1883 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) | 1876 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) |
1884 | { | 1877 | { |
1885 | cal->mErrorOnLoad = false; | 1878 | cal->mErrorOnLoad = false; |
1886 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { | 1879 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { |
1887 | cal->mLoadDt = QDateTime::currentDateTime(); | 1880 | cal->mLoadDt = QDateTime::currentDateTime(); |
1888 | return true; | 1881 | return true; |
1889 | } | 1882 | } |
1890 | qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() ); | 1883 | qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() ); |
1891 | KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName)); | 1884 | KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName)); |