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