mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
printing: store the last import / export template
Store the last template file name which the user imported / exported and then try to pre-select it in the combo box. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
bc6146577d
commit
a2ec791f2f
2 changed files with 7 additions and 1 deletions
|
@ -60,11 +60,13 @@ void PrintOptions::setupTemplates()
|
|||
int current_index = 0;
|
||||
ui.printTemplate->clear();
|
||||
Q_FOREACH(const QString& theme, currList) {
|
||||
if (theme == storedTemplate) // find the stored template in the list
|
||||
// find the stored template in the list
|
||||
if (theme == storedTemplate || theme == lastImportExportTemplate)
|
||||
current_index = currList.indexOf(theme);
|
||||
ui.printTemplate->addItem(theme.split('.')[0], theme);
|
||||
}
|
||||
ui.printTemplate->setCurrentIndex(current_index);
|
||||
lastImportExportTemplate = "";
|
||||
}
|
||||
|
||||
// print type radio buttons
|
||||
|
@ -149,6 +151,7 @@ void PrintOptions::on_importButton_clicked()
|
|||
QFileInfo fileInfo(filename);
|
||||
QFile::copy(filename, pathUser + QDir::separator() + fileInfo.fileName());
|
||||
printOptions->p_template = fileInfo.fileName();
|
||||
lastImportExportTemplate = fileInfo.fileName();
|
||||
find_all_templates();
|
||||
setup();
|
||||
}
|
||||
|
@ -166,6 +169,8 @@ void PrintOptions::on_exportButton_clicked()
|
|||
f.setPermissions(QFileDevice::ReadUser | QFileDevice::ReadOwner | QFileDevice::WriteUser | QFileDevice::WriteOwner);
|
||||
else
|
||||
f.close();
|
||||
QFileInfo fileInfo(filename);
|
||||
lastImportExportTemplate = fileInfo.fileName();
|
||||
find_all_templates();
|
||||
setup();
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ private:
|
|||
struct print_options *printOptions;
|
||||
struct template_options *templateOptions;
|
||||
bool hasSetupSlots;
|
||||
QString lastImportExportTemplate;
|
||||
void setupTemplates();
|
||||
|
||||
private
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue