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
00175 KexiProjectData *data() const;
00176
00180 KexiDialogBase* openObject(KexiMainWindow *wnd, KexiPart::Item& item,
00181 int viewMode = Kexi::DataViewMode, QMap<QString,QString>* staticObjectArgs = 0);
00182
00184 KexiDialogBase* openObject(KexiMainWindow *wnd, const QCString &mimeType,
00185 const QString& name, int viewMode = Kexi::DataViewMode);
00186
00189 bool removeObject(KexiMainWindow *wnd, KexiPart::Item& item);
00190
00193 bool renameObject(KexiMainWindow *wnd, KexiPart::Item& item, const QString& newName);
00194
00209 KexiPart::Item* createPartItem(KexiPart::Info *info,
00210 const QString& suggestedCaption = QString::null );
00211
00213 KexiPart::Item* createPartItem(KexiPart::Part *part,
00214 const QString& suggestedCaption = QString::null);
00215
00220 void addStoredItem(KexiPart::Info *info, KexiPart::Item *item);
00221
00225 void deleteUnstoredItem(KexiPart::Item *item);
00226
00227 #if 0 //remove?
00228
00235 bool createObject(KexiDialogBase *dlg);
00236 #endif
00237
00238 KexiDB::Parser* sqlParser();
00239
00241 bool final() const;
00242
00243 void setFinal(bool set);
00244
00251 static KexiProject* createBlankProject(bool &cancelled, KexiProjectData* data,
00252 KexiDB::MessageHandler* handler = 0);
00253
00256 static tristate dropProject(KexiProjectData* data,
00257 KexiDB::MessageHandler* handler, bool dontAsk = false);
00258
00260
00261
00262
00263
00264
00265
00266 protected:
00269 bool createConnection();
00270
00271 void closeConnection();
00272
00273 bool initProject();
00274
00276 tristate openInternal(bool *incompatibleWithKexi);
00277
00297 bool createInternalStructures(bool insideTransaction);
00298
00300 KexiPart::Part *findPartFor(KexiPart::Item& item);
00301
00302 signals:
00304 void error(const QString &title, KexiDB::Object *obj);
00305
00307 void error(const QString &msg, const QString &desc);
00308
00310 void newItemStored(KexiPart::Item& item);
00311
00313 void itemRemoved(const KexiPart::Item &item);
00314
00316 void itemRenamed(const KexiPart::Item &item, const QCString& oldName);
00317
00318
00319
00320
00321
00322
00323 protected:
00326 bool checkWritable();
00327
00328 class Private;
00329 Private *d;
00330
00331 friend class KexiMainWindowImpl;
00332 };
00333
00334
00335 #endif
|