Ananas Library 0.9.5
edocument.ui.h
1/****************************************************************************
2** $Id: edocument.ui.h,v 1.7 2004/07/01 11:30:55 pashik Exp $
3**
4** Code file of the edit document 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//nclude "mainform.h"
39//#include "cfgform.h"
40#include "acfg.h"
41
42void eDocument::init()
43{
44/*
45 int oc, i, f, idx=0;
46 char *id, *name, *ot;
47 cfg_objptr o;
48 char otype[100];
49 QString named;
50
51 otypes.clear();
52 eType->clear();
53 otypes.append("D");
54 eType->insertItem(trUtf8("Дата"), idx++);
55 otypes.append("T");
56 eType->insertItem(trUtf8("Время"), idx++);
57 otypes.append("N %d %d");
58 eType->insertItem(trUtf8("Число"), idx++);
59 otypes.append("C %d");
60 eType->insertItem(trUtf8("Строка"), idx++);
61
62 oc=cfgobj_count(NULL, NULL);
63 for (i=1;i<=oc;i++) {
64 id=cfgobj_idn(NULL, NULL, i, &o);
65 ot=(char *)o->name;
66 name=cfgobj_attr(o, "name");
67 named="";
68 f=0;
69 if (strcmp((char *)ot, aot_doc)==0) {
70 named=trUtf8("Документ.");
71 f=1;
72 }
73 if (strcmp((char *)ot, aot_cat)==0) {
74 named=trUtf8("Справочник.");
75 f=1;
76 }
77 if (f) {
78 named=named+trUtf8(name);
79 sprintf(otype, "O %s", id);
80 otypes.append(otype);
81 eType->insertItem(named, idx++);
82 }
83 }
84*/
85}
86
87
88
89void eDocument::setData( QWidget *o, aCfg *md )
90{
91// const QObject *o = sender();
92 if ( o ) {
93 if ( o->className() != QString("wDocument") || !md ) {
94 reject();
95 return;
96 }
97 }
98 else {
99 reject();
100 return;
101 }
102 wDocument *f = ( wDocument*) o;
103 int w=0, d=0, idx=0;
104 unsigned int i;
105 long oid , id;
106
107 id = f->getId();
108
109 otypes.clear();
110 eType->clear();
111
112 QStringList tlist = md->types( md_document );
113 otypes.clear();
114 eType->clear();
115 for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it ) {
116 otypes.append( (*it).section( "\t", 0, 0 ) );
117 eType->insertItem( (*it).section("\t", 1, 1 ), idx++ );
118 }
119 for ( i = 0 ; i < otypes.count(); i++ ) {
120 oid = 0;
121 if( otypes[i][0] == 'O' ) {
122 sscanf( (const char *)otypes[ i ], "O %d", &oid );
123 if ( oid == id ) {
124 eType->setCurrentItem( i );
125 break;
126 }
127 }
128 }
129}
130
131
132void eDocument::getData( QWidget *o )
133//aDocument *f )
134{
135 QVariant v;
136// const QObject *o = sender();
137 if ( !o ) return;
138 if ( o->className() != QString("wDocument") ) return;
139 wDocument *f = ( wDocument*) o;
140
141 int idx=eType->currentItem();
142 int oid = 0;
143
144 if (f) {
145 if( otypes[idx][0] == 'O' ) {
146 sscanf( (const char *)otypes[ idx ], "O %d", &oid );
147// v = oid;
148 f->setProperty("Id", QVariant( oid ) );
149// f->setId( oid );
150 }
151 }
152
153}
154
Класс реализует програмный интерфейс доступа к элементам метаданных системы. Наследует QObject.
Definition acfg.h:437
QStringList types(const QString &filter=QString::null, aCfgItem *obj=0)
Definition acfg.cpp:1297
Визуальный объект - контейнер для работы с документами. Наследует aWidget.
Definition wdocument.h:48