summaryrefslogtreecommitdiff
path: root/noncore
authoreilers <eilers>2004-10-23 12:05:13 (UTC)
committer eilers <eilers>2004-10-23 12:05:13 (UTC)
commitaac8188fde70fc5cfa9f44c6a80a907e44f0f1eb (patch) (unidiff)
tree37b683afa01b06245f81ff13cf8362e9f6ab9378 /noncore
parentf2a2eca1870e1fd88c82a6ccb039610949daa72c (diff)
downloadopie-aac8188fde70fc5cfa9f44c6a80a907e44f0f1eb.zip
opie-aac8188fde70fc5cfa9f44c6a80a907e44f0f1eb.tar.gz
opie-aac8188fde70fc5cfa9f44c6a80a907e44f0f1eb.tar.bz2
Pimconverter got a button to convert databases from sqlite 2->3.
If correct implementation is confirmed, I will commit the rest..
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/pimconverter/converter.cpp87
-rwxr-xr-xnoncore/tools/pimconverter/converter.h2
-rw-r--r--noncore/tools/pimconverter/converter_base.ui62
3 files changed, 141 insertions, 10 deletions
diff --git a/noncore/tools/pimconverter/converter.cpp b/noncore/tools/pimconverter/converter.cpp
index e9de3c3..2cd6969 100644
--- a/noncore/tools/pimconverter/converter.cpp
+++ b/noncore/tools/pimconverter/converter.cpp
@@ -2,2 +2,4 @@
2 2
3#include <stdlib.h> // For "system()" command
4
3/* OPIE */ 5/* OPIE */
@@ -226 +228,86 @@ void Converter::closeEvent( QCloseEvent *e )
226} 228}
229
230
231
232void Converter::start_upgrade()
233{
234 odebug << "Start upgrading" << oendl;
235 switch( QMessageBox::warning( this, "Pim-Converter",
236 "Are you really sure that you\n"
237 "want to convert your database from\n"
238 "sqlite V2 to sqlite V3?",
239 QMessageBox::Ok | QMessageBox::Default,
240 QMessageBox::Abort | QMessageBox::Escape )) {
241
242 case QMessageBox::Abort: // Abort clicked or Escape pressed
243 // abort
244 return;
245 break;
246 }
247 odebug << "Checking whether sqlite is installed" << oendl;
248 if ( system( "which sqlite" ) != 0 ){
249 QMessageBox::critical( this, "Pim-Converter",
250 QString("An internal error occurred:\n") +
251 "sqlite was not accessible!\n"+
252 "Please correct the PATH or install \n" +
253 "this packages!" );
254 return;
255 }
256 if ( system( "which sqlite3" ) != 0 ){
257 QMessageBox::critical( this, "Pim-Converter",
258 QString("An internal error occurred:\n") +
259 "sqlite3 was not accessible!\n"+
260 "Please correct the PATH or install \n" +
261 "this packages!" );
262 return;
263 }
264 if ( QFile::exists( "~/Applications/addressbook/addressbook.db" )
265 && !QFile::exists( "~/Applications/addressbook/addressbook.db_v2" ) ){
266 odebug << "Executing conversion commands" << oendl;
267 QString addr_convert_string = "cd ~/Applications/addressbook/;cp addressbook.db addressbook.db_v2;sqlite addressbook.db_v2 .dump | sqlite3 addressbook.db";
268 odebug << "1. Addressbook Command:" << addr_convert_string << oendl;
269 if ( system( addr_convert_string ) != 0 ){
270 QMessageBox::critical( this, "Pim-Converter",
271 QString("An internal error occurred:\n") +
272 "Converting the addressbook command was impossible!\n"+
273 "Executed the following command:\n" +
274 addr_convert_string );
275 return;
276 }
277 }
278 if ( QFile::exists( "~/Applications/datebook/datebook.db" )
279 && !QFile::exists( "~/Applications/datebook/datebook.db_v2" ) ){
280 QString dateb_convert_string = "cd ~/Applications/datebook/;cp datebook.db datebook.db_v2;sqlite datebook.db_v2 .dump | sqlite3 datebook.db";
281 odebug << "2. Datebook Command" << dateb_convert_string << oendl;
282 if ( system( dateb_convert_string ) != 0 ){
283 QMessageBox::critical( this, "Pim-Converter",
284 QString("An internal error occurred:\n") +
285 "Converting the datebook command was impossible!\n"+
286 "Executed the following command:\n" +
287 dateb_convert_string );
288 return;
289 }
290 }
291
292 if ( QFile::exists( "~/Applications/todolist/todolist.db" )
293 && !QFile::exists( "~/Applications/todolist/todolist.db_v2" ) ){
294 QString todo_convert_string = "cd ~/Applications/todolist/;cp todolist.db todolist.db_v2;sqlite todolist.db_v2 .dump | sqlite3 todolist.db";
295 odebug << "3. Todolist Command:" << todo_convert_string << oendl;
296 if ( system( todo_convert_string ) != 0 ){
297 QMessageBox::critical( this, "Pim-Converter",
298 QString("An internal error occurred:\n") +
299 "Converting the todolist command was impossible!\n"+
300 "Executed the following command:\n" +
301 todo_convert_string );
302 return;
303 }
304 }
305
306 QMessageBox::information( this, "Pim-Converter",
307 "Conversion is finished!",
308 "&OK", NULL, NULL,
309 0, // Enter == button 0
310 0 );
311
312
313}
diff --git a/noncore/tools/pimconverter/converter.h b/noncore/tools/pimconverter/converter.h
index 344562a..9d75d79 100755
--- a/noncore/tools/pimconverter/converter.h
+++ b/noncore/tools/pimconverter/converter.h
@@ -14,2 +14,3 @@ public:
14 void start_conversion(); 14 void start_conversion();
15 void start_upgrade();
15 void selectedDatabase( int num ); 16 void selectedDatabase( int num );
@@ -24,2 +25,3 @@ private:
24 // the predefinition in the UI-File !! 25 // the predefinition in the UI-File !!
26 // If you don't understand what I am talking about: Keep your fingers away!!
25 enum DataBases{ 27 enum DataBases{
diff --git a/noncore/tools/pimconverter/converter_base.ui b/noncore/tools/pimconverter/converter_base.ui
index a5b22c9..b519f2e 100644
--- a/noncore/tools/pimconverter/converter_base.ui
+++ b/noncore/tools/pimconverter/converter_base.ui
@@ -13,4 +13,4 @@
13 <y>0</y> 13 <y>0</y>
14 <width>269</width> 14 <width>308</width>
15 <height>324</height> 15 <height>323</height>
16 </rect> 16 </rect>
@@ -59,2 +59,13 @@
59 <widget> 59 <widget>
60 <class>QPushButton</class>
61 <property stdset="1">
62 <name>name</name>
63 <cstring>PushButton2</cstring>
64 </property>
65 <property stdset="1">
66 <name>text</name>
67 <string>Upgrade to SQLite3</string>
68 </property>
69 </widget>
70 <widget>
60 <class>QGroupBox</class> 71 <class>QGroupBox</class>
@@ -68,2 +79,8 @@
68 </property> 79 </property>
80 <property>
81 <name>layoutMargin</name>
82 </property>
83 <property>
84 <name>layoutSpacing</name>
85 </property>
69 <grid> 86 <grid>
@@ -71,3 +88,3 @@
71 <name>margin</name> 88 <name>margin</name>
72 <number>11</number> 89 <number>4</number>
73 </property> 90 </property>
@@ -75,3 +92,3 @@
75 <name>spacing</name> 92 <name>spacing</name>
76 <number>6</number> 93 <number>2</number>
77 </property> 94 </property>
@@ -114,2 +131,8 @@
114 </property> 131 </property>
132 <property>
133 <name>layoutMargin</name>
134 </property>
135 <property>
136 <name>layoutSpacing</name>
137 </property>
115 <grid> 138 <grid>
@@ -117,3 +140,3 @@
117 <name>margin</name> 140 <name>margin</name>
118 <number>11</number> 141 <number>4</number>
119 </property> 142 </property>
@@ -121,3 +144,3 @@
121 <name>spacing</name> 144 <name>spacing</name>
122 <number>6</number> 145 <number>2</number>
123 </property> 146 </property>
@@ -195,2 +218,8 @@
195 </property> 218 </property>
219 <property>
220 <name>layoutMargin</name>
221 </property>
222 <property>
223 <name>layoutSpacing</name>
224 </property>
196 <grid> 225 <grid>
@@ -198,3 +227,3 @@
198 <name>margin</name> 227 <name>margin</name>
199 <number>11</number> 228 <number>4</number>
200 </property> 229 </property>
@@ -202,3 +231,3 @@
202 <name>spacing</name> 231 <name>spacing</name>
203 <number>6</number> 232 <number>4</number>
204 </property> 233 </property>
@@ -227,2 +256,8 @@
227 </property> 256 </property>
257 <property>
258 <name>layoutMargin</name>
259 </property>
260 <property>
261 <name>layoutSpacing</name>
262 </property>
228 <vbox> 263 <vbox>
@@ -230,3 +265,3 @@
230 <name>margin</name> 265 <name>margin</name>
231 <number>11</number> 266 <number>4</number>
232 </property> 267 </property>
@@ -234,3 +269,3 @@
234 <name>spacing</name> 269 <name>spacing</name>
235 <number>6</number> 270 <number>2</number>
236 </property> 271 </property>
@@ -285,2 +320,8 @@
285 </connection> 320 </connection>
321 <connection>
322 <sender>PushButton2</sender>
323 <signal>clicked()</signal>
324 <receiver>converter_base</receiver>
325 <slot>start_upgrade()</slot>
326 </connection>
286 <slot access="public">selectedDatabase(int)</slot> 327 <slot access="public">selectedDatabase(int)</slot>
@@ -289,2 +330,3 @@
289 <slot access="public">start_conversion()</slot> 330 <slot access="public">start_conversion()</slot>
331 <slot access="public">start_upgrade()</slot>
290</connections> 332</connections>