controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp
changeset 19 36aa4756ee82
parent 11 10d0dd0e43f1
child 21 2883a5458389
--- a/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp	Mon May 03 12:32:06 2010 +0300
+++ b/controlpanelplugins/themeplugin/src/cpthemeclientsymbian_p.cpp	Fri May 14 13:21:08 2010 +0800
@@ -1,35 +1,29 @@
 /*
-* Copyright (c) 2008-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"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
+ * Copyright (c) 2009 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""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  
+ *   
+ */
 
 #include "cpthemeclientsymbian_p.h"
 #include "cpthemesymbiancommon_p.h"
+#include <e32property.h>
 
-#include <QFile>
-#include <QDebug>
-#include <QTime>
-
-const TUint KDefaultMessageSlots = 4;
 
 /**
 * constructor
 */
-CpThemeClientPrivate::CpThemeClientPrivate():
-    clientConnected(false)
+CpThemeClientPrivate::CpThemeClientPrivate()
 {
 }
 
@@ -40,11 +34,7 @@
 */
 bool CpThemeClientPrivate::connectToServer()
 {
-   
-    TInt error; 
-    
-    error = CreateSession(KThemeServerName, Version(), KDefaultMessageSlots);
-    return( clientConnected = (KErrNone == error ) );
+    return true;
 }
 
 /**
@@ -52,19 +42,7 @@
 */
 bool CpThemeClientPrivate::isConnected()
 {
-    return connected;
-}
-
-
-
-/**
-Returns the version number
-*/  
-TVersion CpThemeClientPrivate::Version(void) const
-{
-    return(TVersion(KThemeServerMajorVersionNumber,
-                    KThemeServerMinorVersionNumber,
-                    KThemeServerBuildVersionNumber));
+    return true;
 }
 
 /**
@@ -72,53 +50,6 @@
  */
 CpThemeClientPrivate::~CpThemeClientPrivate()
 {
-    RSessionBase::Close();
-}
-
-/**
- * StartServer
- */
-TInt CpThemeClientPrivate::StartServer()
-{
-    TFindServer findThemeServer(KThemeServerName);
-    TFullName name;
-    if ( KErrNone == findThemeServer.Next( name ) ) {
-        // Server already running
-        return KErrNone;
-    }
-    return CreateServerProcess();
-}
-
-/**
- * CreateServerProcess
- */
-TInt CpThemeClientPrivate::CreateServerProcess()
-{
-    TInt result;
-    const TUid KServerUid2={0x100039CE};
-    const TUidType serverUid( KNullUid, KServerUid2, KServerUid3 );
-    RProcess server;
-    _LIT(KThemeServerExe,"hbthemeserver.exe");
-    
-    result = server.Create( KThemeServerExe, KNullDesC, EOwnerProcess );
-    
-    if (KErrNone != result) {
-        return  result; 
-    }
-    else {
-        TRequestStatus status;
-        server.Rendezvous(status);
-        if (status!=KRequestPending) {
-            server.Kill(0); // abort startup
-        }
-        else {
-            server.Resume(); // logon OK - start the server
-        }
-        User::WaitForRequest(status);// wait for start or death
-        server.Close();
-        connected == status.Int() == KErrNone ? true : false;
-        return status.Int(); // return the error
-    }
 }
 
 /**
@@ -126,8 +57,16 @@
  */
 bool CpThemeClientPrivate::changeTheme(const QString& aString )
 {
-    TPtrC themeName(reinterpret_cast<const TUint16 *>(aString.constData()));
-    TIpcArgs args(&themeName);
-    TInt err = SendReceive(EThemeSelection, args);
-    return KErrNone == err;
+    TInt err = KErrGeneral;
+    RProperty themeRequestProp;
+    
+    User::LeaveIfError( themeRequestProp.Attach( KServerUid3, KNewThemeForThemeChanger ) );
+    
+    TBuf<256> newThemenameChangeRequest;
+    _LIT(KThemeRequestFormatter, "%d:%S");
+    TBuf<256> newThemename(aString.utf16());
+    newThemenameChangeRequest.Format( KThemeRequestFormatter, EThemeSelection, &newThemename);
+    err = themeRequestProp.Set(newThemenameChangeRequest);
+    themeRequestProp.Close();
+    return (err == KErrNone);
 }