From 9355c420935a91d5edc4a8c96b86f15fc2f9f79a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Fri, 10 Dec 2010 19:08:41 +0100 Subject: [PATCH] Fix a bug in search (selecting opposite types of operation) --- src/model/Database.cpp | 6 ++++-- src/view/SearchPanel.cpp | 1 - src/view/wxUI.cpp | 13 ------------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 772e098..0b83830 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -1328,7 +1328,8 @@ std::vector* Database::Search(User* user, wxString* description, wxDa if (types) { - if ((types & FIX_OP) ^ (types & NON_FIX_OP)) + if (((types & FIX_OP) && !(types & NON_FIX_OP)) || + (!(types & FIX_OP) && (types & NON_FIX_OP))) { if (firstCond) req += wxT(" AND ") ; else firstCond = true; @@ -1338,7 +1339,8 @@ std::vector* Database::Search(User* user, wxString* description, wxDa req += wxT(" fix_cost='0'"); } - if ((types & CHECKED_OP) ^ (types & NOT_CHECKED_OP)) + if (((types & CHECKED_OP) && !(types & NOT_CHECKED_OP)) || + (!(types & CHECKED_OP) && (types & NOT_CHECKED_OP))) { if (firstCond) req += wxT(" AND ") ; else firstCond = true; diff --git a/src/view/SearchPanel.cpp b/src/view/SearchPanel.cpp index 3c05d61..1318a0c 100644 --- a/src/view/SearchPanel.cpp +++ b/src/view/SearchPanel.cpp @@ -75,7 +75,6 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(*pa wxString stypes[] = {_("Fix"), _("Non fix"), _("Checked"), _("Not checked")}; _optype = new wxCheckListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 4, stypes); - _optype->Check(0); _optype->Check(1); _optype->Check(2); _optype->Check(3); _account = new wxCheckListBox(this, wxID_ANY); for(accountIt = user->_accounts.begin(); accountIt != user->_accounts.end(); accountIt++) diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index 965e0d7..0d267fb 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -39,19 +39,6 @@ wxUI::wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxS { _hbox = new wxBoxSizer(wxVERTICAL); _buttonPanel = new ButtonPanel(_kiss, this); - // wxMenu *menuFile = new wxMenu; - - // menuFile->Append( ID_About, wxT("&About...") ); - // menuFile->AppendSeparator(); - // menuFile->Append( ID_Quit, wxT("E&xit") ); - - // wxMenuBar *menuBar = new wxMenuBar; - // menuBar->Append( menuFile, wxT("&File") ); - - // SetMenuBar( menuBar ); - - // CreateStatusBar(); - // SetStatusText( wxT("Welcome to wxWidgets!") ); SetSizer(_hbox);