javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettings.cpp
changeset 61 bf7ee68962da
parent 48 e0d6e9bd3ca7
child 62 9d831841012d
child 69 773449708c84
equal deleted inserted replaced
48:e0d6e9bd3ca7 61:bf7ee68962da
     1 /*
       
     2 * Copyright (c) 2008 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 #include "javaapplicationsettings.h"
       
    18 
       
    19 JavaApplicationSettings::JavaApplicationSettings():
       
    20     iName(QString("")), 
       
    21     iValues(QStringList()), 
       
    22     iId(0), iCurrentValue(0), 
       
    23     iColumnName(L""), 
       
    24     iTableName(""), 
       
    25     iStorageValuesFilter(L""), 
       
    26     iValuesColumnName(L""), 
       
    27     iFilterColumnName(L""), 
       
    28     iFilterColumnValue(L""), 
       
    29     connectedToUi(false)
       
    30 {
       
    31 }
       
    32 
       
    33 JavaApplicationSettings::JavaApplicationSettings(const QString& aName, const QStringList& aValues):
       
    34         iName(aName), 
       
    35         iValues(aValues),
       
    36         iId(0), 
       
    37         iCurrentValue(0), 
       
    38         iColumnName(L""), 
       
    39         iTableName(""), 
       
    40         iStorageValuesFilter(L""), 
       
    41         iValuesColumnName(L""), 
       
    42         iFilterColumnName(L""), 
       
    43         iFilterColumnValue(L""), 
       
    44         connectedToUi(false)
       
    45 {
       
    46 }
       
    47 
       
    48 JavaApplicationSettings::JavaApplicationSettings(const QString& aName, const QStringList& aValues, const std::wstring& aColumnName, const std::string& aTableName, const std::vector<std::wstring>& aStorageValues):
       
    49         iName(aName), 
       
    50         iValues(aValues), 
       
    51         iId(0), 
       
    52         iCurrentValue(0), 
       
    53         iColumnName(aColumnName), 
       
    54         iTableName(aTableName), 
       
    55         iStorageValues(aStorageValues), 
       
    56         iStorageValuesFilter(L""), 
       
    57         iValuesColumnName(L""), 
       
    58         iFilterColumnName(L""), 
       
    59         iFilterColumnValue(L""), 
       
    60         connectedToUi(false)
       
    61 {
       
    62 }
       
    63 
       
    64 JavaApplicationSettings::JavaApplicationSettings(const QString& aName, const QStringList& aValues, const std::wstring& aColumnName, const std::string& aTableName, const std::vector<std::wstring>& aStorageValues, const std::wstring& aFilterColumnName, const std::wstring& aFilterColumnValue,  const std::wstring& aValuesColumnName):
       
    65         iName(aName), 
       
    66         iValues(aValues), 
       
    67         iId(0), 
       
    68         iCurrentValue(0), 
       
    69         iColumnName(aColumnName), 
       
    70         iTableName(aTableName), 
       
    71         iStorageValues(aStorageValues), 
       
    72         iStorageValuesFilter(L""), 
       
    73         iValuesColumnName(aValuesColumnName), 
       
    74         iFilterColumnName(aFilterColumnName), 
       
    75         iFilterColumnValue(aFilterColumnValue), 
       
    76         connectedToUi(false)
       
    77 {
       
    78 }
       
    79 
       
    80 void JavaApplicationSettings::setCurrentValue(int aCurrentValue)
       
    81 {
       
    82     iCurrentValue = aCurrentValue;
       
    83 }
       
    84 
       
    85 void JavaApplicationSettings::connectToUi()
       
    86 {
       
    87     connectedToUi = true;
       
    88 }
       
    89 
       
    90 void JavaApplicationSettings::disconnectFromUi()
       
    91 {
       
    92     connectedToUi = false;
       
    93 }
       
    94 
       
    95 bool JavaApplicationSettings::isConnectedToUi()
       
    96 {
       
    97     return connectedToUi;
       
    98 }
       
    99 
       
   100 int JavaApplicationSettings::getCurrentValue()
       
   101 {
       
   102     return iCurrentValue;
       
   103 }
       
   104 
       
   105 const QString& JavaApplicationSettings::getValue(int aValueIndex)
       
   106 {
       
   107     static const QString null;
       
   108     if (aValueIndex >= 0 && aValueIndex < iValues.size())
       
   109         return iValues[aValueIndex];
       
   110     return null;
       
   111 }
       
   112 
       
   113 void JavaApplicationSettings::removeValue(int aValueIndex)
       
   114 {
       
   115     if (aValueIndex >= 0 && aValueIndex < iStorageValues.size())
       
   116         iStorageValues.erase(iStorageValues.begin() + aValueIndex);
       
   117     if (aValueIndex >= 0 && aValueIndex < iValues.size())
       
   118         iValues.erase(iValues.begin() + aValueIndex);
       
   119 }
       
   120 
       
   121 int JavaApplicationSettings::getValue(const QString& aValue)
       
   122 {
       
   123     int value = -1;
       
   124     for (int i = 0; i < iValues.size(); i++)
       
   125     {
       
   126         if (iValues[i] == aValue)
       
   127         {
       
   128             return i;
       
   129         }
       
   130     }
       
   131     return value;
       
   132 }
       
   133 
       
   134 void JavaApplicationSettings::setId(HbDataFormModelItem * aId)
       
   135 {
       
   136     iId = aId;
       
   137 }
       
   138 
       
   139 HbDataFormModelItem * JavaApplicationSettings::getId()
       
   140 {
       
   141     return iId;
       
   142 }
       
   143 
       
   144 const QString& JavaApplicationSettings::getName() const
       
   145 {
       
   146     return iName;
       
   147 }
       
   148 
       
   149 const QStringList& JavaApplicationSettings::getValues() const
       
   150 {
       
   151     return iValues;
       
   152 }
       
   153 
       
   154 const QList<JavaApplicationSettings*>& JavaApplicationSettings::getHighRiskList() const
       
   155 {
       
   156     return iHighRiskList;
       
   157 }
       
   158 
       
   159 void JavaApplicationSettings::setHighRiskList(const QList<JavaApplicationSettings*>& aHighRiskList)
       
   160 {
       
   161     iHighRiskList = aHighRiskList;
       
   162 }
       
   163 
       
   164 const QList<JavaApplicationSettings*>& JavaApplicationSettings::getMutuallyExclusiveList() const
       
   165 {
       
   166     return iMutuallyExclusiveList;
       
   167 }
       
   168 
       
   169 void JavaApplicationSettings::setMutuallyExclusiveList(const QList<JavaApplicationSettings*>& aMutuallyExclusiveList)
       
   170 {
       
   171     iMutuallyExclusiveList = aMutuallyExclusiveList;
       
   172 }
       
   173 
       
   174 const std::wstring& JavaApplicationSettings::getColumnName()
       
   175 {
       
   176     return iColumnName;
       
   177 }
       
   178 
       
   179 const std::wstring& JavaApplicationSettings::getValuesColumnName()
       
   180 {
       
   181     return iValuesColumnName;
       
   182 }
       
   183     
       
   184 const std::string& JavaApplicationSettings::getTableName()
       
   185 {
       
   186     return iTableName;
       
   187 }
       
   188 
       
   189 const std::vector<std::wstring>& JavaApplicationSettings::getStorageValues()
       
   190 {
       
   191     return iStorageValues;
       
   192 }
       
   193 
       
   194 void JavaApplicationSettings::setStorageValuesFilter(const std::wstring& aStorageValuesFilter)
       
   195 {
       
   196     iStorageValuesFilter = aStorageValuesFilter;
       
   197 }
       
   198 
       
   199 const std::wstring& JavaApplicationSettings::getStorageValuesFilter()
       
   200 {
       
   201     return iStorageValuesFilter;
       
   202 }
       
   203 
       
   204 const std::wstring& JavaApplicationSettings::getFilterColumnName()
       
   205 {
       
   206     return iFilterColumnName;
       
   207 }
       
   208 
       
   209 const std::wstring& JavaApplicationSettings::getFilterColumnValue()
       
   210 {
       
   211     return iFilterColumnValue;
       
   212 }