blob: 10e498235f74a5d1eb8c20b86d1ab5ca4fde727f (
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
|
/***************************************************************************
kpayeereassigndlg.cpp
-------------------
copyright : (C) 2005 by Andreas Nicolai
(C) 2007 by Thomas Baumgart
author : Andreas Nicolai, Thomas Baumgart
email : [email protected]
[email protected]
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
// ----------------------------------------------------------------------------
// QT Includes
// ----------------------------------------------------------------------------
// KDE Includes
#include <kdialog.h>
#include <tdelocale.h>
#include <kstdguiitem.h>
#include <kpushbutton.h>
#include <tdemessagebox.h>
// ----------------------------------------------------------------------------
// Project Includes
#include "kpayeereassigndlg.h"
#include <kmymoney/kmymoneycombo.h>
#include <kmymoney/kguiutils.h>
KPayeeReassignDlg::KPayeeReassignDlg( TQWidget* parent, const char* name) :
KPayeeReassignDlgDecl( parent, name)
{
buttonOk->setGuiItem(KStdGuiItem::ok());
buttonCancel->setGuiItem(KStdGuiItem::cancel());
kMandatoryFieldGroup* mandatory = new kMandatoryFieldGroup(TQT_TQOBJECT(this));
mandatory->add(payeeCombo);
mandatory->setOkButton(buttonOk);
}
KPayeeReassignDlg::~KPayeeReassignDlg()
{
}
TQString KPayeeReassignDlg::show(const TQValueList<MyMoneyPayee>& payeeslist)
{
if (payeeslist.isEmpty())
return TQString::null; // no payee available? nothing can be selected...
payeeCombo->loadPayees(payeeslist);
// execute dialog and if aborted, return empty string
if (this->exec() == TQDialog::Rejected)
return TQString::null;
// otherwise return index of selected payee
return payeeCombo->selectedItem();
}
void KPayeeReassignDlg::accept(void)
{
// force update of payeeCombo
buttonOk->setFocus();
if(payeeCombo->selectedItem().isEmpty()) {
KMessageBox::information(this, i18n("This dialog does not allow to create new payees. Please pick a payee from the list."), i18n("Payee creation"));
} else {
KPayeeReassignDlgDecl::accept();
}
}
#include "kpayeereassigndlg.moc"
|