cleanup
[fapman] / searchoptions.cpp
1 #include "searchoptions.h"
2 #include "ui_searchoptions.h"
3
4 SearchOptions::SearchOptions(QWidget *parent) :
5     QDialog(parent),
6     ui(new Ui::SearchOptions)
7 {
8     ui->setupUi(this);
9 }
10
11 SearchOptions::~SearchOptions()
12 {
13     delete ui;
14 }
15
16 void SearchOptions::changeEvent(QEvent *e)
17 {
18     QDialog::changeEvent(e);
19     switch (e->type()) {
20     case QEvent::LanguageChange:
21         ui->retranslateUi(this);
22         break;
23     default:
24         break;
25     }
26 }
27
28 void SearchOptions::setSelections(bool pkgname, bool dispname, bool dshort, bool dlong)
29 {
30         ui->checkBox_pkgname->setChecked(pkgname);
31         ui->checkBox_displayname->setChecked(dispname);
32         ui->checkBox_descshort->setChecked(dshort);
33         ui->checkBox_desclong->setChecked(dlong);
34 }
35
36 bool SearchOptions::searchPkgName()
37 {
38         return ui->checkBox_pkgname->isChecked();
39 }
40
41 bool SearchOptions::searchDisplayName()
42 {
43         if( !ui->checkBox_pkgname->isChecked() &&
44                 !ui->checkBox_descshort->isChecked() &&
45                 !ui->checkBox_desclong->isChecked() )
46         {
47                 return true;
48         }
49
50         return ui->checkBox_displayname->isChecked();
51 }
52
53 bool SearchOptions::searchDescShort()
54 {
55         return ui->checkBox_descshort->isChecked();
56 }
57
58 bool SearchOptions::searchDescLong()
59 {
60         return ui->checkBox_desclong->isChecked();
61 }