--- a/sysresmonitoring/oodmonitor/oodmonitor2/src/outofdiskglobalnote.cpp Thu Aug 19 10:05:08 2010 +0300
+++ b/sysresmonitoring/oodmonitor/oodmonitor2/src/outofdiskglobalnote.cpp Tue Aug 31 15:24:25 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 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,16 +18,12 @@
// 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"
@@ -60,10 +56,9 @@
COutOfDiskGlobalNote::~COutOfDiskGlobalNote()
{
TRACES("COutOfDiskGlobalNote::~COutOfDiskGlobalNote");
- delete iQuery;
iOODResourceFile.Close();
- Cancel(); // Cancel active object
- TRACES("COutOfDiskGlobalNote::~COutOfDiskGlobalNote: End");
+ delete iNote;
+ iNote=NULL;
}
// ---------------------------------------------------------
@@ -71,12 +66,10 @@
// ---------------------------------------------------------
//
COutOfDiskGlobalNote::COutOfDiskGlobalNote( COutOfDiskMonitor* aOutOfDiskMonitor, RFs& aFs ) :
- CActive( EPriorityStandard ),
iOutOfDiskMonitor( aOutOfDiskMonitor ),
iFs( aFs )
{
TRACES("COutOfDiskGlobalNote::COutOfDiskGlobalNote");
- CActiveScheduler::Add( this );
TRACES("COutOfDiskGlobalNote::COutOfDiskGlobalNote: End");
}
@@ -90,7 +83,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"));
@@ -110,19 +103,13 @@
void COutOfDiskGlobalNote::DisplayL(const TDesC& aMessage)
{
TRACES("COutOfDiskGlobalNote::DisplayL");
- 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::COutOfDiskGlobalNote::DisplayL: set text and observer for the note");
+ iNote->SetTextL(aMessage);
+ iNote->SetObserver(this);
+ iNote->SetTimeout(0);
+ iNote->ShowL();
+
TRACES("COutOfDiskGlobalNote::DisplayL: End");
}
@@ -143,8 +130,7 @@
if (iOutOfDiskMonitor->GetGlobalNotesAllowed())
{
- TInt sdDialogId = 0;
-
+
TResourceReader resReader;
HBufC8* str(NULL);
CDesCArray* strings = new ( ELeave ) CDesCArrayFlat( 2 );
@@ -169,7 +155,6 @@
if (aDrive == iOutOfDiskMonitor->GetDefaultPhoneMemory())
{
- sdDialogId = EAknDiskWarnignNote;
str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_DEVICE_MEMORY_LOW);
resReader.SetBuffer(str);
strings->AppendL( driveName );
@@ -177,7 +162,6 @@
else if (driveStatus & DriveInfo::EDriveRemovable)
{
TRACES1("COutOfDiskGlobalNote::ShowGlobalQueryL: Warning note! volNameLength: %d", nameLength);
- sdDialogId = EAknMMCWarningNote;
TBufC<KMaxFileName> name(volInfo.iName);
if (nameLength)
{
@@ -196,7 +180,6 @@
}
else
{
- sdDialogId = EAknDiskWarnignNote;
str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_MASS_STORAGE_MEMORY_LOW);
resReader.SetBuffer(str);
strings->AppendL( driveName );
@@ -207,14 +190,12 @@
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)
{
@@ -233,26 +214,19 @@
}
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);
@@ -310,21 +284,13 @@
}
// -----------------------------------------------------------------------------
-// COutOfDiskGlobalNote::DoCancel
+// COutOfDiskGlobalNote::MessageBoxClosed
// -----------------------------------------------------------------------------
//
-void COutOfDiskGlobalNote::DoCancel()
+void COutOfDiskGlobalNote::MessageBoxClosed(const CHbDeviceMessageBoxSymbian* aMessageBox,
+ CHbDeviceMessageBoxSymbian::TButtonId aButton)
{
- TRACES("COutOfDiskGlobalNote::DoCancel");
- }
-
-// -----------------------------------------------------------------------------
-// COutOfDiskGlobalNote::RunL
-// -----------------------------------------------------------------------------
-//
-void COutOfDiskGlobalNote::RunL()
- {
- TRACES("COutOfDiskGlobalNote::RunL");
+ TRACES("COutOfDiskGlobalNote::closed");
iNoteInfo.iNoteId = KErrNotFound;
iNoteInfo.iStatus = DISK_SPACE_OK;
iNoteInfo.iDrive = KErrNotFound;
@@ -338,21 +304,6 @@
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