Add blocked account (mainly for statistics)

Really fix the previous bug
This commit is contained in:
Grégory Soutadé 2010-11-01 11:34:39 +01:00
parent 7af9f1d9c2
commit 0832e020c4
11 changed files with 220 additions and 130 deletions

View File

@ -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), default_account 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));
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)); 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));

Binary file not shown.

View File

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-10-30 20:31+0200\n" "POT-Creation-Date: 2010-11-01 11:34+0100\n"
"PO-Revision-Date: \n" "PO-Revision-Date: \n"
"Last-Translator: Soutadé <soutade@gmail.com>\n" "Last-Translator: Soutadé <soutade@gmail.com>\n"
"Language-Team: \n" "Language-Team: \n"
@ -20,20 +20,20 @@ msgstr ""
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# #
#: src/view/StatsPanel.cpp:282 #: src/view/StatsPanel.cpp:282
#: src/view/PreferencesPanel.cpp:745 #: src/view/PreferencesPanel.cpp:767
msgid " - " msgid " - "
msgstr " - " msgstr " - "
#: src/view/UsersDialog.cpp:118 #: src/view/UsersDialog.cpp:118
#: src/view/PreferencesPanel.cpp:406 #: src/view/PreferencesPanel.cpp:420
#: src/view/PreferencesPanel.cpp:425 #: src/view/PreferencesPanel.cpp:439
#: src/view/PreferencesPanel.cpp:638 #: src/view/PreferencesPanel.cpp:660
#: src/view/PreferencesPanel.cpp:657 #: src/view/PreferencesPanel.cpp:679
#: src/view/PreferencesPanel.cpp:703 #: src/view/PreferencesPanel.cpp:725
msgid " already exists" msgid " already exists"
msgstr " existe déjà " msgstr " existe déjà "
#: src/view/SearchPanel.cpp:227 #: src/view/SearchPanel.cpp:222
msgid " entries found" msgid " entries found"
msgstr " entrées trouvées" msgstr " entrées trouvées"
@ -41,11 +41,11 @@ msgstr " entrées trouvées"
msgid " not found, aborting" msgid " not found, aborting"
msgstr " non trouvé, arrêt" msgstr " non trouvé, arrêt"
#: src/view/AccountPanel.cpp:709 #: src/view/AccountPanel.cpp:727
msgid " operations ?" msgid " operations ?"
msgstr " opérations ?" msgstr " opérations ?"
#: src/view/PreferencesPanel.cpp:752 #: src/view/PreferencesPanel.cpp:774
msgid " profil ?" msgid " profil ?"
msgstr " profil ?" msgstr " profil ?"
@ -53,7 +53,7 @@ msgstr " profil ?"
msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgid "!! Warning !! If there was a bug, the old database will be suppressed !"
msgstr "!! Attention !! S'il y a eu un bug, l'ancienne base de donnée va être supprimée !" msgstr "!! Attention !! S'il y a eu un bug, l'ancienne base de donnée va être supprimée !"
#: src/view/SearchPanel.cpp:229 #: src/view/SearchPanel.cpp:224
msgid "1 entry found" msgid "1 entry found"
msgstr "1 entrée trouvée" msgstr "1 entrée trouvée"
@ -66,8 +66,8 @@ msgstr "A propos"
msgid "Account" msgid "Account"
msgstr "Compte" msgstr "Compte"
#: src/view/PreferencesPanel.cpp:406 #: src/view/PreferencesPanel.cpp:420
#: src/view/PreferencesPanel.cpp:425 #: src/view/PreferencesPanel.cpp:439
msgid "Account " msgid "Account "
msgstr "Le compte " msgstr "Le compte "
@ -92,25 +92,29 @@ msgstr "Montant min"
msgid "Amount to" msgid "Amount to"
msgstr "Montant max" msgstr "Montant max"
#: src/view/PreferencesPanel.cpp:387 #: src/view/PreferencesPanel.cpp:401
#: src/view/PreferencesPanel.cpp:752 #: src/view/PreferencesPanel.cpp:774
#: src/view/AccountPanel.cpp:704 #: src/view/AccountPanel.cpp:722
msgid "Are you sure want to delete " msgid "Are you sure want to delete "
msgstr "Etes vous sûr de vouloir supprimer " msgstr "Etes vous sûr de vouloir supprimer "
#: src/view/PreferencesPanel.cpp:619 #: src/view/PreferencesPanel.cpp:641
#: src/view/grid/GridAccount.cpp:760 #: src/view/grid/GridAccount.cpp:760
msgid "Are you sure want to delete : \n" msgid "Are you sure want to delete : \n"
msgstr "Etes vous sûr de vouloir supprimer : \n" msgstr "Etes vous sûr de vouloir supprimer : \n"
#: src/view/PreferencesPanel.cpp:308 #: src/view/PreferencesPanel.cpp:315
msgid "Ascending" msgid "Ascending"
msgstr "Croissant" msgstr "Croissant"
#: src/view/PreferencesPanel.cpp:247 #: src/view/PreferencesPanel.cpp:254
msgid "Background color" msgid "Background color"
msgstr "Couleur d'arrière plan" msgstr "Couleur d'arrière plan"
#: src/view/PreferencesPanel.cpp:187
msgid "Blocked"
msgstr "Bloqué"
#: src/view/SearchPanel.cpp:76 #: src/view/SearchPanel.cpp:76
msgid "Both" msgid "Both"
msgstr "Les deux" msgstr "Les deux"
@ -140,8 +144,8 @@ msgstr "Catégories"
msgid "Category" msgid "Category"
msgstr "Catégorie" msgstr "Catégorie"
#: src/view/PreferencesPanel.cpp:638 #: src/view/PreferencesPanel.cpp:660
#: src/view/PreferencesPanel.cpp:657 #: src/view/PreferencesPanel.cpp:679
msgid "Category " msgid "Category "
msgstr "Catégorie" msgstr "Catégorie"
@ -210,13 +214,13 @@ msgstr "Débit"
msgid "Default" msgid "Default"
msgstr "Défaut" msgstr "Défaut"
#: src/view/PreferencesPanel.cpp:187 #: src/view/PreferencesPanel.cpp:188
#: src/view/PreferencesPanel.cpp:250 #: src/view/PreferencesPanel.cpp:257
#: src/view/AccountPanel.cpp:563 #: src/view/AccountPanel.cpp:578
msgid "Delete" msgid "Delete"
msgstr "Supprimer" msgstr "Supprimer"
#: src/view/PreferencesPanel.cpp:309 #: src/view/PreferencesPanel.cpp:316
msgid "Descending" msgid "Descending"
msgstr "Décroissant" msgstr "Décroissant"
@ -231,16 +235,16 @@ msgstr "Description"
#: src/view/SearchPanel.cpp:150 #: src/view/SearchPanel.cpp:150
#: src/view/SearchPanel.cpp:164 #: src/view/SearchPanel.cpp:164
#: src/view/SearchPanel.cpp:175 #: src/view/SearchPanel.cpp:175
#: src/view/PreferencesPanel.cpp:383 #: src/view/PreferencesPanel.cpp:397
#: src/view/PreferencesPanel.cpp:406 #: src/view/PreferencesPanel.cpp:420
#: src/view/PreferencesPanel.cpp:425 #: src/view/PreferencesPanel.cpp:439
#: src/view/PreferencesPanel.cpp:638 #: src/view/PreferencesPanel.cpp:660
#: src/view/PreferencesPanel.cpp:657 #: src/view/PreferencesPanel.cpp:679
#: src/view/PreferencesPanel.cpp:697 #: src/view/PreferencesPanel.cpp:719
#: src/view/PreferencesPanel.cpp:703 #: src/view/PreferencesPanel.cpp:725
#: src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:72
#: src/view/PasswordDialog.cpp:78 #: src/view/PasswordDialog.cpp:78
#: src/view/AccountPanel.cpp:700 #: src/view/AccountPanel.cpp:718
#: src/view/grid/GridAccount.cpp:1144 #: src/view/grid/GridAccount.cpp:1144
#: src/view/grid/GridAccount.cpp:1151 #: src/view/grid/GridAccount.cpp:1151
#: src/view/grid/GridAccount.cpp:1280 #: src/view/grid/GridAccount.cpp:1280
@ -267,16 +271,16 @@ msgstr "Valeur finale"
#: src/view/SearchPanel.cpp:76 #: src/view/SearchPanel.cpp:76
#: src/view/grid/GridAccount.cpp:300 #: src/view/grid/GridAccount.cpp:300
#: src/model/Database.cpp:329 #: src/model/Database.cpp:331
#: src/controller/KissCount.cpp:335 #: src/controller/KissCount.cpp:335
msgid "Fix" msgid "Fix"
msgstr "Fixe" msgstr "Fixe"
#: src/view/PreferencesPanel.cpp:249 #: src/view/PreferencesPanel.cpp:256
msgid "Font" msgid "Font"
msgstr "Police" msgstr "Police"
#: src/view/PreferencesPanel.cpp:248 #: src/view/PreferencesPanel.cpp:255
msgid "Foreground color" msgid "Foreground color"
msgstr "Couleur d'avant plan" msgstr "Couleur d'avant plan"
@ -289,7 +293,7 @@ msgid "From "
msgstr "A partir de " msgstr "A partir de "
#: src/view/GenerateDialog.cpp:31 #: src/view/GenerateDialog.cpp:31
#: src/view/AccountPanel.cpp:560 #: src/view/AccountPanel.cpp:575
msgid "Generate month" msgid "Generate month"
msgstr "Générer mois" msgstr "Générer mois"
@ -329,7 +333,7 @@ msgstr "Intervalle de temps invalide"
msgid "Invalid formula !" msgid "Invalid formula !"
msgstr "Formule invalide !" msgstr "Formule invalide !"
#: src/view/PreferencesPanel.cpp:697 #: src/view/PreferencesPanel.cpp:719
msgid "Invalid name" msgid "Invalid name"
msgstr "Nom invalide" msgstr "Nom invalide"
@ -345,11 +349,11 @@ msgstr "Mot de passe invalide"
msgid "Invalide date range" msgid "Invalide date range"
msgstr "Intervalle de temps invalide" msgstr "Intervalle de temps invalide"
#: src/view/PreferencesPanel.cpp:383 #: src/view/PreferencesPanel.cpp:397
msgid "It must be at least one account !" msgid "It must be at least one account !"
msgstr "Il doit y avoir au moins un compte !" msgstr "Il doit y avoir au moins un compte !"
#: src/view/AccountPanel.cpp:700 #: src/view/AccountPanel.cpp:718
msgid "It must be at least one month !" msgid "It must be at least one month !"
msgstr "Il doit rester au mois un mois" msgstr "Il doit rester au mois un mois"
@ -358,8 +362,8 @@ msgid "Kill me"
msgstr "Kill me" msgstr "Kill me"
#: src/view/StatsPanel.cpp:302 #: src/view/StatsPanel.cpp:302
#: src/view/PreferencesPanel.cpp:737 #: src/view/PreferencesPanel.cpp:759
#: src/view/PreferencesPanel.cpp:740 #: src/view/PreferencesPanel.cpp:762
msgid "KissCount" msgid "KissCount"
msgstr "KissCount" msgstr "KissCount"
@ -367,21 +371,21 @@ msgstr "KissCount"
msgid "Language" msgid "Language"
msgstr "Langue" msgstr "Langue"
#: src/view/PreferencesPanel.cpp:740 #: src/view/PreferencesPanel.cpp:762
msgid "Language not changed" msgid "Language not changed"
msgstr "Langue non changée" msgstr "Langue non changée"
#: src/view/PreferencesPanel.cpp:737 #: src/view/PreferencesPanel.cpp:759
msgid "Language successfully changed, please go to another panel" msgid "Language successfully changed, please go to another panel"
msgstr "Langue changée, allez sur un autre panneau pour rendre le changement effectif" msgstr "Langue changée, allez sur un autre panneau pour rendre le changement effectif"
#: src/view/PreferencesPanel.cpp:71 #: src/view/PreferencesPanel.cpp:71
#: src/view/PreferencesPanel.cpp:184 #: src/view/PreferencesPanel.cpp:184
#: src/view/PreferencesPanel.cpp:246 #: src/view/PreferencesPanel.cpp:253
msgid "Name" msgid "Name"
msgstr "Nom" msgstr "Nom"
#: src/view/PreferencesPanel.cpp:709 #: src/view/PreferencesPanel.cpp:731
msgid "Name changed" msgid "Name changed"
msgstr "Nom changé" msgstr "Nom changé"
@ -402,7 +406,7 @@ msgstr ""
"Aucune base de données trouvée, voulez vous en créer une nouvelle ?\n" "Aucune base de données trouvée, voulez vous en créer une nouvelle ?\n"
"\n" "\n"
#: src/view/SearchPanel.cpp:232 #: src/view/SearchPanel.cpp:227
msgid "No entry found" msgid "No entry found"
msgstr "Pas d'entrée trouvée" msgstr "Pas d'entrée trouvée"
@ -467,8 +471,8 @@ msgstr ""
msgid "Please retype new password" msgid "Please retype new password"
msgstr "Re entrez le mot de passe" msgstr "Re entrez le mot de passe"
#: src/view/PreferencesPanel.cpp:711 #: src/view/PreferencesPanel.cpp:733
#: src/view/PreferencesPanel.cpp:745 #: src/view/PreferencesPanel.cpp:767
#: src/view/ButtonPanel.cpp:72 #: src/view/ButtonPanel.cpp:72
msgid "Preferences" msgid "Preferences"
msgstr "Préférences" msgstr "Préférences"
@ -490,7 +494,7 @@ msgid "Remains"
msgstr "Restant" msgstr "Restant"
#: src/view/SearchPanel.cpp:83 #: src/view/SearchPanel.cpp:83
#: src/view/SearchPanel.cpp:243 #: src/view/SearchPanel.cpp:238
#: src/view/ButtonPanel.cpp:71 #: src/view/ButtonPanel.cpp:71
msgid "Search" msgid "Search"
msgstr "Chercher" msgstr "Chercher"
@ -542,7 +546,7 @@ msgstr "Exceptionnel"
#: src/model/User.cpp:52 #: src/model/User.cpp:52
#: src/model/User.cpp:72 #: src/model/User.cpp:72
#: src/model/User.cpp:112 #: src/model/User.cpp:120
msgid "Unknown" msgid "Unknown"
msgstr "Inconnu" msgstr "Inconnu"
@ -556,7 +560,7 @@ msgstr "Utilisateur"
#: src/view/UsersDialog.cpp:38 #: src/view/UsersDialog.cpp:38
#: src/view/UsersDialog.cpp:118 #: src/view/UsersDialog.cpp:118
#: src/view/PreferencesPanel.cpp:703 #: src/view/PreferencesPanel.cpp:725
msgid "User " msgid "User "
msgstr "Utilisateur" msgstr "Utilisateur"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-10-30 20:52+0200\n" "POT-Creation-Date: 2010-11-01 11:34+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,17 +17,17 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: src/view/StatsPanel.cpp:282 src/view/PreferencesPanel.cpp:745 #: src/view/StatsPanel.cpp:282 src/view/PreferencesPanel.cpp:767
msgid " - " msgid " - "
msgstr "" msgstr ""
#: src/view/UsersDialog.cpp:118 src/view/PreferencesPanel.cpp:406 #: src/view/UsersDialog.cpp:118 src/view/PreferencesPanel.cpp:420
#: src/view/PreferencesPanel.cpp:425 src/view/PreferencesPanel.cpp:638 #: src/view/PreferencesPanel.cpp:439 src/view/PreferencesPanel.cpp:660
#: src/view/PreferencesPanel.cpp:657 src/view/PreferencesPanel.cpp:703 #: src/view/PreferencesPanel.cpp:679 src/view/PreferencesPanel.cpp:725
msgid " already exists" msgid " already exists"
msgstr "" msgstr ""
#: src/view/SearchPanel.cpp:227 #: src/view/SearchPanel.cpp:222
msgid " entries found" msgid " entries found"
msgstr "" msgstr ""
@ -35,11 +35,11 @@ msgstr ""
msgid " not found, aborting" msgid " not found, aborting"
msgstr "" msgstr ""
#: src/view/AccountPanel.cpp:709 #: src/view/AccountPanel.cpp:727
msgid " operations ?" msgid " operations ?"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:752 #: src/view/PreferencesPanel.cpp:774
msgid " profil ?" msgid " profil ?"
msgstr "" msgstr ""
@ -47,7 +47,7 @@ msgstr ""
msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgid "!! Warning !! If there was a bug, the old database will be suppressed !"
msgstr "" msgstr ""
#: src/view/SearchPanel.cpp:229 #: src/view/SearchPanel.cpp:224
msgid "1 entry found" msgid "1 entry found"
msgstr "" msgstr ""
@ -59,7 +59,7 @@ msgstr ""
msgid "Account" msgid "Account"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:406 src/view/PreferencesPanel.cpp:425 #: src/view/PreferencesPanel.cpp:420 src/view/PreferencesPanel.cpp:439
msgid "Account " msgid "Account "
msgstr "" msgstr ""
@ -83,23 +83,27 @@ msgstr ""
msgid "Amount to" msgid "Amount to"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:387 src/view/PreferencesPanel.cpp:752 #: src/view/PreferencesPanel.cpp:401 src/view/PreferencesPanel.cpp:774
#: src/view/AccountPanel.cpp:704 #: src/view/AccountPanel.cpp:722
msgid "Are you sure want to delete " msgid "Are you sure want to delete "
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:619 src/view/grid/GridAccount.cpp:760 #: src/view/PreferencesPanel.cpp:641 src/view/grid/GridAccount.cpp:760
msgid "Are you sure want to delete : \n" msgid "Are you sure want to delete : \n"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:308 #: src/view/PreferencesPanel.cpp:315
msgid "Ascending" msgid "Ascending"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:247 #: src/view/PreferencesPanel.cpp:254
msgid "Background color" msgid "Background color"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:187
msgid "Blocked"
msgstr ""
#: src/view/SearchPanel.cpp:76 #: src/view/SearchPanel.cpp:76
msgid "Both" msgid "Both"
msgstr "" msgstr ""
@ -125,7 +129,7 @@ msgstr ""
msgid "Category" msgid "Category"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:638 src/view/PreferencesPanel.cpp:657 #: src/view/PreferencesPanel.cpp:660 src/view/PreferencesPanel.cpp:679
msgid "Category " msgid "Category "
msgstr "" msgstr ""
@ -193,12 +197,12 @@ msgstr ""
msgid "Default" msgid "Default"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:187 src/view/PreferencesPanel.cpp:250 #: src/view/PreferencesPanel.cpp:188 src/view/PreferencesPanel.cpp:257
#: src/view/AccountPanel.cpp:563 #: src/view/AccountPanel.cpp:578
msgid "Delete" msgid "Delete"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:309 #: src/view/PreferencesPanel.cpp:316
msgid "Descending" msgid "Descending"
msgstr "" msgstr ""
@ -209,11 +213,11 @@ msgstr ""
#: src/view/UsersDialog.cpp:88 src/view/UsersDialog.cpp:118 #: src/view/UsersDialog.cpp:88 src/view/UsersDialog.cpp:118
#: src/view/SearchPanel.cpp:140 src/view/SearchPanel.cpp:150 #: src/view/SearchPanel.cpp:140 src/view/SearchPanel.cpp:150
#: src/view/SearchPanel.cpp:164 src/view/SearchPanel.cpp:175 #: src/view/SearchPanel.cpp:164 src/view/SearchPanel.cpp:175
#: src/view/PreferencesPanel.cpp:383 src/view/PreferencesPanel.cpp:406 #: src/view/PreferencesPanel.cpp:397 src/view/PreferencesPanel.cpp:420
#: src/view/PreferencesPanel.cpp:425 src/view/PreferencesPanel.cpp:638 #: src/view/PreferencesPanel.cpp:439 src/view/PreferencesPanel.cpp:660
#: src/view/PreferencesPanel.cpp:657 src/view/PreferencesPanel.cpp:697 #: src/view/PreferencesPanel.cpp:679 src/view/PreferencesPanel.cpp:719
#: src/view/PreferencesPanel.cpp:703 src/view/PasswordDialog.cpp:72 #: src/view/PreferencesPanel.cpp:725 src/view/PasswordDialog.cpp:72
#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:700 #: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:718
#: src/view/grid/GridAccount.cpp:1144 src/view/grid/GridAccount.cpp:1151 #: src/view/grid/GridAccount.cpp:1144 src/view/grid/GridAccount.cpp:1151
#: src/view/grid/GridAccount.cpp:1280 src/view/grid/GridAccount.cpp:1286 #: src/view/grid/GridAccount.cpp:1280 src/view/grid/GridAccount.cpp:1286
#: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:38 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:38
@ -233,15 +237,15 @@ msgid "Final value"
msgstr "" msgstr ""
#: src/view/SearchPanel.cpp:76 src/view/grid/GridAccount.cpp:300 #: src/view/SearchPanel.cpp:76 src/view/grid/GridAccount.cpp:300
#: src/model/Database.cpp:329 src/controller/KissCount.cpp:335 #: src/model/Database.cpp:331 src/controller/KissCount.cpp:335
msgid "Fix" msgid "Fix"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:249 #: src/view/PreferencesPanel.cpp:256
msgid "Font" msgid "Font"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:248 #: src/view/PreferencesPanel.cpp:255
msgid "Foreground color" msgid "Foreground color"
msgstr "" msgstr ""
@ -253,7 +257,7 @@ msgstr ""
msgid "From " msgid "From "
msgstr "" msgstr ""
#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:560 #: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:575
msgid "Generate month" msgid "Generate month"
msgstr "" msgstr ""
@ -293,7 +297,7 @@ msgstr ""
msgid "Invalid formula !" msgid "Invalid formula !"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:697 #: src/view/PreferencesPanel.cpp:719
msgid "Invalid name" msgid "Invalid name"
msgstr "" msgstr ""
@ -309,11 +313,11 @@ msgstr ""
msgid "Invalide date range" msgid "Invalide date range"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:383 #: src/view/PreferencesPanel.cpp:397
msgid "It must be at least one account !" msgid "It must be at least one account !"
msgstr "" msgstr ""
#: src/view/AccountPanel.cpp:700 #: src/view/AccountPanel.cpp:718
msgid "It must be at least one month !" msgid "It must be at least one month !"
msgstr "" msgstr ""
@ -321,8 +325,8 @@ msgstr ""
msgid "Kill me" msgid "Kill me"
msgstr "" msgstr ""
#: src/view/StatsPanel.cpp:302 src/view/PreferencesPanel.cpp:737 #: src/view/StatsPanel.cpp:302 src/view/PreferencesPanel.cpp:759
#: src/view/PreferencesPanel.cpp:740 #: src/view/PreferencesPanel.cpp:762
msgid "KissCount" msgid "KissCount"
msgstr "" msgstr ""
@ -330,20 +334,20 @@ msgstr ""
msgid "Language" msgid "Language"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:740 #: src/view/PreferencesPanel.cpp:762
msgid "Language not changed" msgid "Language not changed"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:737 #: src/view/PreferencesPanel.cpp:759
msgid "Language successfully changed, please go to another panel" msgid "Language successfully changed, please go to another panel"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:71 src/view/PreferencesPanel.cpp:184 #: src/view/PreferencesPanel.cpp:71 src/view/PreferencesPanel.cpp:184
#: src/view/PreferencesPanel.cpp:246 #: src/view/PreferencesPanel.cpp:253
msgid "Name" msgid "Name"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:709 #: src/view/PreferencesPanel.cpp:731
msgid "Name changed" msgid "Name changed"
msgstr "" msgstr ""
@ -361,7 +365,7 @@ msgid ""
"\n" "\n"
msgstr "" msgstr ""
#: src/view/SearchPanel.cpp:232 #: src/view/SearchPanel.cpp:227
msgid "No entry found" msgid "No entry found"
msgstr "" msgstr ""
@ -419,7 +423,7 @@ msgstr ""
msgid "Please retype new password" msgid "Please retype new password"
msgstr "" msgstr ""
#: src/view/PreferencesPanel.cpp:711 src/view/PreferencesPanel.cpp:745 #: src/view/PreferencesPanel.cpp:733 src/view/PreferencesPanel.cpp:767
#: src/view/ButtonPanel.cpp:72 #: src/view/ButtonPanel.cpp:72
msgid "Preferences" msgid "Preferences"
msgstr "" msgstr ""
@ -440,7 +444,7 @@ msgstr ""
msgid "Remains" msgid "Remains"
msgstr "" msgstr ""
#: src/view/SearchPanel.cpp:83 src/view/SearchPanel.cpp:243 #: src/view/SearchPanel.cpp:83 src/view/SearchPanel.cpp:238
#: src/view/ButtonPanel.cpp:71 #: src/view/ButtonPanel.cpp:71
msgid "Search" msgid "Search"
msgstr "" msgstr ""
@ -486,7 +490,7 @@ msgstr ""
msgid "Unexpected" msgid "Unexpected"
msgstr "" msgstr ""
#: src/model/User.cpp:52 src/model/User.cpp:72 src/model/User.cpp:112 #: src/model/User.cpp:52 src/model/User.cpp:72 src/model/User.cpp:120
msgid "Unknown" msgid "Unknown"
msgstr "" msgstr ""
@ -499,7 +503,7 @@ msgid "User"
msgstr "" msgstr ""
#: src/view/UsersDialog.cpp:38 src/view/UsersDialog.cpp:118 #: src/view/UsersDialog.cpp:38 src/view/UsersDialog.cpp:118
#: src/view/PreferencesPanel.cpp:703 #: src/view/PreferencesPanel.cpp:725
msgid "User " msgid "User "
msgstr "" msgstr ""

