📄 entryappview.h
字号:
/*
============================================================================
Name : EntryAppView.h
Author : Sazzad and Mozaharul
Copyright : @Encryption 2008
Description : Declares view class for application.
============================================================================
*/
#ifndef __ENTRYAPPVIEW_h__
#define __ENTRYAPPVIEW_h__
// INCLUDES
#include <coecntrl.h>
#include <aknsettingitemlist.h>
#include <d32dbms.h>
#include <badesca.h>
#include <f32file.h>
#include <e32std.h>
#include <cryptosymmetric.h>
#include <cryptopadding.h>
class TDbItem
{
public:
TDbItem(): iId(-1){};
public:
TInt iId;
TBuf<160> iSms;
};
// CLASS DECLARATION
class CEntryAppView : public CCoeControl
{
public:
// New methods
/**
*AddView.
*Call the GetTextL() function to get the SMS text from the text dialog
*/
void AddView();
/**
*DataView.
*To raed the data from database to call ConForReadDbItemsL()
*/
void DataView();
/**
*GetTextL.
*Create a Text dialog box to write text
*/
TInt GetTextL();
/**
*EncryptMsg.
*Perform the encryption operation on text
* @returns a 16 bit descriptor containing encrypted data
*/
const TDes& EncryptMsg();
/**
*DecryptMsg.
* Perform the decryption operation on text
* @param the encryted text
* @returns the plain text
*/
const TDes& DecryptMsg(const TDes &KData);
/**
* CreateDescInstance.
* Create the instances for data encryption and decryption
*/
void CreateDescInstance();
/**
* DeleteDescInstance.
* Clean the stack that containing the encryption and decryption instances
*/
void DeleteDescInstance();
/**
* CreateDb.
* To create or open the database
*/
void CreateDb();
/**
* SaveToDatabaseL.
* save the encrypted data to the database
* @param aIndex is the index of the database
*/
void SaveToDatabaseL(TInt& aIndex);
/**
* ConForReadDbItemsL.
* connection to the database to read data
*/
void ConForReadDbItemsL();
/**
* ReadDataL.
* Read the data from database with decryption
*/
void ReadDataL();
/**
* NewL.
* Two-phased constructor.
* Create a CEntryAppView object, which will draw itself to aRect.
* @param aRect The rectangle this view will be drawn to.
* @return a pointer to the created instance of CEntryAppView.
*/
static CEntryAppView* NewL(const TRect& aRect);
/**
* NewLC.
* Two-phased constructor.
* Create a CEntryAppView object, which will draw itself
* to aRect.
* @param aRect Rectangle this view will be drawn to.
* @return A pointer to the created instance of CEntryAppView.
*/
static CEntryAppView* NewLC(const TRect& aRect);
/**
* ~CEntryAppView
* Virtual Destructor.
*/
virtual ~CEntryAppView();
public:
// Functions from base classes
/**
* From CCoeControl, Draw
* Draw this CEntryAppView to the screen.
* @param aRect the rectangle of this view that needs updating
*/
void Draw(const TRect& aRect) const;
/**
* From CoeControl, SizeChanged.
* Called by framework when the view size is changed.
*/
virtual void SizeChanged();
private:
// Constructors
/**
* CreateTableL
* Create a database table
* @param aDatabase read the database
*/
void CreateTableL(RDbDatabase& aDatabase);
TBuf<160> SMSText;
RDbNamedDatabase iItemsDatabase;
RFs iFsSession;
TInt iIndex;
CDESEncryptor* iTrans;
TInt KDESBlockSize;
CDESDecryptor* iDec;
CPaddingPKCS7* pad2;
CBufferedTransformation* iDecbuf;
CPaddingPKCS7* pad;
CBufferedTransformation* iBfrd;
TBuf8<160> deskey;
TBuf8<160> indata,encdata;
//RArray<TEntryItem>& aItemArray;
private:
// Constructors
/**
* ConstructL
* 2nd phase constructor.
* Perform the second phase construction of a
* CEntryAppView object.
* @param aRect The rectangle this view will be drawn to.
*/
void ConstructL(const TRect& aRect);
/**
* CEntryAppView.
* C++ default constructor.
*/
CEntryAppView();
};
#endif // __ENTRYAPPVIEW_h__
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -