There is no need now to cache format information in the SendTo

dialog.
This commit is contained in:
Richard Heck 2016-10-19 17:30:48 -04:00
parent 7fd1a14c1b
commit e7f39ed377
2 changed files with 8 additions and 8 deletions

View File

@ -71,17 +71,17 @@ void GuiSendTo::changed_adaptor()
void GuiSendTo::updateContents()
{
all_formats_ = buffer().params().exportableFormats(false);
sort(all_formats_.begin(), all_formats_.end(), Format::formatSorter);
vector<Format const *> const & all_formats =
buffer().params().exportableFormats(false);
// Save the current selection if any
Format const * current_format = nullptr;
int const line = formatLW->currentRow();
if (line >= 0 && static_cast<unsigned int>(line) < all_formats_.size()
if (line >= 0 && static_cast<unsigned int>(line) < all_formats.size()
&& formatLW->selectedItems().size() > 0)
current_format = all_formats_[line];
current_format = all_formats[line];
// Reset the list widget
formatLW->clear();
for (Format const * f : all_formats_) {
for (Format const * f : all_formats) {
formatLW->addItem(toqstr(translateIfPossible(f->prettyname())));
// Restore the selection
if (current_format && f->prettyname() == current_format->prettyname())
@ -101,7 +101,9 @@ void GuiSendTo::applyView()
if (line < 0 || line > formatLW->count())
return;
format_ = all_formats_[line];
vector<Format const *> const & all_formats =
buffer().params().exportableFormats(false);
format_ = all_formats[line];
command_ = command;
}

View File

@ -46,8 +46,6 @@ private:
/// Update the dialog
void updateContents();
///
std::vector<Format const *> all_formats_;
///
bool initialiseParams(std::string const & data);
///