* Add category font/color (web is missing)
* Fix a bug in category modification (PreferencesPanel), inModification = false ; missing
This commit is contained in:
@@ -26,7 +26,8 @@ public:
|
||||
wxString id;
|
||||
wxString parent;
|
||||
wxString name;
|
||||
wxColour color;
|
||||
wxColour backcolor;
|
||||
wxColour forecolor;
|
||||
wxString font;
|
||||
};
|
||||
|
||||
|
||||
@@ -306,7 +306,8 @@ User* Database::LoadUser(const wxString& name)
|
||||
category.id = set.GetAsString(wxT("id"));
|
||||
category.parent = set.GetAsString(wxT("parent"));
|
||||
category.name = set.GetAsString(wxT("name"));
|
||||
category.color = wxColour(set.GetAsString(wxT("color")));
|
||||
category.backcolor = wxColour(set.GetAsString(wxT("backcolor")));
|
||||
category.forecolor = wxColour(set.GetAsString(wxT("forecolor")));
|
||||
category.font = set.GetAsString(wxT("font"));
|
||||
if (category.name != _("Fix"))
|
||||
user->_categories.push_back(category);
|
||||
@@ -678,18 +679,24 @@ void Database::DeleteAccount(Account& ac)
|
||||
wxString Database::AddCategory(User* user, Category& category)
|
||||
{
|
||||
wxString req;
|
||||
wxString color;
|
||||
wxString backcolor, forecolor;
|
||||
|
||||
color = wxT("#") ;
|
||||
color += wxString::Format(wxT("%02X"), category.color.Red());
|
||||
color += wxString::Format(wxT("%02X"), category.color.Green());
|
||||
color += wxString::Format(wxT("%02X"), category.color.Blue());
|
||||
backcolor = wxT("#") ;
|
||||
backcolor += wxString::Format(wxT("%02X"), category.backcolor.Red());
|
||||
backcolor += wxString::Format(wxT("%02X"), category.backcolor.Green());
|
||||
backcolor += wxString::Format(wxT("%02X"), category.backcolor.Blue());
|
||||
|
||||
req = wxT("INSERT INTO category ('user', 'parent', 'name', 'color', font) VALUES ('") ;
|
||||
forecolor = wxT("#") ;
|
||||
forecolor += wxString::Format(wxT("%02X"), category.forecolor.Red());
|
||||
forecolor += wxString::Format(wxT("%02X"), category.forecolor.Green());
|
||||
forecolor += wxString::Format(wxT("%02X"), category.forecolor.Blue());
|
||||
|
||||
req = wxT("INSERT INTO category ('user', 'parent', 'name', 'backcolor', 'forecolor', font) VALUES ('") ;
|
||||
req += user->_id + wxT("'");
|
||||
req += wxT(", '") + category.parent + wxT("'");
|
||||
req += wxT(", '") + category.name + wxT("'");
|
||||
req += wxT(", '") + color + wxT("'");
|
||||
req += wxT(", '") + backcolor + wxT("'");
|
||||
req += wxT(", '") + forecolor + wxT("'");
|
||||
req += wxT(", '") + category.font + wxT("'");
|
||||
req += wxT(")");
|
||||
|
||||
@@ -701,17 +708,23 @@ wxString Database::AddCategory(User* user, Category& category)
|
||||
void Database::UpdateCategory(Category& category)
|
||||
{
|
||||
wxString req;
|
||||
wxString color;
|
||||
wxString backcolor, forecolor;
|
||||
|
||||
color = wxT("#") ;
|
||||
color += wxString::Format(wxT("%02X"), category.color.Red());
|
||||
color += wxString::Format(wxT("%02X"), category.color.Green());
|
||||
color += wxString::Format(wxT("%02X"), category.color.Blue());
|
||||
backcolor = wxT("#") ;
|
||||
backcolor += wxString::Format(wxT("%02X"), category.backcolor.Red());
|
||||
backcolor += wxString::Format(wxT("%02X"), category.backcolor.Green());
|
||||
backcolor += wxString::Format(wxT("%02X"), category.backcolor.Blue());
|
||||
|
||||
forecolor = wxT("#") ;
|
||||
forecolor += wxString::Format(wxT("%02X"), category.forecolor.Red());
|
||||
forecolor += wxString::Format(wxT("%02X"), category.forecolor.Green());
|
||||
forecolor += wxString::Format(wxT("%02X"), category.forecolor.Blue());
|
||||
|
||||
req = wxT("UPDATE category SET") ;
|
||||
req += wxT(" parent='") + category.parent + wxT("'");
|
||||
req += wxT(", name='") + category.name + wxT("'");
|
||||
req += wxT(", color='") + color + wxT("'");
|
||||
req += wxT(", backcolor='") + backcolor + wxT("'");
|
||||
req += wxT(", forecolor='") + forecolor + wxT("'");
|
||||
req += wxT(", font='") + category.font + wxT("'");
|
||||
req += wxT(" WHERE id='") + category.id + wxT("'");
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@ Category User::GetCategory(wxString& catId)
|
||||
cat.parent = wxT("0");
|
||||
cat.name = _("Unknown");
|
||||
cat.font = wxT("");
|
||||
cat.color = wxColour(0xFF, 0xFF, 0xFF);
|
||||
cat.backcolor = wxColour(0xFF, 0xFF, 0xFF);
|
||||
cat.forecolor = wxColour(0x00, 0x00, 0x00);
|
||||
|
||||
return cat;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user