-rw-r--r-- | libkdepim/phoneaccess.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp index fe914dd..5fafa1f 100644 --- a/libkdepim/phoneaccess.cpp +++ b/libkdepim/phoneaccess.cpp | |||
@@ -98,54 +98,76 @@ void PhoneAccess::writeConfig( QString device, QString connection, QString model | |||
98 | write = true; | 98 | write = true; |
99 | content += "connection = "; | 99 | content += "connection = "; |
100 | content += connection; | 100 | content += connection; |
101 | content += "\n"; | 101 | content += "\n"; |
102 | } | 102 | } |
103 | if ( addPort ) { | 103 | if ( addPort ) { |
104 | write = true; | 104 | write = true; |
105 | content += "port = "; | 105 | content += "port = "; |
106 | content += device; | 106 | content += device; |
107 | content += "\n"; | 107 | content += "\n"; |
108 | 108 | ||
109 | } | 109 | } |
110 | if ( addModel ) { | 110 | if ( addModel ) { |
111 | write = true; | 111 | write = true; |
112 | content += "model = "; | 112 | content += "model = "; |
113 | content += model; | 113 | content += model; |
114 | content += "\n"; | 114 | content += "\n"; |
115 | } | 115 | } |
116 | if ( write ) { | 116 | if ( write ) { |
117 | if (!file.open( IO_WriteOnly ) ) { | 117 | if (!file.open( IO_WriteOnly ) ) { |
118 | qDebug("Error: cannot write file %s ", fileName.latin1() ); | 118 | qDebug("Error: cannot write file %s ", fileName.latin1() ); |
119 | return; | 119 | return; |
120 | } | 120 | } |
121 | qDebug("Writing file %s ", fileName.latin1() ); | 121 | qDebug("Writing file %s ", fileName.latin1() ); |
122 | QTextStream ts( &file ); | 122 | QTextStream ts( &file ); |
123 | ts << content ; | 123 | ts << content ; |
124 | file.close(); | 124 | file.close(); |
125 | } | 125 | } |
126 | 126 | ||
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
130 | bool PhoneAccess::writeToPhone( QString fileName) | 130 | bool PhoneAccess::writeToPhone( QString fileName) |
131 | { | 131 | { |
132 | 132 | ||
133 | #ifdef DESKTOP_VERSION | 133 | #ifdef DESKTOP_VERSION |
134 | #ifdef _WIN32_ | 134 | #ifdef _WIN32_ |
135 | QString command ="kammu --restore " + fileName ; | 135 | QString command ="kammu --restore " + fileName ; |
136 | #else | 136 | #else |
137 | QString command ="./kammu --restore " + fileName ; | 137 | QString command ="./kammu --restore " + fileName ; |
138 | #endif | 138 | #endif |
139 | #else | 139 | #else |
140 | QString command ="kammu --restore " + fileName ; | 140 | QString command ="kammu --restore " + fileName ; |
141 | #endif | 141 | #endif |
142 | int ret; | 142 | int ret; |
143 | while ( (ret = system ( command.latin1())) != 0 ) { | 143 | while ( (ret = system ( command.latin1())) != 0 ) { |
144 | qDebug("Error S::command returned %d.", ret); | 144 | qDebug("Error S::command returned %d.", ret); |
145 | int retval = KMessageBox::warningContinueCancel(0, | 145 | int retval = KMessageBox::warningContinueCancel(0, |
146 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone access"),i18n("Retry"),i18n("Cancel")); | 146 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); |
147 | if ( retval != KMessageBox::Continue ) | ||
148 | return false; | ||
149 | } | ||
150 | return true; | ||
151 | } | ||
152 | bool PhoneAccess::readFromPhone( QString fileName) | ||
153 | { | ||
154 | |||
155 | #ifdef DESKTOP_VERSION | ||
156 | #ifdef _WIN32_ | ||
157 | QString command ="kammu --backup " + fileName + " -yes" ; | ||
158 | #else | ||
159 | QString command ="./kammu --backup " + fileName + " -yes" ; | ||
160 | #endif | ||
161 | #else | ||
162 | QString command ="kammu --backup " + fileName + " -yes" ; | ||
163 | #endif | ||
164 | int ret; | ||
165 | while ( (ret = system ( command.latin1())) != 0 ) { | ||
166 | qDebug("Error S::command returned %d.", ret); | ||
167 | int retval = KMessageBox::warningContinueCancel(0, | ||
168 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); | ||
147 | if ( retval != KMessageBox::Continue ) | 169 | if ( retval != KMessageBox::Continue ) |
148 | return false; | 170 | return false; |
149 | } | 171 | } |
150 | return true; | 172 | return true; |
151 | } | 173 | } |