-rw-r--r-- | kaddressbook/kabcore.cpp | 1 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 136 | ||||
-rw-r--r-- | korganizer/calendarview.h | 9 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 3 | ||||
-rw-r--r-- | korganizer/koprefs.h | 20 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 554 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 24 | ||||
-rw-r--r-- | libkdepim/kpimprefs.cpp | 9 | ||||
-rw-r--r-- | libkdepim/kpimprefs.h | 3 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 72 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 3 |
11 files changed, 137 insertions, 697 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 12502b0..c5406bf 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2881,7 +2881,6 @@ QString KABCore::sentSyncFile() | |||
2881 | } | 2881 | } |
2882 | 2882 | ||
2883 | void KABCore::setCaptionBack() | 2883 | void KABCore::setCaptionBack() |
2884 | { | 2884 | { |
2885 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); | 2885 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); |
2886 | } | 2886 | } |
2887 | |||
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index ea9607d..b56f1f9 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -697,25 +697,13 @@ void CalendarView::createPrinter() | |||
697 | } | 697 | } |
698 | #endif | 698 | #endif |
699 | } | 699 | } |
700 | 700 | ||
701 | void CalendarView::confSync() | 701 | void CalendarView::confSync() |
702 | { | 702 | { |
703 | static KSyncPrefsDialog* sp = 0; | 703 | //DELETE |
704 | if ( ! sp ) { | ||
705 | sp = new KSyncPrefsDialog( this, "syncprefs", true ); | ||
706 | } | ||
707 | sp->usrReadConfig(); | ||
708 | #ifndef DESKTOP_VERSION | ||
709 | sp->showMaximized(); | ||
710 | #else | ||
711 | sp->show(); | ||
712 | #endif | ||
713 | sp->exec(); | ||
714 | KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); | ||
715 | KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); | ||
716 | } | 704 | } |
717 | 705 | ||
718 | 706 | ||
719 | //KOPrefs::instance()->mWriteBackFile | 707 | //KOPrefs::instance()->mWriteBackFile |
720 | //KOPrefs::instance()->mWriteBackExistingOnly | 708 | //KOPrefs::instance()->mWriteBackExistingOnly |
721 | 709 | ||
@@ -874,13 +862,13 @@ Event* CalendarView::getLastSyncEvent() | |||
874 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 862 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
875 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 863 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
876 | if (!lse) { | 864 | if (!lse) { |
877 | lse = new Event(); | 865 | lse = new Event(); |
878 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 866 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
879 | QString sum = ""; | 867 | QString sum = ""; |
880 | if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 868 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
881 | sum = "E: "; | 869 | sum = "E: "; |
882 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 870 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
883 | lse->setDtStart( mLastCalendarSync ); | 871 | lse->setDtStart( mLastCalendarSync ); |
884 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 872 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
885 | lse->setCategories( i18n("SyncEvent") ); | 873 | lse->setCategories( i18n("SyncEvent") ); |
886 | lse->setReadOnly( true ); | 874 | lse->setReadOnly( true ); |
@@ -1116,13 +1104,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1116 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1104 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1117 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1105 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1118 | checkExternSyncEvent(eventLSyncSharp, inL); | 1106 | checkExternSyncEvent(eventLSyncSharp, inL); |
1119 | local->deleteIncidence( inL ); | 1107 | local->deleteIncidence( inL ); |
1120 | ++deletedEventL; | 1108 | ++deletedEventL; |
1121 | } else { | 1109 | } else { |
1122 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1110 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1123 | inL->removeID(mCurrentSyncDevice ); | 1111 | inL->removeID(mCurrentSyncDevice ); |
1124 | ++addedEventR; | 1112 | ++addedEventR; |
1125 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1113 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1126 | inL->setLastModified( modifiedCalendar ); | 1114 | inL->setLastModified( modifiedCalendar ); |
1127 | inR = inL->clone(); | 1115 | inR = inL->clone(); |
1128 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1116 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
@@ -1132,30 +1120,30 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1132 | } else { | 1120 | } else { |
1133 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1121 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1134 | checkExternSyncEvent(eventLSyncSharp, inL); | 1122 | checkExternSyncEvent(eventLSyncSharp, inL); |
1135 | local->deleteIncidence( inL ); | 1123 | local->deleteIncidence( inL ); |
1136 | ++deletedEventL; | 1124 | ++deletedEventL; |
1137 | } else { | 1125 | } else { |
1138 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1126 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1139 | ++addedEventR; | 1127 | ++addedEventR; |
1140 | inL->setLastModified( modifiedCalendar ); | 1128 | inL->setLastModified( modifiedCalendar ); |
1141 | remote->addIncidence( inL->clone() ); | 1129 | remote->addIncidence( inL->clone() ); |
1142 | } | 1130 | } |
1143 | } | 1131 | } |
1144 | } | 1132 | } |
1145 | } | 1133 | } |
1146 | } | 1134 | } |
1147 | inL = el.next(); | 1135 | inL = el.next(); |
1148 | } | 1136 | } |
1149 | int delFut = 0; | 1137 | int delFut = 0; |
1150 | if ( KOPrefs::instance()->mWriteBackInFuture ) { | 1138 | if ( mSyncManager->mWriteBackInFuture ) { |
1151 | er = remote->rawIncidences(); | 1139 | er = remote->rawIncidences(); |
1152 | inR = er.first(); | 1140 | inR = er.first(); |
1153 | QDateTime dt; | 1141 | QDateTime dt; |
1154 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1142 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1155 | QDateTime end = cur.addDays( (KOPrefs::instance()->mWriteBackInFuture +1 ) *7 ); | 1143 | QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); |
1156 | while ( inR ) { | 1144 | while ( inR ) { |
1157 | if ( inR->type() == "Todo" ) { | 1145 | if ( inR->type() == "Todo" ) { |
1158 | Todo * t = (Todo*)inR; | 1146 | Todo * t = (Todo*)inR; |
1159 | if ( t->hasDueDate() ) | 1147 | if ( t->hasDueDate() ) |
1160 | dt = t->dtDue(); | 1148 | dt = t->dtDue(); |
1161 | else | 1149 | else |
@@ -1189,16 +1177,16 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1189 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 1177 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
1190 | remote->addEvent( eventRSync ); | 1178 | remote->addEvent( eventRSync ); |
1191 | QString mes; | 1179 | QString mes; |
1192 | 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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); | 1180 | 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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); |
1193 | QString delmess; | 1181 | QString delmess; |
1194 | if ( delFut ) { | 1182 | if ( delFut ) { |
1195 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture ); | 1183 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, mSyncManager->mWriteBackInFuture ); |
1196 | mes += delmess; | 1184 | mes += delmess; |
1197 | } | 1185 | } |
1198 | if ( KOPrefs::instance()->mShowSyncSummary ) { | 1186 | if ( mSyncManager->mShowSyncSummary ) { |
1199 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); | 1187 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); |
1200 | } | 1188 | } |
1201 | qDebug( mes ); | 1189 | qDebug( mes ); |
1202 | mCalendar->checkAlarmForIncidence( 0, true ); | 1190 | mCalendar->checkAlarmForIncidence( 0, true ); |
1203 | return syncOK; | 1191 | return syncOK; |
1204 | } | 1192 | } |
@@ -1222,13 +1210,13 @@ bool CalendarView::syncCalendar(QString filename, int mode) | |||
1222 | // qDebug("loading ... "); | 1210 | // qDebug("loading ... "); |
1223 | if ( storage->load() ) { | 1211 | if ( storage->load() ) { |
1224 | getEventViewerDialog()->setSyncMode( true ); | 1212 | getEventViewerDialog()->setSyncMode( true ); |
1225 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1213 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1226 | getEventViewerDialog()->setSyncMode( false ); | 1214 | getEventViewerDialog()->setSyncMode( false ); |
1227 | if ( syncOK ) { | 1215 | if ( syncOK ) { |
1228 | if ( KOPrefs::instance()->mWriteBackFile ) | 1216 | if ( mSyncManager->mWriteBackFile ) |
1229 | { | 1217 | { |
1230 | storage->setSaveFormat( new ICalFormat() ); | 1218 | storage->setSaveFormat( new ICalFormat() ); |
1231 | storage->save(); | 1219 | storage->save(); |
1232 | } | 1220 | } |
1233 | } | 1221 | } |
1234 | setModified( true ); | 1222 | setModified( true ); |
@@ -1238,20 +1226,18 @@ bool CalendarView::syncCalendar(QString filename, int mode) | |||
1238 | if ( syncOK ) | 1226 | if ( syncOK ) |
1239 | updateView(); | 1227 | updateView(); |
1240 | return syncOK; | 1228 | return syncOK; |
1241 | } | 1229 | } |
1242 | void CalendarView::syncPhone() | 1230 | void CalendarView::syncPhone() |
1243 | { | 1231 | { |
1244 | syncExternal( 1 ); | 1232 | //DELETE |
1245 | } | 1233 | } |
1246 | void CalendarView::syncExternal( int mode ) | 1234 | void CalendarView::syncExternal( int mode ) |
1247 | { | 1235 | { |
1248 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1236 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1249 | //mCurrentSyncDevice = "sharp-DTM"; | 1237 | |
1250 | if ( KOPrefs::instance()->mAskForPreferences ) | ||
1251 | edit_sync_options(); | ||
1252 | qApp->processEvents(); | 1238 | qApp->processEvents(); |
1253 | CalendarLocal* calendar = new CalendarLocal(); | 1239 | CalendarLocal* calendar = new CalendarLocal(); |
1254 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1240 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1255 | bool syncOK = false; | 1241 | bool syncOK = false; |
1256 | bool loadSuccess = false; | 1242 | bool loadSuccess = false; |
1257 | PhoneFormat* phoneFormat = 0; | 1243 | PhoneFormat* phoneFormat = 0; |
@@ -1262,26 +1248,26 @@ void CalendarView::syncExternal( int mode ) | |||
1262 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1248 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1263 | 1249 | ||
1264 | } else | 1250 | } else |
1265 | #endif | 1251 | #endif |
1266 | if ( mode == 1 ) { // phone | 1252 | if ( mode == 1 ) { // phone |
1267 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1253 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1268 | KOPrefs::instance()->mPhoneDevice, | 1254 | mSyncManager->mPhoneDevice, |
1269 | KOPrefs::instance()->mPhoneConnection, | 1255 | mSyncManager->mPhoneConnection, |
1270 | KOPrefs::instance()->mPhoneModel); | 1256 | mSyncManager->mPhoneModel); |
1271 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1257 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1272 | 1258 | ||
1273 | } else | 1259 | } else |
1274 | return; | 1260 | return; |
1275 | if ( loadSuccess ) { | 1261 | if ( loadSuccess ) { |
1276 | getEventViewerDialog()->setSyncMode( true ); | 1262 | getEventViewerDialog()->setSyncMode( true ); |
1277 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1263 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1278 | getEventViewerDialog()->setSyncMode( false ); | 1264 | getEventViewerDialog()->setSyncMode( false ); |
1279 | qApp->processEvents(); | 1265 | qApp->processEvents(); |
1280 | if ( syncOK ) { | 1266 | if ( syncOK ) { |
1281 | if ( KOPrefs::instance()->mWriteBackFile ) | 1267 | if ( mSyncManager->mWriteBackFile ) |
1282 | { | 1268 | { |
1283 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1269 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1284 | Incidence* inc = iL.first(); | 1270 | Incidence* inc = iL.first(); |
1285 | if ( phoneFormat ) { | 1271 | if ( phoneFormat ) { |
1286 | while ( inc ) { | 1272 | while ( inc ) { |
1287 | inc->removeID(mCurrentSyncDevice); | 1273 | inc->removeID(mCurrentSyncDevice); |
@@ -1326,13 +1312,13 @@ void CalendarView::syncExternal( int mode ) | |||
1326 | updateView(); | 1312 | updateView(); |
1327 | return ;//syncOK; | 1313 | return ;//syncOK; |
1328 | 1314 | ||
1329 | } | 1315 | } |
1330 | void CalendarView::syncSharp() | 1316 | void CalendarView::syncSharp() |
1331 | { | 1317 | { |
1332 | syncExternal( 0 ); | 1318 | //DELETE |
1333 | 1319 | ||
1334 | } | 1320 | } |
1335 | 1321 | ||
1336 | 1322 | ||
1337 | bool CalendarView::importBday() | 1323 | bool CalendarView::importBday() |
1338 | { | 1324 | { |
@@ -1514,13 +1500,13 @@ bool CalendarView::importQtopia( const QString &categories, | |||
1514 | updateView(); | 1500 | updateView(); |
1515 | return true; | 1501 | return true; |
1516 | 1502 | ||
1517 | #if 0 | 1503 | #if 0 |
1518 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1504 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1519 | mCurrentSyncDevice = "qtopia-XML"; | 1505 | mCurrentSyncDevice = "qtopia-XML"; |
1520 | if ( KOPrefs::instance()->mAskForPreferences ) | 1506 | if ( mSyncManager->mAskForPreferences ) |
1521 | edit_sync_options(); | 1507 | edit_sync_options(); |
1522 | qApp->processEvents(); | 1508 | qApp->processEvents(); |
1523 | CalendarLocal* calendar = new CalendarLocal(); | 1509 | CalendarLocal* calendar = new CalendarLocal(); |
1524 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1510 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1525 | bool syncOK = false; | 1511 | bool syncOK = false; |
1526 | QtopiaFormat qtopiaFormat; | 1512 | QtopiaFormat qtopiaFormat; |
@@ -1532,17 +1518,17 @@ bool CalendarView::importQtopia( const QString &categories, | |||
1532 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1518 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1533 | if ( loadOk && !todolist.isEmpty() ) | 1519 | if ( loadOk && !todolist.isEmpty() ) |
1534 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1520 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1535 | 1521 | ||
1536 | if ( loadOk ) { | 1522 | if ( loadOk ) { |
1537 | getEventViewerDialog()->setSyncMode( true ); | 1523 | getEventViewerDialog()->setSyncMode( true ); |
1538 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1524 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1539 | getEventViewerDialog()->setSyncMode( false ); | 1525 | getEventViewerDialog()->setSyncMode( false ); |
1540 | qApp->processEvents(); | 1526 | qApp->processEvents(); |
1541 | if ( syncOK ) { | 1527 | if ( syncOK ) { |
1542 | if ( KOPrefs::instance()->mWriteBackFile ) | 1528 | if ( mSyncManager->mWriteBackFile ) |
1543 | { | 1529 | { |
1544 | // write back XML file | 1530 | // write back XML file |
1545 | 1531 | ||
1546 | } | 1532 | } |
1547 | setModified( true ); | 1533 | setModified( true ); |
1548 | } | 1534 | } |
@@ -1680,17 +1666,17 @@ bool CalendarView::checkFileVersion(QString fn) | |||
1680 | if ( km == KMessageBox::Cancel ) | 1666 | if ( km == KMessageBox::Cancel ) |
1681 | return false; | 1667 | return false; |
1682 | if ( km == KMessageBox::Yes ) | 1668 | if ( km == KMessageBox::Yes ) |
1683 | return true; | 1669 | return true; |
1684 | 1670 | ||
1685 | setSyncDevice("deleteaftersync" ); | 1671 | setSyncDevice("deleteaftersync" ); |
1686 | KOPrefs::instance()->mAskForPreferences = true; | 1672 | mSyncManager->mAskForPreferences = true; |
1687 | KOPrefs::instance()->mSyncAlgoPrefs = 3; | 1673 | mSyncManager->mSyncAlgoPrefs = 3; |
1688 | KOPrefs::instance()->mWriteBackFile = false; | 1674 | mSyncManager->mWriteBackFile = false; |
1689 | KOPrefs::instance()->mWriteBackExistingOnly = false; | 1675 | mSyncManager->mWriteBackExistingOnly = false; |
1690 | KOPrefs::instance()->mShowSyncSummary = false; | 1676 | mSyncManager->mShowSyncSummary = false; |
1691 | syncCalendar( fn, 3 ); | 1677 | syncCalendar( fn, 3 ); |
1692 | Event * e = getLastSyncEvent(); | 1678 | Event * e = getLastSyncEvent(); |
1693 | mCalendar->deleteEvent ( e ); | 1679 | mCalendar->deleteEvent ( e ); |
1694 | updateView(); | 1680 | updateView(); |
1695 | return true; | 1681 | return true; |
1696 | } | 1682 | } |
@@ -2195,59 +2181,13 @@ void CalendarView::edit_options() | |||
2195 | { | 2181 | { |
2196 | mDialogManager->showOptionsDialog(); | 2182 | mDialogManager->showOptionsDialog(); |
2197 | //writeSettings(); | 2183 | //writeSettings(); |
2198 | } | 2184 | } |
2199 | void CalendarView::edit_sync_options() | 2185 | void CalendarView::edit_sync_options() |
2200 | { | 2186 | { |
2201 | //mDialogManager->showSyncOptions(); | 2187 | // DELETE |
2202 | //KOPrefs::instance()->mSyncAlgoPrefs | ||
2203 | QDialog dia( this, "dia", true ); | ||
2204 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); | ||
2205 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); | ||
2206 | QVBoxLayout lay ( &dia ); | ||
2207 | lay.setSpacing( 2 ); | ||
2208 | lay.setMargin( 3 ); | ||
2209 | lay.addWidget(&gr); | ||
2210 | QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); | ||
2211 | QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); | ||
2212 | QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); | ||
2213 | QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); | ||
2214 | QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); | ||
2215 | QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); | ||
2216 | //QRadioButton both( i18n("Take both on conflict"), &gr ); | ||
2217 | QPushButton pb ( "OK", &dia); | ||
2218 | lay.addWidget( &pb ); | ||
2219 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | ||
2220 | switch ( KOPrefs::instance()->mSyncAlgoPrefs ) { | ||
2221 | case 0: | ||
2222 | loc.setChecked( true); | ||
2223 | break; | ||
2224 | case 1: | ||
2225 | rem.setChecked( true ); | ||
2226 | break; | ||
2227 | case 2: | ||
2228 | newest.setChecked( true); | ||
2229 | break; | ||
2230 | case 3: | ||
2231 | ask.setChecked( true); | ||
2232 | break; | ||
2233 | case 4: | ||
2234 | f_loc.setChecked( true); | ||
2235 | break; | ||
2236 | case 5: | ||
2237 | f_rem.setChecked( true); | ||
2238 | break; | ||
2239 | case 6: | ||
2240 | // both.setChecked( true); | ||
2241 | break; | ||
2242 | default: | ||
2243 | break; | ||
2244 | } | ||
2245 | if ( dia.exec() ) { | ||
2246 | KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; | ||
2247 | } | ||
2248 | 2188 | ||
2249 | } | 2189 | } |
2250 | 2190 | ||
2251 | void CalendarView::slotSelectPickerDate( QDate d) | 2191 | void CalendarView::slotSelectPickerDate( QDate d) |
2252 | { | 2192 | { |
2253 | mDateFrame->hide(); | 2193 | mDateFrame->hide(); |
@@ -3765,9 +3705,29 @@ NavigatorBar *CalendarView::navigatorBar() | |||
3765 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 3705 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
3766 | { | 3706 | { |
3767 | //qDebug(" alendarView::keyPressEvent "); | 3707 | //qDebug(" alendarView::keyPressEvent "); |
3768 | e->ignore(); | 3708 | e->ignore(); |
3769 | } | 3709 | } |
3770 | 3710 | ||
3771 | //#include "calendarview.moc" | ||
3772 | 3711 | ||
3773 | //#include "calendarviewbase.moc" | 3712 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
3713 | { | ||
3714 | // mSyncManager = manager; | ||
3715 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | ||
3716 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | ||
3717 | return syncCalendar( filename, mode ); | ||
3718 | } | ||
3719 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | ||
3720 | { | ||
3721 | //mSyncManager = manager; | ||
3722 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | ||
3723 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | ||
3724 | if ( resource == "sharp" ) | ||
3725 | syncExternal( 0 ); | ||
3726 | if ( resource == "phone" ) | ||
3727 | syncExternal( 1 ); | ||
3728 | // pending setmodified | ||
3729 | } | ||
3730 | void CalendarView::setSyncManager(KSyncManager* manager) | ||
3731 | { | ||
3732 | mSyncManager = manager; | ||
3733 | } | ||
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 8d329a9..751b8d9 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -39,12 +39,14 @@ | |||
39 | #include <libkcal/scheduler.h> | 39 | #include <libkcal/scheduler.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | 42 | ||
43 | #include <korganizer/calendarviewbase.h> | 43 | #include <korganizer/calendarviewbase.h> |
44 | 44 | ||
45 | #include <ksyncmanager.h> | ||
46 | |||
45 | class QWidgetStack; | 47 | class QWidgetStack; |
46 | class QSplitter; | 48 | class QSplitter; |
47 | 49 | ||
48 | class CalPrinter; | 50 | class CalPrinter; |
49 | class KOFilterView; | 51 | class KOFilterView; |
50 | class KOViewManager; | 52 | class KOViewManager; |
@@ -74,13 +76,13 @@ using namespace KCal; | |||
74 | of the different views and controls the different dialogs like preferences, | 76 | of the different views and controls the different dialogs like preferences, |
75 | event editor, search dialog etc. | 77 | event editor, search dialog etc. |
76 | 78 | ||
77 | @short main calendar view widget | 79 | @short main calendar view widget |
78 | @author Cornelius Schumacher | 80 | @author Cornelius Schumacher |
79 | */ | 81 | */ |
80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer | 82 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface |
81 | { | 83 | { |
82 | Q_OBJECT | 84 | Q_OBJECT |
83 | public: | 85 | public: |
84 | /** | 86 | /** |
85 | Constructs a new calendar view widget. | 87 | Constructs a new calendar view widget. |
86 | 88 | ||
@@ -458,13 +460,17 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
458 | void selectWeekNum ( int ); | 460 | void selectWeekNum ( int ); |
459 | 461 | ||
460 | public: | 462 | public: |
461 | // show a standard warning | 463 | // show a standard warning |
462 | // returns KMsgBox::yesNoCancel() | 464 | // returns KMsgBox::yesNoCancel() |
463 | int msgCalModified(); | 465 | int msgCalModified(); |
466 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | ||
467 | |||
468 | virtual bool syncExternal(KSyncManager* manager, QString resource); | ||
464 | void confSync(); | 469 | void confSync(); |
470 | void setSyncManager(KSyncManager* manager); | ||
465 | void setLoadedFileVersion(QDateTime); | 471 | void setLoadedFileVersion(QDateTime); |
466 | bool checkFileVersion(QString fn); | 472 | bool checkFileVersion(QString fn); |
467 | bool checkFileChanged(QString fn); | 473 | bool checkFileChanged(QString fn); |
468 | Event* getLastSyncEvent(); | 474 | Event* getLastSyncEvent(); |
469 | /** Adapt navigation units correpsonding to step size of navigation of the | 475 | /** Adapt navigation units correpsonding to step size of navigation of the |
470 | * current view. | 476 | * current view. |
@@ -481,12 +487,13 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
481 | void showEventEditor(); | 487 | void showEventEditor(); |
482 | void showTodoEditor(); | 488 | void showTodoEditor(); |
483 | void writeLocale(); | 489 | void writeLocale(); |
484 | Todo *selectedTodo(); | 490 | Todo *selectedTodo(); |
485 | 491 | ||
486 | private: | 492 | private: |
493 | KSyncManager* mSyncManager; | ||
487 | AlarmDialog * mAlarmDialog; | 494 | AlarmDialog * mAlarmDialog; |
488 | QString mAlarmNotification; | 495 | QString mAlarmNotification; |
489 | QString mSuspendAlarmNotification; | 496 | QString mSuspendAlarmNotification; |
490 | QTimer* mSuspendTimer; | 497 | QTimer* mSuspendTimer; |
491 | QTimer* mAlarmTimer; | 498 | QTimer* mAlarmTimer; |
492 | QTimer* mRecheckAlarmTimer; | 499 | QTimer* mRecheckAlarmTimer; |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 1210094..13035e0 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -193,14 +193,12 @@ KOPrefs::KOPrefs() : | |||
193 | // addItemBool("AskForPreferences",&mAskForPreferences,true); | 193 | // addItemBool("AskForPreferences",&mAskForPreferences,true); |
194 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); | 194 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); |
195 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 195 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
196 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 196 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
197 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 197 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
198 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 198 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
199 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); | ||
200 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); | ||
201 | 199 | ||
202 | #ifdef _WIN32_ | 200 | #ifdef _WIN32_ |
203 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 201 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
204 | #else | 202 | #else |
205 | QString hdp= locateLocal("data","korganizer")+"/"; | 203 | QString hdp= locateLocal("data","korganizer")+"/"; |
206 | #endif | 204 | #endif |
@@ -214,13 +212,12 @@ KOPrefs::KOPrefs() : | |||
214 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 212 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
215 | 213 | ||
216 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 214 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
217 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 215 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
218 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 216 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
219 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 217 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
220 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); | ||
221 | 218 | ||
222 | 219 | ||
223 | KPrefs::setCurrentGroup("Locale"); | 220 | KPrefs::setCurrentGroup("Locale"); |
224 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | 221 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); |
225 | addItemInt("PreferredTime",&mPreferredTime,0); | 222 | addItemInt("PreferredTime",&mPreferredTime,0); |
226 | addItemInt("PreferredDate",&mPreferredDate,0); | 223 | addItemInt("PreferredDate",&mPreferredDate,0); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index ff09e19..03df59b 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -191,35 +191,16 @@ class KOPrefs : public KPimPrefs | |||
191 | bool mToolBarHor; | 191 | bool mToolBarHor; |
192 | bool mToolBarUp; | 192 | bool mToolBarUp; |
193 | bool mToolBarMiniIcons; | 193 | bool mToolBarMiniIcons; |
194 | 194 | ||
195 | bool mAskForQuit; | 195 | bool mAskForQuit; |
196 | bool mUsePassWd; | 196 | bool mUsePassWd; |
197 | bool mWriteBackFile; | ||
198 | int mWriteBackInFuture; | ||
199 | bool mAskForPreferences; | ||
200 | bool mShowSyncSummary; | ||
201 | bool mShowSyncEvents; | 197 | bool mShowSyncEvents; |
202 | bool mShowTodoInAgenda; | 198 | bool mShowTodoInAgenda; |
203 | bool mWriteBackExistingOnly; | ||
204 | |||
205 | QString mRemoteIP; | ||
206 | QString mRemoteUser; | ||
207 | QString mRemotePassWd; | ||
208 | QString mRemoteFile; | ||
209 | QString mLocalTempFile; | ||
210 | QString mPhoneDevice; | ||
211 | QString mPhoneConnection; | ||
212 | QString mPhoneModel; | ||
213 | 199 | ||
214 | int mLastSyncTime; | 200 | int mLastSyncTime; |
215 | int mSyncAlgoPrefs; | ||
216 | int mRingSyncAlgoPrefs; | ||
217 | QStringList mSyncProfileNames; | ||
218 | QStringList mExternSyncProfiles; | ||
219 | QString mLocalMachineName; | ||
220 | void setCategoryColor(QString cat,const QColor & color); | 201 | void setCategoryColor(QString cat,const QColor & color); |
221 | QColor *categoryColor(QString cat); | 202 | QColor *categoryColor(QString cat); |
222 | 203 | ||
223 | QString mArchiveFile; | 204 | QString mArchiveFile; |
224 | QString mHtmlExportFile; | 205 | QString mHtmlExportFile; |
225 | bool mHtmlWithSave; | 206 | bool mHtmlWithSave; |
@@ -227,13 +208,12 @@ class KOPrefs : public KPimPrefs | |||
227 | QStringList mSelectedPlugins; | 208 | QStringList mSelectedPlugins; |
228 | 209 | ||
229 | QString mLastImportFile; | 210 | QString mLastImportFile; |
230 | QString mLastVcalFile; | 211 | QString mLastVcalFile; |
231 | QString mLastSaveFile; | 212 | QString mLastSaveFile; |
232 | QString mLastLoadFile; | 213 | QString mLastLoadFile; |
233 | QString mLastSyncedLocalFile; | ||
234 | 214 | ||
235 | 215 | ||
236 | QString mDefaultAlarmFile; | 216 | QString mDefaultAlarmFile; |
237 | int mIMIPScheduler; | 217 | int mIMIPScheduler; |
238 | int mIMIPSend; | 218 | int mIMIPSend; |
239 | QStringList mAdditionalMails; | 219 | QStringList mAdditionalMails; |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index e3324ee..f7766f8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -123,13 +123,13 @@ public: | |||
123 | }; | 123 | }; |
124 | 124 | ||
125 | int globalFlagBlockStartup; | 125 | int globalFlagBlockStartup; |
126 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 126 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
127 | QMainWindow( parent, name ) | 127 | QMainWindow( parent, name ) |
128 | { | 128 | { |
129 | mPassWordPiSync = "abc"; | 129 | |
130 | #ifdef DESKTOP_VERSION | 130 | #ifdef DESKTOP_VERSION |
131 | setFont( QFont("Arial"), 14 ); | 131 | setFont( QFont("Arial"), 14 ); |
132 | #endif | 132 | #endif |
133 | mServerSocket = 0; | 133 | mServerSocket = 0; |
134 | mClosed = false; | 134 | mClosed = false; |
135 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 135 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
@@ -139,16 +139,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
139 | setIcon(SmallIcon( "ko24" ) ); | 139 | setIcon(SmallIcon( "ko24" ) ); |
140 | mBlockAtStartup = true; | 140 | mBlockAtStartup = true; |
141 | mFlagKeyPressed = false; | 141 | mFlagKeyPressed = false; |
142 | setCaption("KOrganizer/Pi"); | 142 | setCaption("KOrganizer/Pi"); |
143 | KOPrefs *p = KOPrefs::instance(); | 143 | KOPrefs *p = KOPrefs::instance(); |
144 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 144 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
145 | // if ( QApplication::desktop()->height() > 480 ) { | ||
146 | // if ( p->mHourSize == 4 ) | ||
147 | // p->mHourSize = 6; | ||
148 | // } | ||
149 | if ( p->mHourSize > 18 ) | 145 | if ( p->mHourSize > 18 ) |
150 | p->mHourSize = 18; | 146 | p->mHourSize = 18; |
151 | QMainWindow::ToolBarDock tbd; | 147 | QMainWindow::ToolBarDock tbd; |
152 | if ( p->mToolBarHor ) { | 148 | if ( p->mToolBarHor ) { |
153 | if ( p->mToolBarUp ) | 149 | if ( p->mToolBarUp ) |
154 | tbd = Bottom; | 150 | tbd = Bottom; |
@@ -163,13 +159,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
163 | } | 159 | } |
164 | if ( KOPrefs::instance()->mUseAppColors ) | 160 | if ( KOPrefs::instance()->mUseAppColors ) |
165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 161 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
166 | globalFlagBlockStartup = 1; | 162 | globalFlagBlockStartup = 1; |
167 | iconToolBar = new QPEToolBar( this ); | 163 | iconToolBar = new QPEToolBar( this ); |
168 | addToolBar (iconToolBar , tbd ); | 164 | addToolBar (iconToolBar , tbd ); |
169 | mBlockSaveFlag = false; | ||
170 | mCalendarModifiedFlag = false; | 165 | mCalendarModifiedFlag = false; |
171 | 166 | ||
172 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 167 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
173 | splash->setAlignment ( AlignCenter ); | 168 | splash->setAlignment ( AlignCenter ); |
174 | setCentralWidget( splash ); | 169 | setCentralWidget( splash ); |
175 | #ifndef DESKTOP_VERSION | 170 | #ifndef DESKTOP_VERSION |
@@ -179,12 +174,15 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
179 | setDefaultPreferences(); | 174 | setDefaultPreferences(); |
180 | mCalendar = new CalendarLocal(); | 175 | mCalendar = new CalendarLocal(); |
181 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 176 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
182 | mView->hide(); | 177 | mView->hide(); |
183 | //mView->resize(splash->size() ); | 178 | //mView->resize(splash->size() ); |
184 | initActions(); | 179 | initActions(); |
180 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | ||
181 | mSyncManager->setBlockSave(false); | ||
182 | mView->setSyncManager(mSyncManager); | ||
185 | #ifndef DESKTOP_VERSION | 183 | #ifndef DESKTOP_VERSION |
186 | iconToolBar->show(); | 184 | iconToolBar->show(); |
187 | qApp->processEvents(); | 185 | qApp->processEvents(); |
188 | #endif | 186 | #endif |
189 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 187 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
190 | int vh = height() ; | 188 | int vh = height() ; |
@@ -249,13 +247,23 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
249 | mView->show(); | 247 | mView->show(); |
250 | delete splash; | 248 | delete splash; |
251 | if ( newFile ) | 249 | if ( newFile ) |
252 | mView->updateConfig(); | 250 | mView->updateConfig(); |
253 | // qApp->processEvents(); | 251 | // qApp->processEvents(); |
254 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 252 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
255 | fillSyncMenu(); | 253 | //fillSyncMenu(); |
254 | |||
255 | |||
256 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | ||
257 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | ||
258 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | ||
259 | mSyncManager->setDefaultFileName( defaultFileName()); | ||
260 | mSyncManager->fillSyncMenu(); | ||
261 | |||
262 | |||
263 | |||
256 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 264 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
257 | if ( showWarning ) { | 265 | if ( showWarning ) { |
258 | KMessageBox::information( this, | 266 | KMessageBox::information( this, |
259 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 267 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
260 | qApp->processEvents(); | 268 | qApp->processEvents(); |
261 | mView->dialogManager()->showSyncOptions(); | 269 | mView->dialogManager()->showSyncOptions(); |
@@ -392,13 +400,13 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | |||
392 | mView->viewManager()->showDayView(); | 400 | mView->viewManager()->showDayView(); |
393 | } | 401 | } |
394 | else if ( msg == "-showWWeek" ) { | 402 | else if ( msg == "-showWWeek" ) { |
395 | mView->viewManager()->showWorkWeekView(); | 403 | mView->viewManager()->showWorkWeekView(); |
396 | } | 404 | } |
397 | else if ( msg == "-ringSync" ) { | 405 | else if ( msg == "-ringSync" ) { |
398 | multiSync( false ); | 406 | mSyncManager->multiSync( false ); |
399 | } | 407 | } |
400 | else if ( msg == "-showWeek" ) { | 408 | else if ( msg == "-showWeek" ) { |
401 | mView->viewManager()->showWeekView(); | 409 | mView->viewManager()->showWeekView(); |
402 | } | 410 | } |
403 | else if ( msg == "-showTodo" ) { | 411 | else if ( msg == "-showTodo" ) { |
404 | mView->viewManager()->showTodoView(); | 412 | mView->viewManager()->showTodoView(); |
@@ -937,240 +945,13 @@ void MainWindow::initActions() | |||
937 | if (p-> mShowIconWhatsThis) | 945 | if (p-> mShowIconWhatsThis) |
938 | QWhatsThis::whatsThisButton ( iconToolBar ); | 946 | QWhatsThis::whatsThisButton ( iconToolBar ); |
939 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 947 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
940 | configureAgenda( p->mHourSize ); | 948 | configureAgenda( p->mHourSize ); |
941 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 949 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
942 | } | 950 | } |
943 | void MainWindow::fillSyncMenu() | ||
944 | { | ||
945 | if ( syncMenu->count() ) | ||
946 | syncMenu->clear(); | ||
947 | syncMenu->insertItem( i18n("Configure..."), 0 ); | ||
948 | syncMenu->insertSeparator(); | ||
949 | if ( mServerSocket == 0 ) { | ||
950 | syncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); | ||
951 | } else { | ||
952 | syncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); | ||
953 | } | ||
954 | syncMenu->insertSeparator(); | ||
955 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); | ||
956 | syncMenu->insertSeparator(); | ||
957 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | ||
958 | config.setGroup("General"); | ||
959 | QStringList prof = config.readListEntry("SyncProfileNames"); | ||
960 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | ||
961 | if ( prof.count() < 3 ) { | ||
962 | prof.clear(); | ||
963 | prof << i18n("Sharp_DTM"); | ||
964 | prof << i18n("Local_file"); | ||
965 | prof << i18n("Last_file"); | ||
966 | KSyncProfile* temp = new KSyncProfile (); | ||
967 | temp->setName( prof[0] ); | ||
968 | temp->writeConfig(&config); | ||
969 | temp->setName( prof[1] ); | ||
970 | temp->writeConfig(&config); | ||
971 | temp->setName( prof[2] ); | ||
972 | temp->writeConfig(&config); | ||
973 | config.setGroup("General"); | ||
974 | config.writeEntry("SyncProfileNames",prof); | ||
975 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); | ||
976 | config.sync(); | ||
977 | delete temp; | ||
978 | } | ||
979 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); | ||
980 | KOPrefs::instance()->mSyncProfileNames = prof; | ||
981 | int i; | ||
982 | for ( i = 0; i < prof.count(); ++i ) { | ||
983 | |||
984 | syncMenu->insertItem( prof[i], 1000+i ); | ||
985 | if ( i == 2 ) | ||
986 | syncMenu->insertSeparator(); | ||
987 | } | ||
988 | QDir app_dir; | ||
989 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | ||
990 | syncMenu->setItemEnabled( false , 1000 ); | ||
991 | } | ||
992 | } | ||
993 | |||
994 | int MainWindow::ringSync() | ||
995 | { | ||
996 | int syncedProfiles = 0; | ||
997 | int i; | ||
998 | QTime timer; | ||
999 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | ||
1000 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; | ||
1001 | KSyncProfile* temp = new KSyncProfile (); | ||
1002 | KOPrefs::instance()->mAskForPreferences = false; | ||
1003 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | ||
1004 | mCurrentSyncProfile = i; | ||
1005 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | ||
1006 | temp->readConfig(&config); | ||
1007 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { | ||
1008 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | ||
1009 | ++syncedProfiles; | ||
1010 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | ||
1011 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | ||
1012 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | ||
1013 | KOPrefs::instance()->mWriteBackInFuture = 0; | ||
1014 | if ( temp->getWriteBackFuture() ) | ||
1015 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | ||
1016 | KOPrefs::instance()->mShowSyncSummary = false; | ||
1017 | mView->setSyncDevice(syncProfileNames[i] ); | ||
1018 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | ||
1019 | if ( i == 0 ) { | ||
1020 | syncSharp(); | ||
1021 | } else { | ||
1022 | if ( temp->getIsLocalFileSync() ) { | ||
1023 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) | ||
1024 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | ||
1025 | } else { | ||
1026 | if ( temp->getIsPhoneSync() ) { | ||
1027 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; | ||
1028 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); | ||
1029 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); | ||
1030 | syncPhone(); | ||
1031 | } else if ( temp->getIsPiSync() ) { | ||
1032 | mPassWordPiSync = temp->getRemotePw(); | ||
1033 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); | ||
1034 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); | ||
1035 | syncPi(); | ||
1036 | } else | ||
1037 | syncRemote( temp, false ); | ||
1038 | 951 | ||
1039 | } | ||
1040 | } | ||
1041 | timer.start(); | ||
1042 | setCaption(i18n("Multiple sync in progress ... please wait!") ); | ||
1043 | while ( timer.elapsed () < 2000 ) { | ||
1044 | qApp->processEvents(); | ||
1045 | #ifndef _WIN32_ | ||
1046 | sleep (1); | ||
1047 | #endif | ||
1048 | } | ||
1049 | |||
1050 | } | ||
1051 | |||
1052 | } | ||
1053 | delete temp; | ||
1054 | return syncedProfiles; | ||
1055 | } | ||
1056 | |||
1057 | void MainWindow::multiSync( bool askforPrefs ) | ||
1058 | { | ||
1059 | if (mBlockSaveFlag) | ||
1060 | return; | ||
1061 | mBlockSaveFlag = true; | ||
1062 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | ||
1063 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | ||
1064 | question, | ||
1065 | i18n("Yes"), i18n("No"), | ||
1066 | 0, 0 ) != 0 ) { | ||
1067 | mBlockSaveFlag = false; | ||
1068 | setCaption(i18n("Aborted! Nothing synced!")); | ||
1069 | return; | ||
1070 | } | ||
1071 | mView->setSyncDevice(i18n("Multiple profiles") ); | ||
1072 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; | ||
1073 | if ( askforPrefs ) { | ||
1074 | mView->edit_sync_options(); | ||
1075 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; | ||
1076 | } | ||
1077 | setCaption(i18n("Multiple sync started.") ); | ||
1078 | qApp->processEvents(); | ||
1079 | int num = ringSync() ; | ||
1080 | if ( num > 1 ) | ||
1081 | ringSync(); | ||
1082 | mBlockSaveFlag = false; | ||
1083 | if ( num ) | ||
1084 | save(); | ||
1085 | if ( num ) | ||
1086 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); | ||
1087 | else | ||
1088 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | ||
1089 | return; | ||
1090 | } | ||
1091 | void MainWindow::slotSyncMenu( int action ) | ||
1092 | { | ||
1093 | qDebug("syncaction %d ", action); | ||
1094 | if ( action == 0 ) { | ||
1095 | |||
1096 | // seems to be a Qt2 event handling bug | ||
1097 | // syncmenu.clear causes a segfault at first time | ||
1098 | // when we call it after the main event loop, it is ok | ||
1099 | // same behaviour when calling OM/Pi via QCOP for the first time | ||
1100 | QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); | ||
1101 | //confSync(); | ||
1102 | |||
1103 | return; | ||
1104 | } | ||
1105 | if ( action == 1 ) { | ||
1106 | multiSync( true ); | ||
1107 | return; | ||
1108 | } | ||
1109 | if ( action == 2 ) { | ||
1110 | enableQuick(); | ||
1111 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | ||
1112 | return; | ||
1113 | } | ||
1114 | if ( action == 3 ) { | ||
1115 | delete mServerSocket; | ||
1116 | mServerSocket = 0; | ||
1117 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | ||
1118 | return; | ||
1119 | } | ||
1120 | |||
1121 | if (mBlockSaveFlag) | ||
1122 | return; | ||
1123 | mBlockSaveFlag = true; | ||
1124 | mCurrentSyncProfile = action - 1000 ; | ||
1125 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); | ||
1126 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | ||
1127 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | ||
1128 | KSyncProfile* temp = new KSyncProfile (); | ||
1129 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | ||
1130 | temp->readConfig(&config); | ||
1131 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | ||
1132 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); | ||
1133 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | ||
1134 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | ||
1135 | KOPrefs::instance()->mWriteBackInFuture = 0; | ||
1136 | if ( temp->getWriteBackFuture() ) | ||
1137 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | ||
1138 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); | ||
1139 | if ( action == 1000 ) { | ||
1140 | syncSharp(); | ||
1141 | |||
1142 | } else if ( action == 1001 ) { | ||
1143 | syncLocalFile(); | ||
1144 | |||
1145 | } else if ( action == 1002 ) { | ||
1146 | quickSyncLocalFile(); | ||
1147 | |||
1148 | } else if ( action >= 1003 ) { | ||
1149 | if ( temp->getIsLocalFileSync() ) { | ||
1150 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | ||
1151 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | ||
1152 | } else { | ||
1153 | if ( temp->getIsPhoneSync() ) { | ||
1154 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; | ||
1155 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); | ||
1156 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); | ||
1157 | syncPhone(); | ||
1158 | } else if ( temp->getIsPiSync() ) { | ||
1159 | mPassWordPiSync = temp->getRemotePw(); | ||
1160 | KOPrefs::instance()->mActiveSyncPort = temp->getRemotePort(); | ||
1161 | KOPrefs::instance()->mActiveSyncIP = temp->getRemoteIP(); | ||
1162 | syncPi(); | ||
1163 | } else | ||
1164 | syncRemote( temp ); | ||
1165 | |||
1166 | } | ||
1167 | } | ||
1168 | delete temp; | ||
1169 | mBlockSaveFlag = false; | ||
1170 | } | ||
1171 | void MainWindow::exportToPhone( int mode ) | 952 | void MainWindow::exportToPhone( int mode ) |
1172 | { | 953 | { |
1173 | 954 | ||
1174 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 955 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1175 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 956 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1176 | KOex2phonePrefs ex2phone; | 957 | KOex2phonePrefs ex2phone; |
@@ -1581,26 +1362,25 @@ void MainWindow::slotModifiedChanged( bool changed ) | |||
1581 | { | 1362 | { |
1582 | if ( mBlockAtStartup ) | 1363 | if ( mBlockAtStartup ) |
1583 | return; | 1364 | return; |
1584 | int msec; | 1365 | int msec; |
1585 | // we store the changes after 1 minute, | 1366 | // we store the changes after 1 minute, |
1586 | // and for safety reasons after 10 minutes again | 1367 | // and for safety reasons after 10 minutes again |
1587 | if ( !mBlockSaveFlag ) | 1368 | if ( !mSyncManager->blockSave() ) |
1588 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1369 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1589 | else | 1370 | else |
1590 | msec = 1000 * 600; | 1371 | msec = 1000 * 600; |
1591 | mSaveTimer.start( msec, true ); // 1 minute | 1372 | mSaveTimer.start( msec, true ); // 1 minute |
1592 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1373 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1593 | mCalendarModifiedFlag = true; | 1374 | mCalendarModifiedFlag = true; |
1594 | } | 1375 | } |
1595 | void MainWindow::save() | 1376 | void MainWindow::save() |
1596 | { | 1377 | { |
1597 | if ( mBlockSaveFlag ) | 1378 | if ( mSyncManager->blockSave() ) |
1598 | return; | 1379 | return; |
1599 | bool store = mBlockSaveFlag; | 1380 | mSyncManager->setBlockSave(true); |
1600 | mBlockSaveFlag = true; | ||
1601 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1381 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1602 | 1382 | ||
1603 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1383 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1604 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1384 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1605 | qDebug("KO: Start saving data to file!"); | 1385 | qDebug("KO: Start saving data to file!"); |
1606 | mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 1386 | mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
@@ -1612,13 +1392,13 @@ void MainWindow::save() | |||
1612 | QString savemes; | 1392 | QString savemes; |
1613 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1393 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1614 | setCaption(savemes); | 1394 | setCaption(savemes); |
1615 | } else | 1395 | } else |
1616 | setCaption(i18n("Saving cancelled!")); | 1396 | setCaption(i18n("Saving cancelled!")); |
1617 | mCalendarModifiedFlag = false; | 1397 | mCalendarModifiedFlag = false; |
1618 | mBlockSaveFlag = store; | 1398 | mSyncManager->setBlockSave( false ); |
1619 | } | 1399 | } |
1620 | 1400 | ||
1621 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1401 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1622 | { | 1402 | { |
1623 | if ( !e->isAutoRepeat() ) { | 1403 | if ( !e->isAutoRepeat() ) { |
1624 | mFlagKeyPressed = false; | 1404 | mFlagKeyPressed = false; |
@@ -2026,319 +1806,29 @@ void MainWindow::exportVCalendar() | |||
2026 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1806 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
2027 | setCaption(mes); | 1807 | setCaption(mes); |
2028 | } | 1808 | } |
2029 | } | 1809 | } |
2030 | 1810 | ||
2031 | } | 1811 | } |
2032 | QString MainWindow::getPassword( ) | ||
2033 | { | ||
2034 | QString retfile = ""; | ||
2035 | QDialog dia ( this, "input-dialog", true ); | ||
2036 | QLineEdit lab ( &dia ); | ||
2037 | lab.setEchoMode( QLineEdit::Password ); | ||
2038 | QVBoxLayout lay( &dia ); | ||
2039 | lay.setMargin(7); | ||
2040 | lay.setSpacing(7); | ||
2041 | lay.addWidget( &lab); | ||
2042 | dia.setFixedSize( 230,50 ); | ||
2043 | dia.setCaption( i18n("Enter password") ); | ||
2044 | QPushButton pb ( "OK", &dia); | ||
2045 | lay.addWidget( &pb ); | ||
2046 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | ||
2047 | dia.show(); | ||
2048 | int res = dia.exec(); | ||
2049 | if ( res ) | ||
2050 | retfile = lab.text(); | ||
2051 | dia.hide(); | ||
2052 | qApp->processEvents(); | ||
2053 | return retfile; | ||
2054 | |||
2055 | } | ||
2056 | 1812 | ||
2057 | void MainWindow::enableQuick() | 1813 | void MainWindow::syncFileRequest() |
2058 | { | 1814 | { |
2059 | QDialog dia ( this, "input-dialog", true ); | 1815 | save(); |
2060 | QLineEdit lab ( &dia ); | ||
2061 | QVBoxLayout lay( &dia ); | ||
2062 | lab.setText( KOPrefs::instance()->mPassiveSyncPort ); | ||
2063 | lay.setMargin(7); | ||
2064 | lay.setSpacing(7); | ||
2065 | QLabel label ( i18n("Port number (Default: 9197)"), &dia ); | ||
2066 | lay.addWidget( &label); | ||
2067 | lay.addWidget( &lab); | ||
2068 | |||
2069 | QLineEdit lepw ( &dia ); | ||
2070 | lepw.setText( KOPrefs::instance()->mPassiveSyncPw ); | ||
2071 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); | ||
2072 | lay.addWidget( &label2); | ||
2073 | lay.addWidget( &lepw); | ||
2074 | dia.setFixedSize( 230,80 ); | ||
2075 | dia.setCaption( i18n("Enter port for Pi-Sync") ); | ||
2076 | QPushButton pb ( "OK", &dia); | ||
2077 | lay.addWidget( &pb ); | ||
2078 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | ||
2079 | dia.show(); | ||
2080 | if ( ! dia.exec() ) | ||
2081 | return; | ||
2082 | dia.hide(); | ||
2083 | qApp->processEvents(); | ||
2084 | KOPrefs::instance()->mPassiveSyncPw = lepw.text(); | ||
2085 | KOPrefs::instance()->mPassiveSyncPort = lab.text(); | ||
2086 | bool ok; | ||
2087 | Q_UINT16 port = KOPrefs::instance()->mPassiveSyncPort.toUInt(&ok); | ||
2088 | if ( ! ok ) { | ||
2089 | KMessageBox::information( this, i18n("No valid port")); | ||
2090 | return; | ||
2091 | } | ||
2092 | //qDebug("port %d ", port); | ||
2093 | mServerSocket = new KServerSocket ( KOPrefs::instance()->mPassiveSyncPw, port ,1 ); | ||
2094 | mServerSocket->setFileName( defaultFileName() ); | ||
2095 | //qDebug("connected "); | ||
2096 | if ( !mServerSocket->ok() ) { | ||
2097 | KMessageBox::information( this, i18n("Failed to bind or\nlisten to the port!")); | ||
2098 | delete mServerSocket; | ||
2099 | mServerSocket = 0; | ||
2100 | return; | ||
2101 | } | ||
2102 | connect( mServerSocket, SIGNAL ( saveFile() ), this, SLOT ( save() ) ); | ||
2103 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SLOT ( getFile( bool ) ) ); | ||
2104 | } | 1816 | } |
2105 | |||
2106 | void MainWindow::getFile( bool success ) | 1817 | void MainWindow::getFile( bool success ) |
2107 | { | 1818 | { |
2108 | if ( ! success ) { | 1819 | if ( ! success ) { |
2109 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 1820 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2110 | return; | 1821 | return; |
2111 | } | 1822 | } |
2112 | mView->watchSavedFile(); | 1823 | mView->watchSavedFile(); |
2113 | mView->openCalendar( defaultFileName() ); | 1824 | mView->openCalendar( defaultFileName() ); |
2114 | setCaption( i18n("Pi-Sync successful!") ); | 1825 | setCaption( i18n("Pi-Sync successful!") ); |
2115 | 1826 | ||
2116 | } | 1827 | } |
2117 | 1828 | ||
2118 | |||
2119 | void MainWindow::syncPi() | ||
2120 | { | ||
2121 | qApp->processEvents(); | ||
2122 | bool ok; | ||
2123 | Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok); | ||
2124 | if ( ! ok ) { | ||
2125 | setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | ||
2126 | return; | ||
2127 | } | ||
2128 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, KOPrefs::instance()->mActiveSyncIP, this ); | ||
2129 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | ||
2130 | setCaption( i18n("Sending request for remote file ...") ); | ||
2131 | commandSocket->readFile( syncFileName() ); | ||
2132 | } | ||
2133 | |||
2134 | void MainWindow::deleteCommandSocket(KCommandSocket*s, int state) | ||
2135 | { | ||
2136 | qDebug("MainWindow::deleteCommandSocket %d", state); | ||
2137 | |||
2138 | //enum { success, errorW, errorR, quiet }; | ||
2139 | if ( state == KCommandSocket::errorR ) { | ||
2140 | setCaption( i18n("ERROR: Receiving remote file failed.") ); | ||
2141 | delete s; | ||
2142 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this ); | ||
2143 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | ||
2144 | commandSocket->sendStop(); | ||
2145 | return; | ||
2146 | |||
2147 | } else if ( state == KCommandSocket::errorW ) { | ||
2148 | setCaption( i18n("ERROR:Writing back file failed.") ); | ||
2149 | |||
2150 | } else if ( state == KCommandSocket::successR ) { | ||
2151 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); | ||
2152 | |||
2153 | } else if ( state == KCommandSocket::successW ) { | ||
2154 | setCaption( i18n("Pi-Sync succesful!") ); | ||
2155 | } | ||
2156 | |||
2157 | delete s; | ||
2158 | } | ||
2159 | |||
2160 | void MainWindow::readFileFromSocket() | ||
2161 | { | ||
2162 | QString fileName = syncFileName(); | ||
2163 | setCaption( i18n("Remote file saved to temp file.") ); | ||
2164 | if ( ! syncWithFile( fileName , true ) ) { | ||
2165 | setCaption( i18n("Syncing failed.") ); | ||
2166 | qDebug("Syncing failed "); | ||
2167 | return; | ||
2168 | } | ||
2169 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this ); | ||
2170 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | ||
2171 | if ( KOPrefs::instance()->mWriteBackFile ) | ||
2172 | commandSocket->writeFile( fileName ); | ||
2173 | else { | ||
2174 | commandSocket->sendStop(); | ||
2175 | setCaption( i18n("Pi-Sync succesful!") ); | ||
2176 | } | ||
2177 | } | ||
2178 | |||
2179 | void MainWindow::syncLocalFile() | ||
2180 | { | ||
2181 | |||
2182 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; | ||
2183 | |||
2184 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | ||
2185 | if ( fn == "" ) | ||
2186 | return; | ||
2187 | //mView->setSyncDevice("local-file" ); | ||
2188 | if ( syncWithFile( fn, false ) ) { | ||
2189 | // Event* e = mView->getLastSyncEvent(); | ||
2190 | // e->setReadOnly( false ); | ||
2191 | // e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); | ||
2192 | // e->setReadOnly( true ); | ||
2193 | } | ||
2194 | |||
2195 | } | ||
2196 | |||
2197 | bool MainWindow::syncWithFile( QString fn , bool quick ) | ||
2198 | { | ||
2199 | bool ret = false; | ||
2200 | QFileInfo info; | ||
2201 | info.setFile( fn ); | ||
2202 | QString mess; | ||
2203 | bool loadbup = true; | ||
2204 | if ( !info. exists() ) { | ||
2205 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); | ||
2206 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | ||
2207 | mess ); | ||
2208 | return ret; | ||
2209 | } | ||
2210 | int result = 0; | ||
2211 | if ( !quick ) { | ||
2212 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | ||
2213 | result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | ||
2214 | mess, | ||
2215 | i18n("Sync"), i18n("Cancel"), 0, | ||
2216 | 0, 1 ); | ||
2217 | if ( result ) | ||
2218 | return false; | ||
2219 | } | ||
2220 | if ( KOPrefs::instance()->mAskForPreferences ) | ||
2221 | mView->edit_sync_options(); | ||
2222 | if ( result == 0 ) { | ||
2223 | //qDebug("Now sycing ... "); | ||
2224 | if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) | ||
2225 | setCaption( i18n("Synchronization successful") ); | ||
2226 | else | ||
2227 | setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); | ||
2228 | if ( ! quick ) | ||
2229 | KOPrefs::instance()->mLastSyncedLocalFile = fn; | ||
2230 | slotModifiedChanged( true ); | ||
2231 | } | ||
2232 | return ret; | ||
2233 | } | ||
2234 | void MainWindow::quickSyncLocalFile() | ||
2235 | { | ||
2236 | //mView->setSyncDevice("local-file" ); | ||
2237 | //qDebug("quickSyncLocalFile() "); | ||
2238 | if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { | ||
2239 | // Event* e = mView->getLastSyncEvent(); | ||
2240 | // e->setReadOnly( false ); | ||
2241 | // e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); | ||
2242 | // e->setReadOnly( true ); | ||
2243 | |||
2244 | } | ||
2245 | } | ||
2246 | |||
2247 | void MainWindow::confSync() | ||
2248 | { | ||
2249 | mView->confSync(); | ||
2250 | fillSyncMenu(); | ||
2251 | } | ||
2252 | void MainWindow::syncRemote( KSyncProfile* prof, bool ask) | ||
2253 | { | ||
2254 | QString question; | ||
2255 | if ( ask ) { | ||
2256 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; | ||
2257 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | ||
2258 | question, | ||
2259 | i18n("Yes"), i18n("No"), | ||
2260 | 0, 0 ) != 0 ) | ||
2261 | return; | ||
2262 | } | ||
2263 | QString command = prof->getPreSyncCommand(); | ||
2264 | int fi; | ||
2265 | if ( (fi = command.find("$PWD$")) > 0 ) { | ||
2266 | QString pwd = getPassword(); | ||
2267 | command = command.left( fi )+ pwd + command.mid( fi+5 ); | ||
2268 | |||
2269 | } | ||
2270 | int maxlen = 30; | ||
2271 | if ( QApplication::desktop()->width() > 320 ) | ||
2272 | maxlen += 25; | ||
2273 | setCaption ( i18n( "Copy remote file to local machine..." ) ); | ||
2274 | int fileSize = 0; | ||
2275 | int result = system ( command ); | ||
2276 | // 0 : okay | ||
2277 | // 256: no such file or dir | ||
2278 | // | ||
2279 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | ||
2280 | if ( result != 0 ) { | ||
2281 | int len = maxlen; | ||
2282 | while ( len < command.length() ) { | ||
2283 | command.insert( len , "\n" ); | ||
2284 | len += maxlen +2; | ||
2285 | } | ||
2286 | 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) ; | ||
2287 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | ||
2288 | question, | ||
2289 | i18n("Okay!")) ; | ||
2290 | setCaption ("KO/Pi"); | ||
2291 | return; | ||
2292 | } | ||
2293 | setCaption ( i18n( "Copying succeed." ) ); | ||
2294 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | ||
2295 | if ( syncWithFile( prof->getLocalTempFile(), true ) ) { | ||
2296 | // Event* e = mView->getLastSyncEvent(); | ||
2297 | // e->setReadOnly( false ); | ||
2298 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | ||
2299 | // e->setReadOnly( true ); | ||
2300 | if ( KOPrefs::instance()->mWriteBackFile ) { | ||
2301 | command = prof->getPostSyncCommand(); | ||
2302 | int fi; | ||
2303 | if ( (fi = command.find("$PWD$")) > 0 ) { | ||
2304 | QString pwd = getPassword(); | ||
2305 | command = command.left( fi )+ pwd + command.mid( fi+5 ); | ||
2306 | |||
2307 | } | ||
2308 | setCaption ( i18n( "Writing back file ..." ) ); | ||
2309 | result = system ( command ); | ||
2310 | qDebug("KO: Writing back file result: %d ", result); | ||
2311 | if ( result != 0 ) { | ||
2312 | setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); | ||
2313 | return; | ||
2314 | } else { | ||
2315 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | ||
2316 | } | ||
2317 | } | ||
2318 | } | ||
2319 | return; | ||
2320 | } | ||
2321 | |||
2322 | void MainWindow::syncSharp() | ||
2323 | { | ||
2324 | if ( mCalendarModifiedFlag ) | ||
2325 | save(); | ||
2326 | mView->syncSharp(); | ||
2327 | slotModifiedChanged( true ); | ||
2328 | |||
2329 | } | ||
2330 | void MainWindow::syncPhone() | ||
2331 | { | ||
2332 | if ( mCalendarModifiedFlag ) | ||
2333 | save(); | ||
2334 | mView->syncPhone(); | ||
2335 | slotModifiedChanged( true ); | ||
2336 | |||
2337 | } | ||
2338 | |||
2339 | void MainWindow::printSel( ) | 1829 | void MainWindow::printSel( ) |
2340 | { | 1830 | { |
2341 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 1831 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2342 | } | 1832 | } |
2343 | 1833 | ||
2344 | void MainWindow::printCal() | 1834 | void MainWindow::printCal() |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 0da0be0..ee7bd87 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -41,14 +41,12 @@ class MainWindow : public QMainWindow | |||
41 | void recieve( const QCString& msg, const QByteArray& data ); | 41 | void recieve( const QCString& msg, const QByteArray& data ); |
42 | static QString defaultFileName(); | 42 | static QString defaultFileName(); |
43 | static QString syncFileName(); | 43 | static QString syncFileName(); |
44 | static QString resourcePath(); | 44 | static QString resourcePath(); |
45 | protected slots: | 45 | protected slots: |
46 | void setCaptionToDates(); | 46 | void setCaptionToDates(); |
47 | int ringSync(); | ||
48 | void multiSync( bool askforPrefs = false ); | ||
49 | void about(); | 47 | void about(); |
50 | void licence(); | 48 | void licence(); |
51 | void faq(); | 49 | void faq(); |
52 | void usertrans(); | 50 | void usertrans(); |
53 | void features(); | 51 | void features(); |
54 | void synchowto(); | 52 | void synchowto(); |
@@ -76,73 +74,57 @@ class MainWindow : public QMainWindow | |||
76 | void loadCalendar(); | 74 | void loadCalendar(); |
77 | void exportVCalendar(); | 75 | void exportVCalendar(); |
78 | void fillFilterMenu(); | 76 | void fillFilterMenu(); |
79 | void selectFilter( int ); | 77 | void selectFilter( int ); |
80 | void exportToPhone( int ); | 78 | void exportToPhone( int ); |
81 | 79 | ||
82 | void slotSyncMenu( int ); | ||
83 | void confSync(); | ||
84 | void syncSharp(); | ||
85 | void syncPhone(); | ||
86 | void syncPi(); | ||
87 | void syncLocalFile(); | ||
88 | bool syncWithFile( QString, bool ); | ||
89 | void quickSyncLocalFile(); | ||
90 | |||
91 | 80 | ||
92 | protected: | 81 | protected: |
93 | void displayText( QString, QString); | 82 | void displayText( QString, QString); |
94 | void displayFile( QString, QString); | 83 | void displayFile( QString, QString); |
95 | 84 | ||
96 | void enableIncidenceActions( bool ); | 85 | void enableIncidenceActions( bool ); |
97 | 86 | ||
98 | private slots: | 87 | private slots: |
99 | QSocket* piSocket; | 88 | QSocket* piSocket; |
100 | QString piFileString; | 89 | QString piFileString; |
101 | QTime piTime; | 90 | QTime piTime; |
102 | void deleteCommandSocket(KCommandSocket* s, int state ); | ||
103 | void fillSyncMenu(); | ||
104 | void getFile( bool ); | 91 | void getFile( bool ); |
105 | void readFileFromSocket(); | 92 | void syncFileRequest(); |
106 | private: | 93 | private: |
94 | KSyncManager* mSyncManager; | ||
107 | //QTimer* mTimerCommandSocket; | 95 | //QTimer* mTimerCommandSocket; |
108 | QString mPassWordPiSync; | ||
109 | KServerSocket * mServerSocket; | 96 | KServerSocket * mServerSocket; |
110 | bool mClosed; | 97 | bool mClosed; |
111 | void saveOnClose(); | 98 | void saveOnClose(); |
112 | int mCurrentSyncProfile; | ||
113 | void enableQuick(); | ||
114 | void syncRemote( KSyncProfile* , bool ask = true); | ||
115 | bool mFlagKeyPressed; | 99 | bool mFlagKeyPressed; |
116 | bool mBlockAtStartup; | 100 | bool mBlockAtStartup; |
117 | QPEToolBar *iconToolBar; | 101 | QPEToolBar *iconToolBar; |
118 | void initActions(); | 102 | void initActions(); |
119 | void setDefaultPreferences(); | 103 | void setDefaultPreferences(); |
120 | void keyPressEvent ( QKeyEvent * ) ; | 104 | void keyPressEvent ( QKeyEvent * ) ; |
121 | void keyReleaseEvent ( QKeyEvent * ) ; | 105 | void keyReleaseEvent ( QKeyEvent * ) ; |
122 | QPopupMenu *configureToolBarMenu; | 106 | QPopupMenu *configureToolBarMenu; |
123 | QPopupMenu *selectFilterMenu; | 107 | QPopupMenu *selectFilterMenu; |
124 | QPopupMenu *configureAgendaMenu, *syncMenu; | 108 | QPopupMenu *configureAgendaMenu, *syncMenu; |
125 | CalendarLocal *mCalendar; | 109 | CalendarLocal *mCalendar; |
126 | CalendarView *mView; | 110 | CalendarView *mView; |
127 | QString getPassword(); | ||
128 | QAction *mNewSubTodoAction; | 111 | QAction *mNewSubTodoAction; |
129 | 112 | ||
130 | QAction *mShowAction; | 113 | QAction *mShowAction; |
131 | QAction *mEditAction; | 114 | QAction *mEditAction; |
132 | QAction *mDeleteAction; | 115 | QAction *mDeleteAction; |
133 | QAction *mCloneAction; | 116 | QAction *mCloneAction; |
134 | QAction *mMoveAction; | 117 | QAction *mMoveAction; |
135 | QAction *mBeamAction; | 118 | QAction *mBeamAction; |
136 | QAction *mCancelAction; | 119 | QAction *mCancelAction; |
137 | 120 | ||
138 | |||
139 | void closeEvent( QCloseEvent* ce ); | 121 | void closeEvent( QCloseEvent* ce ); |
140 | SimpleAlarmClient mAlarmClient; | 122 | SimpleAlarmClient mAlarmClient; |
141 | QTimer mSaveTimer; | 123 | QTimer mSaveTimer; |
142 | bool mBlockSaveFlag; | 124 | //bool mBlockSaveFlag; |
143 | bool mCalendarModifiedFlag; | 125 | bool mCalendarModifiedFlag; |
144 | QPixmap loadPixmap( QString ); | 126 | QPixmap loadPixmap( QString ); |
145 | }; | 127 | }; |
146 | 128 | ||
147 | 129 | ||
148 | #endif | 130 | #endif |
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp index 0a2f5f1..c21ebaa 100644 --- a/libkdepim/kpimprefs.cpp +++ b/libkdepim/kpimprefs.cpp | |||
@@ -35,15 +35,22 @@ $Id$ | |||
35 | 35 | ||
36 | #include "kpimprefs.h" | 36 | #include "kpimprefs.h" |
37 | 37 | ||
38 | KPimPrefs::KPimPrefs( const QString &name ) : | 38 | KPimPrefs::KPimPrefs( const QString &name ) : |
39 | KPrefs( name ) | 39 | KPrefs( name ) |
40 | { | 40 | { |
41 | config()->setGroup("General"); | 41 | #ifdef _WIN32_ |
42 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | ||
43 | #else | ||
44 | QString hdp= locateLocal("data","korganizer")+"/"; | ||
45 | #endif | ||
46 | config()->setGroup("SyncOptions"); | ||
42 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); | 47 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); |
43 | addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); | 48 | addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); |
49 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); | ||
50 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); | ||
44 | } | 51 | } |
45 | 52 | ||
46 | KPimPrefs::~KPimPrefs() | 53 | KPimPrefs::~KPimPrefs() |
47 | { | 54 | { |
48 | } | 55 | } |
49 | 56 | ||
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h index fde8093..9346f7d 100644 --- a/libkdepim/kpimprefs.h +++ b/libkdepim/kpimprefs.h | |||
@@ -54,13 +54,14 @@ class KPimPrefs : public KPrefs | |||
54 | 54 | ||
55 | 55 | ||
56 | public: | 56 | public: |
57 | QStringList mCustomCategories; | 57 | QStringList mCustomCategories; |
58 | QString mPassiveSyncPort; | 58 | QString mPassiveSyncPort; |
59 | QString mPassiveSyncPw; | 59 | QString mPassiveSyncPw; |
60 | 60 | int mRingSyncAlgoPrefs; | |
61 | QString mLastSyncedLocalFile; | ||
61 | 62 | ||
62 | 63 | ||
63 | protected: | 64 | protected: |
64 | virtual void setCategoryDefaults(); | 65 | virtual void setCategoryDefaults(); |
65 | 66 | ||
66 | 67 | ||
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index fad9a76..568c2a9 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -73,13 +73,13 @@ KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, Targ | |||
73 | 73 | ||
74 | KSyncManager::~KSyncManager() | 74 | KSyncManager::~KSyncManager() |
75 | { | 75 | { |
76 | delete bar; | 76 | delete bar; |
77 | } | 77 | } |
78 | 78 | ||
79 | //LR ok | 79 | |
80 | void KSyncManager::fillSyncMenu() | 80 | void KSyncManager::fillSyncMenu() |
81 | { | 81 | { |
82 | if ( mSyncMenu->count() ) | 82 | if ( mSyncMenu->count() ) |
83 | mSyncMenu->clear(); | 83 | mSyncMenu->clear(); |
84 | 84 | ||
85 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); | 85 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); |
@@ -98,17 +98,20 @@ void KSyncManager::fillSyncMenu() | |||
98 | QStringList prof = config.readListEntry("SyncProfileNames"); | 98 | QStringList prof = config.readListEntry("SyncProfileNames"); |
99 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 99 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
100 | if ( prof.count() < 2 ) { | 100 | if ( prof.count() < 2 ) { |
101 | prof.clear(); | 101 | prof.clear(); |
102 | prof << i18n("Sharp_DTM"); | 102 | prof << i18n("Sharp_DTM"); |
103 | prof << i18n("Local_file"); | 103 | prof << i18n("Local_file"); |
104 | prof << i18n("Last_file"); | ||
104 | KSyncProfile* temp = new KSyncProfile (); | 105 | KSyncProfile* temp = new KSyncProfile (); |
105 | temp->setName( prof[0] ); | 106 | temp->setName( prof[0] ); |
106 | temp->writeConfig(&config); | 107 | temp->writeConfig(&config); |
107 | temp->setName( prof[1] ); | 108 | temp->setName( prof[1] ); |
108 | temp->writeConfig(&config); | 109 | temp->writeConfig(&config); |
110 | temp->setName( prof[2] ); | ||
111 | temp->writeConfig(&config); | ||
109 | config.setGroup("General"); | 112 | config.setGroup("General"); |
110 | config.writeEntry("SyncProfileNames",prof); | 113 | config.writeEntry("SyncProfileNames",prof); |
111 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); | 114 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); |
112 | config.sync(); | 115 | config.sync(); |
113 | delete temp; | 116 | delete temp; |
114 | } | 117 | } |
@@ -123,14 +126,15 @@ void KSyncManager::fillSyncMenu() | |||
123 | QDir app_dir; | 126 | QDir app_dir; |
124 | //US do not display SharpDTM if app is pwmpi, or no sharpfiles available | 127 | //US do not display SharpDTM if app is pwmpi, or no sharpfiles available |
125 | if ( mTargetApp == PWMPI) { | 128 | if ( mTargetApp == PWMPI) { |
126 | mSyncMenu->removeItem( 1000 ); | 129 | mSyncMenu->removeItem( 1000 ); |
127 | } | 130 | } |
128 | else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 131 | else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
129 | mSyncMenu->setItemEnabled( 1000, false ); | 132 | mSyncMenu->removeItem( 1000 ); |
130 | } | 133 | } |
134 | mSyncMenu->removeItem( 1002 ); | ||
131 | } | 135 | } |
132 | 136 | ||
133 | void KSyncManager::slotSyncMenu( int action ) | 137 | void KSyncManager::slotSyncMenu( int action ) |
134 | { | 138 | { |
135 | //qDebug("syncaction %d ", action); | 139 | //qDebug("syncaction %d ", action); |
136 | if ( action == 0 ) { | 140 | if ( action == 0 ) { |
@@ -192,21 +196,21 @@ void KSyncManager::slotSyncMenu( int action ) | |||
192 | } else if ( action >= 1003 ) { | 196 | } else if ( action >= 1003 ) { |
193 | if ( temp->getIsLocalFileSync() ) { | 197 | if ( temp->getIsLocalFileSync() ) { |
194 | switch(mTargetApp) | 198 | switch(mTargetApp) |
195 | { | 199 | { |
196 | case (KAPI): | 200 | case (KAPI): |
197 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 201 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
198 | mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 202 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
199 | break; | 203 | break; |
200 | case (KOPI): | 204 | case (KOPI): |
201 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 205 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
202 | mLastSyncedLocalFile = temp->getRemoteFileName(); | 206 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
203 | break; | 207 | break; |
204 | case (PWMPI): | 208 | case (PWMPI): |
205 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 209 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
206 | mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 210 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
207 | break; | 211 | break; |
208 | default: | 212 | default: |
209 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 213 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
210 | break; | 214 | break; |
211 | 215 | ||
212 | } | 216 | } |
@@ -236,12 +240,13 @@ void KSyncManager::slotSyncMenu( int action ) | |||
236 | 240 | ||
237 | } | 241 | } |
238 | } | 242 | } |
239 | delete temp; | 243 | delete temp; |
240 | setBlockSave(false); | 244 | setBlockSave(false); |
241 | } | 245 | } |
246 | |||
242 | void KSyncManager::enableQuick() | 247 | void KSyncManager::enableQuick() |
243 | { | 248 | { |
244 | QDialog dia ( 0, "input-dialog", true ); | 249 | QDialog dia ( 0, "input-dialog", true ); |
245 | QLineEdit lab ( &dia ); | 250 | QLineEdit lab ( &dia ); |
246 | QVBoxLayout lay( &dia ); | 251 | QVBoxLayout lay( &dia ); |
247 | lab.setText( mPrefs->mPassiveSyncPort ); | 252 | lab.setText( mPrefs->mPassiveSyncPort ); |
@@ -282,21 +287,20 @@ void KSyncManager::enableQuick() | |||
282 | if ( !mServerSocket->ok() ) { | 287 | if ( !mServerSocket->ok() ) { |
283 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); | 288 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); |
284 | delete mServerSocket; | 289 | delete mServerSocket; |
285 | mServerSocket = 0; | 290 | mServerSocket = 0; |
286 | return; | 291 | return; |
287 | } | 292 | } |
288 | //connect( mServerSocket, SIGNAL ( saveFile() ),this, SIGNAL ( save() ) ); | ||
289 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); | 293 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); |
290 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); | 294 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); |
291 | } | 295 | } |
292 | 296 | ||
293 | void KSyncManager::syncLocalFile() | 297 | void KSyncManager::syncLocalFile() |
294 | { | 298 | { |
295 | 299 | ||
296 | QString fn =mLastSyncedLocalFile; | 300 | QString fn =mPrefs->mLastSyncedLocalFile; |
297 | QString ext; | 301 | QString ext; |
298 | 302 | ||
299 | switch(mTargetApp) | 303 | switch(mTargetApp) |
300 | { | 304 | { |
301 | case (KAPI): | 305 | case (KAPI): |
302 | ext = "(*.vcf)"; | 306 | ext = "(*.vcf)"; |
@@ -318,12 +322,13 @@ void KSyncManager::syncLocalFile() | |||
318 | return; | 322 | return; |
319 | if ( syncWithFile( fn, false ) ) { | 323 | if ( syncWithFile( fn, false ) ) { |
320 | qDebug("syncLocalFile() successful "); | 324 | qDebug("syncLocalFile() successful "); |
321 | } | 325 | } |
322 | 326 | ||
323 | } | 327 | } |
328 | |||
324 | bool KSyncManager::syncWithFile( QString fn , bool quick ) | 329 | bool KSyncManager::syncWithFile( QString fn , bool quick ) |
325 | { | 330 | { |
326 | bool ret = false; | 331 | bool ret = false; |
327 | QFileInfo info; | 332 | QFileInfo info; |
328 | info.setFile( fn ); | 333 | info.setFile( fn ); |
329 | QString mess; | 334 | QString mess; |
@@ -350,40 +355,42 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) | |||
350 | //qDebug("Now sycing ... "); | 355 | //qDebug("Now sycing ... "); |
351 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) | 356 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) |
352 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); | 357 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); |
353 | else | 358 | else |
354 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); | 359 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); |
355 | if ( ! quick ) | 360 | if ( ! quick ) |
356 | mLastSyncedLocalFile = fn; | 361 | mPrefs->mLastSyncedLocalFile = fn; |
357 | } | 362 | } |
358 | return ret; | 363 | return ret; |
359 | } | 364 | } |
365 | |||
360 | void KSyncManager::quickSyncLocalFile() | 366 | void KSyncManager::quickSyncLocalFile() |
361 | { | 367 | { |
362 | 368 | ||
363 | if ( syncWithFile( mLastSyncedLocalFile, false ) ) { | 369 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) { |
364 | qDebug("quick syncLocalFile() successful "); | 370 | qDebug("quick syncLocalFile() successful "); |
365 | 371 | ||
366 | } | 372 | } |
367 | } | 373 | } |
374 | |||
368 | void KSyncManager::multiSync( bool askforPrefs ) | 375 | void KSyncManager::multiSync( bool askforPrefs ) |
369 | { | 376 | { |
370 | if (blockSave()) | 377 | if (blockSave()) |
371 | return; | 378 | return; |
372 | setBlockSave(true); | 379 | setBlockSave(true); |
373 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 380 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
374 | if ( QMessageBox::information( mParent, i18n("Sync"), | 381 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), |
375 | question, | 382 | question, |
376 | i18n("Yes"), i18n("No"), | 383 | i18n("Yes"), i18n("No"), |
377 | 0, 0 ) != 0 ) { | 384 | 0, 0 ) != 0 ) { |
378 | setBlockSave(false); | 385 | setBlockSave(false); |
379 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); | 386 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); |
380 | return; | 387 | return; |
381 | } | 388 | } |
382 | mCurrentSyncDevice = i18n("Multiple profiles") ; | 389 | mCurrentSyncDevice = i18n("Multiple profiles") ; |
383 | mSyncAlgoPrefs = mRingSyncAlgoPrefs; | 390 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; |
384 | if ( askforPrefs ) { | 391 | if ( askforPrefs ) { |
385 | edit_sync_options(); | 392 | edit_sync_options(); |
386 | mRingSyncAlgoPrefs = mSyncAlgoPrefs; | 393 | mRingSyncAlgoPrefs = mSyncAlgoPrefs; |
387 | } | 394 | } |
388 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); | 395 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); |
389 | qApp->processEvents(); | 396 | qApp->processEvents(); |
@@ -391,17 +398,18 @@ void KSyncManager::multiSync( bool askforPrefs ) | |||
391 | if ( num > 1 ) | 398 | if ( num > 1 ) |
392 | ringSync(); | 399 | ringSync(); |
393 | setBlockSave(false); | 400 | setBlockSave(false); |
394 | if ( num ) | 401 | if ( num ) |
395 | emit save(); | 402 | emit save(); |
396 | if ( num ) | 403 | if ( num ) |
397 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); | 404 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); |
398 | else | 405 | else |
399 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 406 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
400 | return; | 407 | return; |
401 | } | 408 | } |
409 | |||
402 | int KSyncManager::ringSync() | 410 | int KSyncManager::ringSync() |
403 | { | 411 | { |
404 | int syncedProfiles = 0; | 412 | int syncedProfiles = 0; |
405 | unsigned int i; | 413 | unsigned int i; |
406 | QTime timer; | 414 | QTime timer; |
407 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 415 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
@@ -449,32 +457,47 @@ int KSyncManager::ringSync() | |||
449 | } else { | 457 | } else { |
450 | if ( temp->getIsLocalFileSync() ) { | 458 | if ( temp->getIsLocalFileSync() ) { |
451 | switch(mTargetApp) | 459 | switch(mTargetApp) |
452 | { | 460 | { |
453 | case (KAPI): | 461 | case (KAPI): |
454 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 462 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
455 | mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 463 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
456 | break; | 464 | break; |
457 | case (KOPI): | 465 | case (KOPI): |
458 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 466 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
459 | mLastSyncedLocalFile = temp->getRemoteFileName(); | 467 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
460 | break; | 468 | break; |
461 | case (PWMPI): | 469 | case (PWMPI): |
462 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 470 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
463 | mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 471 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
464 | break; | 472 | break; |
465 | default: | 473 | default: |
466 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 474 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
467 | break; | 475 | break; |
468 | } | 476 | } |
469 | } else { | 477 | } else { |
470 | if ( temp->getIsPhoneSync() ) { | 478 | if ( temp->getIsPhoneSync() ) { |
471 | mPhoneDevice = temp->getPhoneDevice( ) ; | 479 | mPhoneDevice = temp->getPhoneDevice( ) ; |
472 | mPhoneConnection = temp->getPhoneConnection( ); | 480 | mPhoneConnection = temp->getPhoneConnection( ); |
473 | mPhoneModel = temp->getPhoneModel( ); | 481 | mPhoneModel = temp->getPhoneModel( ); |
474 | syncPhone(); | 482 | syncPhone(); |
483 | } else if ( temp->getIsPiSync() ) { | ||
484 | if ( mTargetApp == KAPI ) { | ||
485 | mPassWordPiSync = temp->getRemotePwAB(); | ||
486 | mActiveSyncPort = temp->getRemotePortAB(); | ||
487 | mActiveSyncIP = temp->getRemoteIPAB(); | ||
488 | } else if ( mTargetApp == KOPI ) { | ||
489 | mPassWordPiSync = temp->getRemotePw(); | ||
490 | mActiveSyncPort = temp->getRemotePort(); | ||
491 | mActiveSyncIP = temp->getRemoteIP(); | ||
492 | } else { | ||
493 | mPassWordPiSync = temp->getRemotePwPWM(); | ||
494 | mActiveSyncPort = temp->getRemotePortPWM(); | ||
495 | mActiveSyncIP = temp->getRemoteIPPWM(); | ||
496 | } | ||
497 | syncPi(); | ||
475 | } else | 498 | } else |
476 | syncRemote( temp, false ); | 499 | syncRemote( temp, false ); |
477 | 500 | ||
478 | } | 501 | } |
479 | } | 502 | } |
480 | timer.start(); | 503 | timer.start(); |
@@ -555,25 +578,20 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | |||
555 | len += maxlen +2; | 578 | len += maxlen +2; |
556 | } | 579 | } |
557 | 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 (preCommand) ; | 580 | 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 (preCommand) ; |
558 | QMessageBox::information( mParent, i18n("Sync - ERROR"), | 581 | QMessageBox::information( mParent, i18n("Sync - ERROR"), |
559 | question, | 582 | question, |
560 | i18n("Okay!")) ; | 583 | i18n("Okay!")) ; |
561 | mParent->topLevelWidget()->setCaption (""); | 584 | mParent->topLevelWidget()->setCaption ("KDE-Pim"); |
562 | return; | 585 | return; |
563 | } | 586 | } |
564 | mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); | 587 | mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); |
565 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 588 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
566 | 589 | ||
567 | |||
568 | |||
569 | if ( syncWithFile( localTempFile, true ) ) { | 590 | if ( syncWithFile( localTempFile, true ) ) { |
570 | // Event* e = mView->getLastSyncEvent(); | 591 | |
571 | // e->setReadOnly( false ); | ||
572 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | ||
573 | // e->setReadOnly( true ); | ||
574 | if ( mWriteBackFile ) { | 592 | if ( mWriteBackFile ) { |
575 | int fi; | 593 | int fi; |
576 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { | 594 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { |
577 | QString pwd = getPassword(); | 595 | QString pwd = getPassword(); |
578 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); | 596 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); |
579 | 597 | ||
@@ -641,12 +659,13 @@ void KSyncManager::edit_sync_options() | |||
641 | if ( dia.exec() ) { | 659 | if ( dia.exec() ) { |
642 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; | 660 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; |
643 | } | 661 | } |
644 | 662 | ||
645 | 663 | ||
646 | } | 664 | } |
665 | |||
647 | QString KSyncManager::getPassword( ) | 666 | QString KSyncManager::getPassword( ) |
648 | { | 667 | { |
649 | QString retfile = ""; | 668 | QString retfile = ""; |
650 | QDialog dia ( mParent, "input-dialog", true ); | 669 | QDialog dia ( mParent, "input-dialog", true ); |
651 | QLineEdit lab ( &dia ); | 670 | QLineEdit lab ( &dia ); |
652 | lab.setEchoMode( QLineEdit::Password ); | 671 | lab.setEchoMode( QLineEdit::Password ); |
@@ -682,17 +701,18 @@ void KSyncManager::confSync() | |||
682 | #else | 701 | #else |
683 | sp->show(); | 702 | sp->show(); |
684 | #endif | 703 | #endif |
685 | sp->exec(); | 704 | sp->exec(); |
686 | mSyncProfileNames = sp->getSyncProfileNames(); | 705 | mSyncProfileNames = sp->getSyncProfileNames(); |
687 | mLocalMachineName = sp->getLocalMachineName (); | 706 | mLocalMachineName = sp->getLocalMachineName (); |
688 | fillSyncMenu(); | 707 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
689 | } | 708 | } |
690 | 709 | ||
691 | void KSyncManager::syncSharp() | 710 | void KSyncManager::syncSharp() |
692 | { | 711 | { |
712 | |||
693 | if ( ! syncExternalApplication("sharp") ) | 713 | if ( ! syncExternalApplication("sharp") ) |
694 | qDebug("ERROR sync sharp ");; | 714 | qDebug("ERROR sync sharp ");; |
695 | } | 715 | } |
696 | 716 | ||
697 | bool KSyncManager::syncExternalApplication(QString resource) | 717 | bool KSyncManager::syncExternalApplication(QString resource) |
698 | { | 718 | { |
@@ -709,16 +729,14 @@ bool KSyncManager::syncExternalApplication(QString resource) | |||
709 | return syncOK; | 729 | return syncOK; |
710 | 730 | ||
711 | } | 731 | } |
712 | 732 | ||
713 | void KSyncManager::syncPhone() | 733 | void KSyncManager::syncPhone() |
714 | { | 734 | { |
715 | emit save(); | ||
716 | 735 | ||
717 | qDebug("pending syncPhone(); "); | 736 | syncExternalApplication("phone"); |
718 | //mView->syncPhone(); | ||
719 | 737 | ||
720 | } | 738 | } |
721 | 739 | ||
722 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) | 740 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) |
723 | { | 741 | { |
724 | if (!bar->isVisible()) | 742 | if (!bar->isVisible()) |
@@ -764,12 +782,13 @@ QString KSyncManager::syncFileName() | |||
764 | return locateLocal( "tmp", fn ); | 782 | return locateLocal( "tmp", fn ); |
765 | #else | 783 | #else |
766 | return (QString( "/tmp/" )+ fn ); | 784 | return (QString( "/tmp/" )+ fn ); |
767 | #endif | 785 | #endif |
768 | } | 786 | } |
769 | 787 | ||
788 | |||
770 | void KSyncManager::syncPi() | 789 | void KSyncManager::syncPi() |
771 | { | 790 | { |
772 | qApp->processEvents(); | 791 | qApp->processEvents(); |
773 | bool ok; | 792 | bool ok; |
774 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); | 793 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); |
775 | if ( ! ok ) { | 794 | if ( ! ok ) { |
@@ -1150,7 +1169,6 @@ void KCommandSocket::deleteSocket() | |||
1150 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); | 1169 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); |
1151 | if ( mSocket) | 1170 | if ( mSocket) |
1152 | delete mSocket; | 1171 | delete mSocket; |
1153 | mSocket = 0; | 1172 | mSocket = 0; |
1154 | emit commandFinished( this, mRetVal ); | 1173 | emit commandFinished( this, mRetVal ); |
1155 | } | 1174 | } |
1156 | |||
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 25892d8..7027894 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -114,12 +114,13 @@ class KSyncManager : public QObject | |||
114 | PWMPI = 2 }; | 114 | PWMPI = 2 }; |
115 | 115 | ||
116 | 116 | ||
117 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); | 117 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); |
118 | ~KSyncManager() ; | 118 | ~KSyncManager() ; |
119 | 119 | ||
120 | void multiSync( bool askforPrefs ); | ||
120 | bool blockSave() { return mBlockSaveFlag; } | 121 | bool blockSave() { return mBlockSaveFlag; } |
121 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } | 122 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } |
122 | void setDefaultFileName( QString s) { mDefFileName = s ;} | 123 | void setDefaultFileName( QString s) { mDefFileName = s ;} |
123 | QString defaultFileName() { return mDefFileName ;} | 124 | QString defaultFileName() { return mDefFileName ;} |
124 | QString syncFileName(); | 125 | QString syncFileName(); |
125 | void fillSyncMenu(); | 126 | void fillSyncMenu(); |
@@ -144,13 +145,12 @@ class KSyncManager : public QObject | |||
144 | int mRingSyncAlgoPrefs; | 145 | int mRingSyncAlgoPrefs; |
145 | bool mWriteBackFile; | 146 | bool mWriteBackFile; |
146 | int mWriteBackInFuture; | 147 | int mWriteBackInFuture; |
147 | QString mPhoneDevice; | 148 | QString mPhoneDevice; |
148 | QString mPhoneConnection; | 149 | QString mPhoneConnection; |
149 | QString mPhoneModel; | 150 | QString mPhoneModel; |
150 | QString mLastSyncedLocalFile; // save! | ||
151 | QString mPassWordPiSync; | 151 | QString mPassWordPiSync; |
152 | QString mActiveSyncPort; | 152 | QString mActiveSyncPort; |
153 | QString mActiveSyncIP ; | 153 | QString mActiveSyncIP ; |
154 | 154 | ||
155 | signals: | 155 | signals: |
156 | void save(); | 156 | void save(); |
@@ -175,13 +175,12 @@ class KSyncManager : public QObject | |||
175 | void quickSyncLocalFile(); | 175 | void quickSyncLocalFile(); |
176 | bool syncWithFile( QString fn , bool quick ); | 176 | bool syncWithFile( QString fn , bool quick ); |
177 | void syncLocalFile(); | 177 | void syncLocalFile(); |
178 | void syncPhone(); | 178 | void syncPhone(); |
179 | void syncSharp(); | 179 | void syncSharp(); |
180 | bool syncExternalApplication(QString); | 180 | bool syncExternalApplication(QString); |
181 | void multiSync( bool askforPrefs ); | ||
182 | int mCurrentSyncProfile ; | 181 | int mCurrentSyncProfile ; |
183 | void syncRemote( KSyncProfile* prof, bool ask = true); | 182 | void syncRemote( KSyncProfile* prof, bool ask = true); |
184 | void edit_sync_options(); | 183 | void edit_sync_options(); |
185 | int ringSync(); | 184 | int ringSync(); |
186 | QString getPassword( ); | 185 | QString getPassword( ); |
187 | 186 | ||