[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/office/pekunia/pekunia
From:       Ruurd Pels <ruurd () tiscali ! nl>
Date:       2005-07-04 22:08:25
Message-ID: 1120514905.044597.16435.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 431656 by ruurd:

Small change, synch with other computer

 M  +53 -29    articleuihelper.cpp  
 M  +9 -0      articleuihelper.h  


--- trunk/playground/office/pekunia/pekunia/articleuihelper.cpp #431655:431656
@@ -29,79 +29,103 @@
 #include "unitobject.h"
 #include "sqlerrordialog.h"
 #include <klistview.h>
+#include <kcombobox.h>
 #include <klocale.h>
 
-ArticleUIHelper::ArticleUIHelper(const Model::Admin& theAdmin)
-  : admin(theAdmin)
-{}
+ArticleUIHelper::ArticleUIHelper(const Admin& theAdmin)
+    : admin(theAdmin)
+  {}
 
 ArticleUIHelper::ArticleUIHelper(const ArticleUIHelper& that)
-  : admin(that.admin)
-{}
+    : admin(that.admin)
+  {}
 
 ArticleUIHelper& ArticleUIHelper::operator=(const ArticleUIHelper& that)
-{
+  {
   admin = that.admin;
   return *this;
-}
+  }
 
 ArticleUIHelper::~ArticleUIHelper()
-{}
+  {}
 
 int ArticleUIHelper::ledgerColumn()
-{
+  {
   return 0;
-}
+  }
 int ArticleUIHelper::codeColumn()
-{
+  {
   return 1;
-}
+  }
 
 int ArticleUIHelper::nameColumn()
-{
+  {
   return 2;
-}
+  }
 
 int ArticleUIHelper::unitColumn()
-{
+  {
   return 3;
-}
+  }
 
 void ArticleUIHelper::setListViewColumns(KListView* listView)
-{
+  {
   listView->addColumn(i18n("Ledger"));
   listView->addColumn(i18n("Code"));
   listView->addColumn(i18n("Name"));
   listView->addColumn(i18n("Unit"));
   listView->setFullWidth(true);
-}
+  }
 
 void ArticleUIHelper::refreshListView(KListView* listView)
-{
-  Model::ArticleDBHelper dbhelper;
-  Model::Database::getInstance().startTransaction();
-  Model::Article::List articlelist = dbhelper.selectAll(admin);
-  Model::Database::getInstance().commit();
+  {
+  ArticleDBHelper dbhelper;
+  Database::getInstance().startTransaction();
+  Article::List articlelist = dbhelper.selectAll(admin);
+  Database::getInstance().commit();
   SqlErrorDialog::view(listView);
 
   listView->clear();
-  Model::Article::Iterator iter;
+  Article::Iterator iter;
   KListViewItem* previtem = 0;
   for (iter = articlelist.begin(); iter != articlelist.end(); ++iter)
-  {
-    Model::Article article = *iter;
+    {
+    Article article = *iter;
     KListViewItem* item = new KListViewItem(listView,
                                             article->getLedger()->getAccount().c_str(),
                                             article->getCode().c_str(),
                                             article->getName().c_str(),
                                             article->getUnit()->getCode().c_str());
     if (previtem != 0)
-    {
+      {
       item->moveItem(previtem);
-    }
+      }
     previtem = item;
     listView->insertItem(item);
+    }
   }
-}
 
+void ArticleUIHelper::setListViewColumns(const Ledger::List& list, KComboBox* comboBox)
+  {
+  comboBox->clear();
+  Ledger::Iterator iter;
+  for (iter = list.begin(); iter != list.end(); ++iter)
+    {
+    Ledger ledger = *iter;
+    comboBox->insertItem(ledger->getAccount());
+    }
+  }
 
+void ArticleUIHelper::refreshListView(const Unit::List& list, KComboBox* comboBox)
+  {
+  comboBox->clear();
+  Unit::Iterator iter;
+  for (iter = list.begin(); iter != list.end(); ++iter)
+    {
+    Unit unit = *iter;
+    comboBox->insertItem(unit->getCode());
+    }
+  }
+
+
+
--- trunk/playground/office/pekunia/pekunia/articleuihelper.h #431655:431656
@@ -21,9 +21,14 @@
 #define ARTICLEUIHELPER_H
 
 #include "admin.h"
+#include "ledger.h"
+#include "unit.h"
 
 class KListView;
+class KComboBox;
 
+using namespace Model;
+
 /**
  * @author R.F. Pels
  */
@@ -42,6 +47,10 @@
 
   void setListViewColumns(KListView* listView);
   void refreshListView(KListView* listView);
+  void setListViewColumns(const Ledger::List& list, KListView* listView);
+  void refreshListView(const Unit::List& list, KListView* listView);
+  void setListViewColumns(const Ledger::List& list, KComboBox* comboBox);
+  void refreshListView(const Unit::List& list, KComboBox* comboBox);
 
 private:
   Model::Admin admin;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic