Index: branches/mavlink/tools/FlairGCS/src/ListWidget.cpp
===================================================================
--- branches/mavlink/tools/FlairGCS/src/ListWidget.cpp	(revision 54)
+++ branches/mavlink/tools/FlairGCS/src/ListWidget.cpp	(revision 56)
@@ -8,6 +8,9 @@
 #include <QFormLayout>
 #include <QLabel>
+#include <QListWidgetItem>
+#include <QPalette>
 
 #include <iostream>
+#include <sstream>
 
 ListWidget::ListWidget(Layout *parent, int row, int col, QString name)
@@ -16,4 +19,14 @@
   object_layout->addRow(new QLabel(name));
   object_layout->addRow(listwidget);
+
+  list_red_pal.setColor(QPalette::HighlightedText, QColor(255, 0, 0));
+  list_black_pal.setColor(QPalette::HighlightedText, QColor(255, 255, 255));
+
+  current_item_row = -1;
+  is_up_to_date = true;
+
+  connect(listwidget, SIGNAL(currentRowChanged(int)), this,
+          SLOT(SelectedItemChanged(int)));
+
   // to avoid duplicates when adding items 
   SetIsExpandable(true);
@@ -29,14 +42,22 @@
 ListWidget::~ListWidget() { delete listwidget; }
 
+//received from the UAV / FlairCore
 void ListWidget::XmlEvent(QDomElement dom) {
+  is_up_to_date = false;
+  // if (dom.attribute("value") != "") {
+  //   int new_row = dom.attribute("value");
+  //   listwidget->setCurrentRow(new_row);
+  // }
   if (dom.attribute("item") != "") {
     QString item = dom.attribute("item");
-    listwidget->addItem(item);
+    QListWidgetItem* widget_item = new QListWidgetItem(item);
+    widget_item->setForeground(Qt::red);
+    listwidget->addItem(widget_item);
   }
   if (dom.attribute("delete") != "") {
-    QListWidgetItem* current_item = listwidget->currentItem();
-    listwidget->removeItemWidget(current_item);
-    if (current_item) {
-      delete current_item; 
+    int row_to_del = dom.attribute("delete").toInt();
+    QListWidgetItem* item_to_del = listwidget->takeItem(row_to_del);
+    if (item_to_del) {
+      delete item_to_del; 
     }
   }
@@ -44,18 +65,28 @@
 
 void ListWidget::SetUptodate(void) {
-  // ui_to_var();
-  // ui_to_xml();
-  std::cout << "SetUptodate" << std::endl;
-  visible_widget->setPalette(black_pal);
+  ui_to_var();
+  ui_to_xml();
+  listwidget->setPalette(list_black_pal);
+  is_up_to_date = true;
 }
 
-// void ListWidget::ui_to_var(void) { combobox_value = listwidget->currentIndex(); }
+void ListWidget::ui_to_var(void) { current_item_row = listwidget->currentRow(); }
 
-// void ListWidget::ui_to_xml(void) {
-//   SetValue(QString::number(listwidget->currentIndex()));
-// }
+void ListWidget::ui_to_xml(void) {
+  SetValue(QString::number(listwidget->currentRow()));
+  //add the list of items
+  for(int count = 0; count < listwidget->count(); count++) {
+    std::string item;
+    std::ostringstream item_prop;
+    item_prop << "item" << count;
+    SetAttribute(QString::fromStdString(item_prop.str()), listwidget->item(count)->text());
+    listwidget->item(count)->setForeground(Qt::black);
+  }
+}
 
-void ListWidget::Reset(void) { 
-  // listwidget->setCurrentIndex(combobox_value); 
+void ListWidget::Reset(void) {
+  if (current_item_row != -1) {
+    listwidget->setCurrentRow(current_item_row);
+  }
 }
 
@@ -63,14 +94,14 @@
   std::cout << "In LoadEvent" << std::endl;
   // Parse the item list    
-  QStringList items;
-  int count = 0;
-  while (dom.hasAttribute("item" + QString::number(count))) {
-    QString item = dom.attribute("item" + QString::number(count));
-    std::cout << "Item" << count << " : " << item.toStdString() << std::endl;
-    items.append(item);
-    count++;
-  }
+  // QStringList items;
+  // int count = 0;
+  // while (dom.hasAttribute("item" + QString::number(count))) {
+  //   QString item = dom.attribute("item" + QString::number(count));
+  //   std::cout << "Item" << count << " : " << item.toStdString() << std::endl;
+  //   items.append(item);
+  //   count++;
+  // }
 
-  listwidget->addItems(items);
+  // listwidget->addItems(items);
 
   // if (listwidget->isEnabled() == true) {
@@ -79,9 +110,14 @@
 }
 
-// void ListWidget::valuechanged(int value) {
-//   if (value != combobox_value) {
-//     visible_widget->setPalette(red_pal);
-//   } else {
-//     visible_widget->setPalette(black_pal);
-//   }
-// }
+void ListWidget::SelectedItemChanged(int current_row) {
+  if (current_row != current_item_row) {
+    is_up_to_date = false;
+    listwidget->setPalette(list_red_pal);
+  } else {
+    listwidget->setPalette(list_black_pal);
+  }
+}
+
+bool ListWidget::IsUptodate(void) {
+  return is_up_to_date;
+}
Index: branches/mavlink/tools/FlairGCS/src/ListWidget.h
===================================================================
--- branches/mavlink/tools/FlairGCS/src/ListWidget.h	(revision 54)
+++ branches/mavlink/tools/FlairGCS/src/ListWidget.h	(revision 56)
@@ -11,4 +11,6 @@
 class Layout;
 class QStringList;
+class QListWidgetItem;
+class QPalette;
 
 class ListWidget : public FormLayout {
@@ -22,14 +24,19 @@
 private:
   QListWidget* listwidget;
+  int current_item_row;
+  bool is_up_to_date;
+  QPalette list_red_pal;
+  QPalette list_black_pal;
   void XmlEvent(QDomElement dom);
   void SetUptodate(void);
   void Reset(void);
   void LoadEvent(QDomElement dom);
+  bool IsUptodate(void);
 
-  // void ui_to_var(void);
-  // void ui_to_xml(void);
+  void ui_to_var(void);
+  void ui_to_xml(void);
 
 private slots:
-  // void valuechanged(int value);
+  void SelectedItemChanged(int current_row);
 };
 
