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
00244 bool final() const;
00245
00246 void setFinal(bool set);
00247
00254 static KexiProject* createBlankProject(bool &cancelled, KexiProjectData* data,
00255 KexiDB::MessageHandler* handler = 0);
00256
00259 static tristate dropProject(KexiProjectData* data,
00260 KexiDB::MessageHandler* handler, bool dontAsk = false);
00261
00263
00264
00265
00266
00267
00268
00269 protected:
00273 bool createConnection();
00274
00275 bool closeConnection();
00276
00277 bool initProject();
00278
00280 tristate openInternal(bool *incompatibleWithKexi);
00281
00301 bool createInternalStructures(bool insideTransaction);
00302
00304 KexiPart::Part *findPartFor(KexiPart::Item& item);
00305
00306 signals:
00308 void error(const QString &title, KexiDB::Object *obj);
00309
00311 void error(const QString &msg, const QString &desc);
00312
00314 void newItemStored(KexiPart::Item& item);
00315
00317 void itemRemoved(const KexiPart::Item &item);
00318
00320 void itemRenamed(const KexiPart::Item &item, const QCString& oldName);
00321
00322
00323
00324
00325
00326
00327 protected:
00330 bool checkWritable();
00331
00332 class Private;
00333 Private *d;
00334
00335 friend class KexiMainWindowImpl;
00336 };
00337
00338
00339 #endif
|