From 26a055be993821db436806eeee5ed8ea0867ad2e Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 7 Apr 2013 18:28:52 -0500 Subject: Reconsolidate split code from prior commit (cherry picked from commit 2e1267ad62d5a62f6ace0e5452c07f4c8b685d6a) --- kvoctrain/kvoctrain/kva_clip.cpp | 48 ++------------------------------ kvoctrain/kvoctrain/kvt-core/kvd_csv.cpp | 4 +-- 2 files changed, 5 insertions(+), 47 deletions(-) diff --git a/kvoctrain/kvoctrain/kva_clip.cpp b/kvoctrain/kvoctrain/kva_clip.cpp index d441cc2e..e13e43ab 100644 --- a/kvoctrain/kvoctrain/kva_clip.cpp +++ b/kvoctrain/kvoctrain/kva_clip.cpp @@ -35,6 +35,8 @@ #include using namespace std; +extern vector getCsvOrderStatic(kvoctrainDoc *doc); + void kvoctrainApp::slotSmartSearchClip() { TQString s; @@ -62,51 +64,7 @@ void kvoctrainApp::slotSmartSearchClip() vector kvoctrainApp::getCsvOrder(kvoctrainDoc *doc) { - vector 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; + return getCsvOrderStatic(doc); } diff --git a/kvoctrain/kvoctrain/kvt-core/kvd_csv.cpp b/kvoctrain/kvoctrain/kvt-core/kvd_csv.cpp index e2d4fedb..a194ae13 100644 --- a/kvoctrain/kvoctrain/kvt-core/kvd_csv.cpp +++ b/kvoctrain/kvoctrain/kvt-core/kvd_csv.cpp @@ -32,7 +32,7 @@ #include using namespace std; -vector getCsvOrder(kvoctrainDoc *doc) +vector getCsvOrderStatic(kvoctrainDoc *doc) { vector csv_order; TQStringList lang_order = Prefs::pasteOrder(); @@ -119,7 +119,7 @@ bool kvoctrainDoc::saveToCsv (TQTextStream& os, TQString &) os << i18n("! Title:") << separator << getTitle() << "\n"; os << i18n("! Author:") << separator << getAuthor() << "\n"; - vector csv_order = getCsvOrder(this); + vector csv_order = getCsvOrderStatic(this); vector::const_iterator first = vocabulary.begin (); TQString exp; -- cgit v1.2.1