tags 377894 + patch
thanks

Hello,

I've played with the licq source.

The described problem is in the plugins/qt-gui/src/ownermanagerdlg.cpp
file. If the "Ok"-button is clicked or enter is pressed in the userid or
password field the OwnerEditDlg::slot_ok() method is called. To find out
which protocol has been selected the method iterates thru the a list of
supported protocols provided by the licq core. Every protocol has a name
which is set with an QString object. To compare the protocol selected
with the one current in the iteration the function strcmp is used. The
first parameter it get passed is a char-pointer obtained thru
cmbProtocol->currentText().latin1() earlier. The second parameter is the
name used to create combo entry.

Now the problem is, that with an unset style (described in last mail)
the latin1() method used to create the char-pointer for the first
parameter returns something strange, which is compared to the second
parameter smaller (result -1).

The fix for this problem is, to not convert to a char-pointer using
latin1() in first place, but to use the QString-object returned by
currentText() directly. The class QString provides the necessary method
to do the comparison, which does succeed.

A tested patch is included as attachment.

Greetings
  - Daniel
diff -Nur licq-1.3.2.orig/plugins/qt-gui/src/ownermanagerdlg.cpp 
licq-1.3.2/plugins/qt-gui/src/ownermanagerdlg.cpp
--- licq-1.3.2.orig/plugins/qt-gui/src/ownermanagerdlg.cpp      2005-09-20 
15:46:41.000000000 +0200
+++ licq-1.3.2/plugins/qt-gui/src/ownermanagerdlg.cpp   2006-07-18 
05:12:30.000000000 +0200
@@ -130,7 +130,7 @@
   const char *szPassword = 0;
   if (!edtPassword->text().isEmpty())
     szPassword = edtPassword->text().latin1();
-  const char *szProtocol = cmbProtocol->currentText().latin1();
+  QString szProtocol = cmbProtocol->currentText();
   unsigned long nPPID = 0;
   
   ProtoPluginsList pl;
@@ -138,7 +138,7 @@
   server->ProtoPluginList(pl);
   for (it = pl.begin(); it != pl.end(); it++)
   {
-    if (strcmp(szProtocol, (*it)->Name()) == 0)
+    if (QString::compare(szProtocol, (*it)->Name()) == 0)
     {
       nPPID = (*it)->PPID();
       break;

Attachment: signature.asc
Description: Digital signature

Reply via email to