summaryrefslogtreecommitdiffabout
path: root/libkdepim/phoneaccess.cpp
Unidiff
Diffstat (limited to 'libkdepim/phoneaccess.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/phoneaccess.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp
index e24ad9e..89db22b 100644
--- a/libkdepim/phoneaccess.cpp
+++ b/libkdepim/phoneaccess.cpp
@@ -57,160 +57,160 @@ void PhoneAccess::writeConfig( QString device, QString connection, QString model
57 ; 57 ;
58 } else 58 } else
59 if ( line.left(4 ) == "port" ) { 59 if ( line.left(4 ) == "port" ) {
60 if ( line == "port = " + device+"\n" ) { 60 if ( line == "port = " + device+"\n" ) {
61 content += line ; 61 content += line ;
62 addPort = false; 62 addPort = false;
63 //qDebug("port found" ); 63 //qDebug("port found" );
64 } 64 }
65 65
66 } else if ( line.left(5 ) == "model" ) { 66 } else if ( line.left(5 ) == "model" ) {
67 if ( line == "model = " + model +"\n") { 67 if ( line == "model = " + model +"\n") {
68 content += line ; 68 content += line ;
69 addModel = false; 69 addModel = false;
70 //qDebug("model found" ); 70 //qDebug("model found" );
71 } 71 }
72 72
73 } else if ( line.left( 10 ) == "connection" ) { 73 } else if ( line.left( 10 ) == "connection" ) {
74 if ( line == "connection = " + connection +"\n") { 74 if ( line == "connection = " + connection +"\n") {
75 addConnection = false; 75 addConnection = false;
76 content += line ; 76 content += line ;
77 //qDebug("con found" ); 77 //qDebug("con found" );
78 } 78 }
79 79
80 } else { 80 } else {
81 content += line ; 81 content += line ;
82 } 82 }
83 } 83 }
84 file.close(); 84 file.close();
85 } else { 85 } else {
86 if ( ! connection.isEmpty() ) { 86 if ( ! connection.isEmpty() ) {
87 addConnection = true; 87 addConnection = true;
88 } 88 }
89 if ( ! device.isEmpty() ) { 89 if ( ! device.isEmpty() ) {
90 addPort = true; 90 addPort = true;
91 91
92 } 92 }
93 if ( ! model.isEmpty() ) { 93 if ( ! model.isEmpty() ) {
94 addModel = true; 94 addModel = true;
95 } 95 }
96 } 96 }
97 97
98 if ( addConnection ) { 98 if ( addConnection ) {
99 write = true; 99 write = true;
100 content += "connection = "; 100 content += "connection = ";
101 content += connection; 101 content += connection;
102 content += "\n"; 102 content += "\n";
103 } 103 }
104 if ( addPort ) { 104 if ( addPort ) {
105 write = true; 105 write = true;
106 content += "port = "; 106 content += "port = ";
107 content += device; 107 content += device;
108 content += "\n"; 108 content += "\n";
109 109
110 } 110 }
111 if ( addModel ) { 111 if ( addModel ) {
112 write = true; 112 write = true;
113 content += "model = "; 113 content += "model = ";
114 content += model; 114 content += model;
115 content += "\n"; 115 content += "\n";
116 } 116 }
117 if ( write ) { 117 if ( write ) {
118 if (!file.open( IO_WriteOnly ) ) { 118 if (!file.open( IO_WriteOnly ) ) {
119 qDebug("Error: cannot write file %s ", fileName.latin1() ); 119 qDebug("Error: cannot write file %s ", fileName.latin1() );
120 return; 120 return;
121 } 121 }
122 qDebug("Writing file %s ", fileName.latin1() ); 122 qDebug("Writing file %s ", fileName.latin1() );
123 QTextStream ts( &file ); 123 QTextStream ts( &file );
124 ts << content ; 124 ts << content ;
125 file.close(); 125 file.close();
126 } 126 }
127 127
128} 128}
129 129
130 130
131bool PhoneAccess::writeToPhone( QString fileName) 131bool PhoneAccess::writeToPhone( QString fileName)
132{ 132{
133 133
134#ifdef DESKTOP_VERSION 134#ifdef DESKTOP_VERSION
135#ifdef _WIN32_ 135#ifdef _WIN32_
136 QString command ="kammu --restore " + fileName ; 136 QString command ="kammu --restore " + fileName ;
137#else 137#else
138 QString command ="./kammu --restore " + fileName ; 138 QString command ="./kammu --restore " + fileName ;
139#endif 139#endif
140#else 140#else
141 QString command ="kammu --restore " + fileName ; 141 QString command ="kammu --restore " + fileName ;
142#endif 142#endif
143 int ret = 1; 143 int ret = 1;
144 while ( ret != 0 ) { 144 while ( ret != 0 ) {
145 QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 ); 145 QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 );
146 int w = 235; 146 int w = 235;
147 int h = status->sizeHint().height()+20 ; 147 int h = status->sizeHint().height()+20 ;
148 int dw = QApplication::desktop()->width(); 148 int dw = QApplication::desktop()->width();
149 int dh = QApplication::desktop()->height(); 149 int dh = QApplication::desktop()->height();
150 if ( dw > 310 ) 150 if ( dw > 310 )
151 w = 310; 151 w = 310;
152 status->setCaption(i18n("Writing to phone...") ); 152 status->setCaption(i18n("Writing to phone...") );
153 status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 153 status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
154 status->show(); 154 status->show();
155 status->raise(); 155 status->raise();
156 status->update(); 156 status->update();
157 qApp->processEvents(); 157 qApp->processEvents();
158 status->update(); 158 status->update();
159 qApp->processEvents(); 159 qApp->processEvents();
160 ret = system ( command.latin1()); 160 ret = system ( command.latin1());
161 delete status; 161 delete status;
162 qApp->processEvents(); 162 qApp->processEvents();
163 if ( ret ) { 163 if ( ret ) {
164 qDebug("Error S::command returned %d.", ret); 164 qDebug("Error S::command returned %d.", ret);
165 int retval = KMessageBox::warningContinueCancel(0, 165 int retval = KMessageBox::warningContinueCancel(0,
166 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); 166 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel"));
167 if ( retval != KMessageBox::Continue ) 167 if ( retval != KMessageBox::Continue )
168 return false; 168 return false;
169 } 169 }
170 } 170 }
171 return true; 171 return true;
172} 172}
173bool PhoneAccess::readFromPhone( QString fileName) 173bool PhoneAccess::readFromPhone( QString fileName)
174{ 174{
175 175
176#ifdef DESKTOP_VERSION 176#ifdef DESKTOP_VERSION
177#ifdef _WIN32_ 177#ifdef _WIN32_
178 QString command ="kammu --backup " + fileName + " -yes" ; 178 QString command ="kammu --backup " + fileName + " -yes" ;
179#else 179#else
180 QString command ="./kammu --backup " + fileName + " -yes" ; 180 QString command ="./kammu --backup " + fileName + " -yes" ;
181#endif 181#endif
182#else 182#else
183 QString command ="kammu --backup " + fileName + " -yes" ; 183 QString command ="kammu --backup " + fileName + " -yes" ;
184#endif 184#endif
185 int ret; 185 int ret = 1;
186 while ( ret != 0 ) { 186 while ( ret != 0 ) {
187 QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 ); 187 QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 );
188 int w = 235; 188 int w = 235;
189 int h = status->sizeHint().height()+20 ; 189 int h = status->sizeHint().height()+20 ;
190 int dw = QApplication::desktop()->width(); 190 int dw = QApplication::desktop()->width();
191 int dh = QApplication::desktop()->height(); 191 int dh = QApplication::desktop()->height();
192 if ( dw > 310 ) 192 if ( dw > 310 )
193 w = 310; 193 w = 310;
194 status->setCaption(i18n("Reading from phone...") ); 194 status->setCaption(i18n("Reading from phone...") );
195 status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 195 status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
196 status->show(); 196 status->show();
197 status->raise(); 197 status->raise();
198 status->update(); 198 status->update();
199 qApp->processEvents(); 199 qApp->processEvents();
200 status->update(); 200 status->update();
201 qApp->processEvents(); 201 qApp->processEvents();
202 ret = system ( command.latin1() ); 202 ret = system ( command.latin1() );
203 delete status; 203 delete status;
204 qApp->processEvents(); 204 qApp->processEvents();
205 if ( ret ) { 205 if ( ret ) {
206 qDebug("Error reading from phone:Command returned %d", ret); 206 qDebug("Error reading from phone:Command returned %d", ret);
207 int retval = KMessageBox::warningContinueCancel(0, 207 int retval = KMessageBox::warningContinueCancel(0,
208 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); 208 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel"));
209 if ( retval != KMessageBox::Continue ) 209 if ( retval != KMessageBox::Continue )
210 return false; 210 return false;
211 211
212 } 212 }
213 } 213 }
214 qApp->processEvents(); 214 qApp->processEvents();
215 return true; 215 return true;
216} 216}