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 18167fc..86795ed 100644 Binary files a/ressources/po/french.mo and b/ressources/po/french.mo differ 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);