tstaskmonitor/client/s60/src/tstasksettings_p.cpp
changeset 104 9b022b1f357c
equal deleted inserted replaced
103:b99b84bcd2d1 104:9b022b1f357c
       
     1 /*
       
     2 * Copyright (c) 2009 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 *
       
    16 */
       
    17 #include "tstasksettings_p.h"
       
    18 
       
    19 #include <fbs.h>
       
    20 #include <coecntrl.h>
       
    21 #include <QScopedPointer>
       
    22 #include <QApplication>
       
    23 #include <QDesktopWidget>
       
    24 
       
    25 #include "tsscreenshotclient.h"
       
    26 #include "tstaskmonitorglobals.h"
       
    27 
       
    28 TsTaskSettingsPrivate::TsTaskSettingsPrivate() : mClient(0)
       
    29 {
       
    30     QT_TRAP_THROWING(mClient = CTsScreenshotClient::NewL());
       
    31 }
       
    32 
       
    33 TsTaskSettingsPrivate::~TsTaskSettingsPrivate()
       
    34 {
       
    35     delete mClient;
       
    36 }
       
    37 
       
    38 bool TsTaskSettingsPrivate::registerScreenshot(const QPixmap &screenshot)
       
    39 {    
       
    40     QScopedPointer<CFbsBitmap> bitmap(screenshot.toSymbianCFbsBitmap());
       
    41     if (bitmap.isNull()) 
       
    42         return false;
       
    43 
       
    44     return KErrNone == mClient->RegisterScreenshot(bitmap.data(), wgId());
       
    45 }
       
    46 
       
    47 bool TsTaskSettingsPrivate::unregisterScreenshot()
       
    48 {
       
    49     return KErrNone == mClient->UnregisterScreenshot(wgId());
       
    50 }
       
    51 
       
    52 bool TsTaskSettingsPrivate::setVisibility(bool visibility)
       
    53 {
       
    54     return (KErrNone == mClient->SetVisibility(wgId(), visibility ? Visible : Invisible));
       
    55 }
       
    56 
       
    57 int TsTaskSettingsPrivate::wgId()
       
    58 {
       
    59     return QApplication::desktop()->winId()->ControlEnv()->RootWin().WindowGroupId();
       
    60 }