From 4afecc26047eac097df5debb682e8fe2eb21f26d Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sat, 2 Dec 2000 16:13:18 +0000 Subject: [PATCH] Just added a modify button and a slot (slotModify) that it is connected to. --- mainwindow.cpp | 28 ++++++++++++++++++++++++++++ mainwindow.h | 1 + 2 files changed, 29 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index 094e54f..f072838 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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 */ diff --git a/mainwindow.h b/mainwindow.h index 2a65fe3..ad0638d 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -23,6 +23,7 @@ public slots: void slotLoad(); void slotSearch(); void slotModify(QListViewItem* lvi); + void slotModify(); protected: void updateView(); -- 2.39.2