syncmlfw/dm/syncagent/src/nsmldmcmds.cpp
changeset 51 2e64dc50f295
parent 40 588ad05716be
child 55 1c556dee8eb1
equal deleted inserted replaced
50:a36219ae6585 51:2e64dc50f295
    58 #include <hbsymbianvariant.h>
    58 #include <hbsymbianvariant.h>
    59 // DM specific includes
    59 // DM specific includes
    60 #include "nsmldmagconstants.h"
    60 #include "nsmldmagconstants.h"
    61 #include "NSmlDMCmds.h"
    61 #include "NSmlDMCmds.h"
    62 #include "nsmldmerror.h"
    62 #include "nsmldmerror.h"
       
    63 #include <dmdevdialogclient.h>
    63 #include "OnlineSupportLogger.h"
    64 #include "OnlineSupportLogger.h"
    64 #ifdef __TEST_TREEMODULE
    65 #ifdef __TEST_TREEMODULE
    65 #include "nsmldmtestmodule.h"
    66 #include "nsmldmtestmodule.h"
    66 #else
    67 #else
    67 #include <nsmldmmodule.h>
    68 #include <nsmldmmodule.h>
    74 // DBG_ARGS8 macro in no-debug builds.
    75 // DBG_ARGS8 macro in no-debug builds.
    75 #pragma diag_remark 174
    76 #pragma diag_remark 174
    76 #endif
    77 #endif
    77 
    78 
    78 
    79 
    79 const TUid KNSmlSyncDialogUid = { 0x101F876A };
    80 //const TUid KNSmlSyncDialogUid = { 0x101F876A };
    80 // FOTA
    81 // FOTA
    81 const TInt KNSmlDmNoRequest = -1;
    82 const TInt KNSmlDmNoRequest = -1;
    82 // FOTA end
    83 // FOTA end
    83 const TInt KNSmlDmChoiceChunkMinSize = 32;
    84 const TInt KNSmlDmChoiceChunkMinSize = 32;
    84 const TInt KNSmlDmChoiceChunkMaxSize = 10000;
    85 const TInt KNSmlDmChoiceChunkMaxSize = 10000;
  1766     }
  1767     }
  1767 
  1768 
  1768 void CNSmlDMCmds::ServerHbNotifierL(TSyncMLDlgNoteTypes& aNotetype, TDesC& aServerMsg)
  1769 void CNSmlDMCmds::ServerHbNotifierL(TSyncMLDlgNoteTypes& aNotetype, TDesC& aServerMsg)
  1769     
  1770     
  1770     {
  1771     {
  1771 				LOGSTRING("HandleDisplayAlertL ServerHbNotifier start");  
  1772 				LOGSTRING("HandleDisplayAlertL ServerHbNotifier start");                
  1772 				
  1773         RDmDevDialog DmDevdialog;
  1773         _LIT(KHbNotifier,"com.nokia.hb.devicemanagementdialog/1.0");
  1774         TInt err = DmDevdialog.OpenL();
  1774         
  1775         User::LeaveIfError(err);
  1775         _LIT(KNotifierId, "syncmlfw");
  1776         TRequestStatus status = KRequestPending;
  1776         _LIT(KServerpushalertInfo, "serverpushinformative");
       
  1777         _LIT(KServerpushalertConfirm, "serverpushconfirmative");
       
  1778         
       
  1779         TBuf<25> serverpushalertval;
       
  1780         
       
  1781         if(aNotetype == ESyncMLInfoNote)
  1777         if(aNotetype == ESyncMLInfoNote)
  1782             serverpushalertval.Copy(KServerpushalertInfo);
  1778             {
       
  1779         DmDevdialog.ShowDisplayAlert(aServerMsg,status);
       
  1780             }
       
  1781             
  1783         else 
  1782         else 
  1784             serverpushalertval.Copy(KServerpushalertConfirm);
  1783             {
  1785         
  1784         TInt timeout = 30; // dummy
  1786         CHbDeviceDialogSymbian *devDialog = NULL;
  1785         TBuf<30> header; // dummy
  1787 
  1786         DmDevdialog.ShowConfirmationAlert(timeout,header,aServerMsg,status);
  1788         CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL();
  1787             }
  1789         CleanupStack::PushL(varMap);
  1788        
  1790         
       
  1791 
       
  1792         HBufC* keyBuf = HBufC::NewL(25);
       
  1793         CleanupStack::PushL(keyBuf);
       
  1794         
       
  1795         *keyBuf = KNotifierId;
       
  1796         
       
  1797         HBufC* servalertmsg = HBufC::NewL(25);
       
  1798         CleanupStack::PushL(servalertmsg);
       
  1799                 
       
  1800          *servalertmsg = serverpushalertval;
       
  1801          
       
  1802          TInt id =0;
       
  1803 
       
  1804          CHbSymbianVariant* notifierid = CHbSymbianVariant::NewL(&id,
       
  1805                          CHbSymbianVariant::EInt);
       
  1806          
       
  1807         
       
  1808         CHbSymbianVariant* serveralertmsg = CHbSymbianVariant::NewL(&aServerMsg,
       
  1809                 CHbSymbianVariant::EDes);
       
  1810 
       
  1811         varMap->Add(*keyBuf,notifierid);
       
  1812         varMap->Add(*servalertmsg, serveralertmsg); // takes ownership
       
  1813 
       
  1814         LOGSTRING("HandleDisplayAlertL ServerHbNotifier step 2");
       
  1815         
       
  1816       
       
  1817         RProperty propertykey;
       
  1818         
       
  1819         TRequestStatus status;
       
  1820         
       
  1821         TInt err = RProperty::Define(dmagentuid , EHbDMSyncNotifierKeyStatus, RProperty::EInt);
       
  1822         	
       
  1823         err = RProperty::Define(dmagentuid , EHbDMSyncNotifierKeyStatusReturn, RProperty::EInt);
       
  1824 
       
  1825          TInt err1 = propertykey.Attach(dmagentuid , EHbDMSyncNotifierKeyStatus);
       
  1826 
       
  1827             propertykey.Subscribe(status);
       
  1828         
       
  1829         LOGSTRING2(" err = %d", err);
       
  1830         LOGSTRING2(" err1 = %d", err1);
       
  1831         
       
  1832         
       
  1833          LOGSTRING("HandleDisplayAlertL ServerHbNotifier step 3");
       
  1834 
       
  1835 
       
  1836         devDialog = CHbDeviceDialogSymbian::NewL();
       
  1837         devDialog->Show(KHbNotifier, *varMap);
       
  1838 
       
  1839         User::WaitForRequest(status);
  1789         User::WaitForRequest(status);
  1840         
  1790 
  1841         propertykey.Close();
  1791 DmDevdialog.Close();
  1842 
       
  1843 
       
  1844 
       
  1845 
       
  1846         CleanupStack::PopAndDestroy(3);
       
  1847         
       
  1848 
       
  1849         if(devDialog)
       
  1850             {
       
  1851             delete devDialog;
       
  1852             devDialog = NULL;
       
  1853             }
       
  1854         LOGSTRING("HandleDisplayAlertL ServerHbNotifier end");
  1792         LOGSTRING("HandleDisplayAlertL ServerHbNotifier end");
  1855 
  1793 
  1856 }
  1794 }
  1857 TBool CNSmlDMCmds::IsHbSyncmlNotifierEnabledL()
  1795 TBool CNSmlDMCmds::IsHbSyncmlNotifierEnabledL()
  1858     {
  1796     {