1 /*************************************************************************** 2 kcategoriesview.cpp - description 3 ------------------- 4 begin : Sun Jan 20 2002 5 copyright : (C) 2000-2002 by Michael Edwardes <mte@users.sourceforge.net> 6 Javier Campos Morales <javi_c@users.sourceforge.net> 7 Felix Rodriguez <frodriguez@users.sourceforge.net> 8 John C <thetacoturtle@users.sourceforge.net> 9 Thomas Baumgart <ipwizard@users.sourceforge.net> 10 Kevin Tambascio <ktambascio@users.sourceforge.net> 11 (C) 2017 by Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> 12 ***************************************************************************/ 13 14 /*************************************************************************** 15 * * 16 * This program is free software; you can redistribute it and/or modify * 17 * it under the terms of the GNU General Public License as published by * 18 * the Free Software Foundation; either version 2 of the License, or * 19 * (at your option) any later version. * 20 * * 21 ***************************************************************************/ 22 23 #ifndef KCATEGORIESVIEW_P_H 24 #define KCATEGORIESVIEW_P_H 25 26 #include "kcategoriesview.h" 27 28 // ---------------------------------------------------------------------------- 29 // QT Includes 30 31 // ---------------------------------------------------------------------------- 32 // KDE Includes 33 34 // ---------------------------------------------------------------------------- 35 // Project Includes 36 37 #include "ui_kcategoriesview.h" 38 #include "kmymoneyaccountsviewbase_p.h" 39 40 #include "accountsviewproxymodel.h" 41 #include "mymoneyaccount.h" 42 #include "icons.h" 43 44 using namespace Icons; 45 46 class KCategoriesViewPrivate : public KMyMoneyAccountsViewBasePrivate 47 { Q_DECLARE_PUBLIC(KCategoriesView)48 Q_DECLARE_PUBLIC(KCategoriesView) 49 50 public: 51 explicit KCategoriesViewPrivate(KCategoriesView *qq) : 52 q_ptr(qq), 53 ui(new Ui::KCategoriesView), 54 m_haveUnusedCategories(false) 55 { 56 } 57 ~KCategoriesViewPrivate()58 ~KCategoriesViewPrivate() 59 { 60 delete ui; 61 } 62 init()63 void init() 64 { 65 Q_Q(KCategoriesView); 66 m_accountTree = &ui->m_accountTree; 67 68 // setup icons for collapse and expand button 69 ui->m_collapseButton->setIcon(Icons::get(Icon::ListCollapse)); 70 ui->m_expandButton->setIcon(Icons::get(Icon::ListExpand)); 71 72 m_proxyModel = ui->m_accountTree->init(View::Categories); 73 74 q->connect(m_proxyModel, &AccountsProxyModel::unusedIncomeExpenseAccountHidden, q, &KCategoriesView::slotUnusedIncomeExpenseAccountHidden); 75 q->connect(ui->m_searchWidget, &QLineEdit::textChanged, m_proxyModel, &QSortFilterProxyModel::setFilterFixedString); 76 q->connect(ui->m_accountTree, &KMyMoneyAccountTreeView::selectByObject, q, &KCategoriesView::selectByObject); 77 q->connect(ui->m_accountTree, &KMyMoneyAccountTreeView::selectByVariant, q, &KCategoriesView::selectByVariant); 78 q->connect(MyMoneyFile::instance(), &MyMoneyFile::dataChanged, q, &KCategoriesView::refresh); 79 } 80 81 KCategoriesView *q_ptr; 82 Ui::KCategoriesView *ui; 83 bool m_haveUnusedCategories; 84 MyMoneyAccount m_currentCategory; 85 }; 86 87 #endif 88