/************************************************************************* * Copyright (C) 2008 by Volker Lanz * * Copyright (C) 2016 by Andrius Štikonas * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 3 of * * the License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see .* *************************************************************************/ #include "util/htmlreport.h" #include "backend/corebackend.h" #include "backend/corebackendmanager.h" #include #include #include #include #include #include #include #include #include QString HtmlReport::tableLine(const QString& label, const QString contents) { QString rval; QTextStream s(&rval); s << "\n" << QStringLiteral("%1\n").arg(QString(label).toHtmlEscaped()) << QStringLiteral("%1\n").arg(QString(contents).toHtmlEscaped()) << "\n"; s.flush(); return rval; } QString HtmlReport::header() { QString rval; QTextStream s(&rval); s << "\n" "\n" "\n" " " << i18n("%1: SMART Status Report", QGuiApplication::applicationDisplayName().toHtmlEscaped()) << "\n" " \n" "\n\n" "\n"; s << "

" << i18n("%1: SMART Status Report", QGuiApplication::applicationDisplayName().toHtmlEscaped()) << "

\n\n"; struct utsname info; uname(&info); const QString unameString = QString::fromLocal8Bit(info.sysname) + QStringLiteral(" ") + QString::fromLocal8Bit(info.nodename) + QStringLiteral(" ") + QString::fromLocal8Bit(info.release) + QStringLiteral(" ") + QString::fromLocal8Bit(info.version) + QStringLiteral(" ") + QString::fromLocal8Bit(info.machine); s << "\n" << tableLine(i18n("Date:"), QLocale().toString(QDateTime::currentDateTime(), QLocale::ShortFormat)) << tableLine(i18n("Program version:"), QCoreApplication::applicationVersion()) << tableLine(i18n("Backend:"), QStringLiteral("%1 (%2)").arg(CoreBackendManager::self()->backend()->id()).arg(CoreBackendManager::self()->backend()->version())) << tableLine(i18n("KDE Frameworks version:"), QStringLiteral(KI18N_VERSION_STRING)) << tableLine(i18n("Machine:"), unameString) << "
\n
\n"; s << "\n"; s.flush(); return rval; } QString HtmlReport::footer() { return QStringLiteral("\n\n\n\n"); }