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>
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.
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.
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.
21
#ifndef FORMCONNECTIONDIALOG_H
22
#define FORMCONNECTIONDIALOG_H
27
#include <kexi_export.h>
37
class KexiTableViewData;
39
namespace KFormDesigner
43
class ConnectionBuffer;
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
54
ConnectionDialog(Form *form, QWidget *parent);
57
/*! Displays as modal dialog, to edit connections in Form::connectionBuffer(). */
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.
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);
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);
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. */
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);
97
void slotCellSelected(int col, int row);
98
void slotRowInserted(KexiDB::RecordData*, bool);
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();
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;