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

Method createTableOfContents

gui/ntableview.cpp:1312–1396  ·  view source on GitHub ↗

Combine multiple notes

Source from the content-addressed store, hash-verified

1310
1311// Combine multiple notes
1312void NTableView::createTableOfContents() {
1313 QList<qint32> lids;
1314 getSelectedLids(lids);
1315 if (lids.size() == 0)
1316 return;
1317 NoteTable nTable(global.db);
1318 Note note;
1319
1320 NoteAttributes na;
1321 NUuid uuid;
1322 note.title = tr("Table of Contents");
1323 note.guid = uuid.create();
1324 note.created = QDateTime::currentMSecsSinceEpoch();
1325 note.updated = QDateTime::currentMSecsSinceEpoch();
1326 note.updateSequenceNum = 0;
1327
1328 // Set the author
1329 if (global.full_username != "")
1330 na.author = global.full_username;
1331 QString content = QString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")+
1332 QString("<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">")+
1333 QString("<en-note style=\"word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;\"><ol>");
1334 QStringList tagGuids;
1335 QStringList tagNames;
1336
1337 UserTable utable(global.db);
1338 User user;
1339 utable.getUser(user);
1340
1341 QString href = "evernote:///view/" + QString::number(user.id) + QString("/") +
1342 user.shardId +QString("/");
1343
1344 bool unsyncedNote = false;
1345 for (int i=0; i<lids.size(); i++) {
1346 Note n;
1347 nTable.get(n,lids[i], false, false);
1348 if (!n.updateSequenceNum.isSet() || n.updateSequenceNum == 0)
1349 unsyncedNote = true;
1350 QString href2 = href+n.guid+"/"+n.guid;
1351 if (i==0) {
1352 note.notebookGuid = n.notebookGuid;
1353 }
1354 if (n.tagGuids.isSet()) {
1355 for (int j=0; j<n.tagGuids->size(); j++) {
1356 if (!tagGuids.contains(n.tagGuids->at(j))) {
1357 tagGuids.append(n.tagGuids->at(j));
1358 tagNames.append(n.tagNames->at(j));
1359 }
1360 }
1361 }
1362 QString tempTitle = n.title;
1363 tempTitle.replace("&", "&amp;");
1364 QString url = QString("<a href=\"")+href2+QString("\" title=\"")+tempTitle+
1365 QString("\">")+tempTitle+QString("</a>");
1366 content = content+"<li>"+url+"</li>";
1367 }
1368 content = content+QString("</ol></en-note>");
1369 note.content = content;

Callers

nothing calls this directly

Calls 13

filterMethod · 0.80
valueMethod · 0.80
indexMethod · 0.80
duplicateMethod · 0.80
unsetSearchStringMethod · 0.80
QStringClass · 0.50
createMethod · 0.45
getUserMethod · 0.45
getMethod · 0.45
isSetMethod · 0.45
execMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected