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

void KNateon::slotDeleteBuddy (  )  [private, slot]

친구 삭제

pList 가 멀티셀렉션으로 세팅 되있으면 isMultiSelection은 무조건 true 임. else { Buddy *pBuddy = m_pBuddyList->getBuddyByHandle( pList->currentItem()->text(2) ); m_pMainView->slotAddBuddy( groupItem, pBuddy ); }

Group의 BuddyList에서 삭제된 버디 handle을 삭제한다. 이후 복사/이동에서 목록에 있어서 Skip 되는것을 방지한다.

명령어가 있을때만 DP로 보냄.

Delete? Yes

XXXXXXXXXXXXX

Definition at line 3990 of file knateon.cpp.

References BuddyList::getBuddyByHandle(), CurrentAccount::getBuddyList(), GroupList::getGroupByID(), NateonDPConnection::getGroupCache(), CurrentAccount::getGroupList(), BuddyBase::getHandle(), BuddyBase::getName(), KNateonMainview::getSelectedBuddyCount(), BuddyBase::getUID(), GroupList::isContain(), pDeleteForm, Group::removeBuddy(), NateonConnection::sendCommand(), BuddyBase::setFL(), slotDeleteFriend(), slotDeleteGroup(), KNateonMainview::slotEmoticonList(), and nmconfig::viewemoticonlist.

Referenced by connected().

{
#ifdef NETDEBUG
      kdDebug() << "Selected Buddy Count : " << m_pMainView->getSelectedBuddyCount() << endl;
#endif

      QListView *pList = m_pMainView->listView3;
      m_pBuddyList = const_cast<BuddyList*>(m_pCurrentAccount->getBuddyList());

      QString sBody;
      int nIDX = 0;
      /*! pList 가 멀티셀렉션으로 세팅 되있으면 isMultiSelection은 무조건 true 임.
        else
        {
        Buddy *pBuddy = m_pBuddyList->getBuddyByHandle( pList->currentItem()->text(2) );
        m_pMainView->slotAddBuddy( groupItem, pBuddy );
        }
      */
      if ( m_pMainView->getSelectedBuddyCount() > 1)
      {
            int result = KMessageBox::  questionYesNo(this, QString::number( m_pMainView->getSelectedBuddyCount() ) + UTF8("명의 친구를 삭제 하시겠습니까?"), UTF8("친구 지우기") );
            if ( result == KMessageBox::Yes )
            {
            QPtrList<Buddy> pBuddyList;
                  
                  QListViewItemIterator it( pList );
                  while ( it.current() )
                  {
                        if ( it.current()->isSelected() )
                        {
                              Buddy *pBuddy = m_pBuddyList->getBuddyByHandle( it.current()->text(2) );
                              if (pBuddy)
                              {
                                    sBody += QString::number( nIDX++ );
                                    sBody += " ";
                                    sBody += pBuddy->getHandle();
                                    sBody += " ";
                                    sBody += pBuddy->getUID();
                                    sBody += " ";
                                    sBody += it.current()->text(1);
                                    sBody += "\r\n";

                                    /*!
                                      Group의 BuddyList에서 삭제된 버디 handle을 삭제한다.
                                      이후 복사/이동에서 목록에 있어서 Skip 되는것을 방지한다.
                                    */
                                    Group *pGroup = m_pCurrentAccount->getGroupList()->getGroupByID( it.current()->text(1) );
                                    if ( pGroup )
                                          pGroup->removeBuddy( pBuddy );
            
                        if ( pBuddyList.find( pBuddy ) == -1 )
                                    {
                                          pBuddyList.append( pBuddy );
                                    }
                              }
                        }
                        ++it;
                  }

                  /*!
                   * 명령어가 있을때만 DP로 보냄.
                   */
                  if ( sBody.length() )
                  {
                        QString sCommand;
                        sCommand = QString::number( m_pDPcon->getGroupCache() );
                        sCommand += " ";
                        sCommand += QString::number( sBody.length() );
                        sCommand += "\r\n";
                        sCommand += sBody;
                        
                        m_pDPcon->sendCommand( "RMBG", sCommand );
                        
                        m_pMainView->slotEmoticonList( stConfig.viewemoticonlist );
                        m_pGroupList = const_cast<GroupList*>(m_pCurrentAccount->getGroupList());
                  }
                  
                  QStringList slRMBGList;
            QPtrListIterator<Buddy> iterBL( pBuddyList );
            while( iterBL.current() != 0)
                  {
                if( !m_pGroupList->isContain( iterBL.current() ) )
                        {
                              Buddy *pBuddy = iterBL.current();
                              if ( pBuddy )
                              {
                                    QString sCommand;
                                    sCommand += "FL";
                                    sCommand += " ";
                                    sCommand += pBuddy->getHandle();
                                    sCommand += " ";
                                    sCommand += pBuddy->getUID();
                                    sCommand += " ";
                                    sCommand += "0";
                                    sCommand += "\r\n";
                                    
                                    m_pDPcon->sendCommand( "RMVB", sCommand );
                                    pBuddy->setFL( FALSE );
                              }
                        }
                ++iterBL;
                  }
                  
            } /*! Delete? Yes */
      }
      else if ( m_pMainView->getSelectedBuddyCount() == 1 )
      {
            Buddy *pBuddy = m_pBuddyList->getBuddyByHandle( pList->currentItem()->text(2) );
            if ( pBuddy )
            {
                  if ( !pDeleteForm )
                  {
                        pDeleteForm = new DeleteForm( this, "Delete Buddy" );
                        connect( pDeleteForm, SIGNAL( deleteInfo( DeleteForm * ) ), SLOT( slotDeleteFriend( DeleteForm * ) ) );
                  }
                  /*!
                   * XXXXXXXXXXXXX
                   */
                  pDeleteForm->lockCheckBox->setEnabled( FALSE );
                  
                  pDeleteForm->setName( pBuddy->getName() );
                  pDeleteForm->setUID( pBuddy->getUID() );
                  pDeleteForm->setGID( pList->currentItem()->text(1) );
                  pDeleteForm->setHandle( pBuddy->getHandle() );
                  pDeleteForm->show();
            }
      }
      else
      {
            const GroupList *pGroupList = m_pCurrentAccount->getGroupList();
            Group *pGroup = pGroupList->getGroupByID( pList->currentItem()->text(1) );
            if ( pGroup )
                  slotDeleteGroup();
            else
                  KMessageBox::information (this, UTF8("삭제 할 친구 선택을 안하셨습니다.\n확인하시고 다시 실행해 주십시오."), UTF8("친구 삭제 알림"));
      }
}


Generated by  Doxygen 1.6.0   Back to index