KexiProject Class Reference
#include <kexiproject.h>
Inheritance diagram for KexiProject:

Detailed Description
A project's main controller.It also contains connection data, current file state, etc.
Definition at line 67 of file kexiproject.h.
Signals | |
| void | error (const QString &title, KexiDB::Object *obj) |
| signal emitted on error | |
| void | error (const QString &msg, const QString &desc) |
| signal emitted on error (not KexiDB-related) | |
| void | newItemStored (KexiPart::Item &item) |
| New item has been stored. | |
| void | itemRemoved (const KexiPart::Item &item) |
| instance pointed by item is removed | |
| void | itemRenamed (const KexiPart::Item &item, const QCString &oldName) |
| instance pointed by item is renamed | |
Public Member Functions | |
| KexiProject (KexiProjectData *pdata, KexiDB::MessageHandler *handler=0) | |
| KexiProject (KexiProjectData *pdata, KexiDB::MessageHandler *handler, KexiDB::Connection *conn) | |
| ~KexiProject () | |
| int | versionMajor () const |
| int | versionMinor () const |
| tristate | open () |
| tristate | open (bool &incompatibleWithKexi) |
| tristate | create (bool forceOverwrite=false) |
| bool | error () const |
| bool | isConnected () |
| KexiPart::ItemDict * | items (KexiPart::Info *i) |
| KexiPart::ItemDict * | itemsForMimeType (const QCString &mimeType) |
| void | getSortedItems (KexiPart::ItemList &list, KexiPart::Info *i) |
| Puts a list of items of a type i in this project into list. | |
| void | getSortedItemsForMimeType (KexiPart::ItemList &list, const QCString &mimeType) |
| Puts a sorted list of items of a type mimeType in this project into list. | |
| KexiPart::Item * | itemForMimeType (const QCString &mimeType, const QString &name) |
| KexiPart::Item * | item (KexiPart::Info *i, const QString &name) |
| KexiPart::Item * | item (int identifier) |
| KexiDB::Connection * | dbConnection () const |
| KexiProjectData * | data () const |
| KexiDialogBase * | openObject (KexiMainWindow *wnd, KexiPart::Item &item, int viewMode=Kexi::DataViewMode, QMap< QString, QString > *staticObjectArgs=0) |
| KexiDialogBase * | openObject (KexiMainWindow *wnd, const QCString &mimeType, const QString &name, int viewMode=Kexi::DataViewMode) |
| For convenience. | |
| bool | removeObject (KexiMainWindow *wnd, KexiPart::Item &item) |
| bool | renameObject (KexiMainWindow *wnd, KexiPart::Item &item, const QString &newName) |
| KexiPart::Item * | createPartItem (KexiPart::Info *info, const QString &suggestedCaption=QString::null) |
| KexiPart::Item * | createPartItem (KexiPart::Part *part, const QString &suggestedCaption=QString::null) |
| Added for convenience. | |
| void | addStoredItem (KexiPart::Info *info, KexiPart::Item *item) |
| void | deleteUnstoredItem (KexiPart::Item *item) |
| KexiDB::Parser * | sqlParser () |
| bool | final () const |
| void | setFinal (bool set) |
Static Public Member Functions | |
| static KexiProject * | createBlankProject (bool &cancelled, KexiProjectData *data, KexiDB::MessageHandler *handler=0) |
| static tristate | dropProject (KexiProjectData *data, KexiDB::MessageHandler *handler, bool dontAsk=false) |
Protected Member Functions | |
| bool | createConnection () |
| used to emit objectCreated() signal | |
| bool | closeConnection () |
| bool | initProject () |
| tristate | openInternal (bool *incompatibleWithKexi) |
| Used in open() and open(bool&). | |
| bool | createInternalStructures (bool insideTransaction) |
| KexiPart::Part * | findPartFor (KexiPart::Item &item) |
| bool | checkWritable () |
| New object of mimetype mime and name has been created. | |
Protected Attributes | |
| Private * | d |
| for future extensions | |
Friends | |
| class | KexiMainWindowImpl |
Constructor & Destructor Documentation
|
||||||||||||
|
Constructor 1. Creates a new object using pdata. pdata which will be then owned by KexiProject object. handler can be provided to receive error messages during entire KexiProject object's lifetime. Definition at line 115 of file kexiproject.cpp. References d, and Kexi::partManager(). Referenced by createBlankProject(). |
|
||||||||||||||||
|
Constructor 2. Like above but sets predefined connections conn. The connection should be created using the same connection data as pdata->connectionData(). The connection will become owned by created KexiProject object, so do not destroy it. Definition at line 124 of file kexiproject.cpp. References d, KexiDB::Connection::data(), and Kexi::partManager(). |
|
|
Definition at line 140 of file kexiproject.cpp. References closeConnection(), and d. |
Member Function Documentation
|
||||||||||||
|
Adds item item after it is succesfully stored as an instance of part pointed by info. Also clears 'neverSaved' flag if item. Used by KexiDialogBase::storeNewData(). Definition at line 634 of file kexiproject.cpp. References d, items(), newItemStored(), and KexiPart::Item::setNeverSaved(). Referenced by KexiCSVImportDialog::accept(). |
|
|
New object of mimetype mime and name has been created. Checks whether the project's connection is read-only. If so, error message is set and false is returned. Definition at line 766 of file kexiproject.cpp. References d, and KexiDB::Object::setError(). Referenced by create(), removeObject(), and renameObject(). |
|
|
Definition at line 508 of file kexiproject.cpp. References d, and KexiDB::Object::setError(). Referenced by KexiMainWindowImpl::closeProject(), create(), createConnection(), openInternal(), and ~KexiProject(). |
|
|
Creates new, empty project using project data. If forceOverwrite is true, existing database project is silently overwritten. Connection is created (accessible then with KexiProject::dbConnection()). Since KexiProject inherits KexiDB::Object, it is possible to get error message and other information on error.
Definition at line 237 of file kexiproject.cpp. References KexiDB::Transaction::active(), cancelled, checkWritable(), closeConnection(), createConnection(), createInternalStructures(), d, initProject(), KexiDB::Transaction::isNull(), KexiDB::DatabaseProperties::setCaption(), KexiDB::Object::setError(), and KexiDB::DatabaseProperties::setValue(). Referenced by createBlankProject(), KexiMainWindowImpl::createBlankProject(), and KexiMigration::KexiMigrate::performImport(). |
|
||||||||||||||||
|
Shows dialog for creating new blank project, ans creates one. Dialog is not shown if option for automatic creation is checked or Kexi::startupHandler().projectData() was provided from command line. cancelled is set to true if creation has been cancelled (e.g. user answered no when asked for database overwriting, etc.
Definition at line 963 of file kexiproject.cpp. References create(), data(), and KexiProject(). Referenced by KexiStartupHandler::init(). |
|
|
used to emit objectCreated() signal Creates connection using project data. The connection will be readonly if data()->isReadOnly().
Definition at line 466 of file kexiproject.cpp. References KexiDB::Object::clearError(), closeConnection(), KexiDB::Driver::createConnection(), d, Kexi::driverManager(), KexiDB::Object::errorMsg(), KexiDB::Driver::ReadOnlyConnection, KexiBLOBBuffer::setConnection(), and KexiDB::Object::setError(). Referenced by create(), and openInternal(). |
|
|
Kexi itself can define a number of internal database objects (mostly data structures), usually tables for it's own purposes. Even while at KexiDB library level, such "system" tables, like "kexi__objects", "kexi__objectdata" are created automatically on database project creation, this is not enough: there are objects needed specifically for Kexi but not for other applications utilizing KexiDB library. Example table created here for now is "kexi__blobs". This method is called on create() and open(): creates necessary objects if they are not yet existing. This especially allows to create to create these objects (on open) within a project made with previous Kexi version not supporting all currently defined structurtes. We're trying to be here as much backward compatible as possible. For this purpose, here's the complete list of currently created objects:
Definition at line 311 of file kexiproject.cpp. References KexiDB::FieldList::addField(), KexiDB::Field::AutoInc, KexiDB::Field::BLOB, KexiDB::TransactionGuard::commit(), d, KexiDB::Field::Integer, KEXIPROJECT_VERSION_MAJOR, KEXIPROJECT_VERSION_MINOR, KexiDB::Field::NotNull, KexiDB::Field::PrimaryKey, KexiDB::DatabaseProperties::setCaption(), KexiDB::SchemaData::setName(), KexiDB::TransactionGuard::setTransaction(), KexiDB::DatabaseProperties::setValue(), KexiDB::FieldList::subList(), KexiDB::Field::Text, KexiDB::TransactionGuard::transaction(), KexiDB::Field::Unsigned, and KexiDB::DatabaseProperties::value(). Referenced by create(), and openInternal(). |
|
||||||||||||
|
Added for convenience.
Definition at line 937 of file kexiproject.cpp. References createPartItem(). |
|
||||||||||||
|
Creates part item for given part info. Newly item will not be saved to the backend but stored in memory only (owned by project), and marked as "neverSaved" (see KexiPart::Item::neverSaved()). The item will have assigned a new unique caption like e.g. "Table15", and unique name like "table15", but no specific identifier (because id will be assigned on creation at the backend side). If suggestedCaption is not empty, it will be set as a caption (with number suffix, to avoid duplicated, e.g. "employees7" for "employees" sugested name). Name will be then built based on this caption using KexiUtils::string2Identifier(). This method is used before creating new object.
Definition at line 869 of file kexiproject.cpp. References KexiDB::Object::clearError(), d, data(), KexiPart::Part::instanceCaption(), KexiPart::Part::instanceName(), item(), items(), KexiPart::Info::mimeType(), Kexi::partManager(), KexiPart::Item::setCaption(), KexiDB::Object::setError(), KexiPart::Item::setIdentifier(), KexiPart::Item::setMimeType(), KexiPart::Item::setName(), KexiPart::Item::setNeverSaved(), and KexiUtils::string2Identifier(). Referenced by KexiCSVImportDialog::accept(), createPartItem(), KexiMainWindowImpl::newObject(), and KexiMainWindowImpl::printActionForItem(). |
|
|
Definition at line 151 of file kexiproject.cpp. References d. Referenced by createBlankProject(), createPartItem(), openObject(), removeObject(), renameObject(), KexiMainWindowImpl::slotAutoOpenObjectsLater(), KexiMainWindowImpl::slotToolsCompactDatabase(), and KexiMainWindowImpl::updateAppCaption(). |
|
|
Definition at line 146 of file kexiproject.cpp. References d. Referenced by KexiCSVImportDialog::accept(), dropProject(), KexiMainWindowImpl::initUserActions(), KexiMainWindowImpl::initUserMode(), KexiMainWindowImpl::invalidateProjectWideActions(), KexiMigration::KexiMigrate::performImport(), KexiMainWindowImpl::slotToolsCompactDatabase(), and KexiMainWindowImpl::updateReadOnlyState(). |
|
|
removes item from internal dictionaries. The item is destroyed after successful removal. Used to delete an unstored part item previusly created with createPartItem(). Definition at line 942 of file kexiproject.cpp. References d. |
|
||||||||||||||||
|
Drops project described by data.
Definition at line 996 of file kexiproject.cpp. References cancelled, dbConnection(), KexiDB::SchemaData::objectName(), open(), and KexiDB::MessageHandler::showErrorMessage(). Referenced by KexiStartupHandler::init(). |
|
||||||||||||
|
signal emitted on error (not KexiDB-related)
|
|
||||||||||||
|
signal emitted on error
|
|
|
Reimplemented from KexiDB::Object. Definition at line 125 of file kexiproject.h. References KexiDB::Object::error(). Referenced by initProject(), and KexiMigration::KexiMigrate::performImport(). |
|
|
Definition at line 156 of file kexiproject.cpp. References d. |
|
|
Definition at line 727 of file kexiproject.cpp. References KexiDB::Object::clearError(), Kexi::partManager(), and KexiDB::Object::setError(). Referenced by openObject(), removeObject(), and renameObject(). |
|
||||||||||||
|
Puts a list of items of a type i in this project into list. You can then sort this list using ItemList::sort(). Definition at line 616 of file kexiproject.cpp. References items(). Referenced by getSortedItemsForMimeType(), and KexiDataSourceComboBox::setProject(). |
|
||||||||||||
|
Puts a sorted list of items of a type mimeType in this project into list. You can then sort this list using ItemList::sort(). Definition at line 627 of file kexiproject.cpp. References getSortedItems(), and Kexi::partManager(). |
|
|
Definition at line 524 of file kexiproject.cpp. References d, error(), Kexi::partManager(), KexiDB::Object::setError(), and KexiDB::DatabaseProperties::value(). Referenced by create(), and openInternal(). |
|
|
Definition at line 553 of file kexiproject.cpp. References d. Referenced by KexiMainWindowImpl::initNavigator(), and items(). |
|
|
Definition at line 675 of file kexiproject.cpp. |
|
||||||||||||
|
Definition at line 661 of file kexiproject.cpp. References items(). Referenced by KexiFormEventAction::activate(), createPartItem(), KexiMainWindowImpl::initUserMode(), item(), and KexiMainWindowImpl::slotAutoOpenObjectsLater(). |
|
||||||||||||
|
Definition at line 647 of file kexiproject.cpp. References itemsForMimeType(). Referenced by KexiMainWindowImpl::highlightObject(), openObject(), and KexiMainWindowImpl::openObject(). |
|
|
instance pointed by item is removed
Referenced by removeObject(). |
|
||||||||||||
|
instance pointed by item is renamed
Referenced by renameObject(). |
|
|
Definition at line 562 of file kexiproject.cpp. References d, KexiDB::Cursor::eof(), KexiPart::Item::identifier(), isConnected(), KexiUtils::isIdentifier(), KexiPart::Info::mimeType(), KexiDB::Cursor::moveFirst(), KexiDB::Cursor::moveNext(), KexiPart::Info::projectPartID(), KexiPart::Item::setCaption(), KexiPart::Item::setIdentifier(), KexiPart::Item::setMimeType(), KexiPart::Item::setName(), and KexiDB::Cursor::value(). Referenced by addStoredItem(), createPartItem(), getSortedItems(), item(), itemsForMimeType(), and KexiBrowser::setProject(). |
|
|
Definition at line 609 of file kexiproject.cpp. References items(), and Kexi::partManager(). Referenced by itemForMimeType(). |
|
|
New item has been stored.
Referenced by addStoredItem(). |
|
|
Like open().
Definition at line 177 of file kexiproject.cpp. References openInternal(). |
|
|
Opens existing project using project data.
Definition at line 183 of file kexiproject.cpp. References openInternal(). Referenced by dropProject(), KexiMainWindowImpl::initUserMode(), and KexiMainWindowImpl::openProject(). |
|
|
Used in open() and open(bool&).
Definition at line 189 of file kexiproject.cpp. References cancelled, closeConnection(), createConnection(), createInternalStructures(), d, ERR_NO_DB_PROPERTY, initProject(), and KexiDB::Object::setError(). Referenced by open(). |
|
||||||||||||||||||||
|
For convenience.
Definition at line 759 of file kexiproject.cpp. References itemForMimeType(), and openObject(). |
|
||||||||||||||||||||
|
Opens object pointed by item in a view viewMode. staticObjectArgs can be passed for static object (only works when part for this item is of type KexiPart::StaticPart) Definition at line 737 of file kexiproject.cpp. References KexiDB::Object::clearError(), data(), Kexi::DataViewMode, findPartFor(), KexiPart::Part::lastOperationStatus(), KexiPart::Item::name(), KexiPart::Part::openInstance(), and KexiDB::Object::setError(). Referenced by openObject(), and KexiMainWindowImpl::openObject(). |
|
||||||||||||
|
Remove a part instance pointed by item.
Definition at line 774 of file kexiproject.cpp. References checkWritable(), KexiDB::Object::clearError(), KexiDB::TransactionGuard::commit(), d, data(), findPartFor(), KexiPart::Item::identifier(), KexiPart::Part::info(), itemRemoved(), KexiPart::Item::neverSaved(), KexiPart::Part::remove(), KexiDB::Object::setError(), and KexiDB::TransactionGuard::transaction(). Referenced by KexiMainWindowImpl::removeObject(). |
|
||||||||||||||||
|
Renames a part instance pointed by item to a new name newName.
Definition at line 816 of file kexiproject.cpp. References checkWritable(), KexiDB::Object::clearError(), KexiDB::TransactionGuard::commit(), d, data(), findPartFor(), KexiPart::Item::identifier(), itemRenamed(), KexiPart::Part::lastOperationStatus(), KexiPart::Item::mimeType(), KexiPart::Item::name(), KexiPart::Part::rename(), KexiDB::Object::setError(), KexiPart::Item::setName(), KexiDB::Field::Text, and KexiDB::TransactionGuard::transaction(). Referenced by KexiMainWindowImpl::renameObject(). |
|
|
Definition at line 161 of file kexiproject.cpp. References d. |
|
|
Definition at line 949 of file kexiproject.cpp. References d. |
|
|
Definition at line 166 of file kexiproject.cpp. References d. |
|
|
Definition at line 171 of file kexiproject.cpp. References d. |
Friends And Related Function Documentation
|
|
Definition at line 335 of file kexiproject.h. |
Member Data Documentation
|
|
for future extensions
Reimplemented from KexiDB::Object. Definition at line 332 of file kexiproject.h. Referenced by addStoredItem(), checkWritable(), closeConnection(), create(), createConnection(), createInternalStructures(), createPartItem(), data(), dbConnection(), deleteUnstoredItem(), final(), initProject(), isConnected(), item(), items(), KexiProject(), openInternal(), removeObject(), renameObject(), setFinal(), sqlParser(), versionMajor(), versionMinor(), and ~KexiProject(). |
The documentation for this class was generated from the following files:
