summaryrefslogtreecommitdiffstats
path: root/kmymoney2/dialogs/kexportdlg.h
blob: bd8ab8e40d7b56eab229d8efa4847a2f147bf44e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/***************************************************************************
                          kexportdlg.h  -  description
                             -------------------
    begin                : Tue May 22 2001
    copyright            : (C) 2001 by Michael Edwardes
    email                : mte@users.sourceforge.net
                           Javier Campos Morales <javi_c@ctv.es>
                           Felix Rodriguez <frodriguez@mail.wesleyan.edu>
                           Thomas Baumgart <ipwizard@users.sourceforge.net>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef KEXPORTDLG_H
#define KEXPORTDLG_H

// ----------------------------------------------------------------------------
// QT Headers

#include <tqstring.h>
#include <tqcheckbox.h>

// ----------------------------------------------------------------------------
// KDE Headers

#include <kcombobox.h>

// ----------------------------------------------------------------------------
// Project Headers

#include "../widgets/kmymoneydateinput.h"
#include "../dialogs/kexportdlgdecl.h"

/**
  * This class is used to select the required user input to export
  * a specified account to the popular QIF format.
  * It relies upon the QIF file handling routines in MyMoneyQifProfile and
  * MyMoneyQifWriter to do the actual writing of QIF files.
  *
  * It uses the global TDEConfig object to read and write the application
  * settings.
  *
  * @see MyMoneyAccount, MyMoneyQifProfile, MyMoneyQifProfileEditor
  *
  * @author Felix Rodriguez, Michael Edwardes, Thomas Baumgart 2000-2003
  *
  * @short A class to select user data required to export a specified account to the popular QIF format.
  **/
class KExportDlg : public KExportDlgDecl
{
  TQ_OBJECT
  

public:
  KExportDlg(TQWidget *parent);
  ~KExportDlg();

  /**
    * This method returns the filename entered into the edit field
    *
    * @return TQString with filename
    */
  const TQString filename(void) const { return m_qlineeditFile->text(); };

  /**
    * This method returns the account id that has been selected for export
    *
    * @return TQString with account id
    */
  TQString accountId(void) const;

  /**
    * This method returns the name of the profile that has been selected
    * for the export operation
    *
    * @return TQString with profile name
    */
  const TQString profile(void) const { return m_profileComboBox->currentText(); };

  /**
    * This method returns the start date of the export dialog
    */
  const TQDate startDate(void) const { return m_kmymoneydateStart->date(); };

  /**
    * This method returns the end date of the export dialog
    */
  const TQDate endDate(void) const { return m_kmymoneydateEnd->date(); };

  /**
    * This method returns the state of the account checkbox
    */
  bool accountSelected(void) const { return m_qcheckboxAccount->isChecked(); };

  /**
    * This method returns the state of the account checkbox
    */
  bool categorySelected(void) const { return m_qcheckboxCategories->isChecked(); };

protected slots:
  /**
    * Called when the user clicked on the OK button
    */
  void slotOkClicked();

  /**
    * Called when the user needs to browse the filesystem for a QIF file
    */
  void slotBrowse();

  /**
    * Called when the user needs a new profile
    */
  void slotNewProfile(void);

  /**
    * This slot checks whether all data is correct to enable
    * the 'Export' button. The enable state of the 'Export' button
    * is updated appropriately.
    *
    * If the parameter @p account is not empty, then it is assumed
    * a new account is selected and the date fields will be loaded
    * with the date of the first and last transaction within this
    * account.
    *
    * @param account The id of the selected account.
    */
  void checkData(const TQString& account = TQString());

private:
  void readConfig(void);
  void writeConfig(void);

  /**
    * This method loads the available profiles into
    * the combo box. The parameter @p selectLast controls if
    * the last profile used is preset or not. If preset is not
    * selected, the current selection remains. If the currently selected
    * text is not present in the list anymore, the first item will be
    * selected.
    *
    * @param selectLast If true, the last used profile is selected. The
    *                   default is false.
    */
  void loadProfiles(const bool selectLast = false);

  /**
    * This method is used to load the available accounts into the
    * combo box for selection.
    */
  void loadAccounts(void);

  /**
    * This method is used to load an account hierarchy into a string list
    *
    * @param strList Reference to the string list to setup
    * @param id Account id to add
    * @param leadIn constant leadin to be added in front of the account name
    */
  // void addCategories(TQStringList& strList, const TQString& id, const TQString& leadIn) const;

  /**
    * This method is used to return the account id of a given account name
    *
    * @param account name of the account
    * @return the ID of the account will be returned.
    *         See MyMoneyFile::nameToAccount() for details.
    */
  // TQString accountId(const TQString& account) const;

private:
  TQString   m_lastAccount;
};

#endif