File indexing completed on 2024-12-08 04:18:23

0001 /* This file is part of the KDE project
0002    Copyright (C) 2015 by Adam Pigg (adam@piggz.co.uk)
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2.1 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017    Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef KREPORTEXAMPLEDATASOURCE_H
0021 #define KREPORTEXAMPLEDATASOURCE_H
0022 
0023 #include <KReportDataSource>
0024 #ifdef KREPORT_SCRIPTING
0025 #include <KReportScriptSource>
0026 #define KReportExampleDataSource_ExtraInterfaces , public KReportScriptSource
0027 #else
0028 #define KReportExampleDataSource_ExtraInterfaces
0029 #endif
0030 
0031 class KReportExampleDataSource : public KReportDataSource KReportExampleDataSource_ExtraInterfaces
0032 {
0033 public:
0034     KReportExampleDataSource();
0035     ~KReportExampleDataSource() override;
0036     QVariant value(const QString &field) const override;
0037     QVariant value(int) const override;
0038     QStringList fieldNames() const override;
0039     QStringList fieldKeys() const override;
0040     int fieldNumber(const QString &field) const override;
0041     qint64 recordCount() const override;
0042     qint64 at() const override;
0043     bool moveLast() override;
0044     bool moveFirst() override;
0045     bool movePrevious() override;
0046     bool moveNext() override;
0047     bool close() override;
0048     bool open() override;
0049 
0050 #ifdef KREPORT_SCRIPTING
0051     QStringList scriptList() const override;
0052     QString scriptCode(const QString &script) const override;
0053 #endif
0054 
0055     QStringList dataSourceNames() const override;
0056 
0057 private:
0058     struct Data
0059     {
0060         int id;
0061         QString devName;
0062         QString project;
0063         QString country;
0064         QString mobile;
0065         qreal lat;
0066         qreal lon;
0067         QString code;
0068         bool projectLead;
0069     };
0070 
0071     QList<Data> m_testData;
0072     QStringList m_fieldNames;
0073     int m_currentRecord;
0074 };
0075 
0076 #endif // KREPORTEXAMPLEDATASOURCE_H