summaryrefslogtreecommitdiffstats
path: root/kmymoney2/dialogs/kgncpricesourcedlg.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 22:38:03 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-04 22:38:03 +0000
commitdadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (patch)
tree99e72842fe687baea16376a147619b6048d7e441 /kmymoney2/dialogs/kgncpricesourcedlg.cpp
downloadkmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.tar.gz
kmymoney-dadc34655c3ab961b0b0b94a10eaaba710f0b5e8.zip
Added kmymoney
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmymoney2/dialogs/kgncpricesourcedlg.cpp')
-rw-r--r--kmymoney2/dialogs/kgncpricesourcedlg.cpp106
1 files changed, 106 insertions, 0 deletions
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 <qlabel.h>
+#include <qlistbox.h>
+#include <qlineedit.h>
+#include <qbuttongroup.h>
+#include <qlayout.h>
+#include <qapplication.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+#include <kapplication.h>
+#include <kurlrequester.h>
+#include <ktextbrowser.h>
+#include <klocale.h>
+
+// ----------------------------------------------------------------------------
+// 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"
+