File indexing completed on 2024-04-28 05:08:20

0001 /***************************************************************************
0002     Copyright (C) 2003-2009 Robby Stephenson <robby@periapsis.org>
0003  ***************************************************************************/
0004 
0005 /***************************************************************************
0006  *                                                                         *
0007  *   This program is free software; you can redistribute it and/or         *
0008  *   modify it under the terms of the GNU General Public License as        *
0009  *   published by the Free Software Foundation; either version 2 of        *
0010  *   the License or (at your option) version 3 or any later version        *
0011  *   accepted by the membership of KDE e.V. (or its successor approved     *
0012  *   by the membership of KDE e.V.), which shall act as a proxy            *
0013  *   defined in Section 14 of version 3 of the license.                    *
0014  *                                                                         *
0015  *   This program is distributed in the hope that it will be useful,       *
0016  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0018  *   GNU General Public License for more details.                          *
0019  *                                                                         *
0020  *   You should have received a copy of the GNU General Public License     *
0021  *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
0022  *                                                                         *
0023  ***************************************************************************/
0024 
0025 #ifndef TELLICO_EXPORTDIALOG_H
0026 #define TELLICO_EXPORTDIALOG_H
0027 
0028 #include "translators/translators.h"
0029 #include "datavectors.h"
0030 
0031 #include <QDialog>
0032 #include <QUrl>
0033 
0034 class QCheckBox;
0035 class QRadioButton;
0036 
0037 namespace Tellico {
0038   namespace Export {
0039     class Exporter;
0040   }
0041 
0042 /**
0043  * @author Robby Stephenson
0044  */
0045 class ExportDialog : public QDialog {
0046 Q_OBJECT
0047 
0048 public:
0049   ExportDialog(Export::Format format, Data::CollPtr coll, QWidget* parent);
0050   ~ExportDialog();
0051 
0052   QString fileFilter();
0053   bool exportURL(const QUrl& url=QUrl()) const;
0054 
0055   static Export::Target exportTarget(Export::Format format);
0056   static bool exportCollection(Data::CollPtr coll, Data::EntryList entries, Export::Format format, const QUrl& url);
0057 
0058 private Q_SLOTS:
0059   void slotSaveOptions();
0060 
0061 private:
0062   static Export::Exporter* exporter(Export::Format format, Data::CollPtr coll);
0063 
0064   void readOptions();
0065 
0066   Export::Format m_format;
0067   Data::CollPtr m_coll;
0068   Export::Exporter* m_exporter;
0069   QCheckBox* m_formatFields;
0070   QCheckBox* m_exportSelected;
0071   QCheckBox* m_exportFields;
0072   QRadioButton* m_encodeUTF8;
0073   QRadioButton* m_encodeLocale;
0074 };
0075 
0076 } // end namespace
0077 #endif