From 16e90b8fc0e27379d0f5e24e7f79fe2419202126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 20 Feb 2011 14:22:31 +0100 Subject: [PATCH] Database is now at ~/.kisscount/kc.bdd --- ChangeLog | 1 + init.sql | 2 +- ressources/po/french.mo | Bin 7825 -> 7924 bytes ressources/po/french.po | 100 +++++++++++++++++++++--------------- ressources/po/kisscount.pot | 87 ++++++++++++++++++------------- src/model/Database.cpp | 37 +++++++++---- src/model/Database.h | 7 ++- src/view/SearchPanel.cpp | 3 +- src/view/StatsPanel.cpp | 2 +- 9 files changed, 146 insertions(+), 93 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5ee552..842186c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ v0.2_dev (19/02/2011) Searchs aren't case sensitive enough Default categories in native language (even if switching language at runtime) Add Real mode + Database is now at ~/.kisscount/kc.bdd ** Dev ** Use a factory to create panels (prepare for plug-in) diff --git a/init.sql b/init.sql index 56b957e..ecba2f0 100755 --- a/init.sql +++ b/init.sql @@ -1,6 +1,6 @@ CREATE TABLE kisscount(db_version VARCHAR(20)); 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)); +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 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 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)); diff --git a/ressources/po/french.mo b/ressources/po/french.mo index 18167fc8d5a6e6576b51322776b4b692305d83d2..86795eda38137bb93572af681356b8d9920b620c 100644 GIT binary patch delta 2943 zcmYk-drZ}39LMp8!$l4k<&r2D^&}yfVTiZ}-VzJViG_j1MGEnxAYl?FkogmDBzei5 zxy*E0vzg1e;ZbL!l7?%ga}{KZRc==Pk*1r>R!f_`Kj%C(e>>mvdVbIExj)bEoL$pz zO?NIOgzYw5+lVw`ZJ04<@W)8LxW11zCKLy782*Gq@jBjzcQ6*?V~la*7@ULSQTeNI z2s)@HJ5c4`L_Ut$%eNXlj4E&nY15oR6+Dj`*hL(JgEl{b*5kNOLv@gi5jX`$;WSkF z3XH-wRQsDz?e4&6`Zs$>Xl92{136*ud#(K#PW~^bj($VU{3Z^^2r9*68frijQ3IKY z>bMBiVF^;jR3eLP>Xc9arjdjiZb5al-rjFPHM9fO&~DVq9K;cL6jlB#dhncmehsx{ zf1*0NjT)F{srz_Ty(DyaX3|J#gcIz8DX0NWMU8kiCSnO{=3dl{+b{vQ+4}>??wBrA zxld6Y_oM3niudDRsI5tfWBt`p0i`s6Lew73M>SA}`B;w{`625OR7b~9<-1V>J&P*e zhniRnqg4B;sQT%s70g1dY+gL;?;L7iXt@sA+ z#S|RJa;Sq@sOQC~j;m1vsYP|X!rJ862d$`z?Whj7qXxDIwU_UpW_$ou?kK9k(@5W@ z2X!X;Q1!3c=YOCE@DFMNF7`o2qUt+CZ6XODAY(LU;B0Fhs=`jx$akZbe4q7wR71y5 z9i6gvqw4jbCh$3`-Z@nHeq<#b^8<;h5M!>O3KsHCY43`VEK`O$3w1Vs9cl}>ptqYKkSR$Oe&* zi5(dnPzI`eHmc)%)Zu*$wI!vfr7yQG!N4IzM>A?7p_#U!4%sGDgS${mzaLfMI2PbX zsDa)>b>K=4J|BWAKNNL%(^2h>Lrr8ds=q?(ykz_SFC;@Fu0SOVwHs0+2%pP^QyA2q@6P%CoHA)yBUMs*a&@HMhD z)DowoDon!dScFX0d~2WIKuzEds^d8R`ZUud)Si#FW?FMl?dGFa(3wMmx6hQK8dzit zRM`Ucs6({|HP8*1iF@qx9#n@HP!qUl^DkR(*yp!VD-=4KNntF~j$h z(C;@RG>d$fBNJm^BsH1PwaypfPS4&#Du-a_%rs&i@j9VPE2h;LuN$t7z7lt;Q%d#@8^Tb|G&4AdWx7!ylQhFwTk67{q#L~tL{mc>Ri>3@q+KB zJ2m`SQpTB6-|Au2uj6;gUJiir6{EurmQ>2pV?msOC` zA=0&(&_UQhJW1%dHxS{(!-U?~6+{f7i*sRC6Z$FEyIM&+NG$ZXM?d27e-it#E3A0s zQm?-y?sSN&rooq;uzbkuCT~r%*W>R@s0@kB&GAgiEy&69Ur%fg4O!@K9#I?`tkRPb cJ@#p*LC zii%XysIWdVql+3?SXxO)P!gCDk%ow2riuOk+X;N}`F`g;?|IMVIph|a`Rt_kD*(0zBT!Gpw_f<0=eiObwN8Q!ofHUUCA1BfOTlQI&^~D(ROd53p$DRdlr4~ zBAU6&Xhxeb`!vjIL;mfc6&0?iGe1l&6r(90ie_XyI>Az;k1zx4uo64rC3Ju`q{HX= z=md(<0q=~K#QM=_`-uq(4m2H|(R_687NIMxL>tzi9d1DPz7BnFN34GjUFkk_!k4$_Dx3ICRF7vHo+3R-hADj1IIsT8+N92Ay~UeQyKWehZqp z?Krzp2(O{-uCl+Lzi^!bb)gmCl6&42-NS+Ci(_#LmLYQuyU+>lM>B8$9q?;(D}O+C zBb-7fa1qVm)oAnf4H;;QJ^lU%QE;HSXlg6b7uQFhMN{gS4 zNe-Hc+-L!ssov=OebI#uLeJJnOxR&51yer@ePIO-!5TEBAE0}FFg`zwwm*s<+EZwU zXV8UQKnDyR8%&R8qZ96czTc}O`7fYQ5-Tduzx6B86g`J_yd&1{MN@e!-k(NKv+42= zN_TYNG3ZJsp$nRZX0`$+V-P&nBGtbbJ0V#B)Sycqbl@;)#$_$Xh)mT z6?)AkrVy*W;i@Kv5|0oIh}#MOEIYw+Vl?5^DK=9RsKEBe8!V+RW(SztuOeMw;YlwBp zYng=|S5oq;7)wkf9w6N6rOClrh2=9Sd7`}56CMixY?cxp=}N+rb{pZh`XJ#E_u`Dy zUyt+acRG_OvL^L@*1)u;1xuGNSeW{~<)>+>J=q^MN-oSff%makELZDyT~B%bnCXm7bT8mdwqsN$t!pYxEy6^89oF diff --git a/ressources/po/french.po b/ressources/po/french.po index 9d82426..b7269a0 100644 --- a/ressources/po/french.po +++ b/ressources/po/french.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-15 19:15+0100\n" +"POT-Creation-Date: 2011-02-20 12:04+0100\n" "PO-Revision-Date: \n" "Last-Translator: Soutadé \n" "Language-Team: \n" @@ -37,11 +37,11 @@ msgstr " existe déjà" msgid " entries found" msgstr " entrées trouvées" -#: src/model/Database.cpp:96 +#: src/model/Database.cpp:103 msgid " not found, aborting" msgstr " non trouvé, arrêt" -#: src/view/AccountPanel.cpp:766 +#: src/view/AccountPanel.cpp:852 msgid " operations ?" msgstr " opérations ?" @@ -49,7 +49,7 @@ msgstr " opérations ?" msgid " profil ?" msgstr " profil ?" -#: src/model/Database.cpp:85 +#: src/model/Database.cpp:92 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 !" @@ -71,11 +71,11 @@ msgstr "Le compte " msgid "Account 1" msgstr "Compte 1" -#: src/view/AccountPanel.cpp:106 +#: src/view/AccountPanel.cpp:108 msgid "Account name" msgstr "Nom du compte" -#: src/view/AccountPanel.cpp:105 +#: src/view/AccountPanel.cpp:107 msgid "Account number" msgstr "Numéro de compte" @@ -93,7 +93,7 @@ msgid "Amount to" msgstr "Montant max" #: src/view/PreferencesPanel.cpp:838 -#: src/view/AccountPanel.cpp:761 +#: src/view/AccountPanel.cpp:847 msgid "Are you sure want to delete " msgstr "Etes vous sûr de vouloir supprimer " @@ -163,9 +163,9 @@ msgstr "Changer la catégorie" msgid "Change password" msgstr "Changer le mot de passe" -#: src/view/AccountPanel.cpp:122 -msgid "Check mode" -msgstr "Mode rapprochement" +#: src/view/AccountPanel.cpp:124 +msgid "Check" +msgstr "Rapprochement" #: src/view/SearchPanel.cpp:84 msgid "Checked" @@ -184,7 +184,7 @@ msgid "Confirm password " msgstr "Confirmer le mot de passe " #: src/view/StatsPanel.cpp:128 -#: src/view/AccountPanel.cpp:116 +#: src/view/AccountPanel.cpp:118 msgid "Cost repartition" msgstr "Répartition des coûts" @@ -192,15 +192,15 @@ msgstr "Répartition des coûts" msgid "Credit" msgstr "Crédit" -#: src/view/AccountPanel.cpp:215 +#: src/view/AccountPanel.cpp:219 msgid "Cur Credit" msgstr "Cur Crédit" -#: src/view/AccountPanel.cpp:216 +#: src/view/AccountPanel.cpp:220 msgid "Cur Debit" msgstr "Cur Débit" -#: src/view/AccountPanel.cpp:108 +#: src/view/AccountPanel.cpp:110 msgid "Current value" msgstr "Valeur courante" @@ -226,7 +226,7 @@ msgstr "Défaut" #: src/view/PreferencesPanel.cpp:201 #: src/view/PreferencesPanel.cpp:295 -#: src/view/AccountPanel.cpp:620 +#: src/view/AccountPanel.cpp:706 msgid "Delete" msgstr "Supprimer" @@ -239,7 +239,7 @@ msgstr "Décroissant" msgid "Description" msgstr "Description" -#: src/view/SearchPanel.cpp:394 +#: src/view/SearchPanel.cpp:393 msgid "Enter a new description" msgstr "Nouvelle description" @@ -258,27 +258,29 @@ msgstr "Nouvelle description" #: src/view/PreferencesPanel.cpp:789 #: src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 -#: src/view/AccountPanel.cpp:757 +#: src/view/AccountPanel.cpp:843 #: src/view/grid/GridAccount.cpp:1271 #: src/view/grid/GridAccount.cpp:1278 #: src/view/grid/GridAccount.cpp:1397 #: src/view/grid/GridAccount.cpp:1403 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 -#: src/model/Database.cpp:42 -#: src/model/Database.cpp:49 -#: src/model/Database.cpp:67 -#: src/model/Database.cpp:96 -#: src/model/Database.cpp:104 -#: src/model/Database.cpp:125 +#: src/model/Database.cpp:45 +#: src/model/Database.cpp:52 +#: src/model/Database.cpp:70 +#: src/model/Database.cpp:103 +#: src/model/Database.cpp:109 +#: src/model/Database.cpp:115 +#: src/model/Database.cpp:123 +#: src/model/Database.cpp:144 #: src/model/Database_Update.cpp:23 msgid "Error" msgstr "Erreur" -#: src/model/Database.cpp:125 +#: src/model/Database.cpp:144 msgid "Error creating original database" msgstr "Erreur durant la création de la base de données initiale" -#: src/view/AccountPanel.cpp:109 +#: src/view/AccountPanel.cpp:111 msgid "Final value" msgstr "Valeur finale" @@ -305,7 +307,7 @@ msgid "From " msgstr "A partir de " #: src/view/GenerateDialog.cpp:31 -#: src/view/AccountPanel.cpp:617 +#: src/view/AccountPanel.cpp:703 msgid "Generate month" msgstr "Générer mois" @@ -313,7 +315,7 @@ msgstr "Générer mois" msgid "Groceries" msgstr "Courses" -#: src/view/AccountPanel.cpp:126 +#: src/view/AccountPanel.cpp:130 msgid "Group" msgstr "Grouper" @@ -321,7 +323,7 @@ msgstr "Grouper" msgid "Hobbies" msgstr "Loisirs" -#: src/view/AccountPanel.cpp:107 +#: src/view/AccountPanel.cpp:109 msgid "Initial value" msgstr "Valeur initiale" @@ -365,7 +367,7 @@ msgstr "Intervalle de temps invalide" msgid "It must be at least one account !" msgstr "Il doit y avoir au moins un compte !" -#: src/view/AccountPanel.cpp:757 +#: src/view/AccountPanel.cpp:843 msgid "It must be at least one month !" msgstr "Il doit rester au moins un mois" @@ -392,6 +394,10 @@ msgstr "Langue non changée" msgid "Language successfully changed, please go to another panel" msgstr "Langue changée, allez sur un autre panneau pour rendre le changement effectif" +#: src/view/AccountPanel.cpp:125 +msgid "Mode" +msgstr "Mode" + #: src/view/PreferencesPanel.cpp:72 #: src/view/PreferencesPanel.cpp:196 #: src/view/PreferencesPanel.cpp:291 @@ -411,7 +417,7 @@ msgstr "Nouvel utilisateur" msgid "New password " msgstr "Nouveau mot de passe " -#: src/model/Database.cpp:84 +#: src/model/Database.cpp:91 msgid "" "No database found, would you like to create a new one ?\n" "\n" @@ -461,7 +467,7 @@ msgid "Operation order" msgstr "Ordre des opérations" #: src/view/SearchPanel.cpp:98 -#: src/view/AccountPanel.cpp:175 +#: src/view/AccountPanel.cpp:179 msgid "Operations" msgstr "Opérations" @@ -509,7 +515,11 @@ msgstr "Préférences" msgid "Quit KissCount ?" msgstr "Quitter KissCount ?" -#: src/view/AccountPanel.cpp:217 +#: src/view/AccountPanel.cpp:124 +msgid "Real" +msgstr "Réel" + +#: src/view/AccountPanel.cpp:221 msgid "Remains" msgstr "Restant" @@ -519,12 +529,12 @@ msgstr "Renommer" #: src/view/SearchPanel.cpp:92 #: src/view/SearchPanel.cpp:164 -#: src/view/SearchPanel.cpp:410 +#: src/view/SearchPanel.cpp:409 msgid "Search" msgstr "Chercher" #: src/view/StatsPanel.cpp:120 -#: src/view/AccountPanel.cpp:90 +#: src/view/AccountPanel.cpp:92 msgid "Serie 1" msgstr "Série 1" @@ -545,22 +555,27 @@ msgstr "A" msgid "To " msgstr "Vers " -#: src/view/AccountPanel.cpp:199 +#: src/view/AccountPanel.cpp:203 msgid "Total Credit" msgstr "Total Crédit" -#: src/view/AccountPanel.cpp:200 +#: src/view/AccountPanel.cpp:204 msgid "Total Debit" msgstr "Total Débit" -#: src/view/AccountPanel.cpp:127 +#: src/view/AccountPanel.cpp:131 msgid "UnGroup" msgstr "Dégrouper" -#: src/model/Database.cpp:42 -#: src/model/Database.cpp:49 -#: src/model/Database.cpp:67 -#: src/model/Database.cpp:104 +#: src/model/Database.cpp:109 +#: src/model/Database.cpp:115 +msgid "Unable to Create " +msgstr "Impossible de créer " + +#: src/model/Database.cpp:45 +#: src/model/Database.cpp:52 +#: src/model/Database.cpp:70 +#: src/model/Database.cpp:123 msgid "Unable to open Database" msgstr "Impossible d'ouvrir la base de données" @@ -591,6 +606,7 @@ msgid "Users" msgstr "Utilisateurs" #: src/view/PreferencesPanel.cpp:199 +#: src/view/AccountPanel.cpp:124 msgid "Virtual" msgstr "Virtuel" @@ -658,6 +674,8 @@ msgstr "octobre" msgid "september" msgstr "septembre" +#~ msgid "Check mode" +#~ msgstr "Mode rapprochement" #~ msgid "Query failed !\n" #~ msgstr "La requête a échouée !\n" #~ msgid "Update failed !\n" diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index 7c9e767..edc14d7 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-02-15 19:15+0100\n" +"POT-Creation-Date: 2011-02-20 12:04+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -31,11 +31,11 @@ msgstr "" msgid " entries found" msgstr "" -#: src/model/Database.cpp:96 +#: src/model/Database.cpp:103 msgid " not found, aborting" msgstr "" -#: src/view/AccountPanel.cpp:766 +#: src/view/AccountPanel.cpp:852 msgid " operations ?" msgstr "" @@ -43,7 +43,7 @@ msgstr "" msgid " profil ?" msgstr "" -#: src/model/Database.cpp:85 +#: src/model/Database.cpp:92 msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "" @@ -63,11 +63,11 @@ msgstr "" msgid "Account 1" msgstr "" -#: src/view/AccountPanel.cpp:106 +#: src/view/AccountPanel.cpp:108 msgid "Account name" msgstr "" -#: src/view/AccountPanel.cpp:105 +#: src/view/AccountPanel.cpp:107 msgid "Account number" msgstr "" @@ -83,7 +83,7 @@ msgstr "" msgid "Amount to" msgstr "" -#: src/view/PreferencesPanel.cpp:838 src/view/AccountPanel.cpp:761 +#: src/view/PreferencesPanel.cpp:838 src/view/AccountPanel.cpp:847 msgid "Are you sure want to delete " msgstr "" @@ -148,8 +148,8 @@ msgstr "" msgid "Change password" msgstr "" -#: src/view/AccountPanel.cpp:122 -msgid "Check mode" +#: src/view/AccountPanel.cpp:124 +msgid "Check" msgstr "" #: src/view/SearchPanel.cpp:84 @@ -168,7 +168,7 @@ msgstr "" msgid "Confirm password " msgstr "" -#: src/view/StatsPanel.cpp:128 src/view/AccountPanel.cpp:116 +#: src/view/StatsPanel.cpp:128 src/view/AccountPanel.cpp:118 msgid "Cost repartition" msgstr "" @@ -176,15 +176,15 @@ msgstr "" msgid "Credit" msgstr "" -#: src/view/AccountPanel.cpp:215 +#: src/view/AccountPanel.cpp:219 msgid "Cur Credit" msgstr "" -#: src/view/AccountPanel.cpp:216 +#: src/view/AccountPanel.cpp:220 msgid "Cur Debit" msgstr "" -#: src/view/AccountPanel.cpp:108 +#: src/view/AccountPanel.cpp:110 msgid "Current value" msgstr "" @@ -209,7 +209,7 @@ msgid "Default" msgstr "" #: src/view/PreferencesPanel.cpp:201 src/view/PreferencesPanel.cpp:295 -#: src/view/AccountPanel.cpp:620 +#: src/view/AccountPanel.cpp:706 msgid "Delete" msgstr "" @@ -221,7 +221,7 @@ msgstr "" msgid "Description" msgstr "" -#: src/view/SearchPanel.cpp:394 +#: src/view/SearchPanel.cpp:393 msgid "Enter a new description" msgstr "" @@ -232,21 +232,22 @@ msgstr "" #: src/view/PreferencesPanel.cpp:515 src/view/PreferencesPanel.cpp:726 #: src/view/PreferencesPanel.cpp:745 src/view/PreferencesPanel.cpp:783 #: src/view/PreferencesPanel.cpp:789 src/view/PasswordDialog.cpp:72 -#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:757 +#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:843 #: src/view/grid/GridAccount.cpp:1271 src/view/grid/GridAccount.cpp:1278 #: src/view/grid/GridAccount.cpp:1397 src/view/grid/GridAccount.cpp:1403 -#: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:42 -#: src/model/Database.cpp:49 src/model/Database.cpp:67 -#: src/model/Database.cpp:96 src/model/Database.cpp:104 -#: src/model/Database.cpp:125 src/model/Database_Update.cpp:23 +#: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:45 +#: src/model/Database.cpp:52 src/model/Database.cpp:70 +#: src/model/Database.cpp:103 src/model/Database.cpp:109 +#: src/model/Database.cpp:115 src/model/Database.cpp:123 +#: src/model/Database.cpp:144 src/model/Database_Update.cpp:23 msgid "Error" msgstr "" -#: src/model/Database.cpp:125 +#: src/model/Database.cpp:144 msgid "Error creating original database" msgstr "" -#: src/view/AccountPanel.cpp:109 +#: src/view/AccountPanel.cpp:111 msgid "Final value" msgstr "" @@ -271,7 +272,7 @@ msgstr "" msgid "From " msgstr "" -#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:617 +#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:703 msgid "Generate month" msgstr "" @@ -279,7 +280,7 @@ msgstr "" msgid "Groceries" msgstr "" -#: src/view/AccountPanel.cpp:126 +#: src/view/AccountPanel.cpp:130 msgid "Group" msgstr "" @@ -287,7 +288,7 @@ msgstr "" msgid "Hobbies" msgstr "" -#: src/view/AccountPanel.cpp:107 +#: src/view/AccountPanel.cpp:109 msgid "Initial value" msgstr "" @@ -331,7 +332,7 @@ msgstr "" msgid "It must be at least one account !" msgstr "" -#: src/view/AccountPanel.cpp:757 +#: src/view/AccountPanel.cpp:843 msgid "It must be at least one month !" msgstr "" @@ -356,6 +357,10 @@ msgstr "" msgid "Language successfully changed, please go to another panel" msgstr "" +#: src/view/AccountPanel.cpp:125 +msgid "Mode" +msgstr "" + #: src/view/PreferencesPanel.cpp:72 src/view/PreferencesPanel.cpp:196 #: src/view/PreferencesPanel.cpp:291 msgid "Name" @@ -373,7 +378,7 @@ msgstr "" msgid "New password " msgstr "" -#: src/model/Database.cpp:84 +#: src/model/Database.cpp:91 msgid "" "No database found, would you like to create a new one ?\n" "\n" @@ -417,7 +422,7 @@ msgstr "" msgid "Operation order" msgstr "" -#: src/view/SearchPanel.cpp:98 src/view/AccountPanel.cpp:175 +#: src/view/SearchPanel.cpp:98 src/view/AccountPanel.cpp:179 msgid "Operations" msgstr "" @@ -457,7 +462,11 @@ msgstr "" msgid "Quit KissCount ?" msgstr "" -#: src/view/AccountPanel.cpp:217 +#: src/view/AccountPanel.cpp:124 +msgid "Real" +msgstr "" + +#: src/view/AccountPanel.cpp:221 msgid "Remains" msgstr "" @@ -466,11 +475,11 @@ msgid "Rename" msgstr "" #: src/view/SearchPanel.cpp:92 src/view/SearchPanel.cpp:164 -#: src/view/SearchPanel.cpp:410 +#: src/view/SearchPanel.cpp:409 msgid "Search" msgstr "" -#: src/view/StatsPanel.cpp:120 src/view/AccountPanel.cpp:90 +#: src/view/StatsPanel.cpp:120 src/view/AccountPanel.cpp:92 msgid "Serie 1" msgstr "" @@ -490,20 +499,24 @@ msgstr "" msgid "To " msgstr "" -#: src/view/AccountPanel.cpp:199 +#: src/view/AccountPanel.cpp:203 msgid "Total Credit" msgstr "" -#: src/view/AccountPanel.cpp:200 +#: src/view/AccountPanel.cpp:204 msgid "Total Debit" msgstr "" -#: src/view/AccountPanel.cpp:127 +#: src/view/AccountPanel.cpp:131 msgid "UnGroup" msgstr "" -#: src/model/Database.cpp:42 src/model/Database.cpp:49 -#: src/model/Database.cpp:67 src/model/Database.cpp:104 +#: src/model/Database.cpp:109 src/model/Database.cpp:115 +msgid "Unable to Create " +msgstr "" + +#: src/model/Database.cpp:45 src/model/Database.cpp:52 +#: src/model/Database.cpp:70 src/model/Database.cpp:123 msgid "Unable to open Database" msgstr "" @@ -529,7 +542,7 @@ msgstr "" msgid "Users" msgstr "" -#: src/view/PreferencesPanel.cpp:199 +#: src/view/PreferencesPanel.cpp:199 src/view/AccountPanel.cpp:124 msgid "Virtual" msgstr "" diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 1821a23..3c07537 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -32,6 +32,9 @@ static inline wxString DoubleToString(double d) Database::Database(const char* filename, KissCount* kiss) : _kiss(kiss) { std::ifstream bdd_file; + + std::string sPath = std::string(wxGetHomeDir().mb_str()) + std::string(BDD_FILE); + wxString wPath = wxGetHomeDir() + wxT(BDD_FILE); if (filename) { @@ -53,7 +56,7 @@ Database::Database(const char* filename, KissCount* kiss) : _kiss(kiss) else { // If default BDD file, assume this can be the first load - bdd_file.open(BDD_FILE, std::ifstream::in); + bdd_file.open(sPath.c_str(), std::ifstream::in); if (!bdd_file.good()) { @@ -61,11 +64,11 @@ Database::Database(const char* filename, KissCount* kiss) : _kiss(kiss) } else { - _db.Open(wxT(BDD_FILE)); + _db.Open(wPath); if (!_db.IsOpen()) { wxMessageBox(_("Unable to open Database"), _("Error"), wxICON_ERROR | wxOK ); - throw std::string("Unable to open ") + BDD_FILE; + throw std::string("Unable to open ") + sPath; } } } @@ -80,7 +83,11 @@ void Database::CreateDatabase() std::ifstream init_script; std::string line; wxString wxline; - + std::string sPath = std::string(wxGetHomeDir().mb_str()) + std::string(BDD_FILE); + wxString wPath = wxGetHomeDir() + wxT(BDD_FILE); + wxFileName dirname( wxGetHomeDir() +wxT("/.kisscount/"), wxPATH_UNIX); + wxFileName filename (wPath); + wxFile file; wxString message = _("No database found, would you like to create a new one ?\n\n"); message += _("!! Warning !! If there was a bug, the old database will be suppressed !"); @@ -97,12 +104,24 @@ void Database::CreateDatabase() throw "init.sql not found, aborting"; } - _db.Open(wxT(BDD_FILE)); + if (!dirname.DirExists() && !dirname.Mkdir()) + { + wxMessageBox(_("Unable to Create ") + wxGetHomeDir() +wxT("/.kisscount/"), _("Error"), wxICON_ERROR | wxOK ); + throw std::string("Unable to create ") + std::string(wxGetHomeDir().mb_str()) + std::string("/.kisscount/"); + } + + if (!filename.FileExists() && !file.Create(wPath, false, wxS_IRUSR|wxS_IWUSR|wxS_IXUSR)) + { + wxMessageBox(_("Unable to Create ") + wPath, _("Error"), wxICON_ERROR | wxOK ); + throw std::string("Unable to create ") + sPath; + } + + _db.Open(wPath); if (!_db.IsOpen()) { wxMessageBox(_("Unable to open Database"), _("Error"), wxICON_ERROR | wxOK ); - throw std::string("Unable to open ") + BDD_FILE; + throw std::string("Unable to open ") + sPath; } do @@ -123,7 +142,7 @@ void Database::CreateDatabase() catch (...) { wxMessageBox(_("Error creating original database"), _("Error"), wxICON_ERROR | wxOK ); - remove(BDD_FILE); + remove(sPath.c_str()); throw line; } } while (init_script); @@ -210,7 +229,7 @@ User* Database::LoadUser(const wxString& name) set.Finalize(); - req = wxT("SELECT * FROM account WHERE user='") + user->_id + wxT("' ORDER BY default_account DESC, name ASC"); + req = wxT("SELECT * FROM account WHERE user='") + user->_id + wxT("' ORDER BY default_account DESC, blocked, virtual, name ASC"); EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;}); @@ -228,7 +247,7 @@ User* Database::LoadUser(const wxString& name) } set.Finalize(); - req = wxT("SELECT * FROM account WHERE id IN (SELECT account FROM shared_account WHERE user='") + user->_id + wxT("') ORDER BY name ASC"); + req = wxT("SELECT * FROM account WHERE id IN (SELECT account FROM shared_account WHERE user='") + user->_id + wxT("') ORDER BY blocked, virtual, name ASC"); EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;}); diff --git a/src/model/Database.h b/src/model/Database.h index c10f4f7..88d5c16 100644 --- a/src/model/Database.h +++ b/src/model/Database.h @@ -25,6 +25,9 @@ #include #include #include +#include +#include +#include #include #include "model.h" @@ -32,8 +35,8 @@ #define DATABASE_VERSION 2 -#define BDD_FILE "kc.bdd" -#define INIT_SCRIPT "init.sql" +#define BDD_FILE "/.kisscount/kc.bdd" +#define INIT_SCRIPT "init.sql" #define FIX_OP (1 << 0) #define NON_FIX_OP (1 << 1) diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index 5ae40ae..3e7fa8b 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -79,7 +79,7 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent _category = new wxCheckListBox(this, wxID_ANY); _category->Append(_("Unknown")); for(categoryIt = user->_categories.begin(); categoryIt != user->_categories.end(); categoryIt++) - _category->Append(categoryIt->name); + _category->Append(wxGetTranslation(categoryIt->name)); wxString stypes[] = {_("Fix"), _("Non fix"), _("Checked"), _("Not checked")}; _optype = new wxCheckListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 4, stypes); @@ -381,7 +381,6 @@ static void ChangeName(Operation* op, void** params) void SearchPanel::OnButtonRename(wxCommandEvent& event) { std::vector rows; - User* user = _kiss->GetUser(); std::vector::iterator it; wxString category; wxString description; diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index ae18f85..3fec614 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -84,7 +84,7 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), categoryIt++, i++) { _categoriesIndexes[categoryIt->id] = i; - _categories[i] = categoryIt->name ; + _categories[i] = wxGetTranslation(categoryIt->name) ; } DEFAULT_FONT(font);