OSDN Git Service

Added option to add tag as a child of a selected tag.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / dialog / TagEdit.java
index 7a43821..72c4ff7 100644 (file)
@@ -22,6 +22,7 @@ package cx.fbn.nevernote.dialog;
 import java.util.List;
 
 import com.evernote.edam.type.Tag;
+import com.trolltech.qt.gui.QCheckBox;
 import com.trolltech.qt.gui.QDialog;
 import com.trolltech.qt.gui.QGridLayout;
 import com.trolltech.qt.gui.QIcon;
@@ -33,6 +34,7 @@ public class TagEdit extends QDialog {
        private boolean         okPressed;
        private final QLineEdit tag;
        QPushButton ok;
+       private final QCheckBox useParentTag;
        List<Tag>               currentTags;
        private final String iconPath = new String("classpath:cx/fbn/nevernote/icons/");
        
@@ -48,8 +50,14 @@ public class TagEdit extends QDialog {
                tag = new QLineEdit();
                textGrid.addWidget(new QLabel(tr("Tag Name")), 1,1);
                textGrid.addWidget(tag, 1, 2);
+               
                textGrid.setContentsMargins(10, 10,-10, -10);
                grid.addLayout(textGrid,1,1);
+
+               useParentTag = new QCheckBox();
+               useParentTag.setVisible(false);
+               useParentTag.setChecked(false);
+               grid.addWidget(useParentTag,2,1);
                
                QGridLayout buttonGrid = new QGridLayout();
                ok = new QPushButton(tr("OK"));
@@ -60,7 +68,7 @@ public class TagEdit extends QDialog {
                tag.textChanged.connect(this, "textChanged()");
                buttonGrid.addWidget(ok, 3, 1);
                buttonGrid.addWidget(cancel, 3,2);
-               grid.addLayout(buttonGrid,2,1);
+               grid.addLayout(buttonGrid,3,1);
        }
        
        // The OK button was pressed
@@ -86,6 +94,16 @@ public class TagEdit extends QDialog {
        public void setTag(String name) {
                tag.setText(name);
        }
+
+       // Set the tag name
+       public void setParentTag(String name) {
+               useParentTag.setText(tr("Create as child of \"") +name +"\"");
+               useParentTag.setVisible(true);
+               useParentTag.setChecked(true);
+       }
+       public QCheckBox getParentTag() {
+               return useParentTag;
+       }
        
        // Check if the OK button was pressed
        public boolean okPressed() {