mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Legacy
- Relocated legacy checks from Config.cpp to legacy.cpp.
This commit is contained in:
parent
d62ea4e223
commit
6e21cc5b2a
5 changed files with 73 additions and 71 deletions
|
@ -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 ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue