@@ -82,8 +82,8 @@ bool Note::isShared() const { return this->_shareId > 0; }
82
82
83
83
QString Note::getFileName () const { return this ->_fileName ; }
84
84
85
- NoteSubFolder Note::getNoteSubFolder () const {
86
- return NoteSubFolder::fetch (this ->_noteSubFolderId );
85
+ NoteSubFolder Note::getNoteSubFolder (const QString &connectionName ) const {
86
+ return NoteSubFolder::fetch (this ->_noteSubFolderId , connectionName );
87
87
}
88
88
89
89
int Note::getNoteSubFolderId () const { return this ->_noteSubFolderId ; }
@@ -1760,12 +1760,12 @@ QString Note::getFullFilePathForFile(const QString &fileName) {
1760
1760
return canonicalFilePath;
1761
1761
}
1762
1762
1763
- QString Note::getFilePathRelativeToNote (const Note ¬e) const {
1764
- const QDir dir (fullNoteFilePath ());
1763
+ QString Note::getFilePathRelativeToNote (const Note ¬e, const QString &connectionName ) const {
1764
+ const QDir dir (fullNoteFilePath (connectionName ));
1765
1765
1766
1766
// for some reason there is a leading "../" too much
1767
1767
static const QRegularExpression re (QStringLiteral (R"( ^\.\.\/)" ));
1768
- QString path = dir.relativeFilePath (note.fullNoteFilePath ()).remove (re);
1768
+ QString path = dir.relativeFilePath (note.fullNoteFilePath (connectionName )).remove (re);
1769
1769
1770
1770
// if "note" is the current note we want to use the real filename
1771
1771
if (path == QChar (' .' )) {
@@ -1831,7 +1831,9 @@ QString Note::urlDecodeNoteUrl(QString url) {
1831
1831
/* *
1832
1832
* Returns the full path of the note file
1833
1833
*/
1834
- QString Note::fullNoteFilePath () const { return getFullFilePathForFile (relativeNoteFilePath ()); }
1834
+ QString Note::fullNoteFilePath (const QString &connectionName) const {
1835
+ return getFullFilePathForFile (relativeNoteFilePath (QString (), connectionName));
1836
+ }
1835
1837
1836
1838
/* *
1837
1839
* Returns the full path of directory of the note file
@@ -1845,17 +1847,17 @@ QString Note::fullNoteFileDirPath() const {
1845
1847
/* *
1846
1848
* Returns the relative path of the note file
1847
1849
*/
1848
- QString Note::relativeNoteFilePath (QString separator) const {
1850
+ QString Note::relativeNoteFilePath (QString separator, const QString &connectionName ) const {
1849
1851
QString fullFileName = _fileName;
1850
1852
1851
1853
if (separator.isEmpty ()) {
1852
1854
separator = Utils::Misc::dirSeparator ();
1853
1855
}
1854
1856
1855
1857
if (_noteSubFolderId > 0 ) {
1856
- const NoteSubFolder noteSubFolder = getNoteSubFolder ();
1858
+ const NoteSubFolder noteSubFolder = getNoteSubFolder (connectionName );
1857
1859
if (noteSubFolder.isFetched ()) {
1858
- fullFileName.prepend (noteSubFolder.relativePath () + separator);
1860
+ fullFileName.prepend (noteSubFolder.relativePath (' / ' , connectionName ) + separator);
1859
1861
}
1860
1862
}
1861
1863
@@ -3216,7 +3218,7 @@ void Note::addTextToLinkedNoteHashIfFound(const Note ¬e, const QString ¬eT
3216
3218
*
3217
3219
* @return Hash of notes and the link hits
3218
3220
*/
3219
- QHash<Note, QSet<LinkHit>> Note::findLinkedNotes (QVector<Note> noteList) {
3221
+ QHash<Note, QSet<LinkHit>> Note::findLinkedNotes (QVector<Note> noteList, const QString &connectionName ) {
3220
3222
const auto noteText = getNoteText ();
3221
3223
_linkedNoteHash.clear ();
3222
3224
@@ -3227,7 +3229,7 @@ QHash<Note, QSet<LinkHit>> Note::findLinkedNotes(QVector<Note> noteList) {
3227
3229
// Check all notes and look if the current note contains a link to those notes
3228
3230
// We don't need to care about legacy links, because they don't know subfolders
3229
3231
for (const Note ¬e : noteList) {
3230
- const QString &relativePathToNote = getFilePathRelativeToNote (note);
3232
+ const QString &relativePathToNote = getFilePathRelativeToNote (note, connectionName );
3231
3233
3232
3234
// We now don't escape slashes in the relative file path, but previously we did,
3233
3235
// so we need to search for both
0 commit comments