Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/queries/kexiquerypart.h
1 | /* This file is part of the KDE project | 1 | /* This file is part of the KDE project | ||
---|---|---|---|---|---|
2 | Copyright (C) 2003 Lucijan Busch <lucijan@kde.org> | 2 | Copyright (C) 2003 Lucijan Busch <lucijan@kde.org> | ||
3 | Copyright (C) 2004-2016 Jarosław Staniek <staniek@kde.org> | 3 | Copyright (C) 2004-2017 Jarosław Staniek <staniek@kde.org> | ||
4 | 4 | | |||
5 | This program is free software; you can redistribute it and/or | 5 | This program is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public | ||
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either | ||
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. | ||
9 | 9 | | |||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | 88 | public: | |||
96 | 96 | | |||
97 | virtual KLocalizedString i18nMessage(const QString& englishMessage, | 97 | virtual KLocalizedString i18nMessage(const QString& englishMessage, | ||
98 | KexiWindow* window) const; | 98 | KexiWindow* window) const; | ||
99 | 99 | | |||
100 | /*! Renames stored data pointed by \a item to \a newName. | 100 | /*! Renames stored data pointed by \a item to \a newName. | ||
101 | Reimplemented to mark the query obsolete by using KDbConnection::setQuerySchemaObsolete(). */ | 101 | Reimplemented to mark the query obsolete by using KDbConnection::setQuerySchemaObsolete(). */ | ||
102 | virtual tristate rename(KexiPart::Item *item, const QString& newName); | 102 | virtual tristate rename(KexiPart::Item *item, const QString& newName); | ||
103 | 103 | | |||
104 | /** | ||||
105 | * Closes objects that listenen to changes of the query schema @a query, i.e. use it. | ||||
106 | * | ||||
107 | * These objects can be currently: | ||||
108 | * - lookup fields of tables | ||||
109 | * - queries using the query directly (as subqueries) or via lookup fields | ||||
110 | * - forms and reports that use the query directly as data source or via query. | ||||
111 | * | ||||
112 | * Scripts referencing the query programatically are not analyzed, so they can fail on next | ||||
113 | * execution. | ||||
114 | * | ||||
115 | * This method asks the user for approval if there is at least one object that listens for | ||||
116 | * changes of the schema (altering or removal). If there is no approval, returns | ||||
117 | * @c cancelled. On failure @c false is returned. If @a window is @c nullptr, @c true is | ||||
118 | * returned immediately because there is no window to care about. | ||||
119 | * | ||||
120 | * @note Unlike renaming tables, renaming queries just marks the previous query object one as | ||||
121 | * "obsolete" using KDbConnection::setQuerySchemaObsolete() and keeps the existing actual object | ||||
122 | * in memory so there is no risk of accessing deleted object by other objects. | ||||
123 | * | ||||
124 | * Special case: listener for the query @a query will be silently closed without asking for | ||||
125 | * confirmation. It is ignored when looking for objects that are "blocking" changes | ||||
126 | * of @a query. This exception is needed because the listener handles the data view's lifetime | ||||
127 | * and the data view should be reset silently without bothering the user. | ||||
128 | * | ||||
129 | * @see KexiQueryPartTempData::closeListener() | ||||
130 | * @see KexiTablePart::askForClosingObjectsUsingTableSchema() | ||||
131 | */ | ||||
132 | static tristate askForClosingObjectsUsingQuerySchema(KexiWindow *window, KDbConnection *conn, | ||||
133 | KDbQuerySchema *query, | ||||
134 | const KLocalizedString &msg); | ||||
135 | | ||||
104 | protected: | 136 | protected: | ||
105 | KexiWindowData* createWindowData(KexiWindow* window) override Q_REQUIRED_RESULT; | 137 | KexiWindowData* createWindowData(KexiWindow* window) override Q_REQUIRED_RESULT; | ||
106 | 138 | | |||
107 | KexiView *createView(QWidget *parent, KexiWindow *window, KexiPart::Item *item, | 139 | KexiView *createView(QWidget *parent, KexiWindow *window, KexiPart::Item *item, | ||
108 | Kexi::ViewMode viewMode = Kexi::DataViewMode, | 140 | Kexi::ViewMode viewMode = Kexi::DataViewMode, | ||
109 | QMap<QString, QVariant> *staticObjectArgs = nullptr) override Q_REQUIRED_RESULT; | 141 | QMap<QString, QVariant> *staticObjectArgs = nullptr) override Q_REQUIRED_RESULT; | ||
110 | 142 | | |||
111 | virtual void initPartActions(); | 143 | virtual void initPartActions(); | ||
112 | virtual void initInstanceActions(); | 144 | virtual void initInstanceActions(); | ||
113 | 145 | | |||
114 | virtual KDbObject* loadSchemaObject(KexiWindow *window, | 146 | virtual KDbObject* loadSchemaObject(KexiWindow *window, | ||
115 | const KDbObject& object, Kexi::ViewMode viewMode, bool *ownedByWindow); | 147 | const KDbObject& object, Kexi::ViewMode viewMode, bool *ownedByWindow); | ||
116 | }; | 148 | }; | ||
117 | 149 | | |||
118 | #endif | 150 | #endif |