]> ruin.nu Git - adress.git/blobdiff - mainwindow.cpp
Just added a modify button and a slot (slotModify) that it is connected to.
[adress.git] / mainwindow.cpp
index 094e54f9156730600c168633283073fa350c3d55..f07283884ccbb285d906bbc5b305dd0c7a7f8fcc 100644 (file)
@@ -156,6 +156,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
  */