diff --git a/ChangeLog b/ChangeLog index 457aec0b..19d64e49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17471,3 +17471,6 @@ 2018-08-17 Fred Gleason * Corrected background colors of the Button Log and Message widgets in rdairplay(1). +2018-08-17 Fred Gleason + * Fixed a bug in 'RDCartDrag' that caused corruption with UTF-8 + strings. diff --git a/lib/rdcartdrag.cpp b/lib/rdcartdrag.cpp index cb285a0a..7237a05c 100644 --- a/lib/rdcartdrag.cpp +++ b/lib/rdcartdrag.cpp @@ -2,7 +2,7 @@ // // Stored value drag object for Rivendell carts. // -// (C) Copyright 2013,2016 Fred Gleason +// (C) Copyright 2013-2018 Fred Gleason // // 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 @@ -21,8 +21,6 @@ #include #include -//Added by qt3to4: -#include #include #include @@ -99,7 +97,7 @@ bool RDCartDrag::decode(QMimeSource *e,unsigned *cartnum,QColor *color, QString *title) { RDProfile *p=new RDProfile(); - p->setSourceString(e->encodedData(RDMIMETYPE_CART)); + p->setSourceString(QString::fromUtf8(e->encodedData(RDMIMETYPE_CART))); *cartnum=p->intValue("Rivendell-Cart","Number"); if(color!=NULL) { 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()) { str+="ButtonText="+title+"\n"; } - QByteArray data(str.length()); - data.duplicate(str,str.length()); - setEncodedData(data); + setEncodedData(str.toUtf8()); } diff --git a/lib/rdcartdrag.h b/lib/rdcartdrag.h index 83a30019..a36a9e8c 100644 --- a/lib/rdcartdrag.h +++ b/lib/rdcartdrag.h @@ -2,7 +2,7 @@ // // Stored value drag object for Rivendell carts. // -// (C) Copyright 2013,2016 Fred Gleason +// (C) Copyright 2013-2018 Fred Gleason // // 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 @@ -22,9 +22,10 @@ #define RDCARTDRAG_H #include -#include #include +#include + #include #include