Logo Search packages:      
Sourcecode: nateon version File versions  Download package

void KNateonMainview::sortGroupName ( bool  bOnlyOnline  ) 

그릅과 이름으로 정렬. 그릅 : 한글 + 영문 + 기타 bOnlyOnline : 온/오프라인 모두 보기 false, 온라인 버디만 보기 true

버디 정렬을 위한 임시 리스트 변수

그룹 Tree Open/Close 상태 가지고 옴.

FL(Friend List) == 0

버디 온라인 수

임시 저장 변수 초기화

영어

임시 저장 변수 초기화

한글

FL(Friend List) == 0

버디 온라인 수

Definition at line 1301 of file knateonmainview.cpp.

References Group::getBuddyList(), CurrentAccount::getBuddyList(), getBuddyListName(), BuddyBase::getCyworld_CMN(), MyListItem::getGID(), MyListItem::getGName(), GroupList::getGroupByName(), CurrentAccount::getGroupList(), BuddyBase::getHandle(), BuddyBase::getName(), BuddyBase::getStatus(), BuddyBase::getUID(), BuddyBase::isFL(), ContactList::setHasHompy(), ContactList::setHTMLText(), ContactList::setListParent(), ContactRoot::setOnlineCount(), ContactRoot::setPixmap(), ContactRoot::setTotal(), nmconfig::typeofbuddylist, and nmconfig::viewemoticonlist.

Referenced by slotGotINFY(), slotSortNormal(), and slotSortOnlyOnline().

