You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.9 KiB
86 lines
2.9 KiB
/***************************************************************************
|
|
kpayeereassigndlg.cpp
|
|
-------------------
|
|
copyright : (C) 2005 by Andreas Nicolai
|
|
(C) 2007 by Thomas Baumgart
|
|
author : Andreas Nicolai, Thomas Baumgart
|
|
email : ghorwin@users.sourceforge.net
|
|
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. *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include <config.h>
|
|
#endif
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// 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(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"
|