Step 7: Adding Obejct Window Support
Last updated on: 5/30/2013 8:54 PM
Created on: 11/2/2016 2:22 PM
The SC-7 framework handles the user interface aspects of composing and
reviewing secure objects. The main interface is handled by a window that calls
into an interface that contains the main code to execute based on a user
interaction. The framework determines which features are available in a Secure
Object window based on feature specification flags. A Secure Object is the
window in which the most user interaction takes place and therefore the
ISCSecureObejctExtension interface has the most complexity.
The framework provides the main UI controls and Window, complete with tool bars,
desktop menu bar and context menu support. The Secure Obkect Window allows for
Multiple Tree Widgets and one HTML Browser Widget. To customize and isolate the
rendering logic for each of these controls, window extensions must provide back
the appropriate instances of view class based on the ISCView() interface. There
are three common sub implementations of the ISCView() interface:
ISCTreeWidgetView(), ISCBrowserWidgetView() and ISCListWidgetView(). Derive a
view implementation from either ISCTreeWidgetView() or ISCBroswerWidgetView()
interfaces and return the proper instance of that view class when the framework
calls SetView() with the Qt control that the view will be controlling. Unlike
the AppetWindow method, the SetView() will have an output parameter that needs
to contain the proper text string to display as a caption to the view. Also
note, that SetView() will not be called for every view, only views that are
specified as custom views based on the feature flags.
Additional customizations to the window are performed by implementing and
returning the proper information from these methods:
- QString GetWindowTitle()
- QString GetAppletImageResource()
- QString GetHintText()
- QString GetFileFilter( int nViewID )
Depending on the feature flags selected, these methods will need to be implemented:
- void OnOptionsCompressionToggled( bool )
- void OnOptionsSignToggled( bool )
- void OnOptionsZapToggled( bool )
- void OnPriorityChange( int nNewPriority )
- void OnClassificationChange( QString strNewClassification )
- void OnTextChanged()
The first three methods have associated menu and toolbar actions thus they have these corresponding methods to determine their availability:
- void OnUpdateOptionsCompressionToggled( int nView, PACTIONUI pCmdUI )
- void OnUpdateOptionsSignToggled( int nView, PACTIONUI pCmdUI )
- void OnUpdateOptionsZapToggled( int nView, PACTIONUI pCmdUI )
The framework handles all the behind the scenes logic required to perform copy and paste as well as drag and drop. Both techniques use similar technologies and will require implementation of up to five methods. These three are query based to determine if a view will support an operation based on the type of information available for paste or being dragged into the view:
- ViewHandlesMime( const QMimeData* pMimeSource, int nViewID )
- ViewBuildsScrap( int nViewID )
- ViewAllowsFileDrops( int nViewID )
If a copy operation or a paste operation, or in the case of a drag-n-drop if the selected object drag begins or a drop occurs, these methods are invoked and will require implementation based on what information is to be accepted as the paste/drop or built with the copy/drag actions:
- OnAcceptScrap( const QMimeData* pMimeSource, int nViewID )
- OnBuildScrap( QMimeData& Mime, int nViewID )
If the Secure Object is set to work with Access Control Lists then these events are triggered by the framework when the user performs an ACL modification:
- bool OnACLMemberAdded( cdk::str strMemberCert )
- bool OnACLMemberRemoved( cdk::str strMemberCert )
Likewise, if the Secure Object works with file attachments then these events are triggered by the framework:
- void OnAfterAttachmentsSelected( QStringList& listAttachedFiles, bool bContainsFolders )
- void OnAttachmentSaved( QString strExistingAttachment, QString strNewFile )
- void OnAttachmentRenamed( QString strExistingAttachment, QString strNewFile )
- bool OnAttachmentAdded( QString strPendingAttachment )
- bool OnAttachmentRemoved( QString strExistingAttachment )
Along with these methods that are invoked based on the user interacting with the file attachment view:
- void OnSaveAllAttachments( int nView )
- void OnFileAddFolder( int nView )
- void OnFileSaveAs( int nView )
- void OnSaveSecureObjectAs()
- void OnFileOpen( int nView )
- void OnFileOpenWith( int nView )
- void OnFileRename( int nView )
The important methods to make note of are those that are invoked when the user needs to open or save a secure object. Those methods are as follows:
- void OnFileSave( PIDENTITY pID, QStringList& strAttachments, PHEADEROPTIONS pHeader, void* pCallback )
- void OnSaveSecureObjectAs()
- int OnFileOpen( QString strFileName, PIDENTITY pID, QStringList& strAttachments, PHEADEROPTIONS pHeader, void* pCallback )
- void OnUpdateSaveSecureObjectAs( int nView, PACTIONUI pCmdUI )
To react to any user interaction within the specific view implement one or more of these methods as needed:
- void OnContextMenu( int nView, unsigned long& ulFlags )
- void OnListCurrentRenamed( int nView, QString newText )
- void OnListCurrentChanged( int nView, QTreeWidgetItem* now, QTreeWidgetItem* previous )
- void OnListCurrentRenamed( int nView )
- void OnSelectionActivated( int nView, QTreeWidgetItem* item, int nColumn )
- void OnSelectionChanged( int nView )
- void OnAnchorClicked( int nView, const QUrl &url )
By adding one or more implementations derived from this interface our demo
applet can now interact with the framework to provide the means to perform
security operations as well as open secure objects for use.
Topics
Developer's Historical Persepctive Why A Platform Standards The User ExperienceInterfaces
ISCApplet ISCTaskListExtension ISCConfigPanelExtension ISCErrorReporterExtension ISCLogConnector/ISCLogEntry ISCCertificateStoreExtension ISCSystemTrayExtension ISCAppletWindowExtension ISCSecureObjectExtensionApplet Building Steps
Step 1: Create The Applet Step 2: Adding Action Items Step 3: Adding Configuration Panels Step 4: Adding Custom Error Text Step 5: Startup/Shutdown Step 6: Adding Main Window Support Step 7: Adding Obejct Window Support