File indexing completed on 2024-05-05 05:48:31

0001 /*
0002     CT Month Implementation
0003     --------------------------------------------------------------------
0004     SPDX-FileCopyrightText: 1999 Gary Meyer <gary@meyer.net>
0005     --------------------------------------------------------------------
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #include "ctHelper.h"
0010 
0011 #include <QStringList>
0012 
0013 #include <KLocalizedString>
0014 
0015 QString CTHelper::exportComment(const QString &comment)
0016 {
0017     QString exportComment;
0018 
0019     if (comment.isEmpty()) {
0020         const QString noComment = i18n("No comment");
0021         exportComment += QLatin1String("#") + noComment + QLatin1String("\n");
0022         return exportComment;
0023     }
0024 
0025     const QStringList lines = comment.split(QStringLiteral("\n"));
0026     for (const QString &line : lines) {
0027         exportComment += QLatin1String("#") + line + QLatin1String("\n");
0028     }
0029 
0030     return exportComment;
0031 }