76 // --------------------------------------------------------------------------- |
76 // --------------------------------------------------------------------------- |
77 // --------------------------------------------------------------------------- |
77 // --------------------------------------------------------------------------- |
78 // |
78 // |
79 void CVcxMyVideosMdsDb::ConstructL() |
79 void CVcxMyVideosMdsDb::ConstructL() |
80 { |
80 { |
81 MPX_FUNC( "CVcxMyVideosMdsDb::ConstructL" ); |
81 MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL start" ); |
82 |
82 |
83 iCmdQueue = CVcxMyVideosMdsCmdQueue::NewL( *this ); |
83 iCmdQueue = CVcxMyVideosMdsCmdQueue::NewL( *this ); |
84 |
84 |
85 iActiveSchedulerWait = new (ELeave) CActiveSchedulerWait; |
85 iActiveSchedulerWait = new (ELeave) CActiveSchedulerWait; |
86 |
86 |
87 MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL CMdESession::NewL" ); |
87 OpenMdsSessionL(); |
88 |
88 |
89 // Create session |
89 // Get the schema definitions |
|
90 GetSchemaDefinitionsL(); |
|
91 |
|
92 iAlbums = CVcxMyVideosMdsAlbums::NewL( *this, iAlbumsObserver ); |
|
93 |
|
94 TCallBack callBack( AsyncHandleQueryCompleted, this ); |
|
95 iAsyncHandleQueryCompleteCaller = new (ELeave) CAsyncCallBack( callBack, |
|
96 CActive::EPriorityStandard ); |
|
97 |
|
98 MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL exit" ); |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // CVcxMyVideosMdsDb::OpenMdsSessionL |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 void CVcxMyVideosMdsDb::OpenMdsSessionL() |
|
106 { |
|
107 MPX_DEBUG1( "CVcxMyVideosMdsDb::OpenMdsSessionL() start" ); |
|
108 |
90 iMdsError = KErrNone; |
109 iMdsError = KErrNone; |
91 |
110 |
92 iMdsSession = CMdESession::NewL( *this ); |
111 iMdsSession = CMdESession::NewL( *this ); |
93 if (!iMdsSession) |
112 if ( !iMdsSession ) |
94 { |
113 { |
95 // Failed to create session, leave |
114 // Failed to create session, leave |
96 User::Leave( iMdsError ); |
115 User::Leave( iMdsError ); |
97 } |
116 } |
98 |
117 |
99 // Wait until session opened |
|
100 iActiveSchedulerWait->Start(); |
|
101 |
|
102 MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL iActiveSchedulerWait->Start done" ); |
|
103 |
|
104 if ( iMdsError != KErrNone ) |
118 if ( iMdsError != KErrNone ) |
105 { |
119 { |
106 MPX_DEBUG2("Failed to create session to MDS: %d", iMdsError); |
120 MPX_DEBUG2("Failed to create session to MDS: %d", iMdsError); |
107 User::LeaveIfError( iMdsError ); |
121 User::LeaveIfError( iMdsError ); |
108 } |
122 } |
109 |
123 |
110 // Get the schema definitions |
124 // Wait until session opened |
111 iMdsError = KErrNone; |
125 iActiveSchedulerWait->Start(); |
112 GetSchemaDefinitionsL(); |
126 MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL iActiveSchedulerWait->Start done" ); |
113 |
127 |
114 // Is schema ok |
128 MPX_DEBUG1( "CVcxMyVideosMdsDb::OpenMdsSessionL Adding observers" ); |
115 if ( iMdsError != KErrNone ) |
|
116 { |
|
117 // Schema not loaded, abort |
|
118 User::Leave( iMdsError ); |
|
119 } |
|
120 |
|
121 MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL Adding observers" ); |
|
122 |
129 |
123 // We order all object notifications. If we set video condition, then we wont |
130 // We order all object notifications. If we set video condition, then we wont |
124 // receive remove notifications at all (mds feature). Extra notifications |
131 // receive remove notifications at all (mds feature). Extra notifications |
125 // do not bother us much since we try to fetch the item from the db |
132 // do not bother us much since we try to fetch the item from the db |
126 // after the add notification anyways, and then we use video condition. |
133 // after the add notification anyways, and then we use video condition. |
127 // Eventually extra events are ignored. |
134 // Eventually extra events are ignored. |
128 iMdsSession->AddObjectObserverL( *this, NULL ); |
135 iMdsSession->AddObjectObserverL( *this, NULL ); |
129 |
136 |
130 iMdsSession->AddObjectPresentObserverL( *this ); |
137 iMdsSession->AddObjectPresentObserverL( *this ); |
131 |
138 |
132 iAlbums = CVcxMyVideosMdsAlbums::NewL( *this, iAlbumsObserver ); |
139 MPX_DEBUG1( "CVcxMyVideosMdsDb::OpenMdsSessionL() exit" ); |
133 |
|
134 TCallBack callBack( AsyncHandleQueryCompleted, this ); |
|
135 iAsyncHandleQueryCompleteCaller = new (ELeave) CAsyncCallBack( callBack, |
|
136 CActive::EPriorityStandard ); |
|
137 } |
140 } |
138 |
141 |
139 // --------------------------------------------------------------------------- |
142 // --------------------------------------------------------------------------- |
140 // --------------------------------------------------------------------------- |
143 // --------------------------------------------------------------------------- |
141 // |
144 // |