]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiSendto.cpp
fix completion painting for RTL (inline completion and completion list)
[lyx.git] / src / frontends / qt4 / GuiSendto.cpp
index afb9dc8a27f87dbc984b7ab6e53a680c9a09a367..fe644a40f50c76a7091b0331ad7994af14a8b332 100644 (file)
 #include <config.h>
 
 #include "GuiSendto.h"
+#include "qt_helpers.h"
 
 #include "Buffer.h"
 #include "Converter.h"
 #include "Format.h"
 #include "FuncRequest.h"
 #include "LyXRC.h"
-#include "qt_helpers.h"
 
+#include "support/qstring_helpers.h"
 #include "support/filetools.h"
-#include "support/lstrings.h"
 
 #include <QListWidget>
 #include <QPushButton>
-#include <QCloseEvent>
 
 using namespace std;
 using namespace lyx::support;
@@ -35,10 +34,9 @@ namespace frontend {
 
 
 GuiSendTo::GuiSendTo(GuiView & lv)
-       : GuiDialog(lv, "sendto")
+       : GuiDialog(lv, "sendto", qt_("Send Document to Command"))
 {
        setupUi(this);
-       setViewTitle(_("Send Document to Command"));
 
        connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
        connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
@@ -66,13 +64,6 @@ void GuiSendTo::changed_adaptor()
 }
 
 
-void GuiSendTo::closeEvent(QCloseEvent * e)
-{
-       slotClose();
-       e->accept();
-}
-
-
 void GuiSendTo::updateContents()
 {
        all_formats_ = allFormats();
@@ -93,10 +84,10 @@ void GuiSendTo::updateContents()
 
        for (vector<string>::const_iterator it = keys.begin();
             it != keys.end(); ++it) {
-               formatLW->addItem(toqstr(*it));
+               formatLW->addItem(qt_(*it));
        }
 
-       commandCO->addItem(toqstr(command_));
+       commandCO->addItem(command_);
 }
 
 
@@ -104,11 +95,11 @@ void GuiSendTo::applyView()
 {
        int const line = formatLW->currentRow();
 
-       if (line < 0 || line > int(formatLW->count()))
+       if (line < 0 || line > formatLW->count())
                return;
 
        format_ = all_formats_[line];
-       command_ = trim(fromqstr(commandCO->currentText()));
+       command_ = commandCO->currentText().trimmed();
 }
 
 
@@ -124,20 +115,20 @@ bool GuiSendTo::isValid()
 }
 
 
-bool GuiSendTo::initialiseParams(std::string const &)
+bool GuiSendTo::initialiseParams(string const &)
 {
        format_ = 0;
-       command_ = lyxrc.custom_export_command;
+       command_ = toqstr(lyxrc.custom_export_command);
        return true;
 }
 
 
 void GuiSendTo::dispatchParams()
 {
-       if (command_.empty() || !format_ || format_->name().empty())
+       if (command_.isEmpty() || !format_ || format_->name().empty())
                return;
 
-       string const data = format_->name() + " " + command_;
+       string const data = format_->name() + " " + fromqstr(command_);
        dispatch(FuncRequest(getLfun(), data));
 }
 
@@ -149,8 +140,10 @@ vector<Format const *> GuiSendTo::allFormats() const
        exports.push_back("lyx");
        exports.push_back("text");
 
-       if (buffer().isLatex())
+       if (buffer().isLatex()) {
                exports.push_back("latex");
+               exports.push_back("pdflatex");
+       }
        else if (buffer().isDocBook())
                exports.push_back("docbook");
        else if (buffer().isLiterate())
@@ -181,8 +174,8 @@ vector<Format const *> GuiSendTo::allFormats() const
        }
 
        // Remove repeated formats.
-       std::sort(to.begin(), to.end());
-       to.erase(std::unique(to.begin(), to.end()), to.end());
+       sort(to.begin(), to.end());
+       to.erase(unique(to.begin(), to.end()), to.end());
 
        return to;
 }