View File

@ -30,6 +30,7 @@ public:
wxString name; wxString name;
wxString number; wxString number;
bool shared; bool shared;
bool blocked;
bool _default; bool _default;
bool is_owner; bool is_owner;
}; };

View File

@ -271,6 +271,7 @@ User* Database::LoadUser(const wxString& name)
account.name = set.GetAsString(wxT("name")); account.name = set.GetAsString(wxT("name"));
account.number = set.GetAsString(wxT("number")); account.number = set.GetAsString(wxT("number"));
account.shared = set.GetBool(wxT("shared")); account.shared = set.GetBool(wxT("shared"));
account.blocked = set.GetBool(wxT("blocked"));
account._default = set.GetBool(wxT("default_account")); account._default = set.GetBool(wxT("default_account"));
account.is_owner = true; account.is_owner = true;
user->_accounts.push_back(account); user->_accounts.push_back(account);
@ -287,6 +288,7 @@ User* Database::LoadUser(const wxString& name)
account.name = set.GetAsString(wxT("name")); account.name = set.GetAsString(wxT("name"));
account.number = set.GetAsString(wxT("number")); account.number = set.GetAsString(wxT("number"));
account.shared = set.GetBool(wxT("shared")); account.shared = set.GetBool(wxT("shared"));
account.blocked = set.GetBool(wxT("blocked"));
account._default = set.GetBool(wxT("default_account")); account._default = set.GetBool(wxT("default_account"));
account.is_owner = false; account.is_owner = false;
user->_accounts.push_back(account); user->_accounts.push_back(account);
@ -754,7 +756,7 @@ wxString Database::AddAccount(User* user, Account& ac)
{ {
wxString req; wxString req;
req = wxT("INSERT INTO account ('user', 'name', 'number', 'shared', 'default_account') VALUES ('") ; req = wxT("INSERT INTO account ('user', 'name', 'number', 'shared', 'blocked', 'default_account') VALUES ('") ;
req += user->_id + wxT("'"); req += user->_id + wxT("'");
req += wxT(", '") + ac.name + wxT("'"); req += wxT(", '") + ac.name + wxT("'");
req += wxT(", '") + ac.number + wxT("'"); req += wxT(", '") + ac.number + wxT("'");
@ -762,6 +764,10 @@ wxString Database::AddAccount(User* user, Account& ac)
req += wxT(", '1'") ; req += wxT(", '1'") ;
else else
req += wxT(", '0'") ; req += wxT(", '0'") ;
if (ac.blocked)
req += wxT(", '1'") ;
else
req += wxT(", '0'") ;
if (ac._default) if (ac._default)
req += wxT(", '1'") ; req += wxT(", '1'") ;
else else
@ -783,6 +789,10 @@ void Database::UpdateAccount(Account& ac)
req += wxT(", shared='1'"); req += wxT(", shared='1'");
else else
req += wxT(", shared='0'"); req += wxT(", shared='0'");
if (ac.blocked)
req += wxT(", blocked='1'");
else
req += wxT(", blocked='0'");
if (ac._default) if (ac._default)
req += wxT(", default_account='1'"); req += wxT(", default_account='1'");
else else
@ -1389,7 +1399,7 @@ void Database::GetStats(User* user, const wxString& monthFrom, const wxString& y
std::map<wxString, double>* categories) std::map<wxString, double>* categories)
{ {
wxSQLite3ResultSet set; wxSQLite3ResultSet set;
wxString req; wxString req, req2;
std::vector<Account>::iterator accountIt; std::vector<Account>::iterator accountIt;
std::vector<Category>::iterator categoryIt; std::vector<Category>::iterator categoryIt;
@ -1412,7 +1422,7 @@ void Database::GetStats(User* user, const wxString& monthFrom, const wxString& y
for (categoryIt = user->_categories.begin(); categoryIt != user->_categories.end(); categoryIt++) for (categoryIt = user->_categories.begin(); categoryIt != user->_categories.end(); categoryIt++)
{ {
req = wxT("SELECT SUM(amount) as amount FROM operation WHERE category='") + categoryIt->id + wxT("'"); req = wxT("SELECT SUM(amount) as amount FROM operation AS o1 WHERE category='") + categoryIt->id + wxT("'");
accountIt = user->_accounts.begin(); accountIt = user->_accounts.begin();
req += wxT(" AND (account IN('") + accountIt->id; req += wxT(" AND (account IN('") + accountIt->id;
accountIt++; accountIt++;
@ -1425,17 +1435,31 @@ void Database::GetStats(User* user, const wxString& monthFrom, const wxString& y
req += wxT(" AND (year > '") + yearFrom + wxT("' OR (year == '") + yearFrom + wxT("' AND month >= '") + monthFrom + wxT("'))"); req += wxT(" AND (year > '") + yearFrom + wxT("' OR (year == '") + yearFrom + wxT("' AND month >= '") + monthFrom + wxT("'))");
req += wxT(" AND (year < '") + yearTo + wxT("' OR (year == '") + yearTo + wxT("' AND month <= '") + monthTo + wxT("'))"); req += wxT(" AND (year < '") + yearTo + wxT("' OR (year == '") + yearTo + wxT("' AND month <= '") + monthTo + wxT("'))");
req += wxT(" AND (transfert='' OR transfert IS NULL)");
req += wxT(" AND amount < 0");
req += wxT(" AND meta='0'"); req += wxT(" AND meta='0'");
EXECUTE_SQL_QUERY(req, set, ); req2 = req + wxT(" AND (transfert='' OR transfert IS NULL)");
req2 += wxT(" AND amount < 0");
EXECUTE_SQL_QUERY(req2, set, );
if (set.NextRow()) if (set.NextRow())
{ {
(*categories)[categoryIt->id] = -set.GetDouble(wxT("amount")); (*categories)[categoryIt->id] = -set.GetDouble(wxT("amount"));
} }
set.Finalize(); set.Finalize();
// Transfert on blocked accounts must be computed
req2 = req + wxT(" AND transfert != ''");
req2 = req + wxT(" AND (SELECT blocked FROM account WHERE id=o1.account)");
req2 += wxT(" AND amount > 0");
EXECUTE_SQL_QUERY(req2, set, );
if (set.NextRow())
{
(*categories)[categoryIt->id] += set.GetDouble(wxT("amount"));
}
set.Finalize();
} }
} }
} }

View File

@ -102,6 +102,14 @@ const wxFont User::GetCategoryFont(wxString& catId)
return f; return f;
} }
Account User::GetAccount(const wxString& accountId)
{
std::vector<Account>::iterator it;
for (it=_accounts.begin(); it !=_accounts.end(); it++)
if (it->id == accountId)
return *it;
}
wxString User::GetAccountName(const wxString& accountId) wxString User::GetAccountName(const wxString& accountId)
{ {
std::vector<Account>::iterator it; std::vector<Account>::iterator it;

View File

@ -51,6 +51,7 @@ public:
wxString GetCategoryName(wxString& catId); wxString GetCategoryName(wxString& catId);
wxString GetCategoryId(wxString& catName); wxString GetCategoryId(wxString& catName);
const wxFont GetCategoryFont(wxString& catId); const wxFont GetCategoryFont(wxString& catId);
Account GetAccount(const wxString& accountId);
wxString GetAccountName(const wxString& accountId); wxString GetAccountName(const wxString& accountId);
wxString GetAccountId(wxString& accountName); wxString GetAccountId(wxString& accountName);
int GetCategoriesNumber(); int GetCategoriesNumber();

View File

@ -149,7 +149,7 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*
ChangeUser(); ChangeUser();
//Fit(); Fit();
SetMinSize(wxSize(rect.width-rect.x, rect.height-rect.y-128)); SetMinSize(wxSize(rect.width-rect.x, rect.height-rect.y-128));
SetScrollbars(10, 10, 100/10, 100/10); SetScrollbars(10, 10, 100/10, 100/10);
@ -237,7 +237,7 @@ void AccountPanel::ChangeUser()
else else
_tree.AppendItem(rootNode, wxString::Format(wxT("%d"), it->first)); _tree.AppendItem(rootNode, wxString::Format(wxT("%d"), it->first));
} }
//Fit(); Fit();
if (curYear != -1) if (curYear != -1)
{ {
_tree.SelectItem(curNode, true); _tree.SelectItem(curNode, true);
@ -280,7 +280,7 @@ void AccountPanel::LoadYear(int year, bool showMonth)
} }
_tree.Expand(parentNode); _tree.Expand(parentNode);
//Fit(); Fit();
if (showMonth) if (showMonth)
{ {
_tree.SelectItem(curMonthNode, true); _tree.SelectItem(curMonthNode, true);
@ -356,7 +356,7 @@ void AccountPanel::ShowMonth(int month, int year)
UpdateStats(); UpdateStats();
//Fit(); Fit();
// SetMinSize(GetSize()); // SetMinSize(GetSize());
} }
@ -412,7 +412,8 @@ void AccountPanel::UpdateStats()
unsigned int day; unsigned int day;
bool checkMode = _checkCheckMode->IsChecked(); bool checkMode = _checkCheckMode->IsChecked();
std::map<wxString, double>* notChecked = NULL; std::map<wxString, double>* notChecked = NULL;
Account account;
Operation op;
curCredit = curDebit = totalCredit = totalDebit = percents = 0.0; curCredit = curDebit = totalCredit = totalDebit = percents = 0.0;
@ -436,35 +437,49 @@ void AccountPanel::UpdateStats()
{ {
if (it->meta) continue; if (it->meta) continue;
if (it->amount > 0) op = *it;
// A credit on a blocked account must be considered as a debit
if (op.transfert.Length() && op.amount > 0)
{ {
if (day >= it->day) account = user->GetAccount(op.account);
if (account.blocked)
{ {
if (!it->transfert.Length()) op.amount = -op.amount;
curCredit += it->amount; op.transfert = wxT("");
if (!checkMode || (checkMode && it->checked))
curAccountAmount[it->account] += it->amount;
} }
if (!it->transfert.Length()) }
totalCredit += it->amount;
if (!checkMode || (checkMode && it->checked)) if (op.amount >= 0)
finalAccountAmount[it->account] += it->amount; {
if (day >= op.day)
{
if (!op.transfert.Length())
curCredit += op.amount;
if (!checkMode || (checkMode && op.checked))
curAccountAmount[op.account] += op.amount;
}
if (!op.transfert.Length())
totalCredit += op.amount;
if (!checkMode || (checkMode && op.checked))
finalAccountAmount[op.account] += op.amount;
} }
else else
{ {
if (!it->transfert.Length()) if (!op.transfert.Length())
_categoriesValues[_categoriesIndexes[user->GetCategoryName(it->category)]] += -it->amount ; _categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ;
if (day >= it->day) if (day >= op.day)
{ {
if (!it->transfert.Length()) if (!op.transfert.Length())
curDebit += -it->amount; curDebit += -op.amount;
if (!checkMode || (checkMode && it->checked)) if (!checkMode || (checkMode && op.checked))
curAccountAmount[it->account] += it->amount; curAccountAmount[op.account] += op.amount;
} }
if (!it->transfert.Length()) if (!op.transfert.Length())
totalDebit += -it->amount; totalDebit += -op.amount;
if (!checkMode || (checkMode && it->checked)) if (!checkMode || (checkMode && op.checked))
finalAccountAmount[it->account] += it->amount; finalAccountAmount[op.account] += op.amount;
} }
} }
@ -623,6 +638,7 @@ void AccountPanel::OnTreeChange(wxTreeEvent& event)
} }
inModification = false; inModification = false;
Fit();
} }
void AccountPanel::GetTreeSelection(int* month, int* year) void AccountPanel::GetTreeSelection(int* month, int* year)
@ -682,6 +698,8 @@ void AccountPanel::OnMenuGenerate(wxCommandEvent& event)
GenerateDialog g(_kiss, _wxUI, month, year); GenerateDialog g(_kiss, _wxUI, month, year);
g.ShowModal(); g.ShowModal();
Fit();
} }
void AccountPanel::OnMenuDelete(wxCommandEvent& event) void AccountPanel::OnMenuDelete(wxCommandEvent& event)
@ -736,6 +754,8 @@ void AccountPanel::OnMenuDelete(wxCommandEvent& event)
month = ops[year][0]; month = ops[year][0];
ShowMonth(month, year); ShowMonth(month, year);
} }
Fit();
} }
void AccountPanel::GenerateMonth(int month, int year) void AccountPanel::GenerateMonth(int month, int year)
@ -808,6 +828,8 @@ void AccountPanel::GenerateMonth(int month, int year)
_tree.SelectItem(node, true); _tree.SelectItem(node, true);
ShowMonth(month, year); ShowMonth(month, year);
Fit();
} }
void AccountPanel::OnShow(wxShowEvent& event) void AccountPanel::OnShow(wxShowEvent& event)
@ -816,6 +838,7 @@ void AccountPanel::OnShow(wxShowEvent& event)
_wxUI->SetTitle(_kiss->GetUser()->_name + wxT(" - ") + months[_curMonth] + wxT(" ") + wxString::Format(wxT("%d"), _curYear)); _wxUI->SetTitle(_kiss->GetUser()->_name + wxT(" - ") + months[_curMonth] + wxT(" ") + wxString::Format(wxT("%d"), _curYear));
else else
_wxUI->SetTitle(_kiss->GetUser()->_name); _wxUI->SetTitle(_kiss->GetUser()->_name);
Fit();
} }
void AccountPanel::OnCalendarChange(wxCalendarEvent& event) void AccountPanel::OnCalendarChange(wxCalendarEvent& event)

