Ananas Library  0.9.5
etable.ui.h
1 /****************************************************************************
2 ** $Id: etable.ui.h,v 1.4 2004/07/01 11:30:55 pashik Exp $
3 **
4 ** Code file of the select files 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 "ananas.h"
39 #include "wtable.h"
40 
41 void eTable::init()
42 {
43 /*
44  int oc, i, f, idx=0;
45  char *id, *name, *ot;
46  cfg_objptr o;
47  char otype[100];
48  QString named;
49 
50  CHECK_POINT
51  r = tablerow_new(0);
52 
53  otypes.clear();
54  eType->clear();
55  otypes.append("U");
56  eType->insertItem(trUtf8("Текстовая метка"), idx++);
57  otypes.append("D");
58  eType->insertItem(trUtf8("Дата"), idx++);
59  otypes.append("T");
60  eType->insertItem(trUtf8("Время"), idx++);
61  otypes.append("N %d %d");
62  eType->insertItem(trUtf8("Число"), idx++);
63  otypes.append("C %d");
64  eType->insertItem(trUtf8("Строка"), idx++);
65 
66  oc=cfgobj_count(NULL, NULL);
67  for (i=1;i<=oc;i++) {
68  id=cfgobj_idn(NULL, NULL, i, &o);
69  ot=(char *)o->name;
70  name=cfgobj_attr(o, "name");
71  named="";
72  f=0;
73  if (strcmp((char *)ot, aot_doc)==0) {
74  named=trUtf8("Документ.");
75  f=1;
76  }
77  if (strcmp((char *)ot, aot_cat)==0) {
78  named=trUtf8("Справочник.");
79  f=1;
80  }
81  if (f) {
82  named=named+trUtf8(name);
83  sprintf(otype, "O %s", id);
84  otypes.append(otype);
85  eType->insertItem(named, idx++);
86  }
87  }
88  CHECK_POINT
89 */
90 }
91 
92 
93 void
94 eTable::destroy()
95 {
96 // tablerow_free( r );
97 }
98 
99 
100 
101 void eTable::insertColumn(const char *Header, const char *Name,
102 int idxt, int cw, int tw, int td)
103 {
104 /*
105  tablefield *f;
106  char s[30];
107 
108  sprintf(s, "%s %i %i", (const char *)otypes[idxt], tw, td);
109 
110  f = tablefield_newsys(Name, s, "");
111  tablefield_setheader(f, Header);
112  f->sizex = cw;
113  f->flen = tw;
114  f->decimals = td;
115  f->ftypeindex = idxt;
116  tablerow_insertcolumn(r, f, -1);
117 
118 // blockSignals( true );
119  ListCol->insertItem(trUtf8(Header));
120 // eColHeader->setText( trUtf8(Header));
121 // eColName->setText(trUtf8(Name));
122 // eColWidth->setValue(cw);
123 // eColTWidth->setValue(tw);
124 // eColTDec->setValue(td);
125 // blockSignals( false );
126  if (ListCol->count()) ListCol->setCurrentItem(ListCol->count()-1);
127 */
128 }
129 
130 
131 
132 void eTable::ColumnAdd()
133 {
134 // insertColumn("Новый", "Новый", 0, 0, 0, 0);
135 }
136 
137 
138 void eTable::ColumnDel()
139 {
140 /*
141  int idx;
142  idx = ListCol->currentItem();
143  if (ListCol->count() && idx != -1) {
144  tablerow_removecolumn( r, idx );
145  ListCol->removeItem(idx);
146  }
147 */
148 }
149 
150 
151 void eTable::ColumnL()
152 {
153 
154 }
155 
156 
157 void eTable::ColumnR()
158 {
159 
160 }
161 
162 
163 void eTable::ColumnSel(int col)
164 {
165 /*
166  tablefield *f;
167 
168  if (col >= 0 && col < tablerow_columns( r )) {
169  f = tablerow_column( r, col );
170  blockSignals( true );
171  eColHeader->setText(trUtf8(tablefield_header( f )));
172  eColWidth->setValue(f->sizex);
173  eType->setCurrentItem(f->ftypeindex);
174  eColName->setText(trUtf8(f->name));
175  eColTWidth->setValue(f->flen);
176  eColTDec->setValue(f->decimals);
177  blockSignals( false );
178  }
179 */
180 }
181 
182 
183 void eTable::ColumnUpd()
184 {
185 /*
186  tablefield *f;
187 
188  if (signalsBlocked()) return;
189  int idx = ListCol->currentItem();
190 
191  if ( idx >= 0 && idx < tablerow_columns( r )) {
192  f = tablerow_column( r, idx );
193  if (f->name) free(f->name);
194  f->name=strdup((const char *) eColName->text().utf8());
195  tablefield_setheader( f, (const char *) eColHeader->text().utf8());
196  f->sizex = eColWidth->value();
197  f->flen = eColTWidth->value();
198  f->decimals = eColTDec->value();
199  f->ftypeindex = eType->currentItem();
200 
201  printf("set w=%i l=%i d=%i ti=%i\n", f->sizex, f->flen,
202  f->decimals, f->ftypeindex);
203  ListCol->blockSignals( TRUE );
204  ListCol->changeItem(eColHeader->text(), idx);
205  ListCol->blockSignals( FALSE );
206  }
207  CHECK_POINT
208 */
209 }
210 
211 
212 void eTable::setData( QWidget *o, aCfg *md )
213 {
214 
215  QStringList sl;
216  unsigned int i;
217  QString ft,h,n;
218  int w=0, l=0, d=0, idxt=0;
219  char st[20];
220 
221  wTable *t = (wTable *) o;
222  eTabName->setText(t->getName());
223 /*
224  if (!t->getDefineCols().isEmpty()) {
225  sl = QStringList::split("\n",t->getDefineCols());
226  for (i = 0; i < sl.count(); i++) {
227  sscanf((const char *)sl[i].section("|",3,3),"%s %d %d", st, &l, &d);
228  if (st[0]=='O') ft.sprintf("O %d",l);
229  else ft=st;
230  w = sl[i].section("|",2,2).toInt();
231  h = sl[i].section("|",5,5);
232  n = sl[i].section("|",4,4);
233  for (idxt = otypes.count()-1; idxt>0; idxt--) {
234  if (ft[0]=='O' && otypes[idxt]==ft) break;
235  else if (otypes[idxt][0]==ft[0]) break;
236  }
237  printf("set data %i = %s %s %i %i %i\n", i,
238  (const char *)h, (const char *)n, idxt, w, l);
239  insertColumn(h,n,idxt,w,l,d);
240  }
241  }
242 */
243 }
244 
245 
246 void eTable::getData( QWidget *o )
247 {
248  wTable *t = (wTable *) o;
249 /*
250  int i;
251  QStringList sl;
252  QString cdef, ft, s;
253  tablefield *f;
254 
255  t->vTable->setNumCols(ListCol->count());
256  for (i=0;i<tablerow_columns( r ); i++) {
257  f = tablerow_column( r, i );
258  ft.sprintf(otypes[f->ftypeindex],f->flen,f->decimals);
259  cdef.sprintf("%i|%i|%i|%s|%s|%s",i,0, f->sizex,
260  (const char *) ft, f->name,
261  tablefield_header( f ));
262  s = s + cdef +"\n";
263  }
264 // t->vTable->setColumnLabels(sl);
265  t->setName(eTabName->text());
266  CHECK_POINT
267  printf("getData defs = %s\n",(const char *)s.utf8());
268  t->setDefineCols(s);
269 */
270  t->setName(eTabName->text());
271 }
272 
273 
274 void eTable::ColumnTextUpd( const QString &s )
275 {
276 /*
277  int idx;
278  idx = ListCol->currentItem();
279  if (idx == -1) return;
280  ListCol->blockSignals( TRUE );
281  ListCol->changeItem(s, ListCol->currentItem());
282  ListCol->blockSignals( FALSE );
283  CHECK_POINT
284 */
285 }
286 
287 
Класс реализует програмный интерфейс доступа к элементам метаданных системы. Наследует QObject...
Definition: acfg.h:436
Плагин - виджет для редактирования табличных данных, не хранящихся в бизнес объектах Ананаса...
Definition: wtable.h:63