src/hbplugins/inputmethods/touchinput/hbinputthaispecialpopup.cpp
changeset 5 627c4a0fd0e7
parent 3 11d3954df52a
child 6 c3690ec91ef8
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (developer.feedback@nokia.com)
       
     6 **
       
     7 ** This file is part of the HbPlugins module of the UI Extensions for Mobile.
       
     8 **
       
     9 ** GNU Lesser General Public License Usage
       
    10 ** This file may be used under the terms of the GNU Lesser General Public
       
    11 ** License version 2.1 as published by the Free Software Foundation and
       
    12 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
       
    13 ** Please review the following information to ensure the GNU Lesser General
       
    14 ** Public License version 2.1 requirements will be met:
       
    15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    16 **
       
    17 ** In addition, as a special exception, Nokia gives you certain additional
       
    18 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    20 **
       
    21 ** If you have questions regarding the use of this file, please contact
       
    22 ** Nokia at developer.feedback@nokia.com.
       
    23 **
       
    24 ****************************************************************************/
       
    25 
       
    26 #include <QGraphicsGridLayout>
       
    27 #include <QGraphicsWidget>
       
    28 #include <QString>
       
    29 #include <QSignalMapper>
       
    30 
       
    31 #include <HbMainWindow>
       
    32 #include <hbgridview.h>
       
    33 #include <hbwidget.h>
       
    34 #include <hbdialog_p.h>
       
    35 #include <HbPopup>
       
    36 
       
    37 #include "hbinputtouchkeypadbutton.h"
       
    38 #include "hbinputthaispecialpopup.h"
       
    39 
       
    40 const QString HbAbcButtonObjName = "Popup abc";
       
    41 
       
    42 const int HbPopupAsteriskColumns = 5;
       
    43 const int HbPopupAsteriskRows = 4;
       
    44 const int HbPopupShiftColumns = 4;
       
    45 const int HbPopupShiftRows = 3;
       
    46 
       
    47 
       
    48 const int HBPopupEmptyButtonSeven = 7;
       
    49 const int HBPopupEmptyButtonEight = 8;
       
    50 const int HBPopupEmptyButtonNine = 9;
       
    51 
       
    52 const QString HbPopupPortraitButtonTextLayout = "_hb_sctp_button_text_layout";
       
    53 const QString HbPopupPortraitButtonIconLayout = "_hb_sctp_button_icon_layout";
       
    54 
       
    55 /*!
       
    56 @proto
       
    57 @hbtouchinput
       
    58 \class HbInputThaiSpecialPopup
       
    59 \brief Implementation of Thai Special Popup.
       
    60 
       
    61 Implementation of Thai Special Popup.
       
    62 
       
    63 */
       
    64 
       
    65 /// @cond
       
    66 
       
    67 class HbInputThaiSpecialPopupPrivate: public HbDialogPrivate
       
    68 {
       
    69     Q_DECLARE_PUBLIC(HbInputThaiSpecialPopup)
       
    70 
       
    71 public:
       
    72 	//Character classes
       
    73 	enum ThaiGlyphTypes {
       
    74                 HbThaiCharNon = 0,	//Not a Thai letter
       
    75 		HbThaiCharCons,		//Thai consonant
       
    76 		HbThaiCharLV,		//Leading vowel
       
    77 		HbThaiCharFV1,		//Following vowel, type 1
       
    78 		HbThaiCharFV2,		//Following vowel, type 2
       
    79 		HbThaiCharFV3,		//Following vowel, type 3
       
    80 		HbThaiCharBV1,		//Below vowel, type 1
       
    81 		HbThaiCharBV2,		//Below vowel, type 2
       
    82 		HbThaiCharBD,		//Below diacritic
       
    83 		HbThaiCharTone,		//Tone mark
       
    84 		HbThaiCharAD1,		//Above diacritic, type 1
       
    85 		HbThaiCharAD2,		//Above diacritic, type 2
       
    86 		HbThaiCharAD3,		//Above diacritic, type 3
       
    87 		HbThaiCharAV1,		//Above vowel, type 1
       
    88 		HbThaiCharAV2,		//Above vowel, type 2
       
    89 		HbThaiCharAV3,		//Above vowel, type 3
       
    90 		HbThaiCharNonThai	//Not a Thai letter
       
    91 	};
       
    92 	QGraphicsGridLayout* mButtonLayout; 
       
    93 	QGraphicsWidget* mButtonWidget;
       
    94 	QList<HbTouchKeypadButton *> mPopupButtons;
       
    95         QSignalMapper *mActionMapper;
       
    96 	QSignalMapper *mClickMapper;
       
    97 	QString mSpecialCharacterSet;
       
    98 	const HbKeymap *mKeymap;
       
    99 	QSizeF mSize;
       
   100 	int mButtonId;
       
   101 	int mPopupGridColumns;
       
   102 	int mPopupGridRows;
       
   103 	int mNumPopupButtons;
       
   104 	int mAbcButtonId;
       
   105 	uint mPrevChar;
       
   106 
       
   107 
       
   108 public:
       
   109 	HbInputThaiSpecialPopupPrivate();
       
   110 	~HbInputThaiSpecialPopupPrivate();
       
   111 	void setNumberOfKeys();
       
   112 	void createPopupButtons(int screenWidth, int screenHeight);
       
   113 	void setLayoutDimensions(QSizeF dimensions);
       
   114 	void getSpecialCharacters();
       
   115 	void setPopupButtons(const QString &aCharSet);
       
   116 	void applyEditorConstraints();
       
   117 	int thaiGlyphType(uint prevChar);	
       
   118 	void initializeAbcButton();	
       
   119 	void handleStandardButtonClick(int buttonId);
       
   120 	void _q_mappedKeyClick(int buttonid);	
       
   121 };
       
   122 
       
   123 HbInputThaiSpecialPopupPrivate::HbInputThaiSpecialPopupPrivate()
       
   124 {
       
   125     // we should make sure that it comes above vkb
       
   126     setPriority(HbPopupPrivate::VirtualKeyboard + 1);
       
   127 	mClickMapper = 0;
       
   128 	mSize = QSizeF();
       
   129 }
       
   130 
       
   131 HbInputThaiSpecialPopupPrivate::~HbInputThaiSpecialPopupPrivate()
       
   132 {
       
   133 }
       
   134 
       
   135 /*!
       
   136 Sets number of keys to layout
       
   137 */
       
   138 void HbInputThaiSpecialPopupPrivate::setNumberOfKeys()
       
   139 {
       
   140 	//Manipulate number of keys on the layout depending on the Key_Asterisk and Qt::Key_Shift
       
   141 	if(Qt::Key_Asterisk == mButtonId) {
       
   142 		mPopupGridColumns = HbPopupAsteriskColumns;
       
   143 		mPopupGridRows = HbPopupAsteriskRows;
       
   144 	}else if (Qt::Key_Shift == mButtonId) {
       
   145 		mPopupGridColumns = HbPopupShiftColumns;
       
   146 		mPopupGridRows = HbPopupShiftRows;
       
   147 	}
       
   148 	mNumPopupButtons = mPopupGridColumns * mPopupGridRows;
       
   149 	mAbcButtonId = mPopupGridColumns*mPopupGridRows-1;
       
   150 }
       
   151 
       
   152 
       
   153 /*!
       
   154 Create Popup Buttons
       
   155 */
       
   156 void HbInputThaiSpecialPopupPrivate::createPopupButtons(int screenWidth, int screenHeight)
       
   157 {
       
   158 	Q_Q(HbInputThaiSpecialPopup);
       
   159 	Q_UNUSED(q)
       
   160 	if (mPopupButtons.size() == 0) {
       
   161         for (int i = 0; i < mNumPopupButtons; ++i) {
       
   162 			HbTouchKeypadButton *button = new HbTouchKeypadButton(0,QString(""),0);
       
   163             q->connect(button, SIGNAL(clicked()), mClickMapper, SLOT(map()));
       
   164             mClickMapper->setMapping(button, i);
       
   165             mPopupButtons.append(button);
       
   166             button->setProperty(HbStyleRulesCacheId::hbStyleRulesForNodeCache, HbPopupPortraitButtonTextLayout);
       
   167         }
       
   168 
       
   169         for (int i = 0; i < mNumPopupButtons; ++i) {
       
   170 			if(Qt::Key_Asterisk == mButtonId) {
       
   171 				//This check is for logical separation between Above below vowels , Diacritics and Tone marks 
       
   172 				//In Thai Language we have 7 Above and Below Vowels, 5 Diacritics and 4 Tone marks
       
   173 				if(!(i == HBPopupEmptyButtonSeven || i== HBPopupEmptyButtonEight || i == HBPopupEmptyButtonNine)) {		
       
   174 					mButtonLayout->addItem(mPopupButtons.at(i), i/mPopupGridColumns, i%mPopupGridColumns);
       
   175 				}
       
   176 			} else if (Qt::Key_Shift == mButtonId) {
       
   177 				mButtonLayout->addItem(mPopupButtons.at(i), i/mPopupGridColumns, i%mPopupGridColumns);
       
   178 			}
       
   179         }
       
   180     }
       
   181 	//Set the Layout Dimensions
       
   182 	setLayoutDimensions(QSizeF(screenWidth/mPopupGridColumns, screenHeight/mPopupGridRows));
       
   183 	//Assign button layout to widget
       
   184 	mButtonWidget->setLayout(mButtonLayout);	
       
   185 }
       
   186 
       
   187 /*!
       
   188 This function defines the layout porperties for popup.
       
   189 */
       
   190 void HbInputThaiSpecialPopupPrivate::setLayoutDimensions(QSizeF dimensions)
       
   191 {
       
   192     // only update the dimensions if they are not previously set
       
   193     if (mSize == dimensions) {
       
   194         return;
       
   195     }
       
   196     mSize = dimensions;
       
   197 
       
   198     mButtonLayout->setContentsMargins(0.0, 0.0, 0.0, 0.0);
       
   199 
       
   200     for (int i = 0; i < mPopupGridColumns; i++) {
       
   201         mButtonLayout->setColumnFixedWidth(i, dimensions.width());
       
   202     }
       
   203     for (int i = 0; i < mPopupGridRows; i++) {
       
   204         mButtonLayout->setRowFixedHeight(i, dimensions.height());
       
   205     }
       
   206 
       
   207     mButtonLayout->setHorizontalSpacing(0.0);
       
   208     mButtonLayout->setVerticalSpacing(0.0);
       
   209 	foreach (HbTouchKeypadButton* button, mPopupButtons) {
       
   210         if (button) {
       
   211             button->setInitialSize(dimensions);
       
   212         }
       
   213     }
       
   214 }
       
   215 
       
   216 
       
   217 /*!
       
   218 Gets the special character sets from set keymapping.
       
   219 */
       
   220 void HbInputThaiSpecialPopupPrivate::getSpecialCharacters()
       
   221 {
       
   222     mSpecialCharacterSet.clear();
       
   223     if (mKeymap) {
       
   224 		const HbKeyboardMap* keyboardMap = 0;
       
   225 		//Set keyboard map depending on Key_Asterisk and Key_Shift
       
   226 		if(Qt::Key_Asterisk == mButtonId) {
       
   227 			keyboardMap = mKeymap->keyboard(HbKeyboardThaiStarSctPortrait);
       
   228 		} else if(Qt::Key_Shift == mButtonId) {
       
   229 			keyboardMap = mKeymap->keyboard(HbKeyboardThaiHashSctPortrait);
       
   230 		}
       
   231         if (keyboardMap) {
       
   232             foreach (const HbMappedKey* mappedKey, keyboardMap->keys) {
       
   233 				//Creats character set through keyboard map
       
   234                 mSpecialCharacterSet.append(mappedKey->characters(HbModifierNone));
       
   235             }
       
   236         }
       
   237     }
       
   238 }
       
   239 
       
   240 /*!
       
   241 Let's set Thai Special Character to Buttons
       
   242 */
       
   243 void HbInputThaiSpecialPopupPrivate::setPopupButtons(const QString &aCharSet)
       
   244 {
       
   245     int i = 0;
       
   246     int j = 0;
       
   247 	for (; i < mPopupButtons.size()-1 && j < aCharSet.size(); ++i) {
       
   248 		if(Qt::Key_Asterisk == mButtonId) {
       
   249 			//This check is for logical separation between Above below Vowels , Diacritics and Tone marks 
       
   250 			//In Thai Language we have 7 Above and Below Vowels, 5 Diacritics and 4 Tone marks
       
   251 			if(!(i == HBPopupEmptyButtonSeven || i== HBPopupEmptyButtonEight || i == HBPopupEmptyButtonNine)) {
       
   252 				const QChar &character = aCharSet[j];
       
   253 				mPopupButtons.at(i)->setText(character);
       
   254 				mPopupButtons.at(i)->setObjectName("Thai Sct portrait " + QString(character));
       
   255 				j++;
       
   256 			}
       
   257 		} else if (Qt::Key_Shift == mButtonId) {
       
   258 			const QChar &character = aCharSet[j];
       
   259 			mPopupButtons.at(i)->setText(character);
       
   260 			mPopupButtons.at(i)->setObjectName("Thai Sct portrait " + QString(character));
       
   261 			j++;
       
   262 		}
       
   263 	}
       
   264 
       
   265     for (; i < mPopupButtons.size()-1; ++i) {       
       
   266             mPopupButtons.at(i)->setText("");       
       
   267     }
       
   268     applyEditorConstraints();
       
   269 	initializeAbcButton();
       
   270 }
       
   271 
       
   272 /*!
       
   273 Apply editor constraints on buttons
       
   274 */
       
   275 void HbInputThaiSpecialPopupPrivate::applyEditorConstraints()
       
   276 {	
       
   277 	if (Qt::Key_Asterisk == mButtonId) {
       
   278 		//Get Character class
       
   279 		int glyphType = thaiGlyphType(mPrevChar);
       
   280 		//Set the rules to the editor to allow or disallow characters 
       
   281 		switch(glyphType) {
       
   282 		case HbThaiCharNonThai:
       
   283 		case HbThaiCharNon:
       
   284 		case HbThaiCharLV:
       
   285 		case HbThaiCharFV1:
       
   286 		case HbThaiCharFV2:
       
   287 		case HbThaiCharFV3:
       
   288 		case HbThaiCharBD:
       
   289 		case HbThaiCharTone:
       
   290 		case HbThaiCharAD1:
       
   291 		case HbThaiCharAD2:
       
   292 		case HbThaiCharAD3:
       
   293 			for (int i=0; i < mPopupButtons.size()-1; ++i) {					
       
   294 				mPopupButtons.at(i)->setFade(true);     
       
   295 			}
       
   296 			break;
       
   297 		case HbThaiCharCons:
       
   298 			for (int i=0; i < mPopupButtons.size()-1; ++i) {					
       
   299 				mPopupButtons.at(i)->setFade(false);     
       
   300 			}
       
   301 			break;
       
   302 		case HbThaiCharAV1:
       
   303 		case HbThaiCharBV1: {
       
   304 				static const QChar data[6] = { 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d };
       
   305 				QString allowChar(data, 6);
       
   306 
       
   307 				for (int i=0; i < mPopupButtons.size()-1; ++i) { 				
       
   308 					QString buttonText = mPopupButtons.at(i)->text();
       
   309 
       
   310 					if(buttonText.isEmpty()) {
       
   311 						mPopupButtons.at(i)->setFade(true);
       
   312 					} else {
       
   313 						if (allowChar.contains(buttonText)) {
       
   314 							mPopupButtons.at(i)->setFade(false);
       
   315 						} else {
       
   316 							mPopupButtons.at(i)->setFade(true);						
       
   317 						}
       
   318 					}
       
   319 				}
       
   320 			}
       
   321 			break;
       
   322 		case HbThaiCharAV2:
       
   323 		case HbThaiCharBV2: {				
       
   324 				static const QChar data[4] = { 0x0e48, 0x0e49, 0x0e4a, 0x0e4b };
       
   325 				QString allowChar(data, 4);
       
   326 
       
   327 				for (int i=0; i < mPopupButtons.size()-1; ++i) { 				
       
   328 					QString buttonText = mPopupButtons.at(i)->text();
       
   329 
       
   330 					if(buttonText.isEmpty()) {
       
   331 						mPopupButtons.at(i)->setFade(true);
       
   332 					} else {
       
   333 						if (allowChar.contains(buttonText)) {
       
   334 							mPopupButtons.at(i)->setFade(false);
       
   335 						} else {
       
   336 							mPopupButtons.at(i)->setFade(true);						
       
   337 						}
       
   338 					}
       
   339 
       
   340 				}
       
   341 			
       
   342 			}
       
   343 			break;
       
   344 
       
   345 		case HbThaiCharAV3: {				
       
   346 				static const QChar data[5] = { 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e47 };
       
   347 				QString allowChar(data, 5);
       
   348 
       
   349 				for (int i=0; i < mPopupButtons.size()-1; ++i) { 				
       
   350 					QString buttonText = mPopupButtons.at(i)->text();
       
   351 
       
   352 					if(buttonText.isEmpty()) {
       
   353 						mPopupButtons.at(i)->setFade(true);
       
   354 					} else {
       
   355 						if (allowChar.contains(buttonText)) {
       
   356 							mPopupButtons.at(i)->setFade(false);
       
   357 						} else {
       
   358 							mPopupButtons.at(i)->setFade(true);						
       
   359 						}
       
   360 					}
       
   361 				}
       
   362 			
       
   363 			}
       
   364 			break;
       
   365 		default:
       
   366 			break;
       
   367 
       
   368 		}
       
   369 	}
       
   370 
       
   371 }
       
   372 /*!
       
   373 Returns Character classes depending on the previous entered character
       
   374 */
       
   375 int HbInputThaiSpecialPopupPrivate::thaiGlyphType(uint prevChar)
       
   376 {
       
   377 	if (prevChar >= 0x0E01 && prevChar <= 0x0E2E && prevChar != 0x0E24 && prevChar != 0x0E26 ) {
       
   378 		return(HbThaiCharCons);
       
   379 	} else if (prevChar >= 0x0E40 && prevChar <= 0x0E44) {
       
   380 		return(HbThaiCharLV);
       
   381 	} else if (prevChar == 0x0E30 || prevChar == 0x0E32 || prevChar == 0x0E33) {
       
   382 		return(HbThaiCharFV1);
       
   383 	} else if (prevChar == 0x0E45) {
       
   384 		return(HbThaiCharFV2);
       
   385 	} else if (prevChar == 0x0E24 || prevChar == 0x0E26) {
       
   386 		return(HbThaiCharFV3);
       
   387 	} else if (prevChar == 0x0E38) {
       
   388 		return(HbThaiCharBV1);
       
   389 	} else if (prevChar == 0x0E39) {
       
   390 		return(HbThaiCharBV2);
       
   391 	} else if (prevChar == 0x0E3A) {
       
   392 		return(HbThaiCharBD);
       
   393 	} else if (prevChar >= 0x0E48 && prevChar <= 0x0E4B) {
       
   394 		return(HbThaiCharTone);
       
   395 	} else if (prevChar == 0x0E4C || prevChar == 0x0E4D) {
       
   396 		return(HbThaiCharAD1);
       
   397 	} else if (prevChar == 0x0E47) {
       
   398 		return(HbThaiCharAD2);
       
   399 	} else if (prevChar == 0x0E4E) {
       
   400 		return(HbThaiCharAD3);
       
   401 	} else if (prevChar == 0x0E34) {
       
   402 		return(HbThaiCharAV1);
       
   403 	} else if (prevChar == 0x0E31 || prevChar == 0x0E36) {
       
   404 		return(HbThaiCharAV2);
       
   405 	} else if (prevChar == 0x0E35 || prevChar == 0x0E37) {
       
   406 		return(HbThaiCharAV3);
       
   407 	} else {
       
   408 		return(HbThaiCharNonThai);
       
   409 	}
       
   410 }
       
   411 
       
   412 /*!
       
   413 Initialize ABC button
       
   414 */
       
   415 void HbInputThaiSpecialPopupPrivate::initializeAbcButton()
       
   416 {
       
   417 	mPopupButtons.at(mAbcButtonId)->setIcon(HbIcon("qtg_mono_alpha_mode"));
       
   418     mPopupButtons.at(mAbcButtonId)->setObjectName(HbAbcButtonObjName); 
       
   419     mPopupButtons.at(mAbcButtonId)->setObjectName(HbAbcButtonObjName); 
       
   420     mPopupButtons.at(mAbcButtonId)->setProperty(HbStyleRulesCacheId::hbStyleRulesForNodeCache, HbPopupPortraitButtonIconLayout);
       
   421 	mPopupButtons.at(mAbcButtonId)->setButtonType(HbTouchKeypadButton::HbTouchButtonFunction);
       
   422     mPopupButtons.at(mAbcButtonId)->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased);    
       
   423 }
       
   424 
       
   425 
       
   426 /*!
       
   427 Handles button clicks.
       
   428 */
       
   429 void HbInputThaiSpecialPopupPrivate::handleStandardButtonClick(int buttonId)
       
   430 {
       
   431    Q_Q(HbInputThaiSpecialPopup);
       
   432 
       
   433    if (buttonId >= 0 && buttonId < mNumPopupButtons-1 ) {
       
   434 	   QString buttonText = mPopupButtons.at(buttonId)->text();
       
   435 		//Emit the signal when button is not faded and it has some text
       
   436 	   if (!mPopupButtons.at(buttonId)->isFaded() && buttonText.length() > 0) {
       
   437 		   emit q->chrSelected(buttonText.at(0));
       
   438 	   }
       
   439    }
       
   440    //It will hide popup for any click event
       
   441    q->hide();
       
   442 
       
   443 }
       
   444 
       
   445 /*!
       
   446 Handles virtual key clicks
       
   447 */
       
   448 void HbInputThaiSpecialPopupPrivate::_q_mappedKeyClick(int buttonid)
       
   449 {
       
   450     handleStandardButtonClick(buttonid);
       
   451 }
       
   452 
       
   453 /// @endcond
       
   454 
       
   455 
       
   456 /*!
       
   457 Constructs the object. 
       
   458 */
       
   459 
       
   460 HbInputThaiSpecialPopup::HbInputThaiSpecialPopup(int buttonId, uint prevChar, QGraphicsItem* parent)
       
   461     : HbDialog(*new HbInputThaiSpecialPopupPrivate(), parent)
       
   462 {
       
   463     Q_D(HbInputThaiSpecialPopup);
       
   464 	//Initialize member variable
       
   465 	d->mPrevChar = prevChar;
       
   466 	d->mButtonId = buttonId;
       
   467 #if QT_VERSION >= 0x040600
       
   468     // Make sure the Thai special popup never steals focus.
       
   469     setFlag(QGraphicsItem::ItemIsPanel, true);
       
   470     setActive(false);
       
   471 #endif
       
   472 	// set dialog properties
       
   473     setFocusPolicy(Qt::ClickFocus);
       
   474     setBackgroundFaded(false);
       
   475 	setDismissPolicy(TapAnywhere);
       
   476     setTimeout(NoTimeout);
       
   477 	
       
   478 	d->mButtonLayout = new QGraphicsGridLayout();
       
   479     d->mButtonLayout->setSpacing(0.0);
       
   480     d->mButtonLayout->setContentsMargins(0.0, 0.0, 0.0, 0.0);
       
   481 	
       
   482 	d->mButtonWidget =  new QGraphicsWidget();
       
   483 	//Create Signal mapper
       
   484 	d->mClickMapper = new QSignalMapper(this);
       
   485 
       
   486 	// let's connect buttons to handle click events  
       
   487     connect(d->mClickMapper, SIGNAL(mapped(int)), this, SLOT(_q_mappedKeyClick(int)));
       
   488 }
       
   489 
       
   490 /*!
       
   491 Destructs the object.
       
   492 */
       
   493 HbInputThaiSpecialPopup::~HbInputThaiSpecialPopup()
       
   494 {
       
   495 }
       
   496 
       
   497 /*!
       
   498 This function should be called when ever there is a Key_Asterisk and Key_Shift click happens.
       
   499 This create buttons, Set the layout dimensions and gets the special characters from the given keymappings and set it accordingly.
       
   500 */
       
   501 void HbInputThaiSpecialPopup::setPopupLayout(const HbKeymap* keymap, uint prevChar, int buttonId, int screenWidth, int screenHeight)
       
   502 {
       
   503     Q_D(HbInputThaiSpecialPopup);
       
   504 	if(d->mButtonId != buttonId) {
       
   505 		d->mButtonId = buttonId;
       
   506 		while (!d->mPopupButtons.isEmpty())
       
   507 			delete d->mPopupButtons.takeFirst();
       
   508 	}
       
   509 	d->mKeymap = keymap;
       
   510 	d->mPrevChar = prevChar;	
       
   511 	//Initialize Number of keys dependent on Key_Asterisk and Key_Shift
       
   512 	d->setNumberOfKeys();
       
   513 	//Create buttons.
       
   514 	d->createPopupButtons(screenWidth,screenHeight);
       
   515 	//Gets the special character sets from set keymapping.
       
   516     d->getSpecialCharacters();
       
   517 	//Let's set Special Character Table Buttons
       
   518 	d->setPopupButtons(d->mSpecialCharacterSet);
       
   519 	setContentWidget(d->mButtonWidget);
       
   520 }
       
   521 
       
   522 /*!
       
   523 This a virtual functions in QGraphicsWidget. It is called whenever the Thai popup is shown. 
       
   524 
       
   525 */
       
   526 void HbInputThaiSpecialPopup::showEvent( QShowEvent * event )
       
   527 {
       
   528 	HbDialog::showEvent(event);  
       
   529 }
       
   530 
       
   531 #include "moc_hbinputthaispecialpopup.cpp"
       
   532 
       
   533 //End of file
       
   534