+int64_t bRunRestore::runRestore(QString tablename)
+{
+ QString q;
+ QString tmp;
+
+ tmp = ClientCb->currentText();
+ if (tmp == "") {
+ return 0;
+ }
+ q = "restore client=" + tmp;
+
+ tmp = CommentEntry->text();
+ if (tmp != "") {
+ tmp.replace("\"", " ");
+ q += " comment=\"" + tmp + "\"";
+ }
+
+ tmp = StorageCb->currentText();
+ if (tmp != "") {
+ q += " storage=" + tmp;
+ }
+
+ if (UseFileRelocationChk->checkState() == Qt::Checked) {
+ if (UseRegexpChk->checkState() == Qt::Checked) {
+ tmp = WhereRegexpEntry->text();
+ if (tmp != "") {
+ tmp.replace("\"", "");
+ q += " regexwhere=\"" + tmp + "\"";
+ }
+ } else {
+ QStringList lst;
+ tmp = StripPrefixEntry->text();
+ if (tmp != "") {
+ tmp.replace("\"", "");
+ lst.append("!" + tmp + "!!i");
+ }
+ tmp = AddPrefixEntry->text();
+ if (tmp != "") {
+ tmp.replace("\"", "");
+ lst.append("!^!" + tmp + "!");
+ }
+ tmp = AddSuffixEntry->text();
+ if (tmp != "") {
+ tmp.replace("\"", "");
+ lst.append("!([^/])$!$1" + tmp + "!");
+ }
+ if (lst.size() > 0) {
+ q += " regexwhere=\"" + lst.join(",") + "\"";
+ }
+ }
+ } else {
+ tmp = WhereEntry->text();
+ if (tmp != "") {
+ tmp.replace("\"", "");
+ q += " where=\"" + tmp + "\"";
+ }
+ }
+
+// q += " priority=" + tmp.setNum(PrioritySb->value());
+// q += " job=\"" + RestoreCb->currentText() + "\"";
+ q += " file=\"?" + tablename + "\"";
+ q += " when=\"" + WhenEditor->dateTime().toString("yyyy-MM-dd hh:mm:ss") + "\"";
+ q += " done yes";
+
+ if (mainWin->m_miscDebug) qDebug() << q;
+ QStringList results;
+ if (brestore->console()->dir_cmd(q, results)) {
+ foreach (QString resultline, results) {
+ QStringList fieldlist = resultline.split("=");
+ if (fieldlist.size() == 2) {
+ return fieldlist.at(1).toLongLong();
+ }
+ }
+ }
+ return 0;
+}
+