1
/* This file is part of the KDE project
2
Copyright (C) 2003 Daniel Molkentin <molkentin@kde.org>
3
Copyright (C) 2003 Joseph Wenninger <jowenn@kde.org>
4
Copyright (C) 2003-2006 Jarosław Staniek <staniek@kde.org>
6
This program is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Library General Public
8
License as published by the Free Software Foundation; either
9
version 2 of the License, or (at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Library General Public License for more details.
16
You should have received a copy of the GNU Library General Public License
17
along with this program; see the file COPYING. If not, write to
18
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
* Boston, MA 02110-1301, USA.
22
#ifndef KEXIDB_DRIVER_MNGR_H
23
#define KEXIDB_DRIVER_MNGR_H
25
#include <klibloader.h>
33
class DriverManagerInternal;
36
//! Database driver management, e.g. finding and loading drivers.
37
class KEXI_DB_EXPORT DriverManager : public QObject, public KexiDB::Object
40
typedef QHash<QString, KService::Ptr> ServicesHash;
43
virtual ~DriverManager();
45
/*! Tries to load db driver with named name \a name.
46
The name is case insensitive.
47
\return db driver, or 0 if error (then error message is also set) */
48
Driver* driver(const QString& name);
50
/*! returns list of available drivers names.
51
That drivers can be loaded by first use of driver() method. */
52
const QStringList driverNames();
54
/*! returns information list of available drivers.
55
That drivers can be loaded by first use of driver() method. */
56
const KexiDB::Driver::InfoHash driversInfo();
58
/*! \return information about driver's named with \a name.
59
The name is case insensitive.
60
You can check if driver information is not found calling
61
Info::name.isEmpty() (then error message is also set). */
62
KexiDB::Driver::Info driverInfo(const QString &name);
64
/*! \return service information about driver's named with \a name.
65
The name is case insensitive.
66
In most cases you can use driverInfo() instead. */
67
KService::Ptr serviceInfo(const QString &name);
69
/*! \return a hash structure of the services. Not necessary for everyday use. */
70
const ServicesHash& services();
72
/*! Looks up a drivers list by MIME type of database file.
73
Only file-based database drivers are checked.
74
The lookup is case insensitive.
75
\return driver name or null string if no driver found.
77
QString lookupByMime(const QString &mimeType);
79
//! server error is set if there is error at KService level (useful for debugging)
80
virtual QString serverErrorMsg();
81
virtual int serverResult();
82
virtual QString serverResultName();
84
/*! HTML information about possible problems encountered.
85
It's displayed in 'details' section, if an error encountered.
86
Currently it contains a list of incompatible db drivers.
87
Used in KexiStartupHandler::detectDriverForFile(). */
88
QString possibleProblemsInfoMsg() const;
91
virtual void drv_clearServerResult();
94
DriverManagerInternal *d_int;