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