void ODragObject :: setData (ODS *pODS, QString qsText )
{
  QString                          dbpath,dictpath,s,xmlinstance;
  PropertyHandle                   *ph = NULL;
  int                               inst_id= 0;
  DatabaseHandle                   *dbh   = NULL;
  inst_id= pODS->InstGetObjID();
  ph = pODS->Handle();
  if(ph){
    ph->ExtractKey();
    dbh     = &ph->GetDBHandle();
    dbpath = SZ2QS(dbh->GetPath());
    dictpath = SZ2QS(dbh->GetDictionary().GetPath());
    pEncodedPropertyHandle = new PropertyHandle();
    pEncodedPropertyHandle->OpenHierarchy(ph); 
    pEncodedPropertyHandle->ExtractKey();
    ph->ExtractKey();
  }else{
    dbpath = SZ2QS("undefined");
    dbpath = SZ2QS("undefined");
    dbh    = NULL;
  }
  xmlinstance   = SZ2QS("<instance id=\"%i\" propertyhandle=\"%p\" applicationhandle=\"%p\" databasehandle=\"%p\" odragobject=\"%p\" databasepath=\"%s\" dictionarypath=\"%s\">\n%s\n</instance>");
  s.sprintf(QS2SZ(xmlinstance),inst_id,pEncodedPropertyHandle,QCoreApplication::instance(),dbh,this,QS2SZ(dbpath),QS2SZ(dictpath),QS2SZ(qsText));
  enc_xmlpropertyhandle.resize( s.length() );
  memcpy( enc_xmlpropertyhandle.data(), s.toLatin1(), s.length() );

  xmlinstance   = SZ2QS("%i\n%p\n%p\n%p\n%p\n%s\n%s");
  s.sprintf(QS2SZ(xmlinstance),inst_id,pEncodedPropertyHandle,QCoreApplication::instance(),dbh,this,QS2SZ(dbpath),QS2SZ(dictpath));
  enc_propertyhandle.resize( s.length() );
  memcpy( enc_propertyhandle.data(), s.toLatin1(), s.length() );



}
logical pc_ADK_FieldControl :: AddTabControl (int32 posx, int32 posy )
{
  pc_ADK_Field      fields(GPH("fields"));
  PropertyHandle   *my_class  = GPH("class");
  PropertyHandle   *member;
  PropertyHandle   *fc;
  logical           term = NO;
BEGINSEQ
  if ( !my_class->Get(FIRST_INSTANCE) )              ERROR
    
  pc_ADK_Class   new_class(*my_class);  
  if ( !(fc = new_class.ProvideDefaultTabControl()) ||
       !fc->Exist()  )                               ERROR
    
  if ( fields.NewField("tab",posx,posy) )            ERROR
  fields.SetupDataSource("*","DRT_PropertyPath",NO);
  fields.SetupFromFieldControl(fc);
  
  fields.GPH("class")->Add(new_class.ExtractKey()); CTXCERR
  fields.GPH("field_control")->Add(fc->ExtractKey());
                                                     CTXCERR
  fields.Save();                                     CTXCERR

  SetActionResult(fields.GPH("sys_ident")->GetString());

RECOVER
  SetActionResult("");
  term = YES;
ENDSEQ
  return(term);
}
示例#3
0
logical sNotiz :: DBStored ( )
{
  PropertyHandle   *ph      = GetPropertyHandle();
  logical           del_opt = UNDEF;
BEGINSEQ
  if ( !ph->IsServer() )                            LEAVESEQ
  if ( !UserState1() )                              LEAVESEQ
  SetUserState1(NO);
  
  del_opt = ph->GPH("wiedervorlage")->IsEmpty();
  
  PropertyHandle   notizen_wv(ph->GetDBHandle(),"NotizWiedervorlage",PI_Write);
                                                    SDBCERR
  if ( notizen_wv.Get(ph->ExtractKey()) )
  {
    if ( !del_opt )                                 LEAVESEQ
    notizen_wv.Delete();
  }
  else
  {
    if ( del_opt )                                  LEAVESEQ
    notizen_wv.AddReference(*ph);
  }
RECOVER

ENDSEQ
  return(NO);
}
logical pc_ADK_Field :: SetupField ( )
{
  PropertyHandle        *pfc = GetParentProperty();
  PropertyHandle        *my_class  = pfc->GPH("class");
  PropertyHandle        *member;
  PropertyHandle        *fc;
  logical                vgrow = YES;
  logical                hgrow = YES;
  logical                coll_opt;
  char                  *ref_type;  
  char                  *propnames = NULL;
  char                   strnames[ID_SIZE+1];
  logical                term = NO;
BEGINSEQ
  if ( IsInitialized() )                             LEAVESEQ
    
  propnames = strdup(GPH("sys_ident")->GetString());
    
  SetupFromParent();
  
  if ( !my_class->Get(FIRST_INSTANCE) )              ERROR
    
  pc_ADK_Class   new_class(GetObjectHandle(),PI_Update);  
  PropertyHandle extent(GetObjectHandle(),"SDB_Extend",PI_Read);  
  PropertyHandle phpropnames(propnames);
  pc_ADK_Class    structure(*my_class);  
  if ( member = structure.GetMember(propnames) )
  {
    if ( !(fc = new_class.ProvideDefaultControl(member,hgrow,vgrow)) ||
         !fc->Exist()  )                             ERROR
    coll_opt = pc0_SDB_Member(member).IsMultipleRef() ? YES : NO;
    ref_type = "DRT_PropertyPath";
    strcpy(strnames,member->GetString("ddetype"));
  }
  else if ( extent.Get(phpropnames) )
  {
    if ( !(fc = new_class.ProvideDefaultControl(&extent,hgrow,vgrow)) ||
         !fc->Exist()  )                             ERROR
    coll_opt = YES;
    ref_type = "DRT_Extent";
    strcpy(strnames,extent.GetString("ddetype"));
  }
  else                                               ERROR
    
  if ( !hgrow )
    *GPH("allign.hori_sizing") = "SIZE_Fixed";
  if ( !vgrow )
    *GPH("allign.vert_sizing") = "SIZE_Fixed";
  
  *GPH("auto_open") = YES;
  SetupDataSource(propnames,ref_type,coll_opt);
  SetupFromFieldControl(fc);
  SetupTitle(propnames);

  GPH("class")->Add(new_class.ExtractKey());        CTXCERR
  GPH("field_control")->Add(fc->ExtractKey());      CTXCERR


RECOVER
  term = YES;
ENDSEQ
  if ( propnames )
    free(propnames);
  return(term);
}