Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/scripting/kexidb/kexidbmodule.h
Show All 18 Lines | |||||
19 | 19 | | |||
20 | #ifndef SCRIPTING_KEXIDBMODULE_H | 20 | #ifndef SCRIPTING_KEXIDBMODULE_H | ||
21 | #define SCRIPTING_KEXIDBMODULE_H | 21 | #define SCRIPTING_KEXIDBMODULE_H | ||
22 | 22 | | |||
23 | #include <QString> | 23 | #include <QString> | ||
24 | #include <QObject> | 24 | #include <QObject> | ||
25 | 25 | | |||
26 | #include <KDbDriverManager> | 26 | #include <KDbDriverManager> | ||
27 | #include <KDbConnection> | ||||
27 | 28 | | |||
28 | namespace Scripting | 29 | namespace Scripting | ||
29 | { | 30 | { | ||
30 | 31 | | |||
31 | // Forward declarations. | 32 | // Forward declarations. | ||
32 | class KexiDBDriver; | 33 | class KexiDBDriver; | ||
33 | class KexiDBConnectionData; | 34 | class KexiDBConnectionData; | ||
34 | class KexiDBField; | 35 | class KexiDBField; | ||
35 | class KexiDBTableSchema; | 36 | class KexiDBTableSchema; | ||
36 | class KexiDBQuerySchema; | 37 | class KexiDBQuerySchema; | ||
37 | 38 | | |||
38 | /** | 39 | /** | ||
39 | * The KexiDBModule class provides the main entry point to deal with | 40 | * The KexiDBModule class provides the main entry point to deal with | ||
40 | * the KDb functionality. | 41 | * the KDb functionality. | ||
41 | */ | 42 | */ | ||
42 | class KexiDBModule : public QObject | 43 | class KexiDBModule : public QObject | ||
43 | { | 44 | { | ||
44 | Q_OBJECT | 45 | Q_OBJECT | ||
45 | public: | 46 | public: | ||
46 | explicit KexiDBModule(QObject* parent = 0); | 47 | Q_INVOKABLE explicit KexiDBModule(QObject* parent = 0); | ||
47 | virtual ~KexiDBModule(); | 48 | virtual ~KexiDBModule(); | ||
48 | 49 | | |||
49 | public Q_SLOTS: | | |||
50 | | ||||
51 | /** Returns the version number the KexiDB module defines. */ | 50 | /** Returns the version number the KexiDB module defines. */ | ||
52 | int version(); | 51 | Q_INVOKABLE int version(); | ||
53 | 52 | | |||
54 | /** Returns a list with available drivernames. */ | 53 | /** Returns a list with available drivernames. */ | ||
55 | const QStringList driverNames(); | 54 | Q_INVOKABLE QStringList driverNames(); | ||
56 | 55 | | |||
57 | /** Return the to the defined \p drivername matching \a KexiDBDriver object. */ | 56 | /** Return the to the defined \p drivername matching \a KexiDBDriver object. */ | ||
58 | QObject* driver(const QString& drivername); | 57 | Q_INVOKABLE QObject* driver(const QString& drivername); | ||
59 | 58 | | |||
60 | /** Return the to the defined mimetype-string matching drivername. */ | 59 | /** Return the to the defined mimetype-string matching drivername. */ | ||
61 | const QString lookupByMime(const QString& mimetype); | 60 | Q_INVOKABLE QString lookupByMime(const QString& mimetype); | ||
62 | 61 | | |||
63 | /** Return the matching mimetype for the defined file. */ | 62 | /** Return the matching mimetype for the defined file. */ | ||
64 | const QString mimeForFile(const QString& filename); | 63 | Q_INVOKABLE QString mimeForFile(const QString& filename); | ||
65 | 64 | | |||
66 | /** Return a new \a KexiDBConnectionData object. */ | 65 | /** Return a new \a KexiDBConnectionData object. */ | ||
67 | QObject* createConnectionData(); | 66 | Q_INVOKABLE QObject* createConnectionData(); | ||
68 | 67 | | |||
69 | /** Create and return a \a KexiDBConnectionData object. Fill the content of the | 68 | /** Create and return a \a KexiDBConnectionData object. Fill the content of the | ||
70 | KexiDBConnectionData object with the defined file as. The file could be e.g. | 69 | KexiDBConnectionData object with the defined file as. The file could be e.g. | ||
71 | a *.kexi file or a *.kexis file. */ | 70 | a *.kexi file or a *.kexis file. */ | ||
72 | QObject* createConnectionDataByFile(const QString& filename); | 71 | Q_INVOKABLE QObject* createConnectionDataByFile(const QString& filename); | ||
73 | 72 | | |||
74 | /** Return a new \a KexiDBField object. */ | 73 | /** Return a new \a KexiDBField object. */ | ||
75 | QObject* field(); | 74 | Q_INVOKABLE QObject* field(); | ||
76 | 75 | | |||
77 | /** Return a new \a KexiDBTableSchema object. */ | 76 | /** Return a new \a KexiDBTableSchema object. */ | ||
78 | QObject* tableSchema(const QString& tablename); | 77 | Q_INVOKABLE QObject* tableSchema(const QString& tablename); | ||
79 | 78 | | |||
80 | /** Return a new \a KexiDBQuerySchema object. */ | 79 | /** Return a new \a KexiDBQuerySchema object. */ | ||
81 | QObject* querySchema(); | 80 | Q_INVOKABLE QObject* querySchema(); | ||
82 | 81 | | |||
83 | private Q_SLOTS: | 82 | private Q_SLOTS: | ||
84 | //! Wraps a KDbConnection into a KexiDBConnection | 83 | //! Wraps a KDbConnection into a KexiDBConnection | ||
85 | QObject* connectionWrapper(QObject* connection); | 84 | QObject* connectionWrapper(KDbConnection* connection); | ||
86 | 85 | | |||
87 | private: | 86 | private: | ||
88 | KDbDriverManager m_drivermanager; | 87 | KDbDriverManager m_drivermanager; | ||
88 | | ||||
89 | }; | 89 | }; | ||
90 | 90 | | |||
91 | } | 91 | } | ||
92 | 92 | | |||
93 | #endif | 93 | #endif | ||
94 | 94 | |