-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadvancedfind.cpp
127 lines (107 loc) · 3.69 KB
/
advancedfind.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#include "advancedfind.h"
#include "ui_advancedfind.h"
#include "contact.h"
struct{
Contact::ContactRecord type ;
bool isflag ;
char description[48] ;
} advancedfind_data[] = {
{ Contact::Address, false, "Address" },
{ Contact::Comments, false, "Comments / Notes" },
{ Contact::ID, false, "Contact Manager / Google ID" },
{ Contact::Email, false, "Email Address" },
{ Contact::Names, false, "Names" },
{ Contact::Organisation, false, "Organisation" },
{ Contact::Phone, false, "Phone Number" },
{ Contact::Surname, false, "Surname" },
{ Contact::Voip, false, "Voip Phone" },
{ Contact::ProfileAddress, false, "Google Profile" },
{ Contact::Webaddress, false, "Web Address" },
{ Contact::GroupBusiness, true, "Group: Business" },
{ Contact::GroupClient, true, "Group: Client" },
{ Contact::GroupFamily, true, "Group: Family" },
{ Contact::GroupFriend, true, "Group: Friend" },
{ Contact::GroupOther, true, "Group: Other" },
{ Contact::TextMe, true, "Text Enabled" },
{ Contact::EmailMe, true, "Email Enabled" },
{ Contact::Hidden, true, "Hidden" },
{ Contact::NumberOfRecords, false, "" }} ;
AdvancedFind::AdvancedFind(QWidget *parent) :
QDialog(parent),
ui(new Ui::AdvancedFind)
{
ui->setupUi(this);
ui->comboBox_SearchCategory1->addItem(QString(""), (int)Contact::NumberOfRecords);
ui->comboBox_SearchCategory2->addItem("", (int)Contact::NumberOfRecords);
ui->comboBox_SearchFlag1->addItem("", (int)Contact::NumberOfRecords);
ui->comboBox_SearchFlag2->addItem("", (int)Contact::NumberOfRecords);
for (int i=0; advancedfind_data[i].type != Contact::NumberOfRecords; i++) {
if (advancedfind_data[i].isflag) {
ui->comboBox_SearchFlag1->addItem(advancedfind_data[i].description, advancedfind_data[i].type);
ui->comboBox_SearchFlag2->addItem(advancedfind_data[i].description, advancedfind_data[i].type);
} else {
ui->comboBox_SearchCategory1->addItem(advancedfind_data[i].description, advancedfind_data[i].type);
ui->comboBox_SearchCategory2->addItem(advancedfind_data[i].description, advancedfind_data[i].type);
}
}
}
AdvancedFind::~AdvancedFind()
{
delete ui;
}
Contact::ContactRecord AdvancedFind::categorySearch1()
{
return (Contact::ContactRecord)ui->comboBox_SearchCategory1->currentData().toInt() ;
}
Contact::ContactRecord AdvancedFind::categorySearch2()
{
return (Contact::ContactRecord)ui->comboBox_SearchCategory2->currentData().toInt() ;
}
Contact::ContactRecord AdvancedFind::categoryFlag1()
{
return (Contact::ContactRecord)ui->comboBox_SearchFlag1->currentData().toInt() ;
}
Contact::ContactRecord AdvancedFind::categoryFlag2()
{
return (Contact::ContactRecord)ui->comboBox_SearchFlag2->currentData().toInt() ;
}
QString AdvancedFind::searchText1()
{
return ui->lineEdit_SearchText1->text() ;
}
QString AdvancedFind::searchText2()
{
return ui->lineEdit_SearchText2->text() ;
}
bool AdvancedFind::flagChecked1()
{
return ui->radioButton_Flag1Enabled->isChecked() ;
}
bool AdvancedFind::flagChecked2()
{
return ui->radioButton_Flag2Enabled->isChecked() ;
}
void AdvancedFind::on_buttonBox_accepted()
{
accept() ;
}
void AdvancedFind::on_buttonBox_rejected()
{
reject() ;
}
void AdvancedFind::on_comboBox_SearchCategory1_currentIndexChanged(int index)
{
ui->lineEdit_SearchText1->setEnabled(index!=0) ;
}
void AdvancedFind::on_comboBox_SearchCategory2_currentIndexChanged(int index)
{
ui->lineEdit_SearchText2->setEnabled(index!=0) ;
}
void AdvancedFind::on_comboBox_SearchFlag1_currentIndexChanged(int index)
{
ui->frame_flags1->setEnabled(index!=0);
}
void AdvancedFind::on_comboBox_SearchFlag2_currentIndexChanged(int index)
{
ui->frame_flags2->setEnabled(index!=0);
}