/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
#include "lunchwidget.h"
#include <hbapplication>
#include <QStringList>
#define hbApp qobject_cast<HbApplication*>(qApp)
lunchwidget::lunchwidget(QGraphicsItem *parent)
: HbWidget(parent)
{
mResultLabel = new HbLabel;
mResultLabel2 = new HbLabel;
mCountLabel = new HbLabel;
QStringList list = hbApp->arguments();
int count = list.count();
if ( count <= 1 ) {
mResultLabel->setPlainText("arg1: None");
mResultLabel2->setPlainText("arg2: None");
}
else if( count == 2 ) {
QString arg = list.at(1);
mResultLabel->setPlainText( tr("arg1: ") + arg );
mResultLabel2->setPlainText( "arg2: None" );
}
else {
QString arg1 = list.at(1);
mResultLabel->setPlainText( tr("arg1: ") + arg1 );
QString arg2 = list.at(2);
mResultLabel2->setPlainText( tr("arg2: ") + arg2 );
}
QString countstring;
countstring.setNum(count);
countstring = tr("arg count: ") + countstring;
mCountLabel->setPlainText(countstring);
mGridLayout = new QGraphicsGridLayout();
mGridLayout->addItem(mResultLabel, 0, 0, 1, 1);
mGridLayout->addItem(mResultLabel2, 1, 0, 1, 1);
mGridLayout->addItem(mCountLabel, 2, 0, 1, 1);
setLayout(mGridLayout);
}
lunchwidget::~lunchwidget()
{
}
void lunchwidget::lunch()
{
}