|
of_save
|
|
Full name
|
pfc_n_cst_mru.of_save
|
Access
|
protected
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
protected function integer of_save()
|
Name
|
Datatype
|
li_index
|
integer
|
li_rc
|
integer
|
ll_objectcount
|
long
|
ll_registeredcount
|
long
|
lnv_string
|
n_cst_string
|
ls_defaultcount
|
string
|
ls_id
|
string
|
ls_iditemcount
|
string
|
ls_key
|
string
|
ls_MRUKeyName
|
string
|
protected function integer of_save ();//////////////////////////////////////////////////////////////////////////////
//
// Function: of_Save
//
// Access: protected
//
// Arguments: None
//
// Returns: integer
// SUCCESS = 1
// ERROR = -1
//
// Description:
// store the key data from the mrukeys datastore to ini file or registry
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
integer li_index, li_rc
long ll_objectcount, ll_registeredcount
string ls_id, ls_iditemcount, ls_defaultcount, ls_key, ls_MRUKeyName
n_cst_string lnv_string
// cannot save mru info without this information
if (is_userinifile = "") and (is_userkey = "") then
return -1
end if
if isnull(ii_mruitemcount) then
Return -1
end if
//write general MRU information
// [MRU]
// itemcount=
// item1=xxx
//of_Filter("")
//of_Sort("n_identity D")
//li_rc = of_Write(is_mrusection, ii_mruitemcount)
//if li_rc < 0 then return -1
// write registered id data
// [MRU id]
// itemcount=
// item1=xxx
ll_objectcount = upperbound(inv_register)
for li_index = 1 to ll_objectcount
ls_id = inv_register[li_index].is_id
of_Filter("s_id = '" + ls_id + "'")
of_Sort("n_identity D")
li_rc = of_Write(is_mrusection + " " + ls_id, inv_register[li_index].ii_itemcount)
if li_rc < 0 then
// restore datastore (unfilter and sort)
of_Filter("")
of_Sort("n_identity D")
return -1
end if
end for
// restore datastore (unfilter and sort)
of_Filter("")
of_Sort("n_identity D")
// write out registered id
// [MRU Registered Id]
// itemcount=
// item1=id=Employee Window;iditemcount=x
ll_objectcount = upperbound(inv_register)
for li_index = 1 to ll_objectcount
ll_registeredcount ++
ls_id = "id="
ls_iditemcount = "iditemcount="
lnv_string.of_SetKeyValue (ls_id, "id", inv_register[li_index].is_id, "=")
lnv_string.of_SetKeyValue (ls_iditemcount, "iditemcount", string(inv_register[li_index].ii_itemcount), "=")
ls_key = ls_id + is_delimiter + ls_iditemcount + is_delimiter
ls_MRUKeyName = is_mruitemkey + string(ll_registeredcount)
li_rc = of_WriteKeys(is_mruregisteredsection, ls_MRUKeyName, ls_key)
if li_rc < 0 then exit
end for
ls_key = string(ll_registeredcount)
li_rc = of_WriteKeys(is_mruregisteredsection, is_mrucountkey, ls_key)
// Write # of default items for entire MRU process
// [MRU]
// itemcount=
ls_defaultcount = string(ii_mruitemcount)
li_rc = of_WriteKeys(is_mrusection, is_mrucountkey, ls_defaultcount)
return li_rc
end function