summaryrefslogtreecommitdiffstats
path: root/kmymoney2/dialogs/kaccountselectdlg.h
blob: 1b106df54516e34b8468cccb93aa0a053e2b8c46 (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
/***************************************************************************
                          kaccountselectdlg.h  -  description
                             -------------------
    begin                : Mon Feb 10 2003
    copyright            : (C) 2000-2003 by Michael Edwardes
    email                : mte@users.sourceforge.net
                           Javier Campos Morales <javi_c@users.sourceforge.net>
                           Felix Rodriguez <frodriguez@users.sourceforge.net>
                           John C <thetacoturtle@users.sourceforge.net>
                           Thomas Baumgart <ipwizard@users.sourceforge.net>
                           Kevin Tambascio <ktambascio@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 KACCOUNTSELECTDLG_H
#define KACCOUNTSELECTDLG_H

// ----------------------------------------------------------------------------
// QT Includes

#include <tqwidget.h>
#include <tqstring.h>

// ----------------------------------------------------------------------------
// KDE Includes

// ----------------------------------------------------------------------------
// Project Includes

#include <kmymoney/kmymoneycombo.h>
#include <kmymoney/mymoneyaccount.h>
#include <kmymoney/kmymoneyutils.h>
#include "../dialogs/kaccountselectdlgdecl.h"

/**
  * @author Thomas Baumgart
  */

class KAccountSelectDlg : public KAccountSelectDlgDecl
{
   Q_OBJECT
  TQ_OBJECT
public:
  KAccountSelectDlg(const KMyMoneyUtils::categoryTypeE type, const TQString& purpose = "General", TQWidget *parent=0, const char *name=0);
  ~KAccountSelectDlg();

  /**
    * This method is used to setup the descriptive text in the account
    * selection dialog box. The @p msg should contain a descriptive
    * text about the purpose of the dialog and it's options.
    *
    * @param msg const reference to TQString object containing the text.
    */
  void setDescription(const TQString& msg);

  /**
    * This method is used to setup the buddy text of the account
    * selection box. the @p msg should contain a short text
    * which is placed above the selection box with the account
    * names.
    *
    * @param msg const reference to TQString object containing the text.
    */
  void setHeader(const TQString& msg);

  /**
    * This method is used to pass information to the account selection
    * dialog which will be used as initial selection in the account
    * selection combo box and during account creation.
    *
    * @param account MyMoneyAccount filled with the relevant and available information
    * @param id account id to be used.
    */
  void setAccount(const MyMoneyAccount& account, const TQString& id);

  /**
    * This method returns the name of the selected account in the combo box.
    *
    * @return TQString containing the id of the selected account
    */
  const TQString& selectedAccount(void) const;

  /**
    * This method is used to set the mode of the dialog. Two modes
    * are supplied: a) select or create and b) create only.
    * If @p mode is 0, select or create is selected, otherwise create only
    * is selected.
    *
    * @param mode selected mode
    */
  void setMode(const int mode);

  /**
    * This method allows to control the visibilty of the abort button
    * in this dialog according to the the parameter @p visible.
    *
    * @param visible @p true shows the abort button, @p false hides it.
    */
  void showAbortButton(const bool visible);

  /**
    * This method is used to determine if the user pressed the 'Skip' or
    * the 'Abort' button. The return value is valid only, if the exec()
    * function of the dialog returns false.
    *
    * @retval false Dialog was left using the 'Skip' button
    * @retval true Dialog was left using the 'Abort' button
    */
  bool aborted(void) const { return m_aborted; };

public slots:
  /**
    * Reimplemented from TQDialog
    */
  int exec();

protected slots:
  /**
    * This slot is used to fire up the new account wizard and preset it
    * with the values found in m_account. If an account was created using
    * the wizard, this will be the selected account.
    */
  void slotCreateAccount(void);

  /**
    * This slot is used to fire up the new institution dialog
    */
  void slotCreateInstitution(void);

  /**
    * This slot is used to react on the abort button
    */
  void abort(void);

  /**
    * This is the slot which will be called if the engine data is changed.
    */
  void slotReloadWidget(void);

private:
  TQString         m_purpose;
  MyMoneyAccount  m_account;
  int             m_mode;       // 0 - select or create, 1 - create only
  KMyMoneyUtils::categoryTypeE   m_accountType;
  bool            m_aborted;
};

#endif