void ProfileWidget::on_Delete__released () { auto index = Ui_.FriendsView_->selectionModel ()->currentIndex (); index = index.sibling (index.row (), Columns::Name); if (!index.isValid ()) return; QString msg; index.parent ().isValid () ? msg = tr ("Are you sure to delete user <b>%1</b> from your friends.") .arg (index.data ().toString ()) : msg = tr ("Are you sure to delete group <b>%1</b>" "<br><i>Note: all friends in this group will <b>not</b> be deleted.</i>") .arg (index.data ().toString ()); int res = QMessageBox::question (this, tr ("Change friendslist"), msg, QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel); if (res == QMessageBox::Ok) { LJAccount *account = qobject_cast<LJAccount*> (Profile_->GetParentAccount ()); if (!account) return; if (!index.parent ().isValid ()) account->DeleteGroup (Item2FriendGroup_ [FriendsModel_->itemFromIndex (index)].Id_); else account->DeleteFriend (index.data ().toString ()); } }