X-Git-Url: https://ruin.nu/git/?p=adress.git;a=blobdiff_plain;f=mainwindow.cpp;h=69131c7eb461414b489ba474135557dd62d7eb95;hp=094e54f9156730600c168633283073fa350c3d55;hb=refs%2Fheads%2Forigin;hpb=365dabc89c0592bc776ff088db44a6533a86b923 diff --git a/mainwindow.cpp b/mainwindow.cpp index 094e54f..69131c7 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2,6 +2,7 @@ #include #include "contactmodifyer.h" +#include "searchresult.h" /* BRÖÖL * Constructs a MainWindow which is a child of 'parent', with the @@ -118,7 +119,7 @@ void MainWindow::slotLoad() QString adr = t.readLine(); QString pn = t.readLine(); if (fname == "" && lname == "" && lname == "" && pn == "") - continue; + continue; (void) new CContact(fname, lname, adr, pn); } updateView(); @@ -128,7 +129,12 @@ void MainWindow::slotLoad() */ 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) @@ -156,6 +162,34 @@ 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 */