{
      pBuddyList = m_pCurrentAccount->getBuddyList();
      pGroupList = m_pCurrentAccount->getGroupList();
  
      Buddy *pBuddy;
      QStringList slHan;
      QStringList slBuddyList;

      /*! 버디 정렬을 위한 임시 리스트 변수 */
      QPtrList<Buddy> myBuddy;
      myBuddy.clear();

      listView3->clear();
      listView3->setSorting(-1);
      QPtrListIterator<Group> itorGroup(*pGroupList);
      Group * pGroup;
      QStringList slGroup;
      while (itorGroup.current() != 0)
      {
            pGroup = itorGroup.current();
            slGroup.append( pGroup->getGName() );
            ++itorGroup;
      }
      /*! 그룹 Tree Open/Close 상태 가지고 옴. */
      config->setGroup("BuddyListTree");

      QString etcGrpName = UTF8("기타");
      pGroup = pGroupList->getGroupByName( etcGrpName );

      if ( !pGroup ) {
            //pGroup = new Group( "0", UTF8("기타") );
            //pGroupList->addGroup( pGroup );
            etcGrpName = UTF8("ETC");
            pGroup = pGroupList->getGroupByName( etcGrpName );
      }

#ifdef NETDEBUG
      kdDebug() << etcGrpName << " 의 아이템 수 : [" << pGroup->getBuddyList().count() << "]" << endl;
#endif
            
      ContactRoot* pRoot = new ContactRoot(listView3, pGroup->getGName(), pGroup->getGID() );
      pRoot->setPixmap( folderOpen );
      pRoot->setOpen( config->readBoolEntry( pGroup->getGID() , true ) );
      if ( pRoot->isOpen() )
            pRoot->setPixmap( folderOpen );
      else
            pRoot->setPixmap( folderClosed );
  
  
      int nTotal = 0;
      int nOnlineCount = 0;
      QPtrListIterator<Buddy> iterBL( pGroup->getBuddyList() );
  //
      while( iterBL.current() != 0 )
      {
            pBuddy = iterBL.current();
            if ( pBuddy )
            {
                  /*! FL(Friend List) == 0 */
                  if ( pBuddy->isFL() == FALSE ) { continue; }
                  myBuddy.append( pBuddy );
                  nTotal++;  
            }
#ifdef NETDEBUG
            else
            {
                  kdDebug() << "111> Nothing handle value : [" << *iterBL << "]" << endl;
            }
#endif

            ++iterBL;
      }
      
      MyBuddyList  bList( myBuddy );
      bList.sort();
      QPtrListIterator<Buddy> itorBuddy( bList );
      while (itorBuddy.current() != 0)
      {
            pBuddy = itorBuddy.current();
            // pBuddy->setGID( pGroup->getGID() );

            QListViewItem* pGroupItem = 0;
            pGroupItem = listView3->findItem(pGroup->getGID(), 1, Qt::CaseSensitive);
            if ( pGroupItem == 0 )
            {
#ifdef NETDEBUG
                  kdDebug() << "[KNateonMainview::slotAddFriend] Group 0 is nothing!" << endl;
#endif
                  ++itorBuddy;
                  continue;
            }
            if ( pBuddy->getStatus() != "F" )
                  nOnlineCount++;

            if ( bOnlyOnline )
                  if ( pBuddy->getStatus() == "F" )
                  {
                        ++itorBuddy;
                        continue;
                  }

            ContactList* pNewBuddy = new ContactList( pGroupItem );
            pNewBuddy->setDragEnabled ( true );
            pNewBuddy->setListParent(listView3);
            pNewBuddy->setHasHompy( pBuddy->getCyworld_CMN() != "%00" );
            pNewBuddy->setHTMLText( getBuddyListName( pBuddy, stConfig.viewemoticonlist, stConfig.typeofbuddylist ) );
            pNewBuddy->setText( 0, pBuddy->getName() );
            pNewBuddy->setText( 1, /* pBuddy->getGID() */ pGroupItem->text(1) );
            pNewBuddy->setText( 2, pBuddy->getHandle() );
            pNewBuddy->setText( 3, pBuddy->getUID() );

            ++itorBuddy;
      }
#ifdef NETDEBUG
      kdDebug() << "Online Count : [" << QString::number( nOnlineCount ) << "]" << endl;
      kdDebug() << "nTotal Buddies : [" << QString::number( nTotal ) << "]" << endl;
#endif
      /*! 버디 온라인 수 */
      pRoot->setTotal( nTotal );
      pRoot->setOnlineCount( nOnlineCount );

      slGroup.sort();
      while ( !slGroup.isEmpty() )
      {
            /*! 임시 저장 변수 초기화 */
            myBuddy.clear();

            QString aa( slGroup.last() );
            /*! 영어 */
            //if ( aa != UTF8("기타") )
            if ( aa != etcGrpName )
            {
                  if ( aa.lower() != aa.upper() )
                  {
                        pGroup = pGroupList->getGroupByName( aa );
                        if ( !pGroup )
                              continue;
                        ContactRoot* pRoot = new ContactRoot(listView3, pGroup->getGName(), pGroup->getGID() );
                        pRoot->setPixmap( folderOpen );
                        pRoot->setOpen( config->readBoolEntry( pGroup->getGID() , true ) );
                        if ( pRoot->isOpen() )
                              pRoot->setPixmap( folderOpen );
                        else
                              pRoot->setPixmap( folderClosed );
        
                        nTotal = 0;
                        nOnlineCount = 0;

                        QPtrListIterator<Buddy> iterBL( pGroup->getBuddyList() );
                        while( iterBL.current() != 0 )
                        {
                              pBuddy = iterBL.current();

                              if ( pBuddy )
                              {
                                    // FL(Friend List) == 0
                                    if ( pBuddy->isFL() == FALSE ) { continue; }
                                    myBuddy.append( pBuddy );
                                    nTotal++;
                              }
#ifdef NETDEBUG
                              else
                              {
                                    kdDebug() << "222> Nothing handle value : [" << *iterBL << "]" << endl;
                              }
#endif
                              ++iterBL;
                        }
                        MyBuddyList  bList( myBuddy );
                        bList.sort();
                        QPtrListIterator<Buddy> itorBuddy( bList );
                        while (itorBuddy.current() != 0)
                        {
                              pBuddy = itorBuddy.current();
                              // pBuddy->setGID( pGroup->getGID() );

                              QListViewItem* pGroupItem = 0;
                              pGroupItem = listView3->findItem(pGroup->getGID(), 1, Qt::CaseSensitive);
                              if ( pGroupItem == 0 )
                              {
#ifdef NETDEBUG
                                    kdDebug() << "[KNateonMainview::slotAddFriend] Group 0 is nothing!" << endl;
#endif
                                    ++itorBuddy;
                                    continue;
                              }
                              if ( pBuddy->getStatus() != "F" )
                                    nOnlineCount++;
                        
                              if ( bOnlyOnline )
                                    if ( pBuddy->getStatus() == "F" )
                                    {
                                          ++itorBuddy;
                                          continue;
                                    }
                              ContactList* pNewBuddy = new ContactList( pGroupItem );
                              pNewBuddy->setDragEnabled ( true );    
                              pNewBuddy->setListParent(listView3);
                              pNewBuddy->setHasHompy( pBuddy->getCyworld_CMN() != "%00" );
                              pNewBuddy->setHTMLText( getBuddyListName( pBuddy, stConfig.viewemoticonlist, stConfig.typeofbuddylist ) );
                              pNewBuddy->setText( 0, pBuddy->getName() );
                              //pNewBuddy->setText( 1, pBuddy->getGID() );
                              pNewBuddy->setText( 1, pGroupItem->text(1) );
                              pNewBuddy->setText( 2, pBuddy->getHandle() );
                              pNewBuddy->setText( 3, pBuddy->getUID() );

                              ++itorBuddy;
                        }
                        // 버디 온라인 수 
                        pRoot->setTotal( nTotal );
                        pRoot->setOnlineCount( nOnlineCount );
                  }
                  else
                  {
                        slHan.append( aa );
                  }
            }
            slGroup.pop_back();
      }


      for ( QStringList::Iterator it = slHan.begin(); it != slHan.end(); ++it )
      {
            /*! 임시 저장 변수 초기화 */
            myBuddy.clear();
            /*! 한글 */
            //if ( *it != UTF8("기타") )
            if ( *it != etcGrpName )
            {
                  if ( (*it).lower() == (*it).upper() )
                  {
                        pGroup = pGroupList->getGroupByName( *it );
                        ContactRoot* pRoot = new ContactRoot(listView3, pGroup->getGName(), pGroup->getGID() );
                        pRoot->setPixmap( folderOpen );
                        pRoot->setOpen( config->readBoolEntry( pGroup->getGID() , true ) );
                        if ( pRoot->isOpen() )
                              pRoot->setPixmap( folderOpen );
                        else
                              pRoot->setPixmap( folderClosed );
        
                        nTotal = 0;
                        nOnlineCount = 0;
                  
                        QPtrListIterator<Buddy> iterBL( pGroup->getBuddyList() );
                        while( iterBL.current() != 0 )
                        {
                              pBuddy = iterBL.current();

                              if ( pBuddy )
                              {
                                    /*! FL(Friend List) == 0 */
                                    if ( pBuddy->isFL() == FALSE ) { continue; }
                                    myBuddy.append( pBuddy );
                                    nTotal++;
                              }
#ifdef NETDEBUG
                              else
                              {
                                    kdDebug() << "333> Nothing handle value : [" << *iterBL << "]" << endl;
                              }
#endif
                              ++iterBL;
                        }
                        MyBuddyList  bList( myBuddy );
                        bList.sort();
                        QPtrListIterator<Buddy> itorBuddy( bList );
                        while (itorBuddy.current() != 0)
                        {
                              pBuddy = itorBuddy.current();
                              // pBuddy->setGID( pGroup->getGID() );

                              QListViewItem* pGroupItem = 0;
                              pGroupItem = listView3->findItem(pGroup->getGID(), 1, Qt::CaseSensitive);
                              if ( pGroupItem == 0 )
                              {
#ifdef NETDEBUG
                                    kdDebug() << "[KNateonMainview::slotAddFriend] Group 0 is nothing!" << endl;
#endif
                                    ++itorBuddy;
                                    continue;
                              }
                              if ( pBuddy->getStatus() != "F" )
                                    nOnlineCount++;
                        
                              if ( bOnlyOnline )
                                    if ( pBuddy->getStatus() == "F" )
                                    {
                                          ++itorBuddy;
                                          continue;
                                    }
                              ContactList* pNewBuddy = new ContactList( pGroupItem );
                              pNewBuddy->setDragEnabled ( true );    
                              pNewBuddy->setListParent(listView3);
                              pNewBuddy->setHasHompy( pBuddy->getCyworld_CMN() != "%00" );
                              pNewBuddy->setHTMLText( getBuddyListName( pBuddy, stConfig.viewemoticonlist, stConfig.typeofbuddylist ) );
                              pNewBuddy->setText( 0, pBuddy->getName() );
                              pNewBuddy->setText( 1, /* pBuddy->getGID() */ pGroupItem->text(1) );
                              pNewBuddy->setText( 2, pBuddy->getHandle() );
                              pNewBuddy->setText( 3, pBuddy->getUID() );

                              ++itorBuddy;
                        }
                        /*! 버디 온라인 수 */
                        pRoot->setTotal( nTotal );
                        pRoot->setOnlineCount( nOnlineCount );
                  }
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index