summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiedb/osqlmanager.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiedb/osqlmanager.cpp b/libopie2/opiedb/osqlmanager.cpp
index c472f6b..276b800 100644
--- a/libopie2/opiedb/osqlmanager.cpp
+++ b/libopie2/opiedb/osqlmanager.cpp
@@ -1,85 +1,85 @@
1#include "osqlmanager.h" 1#include "osqlmanager.h"
2#include "osqlbackendmanager.h" 2#include "osqlbackendmanager.h"
3#include "osqlitedriver.h" 3#include "osqlitedriver.h"
4 4
5 5#include <stdlib.h>
6 6
7namespace Opie { 7namespace Opie {
8namespace DB { 8namespace DB {
9 9
10OSQLManager::OSQLManager() { 10OSQLManager::OSQLManager() {
11} 11}
12OSQLBackEnd::ValueList OSQLManager::queryBackEnd() { 12OSQLBackEnd::ValueList OSQLManager::queryBackEnd() {
13 m_list.clear(); 13 m_list.clear();
14 QString opie = QString::fromLatin1( getenv("OPIEDIR") ); 14 QString opie = QString::fromLatin1( getenv("OPIEDIR") );
15 15
16 if ( !m_path.contains(opie) && !opie.isEmpty() ) 16 if ( !m_path.contains(opie) && !opie.isEmpty() )
17 m_path << opie; 17 m_path << opie;
18 18
19 19
20 OSQLBackEndManager mng( m_path ); 20 OSQLBackEndManager mng( m_path );
21 m_list = mng.scan(); 21 m_list = mng.scan();
22 m_list += builtIn(); 22 m_list += builtIn();
23 23
24 return m_list; 24 return m_list;
25} 25}
26/* 26/*
27 * loading dso's is currently not enabled due problems with QLibrary 27 * loading dso's is currently not enabled due problems with QLibrary
28 * beeing in libqpe and not libqte 28 * beeing in libqpe and not libqte
29 */ 29 */
30OSQLDriver* OSQLManager::load( const QString& name ) { 30OSQLDriver* OSQLManager::load( const QString& name ) {
31 OSQLDriver* driver = 0l; 31 OSQLDriver* driver = 0l;
32 32
33 if ( name == "SQLite" ) { 33 if ( name == "SQLite" ) {
34 driver = new Opie::DB::Internal::OSQLiteDriver; 34 driver = new Opie::DB::Internal::OSQLiteDriver;
35 } 35 }
36 return driver; 36 return driver;
37} 37}
38/* 38/*
39 * same as above 39 * same as above
40 */ 40 */
41OSQLDriver* OSQLManager::load( const OSQLBackEnd& end) { 41OSQLDriver* OSQLManager::load( const OSQLBackEnd& end) {
42 OSQLDriver *driver = 0l; 42 OSQLDriver *driver = 0l;
43 if ( end.library() == "builtin" && 43 if ( end.library() == "builtin" &&
44 end.name() == "SQLite" ) 44 end.name() == "SQLite" )
45 driver = new Opie::DB::Internal::OSQLiteDriver; 45 driver = new Opie::DB::Internal::OSQLiteDriver;
46 46
47 return driver; 47 return driver;
48} 48}
49/* 49/*
50 * let's find the a default with the highes preference 50 * let's find the a default with the highes preference
51 */ 51 */
52OSQLDriver* OSQLManager::standard() { 52OSQLDriver* OSQLManager::standard() {
53 OSQLDriver* driver =0l; 53 OSQLDriver* driver =0l;
54 if ( m_list.isEmpty() ) queryBackEnd(); 54 if ( m_list.isEmpty() ) queryBackEnd();
55 OSQLBackEnd::ValueList::Iterator it; 55 OSQLBackEnd::ValueList::Iterator it;
56 OSQLBackEnd back; 56 OSQLBackEnd back;
57 for ( it = m_list.begin(); it != m_list.end(); ++it ) { 57 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
58 if ( (*it).isDefault() && 58 if ( (*it).isDefault() &&
59 back.preference() < (*it).preference() ) { 59 back.preference() < (*it).preference() ) {
60 back = (*it); 60 back = (*it);
61 } 61 }
62 } 62 }
63 driver = load( back ); 63 driver = load( back );
64 return driver; 64 return driver;
65} 65}
66void OSQLManager::registerPath( const QString& path ) { 66void OSQLManager::registerPath( const QString& path ) {
67 m_path << path; 67 m_path << path;
68} 68}
69bool OSQLManager::unregisterPath( const QString& path ) { 69bool OSQLManager::unregisterPath( const QString& path ) {
70 m_path.remove( path ); 70 m_path.remove( path );
71 return true; 71 return true;
72} 72}
73OSQLBackEnd::ValueList OSQLManager::builtIn()const { 73OSQLBackEnd::ValueList OSQLManager::builtIn()const {
74 OSQLBackEnd::ValueList list; 74 OSQLBackEnd::ValueList list;
75 // create the OSQLiteBackend 75 // create the OSQLiteBackend
76 OSQLBackEnd back("SQLite","Opie e.V.","GPL", "builtin" ); 76 OSQLBackEnd back("SQLite","Opie e.V.","GPL", "builtin" );
77 back.setDefault( true ); 77 back.setDefault( true );
78 back.setPreference( 50 ); 78 back.setPreference( 50 );
79 list.append( back ); 79 list.append( back );
80 return list; 80 return list;
81} 81}
82 82
83 83
84} 84}
85} 85}