summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-07 18:09:30 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-04-07 18:09:30 -0500
commitc5dacf57e07e93dd186692d4de64fbe9784af87d (patch)
tree81bcf67e7b5f47cba011e11136daed4caeef81cd
parentc16c4c03575d50a260a94f9f1871d12c35847570 (diff)
downloadtdeedu-c5dacf57e07e93dd186692d4de64fbe9784af87d.tar.gz
tdeedu-c5dacf57e07e93dd186692d4de64fbe9784af87d.zip
Allow kvoctrain to build even if undefined symbols have been disallowed
This relates to Bug 1134
-rw-r--r--kvoctrain/kvoctrain/kvt-core/kvd_csv.cpp51
1 files changed, 50 insertions, 1 deletions
diff --git a/kvoctrain/kvoctrain/kvt-core/kvd_csv.cpp b/kvoctrain/kvoctrain/kvt-core/kvd_csv.cpp
index d48a7ebe..d148f856 100644
--- a/kvoctrain/kvoctrain/kvt-core/kvd_csv.cpp
+++ b/kvoctrain/kvoctrain/kvt-core/kvd_csv.cpp
@@ -32,6 +32,55 @@
#include <vector>
using namespace std;
+vector<int> getCsvOrder(kvoctrainDoc *doc)
+{
+ vector<int> csv_order;
+ 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;
+}
+
bool kvoctrainDoc::saveTypeNameCsv (TQTextStream &)
{
return true;
@@ -70,7 +119,7 @@ bool kvoctrainDoc::saveToCsv (TQTextStream& os, TQString &)
os << i18n("! Title:") << separator << getTitle() << "\n";
os << i18n("! Author:") << separator << getAuthor() << "\n";
- vector <int> csv_order = kvoctrainApp::getCsvOrder(this);
+ vector <int> csv_order = getCsvOrder(this);
vector<kvoctrainExpr>::const_iterator first = vocabulary.begin ();
TQString exp;