From dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 4 Jul 2011 22:38:03 +0000 Subject: Added kmymoney git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmymoney2/dialogs/kgncpricesourcedlg.cpp | 106 +++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 kmymoney2/dialogs/kgncpricesourcedlg.cpp (limited to 'kmymoney2/dialogs/kgncpricesourcedlg.cpp') diff --git a/kmymoney2/dialogs/kgncpricesourcedlg.cpp b/kmymoney2/dialogs/kgncpricesourcedlg.cpp new file mode 100644 index 0000000..2246e01 --- /dev/null +++ b/kmymoney2/dialogs/kgncpricesourcedlg.cpp @@ -0,0 +1,106 @@ +/*************************************************************************** + kgncpricesourcedlg.cpp + ------------------- + copyright : (C) 2005 by Ace Jones + author : Tony Bloomfield + email : tonybloom@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. * + * * + ***************************************************************************/ + +// ---------------------------------------------------------------------------- +// QT Includes +#include +#include +#include +#include +#include +#include + +// ---------------------------------------------------------------------------- +// KDE Includes +#include +#include +#include +#include + +// ---------------------------------------------------------------------------- +// Project Includes +#include "kgncpricesourcedlg.h" +#include "../converter/webpricequote.h" + +KGncPriceSourceDlg::KGncPriceSourceDlg(QWidget *parent, const char *name) + : KGncPriceSourceDlgDecl(parent, name) +{ +} +KGncPriceSourceDlg::KGncPriceSourceDlg(const QString &stockName, const QString &gncSource){ + // signals and slots connections + connect( buttonGroup5, SIGNAL( released(int) ), this, SLOT( buttonPressed(int) ) ); + connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( slotHelp() ) ); + // initialize data fields + textStockName->setText (i18n ("Investment: %1").arg(stockName)); + textGncSource->setText (i18n ("Quote source: %1").arg(gncSource)); + listKnownSource->insertStringList (WebPriceQuote::quoteSources()); + lineUserSource->setText (gncSource); + checkAlwaysUse->setChecked(true); + buttonGroup5->setButton (0); + buttonPressed (0); + return; +} + +KGncPriceSourceDlg::~KGncPriceSourceDlg() +{ +} + +enum ButtonIds {NOSOURCE = 0, KMMSOURCE, USERSOURCE}; + +void KGncPriceSourceDlg::buttonPressed (int buttonId) { + m_currentButton = buttonId; + switch (m_currentButton) { + case NOSOURCE: + listKnownSource->clearSelection(); + listKnownSource->setEnabled (false); + lineUserSource->deselect(); + lineUserSource->setEnabled (false); + break; + case KMMSOURCE: + lineUserSource->deselect (); + lineUserSource->setEnabled (false); + listKnownSource->setEnabled (true); + listKnownSource->setFocus(); + listKnownSource->setSelected (0, true); + break; + case USERSOURCE: + listKnownSource->clearSelection(); + listKnownSource->setEnabled (false); + lineUserSource->setEnabled (true); + lineUserSource->selectAll(); + lineUserSource->setFocus (); + break; + } +} + +QString KGncPriceSourceDlg::selectedSource() const { + QString s; + switch (m_currentButton) { + case NOSOURCE: s = ""; break; + case KMMSOURCE: s = listKnownSource->currentText(); break; + case USERSOURCE: s = lineUserSource->text(); break; + } + return (s); +} + +void KGncPriceSourceDlg::slotHelp(void) +{ + kapp->invokeHelp ("details.impexp.gncquotes"); +} + +#include "kgncpricesourcedlg.moc" + -- cgit v1.2.1