File indexing completed on 2024-05-12 16:35:25

0001 /* This file is part of the KDE project
0002    Copyright (C) 2012-2013 Jigar Raisinghani <jigarraisinghani@gmail.com>
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 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 // Local
0021 #include "pivotoptions.h"
0022 #include "ui_pivotoptions.h"
0023 
0024 
0025 #include<QtGui>
0026 #include<QListWidgetItem>
0027 #include<QListWidget>
0028 #include<QObject>
0029 
0030 #include <sheets/Sheet.h>
0031 #include <sheets/ui/Selection.h>
0032 
0033 using namespace Calligra::Sheets;
0034 
0035 class PivotOptions::Private
0036 {
0037 public:
0038     Selection *selection;
0039     Ui::PivotOptions mainWidget;
0040     QString function;
0041 };//Private
0042 
0043 PivotOptions::PivotOptions(QWidget* parent,Selection* selection):
0044     KoDialog(parent),
0045     d(new Private)
0046 {
0047    
0048    setButtons(Ok|Cancel);
0049    QWidget* widget = new QWidget;
0050    d->mainWidget.setupUi(widget);
0051    setCaption(i18n("Pivot Options"));
0052    setMainWidget(widget);
0053    d->selection= selection;
0054 //    selectBase();   
0055    enableButton(Ok,true);
0056    d->mainWidget.SelectFunction->addItem("prod");
0057    d->mainWidget.SelectFunction->addItem("devsq");
0058    
0059    connect(this, SIGNAL(okClicked()), this, SLOT(on_Ok_clicked()));   
0060      
0061 }//PivotOptions
0062 
0063 QString PivotOptions::returnFunction()
0064 {
0065     d->function=d->mainWidget.SelectFunction->currentText();
0066     return d->function;
0067   
0068 }//returnFunction
0069 
0070 
0071 /*
0072 void PivotOptions::selectBase()
0073 {
0074     Sheet *const sheet = d->selection->lastSheet();
0075     const QRect range = d->selection->lastRange();
0076 
0077     int r = range.right();
0078     int row = range.top();
0079 
0080     Cell cell;
0081     
0082     QString text;
0083 
0084     int index = 0;
0085     for (int i = range.left(); i <= r; ++i) {
0086         cell = Cell(sheet, i, row);
0087         text = cell.displayText();
0088     
0089     if(text.length() >0)
0090     {
0091            d->mainWidget.BaseItem->addItem(text);
0092        d->mainWidget.BaseField->addItem(text); 
0093       
0094     }
0095     }
0096 }
0097 */
0098 void PivotOptions::on_Ok_clicked()
0099 {
0100   //returnFunction();
0101 }
0102 
0103 PivotOptions::~PivotOptions()
0104 {
0105     delete d;
0106 }//~PivotOptions
0107