- Relocated legacy checks from Config.cpp to legacy.cpp.
This commit is contained in:
Paul Beckingham 2011-10-02 18:05:20 -04:00
parent d62ea4e223
commit 6e21cc5b2a
5 changed files with 73 additions and 71 deletions

View file

@ -696,69 +696,3 @@ void Config::all (std::vector<std::string>& items) const
}
////////////////////////////////////////////////////////////////////////////////
std::string Config::checkForDeprecatedColor ()
{
std::vector <std::string> deprecated;
std::map <std::string, std::string>::const_iterator it;
for (it = this->begin (); it != this->end (); ++it)
{
if (it->first.find ("color.") != std::string::npos)
{
std::string value = get (it->first);
if (value.find ("_") != std::string::npos)
deprecated.push_back (it->first);
}
}
std::stringstream out;
if (deprecated.size ())
{
out << STRING_CONFIG_DEPRECATED_US
<< "\n";
std::vector <std::string>::iterator it2;
for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2)
out << " " << *it2 << "=" << get (*it2) << "\n";
out << "\n";
}
return out.str ();
}
////////////////////////////////////////////////////////////////////////////////
std::string Config::checkForDeprecatedColumns ()
{
std::vector <std::string> deprecated;
std::map <std::string, std::string>::const_iterator it;
for (it = this->begin (); it != this->end (); ++it)
{
if (it->first.find ("report") == 0)
{
std::string value = get (it->first);
if (value.find ("entry_time") != std::string::npos ||
value.find ("start_time") != std::string::npos ||
value.find ("end_time") != std::string::npos)
deprecated.push_back (it->first);
}
}
std::stringstream out;
out << "\n";
if (deprecated.size ())
{
out << STRING_CONFIG_DEPRECATED_COL
<< "\n";
std::vector <std::string>::iterator it2;
for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2)
out << " " << *it2 << "=" << get (*it2) << "\n";
out << "\n";
}
return out.str ();
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -60,9 +60,6 @@ public:
void set (const std::string&, const std::string&);
void all (std::vector <std::string>&) const;
std::string checkForDeprecatedColor ();
std::string checkForDeprecatedColumns ();
public:
File _original_file;

View file

@ -32,6 +32,7 @@
#include <algorithm>
#include <text.h>
#include <i18n.h>
#include <main.h>
#include <Context.h>
#include <Directory.h>
#include <ViewText.h>
@ -304,8 +305,9 @@ int CmdShow::execute (std::string& output)
out << " " << format (STRING_CMD_SHOW_DIFFER_COLOR, warning.colorize ("color"));
}
out << context.config.checkForDeprecatedColor ();
out << context.config.checkForDeprecatedColumns ();
out << legacyCheckForDeprecatedColor ();
out << legacyCheckForDeprecatedColumns ();
// TODO Check for referenced but missing theme files.
// TODO Check for referenced but missing string files.
// TODO Check for referenced but missing tips files.

View file

@ -27,6 +27,7 @@
#define L10N // Localization complete.
#include <sstream>
#include <Context.h>
#include <text.h>
#include <i18n.h>
@ -102,3 +103,69 @@ void legacySortColumnMap (std::string& name)
}
////////////////////////////////////////////////////////////////////////////////
std::string legacyCheckForDeprecatedColor ()
{
std::vector <std::string> deprecated;
std::map <std::string, std::string>::const_iterator it;
for (it = context.config.begin (); it != context.config.end (); ++it)
{
if (it->first.find ("color.") != std::string::npos)
{
std::string value = context.config.get (it->first);
if (value.find ("_") != std::string::npos)
deprecated.push_back (it->first);
}
}
std::stringstream out;
if (deprecated.size ())
{
out << STRING_CONFIG_DEPRECATED_US
<< "\n";
std::vector <std::string>::iterator it2;
for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2)
out << " " << *it2 << "=" << context.config.get (*it2) << "\n";
out << "\n";
}
return out.str ();
}
////////////////////////////////////////////////////////////////////////////////
std::string legacyCheckForDeprecatedColumns ()
{
std::vector <std::string> deprecated;
std::map <std::string, std::string>::const_iterator it;
for (it = context.config.begin (); it != context.config.end (); ++it)
{
if (it->first.find ("report") == 0)
{
std::string value = context.config.get (it->first);
if (value.find ("entry_time") != std::string::npos ||
value.find ("start_time") != std::string::npos ||
value.find ("end_time") != std::string::npos)
deprecated.push_back (it->first);
}
}
std::stringstream out;
out << "\n";
if (deprecated.size ())
{
out << STRING_CONFIG_DEPRECATED_COL
<< "\n";
std::vector <std::string>::iterator it2;
for (it2 = deprecated.begin (); it2 != deprecated.end (); ++it2)
out << " " << *it2 << "=" << context.config.get (*it2) << "\n";
out << "\n";
}
return out.str ();
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -82,6 +82,8 @@ void sort_tasks (std::vector <Task>&, std::vector <int>&, const std::string&);
void legacyAttributeCheck (const std::string&);
void legacyColumnMap (std::string&);
void legacySortColumnMap (std::string&);
std::string legacyCheckForDeprecatedColor ();
std::string legacyCheckForDeprecatedColumns ();
// list template
///////////////////////////////////////////////////////////////////////////////