logger.log(logger.HIGH, "Inside NeverNote.addTag");
TagEdit edit = new TagEdit();
edit.setTagList(listManager.getTagIndex());
+
+ List<QTreeWidgetItem> selections = tagTree.selectedItems();
+ QTreeWidgetItem currentSelection = null;
+ if (selections.size() > 0) {
+ currentSelection = selections.get(0);
+ edit.setParentTag(currentSelection.text(0));
+ }
+
edit.exec();
if (!edit.okPressed())
newTag.setUpdateSequenceNum(0);
newTag.setGuid(randint);
newTag.setName(edit.getTag());
+ if (edit.getParentTag().isChecked()) {
+ newTag.setParentGuid(currentSelection.text(2));
+ newTag.setParentGuidIsSet(true);
+ currentSelection.setExpanded(true);
+ }
conn.getTagTable().addTag(newTag, true);
listManager.getTagIndex().add(newTag);
reloadTagTree(true);
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;
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/");
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"));
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
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() {