#include <iostream>
#include "contactmodifyer.h"
+#include "searchresult.h"
/* BRÖÖL
* Constructs a MainWindow which is a child of 'parent', with the
QString adr = t.readLine();
QString pn = t.readLine();
if (fname == "" && lname == "" && lname == "" && pn == "")
- continue;
+ continue;
(void) new CContact(fname, lname, adr, pn);
}
updateView();
*/
void MainWindow::slotSearch()
{
- qWarning( "MainWindow::slotSearch() not yet implemented!" );
+ if (SearchLine->text().isNull())
+ return;
+
+ SearchResult search(SearchLine->text(), SearchCombo->currentItem() + 1);
+ search.show();
+ updateView();
}
void MainWindow::slotModify(QListViewItem* lvi)
if(modify.exec() == QDialog::Accepted)
updateView();
}
+
+void MainWindow::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)
+ updateView();
+}
/*
* This funtion puts all contacts in the listview
*/