epoc32/include/cdbpreftable.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 cdbpreftable.h
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Comms Database Connection Preference Table header
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @publishedAll
       
    23  @deprecated since v9.1. Functionality is replaced with commsdat.
       
    24 */
       
    25 
       
    26 #ifndef CDBPREFTABLE_H
       
    27 #define	CDBPREFTABLE_H
       
    28 
       
    29 #include <d32dbms.h>
       
    30 #include <cdbcols.h>
       
    31 #include <cdblen.h>
       
    32 
       
    33 class CCommsDatabase;
       
    34 class TCommDbCommonBearerInfo;
       
    35 class CCommDbTableExtension;
       
    36 class CCommsDbTableView;
       
    37 //Created via CCommsDatabase::OpenConnectionPrefTableLC() or NewLC().
       
    38 //Uses a CCommsDatabase and has an RDbView for access to the database.
       
    39 class CCommsDbConnectionPrefTableView : public CBase
       
    40 /**
       
    41 
       
    42 Implements actions on records of the Connection Preferences table, to allow clients to set
       
    43 the preferred order in which connections are attempted.
       
    44 
       
    45 The class is similiar to CCommsDbTableView, but only allows access to connection
       
    46 preferences as a set and not to individual fields in the table. This prevents
       
    47 inappropriate updates of the records. Like CCommsDbTableView, the class has
       
    48 a group of functions for navigating through the records in the view, and another
       
    49 group for setting fields in the current record.
       
    50 
       
    51 Clients do not create this type of object, but get an instance through
       
    52 CCommsDatabase::OpenConnectionPrefTableLC(),
       
    53 CCommsDatabase::OpenConnectionPrefTableInRankOrderLC(), or
       
    54 CCommsDatabase::OpenConnectionPrefTableViewOnRankLC().
       
    55 
       
    56 In addition to the leave codes documented, all leaving functions can leave
       
    57 with any error returned by DBMS during database manipulation.
       
    58 
       
    59 @see CCommDbOverrideSettings::GetConnectionPreferenceOverride()
       
    60 @see CCommDbOverrideSettings::SetConnectionPreferenceOverride()
       
    61 @publishedAll
       
    62 @released */
       
    63 	{
       
    64 public:
       
    65 	friend class CCommsDatabaseBase;
       
    66 
       
    67 public:
       
    68 	class TCommDbIapBearer
       
    69 	/** Encapsulates the bearer set (CONNECT_PREF_BEARER_SET) and IAP (CONNECT_PREF_IAP)
       
    70 	fields.
       
    71 	Used in calls to UpdateBearerL() and as a public member of TCommDbIapConnectionPref.
       
    72 	@publishedAll
       
    73 	@released */
       
    74 		{
       
    75 	public:
       
    76 		IMPORT_C TCommDbIapBearer();
       
    77 	public:
       
    78 		/** Value for the bearer set (CONNECT_PREF_BEARER_SET) field. */
       
    79 		TUint32 iBearerSet;
       
    80 		/** Value for the IAP (CONNECT_PREF_IAP) field. */
       
    81 		TUint32 iIapId;
       
    82 		};
       
    83 
       
    84 	class TCommDbIapConnectionPref
       
    85 	/** Encapsulates the rank (CONNECT_PREF_RANKING), direction (CONNECTION_PREF_DIRECTION),
       
    86 	and dialog preference (CONNECT_PREF_DIALOG_PREF) fields, plus a TCommDbIapBearer
       
    87 	object.
       
    88 	A complete connection preference - containing rank, direction, dialogue option,
       
    89 	bearers for the dialogue and the prefered IAP.
       
    90 	@see TCommDbConnectionDirection
       
    91 	@publishedAll
       
    92 	@released */
       
    93 		{
       
    94 	public:
       
    95 		IMPORT_C TCommDbIapConnectionPref();
       
    96 		IMPORT_C TBool operator==(const TCommDbIapConnectionPref& aPref) const;
       
    97 	public:
       
    98 		/** Value for the rank (CONNECT_PREF_BEARER_SET) field. */
       
    99 		TUint32 iRanking;
       
   100 		/** Value for the direction (CONNECTION_PREF_DIRECTION) field.
       
   101 
       
   102 		@see TCommDbConnectionDirection */
       
   103 		TCommDbConnectionDirection iDirection;
       
   104 		/** Value for the dialog preference (CONNECT_PREF_DIALOG_PREF) field.
       
   105 
       
   106 		@see TCommDbDialogPref */
       
   107 		TCommDbDialogPref iDialogPref;
       
   108 		/** Values for the bearer (CONNECT_PREF_BEARER_SET) and IAP (CONNECT_PREF_IAP) fields.
       
   109 
       
   110 		@see TCommDbIapBearer */
       
   111 		TCommDbIapBearer iBearer;
       
   112 		};
       
   113 
       
   114 	class TCommDbIspBearer
       
   115 	/**
       
   116 
       
   117 	Frame left in place for BC with 6.1
       
   118 	@publishedAll
       
   119 	@deprecated 7.0 */
       
   120 		{
       
   121 	public:
       
   122 		IMPORT_C TCommDbIspBearer();
       
   123 		};
       
   124 
       
   125 	class TCommDbIspConnectionPref
       
   126 /**
       
   127 @publishedAll
       
   128 @deprecated
       
   129 */
       
   130 		{
       
   131 	public:
       
   132 		IMPORT_C TCommDbIspConnectionPref();
       
   133 		IMPORT_C TBool operator==(const TCommDbIspConnectionPref& aPref) const;
       
   134 	public:
       
   135 		TCommDbIspBearer iBearer;
       
   136 		};
       
   137 
       
   138 public:
       
   139 	IMPORT_C virtual ~CCommsDbConnectionPrefTableView();
       
   140 
       
   141 	static CCommsDbConnectionPrefTableView* NewLC(CCommsDatabase& aDb, const TDbQuery& aQuery);
       
   142 	static CCommsDbConnectionPrefTableView* NewLC(CCommsDatabase& aDb, TCommDbConnectionDirection aDirection, TBool aSortRanking = EFalse);
       
   143 	static CCommsDbConnectionPrefTableView* NewL(CCommsDatabase& aDb, TCommDbConnectionDirection aDirection,	TUint32 aRank);
       
   144 
       
   145 	IMPORT_C void InsertConnectionPreferenceL(const TCommDbIapConnectionPref& aPref, TBool aReadOnly = EFalse);
       
   146 
       
   147 	IMPORT_C void ReadConnectionPreferenceL(TCommDbIapConnectionPref& aPref);
       
   148 
       
   149 	IMPORT_C void UpdateBearerL(const TCommDbIapBearer& aUpdate, TBool aReadOnly = EFalse);
       
   150 
       
   151 	IMPORT_C void UpdateDialogPrefL(const TCommDbDialogPref& aUpdate);
       
   152 
       
   153 	IMPORT_C void ChangeConnectionPreferenceRankL(TUint32 aNewRank);
       
   154 
       
   155 	IMPORT_C void DeleteConnectionPreferenceL();
       
   156 
       
   157 	IMPORT_C void SwapConnectionPreferencesL(TCommDbConnectionDirection aDirection, TUint32 aFirstRank, TUint32 aSecondRank);
       
   158 
       
   159 	IMPORT_C TInt GotoFirstRecord();
       
   160 
       
   161 	IMPORT_C TInt GotoNextRecord();
       
   162 
       
   163 	IMPORT_C TInt GotoPreviousRecord();
       
   164 
       
   165 	//
       
   166 	// ISP Connection Preference record operations
       
   167 	// All these were deprecated in 7.0 but have now
       
   168 	// been re-instated in limited form to accomodate 6.1 BC
       
   169 	//
       
   170 	IMPORT_C void InsertConnectionPreferenceL(const TCommDbIspConnectionPref& aPref, TBool aReadOnly = EFalse);
       
   171 	IMPORT_C void UpdateBearerL(const TCommDbIspBearer& aUpdate, TBool aReadOnly = EFalse);
       
   172 	IMPORT_C void ReadConnectionPreferenceL(TCommDbIspConnectionPref& aPref);
       
   173 
       
   174 protected:
       
   175 	CCommsDbConnectionPrefTableView(CCommsDatabase& aDb);
       
   176 	void ConstructL(const TDbQuery& aQuery);
       
   177 	void ConstructL(TCommDbConnectionDirection aDirection, TBool aSortRanking);
       
   178 	void ConstructL(TCommDbConnectionDirection aDirection, TUint32 aRank);
       
   179 	void Close();
       
   180 	void  OpenL(const TDbQuery& aQuery);
       
   181 	RDbRowSet::TAccess GetL();
       
   182 	inline TDbColNo ColNum(const TDesC& aColumn) const;
       
   183 	void GetUint32L(const TDesC& aColumnName, TUint32& aValue);
       
   184 
       
   185 private:
       
   186 	void SetRankL(TUint32 aNewRank);
       
   187 	void DoSwapConnectionPreferencesL(TCommDbConnectionDirection aDirection, TUint32 aFirstRank, TUint32 aSecondRank);
       
   188 
       
   189 protected:
       
   190 	/** DBMS view. Variable not used in shim. Not removed because of BC break */
       
   191 	RDbView iTableView;
       
   192 	CCommDbTableExtension* iTableExt;
       
   193 
       
   194 	/** Comms data base that is being viewed. */
       
   195 	CCommsDatabase& iDb;
       
   196 	};
       
   197 
       
   198 #endif