56
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
* CMsgErrorSmsDiskSpaceObserver implementation file
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
#include <e32base.h>
|
|
23 |
|
|
24 |
#include <e32property.h>
|
|
25 |
|
|
26 |
#include <smsuaddr.h>
|
|
27 |
#include "msgerrorwatcher_p.h"
|
|
28 |
#include "msgerrorsmsdiskspaceobserver.h"
|
|
29 |
#include "debugtraces.h"
|
|
30 |
// CONSTANTS
|
|
31 |
|
|
32 |
// ================= MEMBER FUNCTIONS =======================
|
|
33 |
|
|
34 |
// ---------------------------------------------------------
|
|
35 |
// CMsgErrorSmsDiskSpaceObserver::CMsgErrorSmsDiskSpaceObserver
|
|
36 |
//
|
|
37 |
// C++ constructor can NOT contain any code, that
|
|
38 |
// might leave.
|
|
39 |
// ---------------------------------------------------------
|
|
40 |
//
|
|
41 |
CMsgErrorSmsDiskSpaceObserver::CMsgErrorSmsDiskSpaceObserver( CMsgErrorWatcherPrivate& aWatcher )
|
|
42 |
: CActive( CActive::EPriorityStandard ),
|
|
43 |
iWatcher( aWatcher )
|
|
44 |
{
|
|
45 |
QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:CMsgErrorSmsDiskSpaceObserver : Enter");
|
|
46 |
CActiveScheduler::Add( this );
|
|
47 |
QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:CMsgErrorSmsDiskSpaceObserver : Exit");
|
|
48 |
}
|
|
49 |
|
|
50 |
// ---------------------------------------------------------
|
|
51 |
// CMsgErrorSmsDiskSpaceObserver::ConstructL()
|
|
52 |
//
|
|
53 |
// Symbian OS default constructor can leave.
|
|
54 |
// ---------------------------------------------------------
|
|
55 |
//
|
|
56 |
void CMsgErrorSmsDiskSpaceObserver::ConstructL()
|
|
57 |
{
|
|
58 |
QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:ConstructL : Enter");
|
|
59 |
|
|
60 |
TInt success = iSmsDiskSpaceProperty.Attach( KUidPSSMSStackCategory, KUidPSSMSStackDiskSpaceMonitorKey );
|
|
61 |
QDEBUG_WRITE_FORMAT("iSmsDiskSpaceProperty.Attach: " ,success );
|
|
62 |
User::LeaveIfError(success);
|
|
63 |
iStatus = KRequestPending;
|
|
64 |
iSmsDiskSpaceProperty.Subscribe( iStatus );
|
|
65 |
SetActive();
|
|
66 |
QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:ConstructL : Exit");
|
|
67 |
}
|
|
68 |
|
|
69 |
// ---------------------------------------------------------
|
|
70 |
// CMsgErrorSmsDiskSpaceObserver::NewL
|
|
71 |
//
|
|
72 |
// Two-phased constructor.
|
|
73 |
// ---------------------------------------------------------
|
|
74 |
//
|
|
75 |
CMsgErrorSmsDiskSpaceObserver* CMsgErrorSmsDiskSpaceObserver::NewL( CMsgErrorWatcherPrivate& aWatcher)
|
|
76 |
{
|
|
77 |
QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:NewL : Enter");
|
|
78 |
CMsgErrorSmsDiskSpaceObserver* self = new ( ELeave )
|
|
79 |
CMsgErrorSmsDiskSpaceObserver( aWatcher);
|
|
80 |
|
|
81 |
CleanupStack::PushL( self );
|
|
82 |
self->ConstructL();
|
|
83 |
CleanupStack::Pop( self );
|
|
84 |
QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:NewL : Exit");
|
|
85 |
return self;
|
|
86 |
}
|
|
87 |
|
|
88 |
// ---------------------------------------------------------
|
|
89 |
// CMsgErrorSmsDiskSpaceObserver::~CMsgErrorSmsDiskSpaceObserver
|
|
90 |
//
|
|
91 |
// Destructor
|
|
92 |
// ---------------------------------------------------------
|
|
93 |
//
|
|
94 |
CMsgErrorSmsDiskSpaceObserver::~CMsgErrorSmsDiskSpaceObserver()
|
|
95 |
{
|
|
96 |
QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:~CMsgErrorSmsDiskSpaceObserver : Enter");
|
|
97 |
Cancel();
|
|
98 |
iSmsDiskSpaceProperty.Close();
|
|
99 |
QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:~CMsgErrorSmsDiskSpaceObserver : Exit");
|
|
100 |
}
|
|
101 |
|
|
102 |
// ---------------------------------------------------------
|
|
103 |
// CMsgErrorSmsDiskSpaceObserver::DoCancel
|
|
104 |
//
|
|
105 |
// From active object framework
|
|
106 |
// ---------------------------------------------------------
|
|
107 |
//
|
|
108 |
void CMsgErrorSmsDiskSpaceObserver::DoCancel()
|
|
109 |
{
|
|
110 |
QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:DoCancel : Enter");
|
|
111 |
iSmsDiskSpaceProperty.Cancel();
|
|
112 |
QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:DoCancel : Exit");
|
|
113 |
}
|
|
114 |
|
|
115 |
// ---------------------------------------------------------
|
|
116 |
// CMsgErrorSmsDiskSpaceObserver::RunL
|
|
117 |
//
|
|
118 |
// From active object framework
|
|
119 |
// ---------------------------------------------------------
|
|
120 |
//
|
|
121 |
void CMsgErrorSmsDiskSpaceObserver::RunL()
|
|
122 |
{
|
|
123 |
QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:RunL : Enter");
|
|
124 |
TInt messagesComingInLowDiskSpace(ESmsDiskSpaceUnknown);
|
|
125 |
TInt success = iSmsDiskSpaceProperty.Get( messagesComingInLowDiskSpace );
|
|
126 |
|
|
127 |
QDEBUG_WRITE_FORMAT("iSmsDiskSpaceProperty.Get returns: " ,success );
|
|
128 |
QDEBUG_WRITE_FORMAT("iSmsDiskSpaceProperty.Get: " ,messagesComingInLowDiskSpace );
|
|
129 |
|
|
130 |
|
|
131 |
if ( messagesComingInLowDiskSpace == ESmsDiskSpaceFull )
|
|
132 |
{
|
|
133 |
QDEBUG_WRITE( "CMsgErrorSmsDiskSpaceObserver::RunL: ESmsDiskSpaceFull" );
|
|
134 |
TRAP_IGNORE( iWatcher.HandleDiskSpaceEvent2L() );
|
|
135 |
}
|
|
136 |
|
|
137 |
iStatus = KRequestPending;
|
|
138 |
iSmsDiskSpaceProperty.Subscribe( iStatus );
|
|
139 |
SetActive();
|
|
140 |
QDEBUG_WRITE("CMsgErrorSmsDiskSpaceObserver:RunL : Exit");
|
|
141 |
}
|
|
142 |
|
|
143 |
|
|
144 |
|
|
145 |
// ================= OTHER EXPORTED FUNCTIONS ==============
|
|
146 |
|
|
147 |
// End of File
|