diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-11-23 16:40:05 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-11-24 21:50:16 +0200 |
commit | a2ec791f2fa9db99adbea0cd8820ed9c142f2349 (patch) | |
tree | d7f58f97712b076862185e125259f24a51734159 /desktop-widgets | |
parent | bc6146577d0c3524a02733d79811a6bc9310d839 (diff) | |
download | subsurface-a2ec791f2fa9db99adbea0cd8820ed9c142f2349.tar.gz |
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>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/printoptions.cpp | 7 | ||||
-rw-r--r-- | desktop-widgets/printoptions.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/desktop-widgets/printoptions.cpp b/desktop-widgets/printoptions.cpp index 7ed8ecb46..10d6d9c25 100644 --- a/desktop-widgets/printoptions.cpp +++ b/desktop-widgets/printoptions.cpp @@ -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(); } diff --git a/desktop-widgets/printoptions.h b/desktop-widgets/printoptions.h index 9aaf8de70..1db0dfe61 100644 --- a/desktop-widgets/printoptions.h +++ b/desktop-widgets/printoptions.h @@ -72,6 +72,7 @@ private: struct print_options *printOptions; struct template_options *templateOptions; bool hasSetupSlots; + QString lastImportExportTemplate; void setupTemplates(); private |