| 1601 | |
| 1602 | |
| 1603 | void CPreferences::SaveCats() |
| 1604 | { |
| 1605 | if ( GetCatCount() ) { |
| 1606 | wxConfigBase* cfg = wxConfigBase::Get(); |
| 1607 | |
| 1608 | // Save the main cat. |
| 1609 | cfg->Write( "/eMule/AllcatType", (int)s_allcatFilter); |
| 1610 | |
| 1611 | // The first category is the default one and should not be counted |
| 1612 | |
| 1613 | cfg->Write( "/General/Count", (long)(m_CatList.size() - 1) ); |
| 1614 | |
| 1615 | uint32 maxcat = m_CatList.size(); |
| 1616 | for (uint32 i = 1; i < maxcat; i++) { |
| 1617 | cfg->SetPath(CFormat("/Cat#%i") % i); |
| 1618 | |
| 1619 | cfg->Write( "Title", m_CatList[i]->title ); |
| 1620 | cfg->Write( "Incoming", CPath::ToUniv(m_CatList[i]->path) ); |
| 1621 | cfg->Write( "Comment", m_CatList[i]->comment ); |
| 1622 | cfg->Write( "Color", wxString(CFormat("%u") % m_CatList[i]->color)); |
| 1623 | cfg->Write( "Priority", (int)m_CatList[i]->prio ); |
| 1624 | } |
| 1625 | // remove deleted cats from config |
| 1626 | while (cfg->DeleteGroup(CFormat("/Cat#%i") % maxcat++)) {} |
| 1627 | |
| 1628 | cfg->Flush(); |
| 1629 | } |
| 1630 | } |
| 1631 | |
| 1632 | |
| 1633 | void CPreferences::LoadPreferences() |