Ananas Library 0.9.5
edbfield.ui.h
1/****************************************************************************
2** $Id: edbfield.ui.h,v 1.16 2004/07/06 11:21:30 cibfx Exp $
3**
4** Code file of the edit database field plugin of Ananas
5** Designer and Engine applications
6**
7** Created : 20031201
8**
9** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved.
10**
11** This file is part of the Ananas Plugins of the Ananas
12** automation accounting system.
13**
14** This file may be distributed and/or modified under the terms of the
15** GNU General Public License version 2 as published by the Free Software
16** Foundation and appearing in the file LICENSE.GPL included in the
17** packaging of this file.
18**
19** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21**
22** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
23** See http://www.leaderit.ru/gpl/ for GPL licensing information.
24**
25** Contact org@leaderit.ru if any conditions of this licensing are
26** not clear to you.
27**
28**********************************************************************/
29
30/****************************************************************************
31** ui.h extension file, included from the uic-generated form implementation.
32**
33** If you wish to add, delete or rename functions or slots use
34** Qt Designer which will update this file, preserving your code. Create an
35** init() function in place of a constructor, and a destroy() function in
36** place of a destructor.
37*****************************************************************************/
38#include "acfg.h"
39#include "wdbfield.h"
40
41void eDBField::init()
42{
43 eName->clear();
44 onames.clear();
45 oids.clear();
46}
47
48
49
50void eDBField::setData( QWidget *o, aCfg *md )
51{
52// const QObject *o = sender();
53 if ( o ) {
54 if ( o->className() != QString("wDBField") || !md ) {
55 reject();
56 return;
57 }
58 }
59 else {
60 reject();
61 return;
62 }
63 int w=0, d=0, idx=0;
64 unsigned int i;
65 long oid, widgetId, fieldId;
66 QString pn;
67 aWidget *widget;
68 wDBField *field = (wDBField*)o;
69 QWidget *pWidget = field->parentWidget();
70
71 while ( pWidget ) {
72 pn = "";
73 pn = pWidget->className();
74 if ( pn == QString("wCatalogue") || pn == QString("wDocument") ) break;
75 pWidget = pWidget->parentWidget();
76 }
77 if ( pn == QString("wCatalogue") ) widget = (wCatalogue*)pWidget; else
78 if ( pn == QString("wDocument") ) widget = (wDocument*)pWidget; else
79 return;
80
81 widgetId = widget->getId();
82 //fieldId = field->getId();
83 if ( widgetId ) widget->setMDObject( md->find( widgetId ) );
84
85// printf( "parent widget id = %i\n", widgetId );
86// printf( "field id = %i\n", fieldId );
87// printf( "metadata id = %i\n", md->id( *widget->getMDObject() ) );
88
89 QStringList tlist = md->types( md_field, widget->getMDObject() );
90 otypes.clear();
91 eType->clear();
92 for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it ) {
93 otypes.append( (*it).section( "\t", 0, 0 ) );
94 eName->insertItem( (*it).section("\t", 1, 1 ), idx++ );
95 }
96 for ( i = 0 ; i < otypes.count(); i++ ) {
97 oid = 0;
98 if( otypes[i][0] == 'O' ) {
99 sscanf( (const char *)otypes[ i ], "O %d", &oid );
100 if ( oid == fieldId ) {
101 eName->setCurrentItem( i );
102 break;
103 }
104 }
105 }
106}
107
108
109void eDBField::getData( QWidget *o )
110{
111// const QObject *o = sender();
112 if ( !o ) return;
113 if ( o->className() != QString("wDBField") ) return;
114 wDBField *f = ( wDBField*) o;
115
116 int idx=eName->currentItem();
117 long oid = 0;
118 if (f) {
119 if( otypes[idx][0] == 'O' ) {
120 sscanf( (const char *)otypes[ idx ], "O %d", &oid );
121 // f->setId( oid );
122 }
123 }
124}
125
126
127void eDBField::namechanged( const QString &s )
128{
129 int idx=eName->currentItem();
130// printf("new str=%s\n", (const char *) s.utf8());
131 selotype=otypes[idx];
132 seloid=oids[idx];
133 eType->setText(onames[idx]);
134}
Класс реализует програмный интерфейс доступа к элементам метаданных системы. Наследует QObject.
Definition acfg.h:437
QStringList types(const QString &filter=QString::null, aCfgItem *obj=0)
Definition acfg.cpp:1297
aCfgItem find(aCfgItem context, const QString &name, int n=0)
Definition acfg.cpp:539
Базовый класс для визуальных объектов. Наследует QWidget.
Definition awidget.h:53
Definition wcatalogue.h:44
Универсальный Плагин – виджет, предназначен для редактирования атрибутов бизнес объектов Ананаса....
Definition wdbfield.h:62
Визуальный объект - контейнер для работы с документами. Наследует aWidget.
Definition wdocument.h:48