MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / copyNoteLink

Method copyNoteLink

gui/ntableview.cpp:897–953  ·  view source on GitHub ↗

Copy a note link into the clipboard

Source from the content-addressed store, hash-verified

895
896// Copy a note link into the clipboard
897void NTableView::copyNoteLink() {
898 QList<qint32> lids;
899 getSelectedLids(lids);
900 if (lids.size() == 0)
901 return;
902
903
904 UserTable userTable(global.db);
905 User user;
906 userTable.getUser(user);
907 bool syncneeded = false;
908 QString userid;
909
910 if (user.id.isSet())
911 userid = QVariant(user.id).toString();
912 else {
913 syncneeded = true;
914 userid = "0000";
915 }
916
917 QString shard;
918 if (user.shardId.isSet())
919 shard =user.shardId;
920 else {
921 syncneeded = true;
922 shard = "s0";
923 }
924
925 Note note;
926 NoteTable ntable(global.db);
927 QString lidUrl = "";
928 for (int i=0; i<lids.size(); i++) {
929 ntable.get(note, lids[i], false, false);
930
931 QString guid = "";
932 if (note.guid.isSet())
933 guid = note.guid;
934 QString localid;
935 if (!note.updateSequenceNum.isSet() || note.updateSequenceNum == 0) {
936 syncneeded = true;
937 localid = QString::number(lids[i]);
938 } else
939 localid = guid;
940
941 lidUrl = lidUrl+"evernote:///view/" + userid +"/" +shard + "/" +guid + "/" +localid +"/" + " ";
942 }
943 if (syncneeded) {
944 QMessageBox msgBox;
945 msgBox.setWindowTitle(tr("Unsynchronized Note"));
946 msgBox.setText(tr("This note has never been synchronized.\nUsing this in a note link can cause problems unless you synchronize it first."));
947 msgBox.setStandardButtons(QMessageBox::Ok);
948 msgBox.setIcon(QMessageBox::Warning);
949 msgBox.setDefaultButton(QMessageBox::Ok);
950 msgBox.exec();
951 }
952 QApplication::clipboard()->setText(lidUrl);
953}
954

Callers

nothing calls this directly

Calls 6

getUserMethod · 0.45
isSetMethod · 0.45
toStringMethod · 0.45
getMethod · 0.45
setTextMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected