diff -r 8c9427577f2a -r 848a3adde87f controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp --- a/controlpanelplugins/themeplugin/src/cpthemeclientqt_p.cpp Fri Jun 11 16:24:15 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,189 +0,0 @@ -/* - * 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 "cpthemeclientqt_p.h" -#include -#include -#include -#include -#include -#include - -#include - - -#define WAIT_TIME_TO_CONNECT_TO_SERVER 500 -#define WAIT_TIME_TO_START_SERVER 5000 -//static const QString SERVERFILEPATH = QLatin1String(HB_BIN_DIR) + QDir::separator() + QLatin1String("hbthemeserver"); - -/** - * Constructor - */ -CpThemeClientPrivate::CpThemeClientPrivate():clientConnected( false ),localSocket( new QLocalSocket() ) -{ -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO ; -#endif -} - -/** - * connectToServer - */ -bool CpThemeClientPrivate::connectToServer() -{ - localSocket->connectToServer(THEME_SERVER_NAME); - // This logic needs to be improved - bool success = localSocket->waitForConnected( WAIT_TIME_TO_CONNECT_TO_SERVER ); - -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO << "Socket Connect status: " << success; -#endif - -// Stub shouldn't try starting the theme server yet again. -#if 0 - if(!success) { - QProcess *newProcess = new QProcess(); - newProcess->start(SERVERFILEPATH); - success = newProcess->waitForStarted( WAIT_TIME_TO_START_SERVER ); -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO << "Server Start Status: " << success << "Error = " << newProcess->error (); -#endif - - // If server started - if (success) { - // ToDo: This is to wait for server to start running. Logic needs to be improved. - newProcess->waitForFinished(3000); -#ifdef THEME_SERVER_TRACES - qDebug() <connectToServer(THEME_SERVER_NAME); - success = localSocket->waitForConnected(); -#ifdef THEME_SERVER_TRACES - qDebug() <disconnectFromServer(); - delete localSocket; -} - -/** - * CpThemeClientPrivate::themeChanged() - */ -void CpThemeClientPrivate::themeChanged() -{ -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO; -#endif - - QByteArray inputByteArray = localSocket->readAll(); - QDataStream inputDataStream(inputByteArray); - int request; - inputDataStream >> request; - -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO << "recognizer: "<theme()->d_ptr->clearCache(); - } -#endif -} - -/** - * CpThemeClientPrivate::handleThemeChangeRequest() - */ -void CpThemeClientPrivate::handleThemeChangeRequest(QDataStream &dataStream) -{ - QString themeName; - dataStream >> themeName; -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO <<"themeName is : " <theme()->name() == themeName)) { -#ifdef THEME_SERVER_TRACES - qDebug() << Q_FUNC_INFO <<"themeChanged(): called"; -#endif -#if 0 - // TODO determine if we need this for the control panel app - hbInstance->theme()->d_ptr->handleThemeChange(); -#endif - } -} - -/** - * changeTheme - */ -bool CpThemeClientPrivate::changeTheme(const QString &newTheme) -{ -#ifdef THEME_CHANGER_TRACES - qDebug() <<"ThemeClientQt::changeTheme("<write(outputByteArray); -#ifdef THEME_CHANGER_TRACES - qDebug()<<"ThemeClientQt::ThemeName written to server"; -#endif - localSocket->flush(); - return count == expected; -} - - - - - -