kexi

kexiformmanager.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KEXIFORMMANAGER_H
00021 #define KEXIFORMMANAGER_H
00022 
00023 #include <formmanager.h>
00024 #include <kexipart.h>
00025 
00026 class KCommand;
00027 class KexiFormView;
00028 
00031 class KEXIFORMUTILS_EXPORT KexiFormManager : public KFormDesigner::FormManager
00032 {
00033     Q_OBJECT
00034 
00035     public:
00036         KexiFormManager(KexiPart::Part *parent, const char* name = 0);
00037         virtual ~KexiFormManager();
00038 
00039         virtual KAction* action( const char* name );
00040         virtual void enableAction( const char* name, bool enable );
00041 
00042     public slots:
00044         void setFormDataSource(const QCString& mime, const QCString& name);
00045 
00052         void setDataSourceFieldOrExpression(const QString& string, const QString& caption, 
00053             KexiDB::Field::Type type);
00054 
00056         void insertAutoFields(const QString& sourceMimeType, const QString& sourceName,
00057             const QStringList& fields);
00058 
00059     protected slots:
00060         void slotHistoryCommandExecuted();
00061 
00062     protected:
00063         inline QString translateName( const char* name ) const;
00064 
00065     private:
00067         KexiFormView* activeFormViewWidget() const;
00068 
00069 //      virtual bool loadFormFromDomInternal(Form *form, QWidget *container, QDomDocument &inBuf);
00070 //      virtual bool saveFormToStringInternal(Form *form, QString &dest, int indent = 0);
00071 
00072         KexiPart::Part* m_part;
00073 };
00074 
00075 QString KexiFormManager::translateName( const char* name ) const
00076 {
00077     QString n( name );
00078     //translate to our name space:
00079     if (n.startsWith("align_") || n.startsWith("adjust_") || n.startsWith("layout_")
00080         || n=="format_raise" || n=="format_raise" || n=="taborder" | n=="break_layout")
00081     {
00082         n.prepend("formpart_");
00083     }
00084     return n;
00085 }
00086 
00087 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys