21#include "kexiquerydesignerguieditor.h"
30#include <tdemessagebox.h>
32#include <kexidb/field.h>
33#include <kexidb/queryschema.h>
34#include <kexidb/connection.h>
35#include <kexidb/parser/parser.h>
36#include <kexidb/parser/sqlparser.h>
37#include <kexidb/utils.h>
38#include <kexidb/roweditbuffer.h>
39#include <kexiutils/identifier.h>
40#include <kexiproject.h>
41#include <keximainwindow.h>
42#include <kexiinternalpart.h>
43#include <kexitableview.h>
44#include <kexitableitem.h>
45#include <kexitableviewdata.h>
46#include <kexidragobjects.h>
47#include <kexidialogbase.h>
48#include <kexidatatable.h>
50#include <kexisectionheader.h>
51#include <widget/tableview/kexidataawarepropertyset.h>
52#include <widget/relations/kexirelationwidget.h>
53#include <widget/relations/kexirelationviewtable.h>
54#include <koproperty/property.h>
55#include <koproperty/set.h>
57#include "kexiquerypart.h"
60#define KEXI_NO_QUERY_TOTALS
63#define COLUMN_ID_COLUMN 0
64#define COLUMN_ID_TABLE 1
65#define COLUMN_ID_VISIBLE 2
66#ifdef KEXI_NO_QUERY_TOTALS
67# define COLUMN_ID_SORTING 3
68# define COLUMN_ID_CRITERIA 4
70# define COLUMN_ID_TOTALS 3
71# define COLUMN_ID_SORTING 4
72# define COLUMN_ID_CRITERIA 5
76class KexiQueryDesignerGuiEditor::Private
80 : fieldColumnIdentifiers(1009, false)
83 slotTableAdded_enabled = true;
86 bool changeSingleCellValue(KexiTableItem &item, int columnNumber,
89 data->clearRowEditBuffer();
90 if (!data->updateRowEditBuffer(&item, columnNumber, value)
91 || !data->saveRowChanges(item, true))
94 *result = *data->result();
102 TQGuardedPtr<KexiDB::Connection> conn;
104 KexiRelationWidget *relations;
105 KexiSectionHeader *head;
119 TQDict<char> fieldColumnIdentifiers;
122 KexiTableItem *droppedNewItem;
124 TQString droppedNewTable, droppedNewField;
126 bool slotTableAdded_enabled : 1;
129static bool isAsterisk( const TQString& tableName, const TQString& fieldName)
131 return tableName== "*" || fieldName.endsWith( "*");
135static bool sortingAllowed( const TQString& fieldName, const TQString& tableName) {
136 return ! (fieldName== "*" || (fieldName.isEmpty() && tableName== "*"));
141KexiQueryDesignerGuiEditor::KexiQueryDesignerGuiEditor(
148 d->spl = new TQSplitter(TQt::Vertical, this);
149 d->spl->setChildrenCollapsible( false);
150 d->relations = new KexiRelationWidget(mainWin, d->spl, "relations");
155 connect(d->relations, TQ_SIGNAL(tableFieldDoubleClicked( KexiDB::TableSchema*, const TQString&)),
158 d->head = new KexiSectionHeader(i18n( "Query Columns"),TQt::Vertical, d->spl);
159 d->dataTable = new KexiDataTable(mainWin, d->head, "guieditor_dataTable", false);
160 d->dataTable->dataAwareObject()->setSpreadSheetMode();
168 c << COLUMN_ID_COLUMN << COLUMN_ID_TABLE << COLUMN_ID_CRITERIA;
169 if (d->dataTable->tableView()) {
170 d->dataTable->tableView()->adjustColumnWidthToContents(COLUMN_ID_VISIBLE);
171 d->dataTable->tableView()->adjustColumnWidthToContents(COLUMN_ID_SORTING);
172 d->dataTable->tableView()->maximizeColumnsWidth( c );
173 d->dataTable->tableView()->setDropsAtRowEnabled( true);
174 connect(d->dataTable->tableView(), TQ_SIGNAL(dragOverRow(KexiTableItem*, int,TQDragMoveEvent*)),
175 this, TQ_SLOT(slotDragOverTableRow(KexiTableItem*, int,TQDragMoveEvent*)));
176 connect(d->dataTable->tableView(), TQ_SIGNAL(droppedAtRow(KexiTableItem*, int,TQDropEvent*,KexiTableItem*&)),
177 this, TQ_SLOT(slotDroppedAtRow(KexiTableItem*, int,TQDropEvent*,KexiTableItem*&)));
178 connect(d->dataTable->tableView(), TQ_SIGNAL(newItemAppendedForAfterDeletingInSpreadSheetMode()),
179 this, TQ_SLOT(slotNewItemAppendedForAfterDeletingInSpreadSheetMode()));
181 connect(d->data, TQ_SIGNAL(aboutToChangeCell(KexiTableItem*, int,TQVariant&, KexiDB::ResultInfo*)),
182 this, TQ_SLOT(slotBeforeCellChanged(KexiTableItem*, int,TQVariant&, KexiDB::ResultInfo*)));
183 connect(d->data, TQ_SIGNAL(rowInserted(KexiTableItem*,uint, bool)),
184 this, TQ_SLOT(slotRowInserted(KexiTableItem*,uint, bool)));
185 connect(d->relations, TQ_SIGNAL(tablePositionChanged(KexiRelationViewTableContainer*)),
186 this, TQ_SLOT(slotTablePositionChanged(KexiRelationViewTableContainer*)));
187 connect(d->relations, TQ_SIGNAL(aboutConnectionRemove(KexiRelationViewConnection*)),
188 this, TQ_SLOT(slotAboutConnectionRemove(KexiRelationViewConnection*)));
190 TQVBoxLayout *l = new TQVBoxLayout( this);
191 l->addWidget(d->spl);
193 addChildView(d->relations);
194 addChildView(d->dataTable);
195 setViewWidget(d->dataTable, true);
196 d->relations->setSizePolicy(TQSizePolicy::Expanding,TQSizePolicy::Expanding);
197 d->head->setSizePolicy(TQSizePolicy::Expanding,TQSizePolicy::Expanding);
199 d->spl->setSizes(TQValueList<int>()<< 800<<400);
202KexiQueryDesignerGuiEditor::~KexiQueryDesignerGuiEditor()
210 i18n( "Describes field name or expression for the designed query."));
215 d->data->addColumn(col1);
218 i18n( "Describes table for a given field. Can be empty."));
221 d->data->addColumn(col2);
224 i18n( "Describes visibility for a given field or expression."));
227 d->data->addColumn(col3);
229#ifndef KEXI_NO_QUERY_TOTALS
231 i18n( "Describes a way of computing totals for a given field or expression."));
232 TQValueVector<TQString> totalsTypes;
233 totalsTypes.append( i18n( "Group by") );
234 totalsTypes.append( i18n( "Sum") );
235 totalsTypes.append( i18n( "Average") );
236 totalsTypes.append( i18n( "Min") );
237 totalsTypes.append( i18n( "Max") );
240 d->data->addColumn(col4);
244 i18n( "Describes a way of sorting for a given field."));
245 TQValueVector<TQString> sortTypes;
246 sortTypes.append( "" );
247 sortTypes.append( i18n( "Ascending") );
248 sortTypes.append( i18n( "Descending") );
250 d->data->addColumn(col5);
253 i18n( "Describes the criteria for a given field or expression."));
254 d->data->addColumn(col6);
262 d->data->deleteAllRows();
264 for ( int i=0; i<(int)d->sets->size(); i++) {
266 d->data->append(item = d->data->createItem());
267 item->at(COLUMN_ID_VISIBLE) = TQVariant( false);
269 d->dataTable->dataAwareObject()->setData(d->data);
276 d->dataTable->dataAwareObject()->acceptRowEdit();
278 TQStringList sortedTableNames;
279 for (TablesDictIterator it(*d->relations->tables());it.current();++it)
280 sortedTableNames += it.current()->schema()->name();
281 qHeapSort( sortedTableNames );
284 TQValueList<int> rowsToDelete;
285 for ( int r = 0; r<(int)d->sets->size(); r++) {
286 KoProperty::Set *set = d->sets->at(r);
288 TQString tableName = (*set)[ "table"].value().toString();
289 TQString fieldName = (*set)[ "field"].value().toString();
290 const bool allTablesAsterisk = tableName== "*" && d->relations->tables()->isEmpty();
291 const bool fieldNotFound = tableName!= "*"
292 && !(*set)[ "isExpression"].value().toBool()
293 && sortedTableNames.end() == tqFind( sortedTableNames.begin(), sortedTableNames.end(), tableName );
295 if (allTablesAsterisk || fieldNotFound) {
301 d->data->deleteRows( rowsToDelete );
304 d->tablesColumnData->deleteAllRows();
305 d->fieldColumnData->deleteAllRows();
306 d->fieldColumnIdentifiers.clear();
308 KexiTableItem *item = d->fieldColumnData->createItem();
309 (*item)[COLUMN_ID_COLUMN]= "*";
310 (*item)[COLUMN_ID_TABLE]= "*";
311 d->fieldColumnData->append( item );
312 d->fieldColumnIdentifiers.insert((*item)[COLUMN_ID_COLUMN].toString(), ( char*)1);
315 tempData()->unregisterForTablesSchemaChanges();
316 for (TQStringList::const_iterator it = sortedTableNames.constBegin();
317 it!=sortedTableNames.constEnd(); ++it)
322 d->conn->registerForTableSchemaChanges(*tempData(), *table);
323 item = d->tablesColumnData->createItem();
324 (*item)[COLUMN_ID_COLUMN]=table->name();
325 (*item)[COLUMN_ID_TABLE]=(*item)[COLUMN_ID_COLUMN];
326 d->tablesColumnData->append( item );
328 item = d->fieldColumnData->createItem();
329 (*item)[COLUMN_ID_COLUMN]=table->name()+ ".*";
330 (*item)[COLUMN_ID_TABLE]=(*item)[COLUMN_ID_COLUMN];
331 d->fieldColumnData->append( item );
332 d->fieldColumnIdentifiers.insert((*item)[COLUMN_ID_COLUMN].toString(), ( char*)1);
334 item = d->fieldColumnData->createItem();
335 (*item)[COLUMN_ID_COLUMN]=table->name()+ "."+t_it.current()->name();
336 (*item)[COLUMN_ID_TABLE]=TQString( " ") + t_it.current()->name();
337 d->fieldColumnData->append( item );
338 d->fieldColumnIdentifiers.insert((*item)[COLUMN_ID_COLUMN].toString(), ( char*)1);
344KexiRelationWidget *KexiQueryDesignerGuiEditor::relationView() const
350KexiQueryDesignerGuiEditor::tempData() const
355static TQString msgCannotSwitch_EmptyDesign() {
356 return i18n( "Cannot switch to data view, because query design is empty.\n"
357 "First, please create your design.");
372 for (TablesDictIterator it(*d->relations->tables()); it.current(); ++it) {
381 const uint count = TQMIN(d->data->count(), d->sets->size());
382 bool fieldsFound = false;
383 KexiTableViewData::Iterator it(d->data->iterator());
384 for (uint i=0; i<count && it.current(); ++it, i++) {
385 if (!it.current()->at(COLUMN_ID_TABLE).isNull() && it.current()->at(COLUMN_ID_COLUMN).isNull()) {
387 kexipluginsdbg << "no field provided!" << endl;
388 d->dataTable->dataAwareObject()->setCursorPosition(i,0);
390 *errMsg = i18n( "Select column for table \"%1\"")
391 .arg(it.current()->at(COLUMN_ID_TABLE).toString());
395 KoProperty::Set *set = d->sets->at(i);
397 TQString tableName = (*set)[ "table"].value().toString().stripWhiteSpace();
398 TQString fieldName = (*set)[ "field"].value().toString();
399 TQString fieldAndTableName = fieldName;
402 if (!tableName.isEmpty())
403 fieldAndTableName.prepend(tableName+ ".");
404 const bool fieldVisible = (*set)[ "visible"].value().toBool();
405 TQString criteriaStr = (*set)[ "criteria"].value().toString();
406 TQCString alias = (*set)[ "alias"].value().toCString();
407 if (!criteriaStr.isEmpty()) {
413 *errMsg = i18n( "Invalid criteria \"%1\"").arg(criteriaStr);
419 criteriaExpr = new KexiDB::BinaryExpr(KexiDBExpr_Relational, varExpr, token, criteriaExpr);
424 whereExpr = criteriaExpr;
426 if (tableName.isEmpty()) {
427 if ((*set)[ "isExpression"].value().toBool()== true) {
434 *errMsg = i18n( "Invalid expression \"%1\"").arg(fieldName);
440 if (!alias.isEmpty())
445 else if (tableName== "*") {
454 if (fieldName== "*") {
461 kexipluginswarn << "query designer: NO TABLE '"
462 << (*set)[ "table"].value().toString() << "'" << endl;
465 currentField = t-> field( fieldName );
467 kexipluginswarn << "query designer: NO FIELD '" << fieldName << "'" << endl;
470 if (!fieldVisible && criteriaStr.isEmpty() && (*set)[ "isExpression"]
471 && (*set)[ "sorting"].value().toString()!= "nosorting")
473 kexipluginsdbg << "invisible field with sorting: do not add it to the fields list" << endl;
481 if (!alias.isEmpty())
487 kexipluginsdbg << it.current()->at(COLUMN_ID_TABLE).toString() << endl;
492 *errMsg = msgCannotSwitch_EmptyDesign();
496 kexipluginsdbg << "KexiQueryDesignerGuiEditor::buildSchema(): setting CRITERIA: "
497 << whereExpr->debugString() << endl;
504 for (ConnectionListIterator it(*d->relations->connections()); it.current(); ++it) {
505 KexiRelationViewTableContainer *masterTable = it.current()->masterTable();
506 KexiRelationViewTableContainer *detailsTable = it.current()->detailsTable();
510 masterTable->schema()->table()->field(it.current()->masterField()),
511 detailsTable->schema()->table()->field(it.current()->detailsField()) );
517 it = d->data->iterator();
518 int fieldNumber = -1;
519 for (uint i=0; i<count && it.current(); ++it, i++) {
520 KoProperty::Set *set = d->sets->at(i);
526 TQString sortingString( (*set)[ "sorting"].value().toString() );
527 if (sortingString!= "ascending" && sortingString!= "descending")
529 if (!(*set)[ "visible"].value().toBool()) {
537 kexipluginswarn << "KexiQueryDesignerGuiEditor::buildSchema(): NO FIELD '"
538 << (*set)[ "field"].value().toString()
539 << " available for sorting" << endl;
542 orderByColumns. appendField(*currentField, sortingString== "ascending");
545 currentField = temp-> query()-> field( (uint)fieldNumber );
550 TQString aliasString( (*set)[ "alias"].value().toString() );
552 (*set)[ "table"].value().toString() + "."
553 + (aliasString.isEmpty() ? currentField->name() : aliasString) );
554 if (currentField && currentColumn) {
556 orderByColumns. appendColumn(*currentColumn, sortingString== "ascending");
557 else if (currentColumn->field)
558 orderByColumns. appendField(*currentColumn->field, sortingString== "ascending");
564 temp->registerTableSchemaChanges(temp-> query());
572 kexipluginsdbg << "KexiQueryDesignerGuiEditor::beforeSwitch()" << mode << endl;
574 if (!d->dataTable->dataAwareObject()->acceptRowEdit())
577 if (mode==Kexi::DesignViewMode) {
580 else if (mode==Kexi::DataViewMode) {
585 KMessageBox::information( this, msgCannotSwitch_EmptyDesign());
588 if ( dirty() || !tempData()->query()) {
594 KMessageBox::sorry( this, errMsg);
620 const bool was_dirty = dirty();
622 if (mode== Kexi::NoViewMode || (mode==Kexi::DataViewMode && !tempData()->query())) {
628 i18n( "Query definition loading failed."),
629 i18n( "Query design may be corrupted so it could not be opened even in text view.\n"
630 "You can delete the query and create it again."));
642 parentDialog()->setStatus(&result, i18n( "Query definition loading failed."));
653 if (tempData()->queryChangedInPreviousView) {
658 if (tempData()->query()) {
660 showTablesForQuery( tempData()->query() );
665 parentDialog()->setStatus(&result, i18n( "Query definition loading failed."));
670 d->relations->clear();
676 if (mode==Kexi::DataViewMode) {
679 if (d->dataTable->dataAwareObject()->currentRow()<0
680 || d->dataTable->dataAwareObject()->currentColumn()<0)
682 d->dataTable->dataAwareObject()->ensureCellVisible(0,0);
683 d->dataTable->dataAwareObject()->setCursorPosition(0,0);
697 if (!d->dataTable->dataAwareObject()->acceptRowEdit()) {
706 KMessageBox::sorry( this, errMsg);
730 if (!d->dataTable->dataAwareObject()->acceptRowEdit())
733 const bool was_dirty = dirty();
752 d->slotTableAdded_enabled = false;
753 d->relations->removeAllConnections();
754 d->relations->hideAllTablesExcept( query-> tables() );
756 d->relations->addTable( it.current() );
759 d->slotTableAdded_enabled = true;
763void KexiQueryDesignerGuiEditor::addConnection(
766 SourceConnection conn;
767 conn.masterTable = masterField-> table()->name();
768 conn.masterField = masterField->name();
769 conn.detailsTable = detailsField-> table()->name();
770 conn.detailsField = detailsField->name();
771 d->relations->addConnection( conn );
794 const bool was_dirty = dirty();
798 KexiDB::Relationship *rel;
799 for (KexiDB::Relationship::ListIterator it(*query-> relationships());
800 (rel=it.current()); ++it)
803 KexiDB::Field *masterField = rel->masterIndex()->fields()->first();
804 KexiDB::Field *detailsField = rel->detailsIndex()->fields()->first();
805 addConnection(masterField, detailsField);
812 TQDict<KexiDB::BaseExpr> criterias(1009, false);
817 while (e && e->toUnary() && e->token()== '(')
818 e = e->toUnary()->arg();
820 if (e->toBinary() && e->token()==AND) {
821 eItem = e->toBinary()->left();
822 e = e->toBinary()->right();
830 while (eItem && eItem->toUnary() && eItem->token()== '(')
831 eItem = eItem->toUnary()->arg();
836 kexidbg << eItem-> toString() << endl;
838 if (binary && eItem->exprClass()==KexiDBExpr_Relational) {
840 if (eItem->token()== '='
841 && binary->left()->toVariable()
842 && binary->right()->toVariable()
855 addConnection(leftField , rightField );
857 addConnection(rightField , leftField );
861 else if (binary->left()->toVariable()) {
864 criterias.insert(binary->left()->toVariable()-> name, binary->right());
866 else if (binary->right()->toVariable()) {
869 criterias.insert(binary->right()->toVariable()-> name, binary->left());
880 TQPtrDict<char> usedCriterias(1009);
884 (field = it.current()); ++it, row_num++)
887 TQString tableName, fieldName, columnAlias, criteriaString;
890 if (field->isQueryAsterisk()) {
891 if (field->table()) {
892 tableName = field->table()->name();
902 if (field->isExpression()) {
908 fieldName = field->expression()->toString();
913 tableName = field->table()->name();
914 fieldName = field->name();
915 criteriaArgument = criterias[fieldName];
916 if (!criteriaArgument) {
917 criteriaArgument = criterias[tableName+ "."+fieldName];
919 if (criteriaArgument) {
920 criteriaExpr = criteriaArgument->parent()->toBinary();
921 usedCriterias.insert(criteriaArgument, ( char*)1);
926 KexiTableItem *newItem = createNewRow(tableName, fieldName, true );
929 if (criteriaExpr->token()== '=')
930 criteriaString = criteriaArgument-> toString();
933 (*newItem)[COLUMN_ID_CRITERIA] = criteriaString;
935 d->dataTable->dataAwareObject()->insertItem(newItem, row_num);
937 KoProperty::Set &set = * createPropertySet( row_num, tableName, fieldName, true );
938 if (!columnAlias.isEmpty())
939 set[ "alias"].setValue(columnAlias, false);
940 if (!criteriaString.isEmpty())
941 set[ "criteria"].setValue( criteriaString, false );
942 if (field->isExpression()) {
944 if (!d->changeSingleCellValue(*newItem, COLUMN_ID_COLUMN,
945 TQVariant(columnAlias + ": " + field->expression()->toString()), &result))
951 d->data->clearRowEditBuffer();
953 TQMap<KexiDB::QueryColumnInfo*,int> columnsOrder(
955 for (KexiDB::OrderByColumn::ListConstIterator orderByColumnsIt( orderByColumns.constBegin() );
956 orderByColumnsIt!=orderByColumns.constEnd(); ++orderByColumnsIt)
959 KexiTableItem *rowItem = 0;
960 KoProperty::Set *rowPropertySet = 0;
964 if (columnsOrder.contains(column)) {
965 const int columnPosition = columnsOrder[ column ];
966 rowItem = d->data->at( columnPosition );
967 rowPropertySet = d->sets->at( columnPosition );
968 kexipluginsdbg << "KexiQueryDesignerGuiEditor::showFieldsOrRelationsForQueryInternal():\n\t"
969 "Setting \"" << (*orderByColumnsIt).debugString() << "\" sorting for row #"
970 << columnPosition << endl;
974 else if ((*orderByColumnsIt).field()) {
976 field = (*orderByColumnsIt).field();
977 TQString tableName( field->table() ? field->table()->name() : TQString() );
978 rowItem = createNewRow( tableName, field->name(), false );
979 d->dataTable->dataAwareObject()->insertItem(rowItem, row_num);
982 kexipluginsdbg << "KexiQueryDesignerGuiEditor::showFieldsOrRelationsForQueryInternal():\n\t"
983 "Setting \"" << (*orderByColumnsIt).debugString() << "\" sorting for invisible field "
984 << field->name() << ", table " << tableName << " -row #" << row_num << endl;
988 if (rowItem && rowPropertySet) {
989 d->data->updateRowEditBuffer(rowItem, COLUMN_ID_SORTING,
990 (*orderByColumnsIt).ascending() ? 1 : 2);
992 d->data->saveRowChanges(*rowItem, true);
993 (*rowPropertySet)[ "sorting"].clearModifiedFlag();
994 if (!rowItem->at(COLUMN_ID_VISIBLE).toBool())
995 (*rowPropertySet)[ "visible"].setValue(TQVariant( false), false);
1001 for (TQDictIterator<KexiDB::BaseExpr> it(criterias); (criteriaArgument = it.current()); ++it) {
1002 if (usedCriterias[it.current()])
1006 if (!criteriaExpr) {
1007 kexipluginswarn << "KexiQueryDesignerGuiEditor::showFieldsOrRelationsForQueryInternal(): "
1008 "criteriaExpr is not a binary expr" << endl;
1012 if (!columnNameArgument) {
1013 columnNameArgument = criteriaExpr->right()->toVariable();
1014 if (!columnNameArgument) {
1015 kexipluginswarn << "KexiQueryDesignerGuiEditor::showFieldsOrRelationsForQueryInternal(): "
1016 "columnNameArgument is not a variable (table or table.field) expr" << endl;
1021 if (-1 == columnNameArgument-> name.find( '.') && query-> tables()->count()==1) {
1023 field = query-> tables()->first()->field(columnNameArgument-> name);
1030 kexipluginswarn << "KexiQueryDesignerGuiEditor::showFieldsOrRelationsForQueryInternal(): "
1031 "no columnInfo found in the query for name \"" << columnNameArgument-> name << endl;
1034 TQString tableName, fieldName, columnAlias, criteriaString;
1036 tableName = field->table()->name();
1037 fieldName = field->name();
1039 KexiTableItem *newItem = createNewRow(tableName, fieldName, false );
1042 if (criteriaExpr->token()== '=')
1043 criteriaString = criteriaArgument-> toString();
1046 (*newItem)[COLUMN_ID_CRITERIA] = criteriaString;
1048 d->dataTable->dataAwareObject()->insertItem(newItem, row_num);
1050 KoProperty::Set &set = * createPropertySet( row_num++, tableName, fieldName, true );
1054 set[ "criteria"].setValue( criteriaString, false );
1055 set[ "visible"].setValue( TQVariant( false), false );
1064 d->dataTable->dataAwareObject()->ensureCellVisible(0,0);
1076 if (xml.isEmpty()) {
1082 showTablesForQuery( q );
1086 parentDialog()->setStatus(&result, i18n( "Query definition loading failed."));
1094 doc.setContent(xml);
1095 TQDomElement doc_el = doc.documentElement(), el;
1096 if (doc_el.tagName()!= "query_layout") {
1101 const bool was_dirty = dirty();
1104 for (el = doc_el.firstChild().toElement(); !el.isNull(); el=el.nextSibling().toElement()) {
1105 if (el.tagName()== "table") {
1107 int x = el.attribute( "x", "-1").toInt();
1108 int y = el.attribute( "y", "-1").toInt();
1109 int width = el.attribute( "width", "-1").toInt();
1110 int height = el.attribute( "height", "-1").toInt();
1112 if (x!=-1 || y!=-1 || width!=-1 || height!=-1)
1113 rect = TQRect(x,y,width,height);
1114 d->relations->addTable( t, rect );
1116 else if (el.tagName()== "conn") {
1117 SourceConnection src_conn;
1118 src_conn.masterTable = el.attribute( "mtable");
1119 src_conn.masterField = el.attribute( "mfield");
1120 src_conn.detailsTable = el.attribute( "dtable");
1121 src_conn.detailsField = el.attribute( "dfield");
1122 d->relations->addConnection(src_conn);
1137 if (m_dialog->schemaData())
1141 options. identifierEscaping = KexiDB::Driver::EscapeKexi|KexiDB::Driver::EscapeAsNecessary;
1149 TQString xml = "<query_layout>", tmp;
1150 for (TablesDictIterator it(*d->relations->tables()); it.current(); ++it) {
1151 KexiRelationViewTableContainer *table_cont = it.current();
1153 tmp = TQString( "<table name=\"")+TQString(table_cont->schema()->name())+ "\" x=\""
1154 +TQString::number(table_cont->x())
1155 + "\" y=\""+TQString::number(table_cont->y())
1156 + "\" width=\""+TQString::number(table_cont->width())
1157 + "\" height=\""+TQString::number(table_cont->height())
1162 KexiRelationViewConnection *con;
1163 for (ConnectionListIterator it(*d->relations->connections()); (con = it.current()); ++it) {
1164 tmp = TQString( "<conn mtable=\"") + TQString(con->masterTable()->schema()->name())
1165 + "\" mfield=\"" + con->masterField() + "\" dtable=\""
1166 + TQString(con->detailsTable()->schema()->name())
1167 + "\" dfield=\"" + con->detailsField() + "\"/>";
1170 xml += "</query_layout>";
1180TQSize KexiQueryDesignerGuiEditor::sizeHint() const
1182 TQSize s1 = d->relations->sizeHint();
1183 TQSize s2 = d->head->sizeHint();
1184 return TQSize(TQMAX(s1.width(),s2.width()), s1.height()+s2.height());
1191 KexiTableItem *newItem = d->data->createItem();
1196 if (!tableName.isEmpty())
1197 key = (tableName+ ".");
1200 (*newItem)[COLUMN_ID_COLUMN]=key;
1201 (*newItem)[COLUMN_ID_TABLE]=tableName;
1202 (*newItem)[COLUMN_ID_VISIBLE]=TQVariant(visible);
1203#ifndef KEXI_NO_QUERY_TOTALS
1204 (*newItem)[COLUMN_ID_TOTALS]=TQVariant(0);
1209void KexiQueryDesignerGuiEditor::slotDragOverTableRow(
1210 KexiTableItem * , int , TQDragMoveEvent* e)
1212 if (e->provides( "kexi/field")) {
1213 e->acceptAction( true);
1218KexiQueryDesignerGuiEditor::slotDroppedAtRow(KexiTableItem * , int ,
1219 TQDropEvent *ev, KexiTableItem*& newItem)
1221 TQString sourceMimeType;
1229 d->droppedNewItem = newItem;
1230 d->droppedNewTable = srcTable;
1231 d->droppedNewField = srcField;
1237 KexiTableItem *item = d->data->last();
1239 item->at(COLUMN_ID_VISIBLE) = TQVariant( false);
1242void KexiQueryDesignerGuiEditor::slotRowInserted(KexiTableItem* item, uint row, bool )
1244 if (d->droppedNewItem && d->droppedNewItem==item) {
1247 d->droppedNewItem=0;
1253 if (!d->slotTableAdded_enabled)
1257 d->dataTable->setFocus();
1267TQCString KexiQueryDesignerGuiEditor::generateUniqueAlias() const
1270 const TQCString expStr
1271 = i18n( "short for 'expression' word (only latin letters, please)", "expr").latin1();
1273 TQAsciiDict<char> aliases(1009);
1274 for ( int r = 0; r<(int)d->sets->size(); r++) {
1275 KoProperty::Set *set = d->sets->at(r);
1277 const TQCString a = (*set)[ "alias"].value().toCString().lower();
1279 aliases.insert(a,( char*)1);
1284 if (!aliases[expStr+TQString::number(aliasNr).latin1()])
1287 return expStr+TQString::number(aliasNr).latin1();
1293 bool allowRelationalOperator)
1295 TQString str = fullString.stripWhiteSpace();
1301 if (str.startsWith( ">="))
1302 token = GREATER_OR_EQUAL;
1303 else if (str.startsWith( "<="))
1304 token = LESS_OR_EQUAL;
1305 else if (str.startsWith( "<>"))
1307 else if (str.startsWith( "!="))
1309 else if (str.startsWith( "=="))
1314 else if (str.startsWith( "=")
1315 || str.startsWith( "<")
1316 || str.startsWith( ">"))
1318 token = str[0].latin1();
1322 if (allowRelationalOperator)
1326 if (!allowRelationalOperator && token!=0)
1331 str = str.mid(len).stripWhiteSpace();
1337 if (str.length()>=2 &&
1339 (str.startsWith( "\"") && str.endsWith( "\""))
1340 || (str.startsWith( "'") && str.endsWith( "'")))
1343 valueExpr = new KexiDB::ConstExpr(CHARACTER_STRING_LITERAL, str.mid(1,str.length()-2));
1345 else if (str.startsWith( "[") && str.endsWith( "]")) {
1348 else if ((re = TQRegExp( "(\\d{1,4})-(\\d{1,2})-(\\d{1,2})")).exactMatch( str ))
1351 re.cap(1).rightJustify(4, '0')+ "-"+re.cap(2).rightJustify(2, '0')
1352 + "-"+re.cap(3).rightJustify(2, '0'), TQt::ISODate));
1354 else if ((re = TQRegExp( "(\\d{1,2}):(\\d{1,2})")).exactMatch( str )
1355 || (re = TQRegExp( "(\\d{1,2}):(\\d{1,2}):(\\d{1,2})")).exactMatch( str ))
1357 TQString res = re.cap(1).rightJustify(2, '0')+ ":"+re.cap(2).rightJustify(2, '0')
1358 + ":"+re.cap(3).rightJustify(2, '0');
1360 valueExpr = new KexiDB::ConstExpr(TIME_CONST, TQTime::fromString(res, TQt::ISODate));
1362 else if ((re = TQRegExp( "(\\d{1,4})-(\\d{1,2})-(\\d{1,2})\\s+(\\d{1,2}):(\\d{1,2})")).exactMatch( str )
1363 || (re = TQRegExp( "(\\d{1,4})-(\\d{1,2})-(\\d{1,2})\\s+(\\d{1,2}):(\\d{1,2}):(\\d{1,2})")).exactMatch( str ))
1365 TQString res = re.cap(1).rightJustify(4, '0')+ "-"+re.cap(2).rightJustify(2, '0')
1366 + "-"+re.cap(3).rightJustify(2, '0')
1367 + "T"+re.cap(4).rightJustify(2, '0')+ ":"+re.cap(5).rightJustify(2, '0')
1368 + ":"+re.cap(6).rightJustify(2, '0');
1371 TQDateTime::fromString(res, TQt::ISODate));
1373 else if (str[0]>= '0' && str[0]<= '9' || str[0]== '-' || str[0]== '+') {
1375 TQString decimalSym = TDEGlobal::locale()->decimalSymbol();
1377 int pos = str.find( '.');
1379 pos = str.find(decimalSym);
1382 const int left = str.left(pos).toInt(&ok);
1385 const int right = str.mid(pos+1).toInt(&ok);
1392 const TQ_LLONG val = str.toLongLong(&ok);
1398 else if (str.lower()== "null") {
1406 for (TablesDictIterator it(*d->relations->tables()); it.current(); ++it) {
1408 if (it.current()->schema()->table() && it.current()->schema()->table()->field(str)) {
1409 valueExpr->toVariable()->field = it.current()->schema()-> table()-> field(str);
1420 if (colnum == COLUMN_ID_COLUMN) {
1421 if (newValue.isNull()) {
1422 d->data->updateRowEditBuffer(item, COLUMN_ID_TABLE, TQVariant(), false);
1423 d->data->updateRowEditBuffer(item, COLUMN_ID_VISIBLE, TQVariant( false));
1424 d->data->updateRowEditBuffer(item, COLUMN_ID_SORTING, TQVariant());
1425#ifndef KEXI_NO_QUERY_TOTALS
1426 d->data->updateRowEditBuffer(item, COLUMN_ID_TOTALS, TQVariant());
1428 d->data->updateRowEditBuffer(item, COLUMN_ID_CRITERIA, TQVariant());
1429 d->sets->removeCurrentPropertySet();
1433 TQString fieldId( newValue.toString().stripWhiteSpace() );
1437 TQString columnValueForExpr;
1438 const bool isExpression = !d->fieldColumnIdentifiers[fieldId];
1444 const int id = fieldId.find( ':');
1446 alias = fieldId.left( id).stripWhiteSpace().latin1();
1451 result->msg = i18n( "Entered column alias \"%1\" is not a valid identifier.")
1453 result-> desc = i18n( "Identifiers should start with a letter or '_' character");
1457 fieldName = fieldId.mid( id+1).stripWhiteSpace();
1471 result->msg = i18n( "Invalid expression \"%1\"").arg(fieldName);
1484 kexipluginswarn << "KexiQueryDesignerGuiEditor::slotBeforeCellChanged(): no 'field' or 'table.field'" << endl;
1489 bool saveOldValue = true;
1490 KoProperty::Set *set = d->sets->findPropertySetForItem(*item);
1492 saveOldValue = false;
1493 const int row = d->data->findRef(item);
1501 d->data->updateRowEditBuffer(item, COLUMN_ID_TABLE, TQVariant(tableName), false);
1502 d->data->updateRowEditBuffer(item, COLUMN_ID_VISIBLE, TQVariant( true));
1503#ifndef KEXI_NO_QUERY_TOTALS
1504 d->data->updateRowEditBuffer(item, COLUMN_ID_TOTALS, TQVariant(0));
1506 if (!sortingAllowed(fieldName, tableName)) {
1509 d->data->updateRowEditBuffer(item, COLUMN_ID_SORTING, TQVariant());
1512 (*set)[ "field"].setValue(fieldName, saveOldValue);
1515 if (alias.isEmpty())
1516 alias = (*set)[ "alias"].value().toCString();
1517 if (alias.isEmpty())
1518 alias = generateUniqueAlias();
1520 (*set)[ "isExpression"].setValue(TQVariant(isExpression), saveOldValue);
1521 if (!alias.isEmpty()) {
1522 (*set)[ "alias"].setValue(alias, saveOldValue);
1524 newValue = TQString(alias) + ": " + fieldName;
1526 (*set)[ "caption"].setValue(TQString(), saveOldValue);
1527 (*set)[ "table"].setValue(tableName, saveOldValue);
1528 updatePropertiesVisibility(*set);
1531 else if (colnum==COLUMN_ID_TABLE) {
1532 if (newValue.isNull()) {
1533 if (!item->at(COLUMN_ID_COLUMN).toString().isEmpty())
1534 d->data->updateRowEditBuffer(item, COLUMN_ID_COLUMN, TQVariant(), false);
1535 d->data->updateRowEditBuffer(item, COLUMN_ID_VISIBLE, TQVariant( false));
1536#ifndef KEXI_NO_QUERY_TOTALS
1537 d->data->updateRowEditBuffer(item, COLUMN_ID_TOTALS, TQVariant());
1539 d->data->updateRowEditBuffer(item, COLUMN_ID_CRITERIA, TQVariant());
1540 d->sets->removeCurrentPropertySet();
1543 KoProperty::Set *set = d->sets->findPropertySetForItem(*item);
1545 if ((*set)[ "isExpression"].value().toBool()== false) {
1546 (*set)[ "table"] = newValue;
1547 (*set)[ "caption"] = TQString();
1551 newValue = TQVariant();
1554 updatePropertiesVisibility(*set);
1557 else if (colnum==COLUMN_ID_VISIBLE) {
1558 bool saveOldValue = true;
1560 saveOldValue = false;
1562 item->at(COLUMN_ID_TABLE).toString(), item->at(COLUMN_ID_COLUMN).toString(), true );
1563#ifndef KEXI_NO_QUERY_TOTALS
1564 d->data->updateRowEditBuffer(item, COLUMN_ID_TOTALS, TQVariant(0));
1569 set[ "visible"].setValue(newValue, saveOldValue);
1571#ifndef KEXI_NO_QUERY_TOTALS
1572 else if (colnum==COLUMN_ID_TOTALS) {
1578 else if (colnum==COLUMN_ID_SORTING) {
1579 KoProperty::Set *set = d->sets->findPropertySetForItem(*item);
1580 TQString table( set->property( "table").value().toString() );
1581 TQString field( set->property( "field").value().toString() );
1582 if (newValue.toInt()==0 || sortingAllowed(field, table)) {
1583 KoProperty::Property & property = set->property( "sorting");
1584 TQString key( property.listData()->keysAsStringList()[ newValue.toInt() ] );
1585 kexipluginsdbg << "new key=" << key << endl;
1586 property.setValue(key, true);
1592 result->msg = i18n( "Could not set sorting for multiple columns (%1)")
1593 .arg(table== "*" ? table : (table+ ".*"));
1596 else if (colnum==COLUMN_ID_CRITERIA) {
1598 TQString operatorStr, argStr;
1600 const TQString str = newValue. toString().stripWhiteSpace();
1602 TQString field, table;
1603 KoProperty::Set *set = d->sets->findPropertySetForItem(*item);
1605 field = (*set)[ "field"].value().toString();
1606 table = (*set)[ "table"].value().toString();
1608 if (!str.isEmpty() && (!set || table== "*" || field.find( "*")!=-1)) {
1614 result->msg = i18n( "Could not set criteria for \"%1\"")
1615 .arg(table== "*" ? table : field);
1617 result->msg = i18n( "Could not set criteria for empty row");
1628 (*set)[ "criteria"] = tokenStr + e-> toString();
1632 else if (str.isEmpty()) {
1633 (*set)[ "criteria"] = TQVariant();
1641 result->msg = i18n( "Invalid criteria \"%1\"").arg(newValue.toString());
1646void KexiQueryDesignerGuiEditor::slotTablePositionChanged(KexiRelationViewTableContainer*)
1651void KexiQueryDesignerGuiEditor::slotAboutConnectionRemove(KexiRelationViewConnection*)
1656void KexiQueryDesignerGuiEditor::slotTableFieldDoubleClicked(
1659 if (!table || (!table-> field(fieldName) && fieldName!= "*"))
1663 for (row_num=d->sets->size()-1; row_num>=0 && !d->sets->at(row_num); row_num--)
1667 KexiTableItem *newItem = createNewRow(table->name(), fieldName, true );
1668 d->dataTable->dataAwareObject()->insertItem(newItem, row_num);
1669 d->dataTable->dataAwareObject()->setCursorPosition(row_num, 0);
1673 d->dataTable->setFocus();
1678 return d->sets->currentPropertySet();
1681void KexiQueryDesignerGuiEditor::updatePropertiesVisibility(KoProperty::Set& set)
1683 const bool asterisk = isAsterisk(
1684 set[ "table"].value().toString(), set[ "field"].value().toString()
1686#ifndef KEXI_NO_UNFINISHED
1687 set[ "caption"].setVisible( !asterisk );
1689 set[ "alias"].setVisible( !asterisk );
1698 const TQString& tableName, const TQString& fieldName, bool newOne )
1701 TQString typeName = "KexiQueryDesignerGuiEditor::Column";
1702 KoProperty::Set *set = new KoProperty::Set(d->sets, typeName);
1703 KoProperty::Property *prop;
1706 set->addProperty(prop = new KoProperty::Property( "this:classString", i18n( "Query column")) );
1707 prop->setVisible( false);
1711 set->addProperty(prop = new KoProperty::Property( "table", TQVariant(tableName)) );
1712 prop->setVisible( false);
1714 set->addProperty(prop = new KoProperty::Property( "field", TQVariant(fieldName)) );
1715 prop->setVisible( false);
1717 set->addProperty(prop = new KoProperty::Property( "caption", TQVariant(TQString()), i18n( "Caption") ) );
1718#ifdef KEXI_NO_UNFINISHED
1719 prop->setVisible( false);
1722 set->addProperty(prop = new KoProperty::Property( "alias", TQVariant(TQString()), i18n( "Alias")) );
1724 set->addProperty(prop = new KoProperty::Property( "visible", TQVariant( true)) );
1725 prop->setVisible( false);
1732 TQStringList slist, nlist;
1733 slist << "nosorting" << "ascending" << "descending";
1734 nlist << i18n( "None") << i18n( "Ascending") << i18n( "Descending");
1735 set->addProperty(prop = new KoProperty::Property( "sorting",
1736 slist, nlist, *slist.at(0), i18n( "Sorting")));
1737 prop->setVisible( false);
1739 set->addProperty(prop = new KoProperty::Property( "criteria", TQVariant(TQString())) );
1740 prop->setVisible( false);
1742 set->addProperty(prop = new KoProperty::Property( "isExpression", TQVariant( false)) );
1743 prop->setVisible( false);
1745 connect(set, TQ_SIGNAL(propertyChanged(KoProperty::Set&, KoProperty::Property&)),
1746 this, TQ_SLOT(slotPropertyChanged(KoProperty::Set&, KoProperty::Property&)));
1748 d->sets->insert(row, set, newOne);
1750 updatePropertiesVisibility(*set);
1754void KexiQueryDesignerGuiEditor::setFocus()
1756 d->dataTable->setFocus();
1759void KexiQueryDesignerGuiEditor::slotPropertyChanged(KoProperty::Set& set, KoProperty::Property& property)
1761 const TQCString& pname = property.name();
1765 if (pname== "alias" || pname== "name") {
1766 const TQVariant& v = property.value();
1768 KMessageBox::sorry( this,
1770 property.resetValue();
1772 if (pname== "alias") {
1773 if (set[ "isExpression"].value().toBool()== true) {
1775 d->dataTable->dataAwareObject()->acceptEditor();
1778 d->data->updateRowEditBuffer(d->dataTable->dataAwareObject()->selectedItem(),
1779 0, TQVariant(set[ "alias"].value().toString() + ": " + set[ "field"].value().toString()));
1780 d->data->saveRowChanges(*d->dataTable->dataAwareObject()->selectedItem(), true);
1787void KexiQueryDesignerGuiEditor::slotNewItemStored( KexiPart::Item& item)
1789 d->relations->objectCreated(item.mimeType(), item.name().latin1());
1792void KexiQueryDesignerGuiEditor::slotItemRemoved( const KexiPart::Item& item)
1794 d->relations->objectDeleted(item.mimeType(), item.name().latin1());
1797void KexiQueryDesignerGuiEditor::slotItemRenamed( const KexiPart::Item& item, const TQCString& oldName)
1799 d->relations->objectRenamed(item.mimeType(), oldName, item.name().latin1());
1802#include "kexiquerydesignerguieditor.moc"
A base class for all expressions.
virtual TQString toString(QuerySchemaParameterValueListIterator *params=0)=0
virtual TQString tokenToString()
options used in selectStatement()
int identifierEscaping A mode for escaping identifier, Driver::EscapeDriver|Driver::EscapeAsNecessary by default.
bool addVisibleLookupColumns
Provides database connection, allowing queries and data modification.
bool setQuerySchemaObsolete(const TQString &queryName)
bool storeObjectSchemaData(SchemaData &sdata, bool newObject)
TQString selectStatement(QuerySchema &querySchema, const TQValueList< TQVariant > ¶ms, const SelectStatementOptions &options=SelectStatementOptions()) const
bool isPrimaryKey() const
void setDefaultValue(const TQVariant &def)
void setEnumHints(const TQValueVector< TQString > &l)
TQPtrListIterator< Field > ListIterator iterator for list of fields
virtual bool isQueryAsterisk() const
bool isExpression() const
virtual TableSchema * table() const
KexiDB::OrderByColumnList provides list of sorted columns for a query schema.
void appendColumn(QueryColumnInfo &columnInfo, bool ascending=true)
void appendField(Field &field, bool ascending=true)
KexiDB::QueryAsterisk class encapsulates information about single asterisk in query definition.
Helper class that assigns additional information for the column in a query.
bool visible true if this column is visible to the user (and its data is fetched by the engine)
Query parameter used to getting user input of constant values.
KexiDB::QuerySchema provides information about database query.
TQCString columnAlias(uint position) const
FieldList & addExpression(BaseExpr *expr, bool visible=true)
Relationship::List * relationships() const
void addTable(TableSchema *table, const TQCString &alias=TQCString())
virtual Field * field(const TQString &name, bool expanded=true)
FieldList & addAsterisk(QueryAsterisk *asterisk, bool visible=true)
void setWhereExpression(BaseExpr *expr)
Relationship * addRelationship(Field *field1, Field *field2)
OrderByColumnList & orderByColumnList() const
TQMap< QueryColumnInfo *, int > columnsOrder(ColumnsOrderOptions options=ExpandedList)
QueryColumnInfo::Vector fieldsExpanded(FieldsExpandedOptions options=Default)
@ UnexpandedListWithoutAsterisks A map for unexpanded list is created, with asterisks skipped.
Field * findTableField(const TQString &tableOrTableAndFieldName) const
TableSchema::List * tables() const
QueryColumnInfo * columnInfo(const TQString &identifier, bool expanded=true)
void setOrderByColumnList(const OrderByColumnList &list)
BaseExpr * whereExpression() const
FieldList & addField(Field *field, bool visible=true)
QueryColumnInfo * expandedOrInternalField(uint index)
void setColumnAlias(uint position, const TQCString &alias)
bool success result of the operation, true by default
int column faulty column, -1 (the default) means: there is no faulty column
TQString desc error message and detailed description, both empty by default
bool allowToDiscardChanges True if changes can be discarded, false by default If true, additional "Discard changes" messagebox b...
TQPtrListIterator< TableSchema > ListIterator Iterator for tables list.
Variables like fieldname or tablename.fieldname
Provides a data-driven (record-based) tabular view.
KexiDialogTempData * tempData() const
bool proposeOpeningInTextViewModeBecauseOfProblems
static bool decodeSingle(TQDropEvent *e, TQString &sourceMimeType, TQString &sourceName, TQString &field)
Kexi's main window interface This interface is implemented by KexiMainWindowImpl class.
virtual KexiProject * project()=0 Project data of currently opened project or NULL if no project here yet.
Information about a single object that can be instantiated using Kexi Part.
KexiDB::Connection * dbConnection() const
virtual KexiDB::SchemaData * storeNewData(const KexiDB::SchemaData &sdata, bool &cancel)
void slotBeforeCellChanged(KexiTableItem *item, int colnum, TQVariant &newValue, KexiDB::ResultInfo *result) Called before cell change in tableview.
KexiDB::BaseExpr * parseExpressionString(const TQString &fullString, int &token, bool allowRelationalOperator)
void initTableRows() Called to have all rows empty.
virtual tristate beforeSwitchTo(int mode, bool &dontStore)
void showFieldsAndRelationsForQuery(KexiDB::QuerySchema *query, KexiDB::ResultInfo &result) convenience method equal to showFieldsOrRelationsForQueryInternal(query, true, true)
void showFieldsForQuery(KexiDB::QuerySchema *query, KexiDB::ResultInfo &result) convenience method equal to showFieldsOrRelationsForQueryInternal(query, true, false)
KexiTableItem * createNewRow(const TQString &tableName, const TQString &fieldName, bool visible) const
void initTableColumns() Called just once.
virtual tristate storeData(bool dontAsk=false)
virtual tristate afterSwitchFrom(int mode)
bool buildSchema(TQString *errMsg=0)
void slotNewItemAppendedForAfterDeletingInSpreadSheetMode() Reaction on appending a new item after deleting one.
virtual KoProperty::Set * propertySet()
void showRelationsForQuery(KexiDB::QuerySchema *query, KexiDB::ResultInfo &result) convenience method equal to showFieldsOrRelationsForQueryInternal(query, false, true)
void showFieldsOrRelationsForQueryInternal(KexiDB::QuerySchema *query, bool showFields, bool showRelations, KexiDB::ResultInfo &result)
KoProperty::Set * createPropertySet(int row, const TQString &tableName, const TQString &fieldName, bool newOne=false)
Temporary data kept in memory while switching between Query Dialog's views.
KexiDB::QuerySchema * takeQuery() Takes query associated with this data (without deleting) and returns it.
KexiDB::QuerySchema * query() const
bool queryChangedInPreviousView
void setQuery(KexiDB::QuerySchema *query)
KexiDB::Field * field() const
void setRelatedDataEditable(bool set)
void setRelatedData(KexiTableViewData *data)
Base class for single view embeddable of in KexiDialogBase.
virtual bool dirty() const
virtual tristate storeData(bool dontAsk=false)
virtual void propertySetSwitched()
void propertySetReloaded(bool preservePrevSelection=false, const TQCString &propertyToSelect=TQCString())
bool storeDataBlock(const TQString &dataString, const TQString &dataID=TQString())
bool loadDataBlock(TQString &dataString, const TQString &dataID=TQString(), bool canBeEmpty=false)
KexiDialogBase * parentDialog() const
KexiMainWindow * mainWin() const
3-state logical type with three values: true, false and cancelled and convenient operators.
KEXI_DB_EXPORT bool splitToTableAndFieldParts(const TQString &string, TQString &tableName, TQString &fieldName, SplitToTableAndFieldPartsOptions option=FailIfNoTableOrFieldName)
@ SetFieldNameIfNoTableName see splitToTableAndFieldParts()
KEXIUTILS_EXPORT TQString identifierExpectedMessage(const TQString &valueName, const TQVariant &v)
KEXIUTILS_EXPORT bool isIdentifier(const TQString &s)
@ TextViewMode Also known as SQL View Mode.
@ NoViewMode In KexiViewBase::afterSwitchFrom() and KexiViewBase::beforeSwitchTo() means that parent dialog of the...
|