File indexing completed on 2024-05-12 16:39:46

0001 /* This file is part of the KDE project
0002    Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef KFORMDESIGNEREVENTS_H
0021 #define KFORMDESIGNEREVENTS_H
0022 
0023 #include "kformdesigner_export.h"
0024 
0025 #include <QList>
0026 #include <QString>
0027 
0028 class QDomNode;
0029 
0030 namespace KFormDesigner
0031 {
0032 
0033 class KFORMDESIGNER_EXPORT Connection
0034 {
0035 public:
0036     Connection(const QString &sender, const QString &signal,
0037                const QString &receiver, const QString &slot);
0038     Connection();
0039 
0040     ~Connection();
0041 
0042     QString sender() const;
0043     QString receiver() const;
0044     QString signal() const;
0045     QString slot() const;
0046 
0047     void setSender(const QString &v);
0048     void setReceiver(const QString &v);
0049     void setSignal(const QString &v);
0050     void setSlot(const QString &v);
0051 
0052 private:
0053     class Private;
0054     Private* const d;
0055 };
0056 
0057 typedef QList<Connection*> ConnectionList;
0058 
0059 class KFORMDESIGNER_EXPORT ConnectionBuffer : public ConnectionList
0060 {
0061 public:
0062     ConnectionBuffer();
0063     ~ConnectionBuffer();
0064 
0065     void save(QDomNode &parentNode);
0066     void load(const QDomNode &parentNode);
0067 
0068     /*! This function is called when a widget is renamed from \a oldname
0069     to \a newname. All the Connections for this widget are updated. */
0070     void fixName(const QString &oldname, const QString &newName);
0071 
0072     ConnectionBuffer* allConnectionsForWidget(const QString &widget);
0073     void saveAllConnectionsForWidget(const QString &widget, QDomNode &parentNode);
0074     void removeAllConnectionsForWidget(const QString &widget);
0075 };
0076 
0077 }
0078 
0079 #endif
0080