+bool dateMoreThan(const Score *s1, const Score *s2)
+{
+ return (*s1) > (*s2);
+}
+// Find score based on club and course name
+Score *MainWindow::findScore(QString & clubName, QString & courseName)
+{
+ QListIterator<Score *> i(scoreList);
+ Score * s;
+
+ while (i.hasNext()) {
+ s = i.next();
+ if ((s->getClubName() == clubName) &&
+ (s->getCourseName() == courseName))
+ return s;
+ }
+ return 0;
+}
+
+// Find club based on name
+Club *MainWindow::findClub(QString &name)
+{
+ QListIterator<Club *> i(clubList);
+ Club *c;
+
+ while (i.hasNext()) {
+ c = i.next();
+ if (c->getName() == name)
+ return c;
+ }
+ return 0;
+}
+
+// Find course based on club & course name
+Course *MainWindow::findCourse(const QString &clubName,
+ const QString &courseName)
+{
+ QListIterator<Club *> i(clubList);
+ Club *c;
+
+ while (i.hasNext()) {
+ c = i.next();
+ if (c->getName() == clubName) {
+ return c->getCourse(courseName);
+ }
+ }
+ return 0;
+}
+
+// Find course based on current selection on the list
+// TODO: make sure this is only called when course list is the model...
+Course *MainWindow::findCourse()
+{
+ QModelIndex index = selectionModel->currentIndex();
+ const QAbstractItemModel *model = selectionModel->model();
+ QString str = model->data(index, Qt::DisplayRole).toString();
+
+ QStringList strList = str.split(",");
+ if (strList.count() != 2) {
+ showNote(tr("Invalid course selection"));
+ return 0;
+ }
+ return findCourse(strList[0], strList[1]);
+}
+