1 /* This file is part of the KDE project
2    Copyright (C) 2006-2008 Jarosław Staniek <staniek@kde.org>
3 
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public
6    License as published by the Free Software Foundation; either
7    version 2 of the License, or (at your option) any later version.
8 
9    This library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
13 
14    You should have received a copy of the GNU Library General Public License
15    along with this library; see the file COPYING.LIB.  If not, write to
16    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18 */
19 #ifndef KEXILOOKUPCOLUMNPAGE_H
20 #define KEXILOOKUPCOLUMNPAGE_H
21 
22 #include <widget/properties/KexiPropertyPaneViewBase.h>
23 
24 #include <KDbField>
25 #include <KDbUtils>
26 
27 #include <KPropertySet>
28 
29 class KexiProject;
30 
31 //! @short A page within table designer's property pane, providing lookup column editor.
32 /*! It's data model is basically KDbLookupFieldSchema class, but the page does
33  not create it directly but instead updates a property set that defines
34  the field currently selected in the designer.
35 
36  @todo not all features of KDbLookupFieldSchema class are displayed on this page yet
37  */
38 class KexiLookupColumnPage : public KexiPropertyPaneViewBase
39 {
40     Q_OBJECT
41 
42 public:
43     explicit KexiLookupColumnPage(QWidget *parent = 0);
44     virtual ~KexiLookupColumnPage();
45 
46 public Q_SLOTS:
47     void setProject(KexiProject *prj);
48     void clearRowSourceSelection(bool alsoClearComboBox = true);
49     void clearBoundColumnSelection();
50     void clearVisibleColumnSelection();
51 
52     //! Receives a pointer to a new property \a set (from KexiFormView::managerPropertyChanged())
53     void assignPropertySet(KPropertySet* propertySet);
54 
55 Q_SIGNALS:
56     //! Signal emitted when helper button 'Go to selected record sourcesource' is clicked.
57     void jumpToObjectRequested(const QString& mime, const QString& name);
58 
59 protected Q_SLOTS:
60     void slotRowSourceTextChanged(const QString &text);
61     void slotRowSourceChanged();
62     void slotGotoSelectedRowSource();
63     void slotBoundColumnTextChanged(const QString &text);
64     void slotBoundColumnSelected();
65     void slotVisibleColumnTextChanged(const QString &text);
66     void slotVisibleColumnSelected();
67 
68 protected:
69     void updateBoundColumnWidgetsAvailability();
70 
71     //! Used instead of m_propertySet->changeProperty() to honor m_propertySetEnabled
72     void changeProperty(const QByteArray &property, const QVariant &value);
73 
74 private:
75     class Private;
76     Private* const d;
77 };
78 
79 #endif
80