Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/forms/kexidatasourcepage.h
Show All 15 Lines | 1 | /* This file is part of the KDE project | |||
---|---|---|---|---|---|
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | * Boston, MA 02110-1301, USA. | 17 | * Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | #ifndef KEXIDATASOURCEPAGE_H | 19 | #ifndef KEXIDATASOURCEPAGE_H | ||
20 | #define KEXIDATASOURCEPAGE_H | 20 | #define KEXIDATASOURCEPAGE_H | ||
21 | 21 | | |||
22 | #include "kexiformutils_export.h" | 22 | #include "kexiformutils_export.h" | ||
23 | #include <config-kexi.h> | 23 | #include <config-kexi.h> | ||
24 | #include <widget/properties/KexiPropertyPaneViewBase.h> | | |||
25 | | ||||
26 | #include <KDbField> | 24 | #include <KDbField> | ||
27 | #include <KDbUtils> | 25 | #include <KDbUtils> | ||
28 | #include <KDbTableOrQuerySchema> | 26 | #include <KDbTableOrQuerySchema> | ||
29 | 27 | | |||
30 | #include <KPropertySet> | 28 | #include <KPropertySet> | ||
31 | 29 | | |||
30 | #include <QWidget> | ||||
31 | | ||||
32 | class KexiDataSourceComboBox; | 32 | class KexiDataSourceComboBox; | ||
33 | class KexiFieldComboBox; | 33 | class KexiFieldComboBox; | ||
34 | class KexiFieldListView; | 34 | class KexiFieldListView; | ||
35 | class KexiProject; | 35 | class KexiProject; | ||
36 | class QToolButton; | 36 | class QToolButton; | ||
37 | class QLabel; | 37 | class QLabel; | ||
38 | class QVBoxLayout; | ||||
39 | class QGridLayout; | ||||
40 | class QSpacerItem; | ||||
38 | 41 | | |||
39 | //! A page within form designer's property tabbed pane, providing data source editor | 42 | //! A page within form designer's property tabbed pane, providing data source editor | ||
40 | class KEXIFORMUTILS_EXPORT KexiDataSourcePage : public KexiPropertyPaneViewBase | 43 | class KEXIFORMUTILS_EXPORT KexiDataSourcePage : public QWidget | ||
41 | { | 44 | { | ||
42 | Q_OBJECT | 45 | Q_OBJECT | ||
43 | 46 | | |||
44 | public: | 47 | public: | ||
45 | explicit KexiDataSourcePage(QWidget *parent); | 48 | explicit KexiDataSourcePage(QWidget *parent = 0); | ||
46 | virtual ~KexiDataSourcePage(); | 49 | virtual ~KexiDataSourcePage(); | ||
47 | 50 | | |||
51 | //QSize sizeHint() const Q_DECL_OVERRIDE { return QSize(); } | ||||
52 | | ||||
53 | enum AssignFlag { | ||||
54 | NoFlags = 0, | ||||
55 | ForceAssign = 1 | ||||
56 | }; | ||||
57 | Q_DECLARE_FLAGS(AssignFlags, AssignFlag) | ||||
58 | | ||||
48 | //! @return name plugin ID of selected item (usually a table or a query). Can return an empty string. | 59 | //! @return name plugin ID of selected item (usually a table or a query). Can return an empty string. | ||
49 | QString selectedPluginId() const; | 60 | QString selectedPluginId() const; | ||
50 | 61 | | |||
51 | //! @return name of selected table or query. | 62 | //! @return name of selected table or query. | ||
52 | QString selectedName() const; | 63 | QString selectedName() const; | ||
53 | 64 | | |||
54 | public Q_SLOTS: | 65 | public Q_SLOTS: | ||
55 | void setProject(KexiProject *prj); | 66 | void setProject(KexiProject *prj); | ||
56 | void clearFormDataSourceSelection(bool alsoClearComboBox = true); | 67 | void clearFormDataSourceSelection(bool alsoClearComboBox = true); | ||
57 | void clearWidgetDataSourceSelection(); | 68 | void clearWidgetDataSourceSelection(); | ||
58 | 69 | | |||
59 | //! Sets data source of a currently selected form. | 70 | //! Sets data source of a currently selected form. | ||
60 | //! This is performed on form initialization and on activating. | 71 | //! This is performed on form initialization and on activating. | ||
61 | void setFormDataSource(const QString& pluginId, const QString& name); | 72 | void setFormDataSource(const QString& pluginId, const QString& name); | ||
62 | 73 | | |||
63 | //! Receives a pointer to a new property \a set (from KexiFormView::managerPropertyChanged()) | 74 | //! Receives a pointer to a new property \a set (from KexiFormView::managerPropertyChanged()) | ||
64 | void assignPropertySet(KPropertySet* propertySet); | 75 | void assignPropertySet(KPropertySet* propertySet, AssignFlags flags = NoFlags); | ||
65 | 76 | | |||
66 | Q_SIGNALS: | 77 | Q_SIGNALS: | ||
67 | //! Signal emitted when helper button 'go to selected data source' is clicked. | 78 | //! Signal emitted when helper button 'go to selected data source' is clicked. | ||
68 | void jumpToObjectRequested(const QString& mime, const QString& name); | 79 | void jumpToObjectRequested(const QString& mime, const QString& name); | ||
69 | 80 | | |||
70 | //! Signal emitted when form's data source has been changed. It's connected to the Form Manager. | 81 | //! Signal emitted when form's data source has been changed. It's connected to the Form Manager. | ||
71 | void formDataSourceChanged(const QString& mime, const QString& name); | 82 | void formDataSourceChanged(const QString& mime, const QString& name); | ||
72 | 83 | | |||
Show All 16 Lines | 94 | protected Q_SLOTS: | |||
89 | void slotInsertSelectedFields(); | 100 | void slotInsertSelectedFields(); | ||
90 | void slotFieldListViewSelectionChanged(); | 101 | void slotFieldListViewSelectionChanged(); | ||
91 | void slotFieldDoubleClicked(const QString& sourcePluginId, const QString& sourceName, | 102 | void slotFieldDoubleClicked(const QString& sourcePluginId, const QString& sourceName, | ||
92 | const QString& fieldName); | 103 | const QString& fieldName); | ||
93 | 104 | | |||
94 | protected: | 105 | protected: | ||
95 | void updateSourceFieldWidgetsAvailability(); | 106 | void updateSourceFieldWidgetsAvailability(); | ||
96 | 107 | | |||
108 | QVBoxLayout *m_mainLyr; | ||||
109 | QGridLayout *m_formLyr; | ||||
97 | KexiFieldComboBox *m_widgetDataSourceCombo; | 110 | KexiFieldComboBox *m_widgetDataSourceCombo; | ||
98 | QWidget *m_widgetDataSourceComboSpacer; | 111 | QWidget *m_widgetDataSourceContainer; | ||
99 | KexiDataSourceComboBox* m_formDataSourceCombo; | 112 | KexiDataSourceComboBox* m_formDataSourceCombo; | ||
100 | QWidget *m_formDataSourceComboSpacer; | 113 | QWidget *m_formDataSourceComboSpacer; | ||
101 | QLabel *m_dataSourceLabel, *m_noDataSourceAvailableLabel, *m_widgetDSLabel; | 114 | QLabel *m_noDataSourceAvailableLabel; | ||
102 | QToolButton *m_gotoButton; | 115 | QToolButton *m_gotoButton; | ||
103 | QString m_noDataSourceAvailableSingleText; | 116 | QString m_noDataSourceAvailableSingleText; | ||
104 | QString m_noDataSourceAvailableMultiText; | 117 | QString m_noDataSourceAvailableMultiText; | ||
105 | bool m_insideClearFormDataSourceSelection; | 118 | bool m_insideClearFormDataSourceSelection; | ||
119 | bool m_slotWidgetDataSourceTextChangedEnabled; | ||||
106 | #ifdef KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT | 120 | #ifdef KEXI_AUTOFIELD_FORM_WIDGET_SUPPORT | ||
107 | KexiFieldListView* m_availableFieldsLabel; | 121 | KexiFieldListView* m_availableFieldsLabel; | ||
108 | KexiFieldListView* m_fieldListView; | 122 | KexiFieldListView* m_fieldListView; | ||
109 | QLabel *m_mousePointerLabel; | 123 | QLabel *m_mousePointerLabel; | ||
110 | QLabel *m_availableFieldsDescriptionLabel; | 124 | QLabel *m_availableFieldsDescriptionLabel; | ||
111 | QToolButton *m_addField; | 125 | QToolButton *m_addField; | ||
112 | #else | 126 | #else | ||
113 | KDbTableOrQuerySchema *m_tableOrQuerySchema; //!< temp. | 127 | KDbTableOrQuerySchema *m_tableOrQuerySchema; //!< temp. | ||
114 | #endif | 128 | #endif | ||
115 | 129 | | |||
116 | //! Used only in assignPropertySet() to check whether we already have the set assigned | 130 | //! Used only in assignPropertySet() to check whether we already have the set assigned | ||
117 | QString m_currentObjectName; | 131 | QString m_currentObjectName; | ||
118 | }; | 132 | }; | ||
119 | 133 | | |||
120 | #endif | 134 | #endif |