Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/forms/kexiformpart.h
1 | /* This file is part of the KDE project | 1 | /* This file is part of the KDE project | ||
---|---|---|---|---|---|
2 | Copyright (C) 2004 Lucijan Busch <lucijan@kde.org> | 2 | Copyright (C) 2004 Lucijan Busch <lucijan@kde.org> | ||
3 | Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr> | 3 | Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr> | ||
4 | Copyright (C) 2005-2009 Jarosław Staniek <staniek@kde.org> | 4 | Copyright (C) 2005-2017 Jarosław Staniek <staniek@kde.org> | ||
5 | 5 | | |||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or | ||
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public | ||
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either | ||
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. | ||
10 | 10 | | |||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
Show All 10 Lines | |||||
23 | #define KEXIFORMPART_H | 23 | #define KEXIFORMPART_H | ||
24 | 24 | | |||
25 | #include <kexi.h> | 25 | #include <kexi.h> | ||
26 | #include <kexipart.h> | 26 | #include <kexipart.h> | ||
27 | #include <kexiblobbuffer.h> | 27 | #include <kexiblobbuffer.h> | ||
28 | #include <KexiWindowData.h> | 28 | #include <KexiWindowData.h> | ||
29 | #include <kexiformview.h> | 29 | #include <kexiformview.h> | ||
30 | 30 | | |||
31 | #include <KDbTableSchemaChangeListener> | ||||
32 | | ||||
31 | class QDomDocument; | 33 | class QDomDocument; | ||
32 | namespace KFormDesigner | 34 | namespace KFormDesigner | ||
33 | { | 35 | { | ||
34 | class Form; | 36 | class Form; | ||
35 | class WidgetTreeWidget; | 37 | class WidgetTreeWidget; | ||
36 | } | 38 | } | ||
37 | class KDbFieldList; | 39 | class KDbFieldList; | ||
38 | class KexiDataSourcePage; | 40 | class KexiDataSourcePage; | ||
39 | 41 | | |||
40 | class KexiFormPartTempData : public KexiWindowData | 42 | class KexiFormPartTempData : public KexiWindowData, public KDbTableSchemaChangeListener | ||
41 | { | 43 | { | ||
42 | Q_OBJECT | 44 | Q_OBJECT | ||
43 | public: | 45 | public: | ||
44 | explicit KexiFormPartTempData(KexiWindow* parent); | 46 | KexiFormPartTempData(KexiWindow* parent, KDbConnection *conn); | ||
45 | ~KexiFormPartTempData(); | 47 | ~KexiFormPartTempData(); | ||
48 | | ||||
49 | //! Sets data source used for this data. | ||||
50 | //! If the previous data source is different and is not empty, listener for it will be unregistered. | ||||
51 | //! If the new data source is empty this temp-data object will be registered as a listener for it. | ||||
52 | void setDataSource(const QString &pluginId, const QString &dataSource); | ||||
53 | | ||||
46 | QPointer<KFormDesigner::Form> form; | 54 | QPointer<KFormDesigner::Form> form; | ||
47 | QPointer<KFormDesigner::Form> previewForm; | 55 | QPointer<KFormDesigner::Form> previewForm; | ||
48 | QString tempForm; | 56 | QString tempForm; | ||
49 | QPoint scrollViewContentsPos; //!< to preserve contents pos after switching | 57 | QPoint scrollViewContentsPos; //!< to preserve contents pos after switching | ||
50 | //! Used in KexiFormView::setUnsavedLocalBLOBs() | 58 | //! Used in KexiFormView::setUnsavedLocalBLOBs() | ||
51 | QHash<QWidget*, KexiBLOBBuffer::Id_t> unsavedLocalBLOBs; | 59 | QHash<QWidget*, KexiBLOBBuffer::Id_t> unsavedLocalBLOBs; | ||
52 | //! Used when loading a form from (temporary) XML in Data View | 60 | //! Used when loading a form from (temporary) XML in Data View | ||
53 | //! to get unsaved blobs collected at design mode. | 61 | //! to get unsaved blobs collected at design mode. | ||
54 | QHash<QByteArray, KexiBLOBBuffer::Id_t> unsavedLocalBLOBsByName; | 62 | QHash<QByteArray, KexiBLOBBuffer::Id_t> unsavedLocalBLOBsByName; | ||
63 | | ||||
64 | protected: | ||||
65 | //! This temp-data acts as a listener for tracking changes in table schema | ||||
66 | //! used by the form. This method closes the form on request. | ||||
67 | tristate closeListener() override; | ||||
68 | | ||||
69 | private: | ||||
70 | Q_DISABLE_COPY(KexiFormPartTempData) | ||||
71 | class Private; | ||||
72 | Private * const d; | ||||
55 | }; | 73 | }; | ||
56 | 74 | | |||
57 | //! Kexi Form Plugin | 75 | //! Kexi Form Plugin | ||
58 | /*! It just creates a \ref KexiFormView. See there for most of code. */ | 76 | /*! It just creates a \ref KexiFormView. See there for most of code. */ | ||
59 | class KEXIFORMUTILS_EXPORT KexiFormPart : public KexiPart::Part | 77 | class KEXIFORMUTILS_EXPORT KexiFormPart : public KexiPart::Part | ||
60 | { | 78 | { | ||
61 | Q_OBJECT | 79 | Q_OBJECT | ||
62 | 80 | | |||
Show All 33 Lines |