Changeset View
Changeset View
Standalone View
Standalone View
kexi/plugins/tables/kexitabledesigner_dataview.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | |||||
71 | } | 71 | } | ||
72 | 72 | | |||
73 | tristate KexiTableDesigner_DataView::afterSwitchFrom(Kexi::ViewMode mode) | 73 | tristate KexiTableDesigner_DataView::afterSwitchFrom(Kexi::ViewMode mode) | ||
74 | { | 74 | { | ||
75 | Q_UNUSED(mode); | 75 | Q_UNUSED(mode); | ||
76 | 76 | | |||
77 | if (tempData()->tableSchemaChangedInPreviousView) { | 77 | if (tempData()->tableSchemaChangedInPreviousView) { | ||
78 | KexiUtils::WaitCursor wait; | 78 | KexiUtils::WaitCursor wait; | ||
79 | KexiDB::Cursor *c | 79 | KexiDB::Connection *conn = KexiMainWindowIface::global()->project()->dbConnection(); | ||
80 | = KexiMainWindowIface::global()->project()->dbConnection()->prepareQuery( | 80 | KexiDB::Cursor *cursor = conn->prepareQuery(*tempData()->table); | ||
81 | *tempData()->table); | 81 | if (!cursor) { | ||
82 | if (!c) | | |||
83 | return false; | 82 | return false; | ||
84 | setData(c); | 83 | } | ||
84 | if (!setData(cursor)) { | ||||
85 | conn->deleteCursor(cursor); | ||||
86 | return false; | ||||
87 | } | ||||
85 | tempData()->tableSchemaChangedInPreviousView = false; | 88 | tempData()->tableSchemaChangedInPreviousView = false; | ||
86 | } | 89 | } | ||
87 | return true; | 90 | return true; | ||
88 | } | 91 | } | ||
89 | 92 | | |||
90 | KexiTablePart::TempData* KexiTableDesigner_DataView::tempData() const | 93 | KexiTablePart::TempData* KexiTableDesigner_DataView::tempData() const | ||
91 | { | 94 | { | ||
92 | return static_cast<KexiTablePart::TempData*>(window()->data()); | 95 | return static_cast<KexiTablePart::TempData*>(window()->data()); | ||
93 | } | 96 | } | ||
94 | 97 | | |||
95 | #include "kexitabledesigner_dataview.moc" | 98 | #include "kexitabledesigner_dataview.moc" |