///////////////////////////////////////////////////////////////////////
void Gimmick::addDB(std::string &i_name, std::string &i_location)
{
- mTreeHandlerMap[i_name] = new SQLiteTreeHandler(i_location);
+ if(mTreeHandlerMap.find(i_name) == mTreeHandlerMap.end())
+ {
+ mTreeHandlerMap[i_name] = new SQLiteTreeHandler(i_location);
+ mTreeHandlerMap[i_name]->Open(true);
+ }
}
this->CreateTreeView(i->second, mGimmick->GetTimestampDatabase());
}
}
+
+ /// Create a tree view with a given name
+ void GimmickView::CreateSingleTreeView(std::string &i_name)
+ {
+ this->CreateTreeView(mGimmick->GetTreeHandlerMap()[i_name],
+ mGimmick->GetTimestampDatabase());
+
+ }
+
+
//======================================================================
//======================================================================
/// Create the tree views
void CreateTreeViews();
+ /// Create a tree view with a given name
+ void CreateSingleTreeView(std::string &i_name);
+
/// Create the tree view for TreeHandler provided
virtual void CreateTreeView( TreeHandler*, TimestampDatabaseHandler* )
{ GimmickError("INTERNAL ERROR : CreateTreeView not implemented"); }
wxMessageBox(std2wx(mess.str()),_T("Addition result"),wxOK,this);
}
+ //////////////////////////////////////////////////
+ // Add a DB to application //
+ // @param event : WxEvent //
+ // @return : - //
+ //////////////////////////////////////////////////
void WxGimmickView::OnAddDB(wxCommandEvent& event)
{
wxBusyCursor busy;
wxArrayString files;
FD->GetPaths(files);
+ std::stringstream st;
for(int i = 0; i< files.size(); i++)
{
- std::string snb = "remote_1";
- mGimmick->addDB(snb, crea::wx2std(files[i]));
- // UpdateTreeViewLevel("remote_1",1);
+ st<< "remote_" << i+1;
+ //create TreeHandler
+ mGimmick->addDB(st.str(), crea::wx2std(files[i]));
+ //create TreeView
+ CreateSingleTreeView(st.str());
}
}