See previous commit
This commit is contained in:
parent
329ea9ef5d
commit
37f03a1da0
|
@ -1,6 +1,6 @@
|
||||||
CREATE TABLE kisscount(db_version VARCHAR(20));
|
CREATE TABLE kisscount(db_version VARCHAR(20));
|
||||||
CREATE TABLE user (id INTEGER PRIMARY KEY, name VARCHAR(255), password VARCHAR(255));
|
CREATE TABLE user (id INTEGER PRIMARY KEY, name VARCHAR(255), password VARCHAR(255));
|
||||||
CREATE TABLE account(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), number VARCHAR(255), shared CHAR(1), blocked CHAR(1), default_account CHAR(1), virtual CHAR(1));
|
CREATE TABLE account(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), number VARCHAR(255), shared CHAR(1), blocked CHAR(1), default_account CHAR(1), virtual CHAR(1), hidden CHAR(1));
|
||||||
CREATE TABLE shared_account(account REFERENCES account(id), user REFERENCES user(id));
|
CREATE TABLE shared_account(account REFERENCES account(id), user REFERENCES user(id));
|
||||||
CREATE TABLE account_amount(id INTEGER PRIMARY KEY, account REFERENCES account(id), year INTEGER, month INTEGER, amount FLOAT);
|
CREATE TABLE account_amount(id INTEGER PRIMARY KEY, account REFERENCES account(id), year INTEGER, month INTEGER, amount FLOAT);
|
||||||
CREATE TABLE operation(id INTEGER PRIMARY KEY, parent REFERENCES operation(id), user REFERENCES user(id), account REFERENCES account(id), year INTEGER, month INTEGER, day INTEGER, amount FLOAT, description VARCHAR(255), category REFERENCES category(id), fix_cost CHAR(1), checked CHAR(1), formula VARCHAR(255), transfert REFERENCES operation(id), meta CHAR(1), virtual CHAR(1));
|
CREATE TABLE operation(id INTEGER PRIMARY KEY, parent REFERENCES operation(id), user REFERENCES user(id), account REFERENCES account(id), year INTEGER, month INTEGER, day INTEGER, amount FLOAT, description VARCHAR(255), category REFERENCES category(id), fix_cost CHAR(1), checked CHAR(1), formula VARCHAR(255), transfert REFERENCES operation(id), meta CHAR(1), virtual CHAR(1));
|
||||||
|
|
|
@ -29,6 +29,7 @@ struct Account {
|
||||||
bool _default;
|
bool _default;
|
||||||
bool is_owner;
|
bool is_owner;
|
||||||
bool _virtual;
|
bool _virtual;
|
||||||
|
bool hidden;
|
||||||
|
|
||||||
bool operator() (const Account& ac1, const Account& ac2) const
|
bool operator() (const Account& ac1, const Account& ac2) const
|
||||||
{
|
{
|
||||||
|
@ -41,6 +42,9 @@ struct Account {
|
||||||
if (!ac1._virtual && ac2._virtual) return true;
|
if (!ac1._virtual && ac2._virtual) return true;
|
||||||
if (ac1._virtual && !ac2._virtual) return false;
|
if (ac1._virtual && !ac2._virtual) return false;
|
||||||
|
|
||||||
|
if (!ac1.hidden && ac2.hidden) return true;
|
||||||
|
if (ac1.hidden && !ac2.hidden) return false;
|
||||||
|
|
||||||
return ac1.name < ac2.name;
|
return ac1.name < ac2.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,6 +233,7 @@ static inline void fillAccount(Account* account, const QSqlRecord& set)
|
||||||
account->_default = set.value("default_account").toBool();
|
account->_default = set.value("default_account").toBool();
|
||||||
account->_virtual = set.value("virtual").toBool();
|
account->_virtual = set.value("virtual").toBool();
|
||||||
account->is_owner = true;
|
account->is_owner = true;
|
||||||
|
account->hidden = set.value("hidden").toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void fillCategory(Category* category, const QSqlRecord& set)
|
static inline void fillCategory(Category* category, const QSqlRecord& set)
|
||||||
|
@ -775,10 +776,10 @@ int Database::AddAccount(User* user, Account& ac)
|
||||||
QString req;
|
QString req;
|
||||||
QSqlQuery query(_db);
|
QSqlQuery query(_db);
|
||||||
|
|
||||||
req = "INSERT INTO account ('user', 'name', 'number', 'shared', 'blocked', 'default_account', 'virtual') VALUES " ;
|
req = "INSERT INTO account ('user', 'name', 'number', 'shared', 'blocked', 'default_account', 'virtual', 'hidden') VALUES " ;
|
||||||
req += "('%1', '%2', '%3', '%4', '%5', '%6', '%7')";
|
req += "('%1', '%2', '%3', '%4', '%5', '%6', '%7', '%8')";
|
||||||
req = req.arg(QString::number(user->_id), ac.name, ac.number, QString::number(ac.shared), QString::number(ac.blocked),
|
req = req.arg(QString::number(user->_id), ac.name, ac.number, QString::number(ac.shared), QString::number(ac.blocked),
|
||||||
QString::number(ac._default), QString::number(ac._virtual));
|
QString::number(ac._default), QString::number(ac._virtual), QString::number(ac.hidden));
|
||||||
|
|
||||||
if (!query.exec(req))
|
if (!query.exec(req))
|
||||||
{
|
{
|
||||||
|
@ -796,9 +797,9 @@ void Database::UpdateAccount(Account& ac)
|
||||||
{
|
{
|
||||||
QString req;
|
QString req;
|
||||||
|
|
||||||
req = "UPDATE account SET name='%1', number='%2', shared='%3', blocked='%4', default_account='%5', virtual='%6' WHERE id='%7'" ;
|
req = "UPDATE account SET name='%1', number='%2', shared='%3', blocked='%4', default_account='%5', virtual='%6', hidden='%7' WHERE id='%8'" ;
|
||||||
req = req.arg(ac.name, ac.number, QString::number(ac.shared), QString::number(ac.blocked), QString::number(ac._default),
|
req = req.arg(ac.name, ac.number, QString::number(ac.shared), QString::number(ac.blocked), QString::number(ac._default),
|
||||||
QString::number(ac._virtual), QString::number(ac.id));
|
QString::number(ac._virtual), QString::number(ac.hidden), QString::number(ac.id));
|
||||||
|
|
||||||
EXECUTE_SQL_UPDATE(req, );
|
EXECUTE_SQL_UPDATE(req, );
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ public:
|
||||||
static const int NOT_CHECKED_OP = (1 << 3);
|
static const int NOT_CHECKED_OP = (1 << 3);
|
||||||
static const int ALL_OP = (~0);
|
static const int ALL_OP = (~0);
|
||||||
|
|
||||||
static const int VERSION = 2;
|
static const int VERSION = 3;
|
||||||
|
|
||||||
Database(const char* filename, KissCount* kiss);
|
Database(const char* filename, KissCount* kiss);
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,23 @@ static void Version_1_to_2(QSqlDatabase& _db)
|
||||||
UPDATE_TABLE("1", "2", "8");
|
UPDATE_TABLE("1", "2", "8");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Version_2_to_3(QSqlDatabase& _db)
|
||||||
|
{
|
||||||
|
QString req ;
|
||||||
|
|
||||||
|
/* Account */
|
||||||
|
req = "ALTER TABLE account ADD hidden CHAR(1)";
|
||||||
|
|
||||||
|
UPDATE_TABLE("2", "3", "1");
|
||||||
|
|
||||||
|
req = "UPDATE account SET hidden='0'";
|
||||||
|
|
||||||
|
UPDATE_TABLE("2", "3", "2");
|
||||||
|
}
|
||||||
|
|
||||||
static update_func updates[] = {
|
static update_func updates[] = {
|
||||||
Version_1_to_2
|
Version_1_to_2,
|
||||||
|
Version_2_to_3
|
||||||
};
|
};
|
||||||
|
|
||||||
void Database::CheckDatabaseVersion()
|
void Database::CheckDatabaseVersion()
|
||||||
|
|
|
@ -454,7 +454,7 @@ void AccountPanel::InitAccountsGrid(User* user, int month, int year)
|
||||||
std::vector<Account>::iterator it;
|
std::vector<Account>::iterator it;
|
||||||
int curLine = 0;
|
int curLine = 0;
|
||||||
double value;
|
double value;
|
||||||
int i, a;
|
int i, nbAccounts;
|
||||||
QTableWidgetItem* item;
|
QTableWidgetItem* item;
|
||||||
QString v;
|
QString v;
|
||||||
DEFAULT_FONT(font);
|
DEFAULT_FONT(font);
|
||||||
|
@ -478,10 +478,24 @@ void AccountPanel::InitAccountsGrid(User* user, int month, int year)
|
||||||
FloatDelegate* floatEditor = new FloatDelegate(_accountsGrid);
|
FloatDelegate* floatEditor = new FloatDelegate(_accountsGrid);
|
||||||
_accountsGrid->setItemDelegateForColumn(ACCOUNT_INIT, floatEditor);
|
_accountsGrid->setItemDelegateForColumn(ACCOUNT_INIT, floatEditor);
|
||||||
|
|
||||||
_accountsGrid->setRowCount(user->_accounts.size());
|
nbAccounts = 0;
|
||||||
|
for (it = user->_accounts.begin(); it != user->_accounts.end(); it++)
|
||||||
for (i=0, it = user->_accounts.begin(); it != user->_accounts.end(); i++, it++, curLine++)
|
|
||||||
{
|
{
|
||||||
|
if (!it->hidden) nbAccounts++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_accountsGrid->setRowCount(nbAccounts);
|
||||||
|
|
||||||
|
for (it = user->_accounts.begin(); it != user->_accounts.end(); it++, curLine++)
|
||||||
|
{
|
||||||
|
if (it->hidden)
|
||||||
|
{
|
||||||
|
value = _kiss->GetAccountAmount(it->id, month, year);
|
||||||
|
_accountsInitValues[it->id] = value;
|
||||||
|
curLine--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (it->shared)
|
if (it->shared)
|
||||||
_accountsGrid->setItem(curLine, ACCOUNT_NUMBER, new QTableWidgetItem(it->number + "*"));
|
_accountsGrid->setItem(curLine, ACCOUNT_NUMBER, new QTableWidgetItem(it->number + "*"));
|
||||||
else
|
else
|
||||||
|
@ -493,12 +507,12 @@ void AccountPanel::InitAccountsGrid(User* user, int month, int year)
|
||||||
_accountsGrid->setItem(curLine, ACCOUNT_INIT, new QTableWidgetItem(v.sprintf("%.2lf", value)));
|
_accountsGrid->setItem(curLine, ACCOUNT_INIT, new QTableWidgetItem(v.sprintf("%.2lf", value)));
|
||||||
_accountsGrid->setItem(curLine, ACCOUNT_CUR, new QTableWidgetItem(""));
|
_accountsGrid->setItem(curLine, ACCOUNT_CUR, new QTableWidgetItem(""));
|
||||||
_accountsGrid->setItem(curLine, ACCOUNT_FINAL, new QTableWidgetItem(""));
|
_accountsGrid->setItem(curLine, ACCOUNT_FINAL, new QTableWidgetItem(""));
|
||||||
for (a=0; a<NUMBER_COLS_ACCOUNTS; a++)
|
for (i=0; i<NUMBER_COLS_ACCOUNTS; i++)
|
||||||
{
|
{
|
||||||
item = _accountsGrid->item(curLine, a);
|
item = _accountsGrid->item(curLine, i);
|
||||||
if (a != ACCOUNT_INIT)
|
if (i != ACCOUNT_INIT)
|
||||||
item->setFlags(item->flags() & ~Qt::ItemIsEditable);
|
item->setFlags(item->flags() & ~Qt::ItemIsEditable);
|
||||||
if (a == ACCOUNT_CUR)
|
if (i == ACCOUNT_CUR)
|
||||||
item->setFont(font);
|
item->setFont(font);
|
||||||
}
|
}
|
||||||
_accountsInitValues[it->id] = value;
|
_accountsInitValues[it->id] = value;
|
||||||
|
@ -736,6 +750,12 @@ void AccountPanel::UpdateStats()
|
||||||
|
|
||||||
for (i=0, accountIt=user->_accounts.begin(); accountIt!=user->_accounts.end(); accountIt++, i++)
|
for (i=0, accountIt=user->_accounts.begin(); accountIt!=user->_accounts.end(); accountIt++, i++)
|
||||||
{
|
{
|
||||||
|
if (accountIt->hidden)
|
||||||
|
{
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (mode != CHECK_MODE)
|
if (mode != CHECK_MODE)
|
||||||
{
|
{
|
||||||
value = _accountsInitValues[accountIt->id];
|
value = _accountsInitValues[accountIt->id];
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "PreferencesPanel.hpp"
|
#include "PreferencesPanel.hpp"
|
||||||
#include "grid/StarDelegate.hpp"
|
#include "grid/StarDelegate.hpp"
|
||||||
|
|
||||||
enum {ACCOUNT_NAME, ACCOUNT_NUMBER, ACCOUNT_DEFAULT, ACCOUNT_VIRTUAL, ACCOUNT_BLOCKED, ACCOUNT_DELETE, NUMBER_COLS_ACCOUNT};
|
enum {ACCOUNT_NAME, ACCOUNT_NUMBER, ACCOUNT_DEFAULT, ACCOUNT_VIRTUAL, ACCOUNT_BLOCKED, ACCOUNT_DELETE, ACCOUNT_HIDDEN, NUMBER_COLS_ACCOUNT};
|
||||||
enum {CATEGORY_NAME, CATEGORY_BACKGROUND_COLOR, CATEGORY_FOREGROUND_COLOR, CATEGORY_FONT, CATEGORY_DELETE, NUMBER_COLS_CATEGORY};
|
enum {CATEGORY_NAME, CATEGORY_BACKGROUND_COLOR, CATEGORY_FOREGROUND_COLOR, CATEGORY_FONT, CATEGORY_DELETE, NUMBER_COLS_CATEGORY};
|
||||||
|
|
||||||
PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _sharedWith(0), _curAccountRow(-1), _defaultSignalMapper(this), _virtualSignalMapper(this), _blockedSignalMapper(this), _deleteAccountSignalMapper(this), _deleteCategorySignalMapper(this), _backgroundColorSignalMapper(this), _foregroundColorSignalMapper(this), _fontSignalMapper(this), _inModification(false)
|
PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _sharedWith(0), _curAccountRow(-1), _defaultSignalMapper(this), _virtualSignalMapper(this), _blockedSignalMapper(this), _deleteAccountSignalMapper(this), _deleteCategorySignalMapper(this), _backgroundColorSignalMapper(this), _foregroundColorSignalMapper(this), _fontSignalMapper(this), _inModification(false)
|
||||||
|
@ -171,6 +171,7 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(ki
|
||||||
connect(&_virtualSignalMapper, SIGNAL(mapped(int)), this, SLOT(OnAccountVirtualClicked(int)));
|
connect(&_virtualSignalMapper, SIGNAL(mapped(int)), this, SLOT(OnAccountVirtualClicked(int)));
|
||||||
connect(&_blockedSignalMapper, SIGNAL(mapped(int)), this, SLOT(OnAccountBlockedClicked(int)));
|
connect(&_blockedSignalMapper, SIGNAL(mapped(int)), this, SLOT(OnAccountBlockedClicked(int)));
|
||||||
connect(&_deleteAccountSignalMapper, SIGNAL(mapped(int)), this, SLOT(OnAccountDeleteClicked(int)));
|
connect(&_deleteAccountSignalMapper, SIGNAL(mapped(int)), this, SLOT(OnAccountDeleteClicked(int)));
|
||||||
|
connect(&_hiddenAccountSignalMapper, SIGNAL(mapped(int)), this, SLOT(OnAccountHiddenClicked(int)));
|
||||||
|
|
||||||
connect(&_deleteCategorySignalMapper, SIGNAL(mapped(int)), this, SLOT(OnCategoryDeleteClicked(int)));
|
connect(&_deleteCategorySignalMapper, SIGNAL(mapped(int)), this, SLOT(OnCategoryDeleteClicked(int)));
|
||||||
connect(&_backgroundColorSignalMapper, SIGNAL(mapped(int)), this, SLOT(OnBackgroundColorClicked(int)));
|
connect(&_backgroundColorSignalMapper, SIGNAL(mapped(int)), this, SLOT(OnBackgroundColorClicked(int)));
|
||||||
|
@ -219,6 +220,7 @@ void PreferencesPanel::InitAccounts(User* user)
|
||||||
_accountsGrid->setHorizontalHeaderItem(ACCOUNT_VIRTUAL, new QTableWidgetItem(_("Virtual")));
|
_accountsGrid->setHorizontalHeaderItem(ACCOUNT_VIRTUAL, new QTableWidgetItem(_("Virtual")));
|
||||||
_accountsGrid->setHorizontalHeaderItem(ACCOUNT_BLOCKED, new QTableWidgetItem(_("Blocked")));
|
_accountsGrid->setHorizontalHeaderItem(ACCOUNT_BLOCKED, new QTableWidgetItem(_("Blocked")));
|
||||||
_accountsGrid->setHorizontalHeaderItem(ACCOUNT_DELETE, new QTableWidgetItem(_("Delete")));
|
_accountsGrid->setHorizontalHeaderItem(ACCOUNT_DELETE, new QTableWidgetItem(_("Delete")));
|
||||||
|
_accountsGrid->setHorizontalHeaderItem(ACCOUNT_HIDDEN, new QTableWidgetItem(_("Hidden")));
|
||||||
|
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
for(int i=0; i<NUMBER_COLS_ACCOUNT; i++)
|
for(int i=0; i<NUMBER_COLS_ACCOUNT; i++)
|
||||||
|
@ -274,6 +276,12 @@ void PreferencesPanel::AddAccount(int line, Account ac)
|
||||||
_accountsGrid->setCellWidget(line, ACCOUNT_DELETE, checkBox);
|
_accountsGrid->setCellWidget(line, ACCOUNT_DELETE, checkBox);
|
||||||
_deleteAccountSignalMapper.setMapping(checkBox, ac.id);
|
_deleteAccountSignalMapper.setMapping(checkBox, ac.id);
|
||||||
connect(checkBox, SIGNAL(stateChanged(int)), &_deleteAccountSignalMapper, SLOT(map()));
|
connect(checkBox, SIGNAL(stateChanged(int)), &_deleteAccountSignalMapper, SLOT(map()));
|
||||||
|
|
||||||
|
checkBox = new QCheckBox();
|
||||||
|
checkBox->setCheckState((ac.hidden) ? Qt::Checked : Qt::Unchecked);
|
||||||
|
_accountsGrid->setCellWidget(line, ACCOUNT_HIDDEN, checkBox);
|
||||||
|
_hiddenAccountSignalMapper.setMapping(checkBox, ac.id);
|
||||||
|
connect(checkBox, SIGNAL(stateChanged(int)), &_hiddenAccountSignalMapper, SLOT(map()));
|
||||||
|
|
||||||
for(int i=0; i<NUMBER_COLS_ACCOUNT; i++)
|
for(int i=0; i<NUMBER_COLS_ACCOUNT; i++)
|
||||||
if (!_accountsGrid->item(line, i))
|
if (!_accountsGrid->item(line, i))
|
||||||
|
@ -290,6 +298,7 @@ void PreferencesPanel::AddAccount(int line, Account ac)
|
||||||
SET_READ_ONLY(line, ACCOUNT_DEFAULT);
|
SET_READ_ONLY(line, ACCOUNT_DEFAULT);
|
||||||
SET_READ_ONLY(line, ACCOUNT_VIRTUAL);
|
SET_READ_ONLY(line, ACCOUNT_VIRTUAL);
|
||||||
SET_READ_ONLY(line, ACCOUNT_BLOCKED);
|
SET_READ_ONLY(line, ACCOUNT_BLOCKED);
|
||||||
|
SET_READ_ONLY(line, ACCOUNT_HIDDEN);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -309,6 +318,7 @@ void PreferencesPanel::AddAccount(int line, Account ac)
|
||||||
SET_READ_ONLY(line, ACCOUNT_VIRTUAL);
|
SET_READ_ONLY(line, ACCOUNT_VIRTUAL);
|
||||||
SET_READ_ONLY(line, ACCOUNT_BLOCKED);
|
SET_READ_ONLY(line, ACCOUNT_BLOCKED);
|
||||||
SET_READ_ONLY(line, ACCOUNT_DELETE);
|
SET_READ_ONLY(line, ACCOUNT_DELETE);
|
||||||
|
SET_READ_ONLY(line, ACCOUNT_HIDDEN);
|
||||||
}
|
}
|
||||||
_accountsGrid->resizeColumnsToContents();
|
_accountsGrid->resizeColumnsToContents();
|
||||||
}
|
}
|
||||||
|
@ -511,6 +521,8 @@ void PreferencesPanel::OnAccountDefaultClicked(int id)
|
||||||
|
|
||||||
account = user->_accounts[row];
|
account = user->_accounts[row];
|
||||||
_inModification = false;
|
_inModification = false;
|
||||||
|
|
||||||
|
_wxUI->NeedReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesPanel::OnAccountVirtualClicked(int id)
|
void PreferencesPanel::OnAccountVirtualClicked(int id)
|
||||||
|
@ -530,6 +542,8 @@ void PreferencesPanel::OnAccountVirtualClicked(int id)
|
||||||
|
|
||||||
account._virtual = (checkBox->checkState() == Qt::Checked);
|
account._virtual = (checkBox->checkState() == Qt::Checked);
|
||||||
_kiss->UpdateAccount(account);
|
_kiss->UpdateAccount(account);
|
||||||
|
|
||||||
|
_wxUI->NeedReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesPanel::OnAccountBlockedClicked(int id)
|
void PreferencesPanel::OnAccountBlockedClicked(int id)
|
||||||
|
@ -549,6 +563,8 @@ void PreferencesPanel::OnAccountBlockedClicked(int id)
|
||||||
|
|
||||||
account.blocked = (checkBox->checkState() == Qt::Checked);
|
account.blocked = (checkBox->checkState() == Qt::Checked);
|
||||||
_kiss->UpdateAccount(account);
|
_kiss->UpdateAccount(account);
|
||||||
|
|
||||||
|
_wxUI->NeedReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesPanel::OnAccountDeleteClicked(int id)
|
void PreferencesPanel::OnAccountDeleteClicked(int id)
|
||||||
|
@ -612,6 +628,27 @@ void PreferencesPanel::OnAccountDeleteClicked(int id)
|
||||||
_wxUI->NeedReload();
|
_wxUI->NeedReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PreferencesPanel::OnAccountHiddenClicked(int id)
|
||||||
|
{
|
||||||
|
User* user = _kiss->GetUser();
|
||||||
|
QCheckBox* checkBox = qobject_cast<QCheckBox*> (_hiddenAccountSignalMapper.mapping(id));
|
||||||
|
std::vector<Account>::iterator it;
|
||||||
|
Account account;
|
||||||
|
int row;
|
||||||
|
|
||||||
|
it = std::find(user->_accounts.begin(), user->_accounts.end(), id);
|
||||||
|
|
||||||
|
if (it == user->_accounts.end()) return ;
|
||||||
|
|
||||||
|
row = it-user->_accounts.begin();
|
||||||
|
account = user->_accounts[row];
|
||||||
|
|
||||||
|
account.hidden = (checkBox->checkState() == Qt::Checked);
|
||||||
|
_kiss->UpdateAccount(account);
|
||||||
|
|
||||||
|
_wxUI->NeedReload();
|
||||||
|
}
|
||||||
|
|
||||||
void PreferencesPanel::OnCategoryDeleteClicked(int id)
|
void PreferencesPanel::OnCategoryDeleteClicked(int id)
|
||||||
{
|
{
|
||||||
QStringList categories;
|
QStringList categories;
|
||||||
|
@ -814,6 +851,7 @@ void PreferencesPanel::OnAccountModified(int row, int col)
|
||||||
new_account.blocked = false;
|
new_account.blocked = false;
|
||||||
new_account.is_owner = true;
|
new_account.is_owner = true;
|
||||||
new_account._virtual = false;
|
new_account._virtual = false;
|
||||||
|
new_account.hidden = false;
|
||||||
|
|
||||||
AddAccount(row, new_account);
|
AddAccount(row, new_account);
|
||||||
_kiss->AddAccount(new_account);
|
_kiss->AddAccount(new_account);
|
||||||
|
|
|
@ -45,6 +45,7 @@ private slots:
|
||||||
void OnAccountVirtualClicked(int id);
|
void OnAccountVirtualClicked(int id);
|
||||||
void OnAccountBlockedClicked(int id);
|
void OnAccountBlockedClicked(int id);
|
||||||
void OnAccountDeleteClicked(int id);
|
void OnAccountDeleteClicked(int id);
|
||||||
|
void OnAccountHiddenClicked(int id);
|
||||||
void OnCategoryDeleteClicked(int id);
|
void OnCategoryDeleteClicked(int id);
|
||||||
void OnBackgroundColorClicked(int id);
|
void OnBackgroundColorClicked(int id);
|
||||||
void OnForegroundClicked(int id);
|
void OnForegroundClicked(int id);
|
||||||
|
@ -68,7 +69,7 @@ private:
|
||||||
QListWidget* _sharedWith;
|
QListWidget* _sharedWith;
|
||||||
int _curAccountRow;
|
int _curAccountRow;
|
||||||
std::map<QString, QString> _sharedOwners;
|
std::map<QString, QString> _sharedOwners;
|
||||||
QSignalMapper _defaultSignalMapper, _virtualSignalMapper, _blockedSignalMapper, _deleteAccountSignalMapper, _deleteCategorySignalMapper, _backgroundColorSignalMapper, _foregroundColorSignalMapper, _fontSignalMapper;
|
QSignalMapper _defaultSignalMapper, _virtualSignalMapper, _blockedSignalMapper, _deleteAccountSignalMapper, _hiddenAccountSignalMapper, _deleteCategorySignalMapper, _backgroundColorSignalMapper, _foregroundColorSignalMapper, _fontSignalMapper;
|
||||||
bool _inModification;
|
bool _inModification;
|
||||||
void InitAccounts(User* user);
|
void InitAccounts(User* user);
|
||||||
void InitCategories(User* user);
|
void InitCategories(User* user);
|
||||||
|
|
|
@ -92,12 +92,26 @@ GridAccount::GridAccount(KissCount* kiss, QWidget *parent,
|
||||||
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
setCellWidget(0, CHECKED, label);
|
setCellWidget(0, CHECKED, label);
|
||||||
|
|
||||||
_accounts = new QString[user->GetAccountsNumber()];
|
_nbAccounts = 0;
|
||||||
|
for (accountIt = user->_accounts.begin();
|
||||||
|
accountIt != user->_accounts.end();
|
||||||
|
accountIt++)
|
||||||
|
{
|
||||||
|
if (!accountIt->hidden)
|
||||||
|
_nbAccounts++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_accounts = new QString[_nbAccounts];
|
||||||
for (i=0,
|
for (i=0,
|
||||||
accountIt = user->_accounts.begin();
|
accountIt = user->_accounts.begin();
|
||||||
accountIt != user->_accounts.end();
|
accountIt != user->_accounts.end();
|
||||||
accountIt++, i++)
|
accountIt++, i++)
|
||||||
_accounts[i] = accountIt->name;
|
{
|
||||||
|
if (!accountIt->hidden)
|
||||||
|
_accounts[i] = accountIt->name;
|
||||||
|
else
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
|
||||||
_categories = new QString[user->GetCategoriesNumber()-1] ;
|
_categories = new QString[user->GetCategoriesNumber()-1] ;
|
||||||
for(i=0, categoryIt = user->_categories.begin()+1;
|
for(i=0, categoryIt = user->_categories.begin()+1;
|
||||||
|
@ -205,7 +219,7 @@ void GridAccount::LoadOperations(std::vector<Operation>* operations, int month,
|
||||||
|
|
||||||
ChoiceDelegate* categoryEditor = new ChoiceDelegate(this, _categories, user->GetCategoriesNumber()-1);
|
ChoiceDelegate* categoryEditor = new ChoiceDelegate(this, _categories, user->GetCategoriesNumber()-1);
|
||||||
setItemDelegateForColumn(CATEGORY, categoryEditor);
|
setItemDelegateForColumn(CATEGORY, categoryEditor);
|
||||||
ChoiceDelegate* accountEditor = new ChoiceDelegate(this, _accounts, user->GetAccountsNumber());
|
ChoiceDelegate* accountEditor = new ChoiceDelegate(this, _accounts, _nbAccounts);
|
||||||
setItemDelegateForColumn(ACCOUNT, accountEditor);
|
setItemDelegateForColumn(ACCOUNT, accountEditor);
|
||||||
|
|
||||||
DateDelegate* dateEditor = new DateDelegate(this, month+1, year);
|
DateDelegate* dateEditor = new DateDelegate(this, month+1, year);
|
||||||
|
|
|
@ -75,6 +75,7 @@ private:
|
||||||
bool _setWeek;
|
bool _setWeek;
|
||||||
bool _databaseSynchronization;
|
bool _databaseSynchronization;
|
||||||
QString* _categories, *_accounts;
|
QString* _categories, *_accounts;
|
||||||
|
int _nbAccounts;
|
||||||
std::vector<Operation>* _operations;
|
std::vector<Operation>* _operations;
|
||||||
bool _loadOperations;
|
bool _loadOperations;
|
||||||
int _curMonth, _curYear;
|
int _curMonth, _curYear;
|
||||||
|
|
|
@ -206,6 +206,7 @@ function toggleOperations(parent, operations)
|
||||||
<?php
|
<?php
|
||||||
foreach($_SESSION["user"]->accounts as $i => $account)
|
foreach($_SESSION["user"]->accounts as $i => $account)
|
||||||
{
|
{
|
||||||
|
if ($accounts["hidden"] == "1") continue;
|
||||||
$val = GetAccountAmount($account["id"], $_SESSION["cur_month"], $_SESSION["cur_year"]);
|
$val = GetAccountAmount($account["id"], $_SESSION["cur_month"], $_SESSION["cur_year"]);
|
||||||
echo "<tr class='bordered'>";
|
echo "<tr class='bordered'>";
|
||||||
if ($account["shared"] == "1")
|
if ($account["shared"] == "1")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user