]> 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 798fad0c39eb4171a65c26bf0650ee34b9fae324..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 std::vector;
-using std::string;
 
+using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 namespace frontend {
 
-using support::trim;
 
-GuiSendTo::GuiSendTo(LyXView & lv)
-       : GuiDialog(lv, "sendto"), Controller(this)
+GuiSendTo::GuiSendTo(GuiView & lv)
+       : GuiDialog(lv, "sendto", qt_("Send Document to Command"))
 {
        setupUi(this);
-       setViewTitle(_("Send Document to Command"));
-       setController(this, false);
 
        connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
        connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
@@ -69,13 +64,6 @@ void GuiSendTo::changed_adaptor()
 }
 
 
-void GuiSendTo::closeEvent(QCloseEvent * e)
-{
-       slotClose();
-       e->accept();
-}
-
-
 void GuiSendTo::updateContents()
 {
        all_formats_ = allFormats();
@@ -96,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_);
 }
 
 
@@ -107,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();
 }
 
 
@@ -127,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));
 }
 
@@ -152,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())
@@ -184,14 +174,14 @@ 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;
 }
 
 
-Dialog * createGuiSendTo(LyXView & lv) { return new GuiSendTo(lv); }
+Dialog * createGuiSendTo(GuiView & lv) { return new GuiSendTo(lv); }
 
 
 } // namespace frontend