2 * This file is part of NeverNote
\r
3 * Copyright 2009 Randy Baumgarte
\r
5 * This file may be licensed under the terms of of the
\r
6 * GNU General Public License Version 2 (the ``GPL'').
\r
8 * Software distributed under the License is distributed
\r
9 * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
\r
10 * express or implied. See the GPL for the specific language
\r
11 * governing rights and limitations.
\r
13 * You should have received a copy of the GPL along with this
\r
14 * program. If not, go to http://www.gnu.org/licenses/gpl.html
\r
15 * or write to the Free Software Foundation, Inc.,
\r
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
20 package cx.fbn.nevernote.dialog;
\r
22 //**********************************************
\r
23 //**********************************************
\r
24 //* Combine two tags
\r
25 //**********************************************
\r
26 //**********************************************
\r
28 import java.util.List;
\r
30 import com.evernote.edam.type.Tag;
\r
31 import com.trolltech.qt.gui.QComboBox;
\r
32 import com.trolltech.qt.gui.QDialog;
\r
33 import com.trolltech.qt.gui.QHBoxLayout;
\r
34 import com.trolltech.qt.gui.QIcon;
\r
35 import com.trolltech.qt.gui.QLabel;
\r
36 import com.trolltech.qt.gui.QPushButton;
\r
37 import com.trolltech.qt.gui.QSpacerItem;
\r
38 import com.trolltech.qt.gui.QVBoxLayout;
\r
40 public class TagMerge extends QDialog {
\r
41 private final QComboBox newTag;
\r
42 private final QPushButton okButton;
\r
43 private final QPushButton cancelButton;
\r
44 private boolean okClicked;
\r
45 private final String iconPath = new String("classpath:cx/fbn/nevernote/icons/");
\r
47 public TagMerge(List<Tag> tags) {
\r
48 setWindowIcon(new QIcon(iconPath+"tag.png"));
\r
51 okButton = new QPushButton();
\r
52 okButton.setText(tr("OK"));
\r
53 okButton.pressed.connect(this, "onClicked()");
\r
55 cancelButton = new QPushButton();
\r
56 cancelButton.setText(tr("Cancel"));
\r
57 cancelButton.pressed.connect(this, "onCancel()");
\r
60 QVBoxLayout middleLayout = new QVBoxLayout();
\r
61 middleLayout.addSpacerItem(new QSpacerItem(1,1));
\r
62 middleLayout.addSpacerItem(new QSpacerItem(1,1));
\r
64 QVBoxLayout closeLayout = new QVBoxLayout();
\r
65 closeLayout.addWidget(new QLabel(tr("Merge Into")));
\r
66 newTag = new QComboBox();
\r
67 closeLayout.addWidget(newTag);
\r
69 QHBoxLayout buttonLayout = new QHBoxLayout();
\r
70 buttonLayout.addStretch(1);
\r
71 buttonLayout.addWidget(okButton);
\r
72 buttonLayout.addWidget(cancelButton);
\r
73 setWindowTitle(tr("Open/Close Notebooks"));
\r
75 QHBoxLayout upperLayout = new QHBoxLayout();
\r
76 upperLayout.addLayout(middleLayout);
\r
77 upperLayout.addLayout(closeLayout);
\r
79 QVBoxLayout mainLayout = new QVBoxLayout();
\r
80 mainLayout.addLayout(upperLayout);
\r
81 //mainLayout.addStretch(1);
\r
82 mainLayout.addSpacing(1);
\r
83 mainLayout.addLayout(buttonLayout);
\r
84 setLayout(mainLayout);
\r
86 for (int i=0; i<tags.size(); i++) {
\r
87 newTag.addItem(tags.get(i).getName(), tags.get(i).getGuid());
\r
89 setWindowTitle(tr("Merge Tags"));
\r
92 @SuppressWarnings("unused")
\r
93 private void onClicked() {
\r
98 @SuppressWarnings("unused")
\r
99 private void onCancel() {
\r
104 public boolean okClicked() {
\r
108 public String getNewTagGuid() {
\r
109 int position = newTag.currentIndex();
\r
110 return newTag.itemData(position).toString();
\r