Hello Philippe and Wengonauts
 
 Thank you for answer
 
 cprofile is an object of class ContactProfile, sorry I forgot the class in the 
last message, now with the string, when i declare it as std::string var 
Compilation Error "var is not define in std", and if Qstring or string type, 
error "Cannot convert or cast from '(which type was choosed)'" to const char *.
 
 That is because I can keep the contact groups close or open, but I need to 
validate the contact group if was open or closed before redraw, so in this way 
redraw it as user keep.
 
 void QtContactManager::redrawContacts() {
 if (_canShow) {
 _canShow = false;
 if (_showTimerId != -1) {
 killTimer(_showTimerId);
 }
 _showTimerId = startTimer(500);
 _wantShow = false;
 } else {
 _wantShow = true;
 return;
 }
 
 ContactProfile cprofile;
 QtContactListManager * ul = QtContactListManager::getInstance();
 QTreeWidgetItem * group;
 std::vector<std::string> contactIds = 
_qtContactList.getCContactList().getContactIds();
 std::vector<std::string>::iterator it; 
 QString groupIdTemp/*[100]*/ = "";
 
 //First, remove all item from the treeview and all users from userlist
 _tree->clear();
 ul->clear();
 //* DGA create a way to keep the groups open or close *//
 int indice=100;//is the index of the array
 int arrGrupos[100];
 //arrGrupos = new int[indice];
 ////////////////////////////////*////////////////////////////////////
 for (it = contactIds.begin(); it != contactIds.end(); it++) {
 cprofile = _qtContactList.getCContactList().getContactProfile((*it));
 std::string contactGroupId = cprofile.getGroupId();
 //DGA
 //char * charIdTemp = (char*) groupIdTemp;//Creando el casting de QString a 
Char *
 QString paVer = (Qstring)contactGroupId;
 if(strcmp(groupIdTemp,paVer))  
 {
  //groupIdTemp = contactGroupId.c_str ();
  //strcpy(groupIdTemp, contactGroupId);
  _tree->setItemExpanded(group,true);
  }//if
 else
 {
 _tree->setItemExpanded(group,false);
 }//else*/
 if (canShowUser(&cprofile)) { //Create new group if needed
 
 QList < QTreeWidgetItem * > list;
 if (groupsAreHidden()) {
 list = _tree->findItems(QtContactList::DEFAULT_GROUP_NAME,Qt::MatchExactly);
 } else {
 list =_tree->findItems(QString::fromStdString(contactGroupId), 
Qt::MatchExactly);
 }
 //If no group exists, create the group
 if (list.isEmpty()) {
 group = new QTreeWidgetItem(_tree);
 if (groupsAreHidden()) {
 group->setText(0, QtContactList::DEFAULT_GROUP_NAME);
 } else {
 group->setText(0, QString::fromStdString(contactGroupId));
 }
 
 } else {
 
 
 group = list[0];
 //_tree->setItemExpanded(group, false); }
 //We have the group, now add users to the group
 QTreeWidgetItem * newContact = NULL;
 QtContact * qtContact = NULL;
 QString contactName;
 newContact = new QTreeWidgetItem(group); 
 newContact->setText(0, QString::fromStdString((*it)));
 newContact->setFlags(newContact->flags() | Qt::ItemIsEditable);
 qtContact = new QtContact((*it), _cWengoPhone, _tree);
 ul->addContact(qtContact);
 }
 }
 
 //safeSortContacts(true);
  //delete[] arrGrupos;//kill the array and free the memory DGA
 }
 
 
 My problem is on the validation of Group names(red text), where I need to know 
wich group is and ask if is expanded or collapsed before clean tree widget
 
 
 It is my problem, thanks in advance
 
 P.D. QtContactManager->redrawContacts
       Dennis Guzman Artavia
 Software Development
 DGA Pro.
    
 -----Original Message-----
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: [email protected]
 Sent: Tue, 6 Mar 2007 12:26 AM
 Subject: Re: [Wengophone-devel] keep close/open the groups when redrawContacts
 
  Hi Dennis, 
 
 Le 5 mars 07 à 21:00, [EMAIL PROTECTED] a écrit : 
 
 > Sorry but I need your help when the redrawContacs methon in > 
 > QtContactManager, I tried to make a copy of cprofile and use the > function 
 > getGroupId but the var must be std::string so I import the > string.h 
 > library and declarate a string var to assing the Group Id > but, crash with 
 > compilation error "string undeclare" I tried String > too, char * or char[] 
 > but I cant cast it. 
 
 What is cprofile? We have no class of type CProfile so I don't which class 
you're trying to copy. 
 About the string undeclare, did you declare a 'string' or a 'std::string'? 
 
 -- 
 Philippe BERNERY <[EMAIL PROTECTED]> 
 http://dev.openwengo.org 
 
   
________________________________________________________________________
Check Out the new free AIM(R) Mail -- 2 GB of storage and industry-leading spam 
and email virus protection.
_______________________________________________
Wengophone-devel mailing list
[email protected]
http://dev.openwengo.com/mailman/listinfo/wengophone-devel

Reply via email to