1 #include "searchresult.h"
8 #include "contactmodifyer.h"
11 * Constructs a SearchResult which is a child of 'parent', with the
12 * name 'name' and widget flags set to 'f'
14 * The dialog will by default be modeless, unless you set 'modal' to
15 * TRUE to construct a modal dialog.
17 SearchResult::SearchResult(QString searchword, int cat, QWidget* parent, const char* name, bool modal, WFlags fl )
18 : SearchResultBase( parent, name, modal, fl )
20 m_searchword = searchword;
26 * Destroys the object and frees any allocated resources
28 SearchResult::~SearchResult()
30 // no need to delete child widgets, Qt does it all for us
36 void SearchResult::slotDel()
38 QListViewItem* lvi = ContactView->selectedItem();
45 int num = lvi->text(0).toInt();
47 if (num < 1 || num > CContact::getNum())
50 CContact* contact = CContact::getFirst();
52 for (int i = 1; i < num; i++, contact = contact->getNext())
54 if (contact->getNext() == '\0')
66 void SearchResult::slotModify()
68 QListViewItem* lvi = ContactView->selectedItem();
75 int num = lvi->text(0).toInt();
77 if (num < 1 || num > CContact::getNum())
80 CContact* contact = CContact::getFirst();
82 for (int i = 1; i < num; i++, contact = contact->getNext())
84 if (contact->getNext() == '\0')
89 ContactModifier modify(contact);
90 if(modify.exec() == QDialog::Accepted)
95 void SearchResult::Find()
98 CContact* contact = CContact::getFirst();
103 while (contact != '\0')
105 if (contact->search(m_cat, m_searchword))
107 sprintf(s,"%i",i);//.arg(i);
108 (void) new QListViewItem(ContactView, s, contact->lastname(), contact->firstname(), contact->adress(), contact->phoneNumber());
110 contact = contact->getNext();