[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/klabelbrowser
From: Ramakrishna R <rkhas108solutions () yahoo ! com>
Date: 2005-08-18 14:52:03
Message-ID: 1124376723.309127.21172.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 450572 by ramakrishna:
modified getAllLabels Api function to accept QStringList parameter instead of QString
M +13 -1 lbapi.cpp
M +4 -1 lbapi.h
M +5 -2 test.cpp
--- trunk/playground/base/klabelbrowser/lbapi.cpp #450571:450572
@@ -109,8 +109,9 @@
return 0;
}
-bool LabelManager::getAllLabels(QString &labelList)
+bool LabelManager::getAllLabels(QStringList &qlabelList)
{
+ QString labelList;
Connection con = new Connection();
con.connect(labelListName,hostName,userName,tempPassword);
mysqlpp::Query query = con.query();
@@ -130,6 +131,17 @@
resultstr<< result[i][0]; // last name without coma.
labelList = resultstr.str();
+ // conversion from QStrint to QStringList
+ QStringList list ;
+ list = list.split(",", labelList);
+ QString temp;
+
+ for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
+ {
+ temp = *it;
+ temp = temp.mid(1,temp.length()-2);
+ qlabelList << temp;
+ }
}
catch(exception& er)
{
--- trunk/playground/base/klabelbrowser/lbapi.h #450571:450572
@@ -2,6 +2,7 @@
#define _lbapi_h_
#include<qstring.h>
+#include<qstringlist.h>
#include<string>
using namespace std;
@@ -20,7 +21,9 @@
bool getLabels(const QString & path,QString &labelList);
// bool getPaths(const char* labelName,string &pathList);
bool getPaths(const QString & labelName,QString &pathList);
- bool getAllLabels(QString &labelList);
+
+// bool getAllLabels(QString &labelList);
+ bool getAllLabels(QStringList &labelList);
};
}
--- trunk/playground/base/klabelbrowser/test.cpp #450571:450572
@@ -63,7 +63,10 @@
void test_get_all_labels()
{
klb::LabelManager * testLabel = new klb::LabelManager();
- QString ss;
+ QStringList ss;
testLabel->getAllLabels(ss);
- cout <<"\n"<< ss<<"\n";
+ for ( QStringList::Iterator it = ss.begin(); it != ss.end(); ++it )
+ {
+ cout << *it << endl;
+ }
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic