2018-08-17 Fred Gleason <fredg@paravelsystems.com>

* Fixed a bug in 'RDCartDrag' that caused corruption with UTF-8
	strings.
This commit is contained in:
Fred Gleason 2018-08-17 10:58:25 -04:00
parent 72b851ecfa
commit 04fac8e777
3 changed files with 9 additions and 9 deletions

View File

@ -17471,3 +17471,6 @@
2018-08-17 Fred Gleason <fredg@paravelsystems.com> 2018-08-17 Fred Gleason <fredg@paravelsystems.com>
* Corrected background colors of the Button Log and Message widgets * Corrected background colors of the Button Log and Message widgets
in rdairplay(1). in rdairplay(1).
2018-08-17 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in 'RDCartDrag' that caused corruption with UTF-8
strings.

View File

@ -2,7 +2,7 @@
// //
// Stored value drag object for Rivendell carts. // Stored value drag object for Rivendell carts.
// //
// (C) Copyright 2013,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2013-2018 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as // it under the terms of the GNU General Public License version 2 as
@ -21,8 +21,6 @@
#include <string.h> #include <string.h>
#include <qstringlist.h> #include <qstringlist.h>
//Added by qt3to4:
#include <QPixmap>
#include <rd.h> #include <rd.h>
#include <rdcart.h> #include <rdcart.h>
@ -99,7 +97,7 @@ bool RDCartDrag::decode(QMimeSource *e,unsigned *cartnum,QColor *color,
QString *title) QString *title)
{ {
RDProfile *p=new RDProfile(); RDProfile *p=new RDProfile();
p->setSourceString(e->encodedData(RDMIMETYPE_CART)); p->setSourceString(QString::fromUtf8(e->encodedData(RDMIMETYPE_CART)));
*cartnum=p->intValue("Rivendell-Cart","Number"); *cartnum=p->intValue("Rivendell-Cart","Number");
if(color!=NULL) { if(color!=NULL) {
color->setNamedColor(p->stringValue("Rivendell-Cart","Color")); color->setNamedColor(p->stringValue("Rivendell-Cart","Color"));
@ -135,7 +133,5 @@ void RDCartDrag::SetData(unsigned cartnum,const QColor &color,const QString &tit
if(!title.isEmpty()) { if(!title.isEmpty()) {
str+="ButtonText="+title+"\n"; str+="ButtonText="+title+"\n";
} }
QByteArray data(str.length()); setEncodedData(str.toUtf8());
data.duplicate(str,str.length());
setEncodedData(data);
} }

View File

@ -2,7 +2,7 @@
// //
// Stored value drag object for Rivendell carts. // Stored value drag object for Rivendell carts.
// //
// (C) Copyright 2013,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2013-2018 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as // it under the terms of the GNU General Public License version 2 as
@ -22,9 +22,10 @@
#define RDCARTDRAG_H #define RDCARTDRAG_H
#include <qcolor.h> #include <qcolor.h>
#include <q3dragobject.h>
#include <qpixmap.h> #include <qpixmap.h>
#include <q3dragobject.h>
#include <rdcart.h> #include <rdcart.h>
#include <rdlog_line.h> #include <rdlog_line.h>