Fix:gui/qml:Added check for name uniquennes on bookmarks page
authorakashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sat, 27 Mar 2010 19:11:18 +0000 (19:11 +0000)
committerakashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sat, 27 Mar 2010 19:11:18 +0000 (19:11 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@3090 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/gui/qml/gui_qml.cpp
navit/navit/gui/qml/skins/navit/PageBookmarks.qml

index 7e03729..b3039f4 100644 (file)
@@ -419,6 +419,7 @@ public slots:
                struct attr attr;
                struct item* item;
                struct map_rect *mr=NULL;
+               QHash<QString,QString> seenMap;
 
                navit_get_attr(this->object->nav, attr_bookmarks, &attr, NULL);
                mr=map_rect_new(bookmarks_get_map(attr.u.bookmarks), NULL);
@@ -456,6 +457,8 @@ public slots:
                        if (!label.startsWith(this->current_path)) continue;
                        label=label.right(label.length()-this->current_path.length());
                        labelList=label.split("/",QString::SkipEmptyParts);
+                       if (seenMap[labelList[0]]==labelList[0]) continue;
+                       seenMap[labelList[0]]=labelList[0];
                        curItem->setData(labelList[0],NGQStandardItemModel::ItemName);
                        curItem->setData(QString(this->current_path).append(labelList[0]).append("/"),NGQStandardItemModel::ItemPath);
                        if (labelList.size()>1) {
@@ -480,6 +483,33 @@ public slots:
                        return "Success";
                }
        }
+       QString Cut(QString description) {
+               struct attr attr;
+               navit_get_attr(this->object->nav, attr_bookmarks, &attr, NULL);
+               if (!bookmarks_cut_bookmark(attr.u.bookmarks, description.toLocal8Bit().constData()) ) {
+                       return "Failed!";
+               } else {
+                       return "Success";
+               }
+       }
+       QString Copy(QString description) {
+               struct attr attr;
+               navit_get_attr(this->object->nav, attr_bookmarks, &attr, NULL);
+               if (!bookmarks_copy_bookmark(attr.u.bookmarks, description.toLocal8Bit().constData()) ) {
+                       return "Failed!";
+               } else {
+                       return "Success";
+               }
+       }
+       QString Paste(QString location) {
+               struct attr attr;
+               navit_get_attr(this->object->nav, attr_bookmarks, &attr, NULL);
+               if (!bookmarks_paste_bookmark(attr.u.bookmarks, location.toLocal8Bit().constData()) ) {
+                       return "Failed!";
+               } else {
+                       return "Success";
+               }
+       }
        QString Delete(QString bookmark) {
                struct attr attr;
                navit_get_attr(this->object->nav, attr_bookmarks, &attr, NULL);
index 7b52d78..1c32897 100644 (file)
@@ -49,8 +49,38 @@ Rectangle {
 
                 }
                 Image {
+                       id: imgCut; source: gui.iconPath+"zoom_out.svg"; anchors.right: imgCopy.left;anchors.rightMargin: 5;
+                       width: 20; height: 20;
+
+                       MouseRegion {
+                               id:delegateMouseCut
+                               anchors.fill: parent
+                               onClicked: { bookmarks.Cut(itemId); bookmarks.getAttrList(""); }
+                       }
+               }
+                Image {
+                       id: imgCopy; source: gui.iconPath+"zoom_in.svg"; anchors.right: imgPaste.left;anchors.rightMargin: 5;
+                       width: 20; height: 20;
+
+                       MouseRegion {
+                               id:delegateMouseCopy
+                               anchors.fill: parent
+                               onClicked: { bookmarks.Copy(itemId); bookmarks.getAttrList(""); }
+                       }
+               }
+               Image {
+                       id: imgPaste; source: gui.iconPath+"mark.svg"; anchors.right: imgDelete.left;anchors.rightMargin: 5;
+                       width: 20; height: 20;
+
+                       MouseRegion {
+                               id:delegateMousePaste
+                               anchors.fill: parent
+                               onClicked: { bookmarks.Paste(bookmarks.currentPath); bookmarks.getAttrList(""); }
+                       }
+               }
+                Image {
                        id: imgDelete; source: gui.iconPath+"gui_inactive.svg"; anchors.right: wrapper.right;anchors.rightMargin: 5;
-                       width: 20; height: 20
+                       width: 20; height: 20;
 
                        MouseRegion {
                                id:delegateMouseDelete