📄 pfgsubscribe.pas
字号:
unit pfgSubscribe;
{**************************************************************************}
{* pfgSubscribe Unit *}
{* *}
{* Header file conversion of Subscribe.h *}
{* *}
{* Header file converted by Paul Gilbert Nov 2000. *}
{**************************************************************************}
interface
{
/*****************************************************************************
*
* Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries.
* All rights reserved.
*
****************************************************************************/
/////////////////////////////////////////////////////////////////////////////
//
// File: Subscribe.h
//
// Module: Header for the Subs30(d).Dll
//
// Description: File linking API
//
// Note : This feature was initially called Subscription,
// but was later changed to File link, hence the
// prevalance of "Sub..." in the naming convention.
//
/////////////////////////////////////////////////////////////////////////////
// REVISION HISTORY:
//
// 4/2/97 Ain Created
/////////////////////////////////////////////////////////////////////////////
}
type
{ Enumerations }
SubError = Integer;
SubOptions = Integer;
SubDeleteOptions = Integer;
const
{SubError enumeration }
subNoError=0; subFailed=1; subNoSubData=2;
{ SubOptions enumeration }
optAuto=0; optDaily=1; optWeekly=2; optMonthly=3;
{ SubDeleteOptions enumeration }
optDoNothing=-1; optKeepAll=0; optKeepModified=1; optDeleteAll=2;
MAX_CAT_NAME = 15; // length of category name
MAX_CATEGORIES = 16; // maximum number of categories
BIG_PATH = 256;
CATEGORY_SUBSCRIBED = 1; // indicates that this category is associated with a file link
CATEGORY_REGULAR = 2; // indicates that this is a non file link category
SUBSC_FILENAME = 'Subsc.dat';
SUBSC_LOGFILE_EXT = '.LOG';
LNK_OBJECT_VERSION_1 = $00000001;
LNK_OBJECT_VERSION_CURR = LNK_OBJECT_VERSION_1; // Current schema version for CSubInfo
////////////////////////////////////////////////////////////////////////////////////////
// SubProperties struct
// This struct is used for retrieving conduit specific information
// required by Subs30.dll to set up a file link
//
type
subProperties_t = packed record
szUserPath: Array [0..BIG_PATH] of Char; // path to the conduit data storage directory
// in the user's directory where the conduit desktop data is stored
// filled in by SubsDLL (using condmgr API)
szFilter: Array [0..BIG_PATH] of Char; // file types supported for import
// filled in by the conduit
CategoryNames: Array [0..MAX_CATEGORIES-1, 0..MAX_CAT_NAME] of Char;
// list of existing desktop categories
// filled in by the conduit
szLocalName: Array [0..BIG_PATH] of Char; // Local file name of data file
// filled in by SubsDLL (using condmgr API)
end;
SubProperties = subProperties_t;
////////////////////////////////////////////////////////////////////////////////////////////
//
// CSubInfo Class
// Class used to store file link configuration info for a category-file pair
//
(*
// CSubInfo not support, since it relies on the CObject MFC base class
class SUB_API CSubInfo : public CObject
{
DECLARE_SERIAL(CSubInfo)
public:
int m_subIndex; // File link index, used for accessing a link configuration in the array
CString m_catName; // Category used for this link
int m_nCatId; // Category Id from CatMgr
int m_subOptions; // update frequency options
CTime m_lastUpdate; // Date/Time of last update
CString m_csDataFile; // Path to subscription data
CString m_csLogFile; // Path to subscription log file
CString m_csTemplateFile; // template to store import order for csv files
CString m_csFldOrder; // field mapping for csv files
BOOL m_bSubNow; // Subscribe at next hotsync
BOOL m_bDisable; // Disable subscription but maintain settings
int m_deleteOption; // delete preference
BOOL m_bcatRename;
CString m_catNameOld;
CSubInfo();
virtual void Serialize( CArchive& archive );
void Copy(CSubInfo& src);
};
*)
////////////////////////////////////////////////////////////////////////////////////////////
{
//
// File link API used by the conduits for reading and modifying information in "subsc.dat"
// Step 1 : Always call SubLoadInfo(...) This serializes the "subs.dat" to an array in SubsDLL
// Step 2 : Access file link info
// Step 3 : Call SubUpdateInfo(..) to update the entry in the array
// Step 4 : Call SubSaveInfo(..) to save your changes to "subsc.dat"
//
SUB_API SubError SubLoadInfo(CString&); // Load the user's file link config before
// calling any file link functions
SUB_API SubError SubSaveInfo(CString&); // Save the user's file link info, if modified
// methods for retrieving file link information for a category-file pair
//
SUB_API SubError SubGetFirstSubscription(CSubInfo&, BOOL); // Returns the first subscription
SUB_API SubError SubGetNextSubscription(CSubInfo&, BOOL); // Returns the next subscription
SUB_API SubError SubGetFirstPending(CSubInfo&); // Returns the first pending subscription
SUB_API SubError SubGetNextPending(CSubInfo&); // Returns the next pending subscription
SUB_API int SubFindInfo(CString&, CSubInfo&); // Finds info based on category name
SUB_API int SubFindInfoById(int, CSubInfo&); // Finds info based on category ID
// methods for editing / adding a file link
//
SUB_API SubError SubUpdateInfo(int index, CSubInfo&); // Updates the information at the given
// index
SUB_API SubError SubRemoveInfo(int index, int nDeleteOption=optDeleteAll);
// Sets the link delete option
SUB_API int SubAppendInfo(CSubInfo&); // Adds new subscription info
// methods for deleting a file link
//
SUB_API SubError SubDeleteSubsc(int index, CString&); // Removes subscription info from "subsc.dat"
// and deletes the modified records log file
// Utility Methods
//
SUB_API int SubDupSubscCategory(CString&); // Checks if the category name exists in
// the list of link categories
SUB_API int SubDuplicateCategory(CString& csCatName);
// Checks the list of all categories, including
// regular desktop categories
SUB_API BOOL SubIsPending(CSubInfo&); // True if a link update is pending.
SUB_API void SubGetNextUpdate(CSubInfo&, CString&);
// Get the date of the next due update for a file link
// Methods for logging modified file link records
//
SUB_API void SubLogReset(); // Resets the current log
SUB_API void SubLogMarkRecord(int); // Adds the recordID to the modified records log
SUB_API BOOL SubLogRemoveRecord(int); // Removes the record from the modified records log
SUB_API SubError SubLogLoadRecordList(CSubInfo&, CString&); // Loads the list of modified records
SUB_API SubError SubLogSaveRecordList(CSubInfo&, CString&); // Saves the list of modified records
SUB_API int SubFindInLog(int ); // Searches for the recordID in the .LOG file
// and returns index in the array
SUB_API int SubLogGetRecordCount(); // Returns the number of records in the log
// Internal Use only
//
// Calls made to the conduit
// SubsDLL invokes the conduit for information using the following functions.
//
long SubImportOrder(CSubInfo*);
long LnkGetFileLinkSupport();
long LnkGetConduitName(CString& csDisplayName);
long LnkConfigureSubscription(SubProperties*& pSubProps);
long LnkUpdateTables(SubProperties* pSubProps);
BOOL LoadConduit(CString&);
BOOL UnloadConduit();
int GetWorkWeekBegins(); // read the WorkWeekBegins option from the registry
int SubCategoryCount(void); // count all existing categories
// HotSync use only
SUB_API SubError SubConfigOptions(const char * currentUser ); // Displays File link config UI
SUB_API void InitFLnk5DLL();
}
/////////////////////////////////////////////////////////////////////////////
implementation
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -