Classified ads
Public Types | Public Slots | Public Member Functions | List of all members
MController Class Referenceabstract

Pure-virtual interface class for controller. This is spammed across parties needing access to application controller. Reason for this interface is that for testing purposes we can replace real controller with a dummy mock-up. More...

#include <mcontroller.h>

Inheritance diagram for MController:
Inheritance graph
[legend]
Collaboration diagram for MController:
Collaboration graph
[legend]

Public Types

enum  CAErrorSituation {
  OwnCertNotFound, DataBaseNotMountable, BadPassword, DbTransactionError,
  ContentEncryptionError, FileOperationError, TCLEvalError
}
 
enum  CAUserInterfaceRequest {
  ViewProfileDetails, ViewCa, ViewProfileComment, DisplayProgressDialog,
  VoiceCallToNode
}
 

Public Slots

virtual void exitApp ()=0
 
virtual void displayAboutBox ()=0
 
virtual void displayFront ()=0
 
virtual void handleError (MController::CAErrorSituation aError, const QString &aExplanation)=0
 
virtual NodegetNode () const =0
 
virtual NetworkListenernetworkListener () const =0
 
virtual Modelmodel () const =0
 
virtual void storePrivateDataOfSelectedProfile (bool aPublishTrustListToo=false)=0
 
virtual void reStorePrivateDataOfSelectedProfile ()=0
 
virtual bool isContactInContactList (const Hash &aFingerPrint) const =0
 
virtual QString displayableNameForProfile (const Hash &aProfileFingerPrint) const =0
 
virtual void offerDisplayNameForProfile (const Hash &aProfileFingerPrint, const QString &aDisplayName, const bool iUpdatePersistenStorage=false)=0
 
virtual void displayFileInfoOnUi (const BinaryFile &aFileMetadata)=0
 
virtual VoiceCallEnginevoiceCallEngine ()=0
 
virtual MVoiceCallEnginevoiceCallEngineInterface ()=0
 
virtual TclWrappertclWrapper ()=0
 
virtual QWidget * frontWidget ()=0
 
virtual QString getFileName (bool &aSuccess, bool aIsSaveFile=false, QString aSuggestedFileName=QString())=0
 

Public Member Functions

virtual void startRetrievingContent (NetworkRequestExecutor::NetworkRequestQueueItem aReq, bool aIsBackgroundDl, ProtocolItemType aTypeOfExpectedObject)=0
 
virtual void startRetrievingContent (CaDbRecord::SearchTerms aSearchTerms)=0
 
virtual void userInterfaceAction (CAUserInterfaceRequest aRequest, const Hash &aHashConcerned=KNullHash, const Hash &aFetchFromNode=KNullHash, const QString *aAdditionalInformation=NULL)=0
 
virtual void hideUI ()=0
 
virtual void showUI ()=0
 
virtual void setProfileInUse (const Hash &aProfileHash)=0
 
virtual const HashprofileInUse ()=0
 
virtual void setContentKeyPasswd (QString aPasswd)=0
 
virtual QString contentKeyPasswd () const =0
 

Detailed Description

Pure-virtual interface class for controller. This is spammed across parties needing access to application controller. Reason for this interface is that for testing purposes we can replace real controller with a dummy mock-up.

Member Enumeration Documentation

◆ CAErrorSituation

Enumeration for different errors that may occur within this app. Class controller is supposed to handle these and may be signaled an error

Enumerator
OwnCertNotFound 

Does not have own cert and can't generate

DataBaseNotMountable 

corrupt database or permission?

BadPassword 

Could not open encryption keys with given pwd

DbTransactionError 

something went foul with db

ContentEncryptionError 

something went foul with content encryption interface

FileOperationError 

Error related to binary files

TCLEvalError 

Error related to TCL evaluation

◆ CAUserInterfaceRequest

Enumeration for different user-interface actions that controller tries to route

Enumerator
ViewProfileDetails 

User wants to view details of profile

ViewCa 

User wants to view classified ad

ViewProfileComment 

User wants to view profile comment

DisplayProgressDialog 

puts wait dialog on screen

VoiceCallToNode 

User wants voice call to remote node

Member Function Documentation

◆ contentKeyPasswd()

virtual QString MController::contentKeyPasswd ( ) const
pure virtual

method for getting passwd of private content keys previously set, see method Controller::setContentKeyPasswd

Implemented in Controller.

◆ displayableNameForProfile

virtual QString MController::displayableNameForProfile ( const Hash aProfileFingerPrint) const
pure virtualslot

◆ displayAboutBox

virtual void MController::displayAboutBox ( )
pure virtualslot

bragging

◆ displayFileInfoOnUi

virtual void MController::displayFileInfoOnUi ( const BinaryFile aFileMetadata)
pure virtualslot

method that puts dialog or similar on display, about a published file

◆ displayFront

virtual void MController::displayFront ( )
pure virtualslot

this initializes the "normal" display

◆ exitApp

virtual void MController::exitApp ( )
pure virtualslot

quitting

◆ frontWidget

virtual QWidget* MController::frontWidget ( )
pure virtualslot

Method for getting front-widget, to be used as parent of dialogs spawned from non-ui threads

◆ getFileName

virtual QString MController::getFileName ( bool &  aSuccess,
bool  aIsSaveFile = false,
QString  aSuggestedFileName = QString() 
)
pure virtualslot

Method for getting file name. Method displays file selection dialog and returns the selected file. Idea of this method is that it may be called from background threads and it will display the dialog in UI thread, then report results back. This is a blocking method that will suspend execution of the calling thread for the duration while user is doing the selection.

