1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/loggingservices/eventlogger/LogCli/src/LOGVIEW.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,795 @@
1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <logview.h>
1.20 +
1.21 +// User includes
1.22 +#include <logwrap.h>
1.23 +#include <logcli.h>
1.24 +#include "logclipanic.h"
1.25 +#include "logservcli.h"
1.26 +#include "logpackage.h"
1.27 +#include "logclientop.h"
1.28 +#include "LogViewObserver.h"
1.29 +#include "LogViewWindow.h"
1.30 +
1.31 +// Constants
1.32 +const TInt KLogDefaultWindowSize = 10;
1.33 +
1.34 +//**********************************
1.35 +// CLogView
1.36 +//**********************************
1.37 +
1.38 +CLogView::CLogView(CLogClient& aClient, TInt aPriority/* = CActive:EPriorityStandard*/)
1.39 +: CLogActive(aPriority), iClient(aClient)
1.40 + {
1.41 + // Get the view id
1.42 + iViewId = iClient.Session().AllocateIdView();
1.43 + }
1.44 +
1.45 +EXPORT_C CLogView::~CLogView()
1.46 +/** Frees all resources owned by this object prior to its destruction. In particular,
1.47 +any outstanding asynchronous request is cancelled. */
1.48 + {
1.49 + Cancel();
1.50 +
1.51 + delete iEvent;
1.52 + delete iPackage;
1.53 + delete iMaintain;
1.54 + delete iLogViewObserver;
1.55 + delete iWindow;
1.56 +
1.57 + // Delete the view
1.58 + iClient.Session().Send(ELogViewDelete, TIpcArgs(iViewId)); // Not much we can do if this goes wrong
1.59 + }
1.60 +
1.61 +void CLogView::ConstructL(TInt aType, MLogViewChangeObserver* aObserver)
1.62 + {
1.63 + iType = aType;
1.64 + iLogViewChangeObserver = aObserver;
1.65 + iPackage = CLogPackage::NewL();
1.66 + iEvent = CLogEvent::NewL();
1.67 + iMaintain = new(ELeave)CLogMaintainClientOp(iClient.Session(), *iPackage, Priority());
1.68 +
1.69 + PrepareViewChildrenL();
1.70 + }
1.71 +
1.72 +void CLogView::NotifyLogServerTerminatedL()
1.73 + {
1.74 + PrepareViewChildrenL();
1.75 + }
1.76 +
1.77 +void CLogView::PrepareViewChildrenL()
1.78 + {
1.79 + // Construct the view in the server
1.80 + TIpcArgs aArgs;
1.81 + aArgs.Set(0, iViewId);
1.82 + aArgs.Set(1, iType);
1.83 +
1.84 + User::LeaveIfError(iClient.Session().Send(ELogViewCreate, aArgs));
1.85 + CLogViewWindow* window = new(ELeave)
1.86 + CLogViewWindow(iClient.Session(), iViewId, KLogDefaultWindowSize,
1.87 + iLogViewChangeObserver, CActive::EPriorityIdle);
1.88 +
1.89 + delete iWindow;
1.90 + iWindow = window;
1.91 + iWindow->ConstructL(*iPackage);
1.92 +
1.93 + // The Log view observer receives all events from the log server. It then cascades them to an object owned by
1.94 + // the log window. In turn this object (CLogViewWindowChangeObserver) cascades them back to the log window.
1.95 + // Finally, the log window passes them back up to the client of the log engine, i.e aObserver.
1.96 + CLogViewObserver* observer = CLogViewObserver::NewL(*this, iClient, iWindow->ChangeObserver(), iViewId, Priority());
1.97 + delete iLogViewObserver;
1.98 + iLogViewObserver = observer;
1.99 + }
1.100 +
1.101 +EXPORT_C TBool CLogView::FirstL(TRequestStatus& aStatus)
1.102 +/** Moves the current position in the view to the first event. The first event
1.103 +is the most recent event.
1.104 +
1.105 +This is an asynchronous request.
1.106 +
1.107 +@param aStatus The request status. On request completion, contains:KErrNone,
1.108 +if the position in the view has been successfully moved; otherwise, one of
1.109 +the other system wide error codes.
1.110 +@return ETrue, if the function has successfully issued the asynchronous request.
1.111 +EFalse, if there are no events in the view. */
1.112 + {
1.113 + return NavigateL(ELogNavigateFirst, aStatus);
1.114 + }
1.115 +
1.116 +EXPORT_C TBool CLogView::LastL(TRequestStatus& aStatus)
1.117 +/** Moves the current position in the view to the last event. The last event is
1.118 +the oldest event.
1.119 +
1.120 +This is an asynchronous request.
1.121 +
1.122 +@param aStatus The request status. On request completion, contains:KErrNone,
1.123 +if the position in the view has been successfully moved; otherwise, one of
1.124 +the other system wide error codes.
1.125 +@return ETrue, if the function has successfully issued the asynchronous request.
1.126 +EFalse, if there are no events in the view. */
1.127 + {
1.128 + return NavigateL(ELogNavigateLast, aStatus);
1.129 + }
1.130 +
1.131 +EXPORT_C TBool CLogView::NextL(TRequestStatus& aStatus)
1.132 +/** Moves the current position in the view to the next event. The next event is
1.133 +always older than the current event, i.e. next implies movement in the first
1.134 +to last direction.
1.135 +
1.136 +@param aStatus The request status. On request completion, contains:KErrNone,
1.137 +if the position in the view has been successfully moved; otherwise, one of
1.138 +the other system wide error codes.
1.139 +@return ETrue, if the function has successfully issued the asynchronous request.
1.140 +EFalse, if there are no events in the view. */
1.141 + {
1.142 + return NavigateL(ELogNavigateForwards, aStatus);
1.143 + }
1.144 +
1.145 +EXPORT_C TBool CLogView::PreviousL(TRequestStatus& aStatus)
1.146 +/** Moves the current position in the view to the previous event. The previous
1.147 +event is always more recent than the current event, i.e. previous implies
1.148 +movement in the last to first direction.
1.149 +
1.150 +@param aStatus The request status. On request completion, contains:KErrNone,
1.151 +if the position in the view has been successfully moved; otherwise, one of
1.152 +the other system wide error codes.
1.153 +@return ETrue, if the function has successfully issued the asynchronous request.
1.154 +EFalse, if there are no events in the view. */
1.155 + {
1.156 + return NavigateL(ELogNavigateBackwards, aStatus);
1.157 + }
1.158 +
1.159 +EXPORT_C TInt CLogView::CountL()
1.160 +/** Gets the number of events in the view.
1.161 +
1.162 +@return The number of events in the view. */
1.163 + {
1.164 + // Just return zero if the view isn't setup
1.165 + if (!IsValid() && !LogViewRecordCount())
1.166 + {
1.167 + return 0;
1.168 + }
1.169 +
1.170 + // Ask the server the number of events in this view
1.171 + const TInt count = iClient.Session().Send(ELogViewCount, TIpcArgs(iViewId));
1.172 +
1.173 + User::LeaveIfError(count);
1.174 + return count;
1.175 + }
1.176 +
1.177 +EXPORT_C void CLogView::SetFlagsL(TLogFlags aFlags)
1.178 +/**
1.179 +@capability Note For built-in event types, the required capability level is defined in
1.180 +the event type's write access policy. */
1.181 + {
1.182 + // To preserve the same server side interface as an operation
1.183 + TPckgBuf<TLogClientServerData> data;
1.184 + data().iOperationType = ELogOperationViewSetFlags;
1.185 + data().iOperationId = KLogNullOperationId;
1.186 + //
1.187 + User::LeaveIfError(iClient.Session().Send(ELogViewOperationInitiate, TIpcArgs(&data,iViewId,aFlags)));
1.188 + }
1.189 +
1.190 +TBool CLogView::NavigateL(TInt aPosition, TRequestStatus& aStatus)
1.191 + {
1.192 + __ASSERT_ALWAYS(!IsActive(), Panic(ELogAlreadyActive1));
1.193 + if (!IsValid() && !LogViewRecordCount())
1.194 + {
1.195 + return EFalse;
1.196 + }
1.197 + //
1.198 + const TLogNavigation navigationPosition = static_cast<TLogNavigation>(aPosition);
1.199 + const TBool requestIssued = iWindow->NavigateL(navigationPosition, iStatus);
1.200 + //
1.201 + if (requestIssued)
1.202 + {
1.203 + Queue(aStatus);
1.204 + SetActive();
1.205 + // iValid is false if at time of SetFilterL there is no event.
1.206 + // If iWindow->NavigateL returns ETrue then there are always
1.207 + // events in the view.
1.208 + iValid = ETrue;
1.209 + }
1.210 + //
1.211 + return requestIssued;
1.212 + }
1.213 +
1.214 +void CLogView::DoRunL()
1.215 + {
1.216 + if (iStatus.Int() == KErrNone)
1.217 + ReadEventFromWindowL();
1.218 + }
1.219 +
1.220 +void CLogView::DoCancel()
1.221 + {
1.222 + iWindow->Cancel();
1.223 + CLogActive::DoCancel();
1.224 + }
1.225 +
1.226 +void CLogView::ReadEventFromWindowL()
1.227 + {
1.228 + CLogEvent* event = CLogEvent::NewL();
1.229 + delete iEvent;
1.230 + iEvent = event;
1.231 + iEvent->CopyL(iWindow->CurrsorEvent());
1.232 + }
1.233 +
1.234 +void CLogView::ReawaitForChanges()
1.235 + {
1.236 + iLogViewObserver->Cancel();
1.237 + iLogViewObserver->RequestChanges();
1.238 + }
1.239 +
1.240 +//
1.241 +// The CLogViewWindow member has an observer to receive changes
1.242 +// in events. If events are added to database after SetFilterL then
1.243 +// iWindow would know about them.
1.244 +TInt CLogView::LogViewRecordCount() const
1.245 + {
1.246 + if (iWindow)
1.247 + {
1.248 + return iWindow->ViewRecordCount();
1.249 + }
1.250 + return 0;
1.251 + }
1.252 +
1.253 +
1.254 +
1.255 +
1.256 +
1.257 +
1.258 +
1.259 +
1.260 +
1.261 +
1.262 +
1.263 +
1.264 +
1.265 +
1.266 +
1.267 +
1.268 +//**********************************
1.269 +// CLogViewEvent
1.270 +//**********************************
1.271 +
1.272 +CLogViewEvent::CLogViewEvent(CLogClient& aClient, TInt aPriority)
1.273 +: CLogView(aClient, aPriority)
1.274 + {
1.275 + }
1.276 +
1.277 +EXPORT_C CLogViewEvent::~CLogViewEvent()
1.278 +/** Frees all resources owned by the object prior to its destruction. In particular,
1.279 +any outstanding asynchronous request is cancelled */
1.280 + {
1.281 + Cancel();
1.282 + }
1.283 +
1.284 +void CLogViewEvent::ConstructL(MLogViewChangeObserver* aObserver)
1.285 + {
1.286 + CLogView::ConstructL(ELogViewTypeEvent, aObserver);
1.287 + }
1.288 +
1.289 +EXPORT_C CLogViewEvent* CLogViewEvent::NewL(CLogClient& aClient, TInt aPriority)
1.290 + {
1.291 + CLogViewEvent* self = new(ELeave)CLogViewEvent(aClient, aPriority);
1.292 + CleanupStack::PushL(self);
1.293 + self->ConstructL();
1.294 + CleanupStack::Pop(self);
1.295 + return self;
1.296 + }
1.297 +
1.298 +EXPORT_C CLogViewEvent* CLogViewEvent::NewL(CLogClient& aClient, MLogViewChangeObserver& aObserver, TInt aPriority)
1.299 + {
1.300 + CLogViewEvent* self = new(ELeave)CLogViewEvent(aClient, aPriority);
1.301 + CleanupStack::PushL(self);
1.302 + self->ConstructL(&aObserver);
1.303 + CleanupStack::Pop(self);
1.304 + return self;
1.305 + }
1.306 +
1.307 +EXPORT_C TBool CLogViewEvent::SetFilterL(const CLogFilter& aFilter, TRequestStatus& aStatus)
1.308 +/** Initialises or refreshes the event view defined by the specified filter.
1.309 +
1.310 +The view can only be used after the request completes successfully.
1.311 +
1.312 +@param aFilter The filter.
1.313 +@param aStatus The request status. On request completion, contains:KErrNone,
1.314 +if the view has been successfully initialised or refreshed;one of the other
1.315 +system wide error codes, otherwise.
1.316 +@return ETrue, if the function has successfully issued the asynchronous request.
1.317 +EFalse, if there are no events in the view.
1.318 +@capability Note None required.*/
1.319 + {
1.320 + CLogFilterList* list = new(ELeave)CLogFilterList;
1.321 + CleanupStack::PushL(list);
1.322 + list->AppendL(&aFilter);
1.323 + TBool result = SetFilterL(*list, aStatus);
1.324 + CleanupStack::PopAndDestroy(); // list
1.325 + return result;
1.326 + }
1.327 +
1.328 +EXPORT_C TBool CLogViewEvent::SetFilterL(const CLogFilterList& aFilterList, TRequestStatus& aStatus)
1.329 +/** Initialises or refreshes the event view defined by the set of specified filters.
1.330 +
1.331 +The view can only be used after the request completes successfully.
1.332 +
1.333 +@param aFilterList The set of filters.
1.334 +@param aStatus The request status. On request completion, contains:KErrNone,
1.335 +if the view has been successfully initialised or refreshed;one of the other
1.336 +system wide error codes, otherwise.
1.337 +@return ETrue, if the function has successfully issued the asynchronous request.
1.338 +EFalse, if there are no events in the view.
1.339 +@capability Note None required. */
1.340 + {
1.341 + // Start maintenance of the database - ignore errors
1.342 + iMaintain->Start();
1.343 +
1.344 + // Package the parameters
1.345 + iPackage->SetLogFilterListL(aFilterList);
1.346 +
1.347 + // Setup the view
1.348 + const TInt count = iWindow->Setup(aFilterList, 0, ELogFilterConstructFilterByFilterFieldByField);
1.349 + User::LeaveIfError(count);
1.350 + iValid = count;
1.351 + ReawaitForChanges();
1.352 +
1.353 + if(count)
1.354 + {
1.355 + // Get the required event
1.356 + iValid = FirstL(aStatus);
1.357 + return iValid;
1.358 + }
1.359 + return EFalse;
1.360 + }
1.361 +
1.362 +EXPORT_C TBool CLogViewEvent::SetFilterParseFilterByFilterL(const CLogFilterList& aFilterList, TRequestStatus& aStatus)
1.363 +/**
1.364 +@capability Note None required. */
1.365 + {
1.366 + // Start maintenance of the database - ignore errors
1.367 + iMaintain->Start();
1.368 +
1.369 + // Package the parameters
1.370 + iPackage->SetLogFilterListL(aFilterList);
1.371 +
1.372 + // Setup the view
1.373 + const TInt count = iWindow->Setup(aFilterList, 0, ELogFilterConstructFieldByFieldFilterByFilter);
1.374 + User::LeaveIfError(count);
1.375 + iValid = count;
1.376 + ReawaitForChanges();
1.377 +
1.378 + if(count)
1.379 + {
1.380 + // Get the required event
1.381 + iValid = FirstL(aStatus);
1.382 + return iValid;
1.383 + }
1.384 + return EFalse;
1.385 + }
1.386 +
1.387 +
1.388 +
1.389 +
1.390 +
1.391 +
1.392 +
1.393 +
1.394 +
1.395 +
1.396 +
1.397 +
1.398 +
1.399 +
1.400 +
1.401 +
1.402 +
1.403 +
1.404 +
1.405 +
1.406 +
1.407 +
1.408 +
1.409 +//**********************************
1.410 +// CLogViewRecent
1.411 +//**********************************
1.412 +
1.413 +CLogViewRecent::CLogViewRecent(CLogClient& aClient, TInt aPriority)
1.414 +: CLogView(aClient, aPriority)
1.415 + {
1.416 + }
1.417 +
1.418 +EXPORT_C CLogViewRecent::~CLogViewRecent()
1.419 +/** Frees resources owned by the object priot to its destruction. */
1.420 + {
1.421 + Cancel();
1.422 + delete iRemove;
1.423 + }
1.424 +
1.425 +void CLogViewRecent::ConstructL(MLogViewChangeObserver* aObserver)
1.426 + {
1.427 + // Construct the view
1.428 + CLogView::ConstructL(ELogViewTypeRecent, aObserver);
1.429 +
1.430 + iRemove = new(ELeave) CLogViewRemoveEventClientOp(iClient.Session(), *iPackage, Priority());
1.431 + }
1.432 +
1.433 +EXPORT_C CLogViewRecent* CLogViewRecent::NewL(CLogClient& aClient, TInt aPriority)
1.434 + {
1.435 + CLogViewRecent* self = new(ELeave) CLogViewRecent(aClient, aPriority);
1.436 + CleanupStack::PushL(self);
1.437 + self->ConstructL();
1.438 + CleanupStack::Pop(); // self
1.439 + return self;
1.440 + }
1.441 +
1.442 +EXPORT_C CLogViewRecent* CLogViewRecent::NewL(CLogClient& aClient, MLogViewChangeObserver& aObserver, TInt aPriority)
1.443 + {
1.444 + CLogViewRecent* self = new(ELeave) CLogViewRecent(aClient, aPriority);
1.445 + CleanupStack::PushL(self);
1.446 + self->ConstructL(&aObserver);
1.447 + CleanupStack::Pop(self);
1.448 + return self;
1.449 + }
1.450 +
1.451 +EXPORT_C TBool CLogViewRecent::SetRecentListL(TLogRecentList aList, TRequestStatus& aStatus)
1.452 +/** Initialises or refreshes the view for the specified recent event list. This
1.453 +is an asynchronous request.
1.454 +
1.455 +On successful completion, the view is positioned at the first, i.e. most recent,
1.456 +event within the recent event list.
1.457 +
1.458 +@param aList The recent event list specifier. A value of KLogNullRecentList
1.459 +indicates that the view is to include events from all of the recent event
1.460 +lists.
1.461 +@param aStatus The request status. On request completion, contains:KErrNone,
1.462 +if the view has been successfully initialised or refreshed; otherwise, one
1.463 +of the other system wide error codes.
1.464 +@return ETrue, if the function has successfully issued the asynchronous request.
1.465 +EFalse, if there are no events in the view.
1.466 +@capability Note None required. */
1.467 + {
1.468 + CLogFilter* filter = CLogFilter::NewL();
1.469 + CleanupStack::PushL(filter);
1.470 + TBool result = SetRecentListL(aList, *filter, aStatus);
1.471 + CleanupStack::PopAndDestroy(); // filter
1.472 + return result;
1.473 + }
1.474 +
1.475 +EXPORT_C TBool CLogViewRecent::SetRecentListL(TLogRecentList aList, const CLogFilter& aFilter, TRequestStatus& aStatus)
1.476 +/** Initialises or refreshes the view for the specified recent event list, conforming
1.477 +to the specified filter. This is an asynchronous request.
1.478 +
1.479 +On successful completion, the view is positioned at the first, i.e. most recent,
1.480 +event in the recent event list.
1.481 +
1.482 +@param aList The recent event list specifier. A value of KLogNullRecentList
1.483 +indicates that the view is to include events from all of the recent event
1.484 +lists.
1.485 +@param aFilter The filter.
1.486 +@param aStatus The request status. On request completion, contains:KErrNone,
1.487 +if the view has been successfully initialised or refreshed; otherwise, one
1.488 +of the other system wide error codes.
1.489 +@return ETrue, if the function has successfully issued the asynchronous request.
1.490 +EFalse, if there are no events in the view.
1.491 +@capability Note None required. */
1.492 + {
1.493 + CLogFilterList* list = new(ELeave)CLogFilterList;
1.494 + CleanupStack::PushL(list);
1.495 + list->AppendL(&aFilter);
1.496 + TBool result = SetRecentListL(aList, *list, aStatus);
1.497 + CleanupStack::PopAndDestroy(); // list
1.498 + return result;
1.499 + }
1.500 +
1.501 +EXPORT_C TBool CLogViewRecent::SetRecentListL(TLogRecentList aList, const CLogFilterList& aFilterList, TRequestStatus& aStatus)
1.502 +/** Initialises or refreshes the view for the specified recent event list, conforming
1.503 +to the set of specified filters. This is an asynchronous request.
1.504 +
1.505 +On successful completion, the view is positioned at the first, i.e. most recent,
1.506 +event in the recent event list.
1.507 +
1.508 +@param aList The recent event list specifier. A value of KLogNullRecentList
1.509 +indicates that the view is to include events from all of the recent event
1.510 +lists.
1.511 +@param aFilterList The set of filters.
1.512 +@param aStatus The request status. On request completion, contains:KErrNone,
1.513 +if the view has been successfully initialised or refreshed; otherwise, one
1.514 +of the other system wide error codes.
1.515 +@return ETrue, if the function has successfully issued the asynchronous request.
1.516 +EFalse, if there are no events in the view.
1.517 +@capability Note None required. */
1.518 + {
1.519 + // Start maintenance of the database - ignore errors
1.520 + iMaintain->Start();
1.521 +
1.522 + // Package the parameters
1.523 + iPackage->SetLogFilterListL(aFilterList);
1.524 +
1.525 + // Setup the view
1.526 + TInt count = iWindow->Setup(aFilterList, aList, ELogFilterConstructFilterByFilterFieldByField);
1.527 + User::LeaveIfError(count);
1.528 + iValid = count;
1.529 + ReawaitForChanges();
1.530 +
1.531 + // Initialise list ids
1.532 + iRecentList = aList;
1.533 + iCurrentList = aList;
1.534 +
1.535 + // This receives the current recent list id from the server
1.536 + iCurrentListBuf() = iCurrentList;
1.537 + iData = &iCurrentListBuf;
1.538 +
1.539 + if(count)
1.540 + {
1.541 + // Get the required event
1.542 + iValid = FirstL(aStatus);
1.543 + return iValid;
1.544 + }
1.545 + return EFalse;
1.546 + }
1.547 +
1.548 +EXPORT_C void CLogViewRecent::RemoveL(TLogId aId)
1.549 +/** Removes the event with the specified unique event ID from the view. This does
1.550 +not delete the event from the main event log.
1.551 +
1.552 +@param aId The unique event ID.
1.553 +@capability WriteDeviceData */
1.554 + {
1.555 + User::LeaveIfError(iRemove->Start(iViewId, aId));
1.556 + iWindow->RemoveFromWindowIfPresentL(aId);
1.557 + }
1.558 +
1.559 +EXPORT_C TBool CLogViewRecent::RemoveL(TRequestStatus& aStatus)
1.560 +/** Removes the current event from its recent event list. This is an asynchronous
1.561 +request.
1.562 +
1.563 +This does not delete the event from the main event log.
1.564 +
1.565 +The function moves the current position in the view to the first, i.e. most
1.566 +recent, event.
1.567 +
1.568 +Note that removing a recent event from a recent event list also removes all
1.569 +of its duplicates.
1.570 +
1.571 +@param aStatus The request status. On request completion, contains:KErrNone,
1.572 +if the view has been successfully initialised or refreshed; otherwise, one
1.573 +of the other system wide error codes.
1.574 +@return ETrue, if the function has successfully issued the asynchronous request.
1.575 +EFalse, if there are no events in the view.
1.576 +@capability WriteDeviceData */
1.577 + {
1.578 + __ASSERT_DEBUG(IsValid(), Panic(ELogNotValid1));
1.579 + RemoveL(Event().Id());
1.580 + return FirstL(aStatus);
1.581 + }
1.582 +
1.583 +EXPORT_C TBool CLogViewRecent::DuplicatesL(CLogViewDuplicate& aView, TRequestStatus& aStatus)
1.584 +/** Refreshes the specified duplicate event view with the duplicates of the current
1.585 +event in the recent event list view. This is an asynchronous request.
1.586 +
1.587 +On successful completion, the view is positioned at the first, i.e. most recent,
1.588 +event within the view.
1.589 +
1.590 +@param aView The duplicates view to be refreshed.
1.591 +@param aStatus The request status. On request completion, contains:KErrNone,
1.592 +if the view has been successfully refreshed; otherwise, one of the other system
1.593 +wide error codes.
1.594 +@return ETrue, if the function has successfully issued the asynchronous request.
1.595 +EFalse, if there are no events in the view.
1.596 +@capability Note None required. */
1.597 + {
1.598 + __ASSERT_ALWAYS(!IsActive(), Panic(ELogAlreadyActive5));
1.599 + return IsValid() && aView.SetEventL(Event().Id(), aStatus);
1.600 + }
1.601 +
1.602 +EXPORT_C TBool CLogViewRecent::DuplicatesL(CLogViewDuplicate& aView, const CLogFilter& aFilter, TRequestStatus& aStatus)
1.603 +/** Refreshes the specified duplicate event view with the duplicates of the current
1.604 +event in the recent event list view and conforming to the specified filter.
1.605 +This is an asynchronous request.
1.606 +
1.607 +On successful completion, the view is positioned at the first, i.e. most recent,
1.608 +event within the view.
1.609 +
1.610 +@param aView The duplicates view to be refreshed.
1.611 +@param aFilter The filter.
1.612 +@param aStatus The request status. On request completion, contains:KErrNone,
1.613 +if the view has been successfully refreshed; otherwise, one of the other system
1.614 +wide error codes.
1.615 +@return ETrue, if the function has successfully issued the asynchronous request.
1.616 +EFalse, if there are no events in the view.
1.617 +@capability Note None required.*/
1.618 + {
1.619 + __ASSERT_ALWAYS(!IsActive(), Panic(ELogAlreadyActive6));
1.620 + return IsValid() && aView.SetEventL(Event().Id(), aFilter, aStatus);
1.621 + }
1.622 +
1.623 +EXPORT_C TBool CLogViewRecent::DuplicatesL(CLogViewDuplicate& aView, const CLogFilterList& aFilterList, TRequestStatus& aStatus)
1.624 +/** Refreshes the specified duplicate event view with the duplicates of the current
1.625 +event in the recent event list view and conforming to the set of specified
1.626 +filters. This is an asynchronous request.
1.627 +
1.628 +On successful completion, the view is positioned at the first, i.e. most recent,
1.629 +event within the view.
1.630 +
1.631 +@param aView The duplicates view to be refreshed.
1.632 +@param aFilterList The set of filters.
1.633 +@param aStatus The request status. On request completion, contains:KErrNone,
1.634 +if the view has been successfully refreshed; otherwise, one of the other system
1.635 +wide error codes.
1.636 +@return ETrue, if the function has successfully issued the asynchronous request.
1.637 +EFalse, if there are no events in the view.
1.638 +@capability Note None required.*/
1.639 + {
1.640 + __ASSERT_ALWAYS(!IsActive(), Panic(ELogAlreadyActive7));
1.641 + return IsValid() && aView.SetEventL(Event().Id(), aFilterList, aStatus);
1.642 + }
1.643 +
1.644 +EXPORT_C void CLogViewRecent::ClearDuplicatesL()
1.645 +/**
1.646 +@capability WriteDeviceData */
1.647 + {
1.648 + __ASSERT_DEBUG(IsValid(), Panic(ELogNotValid3));
1.649 +
1.650 + // To preserve the same server side interface as an operation
1.651 + TPckgBuf<TLogClientServerData> data;
1.652 + data().iOperationType = ELogOperationViewClearDuplicates;
1.653 + data().iOperationId = KLogNullOperationId;
1.654 + //
1.655 + User::LeaveIfError(iClient.Session().Send(ELogViewOperationInitiate, TIpcArgs(&data,iViewId)));
1.656 + }
1.657 +
1.658 +void CLogViewRecent::DoRunL()
1.659 + {
1.660 + // To fetch the event
1.661 + ReadEventFromWindowL();
1.662 +
1.663 + // A fix to maintain source compatibility
1.664 + iCurrentList = iCurrentListBuf();
1.665 + }
1.666 +
1.667 +
1.668 +
1.669 +
1.670 +
1.671 +
1.672 +
1.673 +
1.674 +
1.675 +
1.676 +
1.677 +
1.678 +
1.679 +
1.680 +
1.681 +
1.682 +
1.683 +
1.684 +//**********************************
1.685 +// CLogViewDuplicate
1.686 +//**********************************
1.687 +
1.688 +CLogViewDuplicate::CLogViewDuplicate(CLogClient& aClient, TInt aPriority)
1.689 +: CLogView(aClient, aPriority)
1.690 + {
1.691 + }
1.692 +
1.693 +EXPORT_C CLogViewDuplicate::~CLogViewDuplicate()
1.694 + {
1.695 + Cancel();
1.696 + delete iRemove;
1.697 + }
1.698 +
1.699 +void CLogViewDuplicate::ConstructL(MLogViewChangeObserver* aObserver)
1.700 + {
1.701 + CLogView::ConstructL(ELogViewTypeDuplicate, aObserver);
1.702 +
1.703 + iRemove = new(ELeave) CLogViewRemoveEventClientOp(iClient.Session(), *iPackage, Priority());
1.704 + }
1.705 +
1.706 +EXPORT_C CLogViewDuplicate* CLogViewDuplicate::NewL(CLogClient& aClient, TInt aPriority)
1.707 + {
1.708 + CLogViewDuplicate* self = new(ELeave)CLogViewDuplicate(aClient, aPriority);
1.709 + CleanupStack::PushL(self);
1.710 + self->ConstructL();
1.711 + CleanupStack::Pop();
1.712 + return self;
1.713 + }
1.714 +
1.715 +EXPORT_C CLogViewDuplicate* CLogViewDuplicate::NewL(CLogClient& aClient, MLogViewChangeObserver& aObserver, TInt aPriority)
1.716 + {
1.717 + CLogViewDuplicate* self = new(ELeave) CLogViewDuplicate(aClient, aPriority);
1.718 + CleanupStack::PushL(self);
1.719 + self->ConstructL(&aObserver);
1.720 + CleanupStack::Pop(self);
1.721 + return self;
1.722 + }
1.723 +
1.724 +TBool CLogViewDuplicate::SetEventL(TLogId aId, TRequestStatus& aStatus)
1.725 + {
1.726 + CLogFilter* filter = CLogFilter::NewL();
1.727 + CleanupStack::PushL(filter);
1.728 + TBool result = SetEventL(aId, *filter, aStatus);
1.729 + CleanupStack::PopAndDestroy(); // filter
1.730 + return result;
1.731 + }
1.732 +
1.733 +TBool CLogViewDuplicate::SetEventL(TLogId aId, const CLogFilter& aFilter, TRequestStatus& aStatus)
1.734 + {
1.735 + CLogFilterList* list = new(ELeave)CLogFilterList;
1.736 + CleanupStack::PushL(list);
1.737 + list->AppendL(&aFilter);
1.738 + TBool result = SetEventL(aId, *list, aStatus);
1.739 + CleanupStack::PopAndDestroy(); // list
1.740 + return result;
1.741 + }
1.742 +
1.743 +TBool CLogViewDuplicate::SetEventL(TLogId aId, const CLogFilterList& aFilterList, TRequestStatus& aStatus)
1.744 + {
1.745 + // Start maintenance of the database - ignore errors
1.746 + iMaintain->Start();
1.747 +
1.748 + // Package the parameters
1.749 + iPackage->SetLogFilterListL(aFilterList);
1.750 +
1.751 + // Setup the view
1.752 + TInt count = iWindow->Setup(aFilterList, aId, ELogFilterConstructFilterByFilterFieldByField);
1.753 + User::LeaveIfError(count);
1.754 + iValid = count;
1.755 + iSourceId = aId;
1.756 + ReawaitForChanges();
1.757 +
1.758 + if(count)
1.759 + {
1.760 + // Get the required event
1.761 + iValid = FirstL(aStatus);
1.762 + return iValid;
1.763 + }
1.764 + return EFalse;
1.765 + }
1.766 +
1.767 +EXPORT_C void CLogViewDuplicate::RemoveL(TLogId aId)
1.768 +/** Removes the event with the specified unique event ID from the view. This does
1.769 +not delete the event from the main event log.
1.770 +
1.771 +@param aId The unique event ID.
1.772 +@capability WriteDeviceData */
1.773 + {
1.774 + // Note: Duplicate views reset themselves
1.775 + __ASSERT_DEBUG(IsValid(), Panic(ELogNotValid2));
1.776 + User::LeaveIfError(iRemove->Start(iViewId, aId));
1.777 + iWindow->RemoveFromWindowIfPresentL(aId);
1.778 + }
1.779 +
1.780 +EXPORT_C TBool CLogViewDuplicate::RemoveL(TRequestStatus& aStatus)
1.781 +/** Removes the current event from the duplicate list. This is an asynchronous
1.782 +request.
1.783 +
1.784 +This does not delete the event from the main event log.
1.785 +
1.786 +The function moves the current position in the view to the first, i.e. most
1.787 +recent, event.
1.788 +
1.789 +@param aStatus The request status. On request completion, contains: KErrNone,
1.790 +if the view has been successfully initialised or refreshed; otherwise, one
1.791 +of the other system wide error codes.
1.792 +@return ETrue, if the function has successfully issued the asynchronous request.
1.793 +EFalse, if there are no events in the view.
1.794 +@capability WriteDeviceData */
1.795 + {
1.796 + RemoveL(Event().Id());
1.797 + return FirstL(aStatus);
1.798 + }