We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
首先 WizQTClient 的实现方式可以参考一下:
void WizCategoryView::updatePersonalFolderLocation(WizDatabase& db, \ const QString& strOldLocation, const QString& strNewLocation) { WizCategoryViewAllFoldersItem* pItem = dynamic_cast<WizCategoryViewAllFoldersItem* >(findAllFolderItem()); if (!pItem) return; // the last item of folder root should be trash WizCategoryViewTrashItem* trashItem = findTrash(db.kbGUID()); if (trashItem && pItem->indexOfChild(trashItem) != pItem->childCount() - 1) { pItem->takeChild(pItem->indexOfChild(trashItem)); pItem->insertChild(pItem->childCount(), trashItem); } if (strOldLocation != strNewLocation) { db.updateLocation(strOldLocation, strNewLocation); CWizStdStringArray childLocations; db.getAllChildLocations(strNewLocation, childLocations); for (CString childLocation : childLocations) { findFolder(childLocation, true, true); } } // 文件夹移动后触发folder loacation changed,需要更新顺序 QString str = getAllFoldersPosition(); db.setFoldersPos(str, -1); db.setFoldersPosModified(); emit categoryItemPositionChanged(db.kbGUID()); } QString WizCategoryView::getAllFoldersPosition(WizCategoryViewFolderItem* pItem, int& nStartPos) { if (!pItem) return QString(); QString str ="\"" + pItem->location() + "\": " + QString::number(nStartPos); nStartPos ++; for (int i = 0; i < pItem->childCount(); i++) { WizCategoryViewFolderItem* childItem = dynamic_cast<WizCategoryViewFolderItem* >(pItem->child(i)); Q_ASSERT(childItem); str += ", \n"; str += getAllFoldersPosition(childItem, nStartPos); } return str; } void WizDatabase::setFoldersPos(const QString& foldersPos, qint64 nVersion) { setLocalValueVersion("folders_pos", nVersion); setMeta("SYNC_INFO", "FOLDERS_POS", foldersPos); bool bPositionChanged = false; CString str(foldersPos); str.trim(); str.trim('{'); str.trim('}'); str.replace("\n", ""); str.replace("\r", ""); if (str.isEmpty()) return; CWizStdStringArray arrPos; ::WizSplitTextToArray(str, ',', arrPos); QSettings* setting = WizGlobal::settings(); setting->beginGroup("FolderPosition"); setting->remove(""); setting->endGroup(); CWizStdStringArray::const_iterator it; for (it= arrPos.begin(); it != arrPos.end(); it++) { CString strLine = *it; CString strLocation; CString strPos; if (!::WizStringSimpleSplit(strLine, ':', strLocation, strPos)) continue; strLocation.trim(); strLocation.trim('\"'); int nPos = wiz_ttoi(strPos); if (0 == nPos) continue; int nPosOld = setting->value("FolderPosition/" + strLocation).toInt(); if (nPosOld != nPos) { setting->setValue("FolderPosition/" + strLocation, nPos); bPositionChanged = true; } } setting->sync(); if (bPositionChanged) { Q_EMIT folderPositionChanged(); } } void WizDatabase::setFoldersPosModified() { setLocalValueVersion("folders_pos", -1); setLocalValueVersion("folders", -1); } void WizDatabase::setLocalValueVersion(const QString& strKey, qint64 nServerVersion) { setMetaInt64(WIZ_META_SYNCINFO_SECTION, "KEY_" + strKey + "_VERSION", nServerVersion); }
然后 API 文档中写了:
# 文件夹排序 put /ks/category/sort/:kbGuid body: { '/My Notes/': 0, '/New Folder/': 1, }
The text was updated successfully, but these errors were encountered:
👌
Sorry, something went wrong.
64de804
No branches or pull requests
首先 WizQTClient 的实现方式可以参考一下:
然后 API 文档中写了:
The text was updated successfully, but these errors were encountered: