On Wednesday 24 May 2006 17:06, Ladislav Michnovič wrote:
> Hello.
> I'm using now recent licq from svn. I discover a strange thing. It
> looks like licq has a picture support.
> It appeared on one user (I don't know why that one), but there is no
> picture available. It looks ugly and I'm missing status icon. When I
> focus a mouse on the user, it shows a black square (see attached
> screenshot). In debug mode I can see in console this message:
Please try the attached patch and see if it solves the problems.
(cd licq/plugins/qt-gui/src && patch < licq-user-picture.patch)
// Erik
--
This message has been ROT-13 encrypted twice for extra security.
Erik Johansson
http://ejohansson.se
Index: userbox.cpp
===================================================================
--- userbox.cpp (revision 4422)
+++ userbox.cpp (working copy)
@@ -30,6 +30,8 @@
#include <qdrawutil.h>
#include <qregexp.h>
#include <qstyle.h>
+#include <qimage.h>
+#include <qmime.h>
#include "userbox.moc"
#include "skin.h"
@@ -363,11 +365,15 @@
QString strPath = QString(BASE_DIR) + QString("/") + QString(USER_DIR) +
QString("/") + QString(u->IdString()) + QString(".pic");
QImage tmpImg(strPath);
- m_pUserIcon = new QPixmap;
- *m_pUserIcon = tmpImg.scale(16, 16);
+ if (!tmpImg.isNull())
+ {
+ m_pUserIcon = new QPixmap;
+ *m_pUserIcon = tmpImg.scale(16, 16);
+ }
}
- m_pIcon = m_pUserIcon;
+ if (m_pUserIcon)
+ m_pIcon = m_pUserIcon;
}
if (u->NewMessages() > 0)
@@ -1566,8 +1572,13 @@
QString strFileName = "";
if (u && u->GetPicturePresent())
{
- strFileName = QString("<center><img src=") + QString(BASE_DIR) + QString("/") + QString(USER_DIR) +
- QString("/") + QString(u->IdString()) + QString(".pic></center>");
+ const QString file = QString("%1/%2/%3.pic").arg(BASE_DIR).arg(USER_DIR).arg(u->IdString());
+ const QImage picture = QImage(file);
+ if (!picture.isNull())
+ {
+ QMimeSourceFactory::defaultFactory()->setImage(file, picture);
+ strFileName = QString("<center><img src=\"%1\"></center>").arg(file);
+ }
}
QString s = strFileName + QString("<nobr>") + QString(ICQUser::StatusToStatusStr(item->m_nStatus, item->m_bStatusInvisible))