[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kopete-devel
Subject:    Re: [kopete-devel] For review: Avatar selector dialog
From:       Gustavo Pichorim Boiko <gustavo.boiko () kdemail ! net>
Date:       2007-11-14 0:16:45
Message-ID: 200711132216.45917.gustavo.boiko () kdemail ! net
[Download RAW message or body]

Em Tuesday 13 November 2007 20:36:33 Gustavo Pichorim Boiko escreveu:
> Hi
>
> Today I've simplified the avatar selector dialog a bit.
> Screenshot at:
> http://people.mandriva.com/~boiko/kopete/avatars/kopete_avatar_dialog.png

There was a small problem on removing avatars. The problem was that there is 
no more text in the items anymore, so we need to use another way to find the 
item. The attached patch solves the problem.

Cheers
-- 
Gustavo Pichorim Boiko

["0001-Fix-avatar-removing-in-the-new-dialog.patch" (text/x-diff)]

From c7b528a6bc49ec56d0c5e0973852e283c81b241f Mon Sep 17 00:00:00 2001
From: Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
Date: Tue, 13 Nov 2007 22:11:00 -0200
Subject: [PATCH] Fix avatar removing in the new dialog

---
 libkopete/ui/avatarselectorwidget.cpp |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libkopete/ui/avatarselectorwidget.cpp \
b/libkopete/ui/avatarselectorwidget.cpp index 3a50dab..c2b697c 100644
--- a/libkopete/ui/avatarselectorwidget.cpp
+++ b/libkopete/ui/avatarselectorwidget.cpp
@@ -221,7 +221,6 @@ void AvatarSelectorWidget::buttonRemoveAvatarClicked()
 	if ( !d->mainWidget.listUserAvatar->selectedItems().count() )
 		return;
 
-	// You can't remove from listUserContact, so we can always use listUserAvatar
 	AvatarSelectorWidgetItem *selectedItem = dynamic_cast<AvatarSelectorWidgetItem*>( \
d->mainWidget.listUserAvatar->selectedItems().first() );  if( selectedItem )
 	{
@@ -259,12 +258,16 @@ void \
AvatarSelectorWidget::avatarAdded(Kopete::AvatarManager::AvatarEntry newEnt  void \
AvatarSelectorWidget::avatarRemoved(Kopete::AvatarManager::AvatarEntry entryRemoved)  \
{  // Same here, avatar can be only removed from listUserAvatar
-	QList<QListWidgetItem *> foundItems = d->mainWidget.listUserAvatar->findItems( \
                entryRemoved.name, Qt::MatchContains );
-	if( !foundItems.isEmpty() )
+	foreach(QListWidgetItem *item, \
d->mainWidget.listUserAvatar->findItems("",Qt::MatchContains))  {
+		// checks if this is the right item
+		AvatarSelectorWidgetItem *avatar = dynamic_cast<AvatarSelectorWidgetItem*>(item);
+		if (!avatar || avatar->avatarEntry().name != entryRemoved.name)
+		    continue;
+
 		kDebug(14010) << "Removing " << entryRemoved.name << " from list.";
 
-		int deletedRow = d->mainWidget.listUserAvatar->row( foundItems.first() );
+		int deletedRow = d->mainWidget.listUserAvatar->row( item );
 		QListWidgetItem *removedItem = d->mainWidget.listUserAvatar->takeItem( deletedRow \
);  delete removedItem;
 
-- 
1.5.3.5



_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic