87void eDBTable::ColumnDel()
92idx = ListCol->currentItem();
93if (idx != -1 && ListCol->count()>0)
96 table->removeColumn(idx);
97 deletedFields.append(str);
98 deletedFieldsId.append(idlist[idx]);
99 idlist.remove(idlist.at(idx));
100 fname.remove(fname.at(idx));
101 cwidth.remove(cwidth.at(idx));
102 ListCol->removeItem(idx);
107void eDBTable::ColumnL()
111 QStringList::Iterator it;
112 idx = ListCol->currentItem();
118 it = fname.at(idx-1);
119 fname.insert(it,str);
124 it = idlist.at(idx-1);
125 idlist.insert(it,str);
130 it = cwidth.at(idx-1);
131 cwidth.insert(it,str);
133 str = ListCol->currentText();
134 ListCol->removeItem(idx);
135 ListCol->insertItem(str,idx-1);
136 ListCol->setSelected(idx-1,
true);
141void eDBTable::ColumnR()
145 QStringList::Iterator it;
146 idx = ListCol->currentItem();
147 if(idx<ListCol->count()-1)
152 it = fname.at(idx+1);
153 fname.insert(it,str);
158 it = idlist.at(idx+1);
159 idlist.insert(it,str);
164 it = cwidth.at(idx+1);
165 cwidth.insert(it,str);
167 str = ListCol->currentText();
168 ListCol->removeItem(idx);
169 ListCol->insertItem(str,idx+1);
170 ListCol->setSelected(idx+1,
true);
174void eDBTable::ColumnSel(
int col)
179 eColHeader->blockSignals(
true);
180 eColWidth->blockSignals(
true);
182 eColTWidth->setValue(0);
183 eColTDec->setValue(0);
184 eColHeader->setText(
"");
185 eColWidth->setValue(0);
186 eColName->setText(
"");
200 if(col==-1 || ListCol->count()==0)
return;
202 eColHeader->setText(ListCol->currentText());
203 eColHeader->blockSignals(
false);
204 ind = ListCol->currentItem();
206 eColWidth->setValue(atoi(str));
207 eColWidth->blockSignals(
false);
209 eColName->setText(str);
214 str = table->getFieldType(idlist[ind].toInt());
218 eType->setText(str.left(1));
223 eColTWidth->setValue(atoi(str));
228 s = str.remove(0,str.find(
" "));
235 eColTDec->setValue(atoi(str));
259void eDBTable::ColumnUpd()
263QValueList<int> listTableId;
264 id = table->getTableId(ComboBoxTable->currentItem()-1);
265 listTableId = table->getBindList();
266 if(listTableId.find(
id)!=listTableId.end())
268 cfg_message(0,tr(
"table in use, please select another table"));
271 ListCol->insertItem(
"table in use!");
272 ListCol->setEnabled(
false);
273 bOK->setEnabled(
false);
277 if(!ListCol->isEnabled()) ListCol->setEnabled(
true);
278 if(!bOK->isEnabled()) bOK->setEnabled(
true);
279 lst = table->getFields(
id);
282 idlist = table->getFields(
id,
true);
283 ListCol->insertStringList(lst,0);
285 for(uint i=0; i<lst.count();i++)
287 cwidth << table->property(
"DefaultColWidth").toString();
290 findDeletedFields(
id,idlist);
295void eDBTable::getData(
wDBTable *t )
300const QSqlFieldInfo *f;
301 if(ComboBoxTable->count())
304 t->setProperty(
"TableInd",t->
getTableId(ComboBoxTable->currentItem()-1));
306 while(i<t->numCols())
312 for(uint j=0; j<ListCol->count(); j++)
314 ListCol->setCurrentItem(j);
315 str = ListCol->currentText();
317 f =
new QSqlFieldInfo(fname[j]);
319 t->setSqlCursor(t->cur);
320 t->addColumn(f->name(),str,atoi(cwidth[j].ascii()));
321 t->refresh(QDataTable::RefreshColumns);
323 t->setProperty(
"DefHeaders",lst);
324 t->setProperty(
"DefFields",fname);
325 t->setProperty(
"DefIdList",idlist);
326 t->setProperty(
"ColWidth", cwidth);
330 t->setProperty(
"TableInd",-1);
342QStringList lst,lst_full;
359 ComboBoxTable->insertStringList(table->list_available_tables, 1);
360 idTable = table->property(
"TableInd").toInt(&ok);
363 ComboBoxTable->setCurrentItem(1+t->
getTableInd(idTable));
379 lst = table->property(
"DefHeaders").toStringList();
380 ListCol->insertStringList(lst,0);
381 cwidth = table->property(
"ColWidth").toStringList();
382 fname = table->property(
"DefFields").toStringList();
383 idlist = table->property(
"DefIdList").toStringList();
384 findDeletedFields(idTable,idlist);
421void eDBTable::ColumnTextUpd(
const QString &s )
426 idx = ListCol->currentItem();
427 if (idx == -1)
return;
428 ListCol->blockSignals( TRUE );
429 ListCol->changeItem(s, ListCol->currentItem());
430 ListCol->blockSignals( FALSE );
442void eDBTable::ColumnAdd()
446QStringList::Iterator it;
447 addfdialog e( this->topLevelWidget());
448 e.setData(deletedFields,deletedFields,deletedFieldsId);
449 if ( e.exec()==QDialog::Accepted )
451 idx = e.getData(
false);
454 s = table->getFieldName(idx.toInt());
457 ListCol->insertItem(s,ListCol->count());
459 cwidth << table->property(
"DefaultColWidth").toString();
460 it = deletedFields.find(s);
461 deletedFields.remove(it);
462 it = deletedFieldsId.find(idx);
463 deletedFieldsId.remove(it);
469void eDBTable::ColWidthChange(
int value )
473 ind = ListCol->currentItem();
476 cwidth[ind] = num.setNum(value);
483eDBTable::findDeletedFields(
int t_num ,QStringList idls)
485 QStringList lst_full;
486 deletedFields.clear();
488 lst_full = table->getFields(t_num,
true);
489 for(
unsigned int i=0;i<lst_full.count();i++)
492 if(idls.find(lst_full[i])==idls.end())
494 deletedFieldsId << lst_full[i];
495 deletedFields << table->getFieldName(lst_full[i].toInt());
502void eDBTable::doCancel()
int getTableInd(int id)
Definition wdbtable.cpp:717
int getTableId(int ind)
Definition wdbtable.cpp:677