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 <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Gehad elrobey 2015-07-27 13:12:59 +02:00 committed by Lubomir I. Ivanov
parent ed5afc510e
commit f8378927b5

View file

@ -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<QString>::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<QString>::iterator i = grantlee_templates.begin(); i != grantlee_templates.end(); ++i) {