Exemplo n.º 1
0
Host Host::autoRegister()
{
	Host newHost = Host();
	newHost.setName(Host::currentHostName());
	newHost.setOnline(1);
	newHost.commit();

	newHost.updateHardwareInfo();

	Service ab = Service::recordByName("Assburner");
	if( ab.isRecord() ) {
		HostService hs = HostService();
		hs.setHost(newHost);
		hs.setService(ab);
		hs.commit();
	}

	HostGroup hg = HostGroup::recordByName("All");
	if( hg.isRecord() ) {
		HostGroupItem hgi = HostGroupItem();
		hgi.setHost(newHost);
		hgi.setHostGroup(hg);
		hgi.commit();
	}

	return newHost;
}
Exemplo n.º 2
0
void ServiceDialog::refresh()
{
	HostServiceList hsl = HostService::recordsByHost( mHost );
	QMap<Service,HostService> hsm;
	foreach( HostService hs, hsl )
		hsm[hs.service()]=hs;
	foreach( Service s, mServices ) {
		if( !hsm.contains(s) ) {
			HostService hs;
			hs.setHost(mHost);
			hs.setService(s);
			hsl += hs;
		}
	}
	mServiceModel->setRootList( hsl );
}