File indexing completed on 2024-04-21 03:41:45

0001 /*
0002     SPDX-FileCopyrightText: 2006, 2008 Carsten Niehaus <cniehaus@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "rsdialog.h"
0008 
0009 #include <QDialogButtonBox>
0010 #include <QPushButton>
0011 #include <QRegularExpression>
0012 #include <QVBoxLayout>
0013 
0014 #include "kalziumdataobject.h"
0015 #include "kalziumutils.h"
0016 
0017 #include <KHelpClient>
0018 #include <KLocalizedString>
0019 #include <KMessageBox>
0020 
0021 RSDialog::RSDialog(QWidget *parent)
0022     : QDialog(parent)
0023 {
0024     setWindowTitle(i18nc("@title:window", "Risks/Security Phrases"));
0025     auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Close, this);
0026     auto mainWidget = new QWidget(this);
0027     auto mainLayout = new QVBoxLayout(this);
0028     mainLayout->addWidget(mainWidget);
0029     connect(buttonBox, &QDialogButtonBox::rejected, this, &RSDialog::reject);
0030     mainLayout->addWidget(buttonBox);
0031 
0032     createRPhrases();
0033     createSPhrases();
0034 
0035     ui.setupUi(mainWidget);
0036 
0037     connect(ui.filterButton, &QAbstractButton::clicked, this, &RSDialog::filter);
0038     connect(buttonBox, &QDialogButtonBox::helpRequested, this, &RSDialog::slotHelp);
0039 
0040     filter();
0041 }
0042 
0043 void RSDialog::filter()
0044 {
0045     // if the RS sentence starts or ends with a - invalidate it.
0046     // It is probably an user error
0047     if (ui.r_le->text().startsWith('-') || ui.r_le->text().endsWith('-') || ui.s_le->text().startsWith('-') || ui.s_le->text().endsWith('-')) {
0048         invalidPhaseString();
0049         return;
0050     }
0051 
0052     QList<int> r;
0053     QList<int> s;
0054 
0055     // for now only separation by a - is allowed
0056     if (!ui.r_le->text().isEmpty()) {
0057         const QStringList rSplit = ui.r_le->text().split('-');
0058         for (const QString &st : rSplit) {
0059             r << st.toInt();
0060         }
0061     }
0062 
0063     // for now only separation by a - is allowed
0064     if (!ui.s_le->text().isEmpty()) {
0065         const QStringList sSplit = ui.s_le->text().split('-');
0066         for (const QString &st : sSplit) {
0067             s << st.toInt();
0068         }
0069     }
0070 
0071     filterRS(r, s);
0072 }
0073 
0074 void RSDialog::filterRS(const QList<int> &r, const QList<int> &s)
0075 {
0076     QString string(QStringLiteral("<qt>"));
0077 
0078     if (!r.isEmpty()) {
0079         string += QStringLiteral("<h2>") + i18n("R-Phrases:") + QStringLiteral("</h2>");
0080         string += QStringLiteral("<ol>");
0081         for (int i : r) {
0082             string += "<li>" + rphrase(i) + "</li>";
0083         }
0084         string += QStringLiteral("</ol>");
0085     }
0086     if (!s.isEmpty()) {
0087         string += QStringLiteral("<h2>") + i18n("S-Phrases:") + QStringLiteral("</h2>");
0088         string += QStringLiteral("<ol>");
0089         for (int i : s) {
0090             string += "<li>" + sphrase(i) + "</li>";
0091         }
0092         string += QStringLiteral("</ol>");
0093     }
0094     if (s.isEmpty() && r.isEmpty())
0095         string.append("<h2>" + i18n("You asked for no R/S-Phrases.") + "</h2>");
0096 
0097     string.append("</qt>");
0098 
0099     ui.text->setHtml(string);
0100 }
0101 
0102 QString RSDialog::rphrase(int number)
0103 {
0104     QString p;
0105 
0106     QMap<int, QString>::const_iterator i = rphrases_map.constBegin();
0107     while (i != rphrases_map.constEnd()) {
0108         if (i.key() == number) {
0109             return i.value();
0110         }
0111 
0112         ++i;
0113     }
0114 
0115     return p;
0116 }
0117 
0118 QString RSDialog::sphrase(int number)
0119 {
0120     QString p;
0121 
0122     QMap<int, QString>::const_iterator i = sphrases_map.constBegin();
0123     while (i != sphrases_map.constEnd()) {
0124         if (i.key() == number) {
0125             return i.value();
0126         }
0127 
0128         ++i;
0129     }
0130 
0131     return p;
0132 }
0133 
0134 void RSDialog::createSPhrases()
0135 {
0136     QStringList sphrases;
0137     sphrases << i18nc(
0138         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0139         "S1: Keep locked up");
0140     sphrases << i18nc(
0141         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0142         "S2: Keep out of the reach of children");
0143     sphrases << i18nc(
0144         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0145         "S3: Keep in a cool place");
0146     sphrases << i18nc(
0147         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0148         "S4: Keep away from living quarters");
0149     sphrases << i18nc(
0150         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0151         "S5: Keep contents under ... (appropriate liquid to be specified by the manufacturer)");
0152     sphrases << i18nc(
0153         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0154         "S6: Keep under ... (inert gas to be specified by the manufacturer)");
0155     sphrases << i18nc(
0156         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0157         "S7: Keep container tightly closed");
0158     sphrases << i18nc(
0159         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0160         "S8: Keep container dry");
0161     sphrases << i18nc(
0162         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0163         "S9: Keep container in a well-ventilated place");
0164     sphrases << i18nc(
0165         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0166         "S12: Do not keep the container sealed");
0167     sphrases << i18nc(
0168         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0169         "S13: Keep away from food, drink and animal feedingstuffs");
0170     sphrases << i18nc(
0171         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0172         "S14: Keep away from ... ( incompatible materials to be indicated by the manufacturer )");
0173     sphrases << i18nc(
0174         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0175         "S15: Keep away from heat");
0176     sphrases << i18nc(
0177         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0178         "S16: Keep away from sources of ignition - No smoking");
0179     sphrases << i18nc(
0180         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0181         "S17: Keep away from combustible material");
0182     sphrases << i18nc(
0183         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0184         "S18: Handle and open container with care");
0185     sphrases << i18nc(
0186         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0187         "S20: When using do not eat or drink");
0188     sphrases << i18nc(
0189         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0190         "S21: When using do not smoke");
0191     sphrases << i18nc(
0192         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0193         "S22: Do not breathe dust");
0194     sphrases << i18nc(
0195         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0196         "S23: Do not breathe gas/fumes/vapour/spray ( appropriate wording to be specified by the manufacturer )");
0197     sphrases << i18nc(
0198         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0199         "S24: Avoid contact with skin");
0200     sphrases << i18nc(
0201         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0202         "S25: Avoid contact with eyes");
0203     sphrases << i18nc(
0204         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0205         "S26: In case of contact with eyes, rinse immediately with plenty of water and seek medical advice");
0206     sphrases << i18nc(
0207         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0208         "S27: Take off immediately all contaminated clothing");
0209     sphrases << i18nc(
0210         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0211         "S28: After contact with skin, wash immediately with plenty of ... ( to be specified by the manufacturer )");
0212     sphrases << i18nc(
0213         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0214         "S29: Do not empty into drains");
0215     sphrases << i18nc(
0216         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0217         "S30: Never add water to this product");
0218     sphrases << i18nc(
0219         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0220         "S33: Take precautionary measures against static discharges");
0221     sphrases << i18nc(
0222         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0223         "S35: This material and its container must be disposed of in a safe way");
0224     sphrases << i18nc(
0225         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0226         "S36: Wear suitable protective clothing");
0227     sphrases << i18nc(
0228         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0229         "S37: Wear suitable gloves");
0230     sphrases << i18nc(
0231         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0232         "S38: In case of insufficient ventilation wear suitable respiratory equipment");
0233     sphrases << i18nc(
0234         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0235         "S39: Wear eye/face protection");
0236     sphrases << i18nc(
0237         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0238         "S40: To clean the floor and all objects contaminated by this material use ... ( to be specified by the manufacturer )");
0239     sphrases << i18nc(
0240         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0241         "S41: In case of fire and/or explosion do not breathe fumes");
0242     sphrases << i18nc(
0243         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0244         "S42: During fumigation/spraying wear suitable respiratory equipment ( appropriate wording to be specified by the manufacturer )");
0245     sphrases << i18nc(
0246         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0247         "S43: In case of fire use ... ( indicate in the space the precise type of fire-fighting equipment. If water increases the risk add - Never use water "
0248         ")");
0249     sphrases << i18nc(
0250         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0251         "S45: In case of accident or if you feel unwell seek medical advice immediately ( show the label where possible )");
0252     sphrases << i18nc(
0253         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0254         "S46: If swallowed, seek medical advice immediately and show this container or label");
0255     sphrases << i18nc(
0256         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0257         "S47: Keep at temperature not exceeding ... °C ( to be specified by the manufacturer )");
0258     sphrases << i18nc(
0259         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0260         "S48: Keep wet with ... ( appropriate material to be specified by the manufacturer )");
0261     sphrases << i18nc(
0262         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0263         "S49: Keep only in the original container");
0264     sphrases << i18nc(
0265         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0266         "S50: Do not mix with ... ( to be specified by the manufacturer )");
0267     sphrases << i18nc(
0268         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0269         "S51: Use only in well-ventilated areas");
0270     sphrases << i18nc(
0271         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0272         "S52: Not recommended for interior use on large surface areas");
0273     sphrases << i18nc(
0274         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0275         "S53: Avoid exposure - obtain special instructions before use");
0276     sphrases << i18nc(
0277         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0278         "S56: Dispose of this material and its container at hazardous or special waste collection point");
0279     sphrases << i18nc(
0280         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0281         "S57: Use appropriate containment to avoid environmental contamination");
0282     sphrases << i18nc(
0283         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0284         "S59: Refer to manufacturer/supplier for information on recovery/recycling");
0285     sphrases << i18nc(
0286         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0287         "S60: This material and its container must be disposed of as hazardous waste");
0288     sphrases << i18nc(
0289         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0290         "S61: Avoid release to the environment. Refer to special instructions/safety data sheet");
0291     sphrases << i18nc(
0292         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0293         "S62: If swallowed, do not induce vomiting: seek medical advice immediately and show this container or label");
0294     sphrases << i18nc(
0295         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0296         "S63: In case of accident by inhalation: remove casualty to fresh air and keep at rest");
0297     sphrases << i18nc(
0298         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0299         "S64: If swallowed, rinse mouth with water ( only if the person is conscious )");
0300 
0301     QRegularExpression reg("(R|S)(\\d+): (.*)");
0302 
0303     for (const QString &p : std::as_const(sphrases)) {
0304         int number = 0;
0305         QString phrase(QLatin1String(""));
0306         QRegularExpressionMatch match = reg.match(p);
0307 
0308         if (match.hasMatch()) {
0309             const QString part1 = match.captured(2);
0310             const QString part2 = match.captured(3);
0311 
0312             phrase = part2;
0313             number = part1.toInt();
0314         }
0315 
0316         sphrases_map.insert(number, phrase);
0317     }
0318 }
0319 
0320 void RSDialog::createRPhrases()
0321 {
0322     QStringList rphrases;
0323     rphrases << i18nc(
0324         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0325         "R1: Explosive when dry");
0326     rphrases << i18nc(
0327         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0328         "R2: Risk of explosion by shock, friction, fire or other sources of ignition");
0329     rphrases << i18nc(
0330         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0331         "R3: Extreme risk of explosion by shock, friction, fire or other sources of ignition");
0332     rphrases << i18nc(
0333         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0334         "R4: Forms very sensitive explosive metallic compounds");
0335     rphrases << i18nc(
0336         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0337         "R5: Heating may cause an explosion");
0338     rphrases << i18nc(
0339         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0340         "R6: Explosive with or without contact with air");
0341     rphrases << i18nc(
0342         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0343         "R7: May cause fire");
0344     rphrases << i18nc(
0345         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0346         "R8: Contact with combustible material may cause fire");
0347     rphrases << i18nc(
0348         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0349         "R9: Explosive when mixed with combustible material");
0350     rphrases << i18nc(
0351         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0352         "R10: Flammable");
0353     rphrases << i18nc(
0354         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0355         "R11: Highly flammable");
0356     rphrases << i18nc(
0357         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0358         "R12: Extremely flammable");
0359     rphrases << i18nc(
0360         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0361         "R14: Reacts violently with water");
0362     rphrases << i18nc(
0363         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0364         "R15: Contact with water liberates extremely flammable gases");
0365     rphrases << i18nc(
0366         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0367         "R16: Explosive when mixed with oxidising substances");
0368     rphrases << i18nc(
0369         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0370         "R17: Spontaneously flammable in air");
0371     rphrases << i18nc(
0372         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0373         "R18: In use, may form flammable/explosive vapour-air mixture");
0374     rphrases << i18nc(
0375         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0376         "R19: May form explosive peroxides");
0377     rphrases << i18nc(
0378         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0379         "R20: Harmful by inhalation");
0380     rphrases << i18nc(
0381         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0382         "R21: Harmful in contact with skin");
0383     rphrases << i18nc(
0384         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0385         "R22: Harmful if swallowed");
0386     rphrases << i18nc(
0387         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0388         "R23: Toxic by inhalation");
0389     rphrases << i18nc(
0390         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0391         "R24: Toxic in contact with skin");
0392     rphrases << i18nc(
0393         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0394         "R25: Toxic if swallowed");
0395     rphrases << i18nc(
0396         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0397         "R26: Very toxic by inhalation");
0398     rphrases << i18nc(
0399         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0400         "R27: Very toxic in contact with skin");
0401     rphrases << i18nc(
0402         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0403         "R28: Very toxic if swallowed");
0404     rphrases << i18nc(
0405         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0406         "R29: Contact with water liberates toxic gas.");
0407     rphrases << i18nc(
0408         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0409         "R30: Can become highly flammable in use");
0410     rphrases << i18nc(
0411         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0412         "R31: Contact with acids liberates toxic gas");
0413     rphrases << i18nc(
0414         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0415         "R32: Contact with acids liberates very toxic gas");
0416     rphrases << i18nc(
0417         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0418         "R33: Danger of cumulative effects");
0419     rphrases << i18nc(
0420         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0421         "R34: Causes burns");
0422     rphrases << i18nc(
0423         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0424         "R35: Causes severe burns");
0425     rphrases << i18nc(
0426         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0427         "R36: Irritating to eyes");
0428     rphrases << i18nc(
0429         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0430         "R37: Irritating to respiratory system");
0431     rphrases << i18nc(
0432         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0433         "R38: Irritating to skin");
0434     rphrases << i18nc(
0435         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0436         "R39: Danger of very serious irreversible effects");
0437     rphrases << i18nc(
0438         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0439         "R40: Limited evidence of a carcinogenic effect");
0440     rphrases << i18nc(
0441         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0442         "R41: Risk of serious damage to eyes");
0443     rphrases << i18nc(
0444         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0445         "R42: May cause sensitisation by inhalation");
0446     rphrases << i18nc(
0447         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0448         "R43: May cause sensitisation by skin contact");
0449     rphrases << i18nc(
0450         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0451         "R44: Risk of explosion if heated under confinement");
0452     rphrases << i18nc(
0453         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0454         "R45: May cause cancer");
0455     rphrases << i18nc(
0456         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0457         "R46: May cause heritable genetic damage");
0458     rphrases << i18nc(
0459         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0460         "R48: Danger of serious damage to health by prolonged exposure");
0461     rphrases << i18nc(
0462         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0463         "R49: May cause cancer by inhalation");
0464     rphrases << i18nc(
0465         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0466         "R50: Very toxic to aquatic organisms");
0467     rphrases << i18nc(
0468         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0469         "R51: Toxic to aquatic organisms");
0470     rphrases << i18nc(
0471         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0472         "R52: Harmful to aquatic organisms");
0473     rphrases << i18nc(
0474         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0475         "R53: May cause long-term adverse effects in the aquatic environment");
0476     rphrases << i18nc(
0477         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0478         "R54: Toxic to flora");
0479     rphrases << i18nc(
0480         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0481         "R55: Toxic to fauna");
0482     rphrases << i18nc(
0483         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0484         "R56: Toxic to soil organisms");
0485     rphrases << i18nc(
0486         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0487         "R57: Toxic to bees");
0488     rphrases << i18nc(
0489         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0490         "R58: May cause long-term adverse effects in the environment");
0491     rphrases << i18nc(
0492         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0493         "R59: Dangerous for the ozone layer");
0494     rphrases << i18nc(
0495         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0496         "R60: May impair fertility");
0497     rphrases << i18nc(
0498         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0499         "R61: May cause harm to the unborn child");
0500     rphrases << i18nc(
0501         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0502         "R62: Possible risk of impaired fertility");
0503     rphrases << i18nc(
0504         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0505         "R63: Possible risk of harm to the unborn child");
0506     rphrases << i18nc(
0507         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0508         "R64: May cause harm to breast-fed babies");
0509     rphrases << i18nc(
0510         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0511         "R65: Harmful: may cause lung damage if swallowed");
0512     rphrases << i18nc(
0513         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0514         "R66: Repeated exposure may cause skin dryness or cracking");
0515     rphrases << i18nc(
0516         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0517         "R67: Vapours may cause drowsiness and dizziness");
0518     rphrases << i18nc(
0519         "Please take the official translations! You find them here: https://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32001L0059:EN:HTML",
0520         "R68: Possible risk of irreversible effects");
0521 
0522     QRegularExpression reg("(R|S)(\\d+): (.*)");
0523 
0524     for (const QString &p : std::as_const(rphrases)) {
0525         int number = 0;
0526         QString phrase(QLatin1String(""));
0527         QRegularExpressionMatch match = reg.match(p);
0528 
0529         if (match.hasMatch()) {
0530             const QString part1 = match.captured(2);
0531             const QString part2 = match.captured(3);
0532 
0533             phrase = part2;
0534             number = part1.toInt();
0535         }
0536 
0537         rphrases_map.insert(number, phrase);
0538     }
0539 }
0540 
0541 void RSDialog::slotHelp()
0542 {
0543     KHelpClient::invokeHelp(QStringLiteral("tools.html#rs_phrases"), QStringLiteral("kalzium"));
0544 }
0545 
0546 void RSDialog::invalidPhaseString()
0547 {
0548     KMessageBox::error(nullptr, i18n("At least one of the specified phrases is invalid."));
0549 }
0550 
0551 #include "moc_rsdialog.cpp"