eqtoolbutton.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Arturo Martin Llado                             *
00003  *   amartin@conetxia.com                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #include <QWidget>
00022 #include <QString>
00023 #include <QFileDialog>
00024 #include <QMap>
00025 #include <QList>
00026 #include <QMenu>
00027 #include <QAction>
00028 
00029 
00030 #include "fixed.h"
00031 #include "empresabase.h"
00032 #include "dbrecord.h"
00033 #include "eqtoolbutton.h"
00034 #include "funcaux.h"
00035 
00037 
00040 EQToolButton::EQToolButton(QWidget *parent) : QWidget(parent) {
00041     _depura("EQToolButton::EQToolButton", 0);
00042       connect (parent, SIGNAL(pintaMenu(QMenu *)), this, SLOT(pintaMenu(QMenu *)));
00043       connect (parent, SIGNAL(trataMenu(QAction *)), this, SLOT(trataMenu(QAction *)));
00044     m_ficha = (Ficha *) parent;
00045     _depura("END EQToolButton::EQToolButton", 0);
00046 }
00047 
00048 
00050 
00052 EQToolButton::~EQToolButton() {
00053     _depura("EQToolButton::~EQToolButton", 0);
00054     _depura("END EQToolButton::~EQToolButton", 0);
00055 }
00056 
00057 
00059 
00062 void EQToolButton::pintaMenu(QMenu *menu) {
00063     _depura("EQToolButton::pintaMenu", 0);
00064     QMenu *ajust = menu->addMenu(tr("Informes Personales"));
00065 
00067      QDir dir(confpr->valor(CONF_DIR_OPENREPORTS));
00068      dir.setFilter(QDir::Files | QDir::NoSymLinks);
00069      dir.setSorting(QDir::Size | QDir::Reversed);
00071      QStringList filters;
00072      filters << "*" + m_ficha->tableName() + "*.rml";
00073      dir.setNameFilters(filters);
00074 
00075 
00076      QFileInfoList list = dir.entryInfoList();
00077      for (int i = 0; i < list.size(); ++i) {
00078          QFileInfo fileInfo = list.at(i);
00079          ajust->addAction(fileInfo.fileName());
00080      }
00081     _depura("END EQToolButton::pintaMenu", 0);
00082 }
00083 
00084 
00086 
00089 void EQToolButton::trataMenu(QAction *action) {
00090     _depura("EQToolButton::trataMenu", 0);
00091 
00093      QDir dir(confpr->valor(CONF_DIR_OPENREPORTS));
00094      dir.setFilter(QDir::Files | QDir::NoSymLinks);
00095      dir.setSorting(QDir::Size | QDir::Reversed);
00097      QStringList filters;
00098      filters << "*" + m_ficha->tableName() + "*.rml";
00099      dir.setNameFilters(filters);
00100 
00101 
00102      QFileInfoList list = dir.entryInfoList();
00103      for (int i = 0; i < list.size(); ++i) {
00104          QFileInfo fileInfo = list.at(i);
00105          if (action->text() == fileInfo.fileName()) {
00106                 m_ficha->generaRML(fileInfo.fileName());
00107                 invocaPDF(fileInfo.fileName().left(fileInfo.fileName().size()-4));
00108          } // end if
00109      }
00110     _depura("END EQToolButton::trataMenu", 0);
00111 }
00112 
00113 
00114 

Generated on Sat Dec 15 00:01:19 2007 for BulmaGes by  doxygen 1.5.1