zeroconf/zeroconfsharing/zeroconfsharing.cpp
author guru.kini@nokia.com
Wed, 21 Jul 2010 14:28:48 +0530
changeset 21 ff5174af067c
permissions -rw-r--r--
ZeroConf Sharing Application
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
     1
/*
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
     3
* All rights reserved.
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
     8
*
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
     9
* Initial Contributors:
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    11
*
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    12
* Contributors:
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    13
*
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    14
* Description: 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    15
*
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    16
*/
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    17
#include "zeroconfsharing.h"
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    18
#include <mdns/mdnsparamset.h>
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    19
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    20
#include <QtGui/QListWidget>
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    21
#include <QVBoxLayout>
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    22
#include <QtNetwork>
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    23
#include <QNetworkRequest>
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    24
#include <QNetworkReply>
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    25
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    26
#ifdef Q_OS_SYMBIAN
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    27
#include "sym_iap_util.h"
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    28
#endif
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    29
#include "bjrhttpserver.h"
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    30
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    31
#include "contactinfo.h"
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    32
#include "cfileparser.h"
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    33
#include "cfilelistengine.h"
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    34
#include "downloadicon.h"
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    35
_LIT8(KFileName,"E:\\logs\\temp.txt");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    36
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    37
_LIT8(KMyStatusFile,"E:\\MyStatus.txt");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    38
const int KMaxLength = 256;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    39
_LIT8(KLogFile,"E:\\logs\\uilog.txt");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    40
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    41
QZeroConfSharingUi::QZeroConfSharingUi(QWidget *parent)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    42
    : QMainWindow(parent)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    43
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    44
	ui.setupUi(this);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    45
	
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    46
	isShared = false;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    47
	
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    48
    tabWidget = new QTabWidget(this);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    49
    tabWidget->hide();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    50
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    51
    shareAction = new QAction(tr("Share"), this);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    52
    connect(shareAction, SIGNAL(triggered()), this, SLOT(StartServer()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    53
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    54
    unshareAction = new QAction(tr("UnShare"), this);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    55
    connect(unshareAction, SIGNAL(triggered()), this, SLOT(StopServer()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    56
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    57
    menuBar()->addAction(shareAction);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    58
#ifdef Q_OS_SYMBIAN
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    59
       qt_SetDefaultIap();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    60
#endif
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    61
   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    62
    manager = new QNetworkAccessManager(this);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    63
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    64
#ifndef __arm 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    65
    PopulateCommunityList();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    66
    PopulateCommunityList();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    67
    PopulateCommunityList();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    68
    PopulateCommunityList();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    69
    PopulateCommunityList();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    70
#endif
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    71
    // Hide the Contact Tab
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    72
    ui.tabWidget->removeTab(0);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    73
    // Hide the Chat tab
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    74
    ui.tabWidget->removeTab(4);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    75
    // Hide the File Share Tab
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    76
    ui.treeContactMusic->setVisible(false);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    77
    ui.treeContactMusic_2->setVisible(false);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    78
    ui.treeContactMusic_3->setVisible(false);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    79
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    80
    ShowBackButtons(false);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    81
    // Layout
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    82
    QVBoxLayout *layout = new QVBoxLayout;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    83
    layout->addWidget(ui.tabWidget);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    84
    setLayout(layout);   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    85
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    86
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    87
	ui.tabWidget->setContextMenuPolicy(Qt::NoContextMenu);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    88
    ui.tabWidget->showMaximized();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    89
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    90
    connect(ui.listAvatars, SIGNAL(itemClicked(QListWidgetItem *)),
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    91
            this, SLOT(on_listAvatars_itemClicked(QListWidgetItem *)));   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    92
  
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    93
	ui.tabWidget->setCurrentIndex(0);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    94
	
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    95
	connect(ui.StatusUpdatebtn, SIGNAL(pressed()),this,SLOT(UpdateMyStatus()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    96
    connect(ui.pushBackContact, SIGNAL(clicked ()), this, SLOT(backPressed()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    97
    connect(ui.pushBackPhoto, SIGNAL(clicked ()), this, SLOT(backPressed()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    98
    connect(ui.pushBackVideo, SIGNAL(clicked ()), this, SLOT(backPressed()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
    99
    connect(ui.pushBackChat, SIGNAL(clicked ()), this, SLOT(backPressed()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   100
    connect(ui.pushBackMusic, SIGNAL(clicked ()), this, SLOT(backPressed()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   101
	
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   102
    connect(ui.treeContactMusic_2, SIGNAL(itemClicked(QTreeWidgetItem* , int)), this, SLOT(ContactitemClicked(QTreeWidgetItem* , int)));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   103
    connect(ui.treeContactMusic, SIGNAL(itemClicked(QTreeWidgetItem* , int)), this, SLOT(ContactitemClicked(QTreeWidgetItem* , int)));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   104
    connect(ui.treeContactMusic_3, SIGNAL(itemClicked(QTreeWidgetItem* , int)), this, SLOT(ContactitemClicked(QTreeWidgetItem* , int)));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   105
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   106
	//Open the status file
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   107
    QString mystatusfile = QString::fromUtf8((const char*)KMyStatusFile().Ptr(),KMyStatusFile().Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   108
    bool doesExist = MyStatusFile.exists(mystatusfile);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   109
    MyStatusFile.setFileName(mystatusfile);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   110
    //file already exists...get the status from file
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   111
    MyStatusFile.open( QIODevice::ReadOnly|QIODevice::Text );
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   112
    //opened in write only mode so that status updates can be
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   113
    //reflected in the file
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   114
    QByteArray str = MyStatusFile.readAll();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   115
    QString filestr(str);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   116
    nowStatus = filestr;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   117
           
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   118
    ui.MyStatusLabel->setText(nowStatus);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   119
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   120
    //convert nowSttaus to Rbuf8
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   121
    TPtrC ptrName(reinterpret_cast<const TText*>(nowStatus.constData()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   122
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   123
    iStatus.CreateL(ptrName.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   124
    iStatus.Copy(ptrName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   125
   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   126
	
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   127
	iZeroConfClient = CZeroconfClient::NewL(this);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   128
    iZeroConfClient->ConnectL();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   129
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   130
    iNewContact = NULL;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   131
       MyStatusFile.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   132
       
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   133
       iStatusUpdate =EFalse;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   134
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   135
    iMusic = CMusicProvider::NewL(this);    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   136
    iUpdate = EFalse;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   137
    iMusic->RequestMediaL();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   138
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   139
    DiscoverServices();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   140
	
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   141
    progressBar = NULL;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   142
    //IsDownloadItem = false;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   143
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   144
    logFile.setFileName("C:\\Data\\logs\\ZeroConfSharingui_log.txt");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   145
    logFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   146
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   147
    logFile.write("Logging Starts");        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   148
    logFile.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   149
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   150
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   151
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   152
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   153
void QZeroConfSharingUi::Log(const char* msg)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   154
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   155
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   156
    logFile.open(QIODevice::Append);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   157
    logFile.write(msg, qstrlen(msg));        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   158
    logFile.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   159
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   160
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   161
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   162
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   163
void QZeroConfSharingUi::ContactitemClicked(QTreeWidgetItem* item, int /*column*/)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   164
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   165
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   166
    TPtrC ptrName(reinterpret_cast<const TText*>(iSelectedContact.constData()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   167
      
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   168
    RBuf8 contactName;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   169
    contactName.Create(ptrName.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   170
    contactName.Copy(ptrName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   171
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   172
    //Find if its an already existing contact
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   173
    CContactInfo* contact = GetSelectedContact(contactName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   174
    if(contact!=NULL)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   175
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   176
        //IsDownloadItem = true;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   177
        RBuf8 url;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   178
        url.Create(KMaxLength);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   179
        url.Copy(contact->BaseUrl());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   180
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   181
        TPtrC fileItemName(reinterpret_cast<const TText*>((item->text(0)).constData()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   182
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   183
        RBuf8 fileName;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   184
        fileName.Create(fileItemName.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   185
        fileName.Copy(fileItemName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   186
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   187
        url.Append(fileName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   188
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   189
        QString qurl = QString::fromUtf8((const char*)url.Ptr(),url.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   190
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   191
        iSelectedFileName = QString::fromUtf8((const char*)(contact->FilePath(fileName)).Ptr(),(contact->FilePath(fileName)).Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   192
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   193
        progressBar = new QProgressDialog(tr("Retrieving Shared Content"), tr("Cancel"), 0, 0);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   194
        connect(progressBar, SIGNAL(canceled()), this, SLOT(ProgressBarCanceled()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   195
        progressBar->show();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   196
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   197
        itemReply = manager->get(QNetworkRequest(QUrl(qurl)));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   198
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   199
        connect(itemReply, SIGNAL(finished()), this, SLOT(ItemRequestFinished()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   200
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   201
        fileName.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   202
        url.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   203
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   204
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   205
    contactName.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   206
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   207
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   208
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   209
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   210
void QZeroConfSharingUi::UpdateMyStatus()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   211
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   212
    //get the Text entered by the user in the status update
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   213
    //text box
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   214
    //& display it in the MyStatus label button
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   215
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   216
    QString mystatusfile = QString::fromUtf8((const char*)KMyStatusFile().Ptr(),KMyStatusFile().Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   217
    bool doesExist = MyStatusFile.exists(mystatusfile);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   218
    MyStatusFile.setFileName(mystatusfile);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   219
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   220
    MyStatusFile.open( QIODevice::WriteOnly |QIODevice::Text );
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   221
    QString currentStatus = ui.StatusTextBox->toPlainText();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   222
    //set the MyStatusLabel with this text
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   223
    ui.MyStatusLabel->setText(currentStatus);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   224
    nowStatus = currentStatus;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   225
    TPtrC ptrName(reinterpret_cast<const TText*>(nowStatus.constData()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   226
            
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   227
    RBuf8 current;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   228
    current.Create(ptrName.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   229
    current.Copy(ptrName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   230
    if(iStatusUpdate)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   231
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   232
        iZeroConfClient->UpdateCurrentStatusServiceL(current);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   233
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   234
    else
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   235
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   236
        iZeroConfClient->PublishCurrentStatusServiceL(current);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   237
        iStatusUpdate =ETrue;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   238
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   239
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   240
    int errval = MyStatusFile.write(nowStatus.toUtf8());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   241
    MyStatusFile.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   242
    current.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   243
    ui.StatusTextBox->clear();    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   244
    //send an update record at Bonjour-level
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   245
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   246
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   247
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   248
void QZeroConfSharingUi::PopulateCommunityList()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   249
{
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   250
    static int i = 0;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   251
    QString path, name;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   252
    switch(i)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   253
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   254
        case 0:  path = ":/Images/Vivek"; name = "Vivek";break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   255
        case 1:  path = ":/Images/Unknown"; name = "Vadan";break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   256
        case 2:  path = ":/Images/Guru"; name = "Guru"; break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   257
        case 3:  path = ":/Images/Sampo"; name =  "Sampo";break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   258
        case 4:  path = ":/Images/Unknown"; name = "Sindhu";break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   259
        default: break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   260
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   261
    i++;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   262
    QListWidgetItem* item = new QListWidgetItem(QIcon(path), name);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   263
    ui.listAvatars->addItem(item);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   264
}
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   265
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   266
void QZeroConfSharingUi::PopulateUserList()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   267
{
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   268
}
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   269
void QZeroConfSharingUi::backPressed()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   270
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   271
    ShowAllContacts(true);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   272
    setWindowTitle(QApplication::translate("MainWindow", "Local Sharing", 0, QApplication::UnicodeUTF8));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   273
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   274
    ui.treeContactMusic->setVisible(false);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   275
    ui.treeContactMusic_2->setVisible(false);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   276
    ui.treeContactMusic_3->setVisible(false);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   277
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   278
    ui.treeMusicAll_3->setVisible(true);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   279
    ui.treeMusicAll->setVisible(true);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   280
    ui.treeMusicAll_2->setVisible(true);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   281
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   282
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   283
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   284
void QZeroConfSharingUi::PopulateContactSpecificData()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   285
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   286
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   287
    TPtrC ptrName(reinterpret_cast<const TText*>(iSelectedContact.constData()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   288
    RBuf8 iname,mname,vname,fname;            
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   289
        RBuf8 contactName;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   290
        contactName.Create(ptrName.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   291
        contactName.Copy(ptrName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   292
        //Find if its an already existing contact
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   293
#ifdef __arm
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   294
        CContactInfo* contact = GetSelectedContact(contactName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   295
        if(contact!=NULL)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   296
#endif
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   297
          {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   298
             //invoke the parser
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   299
#ifdef __arm
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   300
             fname.CreateL(contact->FileListPath(_L8("filelist.txt")));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   301
             
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   302
             iname.CreateL(contact->ImgFileName());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   303
             mname.CreateL(contact->MusicFileName());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   304
             vname.CreateL(contact->VideoFileName());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   305
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   306
#else
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   307
             _LIT8(KFileListName,"c:\\data\\filelist.txt");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   308
             fname.CreateL(KFileListName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   309
             _LIT8(KFileImgName,"c:\\data\\ImgList.txt");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   310
             iname.CreateL(KFileImgName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   311
             _LIT8(KFileMusicName,"c:\\data\\MusicList.txt");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   312
             mname.CreateL(KFileMusicName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   313
             _LIT8(KFileVideoName,"c:\\data\\VideoList.txt");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   314
             vname.CreateL(KFileVideoName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   315
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   316
#endif
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   317
             RBuf allfilenames;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   318
             RBuf photofile;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   319
             RBuf musicfile;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   320
             RBuf videofile;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   321
             
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   322
             allfilenames.CreateL(KMaxLength);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   323
             photofile.CreateL(KMaxLength);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   324
             musicfile.CreateL(KMaxLength);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   325
             videofile.CreateL(KMaxLength);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   326
                          
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   327
             allfilenames.Copy(fname);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   328
             photofile.Copy(iname);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   329
             musicfile.Copy(mname);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   330
             videofile.Copy(vname);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   331
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   332
             CFileParser* parser = CFileParser::NewL();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   333
             parser->ParseFile(allfilenames,photofile,musicfile,videofile); 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   334
             delete parser;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   335
            
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   336
             allfilenames.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   337
             photofile.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   338
             musicfile.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   339
             videofile.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   340
          }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   341
        contactName.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   342
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   343
    _LIT8(KPhoto,"c:\\data\\photolist.txt");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   344
    _LIT8(KMusic,"c:\\data\\musiclist.txt");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   345
    _LIT8(KVideo,"c:\\data\\videolist.txt");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   346
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   347
    ////////////////////////////////////////////////////////////////////////////////////
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   348
    //first open the photo file & read it
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   349
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   350
    ui.treeContactMusic_2->clear();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   351
    ui.treeContactMusic->clear();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   352
    ui.treeContactMusic_3->clear();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   353
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   354
    QString photofile = QString::fromUtf8((const char*)iname.Ptr(),iname.Length()); 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   355
    iGenericFile.setFileName(photofile);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   356
    iGenericFile.open(QIODevice::ReadOnly | QIODevice::Text);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   357
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   358
    int count = 0;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   359
    while(!iGenericFile.atEnd())
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   360
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   361
            ReadFile();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   362
            if(!filename.isEmpty())
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   363
                {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   364
                new QTreeWidgetItem(ui.treeContactMusic_2);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   365
                QTreeWidgetItem *qtreewidgetitem = ui.treeContactMusic_2->topLevelItem(count);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   366
                qtreewidgetitem->setText(0,filename);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   367
                count++;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   368
                }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   369
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   370
    iGenericFile.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   371
    ////////////////////////////////////////////////////////////////////////////////////////
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   372
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   373
    //now open music file & read it
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   374
    QString musicfile = QString::fromUtf8((const char*)mname.Ptr(),mname.Length()); 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   375
    iGenericFile.setFileName(musicfile);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   376
    iGenericFile.open(QIODevice::ReadOnly | QIODevice::Text);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   377
    count = 0;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   378
    while(!iGenericFile.atEnd())
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   379
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   380
            ReadFile();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   381
            if(!filename.isEmpty())
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   382
                {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   383
                new QTreeWidgetItem(ui.treeContactMusic);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   384
                QTreeWidgetItem *qtreewidgetitem = ui.treeContactMusic->topLevelItem(count);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   385
                qtreewidgetitem->setText(0,filename);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   386
                count++;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   387
                }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   388
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   389
    iGenericFile.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   390
            
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   391
    ////////////////////////////////////////////////////////////////////////////////////////
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   392
    //now open video file & read it
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   393
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   394
    QString videofile = QString::fromUtf8((const char*)vname.Ptr(),vname.Length()); 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   395
    iGenericFile.setFileName(videofile);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   396
    iGenericFile.open(QIODevice::ReadOnly | QIODevice::Text);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   397
    count = 0;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   398
    while(!iGenericFile.atEnd())
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   399
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   400
            ReadFile();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   401
            if(!filename.isEmpty())
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   402
                {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   403
                new QTreeWidgetItem(ui.treeContactMusic_3);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   404
                QTreeWidgetItem *qtreewidgetitem = ui.treeContactMusic_3->topLevelItem(count);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   405
                qtreewidgetitem->setText(0,filename);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   406
                count++;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   407
                }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   408
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   409
    iGenericFile.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   410
    ////////////////////////////////////////////////////////////////////////////
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   411
    //close all rbufs
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   412
    fname.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   413
    iname.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   414
    mname.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   415
    vname.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   416
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   417
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   418
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   419
void QZeroConfSharingUi::ReadFile()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   420
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   421
    qint64 value = Q_INT64_C(255);    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   422
    QByteArray str = iGenericFile.readLine(value);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   423
    if((!str.isEmpty()) && (str.endsWith('\n')))
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   424
        str.remove((str.length()-1), 1);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   425
    int index = str.lastIndexOf('/');
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   426
            //cut from the index posn
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   427
    filename = str.mid(index+1);      
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   428
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   429
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   430
CContactInfo* QZeroConfSharingUi::GetSelectedContact(const TDesC8& aConatactName)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   431
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   432
    for(TInt i=0;i<iEntries.Count();i++)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   433
       {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   434
       if(iEntries[i]->ContactName().Compare(aConatactName)==0)                                                     
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   435
           {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   436
           return iEntries[i];
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   437
           }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   438
       }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   439
    return NULL;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   440
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   441
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   442
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   443
void QZeroConfSharingUi::RequestSharedContent()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   444
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   445
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   446
    TPtrC ptrName(reinterpret_cast<const TText*>(iSelectedContact.constData()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   447
    RBuf8 contactName;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   448
    contactName.Create(ptrName.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   449
    contactName.Copy(ptrName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   450
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   451
    //Find if its an already existing contact
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   452
    CContactInfo* contact = GetSelectedContact(contactName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   453
    if(contact!=NULL)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   454
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   455
        RBuf8 fileUrl;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   456
        _LIT8(KFileList,"filelist.txt");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   457
        fileUrl.Create(contact->FileUrl(KFileList));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   458
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   459
        iSelectedFileListName = QString::fromUtf8((const char*)(contact->FileListPath(KFileList)).Ptr(),(contact->FileListPath(KFileList)).Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   460
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   461
        QString qurl = QString::fromUtf8((const char*)(fileUrl).Ptr(),(fileUrl).Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   462
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   463
        //QMessageBox::warning(this, tr("Icon Path"),qurl,QMessageBox::Ok);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   464
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   465
        progressBar = new QProgressDialog(tr("Retrieving Shared Content"), tr("Cancel"), 0, 0);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   466
        connect(progressBar, SIGNAL(canceled()), this, SLOT(ProgressBarCanceled()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   467
        progressBar->show();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   468
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   469
#ifdef __arm 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   470
        reply = manager->get(QNetworkRequest(QUrl(qurl)));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   471
#else
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   472
        reply = manager->get(QNetworkRequest(QUrl("http://kiranp747.googlepages.com/FileList.txt")));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   473
#endif
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   474
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   475
        connect(reply, SIGNAL(finished()), this, SLOT(RequestFinished()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   476
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   477
        fileUrl.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   478
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   479
    contactName.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   480
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   481
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   482
void QZeroConfSharingUi::on_listAvatars_itemClicked(QListWidgetItem* item)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   483
{
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   484
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   485
    if(progressBar != NULL)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   486
        return;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   487
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   488
    iSelectedContact = item->text();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   489
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   490
    setWindowTitle(iSelectedContact);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   491
    ui.tabWidget->removeTab(0);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   492
    ui.tabWidget->insertTab(0, ui.tabVivek, QIcon(":/Images/Unknown"), "Wall");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   493
    ui.tabWidget->insertTab(4, ui.tabChat, QIcon(":/Icons/Chat"), "Chat");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   494
    ui.tabWidget->setCurrentIndex(0);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   495
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   496
    ShowBackButtons(true);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   497
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   498
    ui.treeContactMusic->setVisible(true);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   499
    ui.treeContactMusic_2->setVisible(true);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   500
    ui.treeContactMusic_3->setVisible(true);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   501
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   502
    ui.treeMusicAll_3->setVisible(false);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   503
    ui.treeMusicAll->setVisible(false);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   504
    ui.treeMusicAll_2->setVisible(false);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   505
#ifndef __arm 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   506
    PopulateContactSpecificData();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   507
#endif
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   508
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   509
    RequestSharedContent();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   510
    ShowCur_Status_and_Track();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   511
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   512
}
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   513
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   514
void QZeroConfSharingUi::ProgressBarCanceled()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   515
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   516
    //if(progressBar && progressBar->isVisible())
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   517
    if(progressBar)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   518
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   519
        //progressBar->close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   520
        delete progressBar;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   521
        progressBar = NULL;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   522
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   523
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   524
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   525
void QZeroConfSharingUi::ItemRequestFinished()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   526
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   527
    if(progressBar && progressBar->isVisible())
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   528
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   529
        progressBar->close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   530
        delete progressBar;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   531
        progressBar = NULL;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   532
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   533
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   534
    int error = itemReply->error();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   535
    if(!error)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   536
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   537
        QNetworkReply *reply = ((QNetworkReply *)sender());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   538
        QByteArray data = reply->readAll();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   539
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   540
        if(data.isEmpty())
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   541
            QMessageBox::warning(this, tr("Test"),tr("No Data Reply"),QMessageBox::Ok);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   542
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   543
        QFile temp(iSelectedFileName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   544
        temp.open(QIODevice::WriteOnly | QIODevice::Truncate);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   545
        temp.write(data);        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   546
        temp.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   547
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   548
        QUrl itemUrl(iSelectedFileName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   549
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   550
        bool ret = QDesktopServices::openUrl(itemUrl);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   551
        if(!ret)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   552
            QMessageBox::warning( this, tr("Operation Failed"), tr("Unkown error!"), QMessageBox::Close);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   553
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   554
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   555
    else
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   556
        QMessageBox::warning(this, tr("Test"),reply->errorString(),QMessageBox::Ok);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   557
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   558
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   559
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   560
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   561
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   562
void QZeroConfSharingUi::RequestFinished()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   563
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   564
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   565
    if(progressBar && progressBar->isVisible())
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   566
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   567
        progressBar->close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   568
        delete progressBar;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   569
        progressBar = NULL;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   570
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   571
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   572
    int error = reply->error();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   573
    if(!error)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   574
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   575
        QNetworkReply *reply = ((QNetworkReply *)sender());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   576
        QByteArray data = reply->readAll();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   577
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   578
        if(data.isEmpty())
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   579
            QMessageBox::warning(this, tr("Test"),tr("No Data Reply"),QMessageBox::Ok);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   580
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   581
        QFile temp(iSelectedFileListName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   582
        temp.open(QIODevice::WriteOnly | QIODevice::Truncate);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   583
        temp.write(data);        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   584
        temp.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   585
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   586
        PopulateContactSpecificData();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   587
            //}
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   588
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   589
    else
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   590
        QMessageBox::warning(this, tr("Test"),reply->errorString(),QMessageBox::Ok);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   591
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   592
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   593
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   594
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   595
void QZeroConfSharingUi::ShowCur_Status_and_Track()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   596
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   597
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   598
    TPtrC ptrName(reinterpret_cast<const TText*>(iSelectedContact.constData()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   599
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   600
    RBuf8 contactName;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   601
    RBuf8 currentTrack,currentUserStatus;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   602
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   603
    contactName.Create(ptrName.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   604
    contactName.Copy(ptrName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   605
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   606
    //get complete contact info of the person
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   607
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   608
    for(TInt i=0;i<iEntries.Count();i++)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   609
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   610
        if(iEntries[i]->ContactName().Compare(contactName)==0)                                                     
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   611
                {     
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   612
                     currentTrack.CreateL(iEntries[i]->CurrentlyPlaying().Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   613
                     currentTrack.Copy(iEntries[i]->CurrentlyPlaying());  
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   614
                     
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   615
                     currentUserStatus.CreateL(iEntries[i]->Status().Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   616
                     currentUserStatus.Copy(iEntries[i]->Status());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   617
                     
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   618
                     ui.textEdit_2->clear ();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   619
                     QString nowPlayingLabel = "Now Playing: ";
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   620
                     QString nowPlayingTrack = QString::fromUtf8((const char*)currentTrack.Ptr(),currentTrack.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   621
                     QString total(nowPlayingLabel);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   622
                     total.append(nowPlayingTrack);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   623
                     
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   624
                     QString newline(tr("\n\n\n"));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   625
                     total.append(newline);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   626
                     QString nowStatusLabel = "Status: ";
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   627
                     total.append(nowStatusLabel);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   628
                     QString nowStatusString = QString::fromUtf8((const char*)currentUserStatus.Ptr(),currentUserStatus.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   629
                     total.append(nowStatusString);            
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   630
                     
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   631
                                   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   632
                     ui.textEdit_2->setText(total);                        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   633
                }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   634
         }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   635
    currentTrack.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   636
    currentUserStatus.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   637
    contactName.Close(); 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   638
     
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   639
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   640
    }//end of function
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   641
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   642
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   643
void QZeroConfSharingUi::ShowAllContacts(bool aShow)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   644
{
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   645
    if(aShow)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   646
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   647
        // Contact Tab
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   648
        ui.tabWidget->removeTab(0);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   649
        // Add All Contacts tab
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   650
        ui.tabWidget->insertTab(0, ui.tabContacts, QIcon(":/Icons/Contact"), "Contacts");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   651
        // Chat Tab
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   652
        ui.tabWidget->removeTab(4);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   653
        // Set Focus
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   654
        ui.tabWidget->setCurrentIndex(0);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   655
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   656
    else
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   657
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   658
        ui.tabWidget->removeTab(0);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   659
        //ui.tabWidget->insertTab(0, ui.tabVivek, QIcon(":/Images/Vivek"), "Vivek's Wall");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   660
        ui.tabWidget->insertTab(4, ui.tabChat, QIcon(":/Icons/Chat"), "Chat");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   661
        ui.tabWidget->setCurrentIndex(0);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   662
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   663
    // Music
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   664
    //ui.textMusicAll->setVisible(aShow);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   665
    //ui.treeMusicAll->setVisible(aShow);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   666
    //ui.treeContactMusic->setVisible(!aShow);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   667
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   668
    ShowBackButtons(!aShow);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   669
}
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   670
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   671
void QZeroConfSharingUi::ShowBackButtons(bool aShow)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   672
{
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   673
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   674
    // Push Buttons
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   675
    ui.pushBackChat->setVisible(aShow);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   676
    ui.pushBackContact->setVisible(aShow);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   677
    ui.pushBackPhoto->setVisible(aShow);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   678
    ui.pushBackMusic->setVisible(aShow);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   679
    ui.pushBackVideo->setVisible(aShow);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   680
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   681
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   682
}
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   683
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   684
void QZeroConfSharingUi::on_pushBackContact_clicked()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   685
{
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   686
    ShowAllContacts(true);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   687
}
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   688
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   689
void QZeroConfSharingUi::on_pushBackMusic_clicked()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   690
{
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   691
    ShowAllContacts(true);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   692
}
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   693
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   694
void QZeroConfSharingUi::on_pushBackVideo_clicked()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   695
{
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   696
    ShowAllContacts(true);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   697
}
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   698
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   699
void QZeroConfSharingUi::on_pushBackChat_clicked()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   700
{
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   701
    ShowAllContacts(true);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   702
}
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   703
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   704
void QZeroConfSharingUi::on_pushBackFile_clicked()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   705
{
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   706
    ShowAllContacts(true);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   707
}
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   708
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   709
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   710
void QZeroConfSharingUi::StartServer()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   711
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   712
    menuBar()->removeAction(shareAction);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   713
    menuBar()->addAction(unshareAction);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   714
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   715
    iHttpServer = CHttpServer::NewL();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   716
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   717
    iHttpServer->ProcessSelectionL(EStart);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   718
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   719
    CFileListEngine* filelister = CFileListEngine::NewL();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   720
    filelister->SetOutputFileName(_L("c:\\data\\Images\\filelist.txt"));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   721
    filelister->GetAllMediaContent();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   722
    delete filelister;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   723
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   724
    _LIT8(Kfilelist,"filelist.txt");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   725
    _LIT8(KIconName,"mypic.ico");   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   726
    iPublishBaseUrl.Create(KMaxPath);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   727
    iPublishBaseUrl.Copy(_L8("http://"));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   728
    iPublishBaseUrl.Append(iHttpServer->GetIPAddress());   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   729
    iPublishBaseUrl.Append(_L8("/Images/")); //http://<ipaddr>/
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   730
   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   731
    PublishMyService(Kfilelist,KIconName);    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   732
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   733
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   734
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   735
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   736
void QZeroConfSharingUi::StopServer()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   737
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   738
    //ToDo: Should stop server and unpublish the services.
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   739
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   740
    menuBar()->removeAction(unshareAction);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   741
    menuBar()->addAction(shareAction);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   742
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   743
    iZeroConfClient->UnPublishServices();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   744
    iHttpServer->ProcessSelectionL(EStop); 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   745
    delete iHttpServer;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   746
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   747
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   748
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   749
void QZeroConfSharingUi::NowPlaying(TDes& aTitleBuf)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   750
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   751
    //QString qtTitle = QString::fromUtf16(aTitleBuf.Ptr(),aTitleBuf.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   752
    //QMessageBox::warning(this,tr("Now playing"),qtTitle,QMessageBox::Ok);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   753
    if(iUpdate)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   754
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   755
        iZeroConfClient->UpdateNowPlayingServiceL(aTitleBuf);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   756
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   757
    else
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   758
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   759
        iZeroConfClient->PublishNowPlayingServiceL(aTitleBuf);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   760
        iUpdate = ETrue;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   761
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   762
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   763
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   764
void QZeroConfSharingUi::DiscoverServices()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   765
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   766
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   767
    iZeroConfClient->WriteServices();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   768
    } 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   769
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   770
void QZeroConfSharingUi::GetSrvInfo(const TDesC8& aQueryString,TDnsType aType)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   771
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   772
    iZeroConfClient->GetService(aQueryString,aType);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   773
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   774
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   775
void QZeroConfSharingUi::PublishService()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   776
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   777
    iZeroConfClient->PublishService();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   778
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   779
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   780
void QZeroConfSharingUi:: PublishMyService(const TDesC8& afilelist,const TDesC8& aIconName)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   781
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   782
    iZeroConfClient->PublishMyService(iPublishBaseUrl, afilelist, aIconName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   783
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   784
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   785
QZeroConfSharingUi::~QZeroConfSharingUi()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   786
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   787
    iPublishBaseUrl.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   788
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   789
    iBaseUrl.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   790
    iIconName.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   791
    iFileName.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   792
    iCurrentlyPlaying.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   793
    iStatus.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   794
    iContactName.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   795
	MyStatusFile.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   796
	
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   797
	for(TInt i=0;i<iEntries.Count();i++)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   798
	        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   799
                delete iEntries[i];
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   800
	        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   801
	
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   802
	iEntries.Reset();        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   803
    delete iNewContact;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   804
    delete iNewContact;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   805
    if(manager)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   806
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   807
        manager->disconnect();    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   808
        delete manager;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   809
        manager = 0;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   810
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   811
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   812
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   813
void QZeroConfSharingUi::PopulateMainWindow(QString qname)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   814
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   815
    QTreeWidgetItem *qtreewidgetitem1 = new QTreeWidgetItem(ui.treeMusicAll_3);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   816
    qtreewidgetitem1->setText(0,qname);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   817
    ui.treeMusicAll_3->addTopLevelItem(qtreewidgetitem1);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   818
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   819
    QTreeWidgetItem *qtreewidgetitem2 = new QTreeWidgetItem(ui.treeMusicAll);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   820
    qtreewidgetitem2->setText(0,qname);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   821
    ui.treeMusicAll->addTopLevelItem(qtreewidgetitem2);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   822
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   823
    QTreeWidgetItem *qtreewidgetitem3 = new QTreeWidgetItem(ui.treeMusicAll_2);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   824
    qtreewidgetitem3->setText(0,qname);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   825
    ui.treeMusicAll_2->addTopLevelItem(qtreewidgetitem3);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   826
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   827
void QZeroConfSharingUi::OnPnPEventL (RPnPParameterBundleBase& aServiceEventInfo)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   828
    {   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   829
    //isPresent =EFalse;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   830
    Log("ZeroConfSharingUi::OnPnPEventL - Entry\n");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   831
    RBuf8 ptrInfo;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   832
    aServiceEventInfo.Store(ptrInfo);   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   833
    CContactInfo* contactInfo = NULL;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   834
    TInt familyCount = aServiceEventInfo.CountParameterFamilies();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   835
    for(TInt idx=0; idx<aServiceEventInfo.CountParameterFamilies();idx++)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   836
        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   837
        RParameterFamily pnpFamily = aServiceEventInfo.GetFamilyAtIndex(idx);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   838
        switch(pnpFamily.Id())
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   839
            {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   840
            case EMdnsPtrParamset:
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   841
                {                 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   842
                TUint count = pnpFamily.CountParameterSets ( RParameterFamily::ERequested ) ;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   843
                for (TInt index= 0; index < count ; index++ )
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   844
                     {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   845
                    CMDnsPtrParamSet* ptrParamSet = static_cast<CMDnsPtrParamSet*>(pnpFamily.GetParameterSetAtIndex( index, RParameterFamily::ERequested ));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   846
                    RBuf name;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   847
                    RBuf domain;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   848
                    name.CreateL(255);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   849
                    domain.CreateL(255);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   850
                    name.Copy(ptrParamSet->InstanceName());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   851
                    domain.Copy(ptrParamSet->DomainName()); 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   852
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   853
                    _LIT(KServicesDns,"_services._dns-sd._udp.local.");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   854
                    if(name.Compare(KServicesDns)!=0)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   855
                        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   856
                        TChar ch = '.';
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   857
                        TInt pos = domain.Locate(ch);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   858
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   859
                        if(pos != KErrNotFound)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   860
                            {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   861
                            RBuf buf16;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   862
                            buf16.CreateL(domain.Mid(0,pos));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   863
                            iSrvName.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   864
                            iSrvName.CreateL(buf16.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   865
                            iSrvName.Copy(buf16.Collapse());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   866
                            //Dont query if you have got all records at a shot!!
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   867
                            if(aServiceEventInfo.CountParameterFamilies() <= 1)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   868
                                {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   869
                                Log("ZeroConfSharingUi::OnPnPEventL - Query for SRV\n");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   870
                                QString tempname5 = QString::fromUtf8((const char*)iSrvName.Ptr(),iSrvName.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   871
                                                               
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   872
                               logFile.open(QIODevice::Append);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   873
                               logFile.write(tempname5.toUtf8());        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   874
                               logFile.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   875
                                
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   876
                                GetSrvInfo(iSrvName,EDnsQType_Any);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   877
                                }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   878
                            buf16.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   879
                            }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   880
                        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   881
                    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   882
                    name.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   883
                    domain.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   884
                     }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   885
                }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   886
                break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   887
                
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   888
            case EMdnsSrvParamset:
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   889
                {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   890
                TUint count = pnpFamily.CountParameterSets ( RParameterFamily::ERequested ) ;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   891
                for (TInt index= 0; index < count ; index++ )
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   892
                     {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   893
                    TBool isPresent = EFalse;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   894
                    CMDnsSrvParamSet* srvParamSet = static_cast<CMDnsSrvParamSet*>(pnpFamily.GetParameterSetAtIndex( index, RParameterFamily::ERequested ));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   895
                    RBuf name;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   896
                    RBuf target;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   897
                    name.CreateL(255);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   898
                    target.CreateL(255);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   899
                    target.Copy(srvParamSet->Target());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   900
                    name.Copy(srvParamSet->DomainName());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   901
                    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   902
                    Log("ZeroConfSharingUi::OnPnPEventL - Print srv inst name\n\t");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   903
                    QString tempname1 = QString::fromUtf16(name.Ptr(),name.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   904
                                                   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   905
                   logFile.open(QIODevice::Append);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   906
                   logFile.write(tempname1.toAscii());        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   907
                   logFile.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   908
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   909
                   Log("ZeroConfSharingUi::OnPnPEventL - Print target\n\t");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   910
                   QString tempname2 = QString::fromUtf16(target.Ptr(),target.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   911
                                                                      
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   912
                  logFile.open(QIODevice::Append);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   913
                  logFile.write(tempname2.toAscii());        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   914
                  logFile.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   915
                    TChar ch = '.';
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   916
                    TInt pos = target.Locate(ch);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   917
                    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   918
                    RBuf targetName;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   919
                    targetName.CreateL(target.Mid(0,pos));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   920
                    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   921
                    if(iContactName.Length()!=0)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   922
                        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   923
                        iContactName.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   924
                        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   925
                    iContactName.Create(targetName.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   926
                    iContactName.Copy(targetName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   927
                
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   928
                    for(TInt i=0;i<iEntries.Count();i++)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   929
                        {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   930
                        if(iEntries[i]->ContactName().Compare(iContactName)==0)                                                     
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   931
                                {   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   932
                                Log("ZeroConfSharingUi::OnPnPEventL - Contact Exists\n\t");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   933
                                
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   934
                                QString tempname = QString::fromUtf8((const char*)iContactName.Ptr(),iContactName.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   935
                                
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   936
                                logFile.open(QIODevice::Append);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   937
                                logFile.write(tempname.toUtf8());        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   938
                                logFile.close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   939
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   940
                                isPresent = ETrue;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   941
                                break;                                              
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   942
                                }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   943
                         }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   944
                        if(!isPresent)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   945
                            {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   946
                            Log("ZeroConfSharingUi::OnPnPEventL - New Contact Added\n");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   947
                            contactInfo = Create_Icon_Contact();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   948
                            }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   949
                        /*
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   950
                        if(aServiceEventInfo.CountParameterFamilies() <= 1)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   951
                             {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   952
                             GetSrvInfo(iSrvName,EDnsQType_Any);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   953
                             }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   954
                        */
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   955
                        name.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   956
                        target.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   957
                        targetName.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   958
                            
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   959
                        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   960
                    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   961
                    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   962
                     }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   963
                break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   964
                
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   965
            case EMdnsTxtParamset:
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   966
                {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   967
                TUint count = pnpFamily.CountParameterSets ( RParameterFamily::ERequested ) ;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   968
                for (TInt index= 0; index < count ; index++ )
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   969
                     {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   970
                     CMDnsTxtParamSet* txtParamSet = static_cast<CMDnsTxtParamSet*>(pnpFamily.GetParameterSetAtIndex( index, RParameterFamily::ERequested ));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   971
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   972
                     RArray <RBuf8> txtData ;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   973
                     txtParamSet->TxtDataL(txtData);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   974
                      
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   975
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   976
                     if(contactInfo != NULL)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   977
                         {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   978
                         FetchBaseUrl(txtData);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   979
                         FetchIconUrl(txtData);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   980
                         FetchFileUrl(txtData);                      
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   981
                     
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   982
					 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   983
                         contactInfo->SetBaseUrl(iBaseUrl);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   984
                         FetchCurrentlyPlaying(txtData);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   985
                         FetchStatus(txtData);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   986
                         //See if we have got the Currently Played song
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   987
                         if(iCurrentlyPlaying.Length()!=0)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   988
                             {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   989
                         contactInfo->SetCurrentlyPlaying(iCurrentlyPlaying);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   990
                           
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   991
                                 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   992
                             }           
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   993
                         else if (iStatus.Length()!=0)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   994
                             {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   995
                         contactInfo->SetStatus(iStatus);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   996
                             
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   997
                             }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   998
                         iEntries.Append(Clone(contactInfo));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
   999
                       }  
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1000
                     else
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1001
                         {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1002
                         FetchCurrentlyPlaying(txtData);     
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1003
                         FetchStatus(txtData);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1004
                         CContactInfo** contact = NULL;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1005
                         
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1006
                         for(TInt i=0;i<iEntries.Count();i++)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1007
                             {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1008
                             if(iEntries[i]->ContactName().Compare(iContactName)==0)                                                     
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1009
                                     { 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1010
                                         if(iCurrentlyPlaying.Length()!=0)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1011
                                             iEntries[i]->SetCurrentlyPlaying(iCurrentlyPlaying);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1012
                                         else if(iStatus.Length()!=0)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1013
                                             iEntries[i]->SetStatus(iStatus);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1014
                                         
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1015
                                         TPtrC ptrName(reinterpret_cast<const TText*>(iSelectedContact.constData()));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1016
                                         RBuf8 tempcontact;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1017
                                         tempcontact.Create(ptrName.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1018
                                         tempcontact.Copy(ptrName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1019
                                         if(iEntries[i]->ContactName().Compare(tempcontact)== 0)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1020
                                             {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1021
                                                 ShowCur_Status_and_Track();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1022
                                             }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1023
                                         tempcontact.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1024
                                     }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1025
                             }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1026
                       
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1027
                        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1028
                     
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1029
                     }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1030
                }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1031
                break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1032
                
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1033
            case EMdnsPublishResponseParamset:
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1034
                {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1035
                TUint count = pnpFamily.CountParameterSets ( RParameterFamily::ERequested ) ;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1036
                for (TInt index= 0; index < count ; index++ )
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1037
                     {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1038
                    CMDnsPublishResponseParamSet* publishRespParam = static_cast<CMDnsPublishResponseParamSet*>(pnpFamily.GetParameterSetAtIndex( index, RParameterFamily::ERequested ));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1039
                    RBuf name;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1040
                    name.CreateL(255);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1041
                    name.Copy(publishRespParam->DomainName());             
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1042
                    _LIT(KCRLF, "\r\n A service was published with the name: \n");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1043
                    RBuf str;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1044
                    str.CreateL(255);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1045
                    str.Copy(KCRLF);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1046
                    name.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1047
                    str.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1048
                     }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1049
                }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1050
                break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1051
            }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1052
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1053
    ptrInfo.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1054
    Log("ZeroConfSharingUi::OnPnPEventL - Exit\n");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1055
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1056
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1057
void QZeroConfSharingUi::OnPnPError (TInt /*aError*/)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1058
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1059
        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1060
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1061
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1062
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1063
void QZeroConfSharingUi::FetchBaseUrl(RArray <RBuf8> aTxtData)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1064
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1065
    iBaseUrl.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1066
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1067
    _LIT8(KBaseUrl,"BaseUrl");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1068
    TChar ch = '=';
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1069
    RBuf8 key;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1070
    for(TInt index=0;index<aTxtData.Count();index++)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1071
        {       
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1072
        TInt position = aTxtData[index].Locate(ch);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1073
        if(position!= KErrNotFound)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1074
            {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1075
        key.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1076
        key.CreateL(aTxtData[index].Mid(0,(position-1)));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1077
        if(key.Compare(KBaseUrl)==0)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1078
            {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1079
            iBaseUrl.CreateL(aTxtData[index].Mid((position+2)));           
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1080
            break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1081
            }        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1082
            }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1083
        }   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1084
    key.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1085
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1086
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1087
void QZeroConfSharingUi::FetchIconUrl(RArray <RBuf8> aTxtData)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1088
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1089
    iIconName.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1090
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1091
    _LIT8(KIconUrl,"IconUrl");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1092
    TChar ch = '=';
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1093
    RBuf8 key;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1094
    for(TInt index=0;index<aTxtData.Count();index++)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1095
        {        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1096
        TInt position = aTxtData[index].Locate(ch);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1097
        if(position!= KErrNotFound)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1098
            {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1099
        key.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1100
        key.CreateL(aTxtData[index].Mid(0,(position-1)));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1101
        if(key.Compare(KIconUrl)==0)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1102
            {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1103
            iIconName.CreateL(aTxtData[index].Mid((position+2)));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1104
            break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1105
            }    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1106
            }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1107
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1108
    key.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1109
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1110
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1111
void QZeroConfSharingUi::FetchFileUrl(RArray <RBuf8> aTxtData)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1112
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1113
    iFileName.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1114
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1115
    _LIT8(KFileUrl,"FileUrl");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1116
    TChar ch = '=';
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1117
    RBuf8 key;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1118
    for(TInt index=0;index<aTxtData.Count();index++)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1119
        {        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1120
        TInt position = aTxtData[index].Locate(ch);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1121
        if(position!= KErrNotFound)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1122
            {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1123
        key.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1124
        key.CreateL(aTxtData[index].Mid(0,(position-1)));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1125
        if(key.Compare(KFileUrl)==0)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1126
            {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1127
            iFileName.CreateL(aTxtData[index].Mid((position+2)));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1128
            break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1129
            }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1130
            }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1131
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1132
    key.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1133
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1134
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1135
void QZeroConfSharingUi::FetchCurrentlyPlaying(RArray <RBuf8> aTxtData)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1136
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1137
    iCurrentlyPlaying.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1138
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1139
    _LIT8(KNowPlaying,"Now playing");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1140
    TChar ch = '=';
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1141
    RBuf8 key;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1142
    TInt cnt = aTxtData.Count();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1143
    for(TInt index=0;index<aTxtData.Count();index++)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1144
        {        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1145
        TInt position = aTxtData[index].Locate(ch);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1146
        if(position!= KErrNotFound)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1147
            {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1148
        key.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1149
        key.CreateL(aTxtData[index].Mid(0,(position-1)));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1150
        if(key.Compare(KNowPlaying)==0)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1151
            {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1152
            iCurrentlyPlaying.CreateL(aTxtData[index].Mid((position+2)));            
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1153
            break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1154
            }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1155
            }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1156
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1157
    key.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1158
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1159
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1160
void QZeroConfSharingUi::FetchStatus(RArray <RBuf8> aTxtData)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1161
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1162
    iStatus.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1163
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1164
    _LIT8(KStatus,"Status");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1165
    TChar ch = '=';
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1166
    RBuf8 key;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1167
    for(TInt index=0;index<aTxtData.Count();index++)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1168
        {        
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1169
        TInt position = aTxtData[index].Locate(ch);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1170
        if(position!= KErrNotFound)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1171
            {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1172
        key.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1173
        key.CreateL(aTxtData[index].Mid(0,(position-1)));
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1174
        if(key.Compare(KStatus)==0)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1175
            {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1176
            iStatus.CreateL(aTxtData[index].Mid((position+2)));            
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1177
            break;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1178
            }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1179
            }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1180
        }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1181
    key.Close();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1182
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1183
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1184
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1185
CContactInfo* QZeroConfSharingUi::Clone(CContactInfo* aContact)
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1186
    {
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1187
    //Clone the entry and insert in Hash
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1188
    CContactInfo* contact  = CContactInfo::NewL();    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1189
    contact->SetBaseUrl(aContact->BaseUrl());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1190
    contact->StoreContactDirectory(aContact->ContactDirectory());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1191
    contact->SetContactName(aContact->ContactName());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1192
    contact->SetCurrentlyPlaying(aContact->CurrentlyPlaying());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1193
    contact->SetStatus(aContact->Status());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1194
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1195
    return contact;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1196
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1197
    //iContactEntries.Insert(contact->ContactName(),contact);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1198
    }
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1199
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1200
CContactInfo* QZeroConfSharingUi::Create_Icon_Contact()
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1201
{
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1202
    CContactInfo* contact = NULL;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1203
    QString qtName = QString::fromUtf8((const char*)iContactName.Ptr(),iContactName.Length());
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1204
    QString path(":/Icons/user");
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1205
    QListWidgetItem* item = new QListWidgetItem(QIcon(":/Images/Unknown"),qtName );
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1206
    ui.listAvatars->addItem(item);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1207
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1208
    PopulateMainWindow(qtName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1209
    
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1210
   //Create a new contact
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1211
   contact = CContactInfo::NewL();
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1212
   contact->SetContactName(iContactName);
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1213
   //Creates the contact specific directory
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1214
   contact->SetContactDirectory();  
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1215
   
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1216
   return contact;
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1217
 
ff5174af067c ZeroConf Sharing Application
guru.kini@nokia.com
parents:
diff changeset
  1218
}