|
|
@ -35,6 +35,8 @@
|
|
|
|
#include <algorithm>
|
|
|
|
#include <algorithm>
|
|
|
|
using namespace std;
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern vector<int> getCsvOrderStatic(kvoctrainDoc *doc);
|
|
|
|
|
|
|
|
|
|
|
|
void kvoctrainApp::slotSmartSearchClip()
|
|
|
|
void kvoctrainApp::slotSmartSearchClip()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQString s;
|
|
|
|
TQString s;
|
|
|
@ -62,51 +64,7 @@ void kvoctrainApp::slotSmartSearchClip()
|
|
|
|
|
|
|
|
|
|
|
|
vector<int> kvoctrainApp::getCsvOrder(kvoctrainDoc *doc)
|
|
|
|
vector<int> kvoctrainApp::getCsvOrder(kvoctrainDoc *doc)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
vector<int> csv_order;
|
|
|
|
return getCsvOrderStatic(doc);
|
|
|
|
TQStringList lang_order = Prefs::pasteOrder();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!Prefs::useCurrent())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (/*lang_order &&*/ lang_order.count() != 0) {
|
|
|
|
|
|
|
|
for (int i = 0; i < (int) lang_order.count(); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int j = doc->findIdent((lang_order)[i]);
|
|
|
|
|
|
|
|
if (j >= 0)
|
|
|
|
|
|
|
|
csv_order.push_back (j);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
csv_order.push_back (-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
for (int i = 0; i < csv_order.size(); i++)
|
|
|
|
|
|
|
|
cout << csv_order[i] << " ";
|
|
|
|
|
|
|
|
cout << endl;
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* perhaps skip missing ??
|
|
|
|
|
|
|
|
for (int i = csv_order.size()-1; i >= 0; i--)
|
|
|
|
|
|
|
|
if (csv_order[i] == -1)
|
|
|
|
|
|
|
|
csv_order.erase(csv_order.begin() + i);
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
// append indices from doc if no order given
|
|
|
|
|
|
|
|
for (int i = 0; i < doc->numLangs(); i++)
|
|
|
|
|
|
|
|
if (::find (csv_order.begin(), csv_order.end(), i) == csv_order.end())
|
|
|
|
|
|
|
|
csv_order.push_back(i);
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
if (csv_order.size() > doc->numLangs() )
|
|
|
|
|
|
|
|
csv_order.erase(csv_order.begin() + doc->numLangs(), csv_order.end());
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// remove trailing garbage
|
|
|
|
|
|
|
|
for (int i = csv_order.size()-1; i >= 0; i--) {
|
|
|
|
|
|
|
|
if (csv_order[i] != -1)
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
csv_order.erase(csv_order.begin() + i);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return csv_order;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|