void KopeteAccountConfig::slotColorChanged() { if(m_protected) //this slot is called because we changed the button return; // color because another account has been selected KopeteAccountLVI *lvi = static_cast<KopeteAccountLVI*>( m_view->mAccountList->selectedItem() ); if ( !lvi || !lvi->account() ) return; Kopete::Account *account = lvi->account(); if(!account->color().isValid() && !m_view->mUseColor->isChecked() ) { //we don't use color for that account and nothing changed. m_newColors.remove(account); return; } else if(!m_view->mUseColor->isChecked()) { //the user disabled account coloring, but it was activated before m_newColors[account]=QColor(); emit changed(true); return; } else if(account->color() == m_view->mColorButton->color() ) { //The color has not changed. m_newColors.remove(account); return; } else { m_newColors[account]=m_view->mColorButton->color(); emit changed(true); } }
void KopeteAccountConfig::slotItemSelected() { m_protected=true; KopeteAccountLVI *itemSelected = static_cast<KopeteAccountLVI*>( m_view->mAccountList->selectedItem() ); m_view->mButtonEdit->setEnabled( itemSelected ); m_view->mButtonRemove->setEnabled( itemSelected ); if ( itemSelected && itemSelected->account() ) { m_view->mButtonUp->setEnabled( itemSelected->itemAbove() ); m_view->mButtonDown->setEnabled( itemSelected->itemBelow() ); Kopete::Account *account = itemSelected->account(); QColor color= m_newColors.contains(account) ? m_newColors[account] : account->color(); m_view->mUseColor->setEnabled( true ); m_view->mUseColor->setChecked( color.isValid() ); m_view->mColorButton->setColor( color ); m_view->mColorButton->setEnabled( m_view->mUseColor->isChecked() ); } else { m_view->mButtonUp->setEnabled( false ); m_view->mButtonDown->setEnabled( false); m_view->mUseColor->setEnabled( false ); m_view->mColorButton->setEnabled( false ); } m_protected=false; }