diff --git a/src/common/KReportData.cpp b/src/common/KReportData.cpp
index 74ccf11d..b15f96e3 100644
--- a/src/common/KReportData.cpp
+++ b/src/common/KReportData.cpp
@@ -1,152 +1,142 @@
/* This file is part of the KDE project
* Copyright (C) 2007-2010 by Adam Pigg (adam@piggz.co.uk)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see .
*/
#include "KReportData.h"
#include
class KReportData::SortedField::Private
{
public:
QString field;
Qt::SortOrder order = Qt::AscendingOrder;
};
class KReportData::Private
{
public:
bool dummy = true;
};
//==========KReportData::SortedField==========
KReportData::SortedField::SortedField()
: d(new Private())
{
}
KReportData::SortedField::~SortedField()
{
delete d;
}
KReportData::SortedField & KReportData::SortedField::operator=(const KReportData::SortedField& other)
{
if (this != &other) {
setField(other.field());
setOrder(other.order());
}
return *this;
}
-QString KReportData::SortedField::field()
-{
- return d->field;
-}
-
QString KReportData::SortedField::field() const
{
return d->field;
}
-Qt::SortOrder KReportData::SortedField::order()
-{
- return d->order;
-}
-
Qt::SortOrder KReportData::SortedField::order() const
{
return d->order;
}
void KReportData::SortedField::setField(const QString& field)
{
d->field = field;
}
void KReportData::SortedField::setOrder(Qt::SortOrder order)
{
d->order = order;
}
//==========KReportData==========
KReportData::KReportData() : d(new Private())
{
}
KReportData::~KReportData()
{
delete d;
}
QStringList KReportData::fieldKeys() const
{
return fieldNames();
}
QString KReportData::sourceName() const
{
return QString();
}
QString KReportData::sourceClass() const
{
return QString();
}
void KReportData::setSorting(const QList &sorting)
{
Q_UNUSED(sorting);
}
void KReportData::addExpression(const QString &field, const QVariant &value, char relation)
{
Q_UNUSED(field);
Q_UNUSED(value);
Q_UNUSED(relation);
}
#ifdef KREPORT_SCRIPTING
QStringList KReportData::scriptList() const
{
return QStringList();
}
QString KReportData::scriptCode(const QString &script) const
{
Q_UNUSED(script);
return QString();
}
#endif
QStringList KReportData::dataSources() const
{
return QStringList();
}
QStringList KReportData::dataSourceNames() const
{
return dataSources();
}
KReportData* KReportData::create(const QString &source) const
{
Q_UNUSED(source);
return 0;
}
diff --git a/src/common/KReportData.h b/src/common/KReportData.h
index 460d9202..545495a0 100644
--- a/src/common/KReportData.h
+++ b/src/common/KReportData.h
@@ -1,138 +1,136 @@
/* This file is part of the KDE project
* Copyright (C) 2007-2010 by Adam Pigg (adam@piggz.co.uk)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see .
*/
#ifndef KREPORTDATA_H
#define KREPORTDATA_H
#include
#include
#include "kreport_export.h"
#include "config-kreport.h"
/** @brief Abstraction of report data source
*/
class KREPORT_EXPORT KReportData
{
public:
KReportData();
virtual ~KReportData();
//! Describes sorting for single field
/*! By default the order is ascending. */
class KREPORT_EXPORT SortedField
{
public:
SortedField();
~SortedField();
SortedField& operator=(const SortedField &other);
void setField(const QString &field);
void setOrder(Qt::SortOrder order);
QString field() const;
- QString field();
Qt::SortOrder order() const;
- Qt::SortOrder order();
private:
class Private;
Private * const d;
};
//! Open the dataset
virtual bool open() = 0;
//! Close the dataset
virtual bool close() = 0;
//! Move to the next record
virtual bool moveNext() = 0;
//! Move to the previous record
virtual bool movePrevious() = 0;
//! Move to the first record
virtual bool moveFirst() = 0;
//! Move to the last record
virtual bool moveLast() = 0;
//! Return the current position in the dataset
virtual qint64 at() const = 0;
//! Return the total number of records
virtual qint64 recordCount() const = 0;
//! Return the index number of the field given by nane field
virtual int fieldNumber(const QString &field) const = 0;
//! Return the list of field names
virtual QStringList fieldNames() const = 0;
//! Return the list of field keys. Returns fieldNames() by default
virtual QStringList fieldKeys() const;
//! Return the value of the field at the given position for the current record
virtual QVariant value(unsigned int) const = 0;
//! Return the value of the field fir the given name for the current record
virtual QVariant value(const QString &field) const = 0;
//! Return the name of this source
virtual QString sourceName() const;
//! @return the class name of this source
virtual QString sourceClass() const;
//! Sets the sorting for the data
//! Should be called before open() so that the data source can be edited accordingly
//! Default impl does nothing
virtual void setSorting(const QList &sorting);
//! Adds an expression to the data source
virtual void addExpression(const QString &field, const QVariant &value, char relation = '=');
//! Utility Functions
//! @todo These are probably eligable to be moved into a new class
#ifdef KREPORT_SCRIPTING
//! Allow the reportdata implementation to return a list of possible scripts
virtual QStringList scriptList() const;
//! Allow the reportdata implementation to return some script code based on a specific script name
//! as set in the report
virtual QString scriptCode(const QString& script) const;
#endif
//! Return a list of data sources possible for advanced controls
virtual QStringList dataSources() const;
//! Return a list of data source names possible for advanced controls.
//! Returns dataSources() by default
virtual QStringList dataSourceNames() const;
//! Creates a new instance with data source. Default implementation returns @c nullptr.
//! @a source is implementation-specific identifier.
//! Owner of the returned pointer is the caller.
virtual KReportData* create(const QString &source) const Q_REQUIRED_RESULT;
private:
Q_DISABLE_COPY(KReportData)
class Private;
Private * const d;
};
#endif