Ejemplo n.º 1
0
/*!
 * \en	Calls handler onClick event for Catalogue or Document object. \_en
 * \ru	Вызывает обработчик события onClick для объектов Каталог или Документ. \_ru
 */
void
wField::fieldSelect()
{
	aForm * f = 0;
//    if (!fieldEditor) return;
	switch (vEditorType)
	{
		case Catalogue:
		if ( engine )
		{
			int fid = md->getDefaultFormId( md->find( md_oid ), md_action_view);
			if ( !fid )
			{
				engine->openEmbedCatalogueEditor(md_oid,this,true);
				return;
			}
			f = engine->openForm( md_oid, 0, md_action_view, 0, false );
			if ( f )
			{
				connect(f, SIGNAL(selected( Q_ULLONG )), this, SLOT(on_selected( Q_ULLONG )));
				f->closeAfterSelect = true;
			}
		}
		else
		{
			aLog::print(aLog::MT_ERROR, tr("wField::fieldSelect no engine"));
		}
		break;
		case Document:
		if( engine )
		{
			aCfgItem journ  = md->findJournal(1, md->find( md_oid ));
			if( journ.isNull() )
			{
				aLog::print(aLog::MT_DEBUG, tr("wField::fieldSelect special journal not found, used system journal"));
				journ = md->findJournal(0, md->find( md_oid ));
			}
			else
			{
				aLog::print(aLog::MT_DEBUG, tr("wField::fieldSelect found special journal %1 with class %2").arg(md->attr(journ,mda_name)).arg(md->objClass(journ)));
			}
			f =  engine->openForm( md->id(journ), 0, md_action_view, 0, false );
			if( f )
			{
				connect(f, SIGNAL(selected( Q_ULLONG )), this, SLOT(on_selected( Q_ULLONG )));
				f->closeAfterSelect = true;
			}

		}
		else
		{
			aLog::print(aLog::MT_ERROR, tr("wField::fieldSelect no engine"));
		}
		break;
		default:
		break;
	}
}
Ejemplo n.º 2
0
Rename::Rename(QString name, QObject * parent) : PActionItem(name, parent)
{
   if (!connect(d_rename, SIGNAL(textValueSelected(QString)), this, SLOT(on_selected(QString))))
   {
      general_errors.error("Could not connect rename dialog text value");
   }
}
Ejemplo n.º 3
0
int Rename::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = PActionItem::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: on_selected((*reinterpret_cast< QString(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
Ejemplo n.º 4
0
void
wCatalogEditor::openForm(const bool toSelect)
{

	
	aLog::print(aLog::MT_DEBUG, tr("wCatalog Editor open form for select=%1 ").arg((int)toSelect));
	MainForm *mainform;
	if(parent())
	{
		mainform = (MainForm*) topLevelWidget();
		ws = mainform->ws;
	}
//  aWindowsList *wl = mainform->wl;
	int objid = catId;
/*	if ( wl->find( objid ) )
    	{
//		wl->remove(objid);
		wl->get( objid )->setFocus();
		return;
    	}
	else
	{
  		CatalogForm* newform = new CatalogForm(ws,0, WDestructiveClose);
		wl->insert( objid, newform );
	}*/
	CatalogForm* newform = new CatalogForm(ws,0, WDestructiveClose);

	connect( newform,	SIGNAL(selected(Q_ULLONG)),
  		 this,		SLOT(on_selected( Q_ULLONG )));
	connect( newform, 	SIGNAL(destroyed()),
  	  	 this,		SLOT(on_destroyed_form()));

	aCatalogue *cat = new aCatalogue(md->find(catId),db);
	int count=0;
	bool est=true;
	QMap<Q_ULLONG,QListViewItem*> map, map_el;
	aCfgItem tmp, tmp_f,tmp_el,tmp_group, o;
	QListViewItem * item;
	QListViewItem * p_item;
	Q_ULLONG idGrForm=0, idElForm=0;
	QStringList listPos, listPosGroup;
	newform->ListHint->hide();
	QPixmap pixmap(newform->getGroupPixmap());
	QPixmap pixmap_mark_deleted(newform->getMarkDeletedPixmap());
	tmp = md->find(catId);
	newform->setCaption(md->attr(tmp,mda_name));
	o = md->findChild(tmp, md_forms); // get obj forms
  	if(!o.isNull())
  	{
		count = md->count(o,md_form);
		for(int i=0; i<count; i++)
		{
			tmp_f = md->findChild(o,md_form,i);
			if(!tmp_f.isNull()
			   && atoi(md->attr(tmp_f,mda_type).ascii())==md_form_elem)
	 		{
				aLog::print(aLog::MT_DEBUG, tr("wCatalog Editor found element forms"));
				idElForm = md->id(tmp_f);
//				 continue;
	 		}
			if(!tmp_f.isNull()
			   && atoi(md->attr(tmp_f,mda_type).ascii())==md_form_group)
	 		{
				aLog::print(aLog::MT_DEBUG, tr("wCatalog Editor found group forms"));
				idGrForm = md->id(tmp_f);
	 		}
		}
  	}
	else
	{
		aLog::print(aLog::MT_ERROR, tr("wCatalog Editor meta object forms not found"));
	}
	tmp_el = md->findChild(tmp, md_element);
	tmp_group = md->findChild(tmp,md_group);
	tmp = md->findChild(tmp_el, md_field);
	int count_fields = md->count(tmp_el,md_field);
	listPosGroup = cat->getGroupUserFields();
	int i,level = 0;
	cat->Select();
  	while(est) // add group in tree on levels
  	{
		est = false;
		++level;
		cat->selectByLevel(level-1);

  		if(!cat->FirstInGroupTable()) break;
  		do
  		{
			if(cat->GroupSysValue("level").toInt()==level-1) //all groups, having this level
			{
				est = true;
				QString displayString;
				displayString= cat->GroupSysValue(listPosGroup[0]).toString();
				if(map.contains(cat->GroupSysValue("idp").toULongLong()))
				{
					p_item = map[(cat->GroupSysValue("idp").toULongLong())];
					item = new QListViewItem(p_item);
				}
				else
				{
					item = new QListViewItem(newform->ListView);
					newform->ListView->insertItem(item);
				}
				item->setText(0, displayString);
				if(cat->isGroupMarkDeleted())
					item->setPixmap(0,pixmap_mark_deleted);
				else
					item->setPixmap(0,pixmap);

				map.insert(cat->GroupSysValue("id").toULongLong(),item);
			//printf("%lu\n",cat->GroupSysValue("id").toULongLong());

			}


		}while(cat->NextInGroupTable());

	}
  	listPos = cat->getUserFields();
	checkUserFields(listPos);
	int fid;
	//sets column name
	for(uint i=0; i<listPos.count(); i++)
  	{
		fid = atoi(listPos[i].remove("uf",false).ascii());
		if(!fid)
		{
//			printf("listPos[]=%s",listPos[i].remove("text_uf",false).ascii());
			fid = (listPos[i].remove("text_",false)).toInt();
			//tmp = md->find(fid);
		}
		if(fid)
		{
			tmp = md->find(fid);
			newform->ListView->addColumn(md->attr(tmp,mda_name));
		}
  	}

	listPos.clear();
	listPos = cat->getUserFields();
	checkUserFields(listPos);
  	//Q_ULLONG res = 0;		
   	// cat deleted in function catalogform::destroy(); 

 	 newform->setData(	cat,
		   		map,
		   		listPos,
		   		cat->getGroupUserFields(),
		   		idElForm,
		   		idGrForm,
				toSelect);

	newform->setId(value().toULongLong());
	newform->show();
	((QWidget*)newform->parent())->move(0,0);
}