Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/tables/kexitablepart.h
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 39 | public: | |||
---|---|---|---|---|---|
53 | 53 | | |||
54 | //! Connection used for retrieving definition of the query | 54 | //! Connection used for retrieving definition of the query | ||
55 | KDbConnection* connection(); | 55 | KDbConnection* connection(); | ||
56 | 56 | | |||
57 | /*! true, if \a table member has changed in previous view. Used on view switching. | 57 | /*! true, if \a table member has changed in previous view. Used on view switching. | ||
58 | We're checking this flag to see if we should refresh data for DataViewMode. */ | 58 | We're checking this flag to see if we should refresh data for DataViewMode. */ | ||
59 | bool tableSchemaChangedInPreviousView; | 59 | bool tableSchemaChangedInPreviousView; | ||
60 | 60 | | |||
61 | //! @c true indicates that closeListener() should close the table designer window. | ||||
62 | //! This is disabled in one case: upon saving of the design of this table. | ||||
63 | //! @see KexiTableDesignerView::storeData() | ||||
64 | bool closeWindowOnCloseListener = true; | ||||
65 | | ||||
61 | protected: | 66 | protected: | ||
62 | //! Closes listener - this temp-data acts as a listener for tracking changes in table schema | 67 | //! Closes listener - this temp-data acts as a listener for tracking changes in table schema | ||
63 | //! that is displayed in the window's data view. | 68 | //! that is displayed in the window's data view. | ||
64 | //! It just calls KexiDataTableView::setData(nullptr) is there's data set for the view | 69 | //! It just calls KexiDataTableView::setData(nullptr) is there's data set for the view | ||
65 | //! (i.e. if KexiDataTableView::tableView()->data() is not @c nullptr). | 70 | //! (i.e. if KexiDataTableView::tableView()->data() is not @c nullptr). | ||
66 | tristate closeListener() override; | 71 | tristate closeListener() override; | ||
67 | 72 | | |||
68 | private: | 73 | private: | ||
74 | void closeDataInDataView(); | ||||
75 | | ||||
69 | Q_DISABLE_COPY(KexiTablePartTempData) | 76 | Q_DISABLE_COPY(KexiTablePartTempData) | ||
70 | class Private; | 77 | class Private; | ||
71 | Private * const d; | 78 | Private * const d; | ||
72 | }; | 79 | }; | ||
73 | 80 | | |||
74 | //! @short Kexi Table Designer plugin | 81 | //! @short Kexi Table Designer plugin | ||
75 | class KexiTablePart : public KexiPart::Part | 82 | class KexiTablePart : public KexiPart::Part | ||
76 | { | 83 | { | ||
77 | Q_OBJECT | 84 | Q_OBJECT | ||
78 | 85 | | |||
79 | public: | 86 | public: | ||
80 | KexiTablePart(QObject *parent, const QVariantList &); | 87 | KexiTablePart(QObject *parent, const QVariantList &); | ||
81 | virtual ~KexiTablePart(); | 88 | virtual ~KexiTablePart(); | ||
82 | 89 | | |||
83 | virtual tristate remove(KexiPart::Item *item); | 90 | virtual tristate remove(KexiPart::Item *item); | ||
84 | 91 | | |||
85 | virtual tristate rename(KexiPart::Item *item, const QString& newName); | 92 | virtual tristate rename(KexiPart::Item *item, const QString& newName); | ||
86 | 93 | | |||
87 | //! Close objects that listenen to changes of the table schema @a table. | 94 | /** | ||
88 | //! Asks the user for approval if there is at least one object that listens for changes | 95 | * Closes objects that listenen to changes of the table schema @a table, i.e. use it. | ||
89 | //! of the schema. If there is no approval, returns @c cancelled. | 96 | * | ||
90 | //! On failure returns @c false. | 97 | * These objects can be currently: | ||
91 | //! If @a window is @c nullptr, @c true is returned immediately because there is no window to | 98 | * - lookup fields of other tables | ||
92 | //! care about. | 99 | * - queries using the table directly or via lookup fields | ||
93 | //! Special case: listener that is equal to window->data() will be silently closed | 100 | * - forms and reports that use the table directly as data source or via query. | ||
94 | //! without asking for confirmation. It is not counted when looking for objects that | 101 | * | ||
95 | //! are "blocking" changes of @a table. | 102 | * Scripts referencing the table programatically are not analyzed, so they can fail on next | ||
96 | //! This exception is needed because the listener handles the data view's lifetime | 103 | * execution. | ||
97 | //! and the data view should be reset silently without bothering the user. | 104 | * | ||
98 | //! See KexiTablePartTempData::closeListener() | 105 | * This method asks the user for approval if there is at least one object that listens for | ||
99 | static tristate askForClosingObjectsUsingTableSchema( | 106 | * changes of the schema (altering, renaming or removal). If there is no approval, returns | ||
100 | KexiWindow *window, KDbConnection *conn, | 107 | * @c cancelled. On failure @c false is returned. If @a window is @c nullptr, @c true is | ||
101 | KDbTableSchema *table, const QString& msg); | 108 | * returned immediately because there is no window to care about. | ||
109 | * | ||||
110 | * Special case: listener for the table @a table will be silently closed without asking for | ||||
111 | * confirmation. It is ignored when looking for objects that are "blocking" changes | ||||
112 | * of @a table. This exception is needed because the listener handles the data view's lifetime | ||||
113 | * and the data view should be reset silently without bothering the user. | ||||
114 | * | ||||
115 | * @see KexiTablePartTempData::closeListener() | ||||
116 | * @see KexiQueryPart::askForClosingObjectsUsingQuerySchema() | ||||
117 | */ | ||||
118 | static tristate askForClosingObjectsUsingTableSchema(KexiWindow *window, KDbConnection *conn, | ||||
119 | KDbTableSchema *table, | ||||
120 | const KLocalizedString &msg); | ||||
102 | 121 | | |||
103 | virtual KLocalizedString i18nMessage(const QString& englishMessage, | 122 | virtual KLocalizedString i18nMessage(const QString& englishMessage, | ||
104 | KexiWindow* window) const; | 123 | KexiWindow* window) const; | ||
105 | 124 | | |||
106 | KexiLookupColumnPage* lookupColumnPage() const; | 125 | KexiLookupColumnPage* lookupColumnPage() const; | ||
107 | 126 | | |||
108 | protected: | 127 | protected: | ||
109 | KexiWindowData* createWindowData(KexiWindow* window) override Q_REQUIRED_RESULT; | 128 | KexiWindowData* createWindowData(KexiWindow* window) override Q_REQUIRED_RESULT; | ||
Show All 19 Lines |