kexi
kexiproject.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KEXIPROJECT_H
00022 #define KEXIPROJECT_H
00023
00024 #include <qobject.h>
00025 #include <qintdict.h>
00026 #include <qptrdict.h>
00027 #include <qguardedptr.h>
00028
00029 #include <kexiutils/tristate.h>
00030 #include <kexidb/object.h>
00031 #include "kexiprojectdata.h"
00032 #include "kexipartitem.h"
00033 #include "kexi.h"
00034
00042 #define KEXIPROJECT_VERSION_MAJOR 1
00043 #define KEXIPROJECT_VERSION_MINOR 0
00044
00045 namespace KexiDB
00046 {
00047 class DriverManager;
00048 class Driver;
00049 class Connection;
00050 class Parser;
00051 }
00052
00053 namespace KexiPart
00054 {
00055 class Part;
00056 class Info;
00057 }
00058
00059 class KexiMainWindow;
00060 class KexiDialogBase;
00061
00067 class KEXICORE_EXPORT KexiProject : public QObject, public KexiDB::Object
00068 {
00069 Q_OBJECT
00070
00071 public:
00076 KexiProject(KexiProjectData* pdata, KexiDB::MessageHandler* handler = 0);
00077
00082 KexiProject(KexiProjectData *pdata, KexiDB::MessageHandler* handler,
00083 KexiDB::Connection* conn);
00084
00085
00086
00087 ~KexiProject();
00088
00091 int versionMajor() const;
00092
00095 int versionMinor() const;
00096
00099 tristate open();
00100
00111 tristate open(bool &incompatibleWithKexi);
00112
00122 tristate create(bool forceOverwrite = false);
00123
00125 bool error() const { return KexiDB::Object::error(); }
00126
00130 bool isConnected();
00131
00135 KexiPart::ItemDict* items(KexiPart::Info *i);
00136
00141 KexiPart::ItemDict* itemsForMimeType(const QCString &mimeType);
00142
00147 void getSortedItems(KexiPart::ItemList& list, KexiPart::Info *i);
00148
00153 void getSortedItemsForMimeType(KexiPart::ItemList& list, const QCString &mimeType);
00154
00158 KexiPart::Item* itemForMimeType(const QCString &mimeType, const QString &name);
00159
00163 KexiPart::Item* item(KexiPart::Info *i, const QString &name);
00164
00168 KexiPart::Item* item(int identifier);
00169
00173 KexiDB::Connection *dbConnection() const;
00174
00178 KexiProjectData *data() const;
00179
00183 KexiDialogBase* openObject(KexiMainWindow *wnd, KexiPart::Item& item,
00184 int viewMode = Kexi::DataViewMode, QMap<QString,QString>* staticObjectArgs = 0);
00185
00187 KexiDialogBase* openObject(KexiMainWindow *wnd, const QCString &mimeType,
00188 const QString& name, int viewMode = Kexi::DataViewMode);
00189
00192 bool removeObject(KexiMainWindow *wnd, KexiPart::Item& item);
00193
00196 bool renameObject(KexiMainWindow *wnd, KexiPart::Item& item, const QString& newName);
00197
00212 KexiPart::Item* createPartItem(KexiPart::Info *info,
00213 const QString& suggestedCaption = QString::null );
00214
00216 KexiPart::Item* createPartItem(KexiPart::Part *part,
00217 const QString& suggestedCaption = QString::null);
00218
00223 void addStoredItem(KexiPart::Info *info, KexiPart::Item *item);
00224
00228 void deleteUnstoredItem(KexiPart::Item *item);
00229
00230 #if 0 //remove?
00231
00238 bool createObject(KexiDialogBase *dlg);
00239 #endif
00240
00241 KexiDB::Parser* sqlParser();
00242
00249 static KexiProject* createBlankProject(bool &cancelled, KexiProjectData* data,
00250 KexiDB::MessageHandler* handler = 0);
00251
00254 static tristate dropProject(KexiProjectData* data,
00255 KexiDB::MessageHandler* handler, bool dontAsk = false);
00256
00258
00259
00260
00261
00262
00263
00264 protected:
00268 bool createConnection();
00269
00270 bool closeConnection();
00271
00272 bool initProject();
00273
00275 tristate openInternal(bool *incompatibleWithKexi);
00276
00296 bool createInternalStructures(bool insideTransaction);
00297
00299 KexiPart::Part *findPartFor(KexiPart::Item& item);
00300
00301 signals:
00303 void error(const QString &title, KexiDB::Object *obj);
00304
00306 void error(const QString &msg, const QString &desc);
00307
00309 void newItemStored(KexiPart::Item& item);
00310
00312 void itemRemoved(const KexiPart::Item &item);
00313
00315 void itemRenamed(const KexiPart::Item &item, const QCString& oldName);
00316
00317
00318
00319
00320
00321
00322 protected:
00325 bool checkWritable();
00326
00327 class Private;
00328 Private *d;
00329
00330 friend class KexiMainWindowImpl;
00331 };
00332
00333
00334 #endif
|