Index: trunk/tools/FlairGCS/src/DataRemote.cpp
===================================================================
--- trunk/tools/FlairGCS/src/DataRemote.cpp	(revision 62)
+++ trunk/tools/FlairGCS/src/DataRemote.cpp	(revision 67)
@@ -78,4 +78,6 @@
 
 void DataRemote::SendPeriod(int period, bool auto_refresh) {
+  RemoveAllAttributes();
+
   SetAttribute("period", period);
   SetAttribute("enabled", auto_refresh);
Index: trunk/tools/FlairGCS/src/Landmark.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Landmark.cpp	(revision 62)
+++ trunk/tools/FlairGCS/src/Landmark.cpp	(revision 67)
@@ -46,4 +46,12 @@
 }
 
+bool Landmark::IsUptodate(void) {
+  if(text->brush()==QBrush(Qt::white)) {
+    return true;
+  } else {
+    return false;
+  }
+}
+
 void Landmark::setCoordinate(const QGeoCoordinate &coordinate) {
   pixmap->setCoordinate(coordinate);
Index: trunk/tools/FlairGCS/src/Landmark.h
===================================================================
--- trunk/tools/FlairGCS/src/Landmark.h	(revision 62)
+++ trunk/tools/FlairGCS/src/Landmark.h	(revision 67)
@@ -29,4 +29,5 @@
   void RemoveLandmark(void);
   void AddLandmark(QtMobility::QGraphicsGeoMap *geoMap);
+  bool IsUptodate(void);
 
 private:
Index: trunk/tools/FlairGCS/src/Map.cpp
===================================================================
--- trunk/tools/FlairGCS/src/Map.cpp	(revision 62)
+++ trunk/tools/FlairGCS/src/Map.cpp	(revision 67)
@@ -95,6 +95,4 @@
   for (int i = 0; i < points.count(); i++) delete points.at(i);
   delete mapWidget;
-
-  if(geoMap!=0) delete geoMap;
 }
 
Index: trunk/tools/FlairGCS/src/Map.h
===================================================================
--- trunk/tools/FlairGCS/src/Map.h	(revision 62)
+++ trunk/tools/FlairGCS/src/Map.h	(revision 67)
@@ -25,4 +25,6 @@
 class Map : public DataRemote {
   Q_OBJECT
+
+  friend class MapWidget;
 
 public:
Index: trunk/tools/FlairGCS/src/XmlWidget.cpp
===================================================================
--- trunk/tools/FlairGCS/src/XmlWidget.cpp	(revision 62)
+++ trunk/tools/FlairGCS/src/XmlWidget.cpp	(revision 67)
@@ -291,4 +291,15 @@
 }
 
+void XmlWidget::RemoveAllAttributes() {
+  QString name = write_elem.attribute("name");
+
+  QDomNamedNodeMap attributes=write_elem.attributes();
+  while(attributes.count()!=0) {
+    printf("%i %s\n",attributes.count(),attributes.item(0).toAttr().name().toLocal8Bit().constData());
+    write_elem.removeAttribute(attributes.item(0).toAttr().name());
+  }
+  SetAttribute("name", name);
+}
+
 void XmlWidget::RenamedFrom(QString old_name) {
   QString name = write_elem.attribute("name");
Index: trunk/tools/FlairGCS/src/XmlWidget.h
===================================================================
--- trunk/tools/FlairGCS/src/XmlWidget.h	(revision 62)
+++ trunk/tools/FlairGCS/src/XmlWidget.h	(revision 67)
@@ -68,4 +68,5 @@
   void SetAttribute(const QString &name, float value);
   void SetAttribute(const QString &name, double value);
+  void RemoveAllAttributes(); //except name
   void RemoveAttribute(const QString &name);
 };
Index: trunk/tools/FlairGCS/src/mapwidget.cpp
===================================================================
--- trunk/tools/FlairGCS/src/mapwidget.cpp	(revision 62)
+++ trunk/tools/FlairGCS/src/mapwidget.cpp	(revision 67)
@@ -54,4 +54,5 @@
 #include "Landmark.h"
 #include "Map.h"
+#include "ConnectionLayout.h"
 
 using namespace QtMobility;
@@ -66,5 +67,4 @@
   pressed = false;
   landmark_match = NULL;
-  is_uptodate = true;
   this->map = map;
 
@@ -107,4 +107,5 @@
       QList<QAction *> centered_actions;
 
