summaryrefslogtreecommitdiffstats
path: root/kmymoney2/dialogs/kmymoneyfileinfodlg.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/kmymoneyfileinfodlg.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/kmymoneyfileinfodlg.cpp')
-rw-r--r--kmymoney2/dialogs/kmymoneyfileinfodlg.cpp92
1 files changed, 92 insertions, 0 deletions
diff --git a/kmymoney2/dialogs/kmymoneyfileinfodlg.cpp b/kmymoney2/dialogs/kmymoneyfileinfodlg.cpp
new file mode 100644
index 0000000..108c776
--- /dev/null
+++ b/kmymoney2/dialogs/kmymoneyfileinfodlg.cpp
@@ -0,0 +1,92 @@
+/***************************************************************************
+ kmymoneyfileinfodlg.cpp - description
+ -------------------
+ begin : Sun Oct 9 2005
+ copyright : (C) 2005 by Thomas Baumgart
+ email : Thomas Baumgart <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. *
+ * *
+ ***************************************************************************/
+
+// ----------------------------------------------------------------------------
+// QT Includes
+
+#include <qlabel.h>
+
+// ----------------------------------------------------------------------------
+// KDE Includes
+
+#include <kpushbutton.h>
+#include <klistview.h>
+
+// ----------------------------------------------------------------------------
+// Project Includes
+
+#include "kmymoneyfileinfodlg.h"
+#include <kmymoney/imymoneystorage.h>
+#include <kmymoney/mymoneyfile.h>
+#include <kmymoney/kmymoneyutils.h>
+
+KMyMoneyFileInfoDlg::KMyMoneyFileInfoDlg(QWidget *parent, const char *name )
+ : KMyMoneyFileInfoDlgDecl(parent, name)
+{
+ // Hide the unused buttons.
+ buttonCancel->hide();
+ buttonHelp->hide();
+
+ // Now fill the fields with data
+ IMyMoneyStorage* storage = MyMoneyFile::instance()->storage();
+
+ m_creationDate->setText(storage->creationDate().toString(Qt::ISODate));
+ m_lastModificationDate->setText(storage->lastModificationDate().toString(Qt::ISODate));
+ m_baseCurrency->setText(storage->value("kmm-baseCurrency"));
+
+ m_payeeCount->setText(QString("%1").arg(storage->payeeList().count()));
+ m_institutionCount->setText(QString("%1").arg(storage->institutionList().count()));
+
+ QValueList<MyMoneyAccount> a_list;
+ storage->accountList(a_list);
+ m_accountCount->setText(QString("%1").arg(a_list.count()));
+
+ QMap<MyMoneyAccount::accountTypeE, int> accountMap;
+ QMap<MyMoneyAccount::accountTypeE, int> accountMapClosed;
+ QValueList<MyMoneyAccount>::const_iterator it_a;
+ for(it_a = a_list.begin(); it_a != a_list.end(); ++it_a) {
+ accountMap[(*it_a).accountType()] = accountMap[(*it_a).accountType()] + 1;
+ accountMapClosed[(*it_a).accountType()] = accountMapClosed[(*it_a).accountType()] + 0;
+ if((*it_a).isClosed())
+ accountMapClosed[(*it_a).accountType()] = accountMapClosed[(*it_a).accountType()] + 1;
+ }
+
+ QMap<MyMoneyAccount::accountTypeE, int>::const_iterator it_m;
+ for(it_m = accountMap.begin(); it_m != accountMap.end(); ++it_m) {
+ new KListViewItem(m_accountView, KMyMoneyUtils::accountTypeToString(it_m.key()), QString("%1").arg(*it_m), QString("%1").arg(accountMapClosed[it_m.key()]));
+ }
+
+
+ MyMoneyTransactionFilter filter;
+ filter.setReportAllSplits(false);
+ m_transactionCount->setText(QString("%1").arg(storage->transactionList(filter).count()));
+ filter.setReportAllSplits(true);
+ m_splitCount->setText(QString("%1").arg(storage->transactionList(filter).count()));
+ m_scheduleCount->setText(QString("%1").arg(storage->scheduleList().count()));
+ MyMoneyPriceList list = storage->priceList();
+ MyMoneyPriceList::const_iterator it_p;
+ int pCount = 0;
+ for(it_p = list.begin(); it_p != list.end(); ++it_p)
+ pCount += (*it_p).count();
+ m_priceCount->setText(QString("%1").arg(pCount));
+}
+
+KMyMoneyFileInfoDlg::~KMyMoneyFileInfoDlg()
+{
+}
+
+#include "kmymoneyfileinfodlg.moc"