Site *Site::duplicate()
{
  if (m_type == ST_ROOT || m_type == ST_CATEGORY)
    return 0;
  
  Site *site = new Site(m_manager, m_element.cloneNode());
  site->setAttribute("name", i18n("Copy of") + " " + getAttribute("name"), false);
  site->setAttribute("id", QString::null, false);
  site->refresh(m_manager, site->m_element);

  m_element.parentNode().appendChild(site->m_element);
  m_manager->cacheSite(site);
  emit m_manager->siteAdded(site);

  return site;
}
void Site::addCategory(const QString &name)
{
  QDomElement cat = m_element.ownerDocument().createElement("category");

  // Create a new category
  Site *site = new Site(m_manager, cat);
  site->setAttribute("name", name, false);
  m_element.appendChild(cat);
  m_manager->cacheSite(site);
  
  emit m_manager->siteAdded(site);
}
Exemple #3
0
JSBool JsSite::setAttribute(JSContext *cx,JSObject *obj,uintN argc,jsval *argv,jsval *rval)
{
	char *name = {0};
	char *value = {0};

	if ( !JS_ConvertArguments(cx,argc,argv,"ss",&name,&value) ) {
		return Engine::throwUsageError(cx,argv);
	}

	Site *site = (Site*)JS_GetPrivate(cx,obj);
	site->setAttribute(name,std::string(value));

	return JS_TRUE;
}
Site *Site::addSite(const QString &name)
{
  QDomElement node = m_element.ownerDocument().createElement("server");

  // Create a new site
  Site *site = new Site(m_manager, node);
  site->setAttribute("name", name, false);
  m_element.appendChild(site->m_element);
  m_manager->cacheSite(site);
  
  emit m_manager->siteAdded(site);
  
  site->setProperty("protocol", ProtoFtp);
  site->setProperty("port", 21);
  
  return site;
}