1
/***************************************************************************
2
* Copyright (C) 2006 by Niklas Knutsson *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
22
#ifndef TRANSACTION_EDIT_WIDGET_H
23
#define TRANSACTION_EDIT_WIDGET_H
25
#include <qvaluevector.h>
26
#include <knuminput.h>
29
#include <transaction.h>
30
#include <kdialogbase.h>
42
SECURITY_SHARES_AND_QUOTATION,
43
SECURITY_VALUE_AND_SHARES,
44
SECURITY_VALUE_AND_QUOTATION
45
} SecurityValueDefineType;
47
class TransactionEditWidget : public QWidget {
53
TransactionEditWidget(bool auto_edit, bool extra_parameters, int transaction_type, Security *security, SecurityValueDefineType security_value_type, Budget *budg, QWidget *parent = 0, const char *name = 0);
54
void setTransaction(Transaction *trans);
55
void setScheduledTransaction(ScheduledTransaction *strans, const QDate &date);
56
void updateFromAccounts();
57
void updateToAccounts();
58
void updateAccounts();
59
void transactionsReset();
60
void setCurrentToItem(int index);
61
void setCurrentFromItem(int index);
63
int currentFromItem();
64
void focusDescription();
65
QWidget *bottomWidget();
66
void transactionRemoved(Transaction *trans);
67
void transactionAdded(Transaction *trans);
68
void transactionModified(Transaction *trans);
69
bool modifyTransaction(Transaction *trans);
70
Transaction *createTransaction();
73
void setMaxShares(double max);
78
QDict<Transaction> default_values;
80
bool description_changed;
83
bool b_autoedit, b_sec, b_extra;
84
QValueVector<Account*> froms, tos;
85
KLineEdit *descriptionEdit, *commentsEdit, *payeeEdit;
86
KComboBox *fromCombo, *toCombo;
87
KDoubleSpinBox *valueEdit, *sharesEdit, *quotationEdit, *quantityEdit;
88
QPushButton *maxSharesButton;
90
QWidget *bottom_widget;
95
void dateChanged(const QDate&);
99
void descriptionChanged(const QString&);
100
void setDefaultValue();
105
class ValueSpinBox : public KDoubleSpinBox {
111
ValueSpinBox(QWidget *parent = 0, const char *name = 0);
112
ValueSpinBox(double lower, double upper, double step, double value, int precision = 2, QWidget *parent = 0, const char *name = 0);
114
QLineEdit *lineEdit() const;
122
void returnPressed();
126
class TransactionEditDialog : public KDialogBase {
132
TransactionEditDialog(bool extra_parameters, int transaction_type, Security *security, SecurityValueDefineType security_value_type, Budget *budg, QWidget *parent);
133
TransactionEditWidget *editWidget;
141
class MultipleTransactionsEditDialog : public KDialogBase {
147
MultipleTransactionsEditDialog(bool extra_parameters, int transaction_type, Budget *budg, QWidget *parent = 0, const char *name = 0);
148
void setTransaction(Transaction *trans);
149
void setScheduledTransaction(ScheduledTransaction *strans, const QDate &date);
150
void updateAccounts();
151
bool modifyTransaction(Transaction *trans);
153
bool checkAccounts();
156
QCheckBox *descriptionButton, *valueButton, *categoryButton, *dateButton, *payeeButton;
163
QValueVector<Account*> categories;
164
KLineEdit *descriptionEdit, *payeeEdit;
165
KComboBox *categoryCombo;
166
KDoubleSpinBox *valueEdit;