FACT++  1.0
QStandardItem* FactGui::AddServiceItem ( const string &  server,
const string &  service,
bool  iscmd 
)
inlineprivate

Definition at line 220 of file FactGui.h.

References i.

221  {
222  QListView *servers = iscmd ? fDimCmdServers : fDimSvcServers;
223  QListView *services = iscmd ? fDimCmdCommands : fDimSvcServices;
224  QListView *description = iscmd ? fDimCmdDescription : fDimSvcDescription;
225 
226  QStandardItemModel *m = dynamic_cast<QStandardItemModel*>(servers->model());
227  if (!m)
228  {
229  m = new QStandardItemModel(this);
230  servers->setModel(m);
231  services->setModel(m);
232  description->setModel(m);
233  }
234 
235  QList<QStandardItem*> l = m->findItems(server.c_str());
236 
237  if (l.size()>1)
238  {
239  cout << "hae" << endl;
240  return 0;
241  }
242 
243  QStandardItem *col = l.size()==0 ? NULL : l[0];
244 
245  if (!col)
246  {
247  col = new QStandardItem(server.c_str());
248  m->appendRow(col);
249 
250  if (!services->rootIndex().isValid())
251  {
252  services->setRootIndex(col->index());
253  servers->setCurrentIndex(col->index());
254  }
255  }
256 
257  QStandardItem *item = 0;
258  for (int i=0; i<col->rowCount(); i++)
259  {
260  QStandardItem *coli = col->child(i);
261  if (coli->text().toStdString()==service)
262  return coli;
263  }
264 
265  item = new QStandardItem(service.c_str());
266  col->appendRow(item);
267  col->sortChildren(0);
268 
269  if (!description->rootIndex().isValid())
270  {
271  description->setRootIndex(item->index());
272  services->setCurrentIndex(item->index());
273  }
274 
275  if (!iscmd)
276  item->setCheckable(true);
277 
278  return item;
279  }
Definition: did.h:42
int i
Definition: db_dim_client.c:21