Classified ads
|
Class for keeping app state. More...
#include <controller.h>
Public Slots | |
virtual void | exitApp () |
virtual void | displayAboutBox () |
virtual void | displayFront () |
virtual void | changeProfilePasswd () |
virtual void | createProfile () |
virtual void | deleteProfile () |
virtual void | selectProfile () |
virtual void | displaySettings () |
virtual void | displayStatus () |
virtual void | displaySearch () |
virtual void | displayTclProgs () |
virtual void | displayTclConsole () |
virtual void | handleError (MController::CAErrorSituation aError, const QString &aExplanation) |
void | notifyOfContentReceived (const Hash &aHashOfContent, const ProtocolItemType aTypeOfReceivedContent) |
void | notifyOfContentReceived (const Hash &aHashOfContent, const Hash &aHashOfClassification, const ProtocolItemType aTypeOfReceivedContent) |
void | notifyOfContentNotReceived (const Hash &aHashOfContent, const ProtocolItemType aTypeOfNotReceivdContent) |
virtual void | storePrivateDataOfSelectedProfile (bool aPublishTrustListToo=false) |
virtual void | reStorePrivateDataOfSelectedProfile () |
virtual bool | isContactInContactList (const Hash &aFingerPrint) const |
virtual QString | displayableNameForProfile (const Hash &aProfileFingerPrint) const |
virtual void | offerDisplayNameForProfile (const Hash &aProfileFingerPrint, const QString &aDisplayName, const bool iUpdatePersistenStorage=false) |
virtual void | displayFileInfoOnUi (const BinaryFile &aFileMetadata) |
virtual VoiceCallEngine * | voiceCallEngine () |
virtual MVoiceCallEngine * | voiceCallEngineInterface () |
virtual TclWrapper & | tclWrapper () |
virtual QWidget * | frontWidget () |
void | sendProfileUpdateQuery (const Hash &aProfileFingerPrint, const Hash &aProfileNodeFingerPrint=KNullHash) |
virtual QString | getFileName (bool &aSuccess, bool aIsSaveFile=false, QString aSuggestedFileName=QString()) |
Public Slots inherited from MController | |
virtual void | exitApp ()=0 |
virtual void | displayAboutBox ()=0 |
virtual void | displayFront ()=0 |
virtual void | handleError (MController::CAErrorSituation aError, const QString &aExplanation)=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 VoiceCallEngine * | voiceCallEngine ()=0 |
virtual MVoiceCallEngine * | voiceCallEngineInterface ()=0 |
virtual TclWrapper & | tclWrapper ()=0 |
virtual QWidget * | frontWidget ()=0 |
virtual QString | getFileName (bool &aSuccess, bool aIsSaveFile=false, QString aSuggestedFileName=QString())=0 |
Signals | |
void | userProfileSelected (const Hash &aProfile) |
void | waitDialogToBeDismissed () |
void | startGettingFileName (QString aSuggestedFileName, bool aIsSaveFile) |
Public Member Functions | |
Controller (QApplication &app) | |
~Controller () | |
bool | init () |
virtual void | startRetrievingContent (NetworkRequestExecutor::NetworkRequestQueueItem aReq, bool aIsBackgroundDl, ProtocolItemType aTypeOfExpectedObject) |
virtual void | startRetrievingContent (CaDbRecord::SearchTerms aSearchTerms) |
virtual void | userInterfaceAction (CAUserInterfaceRequest aRequest, const Hash &aHashConcerned=KNullHash, const Hash &aFetchFromNode=KNullHash, const QString *aAdditionalInformation=NULL) |
virtual void | hideUI () |
virtual void | showUI () |
virtual void | setProfileInUse (const Hash &aProfileHash) |
virtual const Hash & | profileInUse () |
virtual void | setContentKeyPasswd (QString aPasswd) |
virtual QString | contentKeyPasswd () const |
virtual Node & | getNode () const |
virtual NetworkListener * | networkListener () const |
virtual Model & | model () const |
void | addObjectToOpen (QUrl aClassifiedAdsObject) |
void | checkForSharedMemoryContents () |
Private Slots | |
void | checkForObjectToOpen (const Hash &aIgnored) |
void | getFileNameSlot (QString aSuggestedFileName, bool aIsSaveFile) |
Private Member Functions | |
void | createMenus () |
int | createPidFile () |
void | deletePidFile () |
bool | createSharedMemSegment (QString &aSegmentName) |
Additional Inherited Members | |
Public Types inherited from MController | |
enum | CAErrorSituation { OwnCertNotFound, DataBaseNotMountable, BadPassword, DbTransactionError, ContentEncryptionError, FileOperationError, TCLEvalError } |
enum | CAUserInterfaceRequest { ViewProfileDetails, ViewCa, ViewProfileComment, DisplayProgressDialog, VoiceCallToNode } |
Class for keeping app state.
C of MVC-pattern is considered here. UI events are routed via this class and this implements scheduling of events so that things happen in correct order.
Controller::Controller | ( | QApplication & | app | ) |
constructor. see also method .
Controller::~Controller | ( | ) |
Destructor
void Controller::addObjectToOpen | ( | QUrl | aClassifiedAdsObject | ) |
method for setting an URL to open. Url is opened only if it is of classified-ads URL scheme, currently supported protocols are caprofile, caad, cacomment and cablob and if URL scheme is not among those, this method does no thing. Host part contains hash of object, other parts are ignored.
aClassifiedAdsObject | object to bring visible to user |
|
virtualslot |
name says it all. initiates UI sequence
|
privateslot |
void Controller::checkForSharedMemoryContents | ( | ) |
method called if old instance of this program is signaled from new instace, calling for this instance to bring itself to front, and, in this method, to check if there is object mentioned in shared memory segment that needs to be displayed
|
virtual |
method for getting passwd of private content keys previously set, see method Controller::setContentKeyPasswd
Implements MController.
|
private |
menus here
|
private |
leave a mark to filesystem about instance
|
virtualslot |
Initiates UI sequence for new profile
|
private |
creates and possibly populates a shared memory segment for IPC needs
|
private |
remove mark from filesystem about instance
|
virtualslot |
Initiates UI sequence for deleting profile
|
virtualslot |
method for producing a displayable version of a profile. in practice this utilitizes the contacts of the selected profile and a cache that is collected from private messages, ads, profile comments and profiles
|
virtualslot |
bragging
|
virtualslot |
method that puts dialog or similar on display, about a published file
|
virtualslot |
this initializes the "normal" display
|
virtualslot |
Slot for displaying search dialog
|
virtualslot |
Slot for displaying node settings
|
virtualslot |
Slot for displaying network status
|
virtualslot |
Slot for displaying TCL console
|
virtualslot |
Slot for displaying TCL library
|
virtualslot |
quitting
|
virtualslot |
Method for getting front-widget, to be used as parent of dialogs spawned from non-ui threads. From MController interface.
|
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.
aSuccess | is set to true if operation ends all right. |
aIsSaveFile | if set to true, "file save" dialog is shown, otherwise "file open" dialog. |
aSuggestedFileName | file 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". |
|
privateslot |
processing of method addObjectToOpen worker-slot for getFileName method ; this slot will be called in queued manner and have its code run in UI thread.
|
virtual |
Method for node ; this may be changed during startup-phase but not after that
Implements MController.
|
virtualslot |
Method for handling errors inside application.
aError | Reason for error call, from error enum above |
aExplanation | NULL or human-readable description about what went wrong. |
|
virtual |
method for hiding UI
Implements MController.
bool Controller::init | ( | ) |
Constructor extras. Constructor may fail but there is no way to communicate that. Design is now so that constructor only allocates memory and initializes member variables, this method here, contains constructor logic and it may fail.
|
virtualslot |
method for checking if a profile is found from contact list of selected user
|
virtual |
method for getting datamodel
Implements MController.
|
virtual |
method for network listener ; it is parent of all connections, also the outgoing
Implements MController.
|
slot |
This is receiving slot of signals sent from retrieval engine; when we try to receive content and we do not get any, this notifies user that time-out is due
aHashOfContent | item that was requested |
aTypeOfNotReceivdContent | item type requested |
|
slot |
This is receiving slot of signals sent from actual content handlers ; when we receive new content, this method is hit, reason for this is that we may be waiting for specific content somewhere
aHashOfContent | item that was requested |
aTypeOfReceivedContent | item type requested |
|
slot |
This is receiving slot of signals sent from actual content handlers ; when we receive new content, this method is hit, reason for this is that we may be waiting for specific content somewhere. This overload is mostly hit by classified ads.
aHashOfContent | item that was requested |
aHashOfClassification | of item that was requested |
aTypeOfReceivedContent | item type requested |
|
virtualslot |
method for keeping profile hash<->displayname relation up to date. this is called when display names are seen in profiles, ads, private messages etc.
|
virtual |
method getting user profile in use.
Implements MController.
|
virtualslot |
method for restoring private data of profile currently in use. shall be called after new profile is selected in frontwidget.
|
virtualslot |
Initiates UI sequence for selecting profile
|
slot |
method for sending a poll around network regarding possible update for a profile and possible addition of comments about given profile.
datamodel should not be locked when this is called.
in practice this is called after user selects a profile to be viewed ; it could be called periodically too for selected profiles..
aProfileFingerPrint | is fingerprint of the profile concerned. |
aProfileNodeFingerPrint | fingerprint of node that is suspected to be the node where profile is published from. this is naturally good candidate for sending the query. |
|
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.
Implements MController.
|
virtual |
method selecting user profile in use.
Implements MController.
|
virtual |
method for showing UI
Implements MController.
|
signal |
signal for launching file selection dlg
|
virtual |
method that starts actions regarding content fetch from network
aReq | specifies the content,at least iRequestType and iRequestedItem need to be there |
aIsBackgroundDl | is true if the retrieval may be queued into background as a low-priority item |
Implements MController.
|
virtual |
Variant of "start fetch" method that starts fetch of db records.
aSearchTerms | Database query that fetched record should satisfy |
Implements MController.
|
virtualslot |
Method for persisting profile private data inside datamodel. Tnis is supposed to be called every time after private data changes.
lock the datamodel before calling this method
aPublishTrustListToo | if set to true, has selected profiles trust list to be updated profile data and profile published with the new trust list. |
|
virtualslot |
Method for getting tcl wrapper instance. If there is no instance one will be created. From MController interface.
|
virtual |
From MController.
Method for requesting different things to take place in UI. controller mostly routes these to FrontWidget but other actions may be in order too..
aRequest | users orders |
aHashConcerned | possible hash parameter ; can be null hash if action is not about specific hash |
aFetchFromNode | possible 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. |
aAdditionalInformation | possible explanation or other info |
Implements MController.
|
signal |
|
virtualslot |
Method for getting voice call engine, if there is any. From MController interface.
|
virtualslot |
Method for getting voice call engine, if there is any. From MController interface.
|
signal |
used for signalling possible wait dialog about dismissal
|
private |
|
private |
|
private |
|
private |
normally points to "frontwidget" instance
|
private |
Logic for fetcing db records from other nodes
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
variable used in getFileName wrapper: points to dialog
|
private |
variable used in getFileName wrapper: holds result string
|
private |
variable used in getFileName wrapper: mutex that is locked for duration while iGetFileNameDialog is on display
|
private |
variable used in getFileName wrapper: result from file selection dialog
|
private |
profile hash<->display_name mapping
|
private |
hash of object that user needs to wait.
|
private |
hash of profile comment that user needs to wait. This is used in two-stage fetch process of profile comment where the profile may need to be retrieved first, then the comment: we store there the profile comment hash for duration of profile fetch
|
private |
Flag for destructor. If this is on, don't allocate more objects
|
private |
|
private |
Incoming connections handler, for ipv4
|
private |
data storage animal
|
private |
Outgoing connections handler
|
private |
our network presence object, there is single instance
|
private |
Node where to ask for profile comment once profile has been fetched
|
private |
pending object to open
|
private |
|
private |
|
private |
passwd used to protect profile private RSA key fingerprint of profile currently in use
|
private |
|
private |
Logic for handling content publish
|
private |
|
private |
Logic for fetcing stuff from other nodes
|
private |
Shared memory block for receiving iObjectToOpen from external process.
|
private |
Menu item for opening tcl console dialog
|
private |
Menu item for opening tcl lib dialog
|
private |
|
private |
wraps TCL interpreter
|
private |
if user requests for item that we do not have, lets put a wait dialog in place and start wait for the object to appear from network. in order to properly dismiss the dialog, have here type (and later hash) of the objects that we're waiting for
|
private |
Currently there is support for one voice call at time
|
private |