/* 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 2 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --- Copyright (C) 2009 Alexander Rieder */ #include "creatematrixassistant.h" #include #include #include #include #include "cantor_macros.h" #include "backend.h" #include "extension.h" #include "creatematrixdlg.h" CreateMatrixAssistant::CreateMatrixAssistant(QObject* parent, QList args) : Assistant(parent) { Q_UNUSED(args) } CreateMatrixAssistant::~CreateMatrixAssistant() { } void CreateMatrixAssistant::initActions() { setXMLFile("cantor_create_matrix_assistant.rc"); KAction* creatematrix=new KAction(i18n("Create Matrix"), actionCollection()); actionCollection()->addAction("creatematrix_assistant", creatematrix); connect(creatematrix, SIGNAL(triggered()), this, SIGNAL(requested())); } QStringList CreateMatrixAssistant::run(QWidget* parent) { QPointer dlg=new CreateMatrixDlg(parent); QStringList result; if( dlg->exec()) { Cantor::LinearAlgebraExtension::Matrix m; for (int i=0;inumRows();i++) { QStringList row; for(int j=0;jnumCols();j++) row<value(i, j); m<(backend()->extension("LinearAlgebraExtension")); result<createMatrix(m); } delete dlg; return result; } K_EXPORT_CANTOR_PLUGIN(creatematrixassistant, CreateMatrixAssistant)