From: <vo...@us...> - 2009-11-01 10:36:02
|
Revision: 713 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=713&view=rev Author: vomikan Date: 2009-11-01 10:35:49 +0000 (Sun, 01 Nov 2009) Log Message: ----------- Addition submenu for Bank Accounts popup menu. + //Accounts Visible// + //All // + //Favorite // + //Open // Now you can temporary switch Accounts Visible parameter for current session only. Modified Paths: -------------- trunk/mmex/src/guiid.h trunk/mmex/src/mmex.cpp trunk/mmex/src/mmex.h Modified: trunk/mmex/src/guiid.h =================================================================== --- trunk/mmex/src/guiid.h 2009-11-01 07:40:45 UTC (rev 712) +++ trunk/mmex/src/guiid.h 2009-11-01 10:35:49 UTC (rev 713) @@ -409,6 +409,9 @@ MENU_TREEPOPUP_ACCOUNT_IMPORTQIF, MENU_TREEPOPUP_ACCOUNT_IMPORTUNIVCSV, MENU_TREEPOPUP_ACCOUNT_IMPORTMMNET, + MENU_TREEPOPUP_ACCOUNT_VIEWALL, + MENU_TREEPOPUP_ACCOUNT_VIEWFAVORITE, + MENU_TREEPOPUP_ACCOUNT_VIEWOPEN, }; //---------------------------------------------------------------------------- Modified: trunk/mmex/src/mmex.cpp =================================================================== --- trunk/mmex/src/mmex.cpp 2009-11-01 07:40:45 UTC (rev 712) +++ trunk/mmex/src/mmex.cpp 2009-11-01 10:35:49 UTC (rev 713) @@ -297,19 +297,7 @@ EVT_MENU(MENU_TRANSACTIONREPORT, mmGUIFrame::OnTransactionReport) /* Navigation Panel */ - /*Popup Menu for Bank Accounts*/ - //New Account // - //Delete Account // - //Edit Account // - //Export > // - //CSV Files // - //QIF Files // - //Import > // - //Universal CSV Files // - //QIF Files // - //MMEX CSV Files // - //MM.&NET CSV Files // EVT_MENU(MENU_TREEPOPUP_ACCOUNT_NEW, mmGUIFrame::OnNewAccount) EVT_MENU(MENU_TREEPOPUP_ACCOUNT_DELETE, mmGUIFrame::OnDeleteAccount) EVT_MENU(MENU_TREEPOPUP_ACCOUNT_EDIT, mmGUIFrame::OnEditAccount) @@ -320,6 +308,9 @@ EVT_MENU(MENU_TREEPOPUP_ACCOUNT_IMPORTCSV, mmGUIFrame::OnImportCSV) EVT_MENU(MENU_TREEPOPUP_ACCOUNT_IMPORTUNIVCSV, mmGUIFrame::OnImportUniversalCSV) EVT_MENU(MENU_TREEPOPUP_ACCOUNT_IMPORTMMNET, mmGUIFrame::OnImportCSVMMNET) + EVT_MENU(MENU_TREEPOPUP_ACCOUNT_VIEWALL, mmGUIFrame::OnViewAllAccounts) + EVT_MENU(MENU_TREEPOPUP_ACCOUNT_VIEWFAVORITE, mmGUIFrame::OnViewFavoriteAccounts) + EVT_MENU(MENU_TREEPOPUP_ACCOUNT_VIEWOPEN, mmGUIFrame::OnViewOpenAccounts) END_EVENT_TABLE() /*******************************************************/ @@ -1905,6 +1896,24 @@ { //wxMenu menu; + /*Popup Menu for Bank Accounts*/ + //New Account // + //Delete Account // + //Edit Account // + //Export > // + //CSV Files // + //QIF Files // + //Import > // + //Universal CSV Files // + //QIF Files // + //MMEX CSV Files // + //MM.&NET CSV Files // + //Accounts Visible// + //All // + //Favorite // + //Open // + + wxMenu *menu = new wxMenu; menu->Append(MENU_TREEPOPUP_ACCOUNT_NEW, _("New &Account")); menu->Append(MENU_TREEPOPUP_ACCOUNT_DELETE, _("&Delete Account")); @@ -1925,12 +1934,62 @@ importFrom->Append(MENU_TREEPOPUP_ACCOUNT_IMPORTCSV, _("&MMEX CSV Files")); importFrom->Append(MENU_TREEPOPUP_ACCOUNT_IMPORTMMNET, _("MM.&NET CSV Files")); menu->AppendSubMenu(importFrom, _("&Import")); + menu->AppendSeparator(); + wxMenu *viewAccounts = new wxMenu; + viewAccounts->Append(MENU_TREEPOPUP_ACCOUNT_VIEWALL, _("All")); + viewAccounts->Append(MENU_TREEPOPUP_ACCOUNT_VIEWOPEN, _("Open")); + viewAccounts->Append(MENU_TREEPOPUP_ACCOUNT_VIEWFAVORITE, _("Favorites")); + menu->AppendSubMenu(viewAccounts, _("Accounts Visible")); PopupMenu(&*menu, pt); } } } +void mmGUIFrame::OnViewAllAccounts(wxCommandEvent&) +{ + //Get current settings for view accounts + wxString vAccts = mmDBWrapper::getINISettingValue(inidb_.get(), wxT("VIEWACCOUNTS"), wxT("ALL")); + //Set view ALL + mmDBWrapper::setINISettingValue(inidb_.get(), wxT("VIEWACCOUNTS"), wxT("ALL")); + + //Refresh Navigation Panel + mmGUIFrame::updateNavTreeControl(); + + //Restore settings + mmDBWrapper::setINISettingValue(inidb_.get(), wxT("VIEWACCOUNTS"), vAccts); + +} +void mmGUIFrame::OnViewFavoriteAccounts(wxCommandEvent&) +{ + //Get current settings for view accounts + wxString vAccts = mmDBWrapper::getINISettingValue(inidb_.get(), wxT("VIEWACCOUNTS"), wxT("ALL")); + + //Set view ALL + mmDBWrapper::setINISettingValue(inidb_.get(), wxT("VIEWACCOUNTS"), wxT("Favorites")); + + //Refresh Navigation Panel + mmGUIFrame::updateNavTreeControl(); + + //Restore settings + mmDBWrapper::setINISettingValue(inidb_.get(), wxT("VIEWACCOUNTS"), vAccts); + +} +void mmGUIFrame::OnViewOpenAccounts(wxCommandEvent&) +{ + //Get current settings for view accounts + wxString vAccts = mmDBWrapper::getINISettingValue(inidb_.get(), wxT("VIEWACCOUNTS"), wxT("ALL")); + + //Set view ALL + mmDBWrapper::setINISettingValue(inidb_.get(), wxT("VIEWACCOUNTS"), wxT("Open")); + + //Refresh Navigation Panel + mmGUIFrame::updateNavTreeControl(); + + //Restore settings + mmDBWrapper::setINISettingValue(inidb_.get(), wxT("VIEWACCOUNTS"), vAccts); + +} void mmGUIFrame::createCheckingAccountPage(int accountID) { wxSizer *sizer = cleanupHomePanel(); Modified: trunk/mmex/src/mmex.h =================================================================== --- trunk/mmex/src/mmex.h 2009-11-01 07:40:45 UTC (rev 712) +++ trunk/mmex/src/mmex.h 2009-11-01 10:35:49 UTC (rev 713) @@ -255,6 +255,10 @@ void OnWizardCancel(wxWizardEvent& event); + void OnViewAllAccounts(wxCommandEvent& event); + void OnViewFavoriteAccounts(wxCommandEvent& event); + void OnViewOpenAccounts(wxCommandEvent& event); + public: mmPanelBase* panelCurrent_; wxPanel* homePanel; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kkk...@us...> - 2009-11-07 10:52:30
|
Revision: 737 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=737&view=rev Author: kkkvadim Date: 2009-11-07 10:52:15 +0000 (Sat, 07 Nov 2009) Log Message: ----------- OnSaveAs refactoring & bugfix: wxCopyFile(xxx,yyy, FALSE) <-- must be TRUE Modified Paths: -------------- trunk/mmex/src/mmex.cpp trunk/mmex/src/mmex.h trunk/mmex/src/mmhomepagepanel.cpp trunk/mmex/src/qifimport.cpp Modified: trunk/mmex/src/mmex.cpp =================================================================== --- trunk/mmex/src/mmex.cpp 2009-11-07 10:49:57 UTC (rev 736) +++ trunk/mmex/src/mmex.cpp 2009-11-07 10:52:15 UTC (rev 737) @@ -29,7 +29,6 @@ #include "univcsvdialog.h" #include "wxtinyxml.h" #include "tinyxml.h" - #include "reportbase.h" #include "reportsummary.h" #include "reportcategexp.h" @@ -44,9 +43,7 @@ #include "reporttransstats.h" #include "reportcategovertimeperf.h" #include "reportbudgetsetup.h" - #include "mmgraphtopcategories.h" - #include "appstartdialog.h" #include "aboutdialog.h" #include "newacctdialog.h" @@ -58,9 +55,9 @@ #include "maincurrencydialog.h" #include "filtertransdialog.h" #include "billsdepositsdialog.h" - #include "util.h" #include "dbwrapper.h" +//---------------------------------------------------------------------------- /* Include XPM Support */ #include "../resources/new.xpm" @@ -96,6 +93,7 @@ #include "../resources/edit_account.xpm" #include "../resources/delete_account.xpm" #include "../resources/filter.xpm" +//---------------------------------------------------------------------------- // Icons from Silk Collection #include "../resources/house.xpm" @@ -109,13 +107,14 @@ #include "../resources/money_dollar.xpm" #include "../resources/user_edit.xpm" #include "../resources/wrench.xpm" - //---------------------------------------------------------------------------- #include <wx/debugrpt.h> #include "wx/sysopt.h" +#include "wx/wizard.h" +#include <wx/xml/xml.h> //---------------------------------------------------------------------------- +#include <boost/scoped_array.hpp> #include <string> -#include <boost/scoped_array.hpp> //---------------------------------------------------------------------------- namespace @@ -124,6 +123,80 @@ const wxChar *MMEX_INIDB_FNAME = wxT("/mmexini.db3"); //---------------------------------------------------------------------------- +class mmNewDatabaseWizard : public wxWizard +{ +public: + mmNewDatabaseWizard(wxFrame *frame, mmCoreDB* core); + void RunIt(bool modal); + + mmCoreDB* core_; + +private: + wxWizardPageSimple* page1; + + DECLARE_EVENT_TABLE() +}; +//---------------------------------------------------------------------------- + +class wxNewDatabaseWizardPage1 : public wxWizardPageSimple +{ +public: + wxNewDatabaseWizardPage1(mmNewDatabaseWizard* parent); + + void OnCurrency(wxCommandEvent& /*event*/); + virtual bool TransferDataFromWindow(); + +private: + mmNewDatabaseWizard* parent_; + wxButton* itemButtonCurrency_; + wxTextCtrl* itemUserName_; + int currencyID_; + + wxString userName; + + DECLARE_EVENT_TABLE() +}; +//---------------------------------------------------------------------------- + +class mmAddAccountWizard : public wxWizard +{ +public: + mmAddAccountWizard(wxFrame *frame, mmCoreDB* core); + void RunIt(bool modal); + wxString accountName_; + + mmCoreDB* core_; + int acctID_; + +private: + wxWizardPageSimple* page1; +}; +//---------------------------------------------------------------------------- + +class wxAddAccountPage1 : public wxWizardPageSimple +{ +public: + wxAddAccountPage1(mmAddAccountWizard* parent); + virtual bool TransferDataFromWindow(); + +private: + mmAddAccountWizard* parent_; + wxTextCtrl* textAccountName_; +}; +//---------------------------------------------------------------------------- + +class wxAddAccountPage2 : public wxWizardPageSimple +{ +public: + wxAddAccountPage2(mmAddAccountWizard *parent); + virtual bool TransferDataFromWindow(); + +private: + wxChoice* itemChoiceType_; + mmAddAccountWizard* parent_; +}; +//---------------------------------------------------------------------------- + wxString getMMEXIconPath() { wxString path; @@ -136,6 +209,12 @@ } //---------------------------------------------------------------------------- +inline bool sortCategs(const CategInfo &elem1, const CategInfo &elem2) +{ + return elem1.amount < elem2.amount; +} +//---------------------------------------------------------------------------- + /* See also: wxStackWalker, wxDebugReportUpload. */ @@ -161,7 +240,7 @@ bool OnInitImpl(mmGUIApp &app) { - app.SetAppName(mmIniOptions::appName_); // TODO: read from version resource + app.SetAppName(mmIniOptions::appName_); // FIXME: read from version resource /* Setting Locale causes unexpected problems, so default to English Locale */ app.getLocale().Init(wxLANGUAGE_ENGLISH); @@ -219,7 +298,8 @@ #endif mmGUIFrame *frame = new mmGUIFrame(mmIniOptions::appName_, wxPoint(valx, valy), wxSize(valw, valh)); - frame->Show(TRUE); + bool ok = frame->Show(); + wxASSERT(ok); if (isMaxStr == wxT("TRUE")) { frame->Maximize(true); @@ -228,10 +308,21 @@ // success: wxApp::OnRun() will be called which will enter the main message // loop and the application will run. If we returned FALSE here, the // application would exit immediately. - return true; + return ok; } //---------------------------------------------------------------------------- +/* + Extention expected in lower case. +*/ +void fixFileExt(wxFileName &f, const wxString &ext) +{ + if (f.GetExt().Lower() != ext) { + f.SetExt(ext); + } +} +//---------------------------------------------------------------------------- + } // namespace //---------------------------------------------------------------------------- @@ -239,10 +330,12 @@ BEGIN_EVENT_TABLE(mmNewDatabaseWizard, wxWizard) EVT_WIZARD_CANCEL(wxID_ANY, mmGUIFrame::OnWizardCancel) END_EVENT_TABLE() +//---------------------------------------------------------------------------- BEGIN_EVENT_TABLE(wxNewDatabaseWizardPage1, wxWizardPageSimple) EVT_BUTTON(ID_DIALOG_OPTIONS_BUTTON_CURRENCY, wxNewDatabaseWizardPage1::OnCurrency) END_EVENT_TABLE() +//---------------------------------------------------------------------------- BEGIN_EVENT_TABLE(mmGUIFrame, wxFrame) EVT_MENU(MENU_NEW, mmGUIFrame::OnNew) @@ -313,16 +406,39 @@ EVT_MENU(MENU_TREEPOPUP_ACCOUNT_VIEWOPEN, mmGUIFrame::OnViewOpenAccounts) END_EVENT_TABLE() -/*******************************************************/ +//---------------------------------------------------------------------------- IMPLEMENT_APP(mmGUIApp) -/*******************************************************/ +//---------------------------------------------------------------------------- +/* + Class used to store item specific information in a tree node +*/ +class mmTreeItemData : public wxTreeItemData +{ +public: + mmTreeItemData(int id, bool isBudget); + mmTreeItemData(const wxString& string); + + int getData() const { return id_; } + wxString getString() const { return stringData_; } + bool isStringData() const { return isString_; } + bool isBudgetingNode() const { return isBudgetingNode_; } + +private: + int id_; + bool isString_; + bool isBudgetingNode_; + wxString stringData_; +}; +//---------------------------------------------------------------------------- + mmTreeItemData::mmTreeItemData(int id, bool isBudget) : id_(id), isString_(false), isBudgetingNode_(isBudget) { } +//---------------------------------------------------------------------------- mmTreeItemData::mmTreeItemData(const wxString& string) : id_(), @@ -331,24 +447,20 @@ stringData_(string) { } +//---------------------------------------------------------------------------- - -mmAddAccountWizard::mmAddAccountWizard(wxFrame *frame, mmCoreDB* core) - :wxWizard(frame,wxID_ANY,_("Add Account Wizard"), - wxBitmap(addacctwiz_xpm),wxDefaultPosition, - wxDEFAULT_DIALOG_STYLE), core_(core), acctID_(-1) +mmAddAccountWizard::mmAddAccountWizard(wxFrame *frame, mmCoreDB* core) : + wxWizard(frame,wxID_ANY,_("Add Account Wizard"), + wxBitmap(addacctwiz_xpm),wxDefaultPosition, + wxDEFAULT_DIALOG_STYLE), core_(core), acctID_(-1) { // a wizard page may be either an object of predefined class page1 = new wxWizardPageSimple(this); - wxString noteString = mmIniOptions::appName_ - + + wxString noteString = mmIniOptions::appName_ + _(" models all transactions as belonging to accounts.\n\n The next pages will help you create a new account.\n\nTo help you get started, begin by making a list of all\nfinancial institutions where you hold an account."); - new wxStaticText(page1, - wxID_ANY, - noteString - ); + new wxStaticText(page1, wxID_ANY, noteString); wxAddAccountPage1* page2 = new wxAddAccountPage1(this); wxAddAccountPage2* page3 = new wxAddAccountPage2(this); @@ -356,34 +468,29 @@ // set the page order using a convenience function - could also use // SetNext/Prev directly as below wxWizardPageSimple::Chain(page1, page2); + wxWizardPageSimple::Chain(page2, page3); - wxWizardPageSimple::Chain(page2, page3); - // allow the wizard to size itself around the pages GetPageAreaSizer()->Add(page1); this->CentreOnParent(); } +//---------------------------------------------------------------------------- void mmAddAccountWizard::RunIt(bool modal) { - if ( modal ) - { - if ( RunWizard(page1) ) - { + if (modal) { + if (RunWizard(page1)) { // Success } - Destroy(); - } - else - { + } else { FinishLayout(); ShowPage(page1); Show(true); } } +//---------------------------------------------------------------------------- - mmNewDatabaseWizard::mmNewDatabaseWizard(wxFrame *frame, mmCoreDB* core) :wxWizard(frame,wxID_ANY,_("New Database Wizard"), wxBitmap(addacctwiz_xpm),wxDefaultPosition, @@ -405,6 +512,7 @@ // allow the wizard to size itself around the pages GetPageAreaSizer()->Add(page1); } +//---------------------------------------------------------------------------- void mmNewDatabaseWizard::RunIt(bool modal) { @@ -424,23 +532,22 @@ Show(true); } } +//---------------------------------------------------------------------------- -/****************************************************** -mmGUIFrame -********************************************************/ -inline bool sortCategs( const CategInfo &elem1, const CategInfo &elem2 ) -{ - return elem1.amount < elem2.amount; -} - mmGUIFrame::mmGUIFrame(const wxString& title, - const wxPoint& pos, const wxSize& size) - : wxFrame((wxFrame*)NULL, -1, title, pos, size), - gotoAccountID_(-1), - selectedItemData_(0), - panelCurrent_(0), - refreshRequested_(false) - + const wxPoint& pos, + const wxSize& size + ) : + wxFrame(0, -1, title, pos, size), + gotoAccountID_(-1), + refreshRequested_(), + panelCurrent_(), + homePanel(), + navTreeCtrl_(), + menuBar_(), + toolBar_(), + selectedItemData_(), + menuItemOnlineUpdateCurRate_() { // tell wxAuiManager to manage this frame m_mgr.SetManagedWindow(this); @@ -450,7 +557,7 @@ SetIcon(icon); /* Setup Printer */ - printer_ = new wxHtmlEasyPrinting(mmIniOptions::appName_, this); + printer_.reset(new wxHtmlEasyPrinting(mmIniOptions::appName_, this)); wxString printHeaderBase = mmIniOptions::appName_; printer_-> SetHeader( printHeaderBase + wxT("(@PAGENUM@/@PAGESCNT@)<hr>"), wxPAGE_ALL); @@ -543,14 +650,25 @@ } } } +//---------------------------------------------------------------------------- mmGUIFrame::~mmGUIFrame() { - delete printer_; + try { + cleanup(); + } catch (...) { + wxASSERT(false); + } +} +//---------------------------------------------------------------------------- + +void mmGUIFrame::cleanup() +{ + printer_.reset(); saveConfigFile(); m_mgr.UnInit(); - + /* Delete the GUI */ cleanupHomePanel(false); @@ -565,22 +683,27 @@ ::wxRemoveFile(wxT("top_categories.png")); - if (core_) - { + if (core_) { core_.reset(); } - if (db_) - { + if (db_) { db_->Close(); } - if (inidb_) - { + if (inidb_) { inidb_->Close(); } } +//---------------------------------------------------------------------------- +void mmGUIFrame::unselectNavTree() +{ + wxASSERT(navTreeCtrl_); + navTreeCtrl_->Unselect(); +} +//---------------------------------------------------------------------------- + void mmGUIFrame::saveConfigFile() { /* Save our settings to ini db */ @@ -620,6 +743,7 @@ mmDBWrapper::setINISettingValue(inidb_.get(), wxT("SIZEH"), valhs); mmDBWrapper::setINISettingValue(inidb_.get(), wxT("ISMAXIMIZED"), isMaxStr); } +//---------------------------------------------------------------------------- void mmGUIFrame::loadConfigFile() { @@ -627,6 +751,7 @@ wxString iniDBPath = mmGetBaseWorkingPath() + MMEX_INIDB_FNAME; inidb_->Open(iniDBPath); } +//---------------------------------------------------------------------------- void mmGUIFrame::menuEnableItems(bool enable) { @@ -662,6 +787,7 @@ toolBar_->EnableTool(MENU_ORGCATEGS, enable); toolBar_->EnableTool(MENU_CURRENCY, enable); } +//---------------------------------------------------------------------------- void mmGUIFrame::menuPrintingEnable(bool enable) { @@ -669,6 +795,7 @@ menuBar_->FindItem(MENU_PRINT)->Enable(enable); menuBar_->FindItem(MENU_EXPORT_HTML)->Enable(enable); } +//---------------------------------------------------------------------------- void mmGUIFrame::createControls() { @@ -709,6 +836,7 @@ Name(wxT("Home")).Caption(wxT("Home")). CenterPane().PaneBorder(false)); } +//---------------------------------------------------------------------------- void mmGUIFrame::updateNavTreeControl() { @@ -1055,6 +1183,7 @@ navTreeCtrl_->Expand(accounts); } +//---------------------------------------------------------------------------- wxString mmGUIFrame::createCategoryList() { @@ -1156,6 +1285,7 @@ return hb.getHTMLText(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnSelChanged(wxTreeEvent& event) { @@ -1759,6 +1889,7 @@ } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnLaunchAccountWebsite(wxCommandEvent& /*event*/) { @@ -1782,6 +1913,7 @@ } } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnPopupEditAccount(wxCommandEvent& /*event*/) { @@ -1810,6 +1942,7 @@ } } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnPopupDeleteAccount(wxCommandEvent& /*event*/) { @@ -1843,11 +1976,13 @@ } } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnItemRightClick(wxTreeEvent& event) { showTreePopupMenu(event.GetItem(), event.GetPoint()); } +//---------------------------------------------------------------------------- void mmGUIFrame::showTreePopupMenu(wxTreeItemId id, const wxPoint& pt) { @@ -1944,6 +2079,7 @@ } } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnViewAllAccounts(wxCommandEvent&) { @@ -1960,6 +2096,8 @@ mmDBWrapper::setINISettingValue(inidb_.get(), wxT("VIEWACCOUNTS"), vAccts); } +//---------------------------------------------------------------------------- + void mmGUIFrame::OnViewFavoriteAccounts(wxCommandEvent&) { //Get current settings for view accounts @@ -1975,6 +2113,8 @@ mmDBWrapper::setINISettingValue(inidb_.get(), wxT("VIEWACCOUNTS"), vAccts); } +//---------------------------------------------------------------------------- + void mmGUIFrame::OnViewOpenAccounts(wxCommandEvent&) { //Get current settings for view accounts @@ -1990,6 +2130,8 @@ mmDBWrapper::setINISettingValue(inidb_.get(), wxT("VIEWACCOUNTS"), vAccts); } +//---------------------------------------------------------------------------- + void mmGUIFrame::createCheckingAccountPage(int accountID) { wxSizer *sizer = cleanupHomePanel(); @@ -2002,6 +2144,7 @@ sizer->Add(panelCurrent_, 1, wxGROW|wxALL, 1); homePanel->Layout(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnGotoAccount(wxCommandEvent& WXUNUSED(event)) { @@ -2010,6 +2153,7 @@ createCheckingAccountPage(gotoAccountID_); } } +//---------------------------------------------------------------------------- void mmGUIFrame::createBudgetingPage(int budgetYearID) { @@ -2022,6 +2166,7 @@ homePanel->Layout(); } +//---------------------------------------------------------------------------- void mmGUIFrame::createHomePage() { @@ -2053,6 +2198,7 @@ homePanel->Layout(); refreshRequested_ = false; } +//---------------------------------------------------------------------------- void mmGUIFrame::createReportsPage(mmPrintableBase* rs) { @@ -2065,6 +2211,7 @@ homePanel->Layout(); } +//---------------------------------------------------------------------------- void mmGUIFrame::createHelpPage() { @@ -2077,8 +2224,8 @@ homePanel->Layout(); } +//---------------------------------------------------------------------------- - void mmGUIFrame::createMenu() { wxBitmap toolBarBitmaps[11]; @@ -2328,6 +2475,7 @@ SetMenuBar(menuBar_); } +//---------------------------------------------------------------------------- void mmGUIFrame::createToolBar() { @@ -2361,9 +2509,9 @@ // after adding the buttons to the toolbar, must call Realize() to reflect changes toolBar_->Realize(); } +//---------------------------------------------------------------------------- -void mmGUIFrame::createDataStore(const wxString& fileName, - bool openingNew) +void mmGUIFrame::createDataStore(const wxString& fileName, const wxString& pwd, bool openingNew) { if (core_) { @@ -2377,10 +2525,10 @@ } wxFileName checkExt(fileName); - wxString password = wxEmptyString; - if (checkExt.GetExt() == wxT("emb") && wxFileName::FileExists(fileName)) + wxString password; + if (checkExt.GetExt().Lower() == wxT("emb") && wxFileName::FileExists(fileName)) { - password = wxGetPasswordFromUser(_("Money Manager Ex: Enter Password For Database..")); + password = !pwd.empty() ? pwd : wxGetPasswordFromUser(_("Enter database's password")); } // Existing Database @@ -2403,19 +2551,18 @@ // we need to check the db whether it is the right version if (!mmDBWrapper::checkDBVersion(db_.get())) { - wxString note = mmIniOptions::appName_ - + _(" - No File opened "); + wxString note = mmIniOptions::appName_ + _(" - No File opened "); this->SetTitle(note); mmShowErrorMessage(this, - _("Sorry. The Database version is too old or Database password is incorrect"), + _("Sorry. The Database version is too old or Database password is incorrect"), _("Error opening database")); db_->Close(); db_.reset(); return ; } + password_ = password; - core_.reset(new mmCoreDB(db_)); } else if (openingNew) // New Database @@ -2457,9 +2604,8 @@ } else // open of existing database failed { - wxString note = mmIniOptions::appName_ + - _(" - No File opened "); - this->SetTitle(note); + wxString note = mmIniOptions::appName_ + _(" - No File opened "); + this->SetTitle(note); wxMessageDialog msgDlg(this, _("Cannot locate previously opened database.\nDo you want to browse to locate the file?"), _("Error opening database"), wxYES_NO); @@ -2475,6 +2621,7 @@ openDataBase(fileName); } +//---------------------------------------------------------------------------- void mmGUIFrame::openDataBase(const wxString& fileName) { @@ -2505,17 +2652,21 @@ password_.Clear(); } } +//---------------------------------------------------------------------------- wxPanel* mmGUIFrame::createMainFrame(wxPanel* /*parent*/) { return 0; } +//---------------------------------------------------------------------------- -void mmGUIFrame::openFile(const wxString& fileName, bool openingNew) +void mmGUIFrame::openFile(const wxString& fileName, + bool openingNew, + const wxString &password + ) { - // Before deleting, go to home page first - // createHomePage(); - createDataStore(fileName, openingNew); + // Before deleting, go to home page first createHomePage() + createDataStore(fileName, password, openingNew); if (db_.get()) { @@ -2534,36 +2685,51 @@ if (!db_.get()) { - mmDBWrapper::setINISettingValue(inidb_.get(), - wxT("LASTFILENAME"), wxGetEmptyString()); + mmDBWrapper::setINISettingValue(inidb_.get(), wxT("LASTFILENAME"), wxGetEmptyString()); showBeginAppDialog(); } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnNew(wxCommandEvent& /*event*/) { - wxString extSupported = wxT("MMB Files(*.mmb)|*.mmb"); - wxFileDialog dlg(this, wxT("Choose database file to create"), - wxGetEmptyString(), wxGetEmptyString(), extSupported, wxSAVE | wxOVERWRITE_PROMPT); + wxFileDialog dlg(this, + _("Choose database file to create"), + wxGetEmptyString(), + wxGetEmptyString(), + wxT("MMB Files(*.mmb)|*.mmb"), + wxSAVE | wxOVERWRITE_PROMPT + ); - if(dlg.ShowModal() == wxID_OK) { - wxString fileName = dlg.GetPath(); - if (!dlg.GetPath().Contains(wxT(".mmb"))) - fileName = dlg.GetPath() + wxT(".mmb"); - openFile(fileName, true); - } + if(dlg.ShowModal() != wxID_OK) { + return; + } + + wxString fileName = dlg.GetPath(); + + if (!fileName.EndsWith(wxT(".mmb"))) { + fileName += wxT(".mmb"); + } + + openFile(fileName, true); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnOpen(wxCommandEvent& /*event*/) { - wxString extSupported = wxT("MMB Files(*.mmb)|*.mmb|Encrypted MMB files (*.emb)|*.emb"); - wxString fileName = wxFileSelector(wxT("Choose database file to open"), - wxGetEmptyString(), wxGetEmptyString(), wxGetEmptyString(), extSupported, wxFILE_MUST_EXIST); - if ( !fileName.empty() ) - { - openFile(fileName, false); - } + wxString fileName = wxFileSelector(_("Choose database file to open"), + wxGetEmptyString(), + wxGetEmptyString(), + wxGetEmptyString(), + wxT("MMB Files(*.mmb)|*.mmb|Encrypted MMB files (*.emb)|*.emb"), + wxFILE_MUST_EXIST + ); + + if (!fileName.empty()) { + openFile(fileName, false); + } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnConvertEncryptedDB(wxCommandEvent& /*event*/) { @@ -2572,11 +2738,11 @@ wxGetEmptyString(), wxGetEmptyString(), wxGetEmptyString(), extSupported, wxFILE_MUST_EXIST); if ( !encFileName.empty() ) { - wxString password = wxGetPasswordFromUser(_("Money Manager Ex: Enter Password For Database..")); + wxString password = wxGetPasswordFromUser(_("Enter password for database")); if (!password.IsEmpty()) { wxString wildCardStr = wxT("MMB Files(*.mmb)|*.mmb"); - wxFileDialog dlg(this, wxT("Choose database file to Save As"), + wxFileDialog dlg(this, _("Choose database file to Save As"), wxGetEmptyString(), wxGetEmptyString(), wildCardStr, wxSAVE | wxOVERWRITE_PROMPT); if(dlg.ShowModal() == wxID_OK) @@ -2607,78 +2773,95 @@ } } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnSaveAs(wxCommandEvent& /*event*/) { - wxString wildCardStr = wxT("MMB Files(*.mmb)|*.mmb|Encrypted MMB files (*.emb)|*.emb"); - wxFileDialog dlg(this, wxT("Choose database file to Save As"), - wxGetEmptyString(), wxGetEmptyString(), wildCardStr, wxSAVE | wxOVERWRITE_PROMPT); - if(dlg.ShowModal() == wxID_OK) - { - wxString fileName = dlg.GetPath(); - if(dlg.GetFilterIndex() == 0) + bool ok = db_ != 0; + wxASSERT(ok); + + if (fileName_.empty()) { + wxASSERT(false); + return; + } + + wxFileDialog dlg(this, + _("Save database file as"), + wxGetEmptyString(), + wxGetEmptyString(), + wxT("MMB Files(*.mmb)|*.mmb|Encrypted MMB files (*.emb)|*.emb"), + wxSAVE | wxOVERWRITE_PROMPT + ); + + if (dlg.ShowModal() != wxID_OK) { + return; + } + + bool encrypt = dlg.GetFilterIndex() != 0; // emb -> Encrypted mMB + wxFileName newFileName(dlg.GetPath()); + fixFileExt(newFileName, encrypt ? wxT("emb") : wxT("mmb")); + + wxFileName oldFileName(fileName_); // opened db's file + + if (newFileName == oldFileName) { // on case-sensitive FS uses case-sensitive comparison + wxMessageDialog dlg(this, _("Can't copy file to itself"), _("Error"), wxICON_ERROR); + dlg.ShowModal(); + return; + } + + // prepare to copy + + wxString new_password; + bool rekey = encrypt ^ db_->IsEncrypted(); + + if (encrypt) { - if (!dlg.GetPath().Contains(wxT(".mmb"))) - fileName = dlg.GetPath() + wxT(".mmb"); - } - else - { - if (!dlg.GetPath().Contains(wxT(".emb"))) - fileName = dlg.GetPath() + wxT(".emb"); + if (rekey) { + new_password = wxGetPasswordFromUser(_("Enter password for new database")); + if (new_password.empty()) { + return; + } + } else { + new_password = password_; + } } - if (db_) + // copying db + + if (db_) // database must be closed before copying its file { db_->Close(); db_.reset(); } - wxCopyFile(fileName_, fileName, false); + + if (!wxCopyFile(oldFileName.GetFullPath(), newFileName.GetFullPath(), true)) { // true -> overwrite if file exists + return; + } - wxFileName newFileName(fileName); - wxFileName oldFileName(fileName_); - if (newFileName.GetExt() == oldFileName.GetExt()) - { - // do nothing - } - else - { - wxString password = wxEmptyString; - wxString oldpassword = password_; - if (newFileName.GetExt() == wxT("emb")) - { - password = wxGetPasswordFromUser(wxT("Money Manager Ex: Set Password For New Database..")); - } - - boost::shared_ptr<wxSQLite3Database> pDB(new wxSQLite3Database()); - db_ = pDB; - - if (oldFileName.GetExt() == wxT("emb")) - { - db_->Open(fileName, oldpassword); - db_->ReKey(wxEmptyString); - } - else - { - db_->Open(fileName); - db_->ReKey(password); - } - - db_->Close(); - db_.reset(); - } - openFile(fileName, false); + if (rekey) // encrypt or reset encryption + { + wxSQLite3Database dbx; + dbx.Open(newFileName.GetFullPath(), password_); + dbx.ReKey(new_password); // empty password resets encryption + dbx.Close(); } + + password_.clear(); + openFile(newFileName.GetFullPath(), false, new_password); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnExport(wxCommandEvent& /*event*/) { mmExportCSV(db_.get()); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnExportToQIF(wxCommandEvent& /*event*/) { mmExportQIF(db_.get()); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnImportCSV(wxCommandEvent& /*event*/) { @@ -2686,6 +2869,7 @@ if (accountID != -1) createCheckingAccountPage(accountID); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnImportQFX(wxCommandEvent& /*event*/) { @@ -2720,7 +2904,7 @@ wxString acctName = scd->GetStringSelection(); fromAccountID = mmDBWrapper::getAccountID(db_.get(), acctName); - wxString fileName = wxFileSelector(wxT("Choose QFX data file to import"), + wxString fileName = wxFileSelector(_("Choose QFX data file to import"), wxGetEmptyString(), wxGetEmptyString(), wxGetEmptyString(), wxT("*.qfx"), wxFILE_MUST_EXIST); if ( !fileName.empty() ) { @@ -2757,6 +2941,7 @@ } scd->Destroy(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnImportQIF(wxCommandEvent& /*event*/) { @@ -2764,6 +2949,7 @@ if (accountID != -1) createCheckingAccountPage(accountID); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnImportUniversalCSV(wxCommandEvent& /*event*/) { @@ -2778,6 +2964,7 @@ dlg->ShowModal(); dlg->Destroy(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnImportCSVMMNET(wxCommandEvent& /*event*/) { @@ -2785,11 +2972,13 @@ if (accountID != -1) createCheckingAccountPage(accountID); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { Close(TRUE); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnNewAccount(wxCommandEvent& /*event*/) { @@ -2816,11 +3005,13 @@ GetEventHandler()->AddPendingEvent(ev); } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnAccountList(wxCommandEvent& /*event*/) { createHomePage(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnOrgCategories(wxCommandEvent& /*event*/) { @@ -2828,6 +3019,7 @@ dlg->ShowModal(); dlg->Destroy(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnOrgPayees(wxCommandEvent& /*event*/) { @@ -2835,6 +3027,7 @@ dlg->ShowModal(); dlg->Destroy(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnBudgetSetupDialog(wxCommandEvent& /*event*/) { @@ -2847,6 +3040,7 @@ updateNavTreeControl(); dlg->Destroy(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnTransactionReport(wxCommandEvent& /*event*/) { @@ -2871,6 +3065,7 @@ } dlg->Destroy(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnCashFlowSpecificAccounts() { @@ -2909,6 +3104,7 @@ } mcd->Destroy(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnOptions(wxCommandEvent& /*event*/) { @@ -2934,12 +3130,14 @@ menuItemOnlineUpdateCurRate_->Enable(false); } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnHelp(wxCommandEvent& /*event*/) { menuPrintingEnable(true); createHelpPage(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnCheckUpdate(wxCommandEvent& /*event*/) { @@ -3018,6 +3216,7 @@ } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnOnlineUpdateCurRate(wxCommandEvent& /*event*/) { @@ -3165,18 +3364,21 @@ createHomePage(); updateNavTreeControl(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnReportIssues(wxCommandEvent& /*event*/) { wxString url = wxT("http://www.codelathe.com/forum"); wxLaunchDefaultBrowser(url); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnBeNotified(wxCommandEvent& /*event*/) { wxString url = wxT("http://groups.google.com/group/mmlist"); wxLaunchDefaultBrowser(url); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { @@ -3184,12 +3386,14 @@ dlg->ShowModal(); dlg->Destroy(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnPrintPageSetup(wxCommandEvent& WXUNUSED(event)) { if (printer_) printer_->PageSetup(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnPrintPageReport(wxCommandEvent& WXUNUSED(event)) { @@ -3207,6 +3411,7 @@ printer_ ->PrintFile(wxT("help/index.html")); } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnPrintPagePreview(wxCommandEvent& WXUNUSED(event)) { @@ -3224,6 +3429,7 @@ printer_ ->PreviewFile(wxT("help/index.html")); } } +//---------------------------------------------------------------------------- void mmGUIFrame::showBeginAppDialog() { @@ -3272,12 +3478,13 @@ dlg->Destroy(); } +//---------------------------------------------------------------------------- - void mmGUIFrame::OnShowAppStartDialog(wxCommandEvent& WXUNUSED(event)) { showBeginAppDialog(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnExportToHtml(wxCommandEvent& WXUNUSED(event)) { @@ -3294,6 +3501,7 @@ } } } +//---------------------------------------------------------------------------- void mmGUIFrame::OnBillsDeposits(wxCommandEvent& WXUNUSED(event)) { @@ -3306,6 +3514,7 @@ homePanel->Layout(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnStocks(wxCommandEvent& /*event*/) { @@ -3318,6 +3527,7 @@ homePanel->Layout(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnAssets(wxCommandEvent& /*event*/) { @@ -3330,6 +3540,7 @@ homePanel->Layout(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnCurrency(wxCommandEvent& /*event*/) { @@ -3339,11 +3550,13 @@ } dlg->Destroy(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnWizardCancel(wxWizardEvent& event) { event.Veto(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnEditAccount(wxCommandEvent& /*event*/) { @@ -3384,6 +3597,7 @@ } scd->Destroy(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnDeleteAccount(wxCommandEvent& /*event*/) { @@ -3430,19 +3644,22 @@ } delete[] arrAcctID; scd->Destroy(); - } +} +//---------------------------------------------------------------------------- void mmGUIFrame::OnViewToolbar(wxCommandEvent &event) { m_mgr.GetPane(wxT("toolbar")).Show(event.IsChecked()); m_mgr.Update(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnViewLinks(wxCommandEvent &event) { m_mgr.GetPane(wxT("Navigation")).Show(event.IsChecked()); m_mgr.Update(); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnViewToolbarUpdateUI(wxUpdateUIEvent &event) { @@ -3451,6 +3668,7 @@ else event.Check(false); } +//---------------------------------------------------------------------------- void mmGUIFrame::OnViewLinksUpdateUI(wxUpdateUIEvent &event) { Modified: trunk/mmex/src/mmex.h =================================================================== --- trunk/mmex/src/mmex.h 2009-11-07 10:49:57 UTC (rev 736) +++ trunk/mmex/src/mmex.h 2009-11-07 10:52:15 UTC (rev 737) @@ -16,22 +16,38 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ********************************************************/ +//---------------------------------------------------------------------------- #ifndef _MM_EX_MMEX_H_ #define _MM_EX_MMEX_H_ //---------------------------------------------------------------------------- -#include "defs.h" -#include "wx/wizard.h" -#include "wx/aui/aui.h" -#include "wx/xml/xml.h" -#include "wx/arrstr.h" -#include "dbwrapper.h" -#include "util.h" -#include "maincurrencydialog.h" +#include <wx/app.h> +#include <wx/aui/aui.h> //---------------------------------------------------------------------------- -#include "mmcoredb.h" #include <boost/scoped_ptr.hpp> +#include <boost/shared_ptr.hpp> //---------------------------------------------------------------------------- +class wxWizardEvent; +class wxSQLite3Database; +class wxTreeCtrl; +class wxToolBar; +class wxHtmlEasyPrinting; +class wxTreeItemId; +class wxTreeEvent; +//---------------------------------------------------------------------------- +class mmCoreDB; +class mmPrintableBase; +class mmPanelBase; +class mmTreeItemData; +//---------------------------------------------------------------------------- +struct CategInfo +{ + wxString categ; + wxString amountStr; + double amount; +}; +//---------------------------------------------------------------------------- + class mmGUIApp : public wxApp { public: @@ -49,133 +65,62 @@ //---------------------------------------------------------------------------- DECLARE_APP(mmGUIApp) //---------------------------------------------------------------------------- -class wxListCtrl; -class wxPanel; -class wxBoxSizer; -class wxSplitterWindow; -class mmCoreDataStore; -class wxTreeCtrl; -class wxFileConfig; -class mmPanelBase; -class wxTreeItemData; -class mmData; -class wxToolBar; -class mmPrintableBase; -//---------------------------------------------------------------------------- -/** - Class used to store item specific information in a tree node -*/ -class mmTreeItemData : public wxTreeItemData +class mmGUIFrame : public wxFrame { public: - mmTreeItemData(int id, bool isBudget); - mmTreeItemData(const wxString& string); + mmGUIFrame(const wxString& title, + const wxPoint& pos, + const wxSize& size); - int getData() const { return id_; } - wxString getString() const { return stringData_; } - bool isStringData() const { return isString_; } - bool isBudgetingNode() const { return isBudgetingNode_; } + ~mmGUIFrame(); -private: - int id_; - bool isString_; - bool isBudgetingNode_; - wxString stringData_; -}; -//---------------------------------------------------------------------------- + void OnWizardCancel(wxWizardEvent& event); + wxString createCategoryList(); -class mmNewDatabaseWizard : public wxWizard -{ -public: - mmNewDatabaseWizard(wxFrame *frame, mmCoreDB* core); - void RunIt(bool modal); - - mmCoreDB* core_; -private: - wxWizardPageSimple* page1; + void setGotoAccountID(int account_id) { gotoAccountID_ = account_id; } + void unselectNavTree(); - DECLARE_EVENT_TABLE() -}; -//---------------------------------------------------------------------------- - -class wxNewDatabaseWizardPage1 : public wxWizardPageSimple -{ -public: - wxNewDatabaseWizardPage1(mmNewDatabaseWizard* parent); - - void OnCurrency(wxCommandEvent& /*event*/); - virtual bool TransferDataFromWindow(); - private: - mmNewDatabaseWizard* parent_; - wxButton* itemButtonCurrency_; - wxTextCtrl* itemUserName_; - int currencyID_; + /* handles to the DB Abstraction */ + boost::scoped_ptr<mmCoreDB> core_; - wxString userName; + /* handles to SQLite Database */ + boost::shared_ptr<wxSQLite3Database> db_; + boost::scoped_ptr<wxSQLite3Database> inidb_; - DECLARE_EVENT_TABLE() -}; -//---------------------------------------------------------------------------- + /* Currently open file name */ + wxString fileName_; + wxString password_; -class mmAddAccountWizard : public wxWizard -{ -public: - mmAddAccountWizard(wxFrame *frame, mmCoreDB* core); - void RunIt(bool modal); - wxString accountName_; + int gotoAccountID_; - mmCoreDB* core_; - int acctID_; + /* Cannot process home page recursively */ + bool refreshRequested_; -private: - wxWizardPageSimple* page1; -}; -//---------------------------------------------------------------------------- + /* controls */ + mmPanelBase* panelCurrent_; + wxPanel* homePanel; + wxTreeCtrl* navTreeCtrl_; + wxMenuBar *menuBar_; + wxToolBar* toolBar_; + mmTreeItemData* selectedItemData_; + wxMenuItem* menuItemOnlineUpdateCurRate_; // Menu Item for Disabling Item -class wxAddAccountPage1 : public wxWizardPageSimple -{ -public: - wxAddAccountPage1(mmAddAccountWizard* parent); + /* printing */ + boost::scoped_ptr<wxHtmlEasyPrinting> printer_; - virtual bool TransferDataFromWindow(); + /* wxAUI */ + wxAuiManager m_mgr; + wxString m_perspective; -private: - mmAddAccountWizard* parent_; - wxTextCtrl* textAccountName_; -}; -//---------------------------------------------------------------------------- + /* Homepage panel logic */ + wxString m_topCategories; -class wxAddAccountPage2 : public wxWizardPageSimple -{ -public: - wxAddAccountPage2(mmAddAccountWizard *parent); - virtual bool TransferDataFromWindow(); - -private: - wxChoice* itemChoiceType_; - mmAddAccountWizard* parent_; -}; -//---------------------------------------------------------------------------- - -struct CategInfo -{ - wxString categ; - wxString amountStr; - double amount; -}; -//---------------------------------------------------------------------------- - -class mmGUIFrame : public wxFrame -{ -public: - mmGUIFrame(const wxString& title, - const wxPoint& pos, - const wxSize& size); - - ~mmGUIFrame(); - + void cleanup(); + wxSizer* cleanupHomePanel(bool new_sizer = true); + void openFile(const wxString& fileName, bool openingNew, const wxString &password = wxGetEmptyString()); + void createDataStore(const wxString& fileName, const wxString &passwd, bool openingNew); void createMenu(); void createToolBar(); void createHomePage(); @@ -183,9 +128,6 @@ void createHelpPage(); wxPanel* createMainFrame(wxPanel* mainpanel); - wxString createCategoryList(); - void createDataStore(const wxString& fileName, - bool openingNew = false); void createCheckingAccountPage(int accountID); void createBudgetingPage(int budgetYearID); void createControls(); @@ -195,7 +137,6 @@ void menuPrintingEnable(bool enable); void updateNavTreeControl(); void showTreePopupMenu(wxTreeItemId id, const wxPoint& pt); - void openFile(const wxString& fileName, bool openingNew); void showBeginAppDialog(); void openDataBase(const wxString& fileName); void OnLaunchAccountWebsite(wxCommandEvent& event); @@ -205,7 +146,7 @@ void OnConvertEncryptedDB(wxCommandEvent& event); void OnSaveAs(wxCommandEvent& event); void OnExport(wxCommandEvent& event); - void OnExportToQIF(wxCommandEvent& event); + void OnExportToQIF(wxCommandEvent& event); void OnExportToHtml(wxCommandEvent& event); void OnImportCSV(wxCommandEvent& event); void OnImportQFX(wxCommandEvent& event); @@ -220,19 +161,19 @@ void OnStocks(wxCommandEvent& event); void OnAssets(wxCommandEvent& event); void OnGotoAccount(wxCommandEvent& WXUNUSED(event)); - void OnViewToolbar(wxCommandEvent &event); - void OnViewStatusbar(wxCommandEvent &event); - void OnViewLinks(wxCommandEvent &event); - void OnViewToolbarUpdateUI(wxUpdateUIEvent &event); - void OnViewStatusbarUpdateUI(wxUpdateUIEvent &event); - void OnViewLinksUpdateUI(wxUpdateUIEvent &event); + void OnViewToolbar(wxCommandEvent &event); + void OnViewStatusbar(wxCommandEvent &event); + void OnViewLinks(wxCommandEvent &event); + void OnViewToolbarUpdateUI(wxUpdateUIEvent &event); + void OnViewStatusbarUpdateUI(wxUpdateUIEvent &event); + void OnViewLinksUpdateUI(wxUpdateUIEvent &event); void OnOnlineUpdateCurRate(wxCommandEvent& event); void OnNewAccount(wxCommandEvent& event); void OnAccountList(wxCommandEvent& event); void OnEditAccount(wxCommandEvent& event); void OnDeleteAccount(wxCommandEvent& event); - + void OnOrgCategories(wxCommandEvent& event); void OnOrgPayees(wxCommandEvent& event); void OnOptions(wxCommandEvent& event); @@ -253,56 +194,12 @@ void OnPopupDeleteAccount(wxCommandEvent& event); void OnPopupEditAccount(wxCommandEvent& event); - void OnWizardCancel(wxWizardEvent& event); + void OnViewAllAccounts(wxCommandEvent& event); + void OnViewFavoriteAccounts(wxCommandEvent& event); + void OnViewOpenAccounts(wxCommandEvent& event); - void OnViewAllAccounts(wxCommandEvent& event); - void OnViewFavoriteAccounts(wxCommandEvent& event); - void OnViewOpenAccounts(wxCommandEvent& event); - -public: - mmPanelBase* panelCurrent_; - wxPanel* homePanel; - wxTreeCtrl* navTreeCtrl_; - int gotoAccountID_; - -private: - /* handles to the DB Abstraction */ - boost::scoped_ptr<mmCoreDB> core_; - - /* handles to SQLite Database */ - boost::shared_ptr<wxSQLite3Database> db_; - boost::scoped_ptr<wxSQLite3Database> inidb_; - - /* Currently open file name */ - wxString fileName_; - wxString password_; - - /* controls */ - wxMenuBar *menuBar_; - wxToolBar* toolBar_; - mmTreeItemData* selectedItemData_; - - /* printing */ - wxHtmlEasyPrinting* printer_; - - /* wxAUI */ - wxAuiManager m_mgr; - wxString m_perspective; - - /* Homepage panel logic */ - wxString m_topCategories; - - /* Cannot process home page recursively */ - bool refreshRequested_; - - /* Menu Item for Disabling Item */ - wxMenuItem* menuItemOnlineUpdateCurRate_; - -private: // any class wishing to process wxWindows events must use this macro DECLARE_EVENT_TABLE() - - wxSizer* cleanupHomePanel(bool new_sizer = true); }; //---------------------------------------------------------------------------- #endif // _MM_EX_MMEX_H_ Modified: trunk/mmex/src/mmhomepagepanel.cpp =================================================================== --- trunk/mmex/src/mmhomepagepanel.cpp 2009-11-07 10:49:57 UTC (rev 736) +++ trunk/mmex/src/mmhomepagepanel.cpp 2009-11-07 10:52:15 UTC (rev 737) @@ -565,7 +565,7 @@ { long id = -1; number.ToLong(&id); - frame_->gotoAccountID_ = id; + frame_->setGotoAccountID(id); wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, MENU_GOTOACCOUNT); frame_->GetEventHandler()->AddPendingEvent(evt); } @@ -580,7 +580,7 @@ frame_->GetEventHandler()->AddPendingEvent(evt); } // Deselect any selections in the tree ctrl, so tree works - frame_->navTreeCtrl_->Unselect(); + frame_->unselectNavTree(); } Modified: trunk/mmex/src/qifimport.cpp =================================================================== --- trunk/mmex/src/qifimport.cpp 2009-11-07 10:49:57 UTC (rev 736) +++ trunk/mmex/src/qifimport.cpp 2009-11-07 10:52:15 UTC (rev 737) @@ -218,6 +218,7 @@ #include "guiid.h" #include "fileviewerdialog.h" #include "mmex.h" +#include "mmcoredb.h" namespace { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-11 19:16:41
|
Revision: 752 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=752&view=rev Author: omalleypat Date: 2009-11-11 19:16:26 +0000 (Wed, 11 Nov 2009) Log Message: ----------- Merge changes to categdialog.* from branch back into trunk using these commands: svn merge https://moneymanagerex.svn.sourceforge.net/svnroot/moneymanagerex/tags/releases/0.9.5.1/include/categdialog.h ./src/categdialog.h svn merge https://moneymanagerex.svn.sourceforge.net/svnroot/moneymanagerex/tags/releases/0.9.5.1/src/categdialog.cpp ./src/categdialog.cpp There were no conflicts to be resolved. Modified Paths: -------------- trunk/mmex/src/categdialog.cpp Property Changed: ---------------- trunk/mmex/src/categdialog.cpp trunk/mmex/src/categdialog.h Modified: trunk/mmex/src/categdialog.cpp =================================================================== --- trunk/mmex/src/categdialog.cpp 2009-11-10 16:40:42 UTC (rev 751) +++ trunk/mmex/src/categdialog.cpp 2009-11-11 19:16:26 UTC (rev 752) @@ -130,7 +130,7 @@ wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5); -#if defined (__WXGTK__) || (__WXMAC__) +#if defined (__WXGTK__) || defined (__WXMAC__) treeCtrl_ = new wxTreeCtrl( itemDialog1, ID_DIALOG_CATEG_TREECTRL_CATS, wxDefaultPosition, wxSize(100, 200)); #else Property changes on: trunk/mmex/src/categdialog.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/categdialog.cpp:408-735 /tags/releases/0.9.5.1/src/categdialog.cpp:736-751 Property changes on: trunk/mmex/src/categdialog.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/categdialog.h:408-735 /tags/releases/0.9.5.1/include/categdialog.h:736-751 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-11 21:47:25
|
Revision: 753 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=753&view=rev Author: omalleypat Date: 2009-11-11 21:46:57 +0000 (Wed, 11 Nov 2009) Log Message: ----------- Merge changes from 0.9.5.1 release using the following commands: svn merge -r 407:HEAD -x -b -x --ignore-eol-style https://moneymanagerex.svn.sourceforge.net/svnroot/moneymanagerex/tags/releases/0.9.5.1/include/stockspanel.h ./src/stockspanel.h svn merge -r 407:HEAD -x -b -x --ignore-eol-style https://moneymanagerex.svn.sourceforge.net/svnroot/moneymanagerex/tags/releases/0.9.5.1/src/stockspanel.cpp ./src/stockspanel.cpp There were no conflicts. Modified Paths: -------------- trunk/mmex/src/stockspanel.cpp trunk/mmex/src/stockspanel.h Property Changed: ---------------- trunk/mmex/src/stockspanel.cpp trunk/mmex/src/stockspanel.h Modified: trunk/mmex/src/stockspanel.cpp =================================================================== --- trunk/mmex/src/stockspanel.cpp 2009-11-11 19:16:26 UTC (rev 752) +++ trunk/mmex/src/stockspanel.cpp 2009-11-11 21:46:57 UTC (rev 753) @@ -45,6 +45,7 @@ EVT_LIST_ITEM_ACTIVATED(ID_PANEL_STOCKS_LISTCTRL, stocksListCtrl::OnListItemActivated) EVT_LIST_ITEM_RIGHT_CLICK(ID_PANEL_STOCKS_LISTCTRL, stocksListCtrl::OnItemRightClick) EVT_LIST_ITEM_SELECTED(ID_PANEL_STOCKS_LISTCTRL, stocksListCtrl::OnListItemSelected) + EVT_LIST_ITEM_DESELECTED(ID_PANEL_STOCKS_LISTCTRL, stocksListCtrl::OnListItemDeselected) EVT_MENU(MENU_TREEPOPUP_NEW, stocksListCtrl::OnNewStocks) EVT_MENU(MENU_TREEPOPUP_EDIT, stocksListCtrl::OnEditStocks) @@ -171,8 +172,8 @@ ID_PANEL_CHECKING_STATIC_BALHEADER, _("Total:"), wxDefaultPosition, wxSize(500, 20), 0 ); - //m_LED = new awxLed( headerPanel, ID_PANEL_STOCK_UPDATE_LED, wxDefaultPosition, wxDefaultSize, awxLED_GREEN, 0 ); - m_LED = new awxLed( headerPanel, ID_PANEL_STOCK_UPDATE_LED, wxDefaultPosition, wxDefaultSize, awxLED_GREEN); + m_LED = new awxLed( headerPanel, ID_PANEL_STOCK_UPDATE_LED, wxDefaultPosition, wxDefaultSize, awxLED_GREEN, 1, 5 ); + //m_LED = new awxLed( headerPanel, ID_PANEL_STOCK_UPDATE_LED, wxDefaultPosition, wxDefaultSize, awxLED_GREEN); m_LED->SetState( awxLED_OFF ); m_LED->SetToolTip( _("Idle") ); @@ -274,12 +275,14 @@ wxDefaultPosition, wxDefaultSize, 0 ); itemButton81->SetToolTip(_("Edit Stock Investment")); itemBoxSizer5->Add(itemButton81, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); + itemButton81->Enable(false); wxButton* itemButton7 = new wxButton( itemPanel12, ID_BUTTON_DELETE_STOCK, _("&Delete"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton7->SetToolTip(_("Delete Stock Investment")); itemBoxSizer5->Add(itemButton7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); - + itemButton7->Enable(false); + wxButton* itemButton8 = new wxButton( itemPanel12, ID_BUTTON_REFRESH_STOCK, _("&Refresh"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton8->SetToolTip(_("Refresh Stock Prices from Yahoo")); @@ -819,8 +822,22 @@ void stocksListCtrl::OnListItemSelected(wxListEvent& event) { selectedIndex_ = event.GetIndex(); + cp_->enableEditDeleteButtons(true); } +void stocksListCtrl::OnListItemDeselected(wxListEvent& event) +{ + selectedIndex_ = -1; + cp_->enableEditDeleteButtons(false); +} +void mmStocksPanel::enableEditDeleteButtons(bool en) +{ + wxButton* bE = (wxButton*)FindWindow(ID_BUTTON_EDIT_STOCK); + wxButton* bD = (wxButton*)FindWindow(ID_BUTTON_DELETE_STOCK); + bE->Enable(en); + bD->Enable(en); +} + int stocksListCtrl::OnGetItemImage(long item) const { /* Returns the icon to be shown for each entry */ Property changes on: trunk/mmex/src/stockspanel.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/stockspanel.cpp:408-735 /tags/releases/0.9.5.1/src/stockspanel.cpp:736-752 Modified: trunk/mmex/src/stockspanel.h =================================================================== --- trunk/mmex/src/stockspanel.h 2009-11-11 19:16:26 UTC (rev 752) +++ trunk/mmex/src/stockspanel.h 2009-11-11 21:46:57 UTC (rev 753) @@ -59,6 +59,7 @@ void OnMarkAllTransactions(wxCommandEvent& event); void OnListKeyDown(wxListEvent& event); void OnListItemSelected(wxListEvent& event); + void OnListItemDeselected(wxListEvent& event); void OnNewStocks(wxCommandEvent& event); void OnDeleteStocks(wxCommandEvent& event); @@ -129,6 +130,7 @@ void OnEditStocks(wxCommandEvent& event); void OnRefreshQuotes(wxCommandEvent& event); void OnHTTPSettings(wxCommandEvent& event); + void enableEditDeleteButtons(bool en); void OnViewPopupSelected(wxCommandEvent& event); Property changes on: trunk/mmex/src/stockspanel.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/stockspanel.h:408-735 /tags/releases/0.9.5.1/include/stockspanel.h:736-752 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-12 20:45:47
|
Revision: 759 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=759&view=rev Author: omalleypat Date: 2009-11-12 20:45:39 +0000 (Thu, 12 Nov 2009) Log Message: ----------- Merge checking panel show/hide edit and delete buttons. svn merge -c 610 -x -b -x --ignore-eol-style ^/tags/releases/0.9.5.1/src/mmcheckingpanel.cpp ./src/mmcheckingpanel.cpp svn merge -c 610 -x -b -x --ignore-eol-style ^/tags/releases/0.9.5.1/include/mmcheckingpanel.h ./src/mmcheckingpanel.h There were some conflicts due to variable renaming and code reorganization, but it seems to work as intended. Modified Paths: -------------- trunk/mmex/src/mmcheckingpanel.cpp trunk/mmex/src/mmcheckingpanel.h Property Changed: ---------------- trunk/mmex/src/mmcheckingpanel.cpp trunk/mmex/src/mmcheckingpanel.h Modified: trunk/mmex/src/mmcheckingpanel.cpp =================================================================== --- trunk/mmex/src/mmcheckingpanel.cpp 2009-11-12 19:04:13 UTC (rev 758) +++ trunk/mmex/src/mmcheckingpanel.cpp 2009-11-12 20:45:39 UTC (rev 759) @@ -379,6 +379,7 @@ void OnItemRightClick(wxListEvent& event); void OnListItemSelected(wxListEvent& event); + void OnListItemDeselected(wxListEvent& event); void OnListItemActivated(wxListEvent& event); void OnMarkTransaction(wxCommandEvent& event); void OnMarkAllTransactions(wxCommandEvent& event); @@ -421,6 +422,7 @@ BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl) EVT_LIST_ITEM_SELECTED(ID_PANEL_CHECKING_LISTCTRL_ACCT, MyListCtrl::OnListItemSelected) + EVT_LIST_ITEM_DESELECTED(ID_PANEL_CHECKING_LISTCTRL_ACCT, MyListCtrl::OnListItemDeselected) EVT_LIST_ITEM_ACTIVATED(ID_PANEL_CHECKING_LISTCTRL_ACCT, MyListCtrl::OnListItemActivated) EVT_LIST_ITEM_RIGHT_CLICK(ID_PANEL_CHECKING_LISTCTRL_ACCT, MyListCtrl::OnItemRightClick) @@ -698,25 +700,46 @@ wxDefaultPosition, wxDefaultSize, 0 ); itemButton7->SetToolTip(_("Edit Transaction")); itemBoxSizer5->Add(itemButton7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); + itemButton7->Enable(false); wxButton* itemButton8 = new wxButton( itemPanel12, ID_BUTTON_DELETE_TRANS, _("&Delete"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton8->SetToolTip(_("Delete Transaction")); itemBoxSizer5->Add(itemButton8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); - + itemButton8->Enable(false); + wxStaticText* itemStaticText11 = new wxStaticText( itemPanel12, ID_PANEL_CHECKING_STATIC_DETAILS, wxT(""), wxDefaultPosition, wxDefaultSize, wxNO_BORDER ); itemBoxSizer4->Add(itemStaticText11, 1, wxGROW|wxALL, 5); } //---------------------------------------------------------------------------- +void mmCheckingPanel::enableEditDeleteButtons(bool en) +{ + wxButton* bE = (wxButton*)FindWindow(ID_BUTTON_EDIT_TRANS); + wxButton* bD = (wxButton*)FindWindow(ID_BUTTON_DELETE_TRANS); + bE->Enable(en); + bD->Enable(en); +} + void mmCheckingPanel::updateExtraTransactionData(int selIndex) { - wxString cat = _("Category : ") + m_trans[selIndex]->catStr_ + wxT("\n"); - wxString subcat = _("Sub Category : ") + m_trans[selIndex]->subCatStr_ + wxT("\n"); - wxString notes = _("Notes : ") + mmReadyDisplayString(m_trans[selIndex]->notes_) + wxT("\n"); - wxString text = cat + subcat + notes; - wxStaticText* st = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_DETAILS); + // Get the items we need to change + wxStaticText* st = (wxStaticText*)FindWindow(ID_PANEL_CHECKING_STATIC_DETAILS); + wxString text; + if (selIndex!=-1) + { + enableEditDeleteButtons(true); + wxString cat = _("Category : ") + m_trans[selIndex]->catStr_ + wxT("\n"); + wxString subcat = _("Sub Category : ") + m_trans[selIndex]->subCatStr_ + wxT("\n"); + wxString notes = _("Notes : ") + mmReadyDisplayString(m_trans[selIndex]->notes_) + wxT("\n"); + text = cat + subcat + notes; + } + else + { + enableEditDeleteButtons(false); + text = wxT(""); + } st->SetLabel(text); } //---------------------------------------------------------------------------- @@ -1174,6 +1197,12 @@ } //---------------------------------------------------------------------------- +void MyListCtrl::OnListItemDeselected(wxListEvent& event) +{ + m_selectedIndex = -1; + m_cp->updateExtraTransactionData(m_selectedIndex); +} + void MyListCtrl::OnItemRightClick(wxListEvent& event) { m_selectedIndex = event.GetIndex(); Property changes on: trunk/mmex/src/mmcheckingpanel.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/mmcheckingpanel.cpp:610 Modified: trunk/mmex/src/mmcheckingpanel.h =================================================================== --- trunk/mmex/src/mmcheckingpanel.h 2009-11-12 19:04:13 UTC (rev 758) +++ trunk/mmex/src/mmcheckingpanel.h 2009-11-12 20:45:39 UTC (rev 759) @@ -118,6 +118,7 @@ long style = wxTAB_TRAVERSAL | wxNO_BORDER, const wxString& name = wxPanelNameStr ); + void enableEditDeleteButtons(bool en); void OnNewTransaction(wxCommandEvent& event); void OnDeleteTransaction(wxCommandEvent& event); Property changes on: trunk/mmex/src/mmcheckingpanel.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/mmcheckingpanel.h:610 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-12 21:38:23
|
Revision: 761 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=761&view=rev Author: omalleypat Date: 2009-11-12 21:38:13 +0000 (Thu, 12 Nov 2009) Log Message: ----------- Merge bills deposits panel show/hide edit and delete buttons. svn merge -r 407:HEAD -x -b -x --ignore-eol-style ^/tags/releases/0.9.5.1/include/billsdepositspanel.h ./src/billsdepositspanel.h svn merge -r 407:HEAD -x -b -x --ignore-eol-style ^/tags/releases/0.9.5.1/src/billsdepositspanel.cpp ./src/billsdepositspanel.cpp Minor conflicts were resolved. Modified Paths: -------------- trunk/mmex/src/billsdepositspanel.cpp trunk/mmex/src/billsdepositspanel.h Property Changed: ---------------- trunk/mmex/src/billsdepositspanel.cpp trunk/mmex/src/billsdepositspanel.h Modified: trunk/mmex/src/billsdepositspanel.cpp =================================================================== --- trunk/mmex/src/billsdepositspanel.cpp 2009-11-12 21:05:38 UTC (rev 760) +++ trunk/mmex/src/billsdepositspanel.cpp 2009-11-12 21:38:13 UTC (rev 761) @@ -39,6 +39,7 @@ EVT_LIST_ITEM_ACTIVATED(ID_PANEL_BD_LISTCTRL, billsDepositsListCtrl::OnListItemActivated) EVT_LIST_ITEM_RIGHT_CLICK(ID_PANEL_BD_LISTCTRL, billsDepositsListCtrl::OnItemRightClick) EVT_LIST_ITEM_SELECTED(ID_PANEL_BD_LISTCTRL, billsDepositsListCtrl::OnListItemSelected) + EVT_LIST_ITEM_DESELECTED(ID_PANEL_BD_LISTCTRL, billsDepositsListCtrl::OnListItemDeselected) EVT_MENU(MENU_TREEPOPUP_NEW, billsDepositsListCtrl::OnNewBDSeries) EVT_MENU(MENU_TREEPOPUP_EDIT, billsDepositsListCtrl::OnEditBDSeries) @@ -216,16 +217,19 @@ wxDefaultPosition, wxDefaultSize, 0 ); itemButton81->SetToolTip(_("Edit Bills && Deposit Series")); itemBoxSizer5->Add(itemButton81, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); - + itemButton81->Enable(false); + wxButton* itemButton7 = new wxButton( itemPanel12, ID_BUTTON_DELETE_BD, _("&Delete Series"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton7->SetToolTip(_("Delete Bills && Deposit Series")); itemBoxSizer5->Add(itemButton7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); - + itemButton7->Enable(false); + wxButton* itemButton8 = new wxButton( itemPanel12, ID_BUTTON_ENTEROCCUR_BD, _("Enter &Transaction"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton8->SetToolTip(_("Enter Next Bills && Deposit Occurrence")); itemBoxSizer5->Add(itemButton8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); + itemButton8->Enable(false); wxStaticText* itemStaticText11 = new wxStaticText( itemPanel12, ID_PANEL_CHECKING_STATIC_DETAILS, wxT(""), wxDefaultPosition, wxDefaultSize, wxNO_BORDER ); @@ -475,6 +479,12 @@ cp_->updateBottomPanelData(selectedIndex_); } +void billsDepositsListCtrl::OnListItemDeselected(wxListEvent& event) +{ + selectedIndex_ = -1; + cp_->updateBottomPanelData(selectedIndex_); +} + int billsDepositsListCtrl::OnGetItemImage(long item) const { /* Returns the icon to be shown for each entry */ @@ -598,8 +608,8 @@ RefreshItems(0, ((int)cp_->trans_.size()) - 1); } dlg->Destroy(); +} -} void mmBillsDepositsPanel::updateBottomPanelData(int selIndex) { // Get the items we need to change @@ -607,6 +617,7 @@ wxString text; if (selIndex!=-1) { + enableEditDeleteButtons(true); text += _("Category : "); text += trans_[selIndex].categoryStr_; text += wxT("\n"); @@ -617,5 +628,22 @@ text += trans_[selIndex].notesStr_; // text += wxT("\n"); } + else + { + enableEditDeleteButtons(false); + text = wxT(""); + } + st->SetLabel(text); -} \ No newline at end of file +} + +void mmBillsDepositsPanel::enableEditDeleteButtons(bool en) +{ + wxButton* bE = (wxButton*)FindWindow(ID_BUTTON_EDIT_BD); + wxButton* bD = (wxButton*)FindWindow(ID_BUTTON_DELETE_BD); + wxButton* bN = (wxButton*)FindWindow(ID_BUTTON_ENTEROCCUR_BD); + bE->Enable(en); + bD->Enable(en); + bN->Enable(en); +} + Property changes on: trunk/mmex/src/billsdepositspanel.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/billsdepositspanel.cpp:408-735 /tags/releases/0.9.5.1/src/billsdepositspanel.cpp:736-760 Modified: trunk/mmex/src/billsdepositspanel.h =================================================================== --- trunk/mmex/src/billsdepositspanel.h 2009-11-12 21:05:38 UTC (rev 760) +++ trunk/mmex/src/billsdepositspanel.h 2009-11-12 21:38:13 UTC (rev 761) @@ -59,6 +59,7 @@ void OnMarkAllTransactions(wxCommandEvent& event); void OnListKeyDown(wxListEvent& event); void OnListItemSelected(wxListEvent& event); + void OnListItemDeselected(wxListEvent& event); void OnNewBDSeries(wxCommandEvent& event); void OnDeleteBDSeries(wxCommandEvent& event); @@ -143,6 +144,7 @@ void OnDeleteBDSeries(wxCommandEvent& event); void OnEditBDSeries(wxCommandEvent& event); void OnEnterBDSeriesOccurrence(wxCommandEvent& event); + void enableEditDeleteButtons(bool en); void OnViewPopupSelected(wxCommandEvent& event); Property changes on: trunk/mmex/src/billsdepositspanel.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/billsdepositspanel.h:408-735 /tags/releases/0.9.5.1/include/billsdepositspanel.h:736-760 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-12 21:43:04
|
Revision: 760 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=760&view=rev Author: omalleypat Date: 2009-11-12 21:05:38 +0000 (Thu, 12 Nov 2009) Log Message: ----------- Merge assets panel show/hide edit and delete buttons. svn merge -r 407:HEAD ^/tags/releases/0.9.5.1/src/assetspanel.cpp ./src/assetspanel.cpp svn merge -r 407:HEAD ^/tags/releases/0.9.5.1/include/assetspanel.h ./src/assetspanel.h There were some conflicts due to code reorganization, but it seems to work as intended. Modified Paths: -------------- trunk/mmex/src/assetspanel.cpp trunk/mmex/src/assetspanel.h Property Changed: ---------------- trunk/mmex/src/assetspanel.cpp trunk/mmex/src/assetspanel.h Modified: trunk/mmex/src/assetspanel.cpp =================================================================== --- trunk/mmex/src/assetspanel.cpp 2009-11-12 20:45:39 UTC (rev 759) +++ trunk/mmex/src/assetspanel.cpp 2009-11-12 21:05:38 UTC (rev 760) @@ -36,6 +36,7 @@ EVT_LIST_ITEM_ACTIVATED(ID_PANEL_STOCKS_LISTCTRL, assetsListCtrl::OnListItemActivated) EVT_LIST_ITEM_RIGHT_CLICK(ID_PANEL_STOCKS_LISTCTRL, assetsListCtrl::OnItemRightClick) EVT_LIST_ITEM_SELECTED(ID_PANEL_STOCKS_LISTCTRL, assetsListCtrl::OnListItemSelected) + EVT_LIST_ITEM_DESELECTED(ID_PANEL_STOCKS_LISTCTRL, assetsListCtrl::OnListItemDeselected) EVT_MENU(MENU_TREEPOPUP_NEW, assetsListCtrl::OnNewAsset) EVT_MENU(MENU_TREEPOPUP_EDIT, assetsListCtrl::OnEditAsset) @@ -185,12 +186,14 @@ wxDefaultPosition, wxDefaultSize, 0 ); itemButton81->SetToolTip(_("Edit Asset")); itemBoxSizer5->Add(itemButton81, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); - + itemButton81->Enable(false); + wxButton* itemButton7 = new wxButton( itemPanel12, ID_BUTTON_DELETE_ASSET, _("&Delete"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton7->SetToolTip(_("Delete Asset")); itemBoxSizer5->Add(itemButton7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); - + itemButton7->Enable(false); + wxStaticText* itemStaticText11 = new wxStaticText( itemPanel12, ID_PANEL_CHECKING_STATIC_DETAILS, wxT(""), wxDefaultPosition, wxDefaultSize, wxNO_BORDER ); itemBoxSizer4->Add(itemStaticText11, 1, wxGROW|wxALL, 5); @@ -292,8 +295,23 @@ void assetsListCtrl::OnListItemSelected(wxListEvent& event) { selectedIndex_ = event.GetIndex(); + cp_->enableEditDeleteButtons(true); } +void assetsListCtrl::OnListItemDeselected(wxListEvent& event) +{ + selectedIndex_ = -1; + cp_->enableEditDeleteButtons(false); +} + +void mmAssetsPanel::enableEditDeleteButtons(bool en) +{ + wxButton* bE = (wxButton*)FindWindow(ID_BUTTON_EDIT_ASSET); + wxButton* bD = (wxButton*)FindWindow(ID_BUTTON_DELETE_ASSET); + bE->Enable(en); + bD->Enable(en); +} + int assetsListCtrl::OnGetItemImage(long /*item*/) const { /* Returns the icon to be shown for each entry */ Property changes on: trunk/mmex/src/assetspanel.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/assetspanel.cpp:408-735 /tags/releases/0.9.5.1/src/assetspanel.cpp:736-759 Modified: trunk/mmex/src/assetspanel.h =================================================================== --- trunk/mmex/src/assetspanel.h 2009-11-12 20:45:39 UTC (rev 759) +++ trunk/mmex/src/assetspanel.h 2009-11-12 21:05:38 UTC (rev 760) @@ -52,6 +52,7 @@ void OnListItemActivated(wxListEvent& event); void OnListKeyDown(wxListEvent& event); void OnListItemSelected(wxListEvent& event); + void OnListItemDeselected(wxListEvent& event); void OnNewAsset(wxCommandEvent& event); void OnDeleteAsset(wxCommandEvent& event); @@ -109,6 +110,7 @@ void OnNewAsset(wxCommandEvent& event); void OnDeleteAsset(wxCommandEvent& event); void OnEditAsset(wxCommandEvent& event); + void enableEditDeleteButtons(bool en); void OnViewPopupSelected(wxCommandEvent& event); Property changes on: trunk/mmex/src/assetspanel.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/assetspanel.h:408-735 /tags/releases/0.9.5.1/include/assetspanel.h:736-759 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-12 21:46:38
|
Revision: 762 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=762&view=rev Author: omalleypat Date: 2009-11-12 21:46:27 +0000 (Thu, 12 Nov 2009) Log Message: ----------- Merge asset dialog from branch svn merge -r 407:HEAD -x -w -x --ignore-eol-style ^/tags/releases/0.9.5.1/include/assetdialog.h ./src/assetdialog.h svn merge -r 407:HEAD -x -w -x --ignore-eol-style ^/tags/releases/0.9.5.1/src/assetdialog.cpp ./src/assetdialog.cpp Minor conflicts were resolved. Modified Paths: -------------- trunk/mmex/src/assetdialog.cpp trunk/mmex/src/assetdialog.h Property Changed: ---------------- trunk/mmex/src/assetdialog.cpp trunk/mmex/src/assetdialog.h Modified: trunk/mmex/src/assetdialog.cpp =================================================================== --- trunk/mmex/src/assetdialog.cpp 2009-11-12 21:38:13 UTC (rev 761) +++ trunk/mmex/src/assetdialog.cpp 2009-11-12 21:46:27 UTC (rev 762) @@ -43,6 +43,7 @@ BEGIN_EVENT_TABLE( mmAssetDialog, wxDialog ) EVT_BUTTON(ID_BUTTON_ASSET_OK, mmAssetDialog::OnOk) EVT_BUTTON(ID_BUTTON_ASSET_CANCEL, mmAssetDialog::OnCancel) + EVT_CHOICE(ID_DIALOG_ASSETDIALOG_COMBO_TYPE, mmAssetDialog::OnChangeAppreciationType) END_EVENT_TABLE() mmAssetDialog::mmAssetDialog( ) @@ -80,7 +81,12 @@ { dataToControls(); } + else + { + enableDisableRate(false); + } + Centre(); return TRUE; } @@ -123,14 +129,26 @@ wxString valueChangeTypeStr = q1.GetString(wxT("VALUECHANGE")); if (valueChangeTypeStr == wxT("None")) + { valueChange_->SetSelection(DEF_CHANGE_NONE); + enableDisableRate(false); + } else if (valueChangeTypeStr == wxT("Appreciates")) - valueChange_->SetSelection(DEF_CHANGE_APPRECIATE); + { + valueChange_->SetSelection(DEF_CHANGE_APPRECIATE); + enableDisableRate(true); + } else if (valueChangeTypeStr == wxT("Depreciates")) + + { valueChange_->SetSelection(DEF_CHANGE_DEPRECIATE); + enableDisableRate(true); + } else + { wxASSERT(false); - + } + wxString assetTypeStr = q1.GetString(wxT("ASSETTYPE")); if (assetTypeStr == wxT("Property")) assetType_->SetSelection(DEF_ASSET_PROPERTY); @@ -250,9 +268,9 @@ valueChange_->SetSelection(DEF_CHANGE_NONE); itemFlexGridSizer6->Add(valueChange_, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticText* itemStaticText13 = new wxStaticText( itemPanel5, + valueChangeRateLabel_ = new wxStaticText( itemPanel5, wxID_STATIC, _("Rate of Change"), wxDefaultPosition, wxDefaultSize, 0 ); - itemFlexGridSizer6->Add(itemStaticText13, 0, + itemFlexGridSizer6->Add(valueChangeRateLabel_, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); valueChangeRate_ = new wxTextCtrl( itemPanel5, ID_TEXTCTRL_ASSETDIALOG_CHANGERATE, wxT(""), @@ -260,7 +278,7 @@ valueChangeRate_->SetToolTip(_("Enter the rate at which the asset changes its value in % per year")); itemFlexGridSizer6->Add(valueChangeRate_, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); - + enableDisableRate(false); wxStaticText* itemStaticText19 = new wxStaticText( itemPanel5, wxID_STATIC, _("Notes"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -337,6 +355,7 @@ if(valueChangeRateStr.ToDouble(&valueChangeRate) == false) { valueChangeRate = -1.0; } + //This should be unnecessary with hidden controls if ((valueChangeType != DEF_CHANGE_NONE) && (valueChangeRate < 0.0)) { mmShowErrorMessage(this, _("Invalid Value "), _("Error")); @@ -416,3 +435,24 @@ EndModal(wxID_OK); } +void mmAssetDialog::OnChangeAppreciationType(wxCommandEvent& event) +{ + int selection = valueChange_->GetSelection(); + // Disable for "None", Enable for "Appreciates" or "Depreciates" + enableDisableRate(selection != DEF_CHANGE_NONE); +} + +void mmAssetDialog::enableDisableRate(bool en) +{ + if (en) + { + valueChangeRate_->SetEditable(true); + valueChangeRateLabel_->Enable(true); + } + else + { + valueChangeRate_->SetValue(wxT("0")); + valueChangeRate_->SetEditable(false); + valueChangeRateLabel_->Enable(false); + } +} Property changes on: trunk/mmex/src/assetdialog.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/assetdialog.cpp:408-735 /tags/releases/0.9.5.1/src/assetdialog.cpp:736-761 Modified: trunk/mmex/src/assetdialog.h =================================================================== --- trunk/mmex/src/assetdialog.h 2009-11-12 21:38:13 UTC (rev 761) +++ trunk/mmex/src/assetdialog.h 2009-11-12 21:46:27 UTC (rev 762) @@ -56,6 +56,8 @@ void OnOk(wxCommandEvent& event); void OnCancel(wxCommandEvent& event); + void OnChangeAppreciationType(wxCommandEvent& event); + void enableDisableRate(bool en); void fillControls(); void dataToControls(); @@ -72,6 +74,8 @@ wxChoice* assetType_; wxChoice* valueChange_; + + wxStaticText* valueChangeRateLabel_; bool edit_; Property changes on: trunk/mmex/src/assetdialog.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/assetdialog.h:408-735 /tags/releases/0.9.5.1/include/assetdialog.h:736-761 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-12 22:01:25
|
Revision: 763 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=763&view=rev Author: omalleypat Date: 2009-11-12 22:01:18 +0000 (Thu, 12 Nov 2009) Log Message: ----------- Merge mmex.cpp syntax error fixes from r566 of branch svn merge -c 566 -x -w -x --ignore-eol-style ^/tags/releases/0.9.5.1/src/ ./src/ Minor conflicts were resolved. Modified Paths: -------------- trunk/mmex/src/mmex.cpp Property Changed: ---------------- trunk/mmex/src/ trunk/mmex/src/mmcheckingpanel.cpp Property changes on: trunk/mmex/src ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src:566 Property changes on: trunk/mmex/src/mmcheckingpanel.cpp ___________________________________________________________________ Modified: svn:mergeinfo - /branches/0.9.5/mmex/src/mmcheckingpanel.cpp:610 + /branches/0.9.5/mmex/src/mmcheckingpanel.cpp:566,610 Modified: trunk/mmex/src/mmex.cpp =================================================================== --- trunk/mmex/src/mmex.cpp 2009-11-12 21:46:27 UTC (rev 762) +++ trunk/mmex/src/mmex.cpp 2009-11-12 22:01:18 UTC (rev 763) @@ -628,7 +628,7 @@ /* Relative paths don't work well in Linux, so using it only for Windows */ -#if defined (__WXGTK__) || (__WXMAC__) +#if defined (__WXGTK__) || defined (__WXMAC__) absName = fName.GetFullPath(); #else wxFileName appPath(mmGetBaseWorkingPath(true)); @@ -710,7 +710,7 @@ wxFileName appPath(mmGetBaseWorkingPath(true)); wxFileName fname(fileName_); -#if defined (__WXGTK__) || (__WXMAC__) +#if defined (__WXGTK__) || defined (__WXMAC__) #else /*bool makeRelative = */fname.MakeRelativeTo(appPath.GetPath()); @@ -799,7 +799,7 @@ void mmGUIFrame::createControls() { -#if defined (__WXGTK__) || (__WXMAC__) +#if defined (__WXGTK__) || defined (__WXMAC__) // Under GTK, row lines look ugly navTreeCtrl_ = new wxTreeCtrl( this, ID_NAVTREECTRL, wxDefaultPosition, wxSize(100, 100)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ell...@us...> - 2009-11-13 03:00:59
|
Revision: 764 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=764&view=rev Author: ellisgen Date: 2009-11-13 03:00:52 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Added very rough draft for ofx import Added Paths: ----------- trunk/mmex/src/ofximport.cpp trunk/mmex/src/ofximport.h Added: trunk/mmex/src/ofximport.cpp =================================================================== --- trunk/mmex/src/ofximport.cpp (rev 0) +++ trunk/mmex/src/ofximport.cpp 2009-11-13 03:00:52 UTC (rev 764) @@ -0,0 +1,658 @@ +/* + * ofximport.cpp + * moneymanagerex + * + * Created by Wesley Ellis on 11/12/09. + * Copyright 2009 __MyCompanyName__. All rights reserved. + * + */ + +#include "ofximport.h" +#include <libofx/libofx.h> +#include "util.h" +#include "dbwrapper.h" +#include "guiid.h" +#include "fileviewerdialog.h" +#include "mmex.h" +#include "mmcoredb.h" + +//Instantiate Import Log here + +/********************************************************************\ + * mmOfxImport + * Entry point + \********************************************************************/ + +//mmImportMatcher *mmImportMatcherGui = NULL; + +/* + int ofx_proc_status_cb(struct OfxStatusData data) + { + return 0; + } + */ + +int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user_data); +int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_user_data); +int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data); + +int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user_data) +{ + char * tmp_cusip=NULL; + char * tmp_default_fullname=NULL; + char * tmp_default_mnemonic=NULL; + + if(data.unique_id_valid==true) + { + tmp_cusip=(char *)data.unique_id; + } + if(data.secname_valid==true) + { + tmp_default_fullname=(char *)data.secname; + } + if(data.ticker_valid==true) + { + tmp_default_mnemonic=(char *)data.ticker; + } + + gnc_import_select_commodity(tmp_cusip, + true, + tmp_default_fullname, + tmp_default_mnemonic); + return 0; +} + +int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_user_data) +{ + char dest_string[255]; + time_t current_time; + Account *account; + Account *investment_account=NULL; + Account *income_account=NULL; + kvp_frame * acc_frame; + kvp_value * kvp_val; + const GUID * income_acc_guid; + gchar *investment_account_text; + gnc_commodity *currency=NULL; + gnc_commodity *investment_commodity=NULL; + gnc_numeric gnc_amount, gnc_units; + GNCBook *book; + Transaction *transaction; + Split *split; + gchar *notes, *tmp; + + g_assert(gnc_ofx_importer_gui); + + if(data.account_id_valid==true){ + account = gnc_import_select_account(NULL, data.account_id, 0, NULL, NULL, + ACCT_TYPE_NONE, NULL, NULL); + if(account!=NULL) + { + /********** Validate the input strings to ensure utf8 ********************/ + if (data.name_valid) + gnc_utf8_strip_invalid(data.name); + if (data.memo_valid) + gnc_utf8_strip_invalid(data.memo); + if (data.check_number_valid) + gnc_utf8_strip_invalid(data.check_number); + if (data.reference_number_valid) + gnc_utf8_strip_invalid(data.reference_number); + + /********** Create the transaction and setup transaction data ************/ + book = gnc_account_get_book(account); + transaction = xaccMallocTransaction(book); + xaccTransBeginEdit(transaction); + + if(data.fi_id_valid==true){ + gnc_import_set_trans_online_id(transaction, data.fi_id); + } + + if(data.date_initiated_valid==true){ + xaccTransSetDateSecs(transaction, data.date_initiated); + } + else if(data.date_posted_valid==true){ + xaccTransSetDateSecs(transaction, data.date_posted); + } + + if(data.date_posted_valid==true){ + xaccTransSetDatePostedSecs(transaction, data.date_posted); + } + + current_time = time(NULL); + xaccTransSetDateEnteredSecs(transaction, mktime(localtime(¤t_time))); + + if(data.check_number_valid==true){ + xaccTransSetNum(transaction, data.check_number); + } + else if(data.reference_number_valid==true){ + xaccTransSetNum(transaction, data.reference_number); + } + /* Put transaction name in Description, or memo if name unavailable */ + if(data.name_valid==true){ + xaccTransSetDescription(transaction, data.name); + } + else if(data.memo_valid==true){ + xaccTransSetDescription(transaction, data.memo); + } + + /* Put everything else in the Notes field */ + notes=g_strdup_printf("OFX ext. info: "); + + if(data.transactiontype_valid==true){ + switch(data.transactiontype){ + case OFX_CREDIT: strncpy(dest_string, "Generic credit", sizeof(dest_string)); + break; + case OFX_DEBIT: strncpy(dest_string, "Generic debit", sizeof(dest_string)); + break; + case OFX_INT: strncpy(dest_string, "Interest earned or paid (Note: Depends on signage of amount)", sizeof(dest_string)); + break; + case OFX_DIV: strncpy(dest_string, "Dividend", sizeof(dest_string)); + break; + case OFX_FEE: strncpy(dest_string, "FI fee", sizeof(dest_string)); + break; + case OFX_SRVCHG: strncpy(dest_string, "Service charge", sizeof(dest_string)); + break; + case OFX_DEP: strncpy(dest_string, "Deposit", sizeof(dest_string)); + break; + case OFX_ATM: strncpy(dest_string, "ATM debit or credit (Note: Depends on signage of amount)", sizeof(dest_string)); + break; + case OFX_POS: strncpy(dest_string, "Point of sale debit or credit (Note: Depends on signage of amount)", sizeof(dest_string)); + break; + case OFX_XFER: strncpy(dest_string, "Transfer", sizeof(dest_string)); + break; + case OFX_CHECK: strncpy(dest_string, "Check", sizeof(dest_string)); + break; + case OFX_PAYMENT: strncpy(dest_string, "Electronic payment", sizeof(dest_string)); + break; + case OFX_CASH: strncpy(dest_string, "Cash withdrawal", sizeof(dest_string)); + break; + case OFX_DIRECTDEP: strncpy(dest_string, "Direct deposit", sizeof(dest_string)); + break; + case OFX_DIRECTDEBIT: strncpy(dest_string, "Merchant initiated debit", sizeof(dest_string)); + break; + case OFX_REPEATPMT: strncpy(dest_string, "Repeating payment/standing order", sizeof(dest_string)); + break; + case OFX_OTHER: strncpy(dest_string, "Other", sizeof(dest_string)); + break; + default : strncpy(dest_string, "Unknown transaction type", sizeof(dest_string)); + break; + } + tmp=notes; + notes=g_strdup_printf("%s%s%s",tmp,"|Trans type:", dest_string); + g_free(tmp); + } + + if(data.invtransactiontype_valid==true){ + switch(data.invtransactiontype){ + case OFX_BUYDEBT: strncpy(dest_string, "BUYDEBT (Buy debt security)", sizeof(dest_string)); + break; + case OFX_BUYMF: strncpy(dest_string, "BUYMF (Buy mutual fund)", sizeof(dest_string)); + break; + case OFX_BUYOPT: strncpy(dest_string, "BUYOPT (Buy option)", sizeof(dest_string)); + break; + case OFX_BUYOTHER: strncpy(dest_string, "BUYOTHER (Buy other security type)", sizeof(dest_string)); + break; + case OFX_BUYSTOCK: strncpy(dest_string, "BUYSTOCK (Buy stock))", sizeof(dest_string)); + break; + case OFX_CLOSUREOPT: strncpy(dest_string, "CLOSUREOPT (Close a position for an option)", sizeof(dest_string)); + break; + case OFX_INCOME: strncpy(dest_string, "INCOME (Investment income is realized as cash into the investment account)", sizeof(dest_string)); + break; + case OFX_INVEXPENSE: strncpy(dest_string, "INVEXPENSE (Misc investment expense that is associated with a specific security)", sizeof(dest_string)); + break; + case OFX_JRNLFUND: strncpy(dest_string, "JRNLFUND (Journaling cash holdings between subaccounts within the same investment account)", sizeof(dest_string)); + break; + case OFX_MARGININTEREST: strncpy(dest_string, "MARGININTEREST (Margin interest expense)", sizeof(dest_string)); + break; + case OFX_REINVEST: strncpy(dest_string, "REINVEST (Reinvestment of income)", sizeof(dest_string)); + break; + case OFX_RETOFCAP: strncpy(dest_string, "RETOFCAP (Return of capital)", sizeof(dest_string)); + break; + case OFX_SELLDEBT: strncpy(dest_string, "SELLDEBT (Sell debt security. Used when debt is sold, called, or reached maturity)", sizeof(dest_string)); + break; + case OFX_SELLMF: strncpy(dest_string, "SELLMF (Sell mutual fund)", sizeof(dest_string)); + break; + case OFX_SELLOPT: strncpy(dest_string, "SELLOPT (Sell option)", sizeof(dest_string)); + break; + case OFX_SELLOTHER: strncpy(dest_string, "SELLOTHER (Sell other type of security)", sizeof(dest_string)); + break; + case OFX_SELLSTOCK: strncpy(dest_string, "SELLSTOCK (Sell stock)", sizeof(dest_string)); + break; + case OFX_SPLIT: strncpy(dest_string, "SPLIT (Stock or mutial fund split)", sizeof(dest_string)); + break; + case OFX_TRANSFER: strncpy(dest_string, "TRANSFER (Transfer holdings in and out of the investment account)", sizeof(dest_string)); + break; + default: strncpy(dest_string, "ERROR, this investment transaction type is unknown. This is a bug in ofxdump", sizeof(dest_string)); + break; + } + tmp=notes; + notes=g_strdup_printf("%s%s%s",tmp,"|Investment Trans type:", dest_string); + g_free(tmp); + } + if(data.memo_valid==true&&data.name_valid==true){/* Copy only if memo wasn't put in Description */ + tmp=notes; + notes=g_strdup_printf("%s%s%s",tmp, "|Memo:", data.memo); + g_free(tmp); + } + if(data.date_funds_available_valid==true){ + Timespec ts; + timespecFromTime_t(&ts, data.date_funds_available); + gnc_timespec_to_iso8601_buff (ts, dest_string); + tmp=notes; + notes=g_strdup_printf("%s%s%s",tmp,"|Date funds available:", dest_string); + g_free(tmp); + } + if(data.server_transaction_id_valid==true){ + tmp=notes; + notes=g_strdup_printf("%s%s%s",tmp, "|Server trans ID (conf. number):", data.server_transaction_id); + g_free(tmp); + } + if(data.standard_industrial_code_valid==true){ + tmp=notes; + notes=g_strdup_printf("%s%s%ld",tmp, "|Standard Industrial Code:",data.standard_industrial_code); + g_free(tmp); + + } + if(data.payee_id_valid==true){ + tmp=notes; + notes=g_strdup_printf("%s%s%s",tmp,"|Payee ID:", data.payee_id); + g_free(tmp); + } + + PERR("WRITEME: GnuCash ofx_proc_transaction():Add PAYEE and ADRESS here once supported by libofx!\n"); + + /* Ideally, gnucash should process the corrected transactions */ + if(data.fi_id_corrected_valid==true){ + PERR("WRITEME: GnuCash ofx_proc_transaction(): WARNING: This transaction corrected a previous transaction, but we created a new one instead!\n"); + tmp=notes; + notes=g_strdup_printf("%s%s%s%s",tmp,"|This corrects transaction #",data.fi_id_corrected,"but GnuCash didn't process the correction!"); + g_free(tmp); + } + xaccTransSetNotes(transaction, notes); + g_free(notes); + if ( data.account_ptr && data.account_ptr->currency_valid ) + { + DEBUG("Currency from libofx: %s",data.account_ptr->currency); + currency = gnc_commodity_table_lookup( gnc_get_current_commodities (), + GNC_COMMODITY_NS_CURRENCY, + data.account_ptr->currency); + } + else + { + DEBUG("Currency from libofx unavailable, defaulting to account's default"); + currency = xaccAccountGetCommodity(account); + } + + xaccTransSetCurrency(transaction,currency); + if(data.amount_valid==true) + { + if(data.invtransactiontype_valid==false) + { + /*************Process a normal transaction ***************************/ + DEBUG("Adding split; Ordinary banking transaction, money flows from or into the source account"); + split=xaccMallocSplit(book); + xaccTransAppendSplit(transaction,split); + xaccAccountInsertSplit(account,split); + + gnc_amount = double_to_gnc_numeric (data.amount, + gnc_commodity_get_fraction(xaccTransGetCurrency(transaction)), + GNC_RND_ROUND); + xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction)); + + /* Also put the ofx transaction's memo in the split's memo field */ + if(data.memo_valid==true){ + xaccSplitSetMemo(split, data.memo); + } + } + else if(data.unique_id_valid == true + && data.security_data_valid + && data.security_data_ptr != NULL + && data.security_data_ptr->secname_valid == true) + { + /************************ Process an investment transaction ******************************/ + /* Note that the ACCT_TYPE_STOCK account type should be replaced with something + derived from data.invtranstype*/ + investment_commodity = gnc_import_select_commodity(data.unique_id, + 0, + NULL, + NULL); + if(investment_commodity!=NULL) + { + investment_account_text = g_strdup_printf( /* This string is a default account + name. It MUST NOT contain the + character ':' anywhere in it or + in any translations. */ + _("Stock account for security \"%s\""), + data.security_data_ptr->secname); + investment_account = gnc_import_select_account(NULL, + data.unique_id, + 1, + investment_account_text, + investment_commodity, + ACCT_TYPE_STOCK, + NULL, + NULL); + g_free (investment_account_text); + investment_account_text = NULL; + if(investment_account!=NULL&& + data.unitprice_valid==true&& + data.units_valid==true&& + ( data.invtransactiontype!=OFX_INCOME ) ) + { + DEBUG("Adding investment split; Money flows from or into the stock account"); + split=xaccMallocSplit(book); + xaccTransAppendSplit(transaction,split); + xaccAccountInsertSplit(investment_account,split); + + gnc_amount = double_to_gnc_numeric (-(data.amount), + gnc_commodity_get_fraction(investment_commodity), + GNC_RND_ROUND); + gnc_units = double_to_gnc_numeric (data.units, + gnc_commodity_get_fraction(investment_commodity), + GNC_RND_ROUND); + xaccSplitSetAmount(split, gnc_units); + xaccSplitSetValue(split, gnc_amount); + + if(data.security_data_ptr->memo_valid==true) + { + xaccSplitSetMemo(split, data.security_data_ptr->memo); + } + } + else + { + PERR("The investment account, units or unitprice was not found for the investment transaction"); + } + } + else + { + PERR("Commodity not found for the investment transaction"); + } + + if(data.invtransactiontype_valid==true) + { + if(data.invtransactiontype==OFX_REINVEST||data.invtransactiontype==OFX_INCOME) + { + DEBUG("Now let's find an account for the destination split"); + + acc_frame=xaccAccountGetSlots(investment_account); + kvp_val = kvp_frame_get_slot(acc_frame, + "ofx/associated-income-account"); + if (kvp_val != NULL) + { + income_account = xaccAccountLookup(kvp_value_get_guid(kvp_val),book); + } + if(income_account==NULL) + { + DEBUG("Couldn't find an associated income account"); + investment_account_text = g_strdup_printf( /* This string is a default account + name. It MUST NOT contain the + character ':' anywhere in it or + in any translations. */ + _("Income account for security \"%s\""), + data.security_data_ptr->secname); + income_account=gnc_import_select_account(NULL, + NULL, + 1, + investment_account_text, + currency, + ACCT_TYPE_INCOME, + NULL, + NULL); + income_acc_guid = xaccAccountGetGUID(income_account); + kvp_val = kvp_value_new_guid(income_acc_guid); + if( acc_frame==NULL) + { + DEBUG("The kvp_frame was NULL, allocating new one"); + acc_frame = kvp_frame_new(); + } + kvp_frame_set_slot_nc(acc_frame, "ofx/associated-income-account", + kvp_val); + DEBUG("KVP written"); + + } + else + { + DEBUG("Found at least one associated income account"); + } + } + if(income_account!=NULL&& + data.invtransactiontype==OFX_REINVEST) + { + DEBUG("Adding investment split; Money flows from the income account"); + split=xaccMallocSplit(book); + xaccTransAppendSplit(transaction,split); + xaccAccountInsertSplit(income_account,split); + + gnc_amount = double_to_gnc_numeric (data.amount, + gnc_commodity_get_fraction(xaccTransGetCurrency(transaction)), + GNC_RND_ROUND); + xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction)); + + /* Also put the ofx transaction name in the splits memo field, or ofx memo if name is unavailable */ + if(data.name_valid==true){ + xaccSplitSetMemo(split, data.name); + } + else if(data.memo_valid==true){ + xaccSplitSetMemo(split, data.memo); + } + } + if(income_account!=NULL&& + data.invtransactiontype==OFX_INCOME) + { + DEBUG("Adding investment split; Money flows from the income account"); + split=xaccMallocSplit(book); + xaccTransAppendSplit(transaction,split); + xaccAccountInsertSplit(income_account,split); + + gnc_amount = double_to_gnc_numeric (-data.amount,/*OFX_INCOME amounts come in as positive numbers*/ + gnc_commodity_get_fraction(xaccTransGetCurrency(transaction)), + GNC_RND_ROUND); + xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction)); + + /* Also put the ofx transaction name in the splits memo field, or ofx memo if name is unavailable */ + if(data.name_valid==true){ + xaccSplitSetMemo(split, data.name); + } + else if(data.memo_valid==true){ + xaccSplitSetMemo(split, data.memo); + } + } + + + if(data.invtransactiontype!=OFX_REINVEST) + { + DEBUG("Adding investment split; Money flows from or to the cash account"); + split=xaccMallocSplit(book); + xaccTransAppendSplit(transaction,split); + xaccAccountInsertSplit(account,split); + + gnc_amount = double_to_gnc_numeric (data.amount, + gnc_commodity_get_fraction(xaccTransGetCurrency(transaction)), + GNC_RND_ROUND); + xaccSplitSetBaseValue(split, gnc_amount, xaccTransGetCurrency(transaction)); + + /* Also put the ofx transaction name in the splits memo field, or ofx memo if name is unavailable */ + if(data.name_valid==true){ + xaccSplitSetMemo(split, data.name); + } + else if(data.memo_valid==true){ + xaccSplitSetMemo(split, data.memo); + } + + } + } + } + + /* Use new importer GUI. */ + DEBUG("%d splits sent to the importer gui",xaccTransCountSplits(transaction)); + gnc_gen_trans_list_add_trans (gnc_ofx_importer_gui, transaction); + } + else + { + PERR("The transaction doesn't have a valid amount"); + xaccTransDestroy(transaction); + xaccTransCommitEdit(transaction); + } + + } + else + { + PERR("Unable to find the account!"); + } + } + else + { + PERR("account ID for this transaction is unavailable!"); + } + return 0; +}//end ofx_proc_transaction() + +/* + int ofx_proc_statement_cb(struct OfxStatementData data, void * statement_user_data) + { + return 0; + }//end ofx_proc_statement() + */ + +int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data) +{ + Account *selected_account; + gnc_commodity_table * commodity_table; + gnc_commodity * default_commodity; + GNCAccountType default_type=ACCT_TYPE_NONE; + gchar * account_description; + gchar * account_type_name = NULL; + + if(data.account_id_valid==true){ + commodity_table = gnc_get_current_commodities (); + if( data.currency_valid == true) + { + DEBUG("Currency from libofx: %s",data.currency); + default_commodity = gnc_commodity_table_lookup(commodity_table, + GNC_COMMODITY_NS_CURRENCY, + data.currency); + } + else + { + default_commodity = NULL; + } + + if(data.account_type_valid==true){ + switch(data.account_type){ + case OFX_CHECKING : + default_type=ACCT_TYPE_BANK; + account_type_name = g_strdup_printf(_("Unknown OFX checking account")); + break; + case OFX_SAVINGS : + default_type=ACCT_TYPE_BANK; + account_type_name = g_strdup_printf(_("Unknown OFX savings account")); + break; + case OFX_MONEYMRKT : + default_type=ACCT_TYPE_MONEYMRKT; + account_type_name = g_strdup_printf(_("Unknown OFX money market account")); + break; + case OFX_CREDITLINE : + default_type=ACCT_TYPE_CREDITLINE; + account_type_name = g_strdup_printf(_("Unknown OFX credit line account")); + break; + case OFX_CMA : + default_type=ACCT_TYPE_NONE; + account_type_name = g_strdup_printf(_("Unknown OFX CMA account")); + break; + case OFX_CREDITCARD : + default_type=ACCT_TYPE_CREDIT; + account_type_name = g_strdup_printf(_("Unknown OFX credit card account")); + break; + case OFX_INVESTMENT : + default_type=ACCT_TYPE_BANK; + account_type_name = g_strdup_printf(_("Unknown OFX investment account")); + break; + default: PERR("WRITEME: ofx_proc_account() This is an unknown account type!"); + } + } + + gnc_utf8_strip_invalid(data.account_name); + account_description = g_strdup_printf( /* This string is a default account + name. It MUST NOT contain the + character ':' anywhere in it or + in any translation. */ + "%s \"%s\"", + account_type_name, + data.account_name); + selected_account = gnc_import_select_account(NULL, + data.account_id, 1, + account_description, default_commodity, + default_type, NULL, NULL); + g_free(account_description); + g_free(account_type_name); + } + else + { + PERR("account online ID not available"); + } + + return 0; +} + +void mmOfxImport () +{ + extern int ofx_PARSER_msg; + extern int ofx_DEBUG_msg; + extern int ofx_WARNING_msg; + extern int ofx_ERROR_msg; + extern int ofx_INFO_msg; + extern int ofx_STATUS_msg; + char *selected_filename; + char *default_dir; + LibofxContextPtr libofx_context = libofx_get_new_context(); + + ofx_PARSER_msg = false; + ofx_DEBUG_msg = false; + ofx_WARNING_msg = true; + ofx_ERROR_msg = true; + ofx_INFO_msg = true; + ofx_STATUS_msg = false; + + DEBUG("gnc_file_ofx_import(): Begin...\n"); + + default_dir = gnc_get_default_directory(GCONF_SECTION); + selected_filename = gnc_file_dialog(_("Select an OFX/QFX file to process"), + NULL, + default_dir, + GNC_FILE_DIALOG_IMPORT); + g_free(default_dir); + + if(selected_filename!=NULL) + { + + + /* Remember the directory as the default. */ + default_dir = g_path_get_dirname(selected_filename); + gnc_set_default_directory(GCONF_SECTION, default_dir); + g_free(default_dir); + + /*strncpy(file,selected_filename, 255);*/ + DEBUG("Filename found: %s",selected_filename); + + /* Create the Generic transaction importer GUI. */ + gnc_ofx_importer_gui = gnc_gen_trans_list_new(NULL, NULL, FALSE, 42); + + /* Initialize libofx */ + + /*ofx_set_statement_cb(libofx_context, ofx_proc_statement_cb, 0);*/ + ofx_set_account_cb(libofx_context, ofx_proc_account_cb, 0); + ofx_set_transaction_cb(libofx_context, ofx_proc_transaction_cb, 0); + ofx_set_security_cb(libofx_context, ofx_proc_security_cb, 0); + /*ofx_set_status_cb(libofx_context, ofx_proc_status_cb, 0);*/ + + + + DEBUG("Opening selected file"); + libofx_proc_file(libofx_context, selected_filename, AUTODETECT); + free(selected_filename); + } + +} + + + Property changes on: trunk/mmex/src/ofximport.cpp ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/mmex/src/ofximport.h =================================================================== --- trunk/mmex/src/ofximport.h (rev 0) +++ trunk/mmex/src/ofximport.h 2009-11-13 03:00:52 UTC (rev 764) @@ -0,0 +1,15 @@ +/* + * ofximport.h + * moneymanagerex + * + * Created by Wesley Ellis on 11/12/09. + * Copyright 2009 __MyCompanyName__. All rights reserved. + * + */ + +#ifndef OFX_IMPORT_H +#define OFX_IMPORT_H + + +void mmOfxImport(); +#endif Property changes on: trunk/mmex/src/ofximport.h ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-13 15:17:50
|
Revision: 767 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=767&view=rev Author: omalleypat Date: 2009-11-13 15:17:42 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Merge changes to optionsdialog (date format additions) from of branch svn merge -x -b -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/include/optionsdialog.h ./src/optionsdialog.h svn merge -x -b -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/src/optionsdialog.cpp ./src/optionsdialog.cpp There were no conflicts Modified Paths: -------------- trunk/mmex/src/optionsdialog.cpp trunk/mmex/src/optionsdialog.h Property Changed: ---------------- trunk/mmex/src/optionsdialog.cpp trunk/mmex/src/optionsdialog.h Modified: trunk/mmex/src/optionsdialog.cpp =================================================================== --- trunk/mmex/src/optionsdialog.cpp 2009-11-13 04:29:54 UTC (rev 766) +++ trunk/mmex/src/optionsdialog.cpp 2009-11-13 15:17:42 UTC (rev 767) @@ -147,12 +147,9 @@ wxT("%d/%m/%Y"), wxT("%m/%d/%y"), wxT("%m/%d/%Y"), - wxT("%m/%d'%Y"), - wxT("%y/%m/%d"), wxT("%Y/%m/%d"), - wxT("%d-%m-%y"), wxT("%d-%m-%Y"), wxT("%m-%d-%y"), @@ -161,7 +158,9 @@ wxT("%d.%m.%Y"), wxT("%Y-%m-%d"), wxT("%Y.%m.%d"), - }; + wxT("%d,%m,%y"), + wxT("%d/%m %Y"), + }; wxString itemChoice7Strings[TOTAL_DATEFORMAT] = { @@ -169,20 +168,19 @@ wxT("DD/MM/YYYY"), wxT("MM/DD/YY"), wxT("MM/DD/YYYY"), - wxT("MM/DD'YYYY"), - wxT("YY/MM/DD"), wxT("YYYY/MM/DD"), - wxT("DD-MM-YY"), wxT("DD-MM-YYYY"), wxT("MM-DD-YY"), wxT("MM-DD-YYYY"), - wxT("DD.MM.YY"), + wxT("DD.MM.YY"), wxT("DD.MM.YYYY"), - wxT("YYYY-MM-DD"), + wxT("YYYY-MM-DD"), wxT("YYYY.MM.DD"), + wxT("DD,MM,YY"), + wxT("DD/MM YYYY"), }; for(int i=0; i<TOTAL_DATEFORMAT; i++) { @@ -202,12 +200,9 @@ wxT("%d/%m/%Y"), wxT("%m/%d/%y"), wxT("%m/%d/%Y"), - wxT("%m/%d'%Y"), - wxT("%y/%m/%d"), wxT("%Y/%m/%d"), - wxT("%d-%m-%y"), wxT("%d-%m-%Y"), wxT("%m-%d-%y"), @@ -216,6 +211,8 @@ wxT("%d.%m.%Y"), wxT("%Y-%m-%d"), wxT("%Y.%m.%d"), + wxT("%d,%m,%y"), + wxT("%d/%m %Y"), }; wxString itemChoice7Strings[TOTAL_DATEFORMAT] = @@ -224,12 +221,9 @@ wxT("DD/MM/YYYY"), wxT("MM/DD/YY"), wxT("MM/DD/YYYY"), - wxT("MM/DD'YYYY"), - wxT("YY/MM/DD"), wxT("YYYY/MM/DD"), - wxT("DD-MM-YY"), wxT("DD-MM-YYYY"), wxT("MM-DD-YY"), @@ -238,6 +232,8 @@ wxT("DD.MM.YYYY"), wxT("YYYY-MM-DD"), wxT("YYYY.MM.DD"), + wxT("DD,MM,YY"), + wxT("DD/MM YYYY"), }; for(int i=0; i<TOTAL_DATEFORMAT; i++) { @@ -380,12 +376,9 @@ wxT("DD/MM/YYYY"), wxT("MM/DD/YY"), wxT("MM/DD/YYYY"), - wxT("MM/DD'YYYY"), - wxT("YY/MM/DD"), wxT("YYYY/MM/DD"), - wxT("DD-MM-YY"), wxT("DD-MM-YYYY"), wxT("MM-DD-YY"), @@ -394,6 +387,8 @@ wxT("DD.MM.YYYY"), wxT("YYYY-MM-DD"), wxT("YYYY.MM.DD"), + wxT("DD,MM,YY"), + wxT("DD/MM YYYY"), }; wxString selection = mmDBWrapper::getInfoSettingValue(db_, wxT("DATEFORMAT"), mmex::DEFDATEFORMAT); @@ -961,4 +956,3 @@ // resize dialog window Fit(); } - Property changes on: trunk/mmex/src/optionsdialog.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/optionsdialog.cpp:408-735 /tags/releases/0.9.5.1/src/optionsdialog.cpp:736-766 Modified: trunk/mmex/src/optionsdialog.h =================================================================== --- trunk/mmex/src/optionsdialog.h 2009-11-13 04:29:54 UTC (rev 766) +++ trunk/mmex/src/optionsdialog.h 2009-11-13 15:17:42 UTC (rev 767) @@ -28,7 +28,7 @@ #define SYMBOL_MMOPTIONSDIALOG_SIZE wxSize(500, 400) #define SYMBOL_MMOPTIONSDIALOG_POSITION wxDefaultPosition -#define TOTAL_DATEFORMAT 15 +#define TOTAL_DATEFORMAT 17 class mmOptionsDialog: public wxDialog { Property changes on: trunk/mmex/src/optionsdialog.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/optionsdialog.h:408-735 /branches/0.9.5/mmex/src/optionsdialog.h:566 /tags/releases/0.9.5.1/include/optionsdialog.h:736-766 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-13 15:28:49
|
Revision: 768 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=768&view=rev Author: omalleypat Date: 2009-11-13 15:28:43 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Merge changes to mmtransaction svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/include/mmtransaction.h ./src/mmtransaction.h svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/src/mmtransaction.cpp ./src/mmtransaction.cpp Changes to sql syntax in trunk causing conflict were kept. This change added to trunk from branch: - pCopyTransaction->status_ = pBankTransaction->status_; + pCopyTransaction->status_ = (useOriginalDate ? wxChar('D') : pBankTransaction->status_); Modified Paths: -------------- trunk/mmex/src/mmtransaction.cpp Property Changed: ---------------- trunk/mmex/src/mmtransaction.cpp trunk/mmex/src/mmtransaction.h Modified: trunk/mmex/src/mmtransaction.cpp =================================================================== --- trunk/mmex/src/mmtransaction.cpp 2009-11-13 15:17:42 UTC (rev 767) +++ trunk/mmex/src/mmtransaction.cpp 2009-11-13 15:28:43 UTC (rev 768) @@ -497,7 +497,7 @@ pCopyTransaction->payeeID_= pBankTransaction->payeeID_; pCopyTransaction->transType_= pBankTransaction->transType_; pCopyTransaction->amt_ = pBankTransaction->amt_; - pCopyTransaction->status_ = pBankTransaction->status_; + pCopyTransaction->status_ = (useOriginalDate ? wxChar('D') : pBankTransaction->status_); pCopyTransaction->transNum_= pBankTransaction->transNum_; pCopyTransaction->notes_= pBankTransaction->notes_; pCopyTransaction->categID_ = pBankTransaction->categID_; Property changes on: trunk/mmex/src/mmtransaction.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/mmtransaction.cpp:408-735 /tags/releases/0.9.5.1/src/mmtransaction.cpp:736-767 Property changes on: trunk/mmex/src/mmtransaction.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/mmtransaction.h:408-735 /branches/0.9.5/mmex/src/mmtransaction.h:566 /tags/releases/0.9.5.1/include/mmtransaction.h:736-767 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-13 15:44:58
|
Revision: 769 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=769&view=rev Author: omalleypat Date: 2009-11-13 15:44:49 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Merge changes to budgetingpanel from 0.9.5 svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/src/budgetingpanel.cpp ./src/budgetingpanel.cpp svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/include/budgetingpanel.h ./src/budgetingpanel.h Changes to sql syntax in trunk causing conflict were kept. Property Changed: ---------------- trunk/mmex/src/budgetingpanel.cpp trunk/mmex/src/budgetingpanel.h Property changes on: trunk/mmex/src/budgetingpanel.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/budgetingpanel.cpp:408-735 /tags/releases/0.9.5.1/src/budgetingpanel.cpp:736-768 Property changes on: trunk/mmex/src/budgetingpanel.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/budgetingpanel.h:408-735 /branches/0.9.5/mmex/src/budgetingpanel.h:566 /tags/releases/0.9.5.1/include/budgetingpanel.h:736-768 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-13 16:08:51
|
Revision: 770 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=770&view=rev Author: omalleypat Date: 2009-11-13 16:08:43 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Merge changes to transdialog from 0.9.5 svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/include/transdialog.h ./src/transdialog.h svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/src/transdialog.cpp ./src/transdialog.cpp No conflicts. I think there used to be one, but I must have been the same one fixed in with the change I made in r756 Property Changed: ---------------- trunk/mmex/src/transdialog.cpp trunk/mmex/src/transdialog.h Property changes on: trunk/mmex/src/transdialog.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/transdialog.cpp:408-735 /tags/releases/0.9.5.1/src/transdialog.cpp:736-769 Property changes on: trunk/mmex/src/transdialog.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/transdialog.h:408-735 /branches/0.9.5/mmex/src/transdialog.h:566 /tags/releases/0.9.5.1/include/transdialog.h:736-769 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-13 16:14:23
|
Revision: 771 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=771&view=rev Author: omalleypat Date: 2009-11-13 16:14:15 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Merge changes from 0.9.5 svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/include/newacctdialog.h ./src/newacctdialog.h svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/src/newacctdialog.cpp ./src/newacctdialog.cpp No conflicts. Modified Paths: -------------- trunk/mmex/src/newacctdialog.cpp Property Changed: ---------------- trunk/mmex/src/newacctdialog.cpp trunk/mmex/src/newacctdialog.h Modified: trunk/mmex/src/newacctdialog.cpp =================================================================== --- trunk/mmex/src/newacctdialog.cpp 2009-11-13 16:08:43 UTC (rev 770) +++ trunk/mmex/src/newacctdialog.cpp 2009-11-13 16:14:15 UTC (rev 771) @@ -105,7 +105,7 @@ textCtrl = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_NOTES); textCtrl->SetValue(pAccount->notes_); - wxChoice* itemAcctType = (wxChoice*)FindWindow(ID_DIALOG_NEWACCT_COMBO_ACCTTYPE); + wxChoice* itemAcctType = (wxChoice*)FindWindow(ID_DIALOG_NEWACCT_COMBO_ACCTTYPE); if (pAccount->acctType_ == wxT("Checking")) itemAcctType->SetSelection(ACCT_TYPE_CHECKING); else @@ -120,7 +120,7 @@ wxCheckBox* itemCheckBox = (wxCheckBox*)FindWindow(ID_DIALOG_NEWACCT_CHKBOX_FAVACCOUNT); itemCheckBox->SetValue(pAccount->favoriteAcct_); - textCtrl = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_INITBALANCE); + textCtrl = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_INITBALANCE); double initBal = pAccount->initialBalance_; boost::shared_ptr<mmCurrency> pCurrency = pAccount->currency_.lock(); @@ -280,7 +280,7 @@ itemTextCtrl18->SetToolTip(_("Enter user notes and details about this account.")); itemGridSizer2->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - + wxCheckBox* itemCheckBox10 = new wxCheckBox( itemDialog1, ID_DIALOG_NEWACCT_CHKBOX_FAVACCOUNT, _("Favorite Account"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); itemCheckBox10->SetValue(TRUE); @@ -375,13 +375,13 @@ pAccount->status_ = mmAccount::MMEX_Open; if (acctStatus == ACCT_STATUS_CLOSED) pAccount->status_ = mmAccount::MMEX_Closed; - - wxCheckBox* itemCheckBox = (wxCheckBox*)FindWindow(ID_DIALOG_NEWACCT_CHKBOX_FAVACCOUNT); + + wxCheckBox* itemCheckBox = (wxCheckBox*)FindWindow(ID_DIALOG_NEWACCT_CHKBOX_FAVACCOUNT); if (itemCheckBox->IsChecked()) pAccount->favoriteAcct_ = true; else pAccount->favoriteAcct_ = false; - + mmDBWrapper::loadSettings(core_->db_.get(), currencyID_); wxTextCtrl* textCtrlInit = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_INITBALANCE); wxString bal = textCtrlInit->GetValue().Trim(); @@ -415,4 +415,3 @@ EndModal(wxID_OK); } - Property changes on: trunk/mmex/src/newacctdialog.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/newacctdialog.cpp:408-735 /tags/releases/0.9.5.1/src/newacctdialog.cpp:736-770 Property changes on: trunk/mmex/src/newacctdialog.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/newacctdialog.h:408-735 /branches/0.9.5/mmex/src/newacctdialog.h:566 /tags/releases/0.9.5.1/include/newacctdialog.h:736-770 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-13 16:21:08
|
Revision: 772 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=772&view=rev Author: omalleypat Date: 2009-11-13 16:20:59 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Merge changes from 0.9.5 svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/include/budgetyeardialog.h ./src/budgetyeardialog.h svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/src/budgetyeardialog.cpp ./src/budgetyeardialog.cpp SQL refactoring in trunk kept (r410). Property Changed: ---------------- trunk/mmex/src/budgetyeardialog.cpp trunk/mmex/src/budgetyeardialog.h Property changes on: trunk/mmex/src/budgetyeardialog.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/budgetyeardialog.cpp:408-735 /tags/releases/0.9.5.1/src/budgetyeardialog.cpp:736-771 Property changes on: trunk/mmex/src/budgetyeardialog.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/budgetyeardialog.h:408-735 /branches/0.9.5/mmex/src/budgetyeardialog.h:566 /tags/releases/0.9.5.1/include/budgetyeardialog.h:736-771 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-13 16:30:45
|
Revision: 773 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=773&view=rev Author: omalleypat Date: 2009-11-13 16:30:33 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Merge changes from 0.9.5 svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/include/budgetyearentrydialog.h ./src/budgetyearentrydialog.h svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/src/budgetyearentrydialog.cpp ./src/budgetyearentrydialog.cpp SQL refactoring in trunk kept (r410). Property Changed: ---------------- trunk/mmex/src/budgetyearentrydialog.cpp trunk/mmex/src/budgetyearentrydialog.h Property changes on: trunk/mmex/src/budgetyearentrydialog.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/budgetyearentrydialog.cpp:408-735 /tags/releases/0.9.5.1/src/budgetyearentrydialog.cpp:736-772 Property changes on: trunk/mmex/src/budgetyearentrydialog.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/budgetyearentrydialog.h:408-735 /branches/0.9.5/mmex/src/budgetyearentrydialog.h:566 /tags/releases/0.9.5.1/include/budgetyearentrydialog.h:736-772 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-13 16:37:54
|
Revision: 774 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=774&view=rev Author: omalleypat Date: 2009-11-13 16:37:37 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Merge changes from 0.9.5 svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/src/billsdepositsdialog.cpp ./src/billsdepositsdialog.cpp svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/include/billsdepositsdialog.h ./src/billsdepositsdialog.h Property Changed: ---------------- trunk/mmex/src/billsdepositsdialog.cpp trunk/mmex/src/billsdepositsdialog.h Property changes on: trunk/mmex/src/billsdepositsdialog.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/billsdepositsdialog.cpp:408-735 /tags/releases/0.9.5.1/src/billsdepositsdialog.cpp:736-773 Property changes on: trunk/mmex/src/billsdepositsdialog.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/billsdepositsdialog.h:408-735 /branches/0.9.5/mmex/src/billsdepositsdialog.h:566 /tags/releases/0.9.5.1/include/billsdepositsdialog.h:736-773 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-13 16:41:54
|
Revision: 775 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=775&view=rev Author: omalleypat Date: 2009-11-13 16:41:40 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Merge changes from 0.9.5 svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/src/filtertransdialog.cpp ./src/filtertransdialog.cpp svn merge -x -w -x --ignore-eol-style -r 407:HEAD ^/tags/releases/0.9.5.1/include/filtertransdialog.h ./src/filtertransdialog.h SQL refactoring kept Property Changed: ---------------- trunk/mmex/src/filtertransdialog.cpp trunk/mmex/src/filtertransdialog.h Property changes on: trunk/mmex/src/filtertransdialog.cpp ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/src/filtertransdialog.cpp:408-735 /tags/releases/0.9.5.1/src/filtertransdialog.cpp:736-774 Property changes on: trunk/mmex/src/filtertransdialog.h ___________________________________________________________________ Added: svn:mergeinfo + /branches/0.9.5/mmex/include/filtertransdialog.h:408-735 /branches/0.9.5/mmex/src/filtertransdialog.h:566 /tags/releases/0.9.5.1/include/filtertransdialog.h:736-774 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-13 21:04:35
|
Revision: 776 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=776&view=rev Author: omalleypat Date: 2009-11-13 21:04:27 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Fixes related to sourceforge bug tracker # 1812855. Previously, the payee select and account select dialog were the same. If you did a transfer, the dialog to select and accoun would have the title *organize payees*, with the add, edit, delete buttons disabled. This replaces any instances of the account list showing up in the payee dialog with a different account dialog. The ability of the payee dialog to display accounts has been completely stripped with this revision. Modified Paths: -------------- trunk/mmex/src/billsdepositsdialog.cpp trunk/mmex/src/filtertransdialog.cpp trunk/mmex/src/mmex.cpp trunk/mmex/src/payeedialog.cpp trunk/mmex/src/payeedialog.h trunk/mmex/src/transdialog.cpp Modified: trunk/mmex/src/billsdepositsdialog.cpp =================================================================== --- trunk/mmex/src/billsdepositsdialog.cpp 2009-11-13 16:41:40 UTC (rev 775) +++ trunk/mmex/src/billsdepositsdialog.cpp 2009-11-13 21:04:27 UTC (rev 776) @@ -500,128 +500,185 @@ void mmBDDialog::OnAccountName(wxCommandEvent& /*event*/) { - bool selectPayees = false; - mmPayeeDialog *dlg = new mmPayeeDialog(core_, selectPayees, this); - if ( dlg->ShowModal() == wxID_OK ) - { - if (dlg->payeeID_ == -1) - return; - accountID_ = dlg->payeeID_; - wxString acctName = mmDBWrapper::getAccountName(db_, accountID_); - itemAccountName_->SetLabel(acctName); - } + + static const char sql[] = + "select ACCOUNTNAME " + "from ACCOUNTLIST_V1 " + "where ACCOUNTTYPE = 'Checking' " + "order by ACCOUNTNAME"; + + wxArrayString as; + + wxSQLite3ResultSet q1 = db_->ExecuteQuery(sql); + while (q1.NextRow()) + { + as.Add(q1.GetString(wxT("ACCOUNTNAME"))); + } + q1.Finalize(); + + wxSingleChoiceDialog* scd = new wxSingleChoiceDialog(0, _("Choose Bank Account"), + _("Select Account"), as); + if (scd->ShowModal() == wxID_OK) + { + wxString acctName = scd->GetStringSelection(); + accountID_ = mmDBWrapper::getAccountID(db_, acctName); + itemAccountName_->SetLabel(acctName); + } + scd->Destroy(); } void mmBDDialog::OnPayee(wxCommandEvent& /*event*/) { - bool selectPayees = true; if (choiceTrans_->GetSelection() == DEF_TRANSFER) - selectPayees = false; + { + static const char sql[] = + "select ACCOUNTNAME " + "from ACCOUNTLIST_V1 " + "where ACCOUNTTYPE = 'Checking' " + "order by ACCOUNTNAME"; + + wxArrayString as; + + wxSQLite3ResultSet q1 = db_->ExecuteQuery(sql); + while (q1.NextRow()) + { + as.Add(q1.GetString(wxT("ACCOUNTNAME"))); + } + q1.Finalize(); + + wxSingleChoiceDialog* scd = new wxSingleChoiceDialog(0, _("Choose Bank Account"), + _("Select Account"), as); + if (scd->ShowModal() == wxID_OK) + { + wxString acctName = scd->GetStringSelection(); + payeeID_ = mmDBWrapper::getAccountID(db_, acctName); + bPayee_->SetLabel(acctName); + } + else + { + wxString acctName = mmDBWrapper::getAccountName(db_, payeeID_); + if (acctName.IsEmpty()) + { + payeeID_ = -1; + categID_ = -1; + subcategID_ = -1; + bCategory_->SetLabel(_("Select Category")); + bPayee_->SetLabel(_("Select Payee")); + } + else + { + bPayee_->SetLabel(acctName); + } + } + scd->Destroy(); + } + else + { + mmPayeeDialog *dlg = new mmPayeeDialog(core_, this); + if ( dlg->ShowModal() == wxID_OK ) + { + payeeID_ = dlg->payeeID_; + if (payeeID_ == -1) + { + bPayee_->SetLabel(wxT("Select Payee")); + return; + } + + // ... If this is a Split Transaction, ignore the Payee change + if (split_->numEntries()) + return; + + int tempCategID = -1; + int tempSubCategID = -1; + wxString payeeName = mmDBWrapper::getPayee(db_, + payeeID_, tempCategID, tempSubCategID); + bPayee_->SetLabel(mmReadyDisplayString(payeeName)); - mmPayeeDialog *dlg = new mmPayeeDialog(core_, selectPayees, this); - if ( dlg->ShowModal() == wxID_OK ) - { - if (selectPayees) - { - payeeID_ = dlg->payeeID_; - if (payeeID_ == -1) - { - bPayee_->SetLabel(_("Select Payee")); - return; - } - - // ... If this is a Split Transaction, ignore the Payee change - if (split_->numEntries()) - return; - - int tempCategID = -1; - int tempSubCategID = -1; - wxString payeeName = mmDBWrapper::getPayee(db_, - payeeID_, tempCategID, tempSubCategID); - bPayee_->SetLabel(mmReadyDisplayString(payeeName)); - - if (tempCategID == -1) - { - return; - } - - wxString catName = mmDBWrapper::getCategoryName(db_, tempCategID); - wxString categString = catName; - - if (tempSubCategID != -1) - { - wxString subcatName = mmDBWrapper::getSubCategoryName(db_, - tempCategID, tempSubCategID); - categString += wxT(" : "); - categString += subcatName; - } - - categID_ = tempCategID; - subcategID_ = tempSubCategID; - bCategory_->SetLabel(categString); - } - else - { - - if (dlg->payeeID_ == -1) - return; - payeeID_ = dlg->payeeID_; - wxString acctName = mmDBWrapper::getAccountName(db_, payeeID_); - bPayee_->SetLabel(acctName); - } - } - else - { - wxString payeeName = mmDBWrapper::getPayee(db_, payeeID_, categID_, subcategID_); - if (payeeName.IsEmpty()) - { - payeeID_ = -1; - categID_ = -1; - subcategID_ = -1; - bCategory_->SetLabel(_("Select Category")); - bPayee_->SetLabel(_("Select Payee")); - } - else - { - bPayee_->SetLabel(payeeName); - } - } - dlg->Destroy(); + if (tempCategID == -1) + { + return; + } + + wxString catName = mmDBWrapper::getCategoryName(db_, tempCategID); + wxString categString = catName; + + if (tempSubCategID != -1) + { + wxString subcatName = mmDBWrapper::getSubCategoryName(db_, + tempCategID, tempSubCategID); + categString += wxT(" : "); + categString += subcatName; + } + + categID_ = tempCategID; + subcategID_ = tempSubCategID; + bCategory_->SetLabel(categString); + } + else + { + wxString payeeName = mmDBWrapper::getPayee(db_, + payeeID_, categID_, subcategID_); + if (payeeName.IsEmpty()) + { + payeeID_ = -1; + categID_ = -1; + subcategID_ = -1; + bCategory_->SetLabel(_("Select Category")); + bPayee_->SetLabel(_("Select Payee")); + } + else + { + bPayee_->SetLabel(payeeName); + } + + } + + dlg->Destroy(); + } } - void mmBDDialog::OnTo(wxCommandEvent& /*event*/) -{ - bool selectPayees = true; - if (choiceTrans_->GetSelection() == DEF_TRANSFER) - selectPayees = false; +{ + // This should only get called if we are in a transfer - mmPayeeDialog *dlg = new mmPayeeDialog(core_, selectPayees, this); - if ( dlg->ShowModal() == wxID_OK ) - { - if (dlg->payeeID_ == -1) - return; - toID_ = dlg->payeeID_; - wxString acctName = mmDBWrapper::getAccountName(db_, toID_); - bTo_->SetLabel(acctName); - } - else - { - int categID, subcategID; - wxString toName = mmDBWrapper::getPayee(db_, toID_, categID, subcategID); - if (toName.IsEmpty()) - { - toID_ = -1; - bCategory_->SetLabel(_("Select Category")); - bTo_->SetLabel(_("Select To")); - } - else - { - bTo_->SetLabel(toName); - } - } - - dlg->Destroy(); + static const char sql[] = + "select ACCOUNTNAME " + "from ACCOUNTLIST_V1 " + "where ACCOUNTTYPE = 'Checking' " + "order by ACCOUNTNAME"; + + wxArrayString as; + + wxSQLite3ResultSet q1 = db_->ExecuteQuery(sql); + while (q1.NextRow()) + { + as.Add(q1.GetString(wxT("ACCOUNTNAME"))); + } + q1.Finalize(); + + wxSingleChoiceDialog* scd = new wxSingleChoiceDialog(0, _("Choose Bank Account"), + _("Select Account"), as); + if (scd->ShowModal() == wxID_OK) + { + wxString acctName = scd->GetStringSelection(); + toID_ = mmDBWrapper::getAccountID(db_, acctName); + bTo_->SetLabel(acctName); + } + else + { + wxString acctName = mmDBWrapper::getAccountName(db_, toID_); + if (acctName.IsEmpty()) + { + toID_ = -1; + bCategory_->SetLabel(_("Select Category")); + bPayee_->SetLabel(_("Select To")); + } + else + { + bPayee_->SetLabel(acctName); + } + } + scd->Destroy(); } void mmBDDialog::OnDateChanged(wxDateEvent& /*event*/) Modified: trunk/mmex/src/filtertransdialog.cpp =================================================================== --- trunk/mmex/src/filtertransdialog.cpp 2009-11-13 16:41:40 UTC (rev 775) +++ trunk/mmex/src/filtertransdialog.cpp 2009-11-13 21:04:27 UTC (rev 776) @@ -657,7 +657,7 @@ void mmFilterTransactionsDialog::OnPayee(wxCommandEvent& /*event*/) { - mmPayeeDialog* dlg = new mmPayeeDialog(core_, true, this); + mmPayeeDialog* dlg = new mmPayeeDialog(core_, this); if ( dlg->ShowModal() == wxID_OK ) { payeeID_ = dlg->payeeID_; Modified: trunk/mmex/src/mmex.cpp =================================================================== --- trunk/mmex/src/mmex.cpp 2009-11-13 16:41:40 UTC (rev 775) +++ trunk/mmex/src/mmex.cpp 2009-11-13 21:04:27 UTC (rev 776) @@ -3023,7 +3023,7 @@ void mmGUIFrame::OnOrgPayees(wxCommandEvent& /*event*/) { - mmPayeeDialog *dlg = new mmPayeeDialog(core_.get(), true, this, false); + mmPayeeDialog *dlg = new mmPayeeDialog(core_.get(), this, false); dlg->ShowModal(); dlg->Destroy(); } Modified: trunk/mmex/src/payeedialog.cpp =================================================================== --- trunk/mmex/src/payeedialog.cpp 2009-11-13 16:41:40 UTC (rev 775) +++ trunk/mmex/src/payeedialog.cpp 2009-11-13 21:04:27 UTC (rev 776) @@ -46,7 +46,6 @@ mmPayeeDialog::mmPayeeDialog( ) { payeeID_ = -1; - selectPayees_ = true; } void mmPayeeDialog::OnListKeyDown(wxKeyEvent &event) @@ -68,7 +67,6 @@ } mmPayeeDialog::mmPayeeDialog(mmCoreDB* core, - bool selectPayees, wxWindow* parent, bool showSelectButton, wxWindowID id, @@ -78,7 +76,6 @@ core_ = core; payeeID_ = -1; - selectPayees_ = selectPayees; showSelectButton_ = showSelectButton; Create(parent, id, caption, pos, size, style | wxWANTS_CHARS); } @@ -94,13 +91,6 @@ GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); - if (!selectPayees_) - { - addButton->Disable(); - editButton->Disable(); - deleteButton->Disable(); - } - if (!showSelectButton_) { selectButton->Disable(); @@ -118,8 +108,7 @@ void mmPayeeDialog::fillControls() { core_->payeeList_.sortPayeeList(); - if (selectPayees_) - { + int numPayees = (int)core_->payeeList_.payees_.size(); for (int idx = 0; idx < numPayees; idx++) { @@ -130,29 +119,6 @@ payeeComboBox_->Connect(ID_DIALOG_TRANS_PAYEECOMBO, wxEVT_SET_FOCUS, wxFocusEventHandler(mmPayeeDialog::OnSetFocus), NULL, this); payeeComboBox_->Connect(ID_DIALOG_TRANS_PAYEECOMBO, wxEVT_KILL_FOCUS, wxFocusEventHandler(mmPayeeDialog::OnFocus), NULL, this); payeeComboBox_->SetFocus(); - - - } - else - { - int numAccounts = (int) core_->accountList_.accounts_.size(); - int insertCount = 0; - for (int iAdx = 0; iAdx < numAccounts; iAdx++) - { - mmCheckingAccount* pCA = dynamic_cast<mmCheckingAccount*>(core_->accountList_.accounts_[iAdx].get()); - if (pCA) - { - listBox_->Insert(pCA->accountName_, insertCount, new mmPayeeListBoxItem(pCA->accountID_)); - insertCount++; - } - } - - listBox_->SetFocus(); - if (!listBox_->IsEmpty()) - { - listBox_->SetSelection(0); - } - } } void mmPayeeDialog::CreateControls() @@ -162,8 +128,6 @@ wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); itemDialog1->SetSizer(itemBoxSizer2); - if (selectPayees_) - { wxStaticText* itemStaticTextName = new wxStaticText( itemDialog1, wxID_STATIC, _("Find Payee: "), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer2->Add(itemStaticTextName, 0, @@ -173,7 +137,6 @@ ID_DIALOG_TRANS_PAYEECOMBO, wxT(""), wxDefaultPosition, wxSize(250, -1), wxCB_READONLY); itemBoxSizer2->Add(payeeComboBox_, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); payeeComboBox_->SetToolTip(_("Enter the payee name to be added or make edits to an existing payee name")); - } wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5); @@ -190,9 +153,9 @@ //itemBoxSizerPayee->Add(itemStaticTextName, 0, // wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticText* itemStaticTextName = new wxStaticText( itemDialog1, wxID_STATIC, + wxStaticText* itemStaticTextName2 = new wxStaticText( itemDialog1, wxID_STATIC, _("Add/Edit Payee: "), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer2->Add(itemStaticTextName, 0, + itemBoxSizer2->Add(itemStaticTextName2, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5); textCtrl = new wxTextCtrl( itemDialog1, ID_DIALOG_PAYEE_TEXTCTRL_PAYEENAME, Modified: trunk/mmex/src/payeedialog.h =================================================================== --- trunk/mmex/src/payeedialog.h 2009-11-13 16:41:40 UTC (rev 775) +++ trunk/mmex/src/payeedialog.h 2009-11-13 21:04:27 UTC (rev 776) @@ -51,7 +51,6 @@ mmPayeeDialog(); mmPayeeDialog( mmCoreDB* core, - bool selectPayees, wxWindow* parent, bool showSelectButton = true, wxWindowID id = SYMBOL_PAYEEDIALOG_IDNAME, @@ -96,7 +95,6 @@ public: int payeeID_; - bool selectPayees_; }; #endif Modified: trunk/mmex/src/transdialog.cpp =================================================================== --- trunk/mmex/src/transdialog.cpp 2009-11-13 16:41:40 UTC (rev 775) +++ trunk/mmex/src/transdialog.cpp 2009-11-13 21:04:27 UTC (rev 776) @@ -452,82 +452,112 @@ void mmTransDialog::OnPayee(wxCommandEvent& /*event*/) { - bool selectPayees = true; if (choiceTrans_->GetSelection() == DEF_TRANSFER) - selectPayees = false; - - mmPayeeDialog *dlg = new mmPayeeDialog(core_, selectPayees, this); - if ( dlg->ShowModal() == wxID_OK ) - { - if (selectPayees) - { - payeeID_ = dlg->payeeID_; - if (payeeID_ == -1) - { - bPayee_->SetLabel(wxT("Select Payee")); - return; - } - - // ... If this is a Split Transaction, ignore the Payee change - if (split_->numEntries()) - return; - - int tempCategID = -1; - int tempSubCategID = -1; - wxString payeeName = mmDBWrapper::getPayee(db_.get(), - payeeID_, tempCategID, tempSubCategID); - bPayee_->SetLabel(mmReadyDisplayString(payeeName)); - - if (tempCategID == -1) - { - return; - } - - wxString catName = mmDBWrapper::getCategoryName(db_.get(), tempCategID); - wxString categString = catName; - - if (tempSubCategID != -1) - { - wxString subcatName = mmDBWrapper::getSubCategoryName(db_.get(), - tempCategID, tempSubCategID); - categString += wxT(" : "); - categString += subcatName; - } - - categID_ = tempCategID; - subcategID_ = tempSubCategID; - bCategory_->SetLabel(categString); - } - else - { - - if (dlg->payeeID_ == -1) - return; - payeeID_ = dlg->payeeID_; - wxString acctName = mmDBWrapper::getAccountName(db_.get(), payeeID_); + { + static const char sql[] = + "select ACCOUNTNAME " + "from ACCOUNTLIST_V1 " + "where ACCOUNTTYPE = 'Checking' " + "order by ACCOUNTNAME"; + + wxArrayString as; + + wxSQLite3ResultSet q1 = db_->ExecuteQuery(sql); + while (q1.NextRow()) + { + as.Add(q1.GetString(wxT("ACCOUNTNAME"))); + } + q1.Finalize(); + + wxSingleChoiceDialog* scd = new wxSingleChoiceDialog(0, _("Choose Bank Account"), + _("Select Account"), as); + if (scd->ShowModal() == wxID_OK) + { + wxString acctName = scd->GetStringSelection(); + payeeID_ = mmDBWrapper::getAccountID(db_.get(), acctName); bPayee_->SetLabel(acctName); - } - } - else - { - wxString payeeName = mmDBWrapper::getPayee(db_.get(), - payeeID_, categID_, subcategID_); - if (payeeName.IsEmpty()) - { - payeeID_ = -1; - categID_ = -1; - subcategID_ = -1; - bCategory_->SetLabel(_("Select Category")); - bPayee_->SetLabel(_("Select Payee")); - } - else - { - bPayee_->SetLabel(payeeName); - } - - } + } + else + { + wxString acctName = mmDBWrapper::getAccountName(db_.get(), payeeID_); + if (acctName.IsEmpty()) + { + payeeID_ = -1; + categID_ = -1; + subcategID_ = -1; + bCategory_->SetLabel(_("Select Category")); + bPayee_->SetLabel(_("Select Payee")); + } + else + { + bPayee_->SetLabel(acctName); + } + } + scd->Destroy(); + } + else + { + mmPayeeDialog *dlg = new mmPayeeDialog(core_, this); + if ( dlg->ShowModal() == wxID_OK ) + { + payeeID_ = dlg->payeeID_; + if (payeeID_ == -1) + { + bPayee_->SetLabel(wxT("Select Payee")); + return; + } + + // ... If this is a Split Transaction, ignore the Payee change + if (split_->numEntries()) + return; + + int tempCategID = -1; + int tempSubCategID = -1; + wxString payeeName = mmDBWrapper::getPayee(db_.get(), + payeeID_, tempCategID, tempSubCategID); + bPayee_->SetLabel(mmReadyDisplayString(payeeName)); - dlg->Destroy(); + if (tempCategID == -1) + { + return; + } + + wxString catName = mmDBWrapper::getCategoryName(db_.get(), tempCategID); + wxString categString = catName; + + if (tempSubCategID != -1) + { + wxString subcatName = mmDBWrapper::getSubCategoryName(db_.get(), + tempCategID, tempSubCategID); + categString += wxT(" : "); + categString += subcatName; + } + + categID_ = tempCategID; + subcategID_ = tempSubCategID; + bCategory_->SetLabel(categString); + } + else + { + wxString payeeName = mmDBWrapper::getPayee(db_.get(), + payeeID_, categID_, subcategID_); + if (payeeName.IsEmpty()) + { + payeeID_ = -1; + categID_ = -1; + subcategID_ = -1; + bCategory_->SetLabel(_("Select Category")); + bPayee_->SetLabel(_("Select Payee")); + } + else + { + bPayee_->SetLabel(payeeName); + } + + } + + dlg->Destroy(); + } } void mmTransDialog::OnAutoTransNum(wxCommandEvent& /*event*/) { @@ -537,37 +567,47 @@ } void mmTransDialog::OnTo(wxCommandEvent& /*event*/) -{ - bool selectPayees = true; - if (choiceTrans_->GetSelection() == DEF_TRANSFER) - selectPayees = false; - - mmPayeeDialog *dlg = new mmPayeeDialog(core_, selectPayees, this); - if ( dlg->ShowModal() == wxID_OK ) - { - if (dlg->payeeID_ == -1) - return; - toID_ = dlg->payeeID_; - wxString acctName = mmDBWrapper::getAccountName(db_.get(), toID_); - bTo_->SetLabel(acctName); - } - else - { - int categID, subcategID; - wxString toName = mmDBWrapper::getPayee(db_.get(), toID_, categID, subcategID); - if (toName.IsEmpty()) - { - toID_ = -1; - bCategory_->SetLabel(_("Select Category")); - bTo_->SetLabel(_("Select To")); - } - else - { - bTo_->SetLabel(toName); - } - } - - dlg->Destroy(); +{ + // This should only get called if we are in a transfer + + static const char sql[] = + "select ACCOUNTNAME " + "from ACCOUNTLIST_V1 " + "where ACCOUNTTYPE = 'Checking' " + "order by ACCOUNTNAME"; + + wxArrayString as; + + wxSQLite3ResultSet q1 = db_->ExecuteQuery(sql); + while (q1.NextRow()) + { + as.Add(q1.GetString(wxT("ACCOUNTNAME"))); + } + q1.Finalize(); + + wxSingleChoiceDialog* scd = new wxSingleChoiceDialog(0, _("Choose Bank Account"), + _("Select Account"), as); + if (scd->ShowModal() == wxID_OK) + { + wxString acctName = scd->GetStringSelection(); + toID_ = mmDBWrapper::getAccountID(db_.get(), acctName); + bTo_->SetLabel(acctName); + } + else + { + wxString acctName = mmDBWrapper::getAccountName(db_.get(), toID_); + if (acctName.IsEmpty()) + { + toID_ = -1; + bCategory_->SetLabel(_("Select Category")); + bPayee_->SetLabel(_("Select To")); + } + else + { + bPayee_->SetLabel(acctName); + } + } + scd->Destroy(); } void mmTransDialog::OnDateChanged(wxDateEvent& /*event*/) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kkk...@us...> - 2009-11-14 13:23:25
|
Revision: 780 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=780&view=rev Author: kkkvadim Date: 2009-11-14 13:23:18 +0000 (Sat, 14 Nov 2009) Log Message: ----------- mmSelectLanguage refactoring Modified Paths: -------------- trunk/mmex/src/mmex.cpp trunk/mmex/src/optionsdialog.cpp trunk/mmex/src/util.cpp trunk/mmex/src/util.h Modified: trunk/mmex/src/mmex.cpp =================================================================== --- trunk/mmex/src/mmex.cpp 2009-11-14 13:11:58 UTC (rev 779) +++ trunk/mmex/src/mmex.cpp 2009-11-14 13:23:18 UTC (rev 780) @@ -288,8 +288,7 @@ valWStr.ToLong(&valw); valHStr.ToLong(&valh); - /* Select language if necessary */ - mmSelectLanguage(inidb.get()); + mmSelectLanguage(0, inidb.get(), false); inidb->Close(); Modified: trunk/mmex/src/optionsdialog.cpp =================================================================== --- trunk/mmex/src/optionsdialog.cpp 2009-11-14 13:11:58 UTC (rev 779) +++ trunk/mmex/src/optionsdialog.cpp 2009-11-14 13:23:18 UTC (rev 780) @@ -454,15 +454,10 @@ wxHORIZONTAL); itemBoxSizer20->Add(itemStaticBoxSizerLang, 0, wxALIGN_LEFT|wxGROW|wxALL, 5); - wxStaticText* itemStaticText555 = new wxStaticText( itemPanelGeneral, wxID_STATIC, - _("Language"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizerLang->Add(itemStaticText555, 0, - wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); - - wxString lang = mmDBWrapper::getINISettingValue(inidb_, - wxT("LANGUAGE"), wxT("")); - wxButton* itemButtonLanguage = new wxButton( itemPanelGeneral, - ID_DIALOG_OPTIONS_BUTTON_LANGUAGE, lang, wxDefaultPosition, wxDefaultSize, 0 ); + wxString lang = mmDBWrapper::getINISettingValue(inidb_, wxT("LANGUAGE")); + wxButton* itemButtonLanguage = new wxButton( itemPanelGeneral, + ID_DIALOG_OPTIONS_BUTTON_LANGUAGE, lang, wxDefaultPosition, wxDefaultSize, 0); + itemStaticBoxSizerLang->Add(itemButtonLanguage, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); itemButtonLanguage->SetToolTip(_("Specify the language to use")); @@ -770,17 +765,29 @@ void mmOptionsDialog::OnLanguageChanged(wxCommandEvent& /*event*/) { - mmSelectLanguage(inidb_, true); - wxButton* bn = (wxButton*)FindWindow(ID_DIALOG_OPTIONS_BUTTON_LANGUAGE); - wxString lang = mmDBWrapper::getINISettingValue(inidb_, - wxT("LANGUAGE"), wxT("")); - bn->SetLabel(lang); + wxString lang = mmSelectLanguage(this, inidb_, true); - // resize dialog window - Fit(); + if (lang.empty()) { + return; + } -// if (!mmGraphGenerator::checkGraphFiles()) -// mmIniOptions::enableGraphs_ = false; + wxButton *btn = (wxButton*)FindWindow(ID_DIALOG_OPTIONS_BUTTON_LANGUAGE); + wxASSERT(btn); + + if (btn && btn->GetLabel() != lang) { + + int x = 0; + int y = 0; + btn->GetTextExtent(lang, &x, &y); + + wxSize sz = btn->GetSize(); + sz.SetWidth(x << 1); + btn->SetSize(sz); + + btn->SetLabel(lang); + + Fit(); // resize dialog window + } } void mmOptionsDialog::OnNavTreeColorChanged(wxCommandEvent& /*event*/) Modified: trunk/mmex/src/util.cpp =================================================================== --- trunk/mmex/src/util.cpp 2009-11-14 13:11:58 UTC (rev 779) +++ trunk/mmex/src/util.cpp 2009-11-14 13:23:18 UTC (rev 780) @@ -46,12 +46,44 @@ } //---------------------------------------------------------------------------- -inline int CaseInsensitiveCmp(const wxString &s1, const wxString &s2) +int CaseInsensitiveCmp(const wxString &s1, const wxString &s2) { return s1.CmpNoCase(s2); } //---------------------------------------------------------------------------- +wxString selectLanguageDlg(wxWindow *parent, const wxString &langPath, bool verbose) +{ + wxString lang; + + wxArrayString lang_files; + size_t cnt = wxDir::GetAllFiles(langPath, &lang_files, wxT("*.mo")); + + if (!cnt) { + + if (verbose) { + wxString s = wxT("Can't find language files (.mo) at \""); + s << langPath << wxT('\"'); + + wxMessageDialog dlg(parent, s, wxT("Error"), wxICON_ERROR); + dlg.ShowModal(); + } + + return lang; + } + + for (size_t i = 0; i < cnt; ++i) { + wxFileName fname(lang_files[i]); + lang_files[i] = fname.GetName(); + } + + lang_files.Sort(CaseInsensitiveCmp); + lang = wxGetSingleChoice(wxT("Please choose language"), wxT("Languages"), lang_files, parent); + + return lang; +} +//---------------------------------------------------------------------------- + } // namespace //---------------------------------------------------------------------------- @@ -63,6 +95,7 @@ { dateFormat = mmDBWrapper::getInfoSettingValue(db, wxT("DATEFORMAT"), mmex::DEFDATEFORMAT); } +//---------------------------------------------------------------------------- void mmOptions::saveOptions(wxSQLite3Database* db) { @@ -186,74 +219,59 @@ #endif } -void mmSelectLanguage(wxSQLite3Database* inidb, bool showSelection) + +/* + locale.AddCatalog(lang) calls wxLogWarning and returns true for corrupted .mo file, + so I should use locale.IsLoaded(lang) also. +*/ +wxString mmSelectLanguage(wxWindow *parent, wxSQLite3Database* inidb, bool forced_show_dlg) { - wxFileName fname(wxTheApp->argv[0]); - mmGUIApp* mmApp = dynamic_cast<mmGUIApp*>(wxTheApp); - wxASSERT(mmApp); - /*******************************************************/ - /* Select Language */ - // TODO : Issue with wxWidgets 2.6.2 causes crash when trying to AddCatalog - // http://cvs.wxwidgets.org/viewcvs.cgi/wxWindows/src/common/intl.cpp.diff?r1=1.166&r2=1.166.2.1 - /*******************************************************/ - wxString langStr = mmDBWrapper::getINISettingValue(inidb, - wxT("LANGUAGE"), wxT("")); + wxString lang; - wxString langPath = fname.GetPath(wxPATH_GET_VOLUME) - + wxT("//en//"); -#if defined (__WXMAC__) || defined (__WXOSX__) - langPath = mmGetBaseWorkingPath() + wxT("/en/"); -#endif -#if defined (__WXGTK__) - mmApp->getLocale().AddCatalogLookupPathPrefix(fname.GetPath(wxPATH_GET_VOLUME)); -#else - mmApp->getLocale().AddCatalogLookupPathPrefix(langPath); -#endif - if (langStr == wxT("") || showSelection) - { - wxArrayString langFileArray; - if (wxDir::Exists(langPath)) - { - int num = (int)wxDir::GetAllFiles(langPath, &langFileArray, wxT("*.mo")); - if (num > 0) - { - for (int ix = 0; ix < num; ix++) - { - wxFileName fname(langFileArray[ix]); - wxString name = fname.GetName(); - langFileArray[ix] = name; - } + const wxString langPath = mmGetBaseWorkingPath() + wxT("/en"); + wxLocale &locale = wxGetApp().getLocale(); + bool verbose = forced_show_dlg; - langFileArray.Sort(CaseInsensitiveCmp); + if (wxDir::Exists(langPath)) { + locale.AddCatalogLookupPathPrefix(langPath); + } else { + if (verbose) { + wxString s = wxT("Directory of language files does not exist:\n\""); + s << langPath << wxT('\"'); - wxString newLangStr = wxGetSingleChoice - ( - wxT("Please choose language:"), - wxT("Language"), - langFileArray - ); + wxMessageDialog dlg(parent, s, wxT("Error"), wxICON_ERROR); + dlg.ShowModal(); + } - if (newLangStr != wxT("")) - { - if(mmApp->getLocale().AddCatalog(newLangStr) == false) { - ::wxLogMessage(wxT("m_locate Error!")); - } + return lang; + } + + const wxString param_lang(wxT("LANGUAGE")); - /* Save Language Setting */ - mmDBWrapper::setINISettingValue(inidb, wxT("LANGUAGE"), - newLangStr); + if (!forced_show_dlg) { - mmOptions::language = newLangStr; - } - } - } + lang = mmDBWrapper::getINISettingValue(inidb, param_lang); + + if (!lang.empty() && locale.AddCatalog(lang) && locale.IsLoaded(lang)) { + mmOptions::language = lang; + return lang; + } + } + + lang = selectLanguageDlg(parent, langPath, verbose); + + if (!lang.empty()) { + + bool ok = locale.AddCatalog(lang) && locale.IsLoaded(lang); + if (!ok) { + lang.clear(); // bad .mo file + } + + mmOptions::language = lang; + mmDBWrapper::setINISettingValue(inidb, param_lang, lang); } - else - { - /* Previous language found */ - mmApp->getLocale().AddCatalog(langStr); - mmOptions::language = langStr; - } + + return lang; } wxString mmReadyDisplayString(const wxString& orig) @@ -272,44 +290,38 @@ wxString mmGetNiceMonthName(int month) { - const wxString gMonthsInYear[12] = - { - _("January"), _("February"), _("March"), _("April"), _("May"), _("June"), - _("July"), _("August"), _("September"), _("October"), _("November"), _("December") - }; + static const wxString mon[12] = { + _("January"), _("February"), _("March"), _("April"), _("May"), _("June"), + _("July"), _("August"), _("September"), _("October"), _("November"), _("December") + }; - return gMonthsInYear[month]; + wxASSERT(month >= 0 && month < 12); + return mon[month]; } wxString mmGetNiceShortMonthName(int month) { - const wxString gMonthsInYear[12] = - { - _("Jan"), _("Feb"), _("Mar"), _("Apr"), _("May"), _("Jun"), - _("Jul"), _("Aug"), _("Sep"), _("Oct"), _("Nov"), _("Dec") - }; + static const wxString mon[12] = { + _("Jan"), _("Feb"), _("Mar"), _("Apr"), _("May"), _("Jun"), + _("Jul"), _("Aug"), _("Sep"), _("Oct"), _("Nov"), _("Dec") + }; - return gMonthsInYear[month]; + wxASSERT(month >= 0 && month < 12); + return mon[month]; } wxString mmGetNiceDateString(wxDateTime dt) { -#if 0 - return dt.Format(wxT("%A, %B %d, %Y")); -#endif - - - const wxString gDaysInWeek[7] = - { - _("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), - _("Thursday"), _("Friday"), _("Saturday") - }; + static const wxString gDaysInWeek[7] = { + _("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), + _("Thursday"), _("Friday"), _("Saturday") + }; - wxString dts(gDaysInWeek[dt.GetWeekDay()] + wxString(wxT(", "))); + wxString dts(gDaysInWeek[dt.GetWeekDay()] + wxString(wxT(", "))); dts += mmGetNiceMonthName(dt.GetMonth()) + wxString(wxT(" ")); - dts += wxString::Format(wxT("%d"), dt.GetDay()) + wxT(", ") - + wxString::Format(wxT("%d"), dt.GetYear()); - return dts; + dts += wxString::Format(wxT("%d"), dt.GetDay()) + wxT(", ") + wxString::Format(wxT("%d"), dt.GetYear()); + + return dts; } wxString mmGetNiceDateSimpleString(wxDateTime dt) Modified: trunk/mmex/src/util.h =================================================================== --- trunk/mmex/src/util.h 2009-11-14 13:11:58 UTC (rev 779) +++ trunk/mmex/src/util.h 2009-11-14 13:23:18 UTC (rev 780) @@ -37,7 +37,7 @@ void mmShowErrorMessageInvalid(wxWindow* parent, wxString message); void mmShowErrorMessage(wxWindow* parent, wxString message, wxString messageheader); -void mmSelectLanguage(wxSQLite3Database* inidb, bool showSelection=false); +wxString mmSelectLanguage(wxWindow *parent, wxSQLite3Database *inidb, bool forced_show_dlg); wxString mmGetDateForStorage(wxDateTime dt); wxDateTime mmGetStorageStringAsDate(const wxString& str); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <oma...@us...> - 2009-11-14 19:18:55
|
Revision: 783 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=783&view=rev Author: omalleypat Date: 2009-11-14 19:18:47 +0000 (Sat, 14 Nov 2009) Log Message: ----------- Preliminary implementation of a recent files list. Currently it doesn't remove any duplicates, but that would be good in the future. I added five items to the ini db, FILEHISTORY1 through FILEHISTORY5 Modified Paths: -------------- trunk/mmex/src/guiid.h trunk/mmex/src/mmex.cpp trunk/mmex/src/mmex.h Modified: trunk/mmex/src/guiid.h =================================================================== --- trunk/mmex/src/guiid.h 2009-11-14 14:25:14 UTC (rev 782) +++ trunk/mmex/src/guiid.h 2009-11-14 19:18:47 UTC (rev 783) @@ -49,6 +49,15 @@ MENU_OPEN, MENU_SAVE, MENU_SAVE_AS, + //Keep this block in order --- + MENU_RECENT, // + MENU_RECENT_1, // + MENU_RECENT_2, // + MENU_RECENT_3, // + MENU_RECENT_4, // + MENU_RECENT_5, // + MENU_RECENT_CLEAR, // + //---------------------------- MENU_EXPORT, MENU_QUIT, MENU_ABOUT, Modified: trunk/mmex/src/mmex.cpp =================================================================== --- trunk/mmex/src/mmex.cpp 2009-11-14 14:25:14 UTC (rev 782) +++ trunk/mmex/src/mmex.cpp 2009-11-14 19:18:47 UTC (rev 783) @@ -340,6 +340,12 @@ EVT_MENU(MENU_NEW, mmGUIFrame::OnNew) EVT_MENU(MENU_OPEN, mmGUIFrame::OnOpen) EVT_MENU(MENU_SAVE_AS, mmGUIFrame::OnSaveAs) + EVT_MENU(MENU_RECENT_1, mmGUIFrame::OnOpenRecent) + EVT_MENU(MENU_RECENT_2, mmGUIFrame::OnOpenRecent) + EVT_MENU(MENU_RECENT_3, mmGUIFrame::OnOpenRecent) + EVT_MENU(MENU_RECENT_4, mmGUIFrame::OnOpenRecent) + EVT_MENU(MENU_RECENT_5, mmGUIFrame::OnOpenRecent) + EVT_MENU(MENU_RECENT_CLEAR, mmGUIFrame::OnRecentFilesClear) EVT_MENU(MENU_CONVERT_ENC_DB, mmGUIFrame::OnConvertEncryptedDB) EVT_MENU(MENU_EXPORT_CSV, mmGUIFrame::OnExport) EVT_MENU(MENU_EXPORT_QIF, mmGUIFrame::OnExportToQIF) @@ -560,13 +566,14 @@ wxString printHeaderBase = mmIniOptions::appName_; printer_-> SetHeader( printHeaderBase + wxT("(@PAGENUM@/@PAGESCNT@)<hr>"), wxPAGE_ALL); + /* Load from Settings DB */ + loadConfigFile(); + /* Create the Controls for the frame */ createMenu(); createToolBar(); createControls(); - /* Load from Settings DB */ - loadConfigFile(); // add the toolbars to the manager m_mgr.AddPane(toolBar_, wxAuiPaneInfo(). @@ -2253,33 +2260,37 @@ toolBarBitmaps[8] = wxBitmap(edit_account_xpm); toolBarBitmaps[9] = wxBitmap(delete_account_xpm); - wxMenu *menuFile = new wxMenu; - wxMenuItem* menuItemNew = new wxMenuItem(menuFile, MENU_NEW, + menuFile_ = new wxMenu; + wxMenuItem* menuItemNew = new wxMenuItem(menuFile_, MENU_NEW, _("&New Database\tCtrl-N"), _("New Database")); menuItemNew->SetBitmap(toolBarBitmaps[0]); - wxMenuItem* menuItemOpen = new wxMenuItem(menuFile, MENU_OPEN, + wxMenuItem* menuItemOpen = new wxMenuItem(menuFile_, MENU_OPEN, _("&Open Database\tCtrl-O"), _("Open Database")); menuItemOpen->SetBitmap(toolBarBitmaps[1]); - menuFile->Append(menuItemNew); - menuFile->Append(menuItemOpen); + menuFile_->Append(menuItemNew); + menuFile_->Append(menuItemOpen); - wxMenuItem* menuItemSaveAs = new wxMenuItem(menuFile, MENU_SAVE_AS, + wxMenuItem* menuItemSaveAs = new wxMenuItem(menuFile_, MENU_SAVE_AS, _("Save Database &As"), _("Save Database As")); menuItemSaveAs->SetBitmap(wxBitmap(saveas_xpm)); - menuFile->Append(menuItemSaveAs); + menuFile_->Append(menuItemSaveAs); - menuFile->AppendSeparator(); - + menuFile_->AppendSeparator(); + + // Create the recently used files list + recentMenu_ = new wxMenu; + RecentFilesMenu(); + wxMenu* exportMenu = new wxMenu; exportMenu->Append(MENU_EXPORT_CSV, _("&CSV Files"), _("Export to CSV")); exportMenu->Append(MENU_EXPORT_QIF, _("&QIF Files"), _("Export to QIF")); exportMenu->Append(MENU_EXPORT_HTML, _("&Report to HTML"), _("Export to HTML")); - menuFile->Append(MENU_EXPORT, _("&Export"), exportMenu); + menuFile_->Append(MENU_EXPORT, _("&Export"), exportMenu); wxMenu* importMenu = new wxMenu; importMenu->Append(MENU_IMPORT_QIF, _("&QIF Files"), _("Import from QIF")); @@ -2289,35 +2300,35 @@ if (mmIniOptions::enableImportMMNETCSV_) importMenu->Append(MENU_IMPORT_MMNETCSV, _("MM.&NET CSV Files"), _("Import from MM.NET CSV")); //importMenu->Append(MENU_IMPORT_QFX, _("&QFX Files"), _("Import from QFX")); - menuFile->Append(MENU_IMPORT, _("&Import"), importMenu); + menuFile_->Append(MENU_IMPORT, _("&Import"), importMenu); - menuFile->AppendSeparator(); + menuFile_->AppendSeparator(); - wxMenuItem* menuItemPrintSetup = new wxMenuItem(menuFile, MENU_PRINT_PAGE_SETUP, + wxMenuItem* menuItemPrintSetup = new wxMenuItem(menuFile_, MENU_PRINT_PAGE_SETUP, _("Page Set&up..."), _("Setup page printing options")); menuItemPrintSetup->SetBitmap(toolBarBitmaps[7]); - menuFile->Append(menuItemPrintSetup); + menuFile_->Append(menuItemPrintSetup); wxMenu* printPreviewMenu = new wxMenu; printPreviewMenu->Append(MENU_PRINT_PREVIEW_REPORT, _("Current &View"), _("Preview current report")); - menuFile->Append(MENU_PRINT_PREVIEW, _("Print Pre&view..."), printPreviewMenu); + menuFile_->Append(MENU_PRINT_PREVIEW, _("Print Pre&view..."), printPreviewMenu); wxMenu* printMenu = new wxMenu; wxMenuItem* menuItemPrintView = new wxMenuItem(printMenu, MENU_PRINT_REPORT, _("Current &View"), _("Print current report")); printMenu->Append(menuItemPrintView); - menuFile->Append( MENU_PRINT, _("&Print..."), printMenu); + menuFile_->Append( MENU_PRINT, _("&Print..."), printMenu); - menuFile->AppendSeparator(); + menuFile_->AppendSeparator(); - wxMenuItem* menuItemQuit = new wxMenuItem(menuFile, wxID_EXIT, + wxMenuItem* menuItemQuit = new wxMenuItem(menuFile_, wxID_EXIT, _("E&xit\tAlt-X"), _("Quit this program")); menuItemQuit->SetBitmap(wxBitmap(exit_xpm)); - menuFile->Append(menuItemQuit); + menuFile_->Append(menuItemQuit); wxMenu *menuView = new wxMenu; @@ -2480,7 +2491,7 @@ menuHelp->Append(menuItemAbout); menuBar_ = new wxMenuBar; - menuBar_->Append(menuFile, _("&File")); + menuBar_->Append(menuFile_, _("&File")); menuBar_->Append(menuAccounts, _("&Accounts")); menuBar_->Append(menuTools, _("&Tools")); menuBar_->Append(menuView, _("&View")); @@ -2701,7 +2712,97 @@ mmDBWrapper::setINISettingValue(inidb_.get(), wxT("LASTFILENAME"), wxGetEmptyString()); showBeginAppDialog(); } + else + { + //File successfully opened, so we need to update history, + //Unless we are opening the same file as before + if (!fileName.IsSameAs(mmDBWrapper::getINISettingValue(inidb_.get(), wxT("LASTFILENAME"), wxGetEmptyString()))) + UpdateRecentFilesINI(); + } + } + +void mmGUIFrame::RecentFilesMenu() +{ + //First, we need to see if the recent files menu is already there and destroy it if so. + if (menuFile_->FindItem(MENU_RECENT)) + { + menuFile_->Delete(MENU_RECENT); + for (int i=0; i<6; i++) //1-5 are files, 6 is clear + recentMenu_->Delete(MENU_RECENT+i+1); + } + + + wxString recent_ini; + wxString rfq; + for (int i=0; i<5; i++) + { + rfq.Printf(wxT("FILEHIST%d"),i+1); + recent_ini = mmDBWrapper::getINISettingValue(inidb_.get(), rfq, wxGetEmptyString()); + if (recent_ini.IsSameAs(wxGetEmptyString())) + { + break; + } + else + { + recentMenu_->Append(MENU_RECENT+i+1,recent_ini); + } + } + if (recentMenu_->GetMenuItemCount()>0) + { + recentMenu_->Append(MENU_RECENT_CLEAR,_("Clear Recent Files")); + menuFile_->Insert(3,MENU_RECENT,_("Recent Files"),recentMenu_); + //menuFile_->AppendSeparator(); + } + +} + +void mmGUIFrame::OnRecentFilesClear(wxCommandEvent& WXUNUSED(event)) +{ + wxString rfq; + for (int i=0; i<5; i++) + { + rfq.Printf(wxT("FILEHIST%d"),i+1); + mmDBWrapper::setINISettingValue(inidb_.get(), rfq, wxGetEmptyString()); + } + RecentFilesMenu(); +} + +void mmGUIFrame::UpdateRecentFilesINI() +{ + //Take the LASTFILE and bump it into the history, making sure there are no repeats or gaps. + // This is a work in progress... + wxString replacing = mmDBWrapper::getINISettingValue(inidb_.get(), + wxT("LASTFILENAME"), wxGetEmptyString()); + wxString getting_replaced; + // Now bump everybody down + wxString recent_ini; + wxString rfq; + for (int i=0; i<5; i++) + { + //First, get whatever the next value is before we replace it: + rfq.Printf(wxT("FILEHIST%d"),i+1); + getting_replaced = mmDBWrapper::getINISettingValue(inidb_.get(), rfq, wxGetEmptyString()); + + if (i==0 && (getting_replaced.IsSameAs(replacing))) + break; //LASTFILENAME was reopened (ie at program launch, no need to continue + + //Next, replace it with the one above in the list + mmDBWrapper::setINISettingValue(inidb_.get(), rfq, replacing); + + // Get ready for the next iteration + if (!getting_replaced.IsSameAs(wxGetEmptyString())) + { + replacing = getting_replaced; + } + else + { + break; + } + } + RecentFilesMenu(); + saveConfigFile(); +} //---------------------------------------------------------------------------- void mmGUIFrame::OnNew(wxCommandEvent& /*event*/) @@ -2742,6 +2843,15 @@ openFile(fileName, false); } } + +void mmGUIFrame::OnOpenRecent(wxCommandEvent& event) +{ + wxString rfq; + rfq.Printf(wxT("FILEHIST%d"),event.GetId()-MENU_RECENT); + wxString fileName = mmDBWrapper::getINISettingValue(inidb_.get(), rfq, wxGetEmptyString()); + openFile(fileName, false); +} + //---------------------------------------------------------------------------- void mmGUIFrame::OnConvertEncryptedDB(wxCommandEvent& /*event*/) Modified: trunk/mmex/src/mmex.h =================================================================== --- trunk/mmex/src/mmex.h 2009-11-14 14:25:14 UTC (rev 782) +++ trunk/mmex/src/mmex.h 2009-11-14 19:18:47 UTC (rev 783) @@ -106,6 +106,10 @@ wxToolBar* toolBar_; mmTreeItemData* selectedItemData_; wxMenuItem* menuItemOnlineUpdateCurRate_; // Menu Item for Disabling Item + + //We need to be able to update these on the fly + wxMenu* recentMenu_; + wxMenu* menuFile_; /* printing */ boost::scoped_ptr<wxHtmlEasyPrinting> printer_; @@ -198,6 +202,10 @@ void OnViewFavoriteAccounts(wxCommandEvent& event); void OnViewOpenAccounts(wxCommandEvent& event); + void RecentFilesMenu(); + void UpdateRecentFilesINI(); + void OnRecentFilesClear(wxCommandEvent& WXUNUSED(event)); + void OnOpenRecent(wxCommandEvent& event); // any class wishing to process wxWindows events must use this macro DECLARE_EVENT_TABLE() }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kkk...@us...> - 2009-11-22 15:25:36
|
Revision: 799 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=799&view=rev Author: kkkvadim Date: 2009-11-22 15:25:24 +0000 (Sun, 22 Nov 2009) Log Message: ----------- new Added Paths: ----------- trunk/mmex/src/mac/ trunk/mmex/src/mac/platfdep.cpp Added: trunk/mmex/src/mac/platfdep.cpp =================================================================== --- trunk/mmex/src/mac/platfdep.cpp (rev 0) +++ trunk/mmex/src/mac/platfdep.cpp 2009-11-22 15:25:24 UTC (rev 799) @@ -0,0 +1,56 @@ +/******************************************************* +Copyright (C) 2009 VaDiM + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + +//---------------------------------------------------------------------------- +#include "../platfdep.h" +#include <wx/stdpaths.h> +#include <wx/filename.h> +//---------------------------------------------------------------------------- + +wxFileName mmex::GetSharedDir() +{ + static wxFileName fname(wxFileName::DirName(wxStandardPaths::Get().GetDataDir())); + return fname; +} +//---------------------------------------------------------------------------- + +wxFileName mmex::GetDocDir() +{ + static wxFileName fname; + + if (!fname.IsOk()) { + fname = GetSharedDir(); + fname.AppendDir(wxT("doc")); + } + + return fname; +} +//---------------------------------------------------------------------------- + +wxFileName mmex::GetResourceDir() +{ + static wxFileName fname(wxFileName::DirName(wxStandardPaths::Get().GetResourcesDir())); + return fname; +} +//---------------------------------------------------------------------------- + +wxString mmex::GetAppName() +{ + return wxString(wxT("MoneyManagerEx")); +} +//---------------------------------------------------------------------------- Property changes on: trunk/mmex/src/mac/platfdep.cpp ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kkk...@us...> - 2009-11-22 15:27:15
|
Revision: 800 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=800&view=rev Author: kkkvadim Date: 2009-11-22 15:26:47 +0000 (Sun, 22 Nov 2009) Log Message: ----------- new Added Paths: ----------- trunk/mmex/src/unix/ trunk/mmex/src/unix/platfdep.cpp Added: trunk/mmex/src/unix/platfdep.cpp =================================================================== --- trunk/mmex/src/unix/platfdep.cpp (rev 0) +++ trunk/mmex/src/unix/platfdep.cpp 2009-11-22 15:26:47 UTC (rev 800) @@ -0,0 +1,64 @@ +/******************************************************* +Copyright (C) 2009 VaDiM + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + +//---------------------------------------------------------------------------- +#include "../platfdep.h" +#include <wx/stdpaths.h> +#include <wx/filename.h> +//---------------------------------------------------------------------------- + +wxFileName mmex::GetSharedDir() +{ + static wxFileName fname(wxFileName::DirName(wxStandardPaths::Get().GetDataDir())); + return fname; +} +//---------------------------------------------------------------------------- + +wxFileName mmex::GetDocDir() +{ + static wxFileName fname; + + if (!fname.IsOk()) { + fname = GetSharedDir(); + fname.RemoveLastDir(); // mmex folder + fname.AppendDir(wxT("doc")); + fname.AppendDir(GetAppName()); + } + + return fname; +} +//---------------------------------------------------------------------------- + +wxFileName mmex::GetResourceDir() +{ + static wxFileName fname; + + if (!fname.IsOk()) { + fname = GetSharedDir(); + fname.AppendDir(wxT("res")); + } + + return fname; +} +//---------------------------------------------------------------------------- + +wxString mmex::GetAppName() +{ + return wxString(wxT("mmex")); +} +//---------------------------------------------------------------------------- Property changes on: trunk/mmex/src/unix/platfdep.cpp ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kkk...@us...> - 2009-11-22 15:28:19
|
Revision: 801 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=801&view=rev Author: kkkvadim Date: 2009-11-22 15:28:11 +0000 (Sun, 22 Nov 2009) Log Message: ----------- new Added Paths: ----------- trunk/mmex/src/win/ trunk/mmex/src/win/platfdep.cpp Added: trunk/mmex/src/win/platfdep.cpp =================================================================== --- trunk/mmex/src/win/platfdep.cpp (rev 0) +++ trunk/mmex/src/win/platfdep.cpp 2009-11-22 15:28:11 UTC (rev 801) @@ -0,0 +1,71 @@ +/******************************************************* +Copyright (C) 2009 VaDiM + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ********************************************************/ + +//---------------------------------------------------------------------------- +#include "../platfdep.h" +#include <wx/stdpaths.h> +#include <wx/filename.h> +//---------------------------------------------------------------------------- + +namespace +{ + +wxFileName GetInstallDir() +{ + const wxStandardPathsBase &p = wxStandardPaths::Get(); + wxFileName fname(p.GetExecutablePath()); + fname.RemoveLastDir(); // bin\mmex.exe + + return fname; +} + +} // namespace + +//---------------------------------------------------------------------------- + +wxFileName mmex::GetSharedDir() +{ + static wxFileName fname(GetInstallDir()); + return fname; +} +//---------------------------------------------------------------------------- + +wxFileName mmex::GetDocDir() +{ + return GetSharedDir(); +} +//---------------------------------------------------------------------------- + +wxFileName mmex::GetResourceDir() +{ + static wxFileName fname; + + if (!fname.IsOk()) { + fname = GetSharedDir(); + fname.AppendDir(wxT("res")); + } + + return fname; +} +//---------------------------------------------------------------------------- + +wxString mmex::GetAppName() +{ + return wxString(wxT("MoneyManagerEx")); +} +//---------------------------------------------------------------------------- Property changes on: trunk/mmex/src/win/platfdep.cpp ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |