author | zautrix <zautrix> | 2004-10-05 08:07:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-05 08:07:41 (UTC) |
commit | ad859d26b813101adab963f50e694961702561d9 (patch) (unidiff) | |
tree | 36eb7f12ee6ee80f50cdd13bbfaba74e9a1b37d1 | |
parent | fc2c103f45a6d4e4105259436266538c645f2c87 (diff) | |
download | kdepimpi-ad859d26b813101adab963f50e694961702561d9.zip kdepimpi-ad859d26b813101adab963f50e694961702561d9.tar.gz kdepimpi-ad859d26b813101adab963f50e694961702561d9.tar.bz2 |
cleanup
-rw-r--r-- | korganizer/calendarview.cpp | 20 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 115 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 2 | ||||
-rw-r--r-- | libkcal/calstorage.h | 2 | ||||
-rw-r--r-- | libkcal/filestorage.cpp | 4 | ||||
-rw-r--r-- | libkcal/filestorage.h | 2 | ||||
-rw-r--r-- | libkcal/icalformat.cpp | 24 | ||||
-rw-r--r-- | libkcal/icalformat.h | 3 |
10 files changed, 20 insertions, 154 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index eaea040..fecc7e2 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1216,24 +1216,24 @@ bool CalendarView::syncCalendar(QString filename, int mode) | |||
1216 | { | 1216 | { |
1217 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1217 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1218 | CalendarLocal* calendar = new CalendarLocal(); | 1218 | CalendarLocal* calendar = new CalendarLocal(); |
1219 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1219 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1220 | FileStorage* storage = new FileStorage( calendar ); | 1220 | FileStorage* storage = new FileStorage( calendar ); |
1221 | bool syncOK = false; | 1221 | bool syncOK = false; |
1222 | storage->setFileName( filename ); | 1222 | storage->setFileName( filename ); |
1223 | // qDebug("loading ... "); | 1223 | // qDebug("loading ... "); |
1224 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1224 | if ( storage->load() ) { |
1225 | getEventViewerDialog()->setSyncMode( true ); | 1225 | getEventViewerDialog()->setSyncMode( true ); |
1226 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1226 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1227 | getEventViewerDialog()->setSyncMode( false ); | 1227 | getEventViewerDialog()->setSyncMode( false ); |
1228 | if ( syncOK ) { | 1228 | if ( syncOK ) { |
1229 | if ( KOPrefs::instance()->mWriteBackFile ) | 1229 | if ( KOPrefs::instance()->mWriteBackFile ) |
1230 | { | 1230 | { |
1231 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1231 | storage->setSaveFormat( new ICalFormat() ); |
1232 | storage->save(); | 1232 | storage->save(); |
1233 | } | 1233 | } |
1234 | } | 1234 | } |
1235 | setModified( true ); | 1235 | setModified( true ); |
1236 | } | 1236 | } |
1237 | delete storage; | 1237 | delete storage; |
1238 | delete calendar; | 1238 | delete calendar; |
1239 | if ( syncOK ) | 1239 | if ( syncOK ) |
@@ -1494,34 +1494,36 @@ bool CalendarView::openCalendar(QString filename, bool merge) | |||
1494 | return false; | 1494 | return false; |
1495 | } | 1495 | } |
1496 | 1496 | ||
1497 | globalFlagBlockAgenda = 1; | 1497 | globalFlagBlockAgenda = 1; |
1498 | if (!merge) mCalendar->close(); | 1498 | if (!merge) mCalendar->close(); |
1499 | 1499 | ||
1500 | mStorage->setFileName( filename ); | 1500 | mStorage->setFileName( filename ); |
1501 | 1501 | ||
1502 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1502 | if ( mStorage->load() ) { |
1503 | if ( merge ) ;//setModified( true ); | 1503 | if ( merge ) ;//setModified( true ); |
1504 | else { | 1504 | else { |
1505 | //setModified( true ); | 1505 | //setModified( true ); |
1506 | mViewManager->setDocumentId( filename ); | 1506 | mViewManager->setDocumentId( filename ); |
1507 | mDialogManager->setDocumentId( filename ); | 1507 | mDialogManager->setDocumentId( filename ); |
1508 | mTodoList->setDocumentId( filename ); | 1508 | mTodoList->setDocumentId( filename ); |
1509 | } | 1509 | } |
1510 | globalFlagBlockAgenda = 2; | 1510 | globalFlagBlockAgenda = 2; |
1511 | // if ( getLastSyncEvent() ) | 1511 | // if ( getLastSyncEvent() ) |
1512 | // getLastSyncEvent()->setReadOnly( true ); | 1512 | // getLastSyncEvent()->setReadOnly( true ); |
1513 | mCalendar->reInitAlarmSettings(); | 1513 | mCalendar->reInitAlarmSettings(); |
1514 | setSyncEventsReadOnly(); | 1514 | setSyncEventsReadOnly(); |
1515 | updateUnmanagedViews(); | 1515 | updateUnmanagedViews(); |
1516 | updateView(); | 1516 | updateView(); |
1517 | if ( filename != MainWindow::defaultFileName() ) | ||
1518 | saveCalendar( MainWindow::defaultFileName() ); | ||
1519 | loadedFileVersion = QDateTime::currentDateTime(); | 1517 | loadedFileVersion = QDateTime::currentDateTime(); |
1518 | if ( filename != MainWindow::defaultFileName() ) { | ||
1519 | saveCalendar( MainWindow::defaultFileName() ); | ||
1520 | watchSavedFile(); | ||
1521 | } | ||
1520 | return true; | 1522 | return true; |
1521 | } else { | 1523 | } else { |
1522 | // while failing to load, the calendar object could | 1524 | // while failing to load, the calendar object could |
1523 | // have become partially populated. Clear it out. | 1525 | // have become partially populated. Clear it out. |
1524 | if ( !merge ) mCalendar->close(); | 1526 | if ( !merge ) mCalendar->close(); |
1525 | 1527 | ||
1526 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1528 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1527 | 1529 | ||
@@ -1595,17 +1597,17 @@ bool CalendarView::saveCalendar( QString filename ) | |||
1595 | 1597 | ||
1596 | // Store back all unsaved data into calendar object | 1598 | // Store back all unsaved data into calendar object |
1597 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1599 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1598 | if ( mViewManager->currentView() ) | 1600 | if ( mViewManager->currentView() ) |
1599 | mViewManager->currentView()->flushView(); | 1601 | mViewManager->currentView()->flushView(); |
1600 | 1602 | ||
1601 | //mStorage->setFileName( filename ); | 1603 | //mStorage->setFileName( filename ); |
1602 | 1604 | ||
1603 | mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1605 | mStorage->setSaveFormat( new ICalFormat() ); |
1604 | mStorage->setFileName( filename ); | 1606 | mStorage->setFileName( filename ); |
1605 | bool success; | 1607 | bool success; |
1606 | success = mStorage->save(); | 1608 | success = mStorage->save(); |
1607 | if ( !success ) { | 1609 | if ( !success ) { |
1608 | return false; | 1610 | return false; |
1609 | } | 1611 | } |
1610 | 1612 | ||
1611 | return true; | 1613 | return true; |
@@ -2296,17 +2298,17 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | |||
2296 | incidence = delSel.next(); | 2298 | incidence = delSel.next(); |
2297 | } | 2299 | } |
2298 | if ( beamDialog->beamVcal() ) { | 2300 | if ( beamDialog->beamVcal() ) { |
2299 | fn += ".vcs"; | 2301 | fn += ".vcs"; |
2300 | FileStorage storage( cal, fn, new VCalFormat ); | 2302 | FileStorage storage( cal, fn, new VCalFormat ); |
2301 | storage.save(); | 2303 | storage.save(); |
2302 | } else { | 2304 | } else { |
2303 | fn += ".ics"; | 2305 | fn += ".ics"; |
2304 | FileStorage storage( cal, fn, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 2306 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2305 | storage.save(); | 2307 | storage.save(); |
2306 | } | 2308 | } |
2307 | delete cal; | 2309 | delete cal; |
2308 | mes = i18n("KO/Pi: Ready for beaming"); | 2310 | mes = i18n("KO/Pi: Ready for beaming"); |
2309 | setCaption(mes); | 2311 | setCaption(mes); |
2310 | 2312 | ||
2311 | #ifndef DESKTOP_VERSION | 2313 | #ifndef DESKTOP_VERSION |
2312 | Ir *ir = new Ir( this ); | 2314 | Ir *ir = new Ir( this ); |
@@ -2851,17 +2853,17 @@ void CalendarView::action_mail() | |||
2851 | CalendarLocal cal_tmp; | 2853 | CalendarLocal cal_tmp; |
2852 | Event *event = 0; | 2854 | Event *event = 0; |
2853 | Event *ev = 0; | 2855 | Event *ev = 0; |
2854 | if ( incidence && incidence->type() == "Event" ) { | 2856 | if ( incidence && incidence->type() == "Event" ) { |
2855 | event = static_cast<Event *>(incidence); | 2857 | event = static_cast<Event *>(incidence); |
2856 | ev = new Event(*event); | 2858 | ev = new Event(*event); |
2857 | cal_tmp.addEvent(ev); | 2859 | cal_tmp.addEvent(ev); |
2858 | } | 2860 | } |
2859 | ICalFormat mForm( KOPrefs::instance()->mUseQuicksave); | 2861 | ICalFormat mForm(); |
2860 | QString attachment = mForm.toString( &cal_tmp ); | 2862 | QString attachment = mForm.toString( &cal_tmp ); |
2861 | if (ev) delete(ev); | 2863 | if (ev) delete(ev); |
2862 | 2864 | ||
2863 | mailClient.mailAttendees(currentSelection(), attachment); | 2865 | mailClient.mailAttendees(currentSelection(), attachment); |
2864 | 2866 | ||
2865 | #endif | 2867 | #endif |
2866 | 2868 | ||
2867 | #if 0 | 2869 | #if 0 |
@@ -3136,17 +3138,17 @@ void CalendarView::printPreview() | |||
3136 | 3138 | ||
3137 | void CalendarView::exportICalendar() | 3139 | void CalendarView::exportICalendar() |
3138 | { | 3140 | { |
3139 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 3141 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
3140 | 3142 | ||
3141 | // Force correct extension | 3143 | // Force correct extension |
3142 | if (filename.right(4) != ".ics") filename += ".ics"; | 3144 | if (filename.right(4) != ".ics") filename += ".ics"; |
3143 | 3145 | ||
3144 | FileStorage storage( mCalendar, filename, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 3146 | FileStorage storage( mCalendar, filename, new ICalFormat() ); |
3145 | storage.save(); | 3147 | storage.save(); |
3146 | } | 3148 | } |
3147 | 3149 | ||
3148 | bool CalendarView::exportVCalendar( QString filename ) | 3150 | bool CalendarView::exportVCalendar( QString filename ) |
3149 | { | 3151 | { |
3150 | if (mCalendar->journals().count() > 0) { | 3152 | if (mCalendar->journals().count() > 0) { |
3151 | int result = KMessageBox::warningContinueCancel(this, | 3153 | int result = KMessageBox::warningContinueCancel(this, |
3152 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 3154 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 0034715..e0623d5 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -219,17 +219,16 @@ KOPrefs::KOPrefs() : | |||
219 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); | 219 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); |
220 | 220 | ||
221 | 221 | ||
222 | KPrefs::setCurrentGroup("Locale"); | 222 | KPrefs::setCurrentGroup("Locale"); |
223 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | 223 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); |
224 | addItemInt("PreferredTime",&mPreferredTime,0); | 224 | addItemInt("PreferredTime",&mPreferredTime,0); |
225 | addItemInt("PreferredDate",&mPreferredDate,0); | 225 | addItemInt("PreferredDate",&mPreferredDate,0); |
226 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | 226 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); |
227 | addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); | ||
228 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 227 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
229 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | 228 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); |
230 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | 229 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); |
231 | 230 | ||
232 | 231 | ||
233 | KPrefs::setCurrentGroup("Colors"); | 232 | KPrefs::setCurrentGroup("Colors"); |
234 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 233 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
235 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 234 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 696433e..7abd741 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -261,17 +261,16 @@ class KOPrefs : public KPimPrefs | |||
261 | bool mWNViewShowLocation; | 261 | bool mWNViewShowLocation; |
262 | bool mTodoViewShowsPercentage; | 262 | bool mTodoViewShowsPercentage; |
263 | bool mTodoViewUsesCatColors; | 263 | bool mTodoViewUsesCatColors; |
264 | bool mTodoViewUsesSmallFont; | 264 | bool mTodoViewUsesSmallFont; |
265 | bool mTodoViewUsesForegroundColor; | 265 | bool mTodoViewUsesForegroundColor; |
266 | bool mMonthViewUsesForegroundColor; | 266 | bool mMonthViewUsesForegroundColor; |
267 | 267 | ||
268 | bool mHightlightDateTimeEdit; | 268 | bool mHightlightDateTimeEdit; |
269 | bool mUseQuicksave; | ||
270 | bool mShortDateInViewer; | 269 | bool mShortDateInViewer; |
271 | 270 | ||
272 | QStringList mLocationDefaults; | 271 | QStringList mLocationDefaults; |
273 | QStringList mEventSummaryUser; | 272 | QStringList mEventSummaryUser; |
274 | QStringList mTodoSummaryUser; | 273 | QStringList mTodoSummaryUser; |
275 | 274 | ||
276 | bool mUseInternalAlarmNotification; | 275 | bool mUseInternalAlarmNotification; |
277 | int mAlarmPlayBeeps; | 276 | int mAlarmPlayBeeps; |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 5aa75f5..43ee2d7 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1947,43 +1947,38 @@ void MainWindow::enableQuick() | |||
1947 | } | 1947 | } |
1948 | 1948 | ||
1949 | void MainWindow::getFile( bool success ) | 1949 | void MainWindow::getFile( bool success ) |
1950 | { | 1950 | { |
1951 | if ( ! success ) { | 1951 | if ( ! success ) { |
1952 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 1952 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
1953 | return; | 1953 | return; |
1954 | } | 1954 | } |
1955 | // pending adjust time for watchSavedFile() | 1955 | mView->watchSavedFile(); |
1956 | //mView->watchSavedFile(); | ||
1957 | mView->openCalendar( defaultFileName() ); | 1956 | mView->openCalendar( defaultFileName() ); |
1958 | setCaption( i18n("Pi-Sync successful!") ); | 1957 | setCaption( i18n("Pi-Sync successful!") ); |
1959 | 1958 | ||
1960 | } | 1959 | } |
1961 | 1960 | ||
1962 | 1961 | ||
1963 | void MainWindow::syncPi() | 1962 | void MainWindow::syncPi() |
1964 | { | 1963 | { |
1965 | qApp->processEvents(); | 1964 | qApp->processEvents(); |
1966 | performQuickQuick(); | ||
1967 | } | ||
1968 | |||
1969 | void MainWindow::performQuickQuick() | ||
1970 | { | ||
1971 | bool ok; | 1965 | bool ok; |
1972 | Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok); | 1966 | Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok); |
1973 | if ( ! ok ) { | 1967 | if ( ! ok ) { |
1974 | setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 1968 | setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
1975 | return; | 1969 | return; |
1976 | } | 1970 | } |
1977 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, KOPrefs::instance()->mActiveSyncIP, this ); | 1971 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, KOPrefs::instance()->mActiveSyncIP, this ); |
1978 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1972 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
1979 | setCaption( i18n("Sending request for remote file ...") ); | 1973 | setCaption( i18n("Sending request for remote file ...") ); |
1980 | commandSocket->readFile( syncFileName() ); | 1974 | commandSocket->readFile( syncFileName() ); |
1981 | } | 1975 | } |
1976 | |||
1982 | void MainWindow::deleteCommandSocket(KCommandSocket*s, int state) | 1977 | void MainWindow::deleteCommandSocket(KCommandSocket*s, int state) |
1983 | { | 1978 | { |
1984 | qDebug("MainWindow::deleteCommandSocket %d", state); | 1979 | qDebug("MainWindow::deleteCommandSocket %d", state); |
1985 | 1980 | ||
1986 | //enum { success, errorW, errorR, quiet }; | 1981 | //enum { success, errorW, errorR, quiet }; |
1987 | if ( state == KCommandSocket::errorR ) { | 1982 | if ( state == KCommandSocket::errorR ) { |
1988 | setCaption( i18n("ERROR: Receiving remote file failed.") ); | 1983 | setCaption( i18n("ERROR: Receiving remote file failed.") ); |
1989 | delete s; | 1984 | delete s; |
@@ -2161,122 +2156,16 @@ void MainWindow::syncRemote( KSyncProfile* prof, bool ask) | |||
2161 | return; | 2156 | return; |
2162 | } else { | 2157 | } else { |
2163 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 2158 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
2164 | } | 2159 | } |
2165 | } | 2160 | } |
2166 | } | 2161 | } |
2167 | return; | 2162 | return; |
2168 | } | 2163 | } |
2169 | void MainWindow::syncSSH() | ||
2170 | { | ||
2171 | // not used anymore | ||
2172 | QTime timer; | ||
2173 | timer.start(); | ||
2174 | //qDebug("MainWindow::syncssh() "); | ||
2175 | KOPrefs *p = KOPrefs::instance(); | ||
2176 | QString localFile = p->mLocalTempFile; | ||
2177 | QString remoteIP = p->mRemoteIP; | ||
2178 | QString remoteUser = p->mRemoteUser; | ||
2179 | QString remoteFile = p->mRemoteFile; | ||
2180 | if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) | ||
2181 | remoteUser += ":" + p->mRemotePassWd; | ||
2182 | |||
2183 | QString question = i18n("Do you really want\nto remote sync?\n \n") + | ||
2184 | i18n("IP: " ) +remoteIP +"\n" + | ||
2185 | i18n("User: " ) + remoteUser +"\n" ; | ||
2186 | int maxlen = 30; | ||
2187 | if ( QApplication::desktop()->width() > 320 ) | ||
2188 | maxlen += 25; | ||
2189 | if ( remoteFile.length() > maxlen ) | ||
2190 | question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; | ||
2191 | else | ||
2192 | question += i18n("Remote file:\n " ) + remoteFile +"\n"; | ||
2193 | if ( localFile.length() > maxlen ) | ||
2194 | question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; | ||
2195 | else | ||
2196 | question += i18n("Local temp file:\n " ) + localFile +"\n"; | ||
2197 | |||
2198 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | ||
2199 | question, | ||
2200 | i18n("Yes"), i18n("No"), | ||
2201 | 0, 0 ) != 0 ) | ||
2202 | return; | ||
2203 | // if ( !p->mUsePassWd ) { | ||
2204 | // QString pass = getPassword(); | ||
2205 | // if ( pass.length() > 0 ) | ||
2206 | // remoteUser += ":" + pass; | ||
2207 | // } | ||
2208 | QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; | ||
2209 | setCaption ( i18n( "Copy remote file to local machine..." ) ); | ||
2210 | int fileSize = 0; | ||
2211 | int result = system ( command ); | ||
2212 | // 0 : okay | ||
2213 | // 256: no such file or dir | ||
2214 | // | ||
2215 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | ||
2216 | if ( result != 0 ) { | ||
2217 | int len = maxlen; | ||
2218 | while ( len < command.length() ) { | ||
2219 | command.insert( len , "\n" ); | ||
2220 | len += maxlen +2; | ||
2221 | } | ||
2222 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | ||
2223 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | ||
2224 | question, | ||
2225 | i18n("Okay!")) ; | ||
2226 | setCaption ("KO/Pi"); | ||
2227 | return; | ||
2228 | } | ||
2229 | |||
2230 | |||
2231 | setCaption ( i18n( "Copying succeed." ) ); | ||
2232 | //mView->setSyncDevice("ssh-scp" ); | ||
2233 | if ( syncWithFile(localFile , true ) ) { | ||
2234 | // Event* e = mView->getLastSyncEvent(); | ||
2235 | // e->setReadOnly( false ); | ||
2236 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | ||
2237 | // e->setReadOnly( true ); | ||
2238 | if ( KOPrefs::instance()->mWriteBackFile ) { | ||
2239 | command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; | ||
2240 | setCaption ( i18n( "Writing back file ..." ) ); | ||
2241 | result = system ( command ); | ||
2242 | if ( result != 0 ) { | ||
2243 | int len = maxlen; | ||
2244 | while ( len < command.length() ) { | ||
2245 | command.insert( len , "\n" ); | ||
2246 | len += maxlen +2; | ||
2247 | } | ||
2248 | question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | ||
2249 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | ||
2250 | question, | ||
2251 | i18n("Okay!")) ; | ||
2252 | setCaption ("KO/Pi"); | ||
2253 | return; | ||
2254 | } else { | ||
2255 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | ||
2256 | } | ||
2257 | } | ||
2258 | } | ||
2259 | return; | ||
2260 | #if 0 | ||
2261 | system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); | ||
2262 | while ( timer.elapsed() < 5000 ) | ||
2263 | qApp->processEvents(); | ||
2264 | |||
2265 | qDebug("MainWindow::merging) "); | ||
2266 | mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); | ||
2267 | while ( mBlockSaveFlag ) | ||
2268 | qApp->processEvents(); | ||
2269 | save(); | ||
2270 | system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); | ||
2271 | #endif | ||
2272 | |||
2273 | } | ||
2274 | |||
2275 | 2164 | ||
2276 | void MainWindow::syncSharp() | 2165 | void MainWindow::syncSharp() |
2277 | { | 2166 | { |
2278 | if ( mCalendarModifiedFlag ) | 2167 | if ( mCalendarModifiedFlag ) |
2279 | save(); | 2168 | save(); |
2280 | mView->syncSharp(); | 2169 | mView->syncSharp(); |
2281 | slotModifiedChanged( true ); | 2170 | slotModifiedChanged( true ); |
2282 | 2171 | ||
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 4da371e..ba627b9 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -140,17 +140,16 @@ class MainWindow : public QMainWindow | |||
140 | void printCal(); | 140 | void printCal(); |
141 | void saveCalendar(); | 141 | void saveCalendar(); |
142 | void loadCalendar(); | 142 | void loadCalendar(); |
143 | void exportVCalendar(); | 143 | void exportVCalendar(); |
144 | void fillFilterMenu(); | 144 | void fillFilterMenu(); |
145 | void selectFilter( int ); | 145 | void selectFilter( int ); |
146 | 146 | ||
147 | void slotSyncMenu( int ); | 147 | void slotSyncMenu( int ); |
148 | void syncSSH(); | ||
149 | void confSync(); | 148 | void confSync(); |
150 | void syncSharp(); | 149 | void syncSharp(); |
151 | void syncPhone(); | 150 | void syncPhone(); |
152 | void syncPi(); | 151 | void syncPi(); |
153 | void syncLocalFile(); | 152 | void syncLocalFile(); |
154 | bool syncWithFile( QString, bool ); | 153 | bool syncWithFile( QString, bool ); |
155 | void quickSyncLocalFile(); | 154 | void quickSyncLocalFile(); |
156 | 155 | ||
@@ -172,17 +171,16 @@ class MainWindow : public QMainWindow | |||
172 | private: | 171 | private: |
173 | //QTimer* mTimerCommandSocket; | 172 | //QTimer* mTimerCommandSocket; |
174 | QString mPassWordPiSync; | 173 | QString mPassWordPiSync; |
175 | KServerSocket * mServerSocket; | 174 | KServerSocket * mServerSocket; |
176 | bool mClosed; | 175 | bool mClosed; |
177 | void saveOnClose(); | 176 | void saveOnClose(); |
178 | int mCurrentSyncProfile; | 177 | int mCurrentSyncProfile; |
179 | void enableQuick(); | 178 | void enableQuick(); |
180 | void performQuickQuick(); | ||
181 | void syncRemote( KSyncProfile* , bool ask = true); | 179 | void syncRemote( KSyncProfile* , bool ask = true); |
182 | bool mFlagKeyPressed; | 180 | bool mFlagKeyPressed; |
183 | bool mBlockAtStartup; | 181 | bool mBlockAtStartup; |
184 | QPEToolBar *iconToolBar; | 182 | QPEToolBar *iconToolBar; |
185 | void initActions(); | 183 | void initActions(); |
186 | void setDefaultPreferences(); | 184 | void setDefaultPreferences(); |
187 | void keyPressEvent ( QKeyEvent * ) ; | 185 | void keyPressEvent ( QKeyEvent * ) ; |
188 | void keyReleaseEvent ( QKeyEvent * ) ; | 186 | void keyReleaseEvent ( QKeyEvent * ) ; |
diff --git a/libkcal/calstorage.h b/libkcal/calstorage.h index 72972ea..82c8682 100644 --- a/libkcal/calstorage.h +++ b/libkcal/calstorage.h | |||
@@ -34,17 +34,17 @@ class CalStorage | |||
34 | { | 34 | { |
35 | mCalendar = calendar; | 35 | mCalendar = calendar; |
36 | } | 36 | } |
37 | virtual ~CalStorage() {} | 37 | virtual ~CalStorage() {} |
38 | 38 | ||
39 | Calendar *calendar() const { return mCalendar; } | 39 | Calendar *calendar() const { return mCalendar; } |
40 | 40 | ||
41 | virtual bool open() = 0; | 41 | virtual bool open() = 0; |
42 | virtual bool load(bool = false ) = 0; | 42 | virtual bool load( ) = 0; |
43 | virtual bool save() = 0; | 43 | virtual bool save() = 0; |
44 | virtual bool close() = 0; | 44 | virtual bool close() = 0; |
45 | 45 | ||
46 | private: | 46 | private: |
47 | Calendar *mCalendar; | 47 | Calendar *mCalendar; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | } | 50 | } |
diff --git a/libkcal/filestorage.cpp b/libkcal/filestorage.cpp index 00c15d9..a139124 100644 --- a/libkcal/filestorage.cpp +++ b/libkcal/filestorage.cpp | |||
@@ -71,27 +71,27 @@ CalFormat *FileStorage::saveFormat()const | |||
71 | } | 71 | } |
72 | 72 | ||
73 | 73 | ||
74 | bool FileStorage::open() | 74 | bool FileStorage::open() |
75 | { | 75 | { |
76 | return true; | 76 | return true; |
77 | } | 77 | } |
78 | 78 | ||
79 | bool FileStorage::load( bool quick ) | 79 | bool FileStorage::load( ) |
80 | { | 80 | { |
81 | kdDebug(5800) << "FileStorage::load(): '" << mFileName << "'" << endl; | 81 | kdDebug(5800) << "FileStorage::load(): '" << mFileName << "'" << endl; |
82 | 82 | ||
83 | // do we want to silently accept this, or make some noise? Dunno... | 83 | // do we want to silently accept this, or make some noise? Dunno... |
84 | // it is a semantical thing vs. a practical thing. | 84 | // it is a semantical thing vs. a practical thing. |
85 | if (mFileName.isEmpty()) return false; | 85 | if (mFileName.isEmpty()) return false; |
86 | 86 | ||
87 | // Always try to load with iCalendar. It will detect, if it is actually a | 87 | // Always try to load with iCalendar. It will detect, if it is actually a |
88 | // vCalendar file. | 88 | // vCalendar file. |
89 | ICalFormat iCal (quick ); | 89 | ICalFormat iCal; |
90 | 90 | ||
91 | bool success = iCal.load( calendar(), mFileName); | 91 | bool success = iCal.load( calendar(), mFileName); |
92 | 92 | ||
93 | if ( !success ) { | 93 | if ( !success ) { |
94 | if ( iCal.exception() ) { | 94 | if ( iCal.exception() ) { |
95 | // kdDebug(5800) << "---Error: " << mFormat->exception()->errorCode() << endl; | 95 | // kdDebug(5800) << "---Error: " << mFormat->exception()->errorCode() << endl; |
96 | if ( iCal.exception()->errorCode() == ErrorFormat::CalVersion1 ) { | 96 | if ( iCal.exception()->errorCode() == ErrorFormat::CalVersion1 ) { |
97 | // Expected non vCalendar file, but detected vCalendar | 97 | // Expected non vCalendar file, but detected vCalendar |
diff --git a/libkcal/filestorage.h b/libkcal/filestorage.h index e9dc15e..17010ac 100644 --- a/libkcal/filestorage.h +++ b/libkcal/filestorage.h | |||
@@ -39,17 +39,17 @@ class FileStorage : public CalStorage | |||
39 | 39 | ||
40 | /** | 40 | /** |
41 | FileStorage takes ownership of format object. | 41 | FileStorage takes ownership of format object. |
42 | */ | 42 | */ |
43 | void setSaveFormat( CalFormat * ); | 43 | void setSaveFormat( CalFormat * ); |
44 | CalFormat *saveFormat()const; | 44 | CalFormat *saveFormat()const; |
45 | 45 | ||
46 | bool open(); | 46 | bool open(); |
47 | bool load(bool quick = false ); | 47 | bool load( ); |
48 | bool save(); | 48 | bool save(); |
49 | bool close(); | 49 | bool close(); |
50 | 50 | ||
51 | private: | 51 | private: |
52 | QString mFileName; | 52 | QString mFileName; |
53 | CalFormat *mSaveFormat; | 53 | CalFormat *mSaveFormat; |
54 | }; | 54 | }; |
55 | 55 | ||
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp index f2e7dfc..3a2aac6 100644 --- a/libkcal/icalformat.cpp +++ b/libkcal/icalformat.cpp | |||
@@ -45,19 +45,18 @@ extern "C" { | |||
45 | 45 | ||
46 | #include "icalformat.h" | 46 | #include "icalformat.h" |
47 | #include "icalformatimpl.h" | 47 | #include "icalformatimpl.h" |
48 | 48 | ||
49 | #define _ICAL_VERSION "2.0" | 49 | #define _ICAL_VERSION "2.0" |
50 | 50 | ||
51 | using namespace KCal; | 51 | using namespace KCal; |
52 | 52 | ||
53 | ICalFormat::ICalFormat(bool quick ) | 53 | ICalFormat::ICalFormat( ) |
54 | { | 54 | { |
55 | mQuicksave = false; //quick; | ||
56 | mImpl = new ICalFormatImpl( this ); | 55 | mImpl = new ICalFormatImpl( this ); |
57 | tzOffsetMin = 0; | 56 | tzOffsetMin = 0; |
58 | //qDebug("new ICalFormat() "); | 57 | //qDebug("new ICalFormat() "); |
59 | } | 58 | } |
60 | 59 | ||
61 | ICalFormat::~ICalFormat() | 60 | ICalFormat::~ICalFormat() |
62 | { | 61 | { |
63 | delete mImpl; | 62 | delete mImpl; |
@@ -71,26 +70,17 @@ bool ICalFormat::load( Calendar *calendar, const QString &fileName) | |||
71 | 70 | ||
72 | QFile file( fileName ); | 71 | QFile file( fileName ); |
73 | if (!file.open( IO_ReadOnly ) ) { | 72 | if (!file.open( IO_ReadOnly ) ) { |
74 | setException(new ErrorFormat(ErrorFormat::LoadError)); | 73 | setException(new ErrorFormat(ErrorFormat::LoadError)); |
75 | return false; | 74 | return false; |
76 | } | 75 | } |
77 | QTextStream ts( &file ); | 76 | QTextStream ts( &file ); |
78 | QString text; | 77 | QString text; |
79 | #if 0 | 78 | |
80 | if ( !mQuicksave ) { | ||
81 | qDebug("KO: No quickload!"); | ||
82 | ts.setEncoding( QTextStream::Latin1 ); | ||
83 | text = ts.read(); | ||
84 | } else { | ||
85 | ts.setCodec( QTextCodec::codecForName("utf8") ); | ||
86 | text = ts.read(); | ||
87 | } | ||
88 | #endif | ||
89 | ts.setEncoding( QTextStream::Latin1 ); | 79 | ts.setEncoding( QTextStream::Latin1 ); |
90 | text = ts.read(); | 80 | text = ts.read(); |
91 | file.close(); | 81 | file.close(); |
92 | 82 | ||
93 | return fromString( calendar, text ); | 83 | return fromString( calendar, text ); |
94 | } | 84 | } |
95 | 85 | ||
96 | //#include <qdatetime.h> | 86 | //#include <qdatetime.h> |
@@ -109,26 +99,16 @@ bool ICalFormat::save( Calendar *calendar, const QString &fileName ) | |||
109 | QFile file( fileName ); | 99 | QFile file( fileName ); |
110 | if (!file.open( IO_WriteOnly ) ) { | 100 | if (!file.open( IO_WriteOnly ) ) { |
111 | setException(new ErrorFormat(ErrorFormat::SaveError, | 101 | setException(new ErrorFormat(ErrorFormat::SaveError, |
112 | i18n("Could not open file '%1'").arg(fileName))); | 102 | i18n("Could not open file '%1'").arg(fileName))); |
113 | return false; | 103 | return false; |
114 | } | 104 | } |
115 | QTextStream ts( &file ); | 105 | QTextStream ts( &file ); |
116 | 106 | ||
117 | // #ifdef DESKTOP_VERSION | ||
118 | // mQuicksave = false; | ||
119 | // #endif | ||
120 | // if ( mQuicksave ) { | ||
121 | // ts << text.utf8(); | ||
122 | // } else { | ||
123 | // ts.setEncoding( QTextStream::Latin1 ); | ||
124 | // ts << text; | ||
125 | // //ts << text.latin1(); | ||
126 | // } | ||
127 | ts.setEncoding( QTextStream::Latin1 ); | 107 | ts.setEncoding( QTextStream::Latin1 ); |
128 | ts << text; | 108 | ts << text; |
129 | file.close(); | 109 | file.close(); |
130 | //qDebug("saving file takes ms: %d ", is.elapsed() ); | 110 | //qDebug("saving file takes ms: %d ", is.elapsed() ); |
131 | return true; | 111 | return true; |
132 | } | 112 | } |
133 | 113 | ||
134 | bool ICalFormat::fromString( Calendar *cal, const QString &text ) | 114 | bool ICalFormat::fromString( Calendar *cal, const QString &text ) |
diff --git a/libkcal/icalformat.h b/libkcal/icalformat.h index 236efbf..485ab6e 100644 --- a/libkcal/icalformat.h +++ b/libkcal/icalformat.h | |||
@@ -35,17 +35,17 @@ class ICalFormatImpl; | |||
35 | loading/saving/converting iCalendar format data into the internal KOrganizer | 35 | loading/saving/converting iCalendar format data into the internal KOrganizer |
36 | representation as Calendar and Events. | 36 | representation as Calendar and Events. |
37 | 37 | ||
38 | @short iCalendar format implementation | 38 | @short iCalendar format implementation |
39 | */ | 39 | */ |
40 | class ICalFormat : public CalFormat { | 40 | class ICalFormat : public CalFormat { |
41 | public: | 41 | public: |
42 | /** Create new iCalendar format. */ | 42 | /** Create new iCalendar format. */ |
43 | ICalFormat( bool quick = false ); | 43 | ICalFormat( ); |
44 | virtual ~ICalFormat(); | 44 | virtual ~ICalFormat(); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | Loads a calendar on disk in iCalendar format into calendar. | 47 | Loads a calendar on disk in iCalendar format into calendar. |
48 | Returns true if successful, else returns false. Provides more error | 48 | Returns true if successful, else returns false. Provides more error |
49 | information by exception(). | 49 | information by exception(). |
50 | @param calendar Calendar object to be filled. | 50 | @param calendar Calendar object to be filled. |
51 | @param fileName The name of the calendar file on disk. | 51 | @param fileName The name of the calendar file on disk. |
@@ -99,17 +99,16 @@ class ICalFormat : public CalFormat { | |||
99 | void setTimeZone( const QString &id, bool utc ); | 99 | void setTimeZone( const QString &id, bool utc ); |
100 | QString timeZoneId() const; | 100 | QString timeZoneId() const; |
101 | int timeOffset(); | 101 | int timeOffset(); |
102 | const char * tzString(); | 102 | const char * tzString(); |
103 | bool utc() const; | 103 | bool utc() const; |
104 | 104 | ||
105 | private: | 105 | private: |
106 | ICalFormatImpl *mImpl; | 106 | ICalFormatImpl *mImpl; |
107 | bool mQuicksave; | ||
108 | QString mTimeZoneId; | 107 | QString mTimeZoneId; |
109 | QCString mTzString; | 108 | QCString mTzString; |
110 | int tzOffsetMin; | 109 | int tzOffsetMin; |
111 | bool mUtc; | 110 | bool mUtc; |
112 | }; | 111 | }; |
113 | 112 | ||
114 | } | 113 | } |
115 | 114 | ||