Parameters
aSuccessis set to true if operation ends all right.
aIsSaveFileif set to true, "file save" dialog is shown, otherwise "file open" dialog.
aSuggestedFileNamefile name (pattern). If given empty, any file is suggested in dialog, if "*.jpg" is given, then dialog shall suggest only files with .jpg ending and if "foobar.txt" is given, then dialog will suggest literal file name "foobar.txt".
Returns
file system file name or empty if aSuccess is set to false.

◆ getNode

virtual Node& MController::getNode ( ) const
pure virtualslot

Method for node ; this may be changed during startup-phase but not after that

Implemented in Controller.

◆ handleError

virtual void MController::handleError ( MController::CAErrorSituation  aError,
const QString &  aExplanation 
)
pure virtualslot

Method for handling errors inside application.

Parameters
aErrorReason for error call, from error enum above
aExplanationNULL or human-readable description about what went wrong.

◆ hideUI()

virtual void MController::hideUI ( )
pure virtual

Implemented in Controller.

◆ isContactInContactList

virtual bool MController::isContactInContactList ( const Hash aFingerPrint) const
pure virtualslot

method for checking if contact is in contact list

◆ model

virtual Model& MController::model ( ) const
pure virtualslot

method for getting datamodel

Implemented in Controller.

◆ networkListener

virtual NetworkListener* MController::networkListener ( ) const
pure virtualslot

method for network listener ; it is parent of all connections, also the outgoing

Implemented in Controller.

◆ offerDisplayNameForProfile

virtual void MController::offerDisplayNameForProfile ( const Hash aProfileFingerPrint,
const QString &  aDisplayName,
const bool  iUpdatePersistenStorage = false 
)
pure virtualslot

◆ profileInUse()

virtual const Hash& MController::profileInUse ( )
pure virtual

method getting user profile in use.

Implemented in Controller.

◆ reStorePrivateDataOfSelectedProfile

virtual void MController::reStorePrivateDataOfSelectedProfile ( )
pure virtualslot

method for restoring private data of profile currently in use. shall be called after new profile is selected in frontwidget.

◆ setContentKeyPasswd()

virtual void MController::setContentKeyPasswd ( QString  aPasswd)
pure virtual

method for setting passwd used to open private content encryption rsa key. this password is stored in controller and is then used by content-open/sign-operations when crypto lib asks for password.

Implemented in Controller.

◆ setProfileInUse()

virtual void MController::setProfileInUse ( const Hash aProfileHash)
pure virtual

method selecting user profile in use.

Implemented in Controller.

◆ showUI()

virtual void MController::showUI ( )
pure virtual

method for showing UI

Implemented in Controller.

◆ startRetrievingContent() [1/2]

virtual void MController::startRetrievingContent ( NetworkRequestExecutor::NetworkRequestQueueItem  aReq,
bool  aIsBackgroundDl,
ProtocolItemType  aTypeOfExpectedObject 
)
pure virtual

Method that starts actions regarding content fetch from network

Parameters
aReqspecifies the content,at least iRequestType and iRequestedItem need to be there
aIsBackgroundDlis true if the retrieval may be queued into background as a low-priority item
aTypeOfExpectedObjectWhat kind of object is expected, possible values include ClassifiedAd, BinaryBlob and UserProfile from ProtocolItemType.

Implemented in Controller.

◆ startRetrievingContent() [2/2]

virtual void MController::startRetrievingContent ( CaDbRecord::SearchTerms  aSearchTerms)
pure virtual

Variant of "start fetch" method that starts fetch of db records.

Parameters
aSearchTermsDatabase query that fetched record should satisfy

Implemented in Controller.

◆ storePrivateDataOfSelectedProfile

virtual void MController::storePrivateDataOfSelectedProfile ( bool  aPublishTrustListToo = false)
pure virtualslot

method for storing private data of profile currently in use

Parameters
aPublishTrustListTooif set to true, has selected profiles trust list to be updated profile data and profile published with the new trust list.

◆ tclWrapper

virtual TclWrapper& MController::tclWrapper ( )
pure virtualslot

Method for getting tcl wrapper instance. If there is no instance one will be created

◆ userInterfaceAction()

virtual void MController::userInterfaceAction ( CAUserInterfaceRequest  aRequest,
const Hash aHashConcerned = KNullHash,
const Hash aFetchFromNode = KNullHash,
const QString *  aAdditionalInformation = NULL 
)
pure virtual

Method for requesting different things to take place in UI. controller mostly routes these to FrontWidget but other actions may be in order too..

Parameters
aRequestusers orders
aHashConcernedpossible hash parameter ; can be null hash if action is not about specific hash
aFetchFromNodepossible node hash parameter ; if concerning item is not found from local storage, try to fetch it from given node ; is KNullHash, then just do fetch using normal algorithm.
aAdditionalInformationpossible explanation or other info
Returns
none

Implemented in Controller.

◆ voiceCallEngine

virtual VoiceCallEngine* MController::voiceCallEngine ( )
pure virtualslot

Method for getting voice call engine. If there is no engine prior to call, one will be constructed

Returns
engine instance

◆ voiceCallEngineInterface

virtual MVoiceCallEngine* MController::voiceCallEngineInterface ( )
pure virtualslot

Method for getting voice call engine interface. If there is no engine prior to call, one will be constructed. The instance is the same that is returned via voiceCallEngine method.

Returns
engine instance, possibly a mock-up for testing purposes

The documentation for this class was generated from the following file: