File indexing completed on 2024-04-28 04:42:12

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
0003  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
0004  * Copyright (C) 2012 by Friedrich W. H. Kossebau (kossebau@kde.org)
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Lesser General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2.1 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0014  * Lesser General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Lesser General Public
0017  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 #ifndef SECTIONEDITOR_H
0021 #define SECTIONEDITOR_H
0022 
0023 #include <QDialog>
0024 #include <QSet>
0025 
0026 #include <ui_KReportSectionEditor.h>
0027 
0028 class KReportDesigner;
0029 class KReportDesignerSectionDetail;
0030 class KReportDesignerSectionDetailGroup;
0031 
0032 class KReportSectionEditor : public QDialog
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037     explicit KReportSectionEditor(KReportDesigner* parent = nullptr);
0038     ~KReportSectionEditor() override;
0039 
0040 private Q_SLOTS:
0041     void cbReportHeader_toggled(bool yes);
0042     void cbReportFooter_toggled(bool yes);
0043     void cbHeadFirst_toggled(bool yes);
0044     void cbHeadLast_toggled(bool yes);
0045     void cbHeadEven_toggled(bool yes);
0046     void cbHeadOdd_toggled(bool yes);
0047     void cbFootFirst_toggled(bool yes);
0048     void cbFootLast_toggled(bool yes);
0049     void cbFootEven_toggled(bool yes);
0050     void cbFootOdd_toggled(bool yes);
0051     void cbHeadAny_toggled(bool yes);
0052     void cbFootAny_toggled(bool yes);
0053 
0054     void btnAdd_clicked();
0055     void btnEdit_clicked();
0056     void btnRemove_clicked();
0057     void btnMoveUp_clicked();
0058     void brnMoveDown_clicked();
0059 
0060     void updateButtonsForItem(QListWidgetItem *currentItem);
0061     void updateButtonsForRow(int row);
0062 
0063 private:
0064     bool editDetailGroup(KReportDesignerSectionDetailGroup *rsdg);
0065     void updateAddButton();
0066 
0067     QString columnName(const QString &column) const;
0068     QSet<QString> groupingColumns() const;
0069 
0070 private:
0071     Ui::SectionEditor m_ui;
0072     QPushButton *m_btnAdd;
0073     QPushButton *m_btnEdit;
0074     QPushButton *m_btnRemove;
0075     QPushButton *m_btnMoveUp;
0076     QPushButton *m_btnMoveDown;
0077 
0078     KReportDesigner *m_reportDesigner;
0079     KReportDesignerSectionDetail *m_reportSectionDetail;
0080 };
0081 
0082 #endif // SECTIONEDITOR_H