View File

@ -19,7 +19,7 @@
#include "PreferencesPanel.h" #include "PreferencesPanel.h"
enum {ACCOUNT_NAME, ACCOUNT_NUMBER, ACCOUNT_DEFAULT, ACCOUNT_DELETE, NUMBER_COLS_ACCOUNT}; enum {ACCOUNT_NAME, ACCOUNT_NUMBER, ACCOUNT_DEFAULT, ACCOUNT_BLOCKED, ACCOUNT_DELETE, 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};
enum {CATEGORIES_GRID_ID=1, ACCOUNTS_GRID_ID, NAME_ID, CHANGE_NAME_ID, CHANGE_PASSWORD_ID, KILL_ME_ID, LANGUAGE_ID, enum {CATEGORIES_GRID_ID=1, ACCOUNTS_GRID_ID, NAME_ID, CHANGE_NAME_ID, CHANGE_PASSWORD_ID, KILL_ME_ID, LANGUAGE_ID,
@ -184,6 +184,7 @@ void PreferencesPanel::InitAccounts(User* user)
_accountsGrid->SetColLabelValue(ACCOUNT_NAME, _("Name")); _accountsGrid->SetColLabelValue(ACCOUNT_NAME, _("Name"));
_accountsGrid->SetColLabelValue(ACCOUNT_NUMBER, _("Number")); _accountsGrid->SetColLabelValue(ACCOUNT_NUMBER, _("Number"));
_accountsGrid->SetColLabelValue(ACCOUNT_DEFAULT, _("Default")); _accountsGrid->SetColLabelValue(ACCOUNT_DEFAULT, _("Default"));
_accountsGrid->SetColLabelValue(ACCOUNT_BLOCKED, _("Blocked"));
_accountsGrid->SetColLabelValue(ACCOUNT_DELETE, _("Delete")); _accountsGrid->SetColLabelValue(ACCOUNT_DELETE, _("Delete"));
_accountsGrid->SetDefaultCellFont(font); _accountsGrid->SetDefaultCellFont(font);
@ -200,11 +201,15 @@ void PreferencesPanel::InitAccounts(User* user)
_accountsGrid->SetCellEditor(curLine, ACCOUNT_NUMBER, new wxGridCellStarEditor ()); _accountsGrid->SetCellEditor(curLine, ACCOUNT_NUMBER, new wxGridCellStarEditor ());
_accountsGrid->SetCellRenderer(curLine, ACCOUNT_DEFAULT, new wxGridCellBoolRenderer ()); _accountsGrid->SetCellRenderer(curLine, ACCOUNT_DEFAULT, new wxGridCellBoolRenderer ());
_accountsGrid->SetCellEditor(curLine, ACCOUNT_DEFAULT, new wxGridCellFastBoolEditor ()); _accountsGrid->SetCellEditor(curLine, ACCOUNT_DEFAULT, new wxGridCellFastBoolEditor ());
_accountsGrid->SetCellRenderer(curLine, ACCOUNT_BLOCKED, new wxGridCellBoolRenderer ());
_accountsGrid->SetCellEditor(curLine, ACCOUNT_BLOCKED, new wxGridCellFastBoolEditor ());
_accountsGrid->SetCellRenderer(curLine, ACCOUNT_DELETE, new wxGridCellBoolRenderer ()); _accountsGrid->SetCellRenderer(curLine, ACCOUNT_DELETE, new wxGridCellBoolRenderer ());
_accountsGrid->SetCellEditor(curLine, ACCOUNT_DELETE, new wxGridCellBoolEditor ()); _accountsGrid->SetCellEditor(curLine, ACCOUNT_DELETE, new wxGridCellBoolEditor ());
_accountsGrid->SetCellValue(curLine, ACCOUNT_DEFAULT, (it->_default)?wxT("1"):wxT("0")); _accountsGrid->SetCellValue(curLine, ACCOUNT_DEFAULT, (it->_default)?wxT("1"):wxT("0"));
_accountsGrid->SetCellValue(curLine, ACCOUNT_BLOCKED, (it->blocked)?wxT("1"):wxT("0"));
_accountsGrid->SetCellAlignment(curLine, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE);
_accountsGrid->SetCellAlignment(curLine, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE);
_accountsGrid->SetCellAlignment(curLine, ACCOUNT_BLOCKED, wxALIGN_CENTRE, wxALIGN_CENTRE);
_accountsGrid->SetCellAlignment(curLine, ACCOUNT_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE); _accountsGrid->SetCellAlignment(curLine, ACCOUNT_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE);
if (!it->is_owner) if (!it->is_owner)
@ -212,6 +217,7 @@ void PreferencesPanel::InitAccounts(User* user)
_accountsGrid->SetReadOnly(curLine, ACCOUNT_NAME, true); _accountsGrid->SetReadOnly(curLine, ACCOUNT_NAME, true);
_accountsGrid->SetReadOnly(curLine, ACCOUNT_NUMBER, true); _accountsGrid->SetReadOnly(curLine, ACCOUNT_NUMBER, true);
_accountsGrid->SetReadOnly(curLine, ACCOUNT_DEFAULT, true); _accountsGrid->SetReadOnly(curLine, ACCOUNT_DEFAULT, true);
_accountsGrid->SetReadOnly(curLine, ACCOUNT_BLOCKED, true);
} }
} }
@ -219,6 +225,7 @@ void PreferencesPanel::InitAccounts(User* user)
_accountsGrid->AppendRows(); _accountsGrid->AppendRows();
_accountsGrid->SetReadOnly(curLine, ACCOUNT_DEFAULT, true); _accountsGrid->SetReadOnly(curLine, ACCOUNT_DEFAULT, true);
_accountsGrid->SetReadOnly(curLine, ACCOUNT_BLOCKED, true);
_accountsGrid->SetReadOnly(curLine, ACCOUNT_DELETE, true); _accountsGrid->SetReadOnly(curLine, ACCOUNT_DELETE, true);
} }
@ -349,6 +356,12 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event)
else else
new_account._default = false; new_account._default = false;
value = _accountsGrid->GetCellValue(row, ACCOUNT_BLOCKED);
if (value.Length() && value != wxT("0"))
new_account.blocked = true;
else
new_account.blocked = false;
if (col == ACCOUNT_DEFAULT) if (col == ACCOUNT_DEFAULT)
{ {
new_account.id = user->_accounts[row].id; new_account.id = user->_accounts[row].id;
@ -375,6 +388,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event)
if (user->GetAccountsNumber() && row < user->GetAccountsNumber()) if (user->GetAccountsNumber() && row < user->GetAccountsNumber())
{ {
new_account.id = user->_accounts[row].id; new_account.id = user->_accounts[row].id;
new_account.shared = user->_accounts[row].shared;
if (col == ACCOUNT_DELETE) if (col == ACCOUNT_DELETE)
{ {
@ -427,14 +441,21 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event)
return ; return ;
} }
new_account.shared = false;
new_account.blocked = false;
_accountsGrid->SetCellRenderer(row, ACCOUNT_DEFAULT, new wxGridCellBoolRenderer ()); _accountsGrid->SetCellRenderer(row, ACCOUNT_DEFAULT, new wxGridCellBoolRenderer ());
_accountsGrid->SetCellEditor(row, ACCOUNT_DEFAULT, new wxGridCellFastBoolEditor ()); _accountsGrid->SetCellEditor(row, ACCOUNT_DEFAULT, new wxGridCellFastBoolEditor ());
_accountsGrid->SetCellRenderer(row, ACCOUNT_BLOCKED, new wxGridCellBoolRenderer ());
_accountsGrid->SetCellEditor(row, ACCOUNT_BLOCKED, new wxGridCellFastBoolEditor ());
_accountsGrid->SetCellRenderer(row, ACCOUNT_DELETE, new wxGridCellBoolRenderer ()); _accountsGrid->SetCellRenderer(row, ACCOUNT_DELETE, new wxGridCellBoolRenderer ());
_accountsGrid->SetCellEditor(row, ACCOUNT_DELETE, new wxGridCellBoolEditor ()); _accountsGrid->SetCellEditor(row, ACCOUNT_DELETE, new wxGridCellBoolEditor ());
_accountsGrid->SetCellAlignment(row, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE); _accountsGrid->SetCellAlignment(row, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE);
_accountsGrid->SetCellAlignment(row, ACCOUNT_BLOCKED, wxALIGN_CENTRE, wxALIGN_CENTRE);
_accountsGrid->SetCellAlignment(row, ACCOUNT_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE); _accountsGrid->SetCellAlignment(row, ACCOUNT_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE);
_accountsGrid->SetReadOnly(row, ACCOUNT_DEFAULT, false); _accountsGrid->SetReadOnly(row, ACCOUNT_DEFAULT, false);
_accountsGrid->SetReadOnly(row, ACCOUNT_BLOCKED, false);
_accountsGrid->SetReadOnly(row, ACCOUNT_DELETE, false); _accountsGrid->SetReadOnly(row, ACCOUNT_DELETE, false);
if (!user->GetAccountsNumber()) if (!user->GetAccountsNumber())
@ -447,6 +468,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event)
_accountsGrid->AppendRows(); _accountsGrid->AppendRows();
_accountsGrid->SetReadOnly(row+1, ACCOUNT_DEFAULT, true); _accountsGrid->SetReadOnly(row+1, ACCOUNT_DEFAULT, true);
_accountsGrid->SetReadOnly(row+1, ACCOUNT_BLOCKED, true);
_accountsGrid->SetReadOnly(row+1, ACCOUNT_DELETE, true); _accountsGrid->SetReadOnly(row+1, ACCOUNT_DELETE, true);
_kiss->AddAccount(new_account); _kiss->AddAccount(new_account);

View File

@ -256,6 +256,9 @@ void wxUI::ShowPanel(wxPanel* panel)
panel = _statsPanel; panel = _statsPanel;
} }
_hbox->Detach(_accountPanel);
_accountPanel->Hide();
_needReload = false; _needReload = false;
} }