+      //add centered for every point
       QMenu *centered_menu = menu->addMenu("centered");
       for (int i = 0; i < points.count(); i++) {
@@ -122,4 +123,6 @@
 
       b = menu->addAction("place checkpoint");
+
+      //add go to for every landmark
       QMenu *go_to_menu = menu->addMenu("go to");
       for (int i = 0; i < landmarks->count(); i++) {
@@ -134,4 +137,5 @@
       z = map->execmenu(this, menu, event->globalPos());
 
+      //center to the desired point
       for (int i = 0; i < centered_actions.count(); i++) {
         if (z == centered_actions.at(i)) {
@@ -146,4 +150,5 @@
       }
 
+      //add a landmark
       if (z == b) {
         Landmark *landmark = new Landmark(
@@ -151,5 +156,4 @@
             QString("%1").arg(landmarks->count() + 1));
         landmarks->append(landmark);
-        is_uptodate = false;
       }
       for (int i = 0; i < go_to_actions.count(); i++) {
@@ -161,22 +165,45 @@
       }
 
+    //delete landmark
     } else {
       QAction *a, *z;
       a = menu->addAction("delete");
-      z = menu->exec(event->globalPos());
-
-      if (z == a) {
-        int i;
-        for (i = 0; i < landmarks->count(); i++) {
-          if (landmarks->at(i)->contains(
+      //get selected landmark id
+      int landmark_index;
+      for (landmark_index = 0; landmark_index < landmarks->count(); landmark_index++) {
+          if (landmarks->at(landmark_index)->contains(
                   geoMap->screenPositionToCoordinate(event->pos()))) {
-            delete landmarks->at(i);
-            landmarks->removeAt(i);
+            a->setEnabled(landmarks->at(landmark_index)->IsUptodate());
             break;
           }
-        }
-        for (int j = i; j < landmarks->count(); j++) {
+      }
+      z = menu->exec(event->globalPos());
+
+      if (z == a) {
+        //remove from landmarks_old
+        for (int i = 0; i < landmarks_old->count(); i++) {
+          if (landmarks_old->at(i)->contains(
+                  geoMap->screenPositionToCoordinate(event->pos()))) {
+            landmarks_old->removeAt(i);
+            break;
+          }
+        }
+
+        //remove from landmarks
+        delete landmarks->at(landmark_index);
+        landmarks->removeAt(landmark_index);
+
+        //reorder the remaining ones
+        for (int j = landmark_index; j < landmarks->count(); j++) {
           landmarks->at(j)->setText(QString("%1").arg(j + 1));
         }
+
+        //send delete
+        map->RemoveAllAttributes();
+        map->SetAttribute("lat" + QString::number(landmark_index),"delete");
+        map->SetAttribute("long" + QString::number(landmark_index),"delete");
+        map->connectionLayout()->XmlToSend(map->XmlDoc());
+        map->RemoveAttribute("lat" + QString::number(landmark_index));
+        map->RemoveAttribute("long" + QString::number(landmark_index));
       }
     }
@@ -219,5 +246,4 @@
         landmark_match = landmarks->at(i);
         landmark_match->setColor(Qt::red);
-        is_uptodate = false;
       }
       new_cursor = Qt::PointingHandCursor;
@@ -290,5 +316,10 @@
 }
 
-bool MapWidget::IsUptodate(void) { return is_uptodate; }
+bool MapWidget::IsUptodate(void) {
+  for (int i = 0; i < landmarks->count(); i++) {
+    if(!landmarks->at(i)->IsUptodate()) return false;
+  }
+  return true;
+}
 
 void MapWidget::SetUptodate(void) {
@@ -306,6 +337,4 @@
     landmarks_old->at(i)->setVisible(false);
   }
-
-  is_uptodate = true;
 }
 
@@ -323,6 +352,4 @@
     landmarks->at(i)->setColor(Qt::white);
   }
-
-  is_uptodate = true;
 }
 
Index: trunk/tools/FlairGCS/src/mapwidget.h
===================================================================
--- trunk/tools/FlairGCS/src/mapwidget.h	(revision 62)
+++ trunk/tools/FlairGCS/src/mapwidget.h	(revision 67)
@@ -94,5 +94,4 @@
   QPoint dragStartPosition;
   bool pressed;
-  bool is_uptodate;
 
   QGraphicsScene *m_scene;
