X-Git-Url: http://git.maemo.org/git/?p=speedfreak;a=blobdiff_plain;f=Client%2Fcategorylist.cpp;h=5d86f767805ddbac887f9da1eda871572b5b3f91;hp=243c5d382ab240efc48b378eb86de605e2508315;hb=74a1541fc05869163401c4885da4445c8940c822;hpb=a16a5f4ed3711ad28f85951c0d63e666b1f86c11 diff --git a/Client/categorylist.cpp b/Client/categorylist.cpp index 243c5d3..5d86f76 100644 --- a/Client/categorylist.cpp +++ b/Client/categorylist.cpp @@ -30,7 +30,17 @@ CategoryList::~CategoryList() */ QStringList CategoryList::getCategoryList() { - qDebug() << "_getCategoryList" ; + qDebug() << "_getCategoryList" << realSizeOfCats; + + if(sizeOfCategoryList() != 0) { + clearCategoryList(); + } + + for(int i = 0; i < realSizeOfCats; i++) + { + categoryList.append(cats[i].description); + } + return categoryList; } @@ -93,19 +103,29 @@ void CategoryList::appendCats(int ind, QString des, QString uni, QString cat) } /** - *Clear categs. + *Search description for an index af cats table. + *@param Index. */ -QString CategoryList::desOfCats(int ind) +QString CategoryList::getRecentDescription(int ind) { return cats[ind].description; } /** + *Search category for an index af cats table. + *@param Index. + */ +QString CategoryList::getRecentCategory(int ind) +{ + return cats[ind].category; +} + +/** *Clear cats. */ void CategoryList::clearCats() { - for(int i = 0; i < 10; i++) + for(int i = 0; i < 20; i++) { cats[i].description.clear(); cats[i].unit.clear(); @@ -117,6 +137,7 @@ void CategoryList::clearCats() *This function is used to get items to top list of the category that is chosen from combobox. *@param QString category *@param int size + *@todo Now there is only one (the latest top10List). Later picking up the requested category. */ QString CategoryList::getTopList( QString category, int size) {