~ubuntu-branches/debian/sid/kexi/sid

« back to all changes in this revision

Viewing changes to src/plugins/forms/kexiformmanager.h

  • Committer: Package Import Robot
  • Author(s): Pino Toscano
  • Date: 2017-06-24 20:10:10 UTC
  • Revision ID: package-import@ubuntu.com-20170624201010-5lrzd5r2vwthwifp
Tags: upstream-3.0.1.1
Import upstream version 3.0.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2005-2009 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
 
 
20
#ifndef KEXIFORMMANAGER_H
 
21
#define KEXIFORMMANAGER_H
 
22
 
 
23
#include "kexiformpart.h"
 
24
 
 
25
#include <KDbField>
 
26
 
 
27
class KexiFormView;
 
28
class KActionCollection;
 
29
class KexiFormManagerPrivate;
 
30
 
 
31
namespace KFormDesigner {
 
32
class WidgetLibrary;
 
33
class WidgetTreeWidget;
 
34
class ActionGroup;
 
35
class Command;
 
36
}
 
37
 
 
38
//! @internal
 
39
class KEXIFORMUTILS_EXPORT KexiFormManager : public QObject
 
40
{
 
41
    Q_OBJECT
 
42
 
 
43
public:
 
44
    static KexiFormManager* self();
 
45
 
 
46
    //! Called by KexiFormPart()
 
47
    void init(KexiFormPart *part, KFormDesigner::WidgetTreeWidget *widgetTree);
 
48
 
 
49
    virtual QAction* action(const char* name);
 
50
    virtual void enableAction(const char* name, bool enable);
 
51
 
 
52
    KFormDesigner::WidgetLibrary* library() const;
 
53
 
 
54
    /*! @return action group containing "insert widget" actions for each widget. */
 
55
    KFormDesigner::ActionGroup* widgetActionGroup() const;
 
56
 
 
57
    //! @internal
 
58
    KexiFormManager();
 
59
 
 
60
    virtual ~KexiFormManager();
 
61
 
 
62
public Q_SLOTS:
 
63
    //! Receives signal from KexiDataSourcePage about changed form's data source
 
64
    void setFormDataSource(const QString& mime, const QString& name);
 
65
 
 
66
    /*! Receives signal from KexiDataSourcePage about changed widget's data source.
 
67
     This is because we couldn't pass objects like KDbQueryColumnInfo.
 
68
 
 
69
     Also sets following things in KexiDBAutoField:
 
70
     - caption related to the data source
 
71
     - data type related to the data source */
 
72
    void setDataSourceFieldOrExpression(const QString& string, const QString& caption,
 
73
                                        KDbField::Type type);
 
74
 
 
75
    /*! Receives signal from KexiDataSourcePage and inserts autofields onto the current form. */
 
76
    void insertAutoFields(const QString& sourcePartClass, const QString& sourceName,
 
77
                          const QStringList& fields);
 
78
 
 
79
    /*! For debugging purposes only:
 
80
     shows a text window containing contents of .ui XML definition of the current form. */
 
81
    void showFormUICode();
 
82
 
 
83
protected Q_SLOTS:
 
84
    void slotHistoryCommandExecuted(KFormDesigner::Command *command);
 
85
    void slotWidgetCreatedByFormsLibrary(QWidget* widget);
 
86
    void slotWidgetActionToggled(const QByteArray& action);
 
87
    void slotAssignAction();
 
88
    void slotPointerClicked();
 
89
 
 
90
protected:
 
91
    QString translateName(const char* name) const;
 
92
 
 
93
private:
 
94
    //! Helper: return active form's view widget or 0 if there's no active form having such widget
 
95
    KexiFormView* activeFormViewWidget() const;
 
96
 
 
97
    //! Called by init()
 
98
    void createActions(KActionCollection* collection);
 
99
 
 
100
    friend class KexiFormManagerPrivate;
 
101
    KexiFormManagerPrivate * const d;
 
102
};
 
103
 
 
104
#endif