userguide/src/HelpStandardItem.cpp
branchRCL_3
changeset 45 cbffe13eac63
parent 44 12f60d9a73b3
child 49 a7ccb69868af
equal deleted inserted replaced
44:12f60d9a73b3 45:cbffe13eac63
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include "HelpUtils.h"
       
    19 #include "HelpCommon.h"
       
    20 #include "HelpStandardItem.h"
       
    21 
       
    22 HelpStandardItem::HelpStandardItem(const QString& text) : QStandardItem(text)
       
    23 {
       
    24 }
       
    25 
       
    26 HelpStandardItem::~HelpStandardItem()
       
    27 {
       
    28 }
       
    29 
       
    30 bool HelpStandardItem::operator<(const QStandardItem & other) const
       
    31 {
       
    32 	const int role = model() ? model()->sortRole() : Qt::DisplayRole;
       
    33 	switch(role)
       
    34 	{
       
    35 	case Qt::DisplayRole:
       
    36 		if(HelpUtils::compareStr(text(), other.text()) < 0)
       
    37 		{
       
    38 			return true;
       
    39 		}
       
    40 		break;
       
    41 	case UidRole:
       
    42 	case HrefRole:
       
    43 	case KeywordRole:
       
    44 	default:
       
    45 		return QStandardItem::operator<(other);
       
    46 	}
       
    47 	return false;
       
    48 }