String url;
mime.setText(currentNoteGuid);
List<QUrl> urls = new ArrayList<QUrl>();
// Start building the URL
User user = Global.getUserInformation();
// Check that we have everything we need
if ((user.getShardId().equals("") || user.getId() == 0) && !Global.bypassSynchronizationWarning()) {
SynchronizationRequiredWarning warning = new SynchronizationRequiredWarning(this);
warning.exec();
if (!warning.neverSynchronize())
return;
else {
Global.setBypassSynchronizationWarning(true);
user.setShardId("s0");
user.setId(0);
}
}
// Start building a list of URLs based upon the selected notes
noteTableView.showColumn(Global.noteTableGuidPosition);
List<QModelIndex> selections = noteTableView.selectionModel().selectedRows();
if (!Global.isColumnVisible("guid"))
noteTableView.hideColumn(Global.noteTableGuidPosition);
// Check that the note is either synchronized, or in a local notebook
for (int i=0; i<selections.size(); i++) {
QModelIndex index;
int row = selections.get(i).row();
index = noteTableView.proxyModel.index(row, Global.noteTableGuidPosition);
SortedMap<Integer, Object> ix = noteTableView.proxyModel.itemData(index);
String selectedGuid = (String)ix.values().toArray()[0];
Note n = conn.getNoteTable().getNote(selectedGuid, false, false, false, false, false);
if (n.getUpdateSequenceNum() == 0 && !conn.getNotebookTable().isNotebookLocal(n.getNotebookGuid())) {
QMessageBox.critical(this, tr("Please Synchronize") ,tr("Please either synchronize or move any " +
"new notes to a local notebook."));
return;
}
}
// Start building the URLs
for (int i=0; i<selections.size(); i++) {
QModelIndex index;
int row = selections.get(i).row();
index = noteTableView.proxyModel.index(row, Global.noteTableGuidPosition);
SortedMap<Integer, Object> ix = noteTableView.proxyModel.itemData(index);
String selectedGuid = (String)ix.values().toArray()[0];
mime.setText(selectedGuid);
String lid;
String gid;
Note selectedNote = conn.getNoteTable().getNote(selectedGuid, false, false, false, false, false);
if (selectedNote.getUpdateSequenceNum() > 0) {
gid = selectedGuid;
lid = selectedGuid;
} else {
gid = "00000000-0000-0000-0000-000000000000";
lid = selectedGuid;
}
url = new String("evernote://///view/") + new String(user.getId() + "/" +user.getShardId() +"/"
+gid+"/"+lid +"/");
urls.add(new QUrl(url));
}
mime.setUrls(urls);
clipboard.setMimeData(mime);