-rw-r--r-- | korganizer/koprefs.cpp | 6 | ||||
-rw-r--r-- | korganizer/koprefs.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 134 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 | ||||
-rw-r--r-- | libkcal/phoneformat.cpp | 68 | ||||
-rw-r--r-- | libkcal/phoneformat.h | 2 |
6 files changed, 188 insertions, 26 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index c28da9a..716a125 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -74,12 +74,18 @@ KOPrefs::KOPrefs() : | |||
74 | mMarcusBainsFont= QFont("helvetica",10); | 74 | mMarcusBainsFont= QFont("helvetica",10); |
75 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); | 75 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); |
76 | mEditBoxFont = QFont("helvetica",12); | 76 | mEditBoxFont = QFont("helvetica",12); |
77 | mJornalViewFont = QFont("helvetica",12); | 77 | mJornalViewFont = QFont("helvetica",12); |
78 | 78 | ||
79 | KPrefs::setCurrentGroup("General"); | 79 | KPrefs::setCurrentGroup("General"); |
80 | |||
81 | |||
82 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); | ||
83 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); | ||
84 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); | ||
85 | |||
80 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 86 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
81 | 87 | ||
82 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 88 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
83 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 89 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
84 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 90 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
85 | addItemBool("ShowIconList",&mShowIconList,true); | 91 | addItemBool("ShowIconList",&mShowIconList,true); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index d9ac851..a1ba8b3 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -207,12 +207,15 @@ class KOPrefs : public KPimPrefs | |||
207 | QString mRemotePassWd; | 207 | QString mRemotePassWd; |
208 | QString mRemoteFile; | 208 | QString mRemoteFile; |
209 | QString mLocalTempFile; | 209 | QString mLocalTempFile; |
210 | QString mPhoneDevice; | 210 | QString mPhoneDevice; |
211 | QString mPhoneConnection; | 211 | QString mPhoneConnection; |
212 | QString mPhoneModel; | 212 | QString mPhoneModel; |
213 | QString mEx2PhoneDevice; | ||
214 | QString mEx2PhoneConnection; | ||
215 | QString mEx2PhoneModel; | ||
213 | 216 | ||
214 | int mLastSyncTime; | 217 | int mLastSyncTime; |
215 | int mSyncAlgoPrefs; | 218 | int mSyncAlgoPrefs; |
216 | int mRingSyncAlgoPrefs; | 219 | int mRingSyncAlgoPrefs; |
217 | QStringList mSyncProfileNames; | 220 | QStringList mSyncProfileNames; |
218 | QStringList mExternSyncProfiles; | 221 | QStringList mExternSyncProfiles; |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index de94b8c..ef73a78 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -10,12 +10,14 @@ | |||
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | ||
17 | #include <qcheckbox.h> | ||
16 | #include <qmap.h> | 18 | #include <qmap.h> |
17 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
18 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
19 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
20 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
21 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
@@ -32,12 +34,13 @@ | |||
32 | #include <qapplication.h> | 34 | #include <qapplication.h> |
33 | //#include <resource.h> | 35 | //#include <resource.h> |
34 | 36 | ||
35 | #endif | 37 | #endif |
36 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
37 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | ||
38 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
39 | #include <libkcal/kincidenceformatter.h> | 42 | #include <libkcal/kincidenceformatter.h> |
40 | #include <libkdepim/kpimglobalprefs.h> | 43 | #include <libkdepim/kpimglobalprefs.h> |
41 | 44 | ||
42 | #include "calendarview.h" | 45 | #include "calendarview.h" |
43 | #include "koviewmanager.h" | 46 | #include "koviewmanager.h" |
@@ -63,12 +66,61 @@ using namespace KCal; | |||
63 | #include <unistd.h> | 66 | #include <unistd.h> |
64 | #else | 67 | #else |
65 | #include "koimportoldialog.h" | 68 | #include "koimportoldialog.h" |
66 | #endif | 69 | #endif |
67 | #include "mainwindow.h" | 70 | #include "mainwindow.h" |
68 | 71 | ||
72 | class KOex2phonePrefs : public QDialog | ||
73 | { | ||
74 | public: | ||
75 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | ||
76 | QDialog( parent, name, true ) | ||
77 | { | ||
78 | setCaption( i18n("Export to phone options") ); | ||
79 | QVBoxLayout* lay = new QVBoxLayout( this ); | ||
80 | lay->setSpacing( 3 ); | ||
81 | lay->setMargin( 3 ); | ||
82 | |||
83 | lay->addWidget(new QLabel( i18n("Please read phone sync howto to\nknow more about the connection settings."), this ) ); | ||
84 | QHBox* temphb; | ||
85 | temphb = new QHBox( this ); | ||
86 | new QLabel( i18n("I/O device: "), temphb ); | ||
87 | mPhoneDevice = new QLineEdit( temphb); | ||
88 | lay->addWidget( temphb ); | ||
89 | temphb = new QHBox( this ); | ||
90 | new QLabel( i18n("Connection: "), temphb ); | ||
91 | mPhoneConnection = new QLineEdit( temphb); | ||
92 | lay->addWidget( temphb ); | ||
93 | temphb = new QHBox( this ); | ||
94 | new QLabel( i18n("Model(opt.): "), temphb ); | ||
95 | mPhoneModel = new QLineEdit( temphb); | ||
96 | lay->addWidget( temphb ); | ||
97 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | ||
98 | mWriteBackFuture->setChecked( true ); | ||
99 | lay->addWidget( mWriteBackFuture ); | ||
100 | temphb = new QHBox( this ); | ||
101 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | ||
102 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | ||
103 | mWriteBackFutureWeeks->setValue( 8 ); | ||
104 | lay->addWidget( temphb ); | ||
105 | QPushButton * ok = new QPushButton( i18n("Export!"), this ); | ||
106 | lay->addWidget( ok ); | ||
107 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | ||
108 | lay->addWidget( cancel ); | ||
109 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | ||
110 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | ||
111 | resize( 220, 220 ); | ||
112 | |||
113 | } | ||
114 | |||
115 | public: | ||
116 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | ||
117 | QCheckBox* mWriteBackFuture; | ||
118 | QSpinBox* mWriteBackFutureWeeks; | ||
119 | }; | ||
120 | |||
69 | int globalFlagBlockStartup; | 121 | int globalFlagBlockStartup; |
70 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 122 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
71 | QMainWindow( parent, name ) | 123 | QMainWindow( parent, name ) |
72 | { | 124 | { |
73 | mPassWordPiSync = "abc"; | 125 | mPassWordPiSync = "abc"; |
74 | #ifdef DESKTOP_VERSION | 126 | #ifdef DESKTOP_VERSION |
@@ -650,12 +702,21 @@ void MainWindow::initActions() | |||
650 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 702 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
651 | 703 | ||
652 | importMenu->insertSeparator(); | 704 | importMenu->insertSeparator(); |
653 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 705 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
654 | this ); | 706 | this ); |
655 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 707 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
708 | |||
709 | |||
710 | //LR | ||
711 | QPopupMenu *ex2phone = new QPopupMenu( this ); | ||
712 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | ||
713 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | ||
714 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | ||
715 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); | ||
716 | |||
656 | importMenu->insertSeparator(); | 717 | importMenu->insertSeparator(); |
657 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 718 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
658 | this ); | 719 | this ); |
659 | action->addTo( importMenu ); | 720 | action->addTo( importMenu ); |
660 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 721 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
661 | #ifndef DESKTOP_VERSION | 722 | #ifndef DESKTOP_VERSION |
@@ -1084,19 +1145,92 @@ void MainWindow::slotSyncMenu( int action ) | |||
1084 | 1145 | ||
1085 | } | 1146 | } |
1086 | } | 1147 | } |
1087 | delete temp; | 1148 | delete temp; |
1088 | mBlockSaveFlag = false; | 1149 | mBlockSaveFlag = false; |
1089 | } | 1150 | } |
1151 | void MainWindow::exportToPhone( int mode ) | ||
1152 | { | ||
1153 | |||
1154 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | ||
1155 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | ||
1156 | KOex2phonePrefs ex2phone; | ||
1157 | ex2phone.mPhoneConnection->setText( KOPrefs::instance()->mEx2PhoneConnection ); | ||
1158 | ex2phone.mPhoneDevice->setText( KOPrefs::instance()->mEx2PhoneDevice ); | ||
1159 | ex2phone.mPhoneModel->setText( KOPrefs::instance()->mEx2PhoneModel ); | ||
1160 | |||
1161 | if ( !ex2phone.exec() ) { | ||
1162 | return; | ||
1163 | } | ||
1164 | KOPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | ||
1165 | KOPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | ||
1166 | KOPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | ||
1167 | |||
1168 | int inFuture = 0; | ||
1169 | if ( ex2phone.mWriteBackFuture->isChecked() ) | ||
1170 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | ||
1171 | QPtrList<Incidence> delSel; | ||
1172 | if ( mode == 1 ) | ||
1173 | delSel = mCalendar->rawIncidences(); | ||
1174 | if ( mode == 2 ) | ||
1175 | delSel = mCalendar->incidences(); | ||
1176 | CalendarLocal* cal = new CalendarLocal(); | ||
1177 | cal->setLocalTime(); | ||
1178 | Incidence *incidence = delSel.first(); | ||
1179 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | ||
1180 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | ||
1181 | while ( incidence ) { | ||
1182 | if ( incidence->type() != "journal" ) { | ||
1183 | bool add = true; | ||
1184 | if ( inFuture ) { | ||
1185 | QDateTime dt; | ||
1186 | if ( incidence->type() == "Todo" ) { | ||
1187 | Todo * t = (Todo*)incidence; | ||
1188 | if ( t->hasDueDate() ) | ||
1189 | dt = t->dtDue(); | ||
1190 | else | ||
1191 | dt = cur.addSecs( 62 ); | ||
1192 | } | ||
1193 | else { | ||
1194 | bool ok; | ||
1195 | dt = incidence->getNextOccurence( cur, &ok ); | ||
1196 | if ( !ok ) | ||
1197 | dt = cur.addSecs( -62 ); | ||
1198 | } | ||
1199 | if ( dt < cur || dt > end ) { | ||
1200 | add = false; | ||
1201 | } | ||
1202 | } | ||
1203 | if ( add ) { | ||
1204 | Incidence *in = incidence->clone(); | ||
1205 | cal->addIncidence( in ); | ||
1206 | } | ||
1207 | } | ||
1208 | incidence = delSel.next(); | ||
1209 | } | ||
1210 | PhoneFormat::writeConfig( KOPrefs::instance()->mEx2PhoneDevice, | ||
1211 | KOPrefs::instance()->mEx2PhoneConnection, | ||
1212 | KOPrefs::instance()->mEx2PhoneModel ); | ||
1213 | |||
1214 | setCaption( i18n("Writing to phone...")); | ||
1215 | if ( PhoneFormat::writeToPhone( cal ) ) | ||
1216 | setCaption( i18n("Export to phone successful!")); | ||
1217 | else | ||
1218 | setCaption( i18n("Error exporting to phone!")); | ||
1219 | delete cal; | ||
1220 | } | ||
1221 | |||
1222 | |||
1090 | void MainWindow::setDefaultPreferences() | 1223 | void MainWindow::setDefaultPreferences() |
1091 | { | 1224 | { |
1092 | KOPrefs *p = KOPrefs::instance(); | 1225 | KOPrefs *p = KOPrefs::instance(); |
1093 | 1226 | ||
1094 | p->mCompactDialogs = true; | 1227 | p->mCompactDialogs = true; |
1095 | p->mConfirm = true; | 1228 | p->mConfirm = true; |
1096 | // p->mEnableQuickTodo = false; | 1229 | // p->mEnableQuickTodo = false; |
1230 | |||
1097 | } | 1231 | } |
1098 | 1232 | ||
1099 | QString MainWindow::resourcePath() | 1233 | QString MainWindow::resourcePath() |
1100 | { | 1234 | { |
1101 | return KGlobal::iconLoader()->iconPath(); | 1235 | return KGlobal::iconLoader()->iconPath(); |
1102 | } | 1236 | } |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 7b24b88..74c7f45 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -141,12 +141,13 @@ class MainWindow : public QMainWindow | |||
141 | void printCal(); | 141 | void printCal(); |
142 | void saveCalendar(); | 142 | void saveCalendar(); |
143 | void loadCalendar(); | 143 | void loadCalendar(); |
144 | void exportVCalendar(); | 144 | void exportVCalendar(); |
145 | void fillFilterMenu(); | 145 | void fillFilterMenu(); |
146 | void selectFilter( int ); | 146 | void selectFilter( int ); |
147 | void exportToPhone( int ); | ||
147 | 148 | ||
148 | void slotSyncMenu( int ); | 149 | void slotSyncMenu( int ); |
149 | void confSync(); | 150 | void confSync(); |
150 | void syncSharp(); | 151 | void syncSharp(); |
151 | void syncPhone(); | 152 | void syncPhone(); |
152 | void syncPi(); | 153 | void syncPi(); |
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 29c1ae6..b2a62b1 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -81,14 +81,25 @@ public: | |||
81 | 81 | ||
82 | 82 | ||
83 | 83 | ||
84 | PhoneFormat::PhoneFormat(QString profileName, QString device,QString connection, QString model ) | 84 | PhoneFormat::PhoneFormat(QString profileName, QString device,QString connection, QString model ) |
85 | { | 85 | { |
86 | mProfileName = profileName; | 86 | mProfileName = profileName; |
87 | 87 | writeConfig( device, connection, model ); | |
88 | } | ||
89 | |||
90 | PhoneFormat::~PhoneFormat() | ||
91 | { | ||
92 | } | ||
93 | void PhoneFormat::writeConfig( QString device, QString connection, QString model ) | ||
94 | { | ||
95 | #ifdef _WIN32_ | ||
96 | QString fileName = qApp->applicationDirPath () +"\\gammurc"; | ||
97 | #else | ||
88 | QString fileName = QDir::homeDirPath() +"/.gammurc"; | 98 | QString fileName = QDir::homeDirPath() +"/.gammurc"; |
99 | #endif | ||
89 | //qDebug("save %d ", load ); | 100 | //qDebug("save %d ", load ); |
90 | QString content; | 101 | QString content; |
91 | bool write = false; | 102 | bool write = false; |
92 | bool addPort = true, addConnection = true, addModel = true; | 103 | bool addPort = true, addConnection = true, addModel = true; |
93 | QFile file( fileName ); | 104 | QFile file( fileName ); |
94 | if ( QFile::exists( fileName) ) { | 105 | if ( QFile::exists( fileName) ) { |
@@ -173,16 +184,13 @@ PhoneFormat::PhoneFormat(QString profileName, QString device,QString connection, | |||
173 | } | 184 | } |
174 | qDebug("Writing file %s ", fileName.latin1() ); | 185 | qDebug("Writing file %s ", fileName.latin1() ); |
175 | QTextStream ts( &file ); | 186 | QTextStream ts( &file ); |
176 | ts << content ; | 187 | ts << content ; |
177 | file.close(); | 188 | file.close(); |
178 | } | 189 | } |
179 | } | ||
180 | 190 | ||
181 | PhoneFormat::~PhoneFormat() | ||
182 | { | ||
183 | } | 191 | } |
184 | #if 0 | 192 | #if 0 |
185 | int PhoneFormat::initDevice(GSM_StateMachine *s) | 193 | int PhoneFormat::initDevice(GSM_StateMachine *s) |
186 | { | 194 | { |
187 | GSM_ReadConfig(NULL, &s->Config[0], 0); | 195 | GSM_ReadConfig(NULL, &s->Config[0], 0); |
188 | s->ConfigNum = 1; | 196 | s->ConfigNum = 1; |
@@ -566,12 +574,41 @@ void PhoneFormat::afterSave( Incidence* inc) | |||
566 | csum = PhoneFormat::getCsumTodo( (Todo*) inc ); | 574 | csum = PhoneFormat::getCsumTodo( (Todo*) inc ); |
567 | inc->setCsum( mProfileName, QString::number( csum )); | 575 | inc->setCsum( mProfileName, QString::number( csum )); |
568 | 576 | ||
569 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 577 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
570 | 578 | ||
571 | } | 579 | } |
580 | |||
581 | bool PhoneFormat::writeToPhone( Calendar * calendar) | ||
582 | { | ||
583 | #ifdef _WIN32_ | ||
584 | QString fileName = locateLocal("tmp", "tempfile.vcs"); | ||
585 | #else | ||
586 | QString fileName = "/tmp/kdepimtemp.vcs"; | ||
587 | #endif | ||
588 | |||
589 | VCalFormat vfsave; | ||
590 | vfsave.setLocalTime ( true ); | ||
591 | if ( ! vfsave.save( calendar, fileName ) ) | ||
592 | return false; | ||
593 | // 4 call kammu | ||
594 | #ifdef DESKTOP_VERSION | ||
595 | QString command ="./kammu --restore " + fileName ; | ||
596 | #else | ||
597 | QString command ="kammu --restore " + fileName ; | ||
598 | #endif | ||
599 | int ret; | ||
600 | while ( (ret = system ( command.latin1())) != 0 ) { | ||
601 | qDebug("Error S::command returned %d. asking users", ret); | ||
602 | int retval = KMessageBox::warningContinueCancel(0, | ||
603 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone access"),i18n("Retry"),i18n("Cancel")); | ||
604 | if ( retval != KMessageBox::Continue ) | ||
605 | return false; | ||
606 | } | ||
607 | return true; | ||
608 | } | ||
572 | bool PhoneFormat::save( Calendar *calendar) | 609 | bool PhoneFormat::save( Calendar *calendar) |
573 | { | 610 | { |
574 | QLabel status ( i18n(" Opening device ..."), 0 ); | 611 | QLabel status ( i18n(" Opening device ..."), 0 ); |
575 | int w = status.sizeHint().width()+20 ; | 612 | int w = status.sizeHint().width()+20 ; |
576 | if ( w < 200 ) w = 230; | 613 | if ( w < 200 ) w = 230; |
577 | int h = status.sizeHint().height()+20 ; | 614 | int h = status.sizeHint().height()+20 ; |
@@ -580,17 +617,12 @@ bool PhoneFormat::save( Calendar *calendar) | |||
580 | status.setCaption(i18n("Writing to phone...") ); | 617 | status.setCaption(i18n("Writing to phone...") ); |
581 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 618 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
582 | status.show(); | 619 | status.show(); |
583 | status.raise(); | 620 | status.raise(); |
584 | qApp->processEvents(); | 621 | qApp->processEvents(); |
585 | QString message; | 622 | QString message; |
586 | #ifdef _WIN32_ | ||
587 | QString fileName = locateLocal("tmp", "tempfile.vcs"); | ||
588 | #else | ||
589 | QString fileName = "/tmp/kdepimtemp.vcs"; | ||
590 | #endif | ||
591 | 623 | ||
592 | // 1 remove events which should be deleted | 624 | // 1 remove events which should be deleted |
593 | QPtrList<Event> er = calendar->rawEvents(); | 625 | QPtrList<Event> er = calendar->rawEvents(); |
594 | Event* ev = er.first(); | 626 | Event* ev = er.first(); |
595 | while ( ev ) { | 627 | while ( ev ) { |
596 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { | 628 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { |
@@ -611,30 +643,14 @@ bool PhoneFormat::save( Calendar *calendar) | |||
611 | calendar->deleteTodo( to ); | 643 | calendar->deleteTodo( to ); |
612 | } | 644 | } |
613 | } | 645 | } |
614 | to = tl.next(); | 646 | to = tl.next(); |
615 | } | 647 | } |
616 | // 3 save file | 648 | // 3 save file |
617 | VCalFormat vfsave; | 649 | if ( !writeToPhone( calendar ) ) |
618 | vfsave.setLocalTime ( true ); | ||
619 | if ( ! vfsave.save( calendar, fileName ) ) | ||
620 | return false; | 650 | return false; |
621 | // 4 call kammu | ||
622 | #ifdef DESKTOP_VERSION | ||
623 | QString command ="./kammu --restore " + fileName ; | ||
624 | #else | ||
625 | QString command ="kammu --restore " + fileName ; | ||
626 | #endif | ||
627 | int ret; | ||
628 | while ( (ret = system ( command.latin1())) != 0 ) { | ||
629 | qDebug("Error S::command returned %d. asking users", ret); | ||
630 | int retval = KMessageBox::warningContinueCancel(0, | ||
631 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone sync"),i18n("Retry"),i18n("Cancel")); | ||
632 | if ( retval != KMessageBox::Continue ) | ||
633 | return false; | ||
634 | } | ||
635 | 651 | ||
636 | // 5 reread data | 652 | // 5 reread data |
637 | message = i18n(" Rereading all data ... "); | 653 | message = i18n(" Rereading all data ... "); |
638 | status.setText ( message ); | 654 | status.setText ( message ); |
639 | qApp->processEvents(); | 655 | qApp->processEvents(); |
640 | CalendarLocal* calendarTemp = new CalendarLocal(); | 656 | CalendarLocal* calendarTemp = new CalendarLocal(); |
diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h index 2d1ff79..61e8160 100644 --- a/libkcal/phoneformat.h +++ b/libkcal/phoneformat.h | |||
@@ -45,12 +45,14 @@ class PhoneFormat : public QObject { | |||
45 | bool save( Calendar * ); | 45 | bool save( Calendar * ); |
46 | bool fromString( Calendar *, const QString & ); | 46 | bool fromString( Calendar *, const QString & ); |
47 | QString toString( Calendar * ); | 47 | QString toString( Calendar * ); |
48 | static ulong getCsum( const QStringList & ); | 48 | static ulong getCsum( const QStringList & ); |
49 | static ulong getCsumTodo( Todo* to ); | 49 | static ulong getCsumTodo( Todo* to ); |
50 | static ulong getCsumEvent( Event* ev ); | 50 | static ulong getCsumEvent( Event* ev ); |
51 | static void writeConfig( QString device,QString connection, QString model ); | ||
52 | static bool writeToPhone( Calendar * ); | ||
51 | private: | 53 | private: |
52 | void copyEvent( Event* to, Event* from ); | 54 | void copyEvent( Event* to, Event* from ); |
53 | void copyTodo( Todo* to, Todo* from ); | 55 | void copyTodo( Todo* to, Todo* from ); |
54 | //int initDevice(GSM_StateMachine *s); | 56 | //int initDevice(GSM_StateMachine *s); |
55 | QString mProfileName; | 57 | QString mProfileName; |
56 | void afterSave( Incidence* ); | 58 | void afterSave( Incidence* ); |