/*************************************************************************** * Copyright (C) 2006, 2007 by Niklas Knutsson * * nq@altern.org * * * * 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., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef QIF_IMPORT_EXPORT_H #define QIF_IMPORT_EXPORT_H #include #include #include "budget.h" #include #include #include class Budget; class AssetsAccount; class KLineEdit; class KComboBox; class KURLRequester; class QRadioButton; class KListView; struct qif_info { AssetsAccount *current_account; QMap unknown_defs; QMap unknown_defs_pre; bool unhandled; bool unknown; bool had_type, had_type_def, had_account_def; bool account_defined; bool had_transaction; int value_format, date_format, shares_format, price_format, percentage_format; char separator; bool p1, p2, p3, p4, ly; QString opening_balance_str; int accounts, categories, transactions, securities, security_transactions, duplicates, failed_transactions; bool payee_as_description, subcategory_as_description, subcategory_as_category, memo_as_description; int description_priority; }; class ImportQIFDialog : public KWizard { Q_OBJECT protected: Budget *budget; qif_info qi; bool b_extra; KURLRequester *fileEdit; KListView *defsView; KComboBox *defsCombo, *dateFormatCombo, *accountCombo, *descriptionPriorityCombo; KLineEdit *openingBalanceEdit; QRadioButton *payeeAsDescriptionButton, *payeeAsPayeeButton, *memoAsDescriptionButton, *memoAsCommentButton; QRadioButton *subcategoryAsDescriptionButton, *subcategoryAsCategoryButton, *subcategoryIgnoreButton; public: ImportQIFDialog(Budget *budg, QWidget *parent, bool extra_parameters); ~ImportQIFDialog(); protected slots: void next(); void accept(); void onFileChanged(const QString&); void defSelectionChanged(QListViewItem*); void defSelected(int); }; class ExportQIFDialog : public KDialogBase { Q_OBJECT protected: Budget *budget; qif_info qi; bool b_extra; QRadioButton *descriptionAsSubcategoryButton, *descriptionAsPayeeButton, *descriptionAsMemoButton, *descriptionIgnoreButton; KComboBox *accountCombo, *dateFormatCombo, *valueFormatCombo; KURLRequester *fileEdit; public: ExportQIFDialog(Budget *budg, QWidget *parent, bool extra_parameters = false); ~ExportQIFDialog(); protected slots: void slotOk(); void onFileChanged(const QString&); }; void importQIF(QTextStream &fstream, bool test, qif_info &qi, Budget *budget); bool importQIFFile(Budget *budget, QWidget *parent, bool extra_parameters = false); void exportQIF(QTextStream &fstream, qif_info &qi, Budget *budget, bool export_cats = true); bool exportQIFFile(Budget *budget, QWidget *parent, bool extra_parameters = false); #endif