securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp
changeset 38 e0432375ea67
parent 37 7bad16cccaca
child 45 5d3e34b7618a
equal deleted inserted replaced
37:7bad16cccaca 38:e0432375ea67
    14 *
    14 *
    15 * Description: SecUi notification content widget.
    15 * Description: SecUi notification content widget.
    16 *
    16 *
    17 */
    17 */
    18 
    18 
       
    19 #include "secuinotificationdebug.h"
    19 #include "secuinotificationcontentwidget.h"
    20 #include "secuinotificationcontentwidget.h"
    20 #include "secuinotificationdialogpluginkeys.h"
    21 #include "secuinotificationdialogpluginkeys.h"
    21 #include <QGraphicsLinearLayout>
    22 #include <QGraphicsLinearLayout>
    22 #include <QToolButton>
    23 #include <QToolButton>
    23 #include <hblabel.h>
    24 #include <hblabel.h>
    62 // ----------------------------------------------------------------------------
    63 // ----------------------------------------------------------------------------
    63 //
    64 //
    64 SecUiNotificationContentWidget::SecUiNotificationContentWidget(
    65 SecUiNotificationContentWidget::SecUiNotificationContentWidget(
    65         QGraphicsItem *parent, Qt::WindowFlags flags) : HbWidget(parent, flags)
    66         QGraphicsItem *parent, Qt::WindowFlags flags) : HbWidget(parent, flags)
    66 {
    67 {
    67 		qDebug() << "SecUiNotificationContentWidget::SecUiNotificationContentWidget";
    68 		RDEBUG("0", 0);
    68 }
    69 }
    69 
    70 
    70 // ----------------------------------------------------------------------------
    71 // ----------------------------------------------------------------------------
    71 // SecUiNotificationContentWidget::~SecUiNotificationContentWidget()
    72 // SecUiNotificationContentWidget::~SecUiNotificationContentWidget()
    72 // ----------------------------------------------------------------------------
    73 // ----------------------------------------------------------------------------
    79 // SecUiNotificationContentWidget::constructFromParameters()
    80 // SecUiNotificationContentWidget::constructFromParameters()
    80 // ----------------------------------------------------------------------------
    81 // ----------------------------------------------------------------------------
    81 //
    82 //
    82 void SecUiNotificationContentWidget::constructFromParameters(const QVariantMap &parameters)
    83 void SecUiNotificationContentWidget::constructFromParameters(const QVariantMap &parameters)
    83 {
    84 {
    84 		qDebug() << "SecUiNotificationContentWidget::constructFromParameters 1";
    85 		RDEBUG("0", 0);
    85 		qDebug() << parameters;
    86 		qDebug() << parameters;
    86     QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
    87     QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
    87 
    88 
    88     lMinLength = 4;	// might be replaced later
    89     lMinLength = 4;	// might be replaced later
    89     lMaxLength = 8;	// might be replaced later
    90     lMaxLength = 8;	// might be replaced later
    91  		isEmergency=0;
    92  		isEmergency=0;
    92        codeTop=0;
    93        codeTop=0;
    93 
    94 
    94     // KApplicationSize
    95     // KApplicationSize
    95     if (parameters.contains(KQueryType)) {
    96     if (parameters.contains(KQueryType)) {
    96 				qDebug() << "SecUiNotificationContentWidget::KQueryType";
    97 				RDEBUG("0", 0);
    97         queryType = parameters.value(KQueryType).toUInt();
    98         queryType = parameters.value(KQueryType).toUInt();
    98 				qDebug() << queryType;
    99 				RDEBUG("queryType", queryType);
    99 				if( (queryType & ESecUiTypeMaskLock) )
   100 				if( (queryType & ESecUiTypeMaskLock) )
   100 					{
   101 					{
   101 					qDebug() << "SecUiNotificationContentWidget::KQueryType=ESecUiTypeLock";
   102 					RDEBUG("KQueryType=ESecUiTypeMaskLock", queryType);
   102 					// showing "Lock" icon. All other params are irrelevant. codeTop is not even created
   103 					// showing "Lock" icon. All other params are irrelevant. codeTop is not even created
   103 
       
   104 					
   104 					
   105         	HbLabel *iconLabel = new HbLabel("Locked");
   105         	HbLabel *iconLabel = new HbLabel("Locked");
   106         	HbIcon *icon = new HbIcon("qtg_large_device_lock");
   106         	HbIcon *icon = new HbIcon("qtg_large_device_lock");
   107         	// iconLabel->setAspectRatioMode(Qt::IgnoreAspectRatio);
   107         	// iconLabel->setAspectRatioMode(Qt::IgnoreAspectRatio);
   108     			// iconLabel->setGeometry(QRectF(QPointF(10,10),QSizeF(300,300)));
   108     			// iconLabel->setGeometry(QRectF(QPointF(10,10),QSizeF(300,300)));
   183         codeTop = new HbLineEdit("");	// no default value
   183         codeTop = new HbLineEdit("");	// no default value
   184         qDebug() << "SecUiNotificationContentWidget::KCodeTop lMaxLength=";
   184         qDebug() << "SecUiNotificationContentWidget::KCodeTop lMaxLength=";
   185         qDebug() << lMaxLength;
   185         qDebug() << lMaxLength;
   186         if(lMaxLength>2)
   186         if(lMaxLength>2)
   187 	        codeTop->setMaxLength(lMaxLength);
   187 	        codeTop->setMaxLength(lMaxLength);
   188         // HbLineEdit *codeTop2 = new HbLineEdit;
       
   189 				qDebug() << "SecUiNotificationContentWidget::KCodeTop 2";
       
   190 				qDebug() << "SecUiNotificationContentWidget::KCodeTop queryType=";
   188 				qDebug() << "SecUiNotificationContentWidget::KCodeTop queryType=";
   191 				qDebug() << queryType;
   189 				qDebug() << queryType;
   192 				codeTop->setInputMethodHints(Qt::ImhDigitsOnly);	// default
   190 				codeTop->setInputMethodHints(Qt::ImhDigitsOnly);	// default
   193  		    if (queryType & ESecUiAlphaSupported)
   191  		    if (queryType & ESecUiAlphaSupported)
   194 		    	{
   192 		    	{
   220   	      QString defaultCode = parameters.value(KDefaultCode).toString();
   218   	      QString defaultCode = parameters.value(KDefaultCode).toString();
   221     	    qDebug() << defaultCode;
   219     	    qDebug() << defaultCode;
   222 					codeTop->setText(defaultCode);
   220 					codeTop->setText(defaultCode);
   223 					}
   221 					}
   224 				qDebug() << "SecUiNotificationContentWidget::KCodeTop 4";
   222 				qDebug() << "SecUiNotificationContentWidget::KCodeTop 4";
       
   223 
       
   224 		    if (parameters.contains(KDialogTitle)) {
       
   225 		        QString titleText = parameters.value(KDialogTitle).toString();
       
   226 		        QString titleAttempts = "";
       
   227 		   			if(titleText.indexOf('|')>0)
       
   228 		    				{	// if separator, take only first part
       
   229 		    				titleText = titleText.left(titleText.indexOf('|'));
       
   230 		    				}
       
   231 		   			if(titleText.indexOf('#')>0)
       
   232 		    				{	// if separator, take only first part
       
   233 		    				titleAttempts = titleText.right(titleText.length()-titleText.indexOf('#')-1);
       
   234 		    				qDebug() << "SecUiNotificationDialog::titleAttempts=" << titleAttempts;
       
   235 		    				int nAttempts = titleAttempts.toInt();
       
   236 		    				RDEBUG("nAttempts", nAttempts);
       
   237 		    				titleText = titleText.left(titleText.indexOf('#'));
       
   238 		    				if(nAttempts>0)
       
   239 		    					titleText = titleText + " attempts=" + QString::number(nAttempts);
       
   240 		    				}
       
   241 		        HbLabel *titleTop = new HbLabel(titleText);
       
   242 		        mainLayout->addItem(titleTop);
       
   243 		        // in the dialog, it was setHeadingWidget(title);
       
   244 		    }
   225 
   245 
   226     		mainLayout->addItem(codeTop);
   246     		mainLayout->addItem(codeTop);
   227     		// double-query
   247     		// double-query
   228     		if (parameters.contains(KCodeBottom))
   248     		if (parameters.contains(KCodeBottom))
   229     			{
   249     			{