~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kexi/formeditor/connectiondialog.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
 
3
   Copyright (C) 2004-2009 Jarosław Staniek <staniek@kde.org>
 
4
 
 
5
   This library is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU Library General Public
 
7
   License as published by the Free Software Foundation; either
 
8
   version 2 of the License, or (at your option) any later version.
 
9
 
 
10
   This library is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
   Library General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU Library General Public License
 
16
   along with this library; see the file COPYING.LIB.  If not, write to
 
17
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
 * Boston, MA 02110-1301, USA.
 
19
*/
 
20
 
 
21
#ifndef FORMCONNECTIONDIALOG_H
 
22
#define FORMCONNECTIONDIALOG_H
 
23
 
 
24
#include <QLabel>
 
25
#include <kdialog.h>
 
26
 
 
27
#include <kexi_export.h>
 
28
 
 
29
namespace KexiDB
 
30
{
 
31
class ResultInfo;
 
32
class RecordData;
 
33
}
 
34
 
 
35
class QLabel;
 
36
class KexiTableView;
 
37
class KexiTableViewData;
 
38
 
 
39
namespace KFormDesigner
 
40
{
 
41
 
 
42
class Form;
 
43
class ConnectionBuffer;
 
44
class Connection;
 
45
 
 
46
 
 
47
/*! This dialog is used to edit the connections of a form. It uses KexiTableView for this. There is also a details widget (icon + text)) that shows correctness
 
48
  of current connection.  */
 
49
class KFORMEDITOR_EXPORT ConnectionDialog : public KDialog
 
50
{
 
51
    Q_OBJECT
 
52
 
 
53
public:
 
54
    ConnectionDialog(Form *form, QWidget *parent);
 
55
    ~ConnectionDialog();
 
56
 
 
57
    /*! Displays as modal dialog, to edit connections in Form::connectionBuffer(). */
 
58
    void exec();
 
59
 
 
60
protected:
 
61
    /*! Used when connection is ok. Displays a message in details widget and changes icon in 'OK?' column. */
 
62
    void setStatusOk(KexiDB::RecordData *record = 0);
 
63
    /*! Used when connection is wrong. Displays a message in details widget and changes icon in 'OK?' column. \a msg is
 
64
      the message explaining what's wrong. */
 
65
    void setStatusError(const QString &msg, KexiDB::RecordData *record = 0);
 
66
    //! Inits table data, columns, etc.
 
67
    void initTable();
 
68
    /*! Updates the widget list (shown in receiver and sender columns). Then fill in the table with the connections in m_buffer. */
 
69
    void updateTableData();
 
70
    /*! Updates the slot list, according to the receiver name, and only shows those who are compatible with signal args. */
 
71
    void updateSlotList(KexiDB::RecordData *record);
 
72
    //! Updates the signal list, according to the sender name.
 
73
    void updateSignalList(KexiDB::RecordData *record);
 
74
 
 
75
protected slots:
 
76
    /*! Slot called when the user modifies a cell. Signal and/or slot cells are cleared if necessary (not valid anymore). */
 
77
    void slotCellChanged(KexiDB::RecordData *, int, QVariant&, KexiDB::ResultInfo*);
 
78
    /*! This function checks if the connection represented by \a record is valid. It checks if all args (sender, receiver, signal and slot)
 
79
     are given, and then if signal/slot args are compatible (should be always true, as we don't show non-compatible slots). It calls \ref setStatusOk()
 
80
     or \ref setStatusError() following the result of checks. */
 
81
    void checkConnection(KexiDB::RecordData *record);
 
82
 
 
83
    /*! Hides the dialog and allow the user to create the Connection by drag-and-drop in the Form itself. Currently disabled in the GUI.
 
84
     \sa FormManager::startCreatingConnection()  */
 
85
    void newItemByDragnDrop();
 
86
    /*! Creates a new item. It just moves the cursor to the last empty row. */
 
87
    void newItem();
 
88
    void removeItem();
 
89
 
 
90
    /*! This slot is called when the user ends connection creation (when in drag-and-drop mode). The dialog is restored,
 
91
      and the created connection is added to the list. */
 
92
    void slotConnectionCreated(KFormDesigner::Form *form, KFormDesigner::Connection &connection);
 
93
    /*! This slot is called when the user aborts connection creation (when in drag-and-drop mode). The dialog is restored,
 
94
      and an empty connection is created. */
 
95
    void slotConnectionAborted(KFormDesigner::Form *form);
 
96
 
 
97
    void slotCellSelected(int col, int row);
 
98
    void slotRowInserted(KexiDB::RecordData*, bool);
 
99
 
 
100
    /*! Slot called when the user presses 'Ok' button. The Form::connectionBuffer() is deleted, created again and filled with Connection.
 
101
     If the user presses 'Cancel', nothing happens. */
 
102
    virtual void slotOk();
 
103
 
 
104
protected:
 
105
    Form *m_form;
 
106
    ConnectionBuffer *m_buffer;
 
107
    KexiTableView  *m_table;
 
108
    KexiTableViewData  *m_data;
 
109
    KexiTableViewData *m_widgetsColumnData,
 
110
    *m_slotsColumnData, *m_signalsColumnData;
 
111
    QLabel  *m_pixmapLabel, *m_textLabel;
 
112
    KPushButton *m_addButton, *m_removeButton;
 
113
};
 
114
 
 
115
}
 
116
 
 
117
#endif