summaryrefslogtreecommitdiffstats
path: root/kmymoney2/dialogs/kimportdlg.h
blob: 9f95c2c651cedc01580879360ab5e5f27494980e (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
/***************************************************************************
                          kimportdlg.h  -  description
                             -------------------
    begin                : Wed May 16 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>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 KIMPORTDLG_H
#define KIMPORTDLG_H

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

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

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

#include <kurl.h>
#include <kcombobox.h>

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

#include "../dialogs/kimportdlgdecl.h"

/**
  * This class is used to import a qif file to an account.
  * It relies upon the TQIF file handling routines in MyMoneyAccount to do
  * the actual writing of TQIF files.
  *
  * It uses the global KConfig object to read and write the application
  * settings.
  *
  * @see MyMoneyAccount
  *
  * @author Felix Rodriguez, Michael Edwardes 2000-2001
  *
  * @short A class to import a qif file to an account.
**/
class KImportDlg : public KImportDlgDecl
{
  Q_OBJECT
  

public:
  /**
    * Standard constructor
    */
  KImportDlg(TQWidget *parent, const char *name = 0);

  /** Standard destructor */
  ~KImportDlg();

  /**
    */
  const TQString filename(void) const { return m_qlineeditFile->text(); };

  /**
    */
  const TQString profile(void) const { return m_profileComboBox->currentText(); };

protected slots:
  /** Called to let the user browse for a TQIF file to import from. */
  void slotBrowse();

  /** Test whether to enable the buttons */
  void slotFileTextChanged(const TQString& text);

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

  void slotOkClicked(void);

  void slotSelectProfile(const TQString& text);

private:
  /**
    * 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 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;

  void readConfig(void);
  void writeConfig(void);
};

#endif