1
/* This file is part of the KDE project
2
Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
3
Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
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., 59 Temple Place - Suite 330,
18
Boston, MA 02111-1307, USA.
21
#ifndef FORMCONNECTIONDIALOG_H
22
#define FORMCONNECTIONDIALOG_H
25
#include <kdialogbase.h>
34
class KexiTableViewData;
37
namespace KFormDesigner {
40
class ConnectionBuffer;
44
/*! 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
45
of current connection. */
46
class KFORMEDITOR_EXPORT ConnectionDialog : public KDialogBase
51
ConnectionDialog(QWidget *parent);
52
~ConnectionDialog() {;}
54
/*! Displays as modal dialog, to edit connections in \ref Form::connectionBuffer(). */
55
void exec(Form *form);
58
/*! Used when connection is ok. Displays a message in details widget and changes icon in 'OK?' column. */
59
void setStatusOk(KexiTableItem *item = 0);
60
/*! Used when connection is wrong. Displays a message in details widget and changes icon in 'OK?' column. \a msg is
61
the message explaining what's wrong. */
62
void setStatusError(const QString &msg, KexiTableItem *item = 0);
63
//! Inits table data, columns, etc.
65
/*! Updates the widget list (shown in receiver and sender columns). Then fill in the table with the connections in m_buffer. */
66
void updateTableData();
67
/*! Updates the slot list, according to the receiver name, and only shows those who are compatible with signal args. */
68
void updateSlotList(KexiTableItem *item);
69
//! Updates the signal list, according to the sender name.
70
void updateSignalList(KexiTableItem *item);
73
/*! Slot called when the user modifies a cell. Signal and/or slot cells are cleared if necessary (not valid anymore). */
74
void slotCellChanged(KexiTableItem*, int, QVariant&, KexiDB::ResultInfo*);
75
/*! This function checks if the connection represented by KexiTableItem \a item is valid. It checks if all args (sender, receiver, signal and slot)
76
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()
77
or \ref setStatusError() following the result of checks. */
78
void checkConnection(KexiTableItem *item);
80
/*! Hides the dialog and allow the user to create the Connection by drag-and-drop in the Form itself. Currently disabled in the GUI.
81
\sa FormManager::startCreatingConnection() */
82
void newItemByDragnDrop();
83
/*! Creates a new item. It just moves the cursor to the last empty row. */
87
/*! This slot is called when the user ends connection creation (when in drag-and-drop mode). The dialog is restored,
88
and the created connection is added to the list. */
89
void slotConnectionCreated(KFormDesigner::Form *form, KFormDesigner::Connection &connection);
90
/*! This slot is called when the user aborts connection creation (when in drag-and-drop mode). The dialog is restored,
91
and an empty connection is created. */
92
void slotConnectionAborted(KFormDesigner::Form *form);
94
void slotCellSelected(int col, int row);
95
void slotRowInserted(KexiTableItem*,bool);
97
/*! Slot called when the user presses 'Ok' button. The \ref Form::connectionBuffer() is deleted, created again and filled with Connection.
98
If the user presses 'Cancel', nothing happens. */
99
virtual void slotOk();
102
enum {BAdd = 10, BRemove};
104
ConnectionBuffer *m_buffer;
105
KexiTableView *m_table;
106
KexiTableViewData *m_data;
107
KexiTableViewData *m_widgetsColumnData, *m_slotsColumnData, *m_signalsColumnData;
108
QLabel *m_pixmapLabel, *m_textLabel;
109
QIntDict<QButton> m_buttons; //! dict of button (for disabling them)