From f8378927b503c51bfaca456e0f511d0e567fafee Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Mon, 27 Jul 2015 13:12:59 +0200 Subject: Printing: choose first template if selected template is not found If user selected template is not found, we choose the first template as a default choice. Signed-off-by: Gehad elrobey Signed-off-by: Lubomir I. Ivanov --- qt-ui/printoptions.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/printoptions.cpp b/qt-ui/printoptions.cpp index 916d9d696..b143e49d0 100644 --- a/qt-ui/printoptions.cpp +++ b/qt-ui/printoptions.cpp @@ -33,12 +33,13 @@ void PrintOptions::setup() // insert existing templates in the UI and select the current template qSort(grantlee_templates); - int current_index = 0; + int current_index = 0, index = 0; for (QList::iterator i = grantlee_templates.begin(); i != grantlee_templates.end(); ++i) { if ((*i).compare(printOptions->p_template) == 0) { + current_index = index; break; } - current_index++; + index++; } ui.printTemplate->clear(); for (QList::iterator i = grantlee_templates.begin(); i != grantlee_templates.end(); ++i) { -- cgit v1.2.3-70-g09d2