--- /dev/null
+#include "searchresult.h"
+#include <stdio.h>
+
+#include <qlistview.h>
+
+//local includes
+#include "contact.h"
+#include "contactmodifyer.h"
+
+/*
+ * Constructs a SearchResult which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+SearchResult::SearchResult(QString searchword, int cat, QWidget* parent, const char* name, bool modal, WFlags fl )
+ : SearchResultBase( parent, name, modal, fl )
+{
+ m_searchword = searchword;
+ m_cat = cat;
+ Find();
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+SearchResult::~SearchResult()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * public slot
+ */
+void SearchResult::slotDel()
+{
+ QListViewItem* lvi = ContactView->selectedItem();
+
+ if (lvi == '\0')
+ {
+ return;
+ }
+
+ int num = lvi->text(0).toInt();
+
+ if (num < 1 || num > CContact::getNum())
+ return;
+
+ CContact* contact = CContact::getFirst();
+
+ for (int i = 1; i < num; i++, contact = contact->getNext())
+ {
+ if (contact->getNext() == '\0')
+ {
+ return;
+ }
+ }
+
+ delete contact;
+ Find();
+}
+/*
+ * public slot
+ */
+void SearchResult::slotModify()
+{
+ QListViewItem* lvi = ContactView->selectedItem();
+
+ if (lvi == '\0')
+ {
+ return;
+ }
+
+ int num = lvi->text(0).toInt();
+
+ if (num < 1 || num > CContact::getNum())
+ return;
+
+ CContact* contact = CContact::getFirst();
+
+ for (int i = 1; i < num; i++, contact = contact->getNext())
+ {
+ if (contact->getNext() == '\0')
+ {
+ return;
+ }
+ }
+ ContactModifier modify(contact);
+ if(modify.exec() == QDialog::Accepted)
+ Find();
+}
+
+//Protected functions
+void SearchResult::Find()
+{
+ ContactView->clear();
+ CContact* contact = CContact::getFirst();
+
+ int i = 1;
+ char s[100];
+
+ while (contact != '\0')
+ {
+ if (contact->search(m_cat, m_searchword))
+ {
+ sprintf(s,"%i",i);//.arg(i);
+ (void) new QListViewItem(ContactView, s, contact->lastname(), contact->firstname(), contact->adress(), contact->phoneNumber());
+ }
+ contact = contact->getNext();
+ i++;
+ }
+}