--- a/sysresmonitoring/oodmonitor/oodmonitor2/src/outofdiskglobalnote.cpp Tue Aug 31 15:24:25 2010 +0300
+++ b/sysresmonitoring/oodmonitor/oodmonitor2/src/outofdiskglobalnote.cpp Wed Sep 01 12:24:48 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -18,12 +18,16 @@
// SYSTEM INCLUDES
#include <e32property.h>
+#include <AknGlobalNote.h>
+#include <secondarydisplay/AknSecondaryDisplayDefs.h>
+#include <aknSDData.h>
+#include <avkon.rsg>
#include <data_caging_path_literals.hrh>
#include <driveinfo.h>
#include <outofdiskmonitor.rsg>
#include <bautils.h> // BaflUtils
#include <StringLoader.h>
-
+#include <aknnotewrappers.h>
// USER INCLUDES
#include "UiklafInternalCRKeys.h"
@@ -56,9 +60,10 @@
COutOfDiskGlobalNote::~COutOfDiskGlobalNote()
{
TRACES("COutOfDiskGlobalNote::~COutOfDiskGlobalNote");
+ delete iQuery;
iOODResourceFile.Close();
- delete iNote;
- iNote=NULL;
+ Cancel(); // Cancel active object
+ TRACES("COutOfDiskGlobalNote::~COutOfDiskGlobalNote: End");
}
// ---------------------------------------------------------
@@ -66,10 +71,12 @@
// ---------------------------------------------------------
//
COutOfDiskGlobalNote::COutOfDiskGlobalNote( COutOfDiskMonitor* aOutOfDiskMonitor, RFs& aFs ) :
+ CActive( EPriorityStandard ),
iOutOfDiskMonitor( aOutOfDiskMonitor ),
iFs( aFs )
{
TRACES("COutOfDiskGlobalNote::COutOfDiskGlobalNote");
+ CActiveScheduler::Add( this );
TRACES("COutOfDiskGlobalNote::COutOfDiskGlobalNote: End");
}
@@ -83,7 +90,7 @@
iNoteInfo.iNoteId = KErrNotFound;
iNoteInfo.iStatus = DISK_SPACE_OK;
iNoteInfo.iDrive = KErrNotFound;
- iNote= CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning);
+
TRACES("COutOfDiskGlobalNote::ConstructL: Open OOD resource file");
TFileName OODFileName;
OODFileName.Append(_L("Z"));
@@ -103,13 +110,19 @@
void COutOfDiskGlobalNote::DisplayL(const TDesC& aMessage)
{
TRACES("COutOfDiskGlobalNote::DisplayL");
-
- TRACES("COutOfDiskGlobalNote::COutOfDiskGlobalNote::DisplayL: set text and observer for the note");
- iNote->SetTextL(aMessage);
- iNote->SetObserver(this);
- iNote->SetTimeout(0);
- iNote->ShowL();
-
+ if (iNoteInfo.iNoteId > KErrNotFound)
+ {
+ CancelNoteL();
+ }
+
+ if (!iQuery)
+ {
+ TRACES("COutOfDiskGlobalNote::COutOfDiskGlobalNote::DisplayL: Create iQuery");
+ iQuery = CAknGlobalNote::NewL();
+ iQuery->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY);
+ }
+ iNoteInfo.iNoteId = iQuery->ShowNoteL(iStatus, EAknGlobalWarningNote, aMessage);
+ SetActive();
TRACES("COutOfDiskGlobalNote::DisplayL: End");
}
@@ -130,7 +143,8 @@
if (iOutOfDiskMonitor->GetGlobalNotesAllowed())
{
-
+ TInt sdDialogId = 0;
+
TResourceReader resReader;
HBufC8* str(NULL);
CDesCArray* strings = new ( ELeave ) CDesCArrayFlat( 2 );
@@ -155,6 +169,7 @@
if (aDrive == iOutOfDiskMonitor->GetDefaultPhoneMemory())
{
+ sdDialogId = EAknDiskWarnignNote;
str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_DEVICE_MEMORY_LOW);
resReader.SetBuffer(str);
strings->AppendL( driveName );
@@ -162,6 +177,7 @@
else if (driveStatus & DriveInfo::EDriveRemovable)
{
TRACES1("COutOfDiskGlobalNote::ShowGlobalQueryL: Warning note! volNameLength: %d", nameLength);
+ sdDialogId = EAknMMCWarningNote;
TBufC<KMaxFileName> name(volInfo.iName);
if (nameLength)
{
@@ -180,6 +196,7 @@
}
else
{
+ sdDialogId = EAknDiskWarnignNote;
str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_MASS_STORAGE_MEMORY_LOW);
resReader.SetBuffer(str);
strings->AppendL( driveName );
@@ -190,12 +207,14 @@
TRACES1("COutOfDiskGlobalNote::ShowGlobalQueryL: Critical note! Drive: %c", aDrive+'A');
if (aDrive == iOutOfDiskMonitor->GetDefaultPhoneMemory())
{
+ sdDialogId = EAknDiskFullNote;
str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_DEVICE_MEMORY_FULL);
resReader.SetBuffer(str);
strings->AppendL( driveName );
}
else if (driveStatus & DriveInfo::EDriveRemovable)
{
+ sdDialogId = EAknMMCFullNote;
TBufC<KMaxFileName> name(volInfo.iName);
if (nameLength)
{
@@ -214,19 +233,26 @@
}
else
{
+ sdDialogId = EAknDiskFullNote;
str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_MASS_STORAGE_FULL);
resReader.SetBuffer(str);
strings->AppendL( driveName );
}
}
resReader.SetBuffer(str);
- HBufC* resHandle = resReader.ReadHBufCL();
+ HBufC* resHandle = resReader.ReadHBufCL();
CleanupStack::PushL( resHandle );
HBufC* message(FormatStringL(resHandle->Des(),*strings));
CleanupStack::PushL( message );
- TRACES1("COutOfDiskMonitor::ShowGlobalQueryL: txt: %S",message);
+ TRACES1("COutOfDiskMonitor::ShowGlobalQueryL: txt: %S",message);
DisplayL(message->Des());
+ TBuf8<2> sdDriveName;
+ sdDriveName.Append(aDrive+'A');
+ sdDriveName.Append(_L8(":"));
+ CAknSDData* sd = CAknSDData::NewL(KAknSecondaryDisplayCategory, sdDialogId, sdDriveName);
+ iQuery->SetSecondaryDisplayData(sd);
+
iNoteInfo.iStatus = aStatus;
iNoteInfo.iDrive = aDrive;
CleanupStack::PopAndDestroy(message);
@@ -284,13 +310,21 @@
}
// -----------------------------------------------------------------------------
-// COutOfDiskGlobalNote::MessageBoxClosed
+// COutOfDiskGlobalNote::DoCancel
// -----------------------------------------------------------------------------
//
-void COutOfDiskGlobalNote::MessageBoxClosed(const CHbDeviceMessageBoxSymbian* aMessageBox,
- CHbDeviceMessageBoxSymbian::TButtonId aButton)
+void COutOfDiskGlobalNote::DoCancel()
{
- TRACES("COutOfDiskGlobalNote::closed");
+ TRACES("COutOfDiskGlobalNote::DoCancel");
+ }
+
+// -----------------------------------------------------------------------------
+// COutOfDiskGlobalNote::RunL
+// -----------------------------------------------------------------------------
+//
+void COutOfDiskGlobalNote::RunL()
+ {
+ TRACES("COutOfDiskGlobalNote::RunL");
iNoteInfo.iNoteId = KErrNotFound;
iNoteInfo.iStatus = DISK_SPACE_OK;
iNoteInfo.iDrive = KErrNotFound;
@@ -304,6 +338,21 @@
TRACES("COutOfDiskGlobalNote::RunL: End");
}
+// -----------------------------------------------------------------------------
+// COutOfDiskGlobalNote::CancelNoteL
+// -----------------------------------------------------------------------------
+//
+void COutOfDiskGlobalNote::CancelNoteL()
+ {
+ TRACES("COutOfDiskGlobalNote::CancelNoteL");
+
+ if (iNoteInfo.iNoteId > KErrNotFound)
+ {
+ iQuery->CancelNoteL(iNoteInfo.iNoteId);
+ }
+ Cancel();
+ TRACES("COutOfDiskGlobalNote::CancelNoteL: End");
+ }
// -----------------------------------------------------------------------------
// COutOfDiskGlobalNote::NoteOnDisplay