mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kdeui: print error message if reading hex QColor from config results in invalid color
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
5ca124cb4e
commit
7555229053
1 changed files with 2 additions and 8 deletions
|
@ -49,14 +49,8 @@ static bool readEntryGui(const QByteArray& data, const char* key, const QVariant
|
||||||
if (data.isEmpty() || data == "invalid") {
|
if (data.isEmpty() || data == "invalid") {
|
||||||
output = QColor(); // return what was stored
|
output = QColor(); // return what was stored
|
||||||
return true;
|
return true;
|
||||||
} else if (data.at(0) == '#') {
|
} else if (data.at(0) == '#' || !data.contains(',')) {
|
||||||
QColor col;
|
QColor col(QString::fromUtf8(data.constData(), data.length()));
|
||||||
col.setNamedColor(QString::fromUtf8(data.constData(), data.length()));
|
|
||||||
output = col;
|
|
||||||
return true;
|
|
||||||
} else if (!data.contains(',')) {
|
|
||||||
QColor col;
|
|
||||||
col.setNamedColor(QString::fromUtf8(data.constData(), data.length()));
|
|
||||||
if (!col.isValid())
|
if (!col.isValid())
|
||||||
kError() << qPrintable(errString);
|
kError() << qPrintable(errString);
|
||||||
output = col;
|
output = col;
|
||||||
|
|
Loading…
Add table
Reference in a new issue