MCPcopy Create free account
hub / github.com/IJHack/QtPass / executeDropAction

Method executeDropAction

src/storemodel.cpp:343–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341}
342
343auto StoreModel::executeDropAction(const dragAndDropInfoPasswordStore &info,
344 Qt::DropAction action,
345 const QModelIndex &parent) -> bool {
346 QModelIndex destIndex =
347 this->index(parent.row(), parent.column(), parent.parent());
348 QFileInfo destFileinfo = fs->fileInfo(mapToSource(destIndex));
349 QFileInfo srcFileInfo = QFileInfo(info.path);
350
351 QString cleanedSrc = QDir::cleanPath(srcFileInfo.absoluteFilePath());
352 QString cleanedDest = QDir::cleanPath(destFileinfo.absoluteFilePath());
353
354 switch (info.kind) {
355 case dragAndDropInfoPasswordStore::ItemKind::Directory:
356 return handleDirDrop(cleanedSrc, destFileinfo, srcFileInfo, action);
357 case dragAndDropInfoPasswordStore::ItemKind::File:
358 return handleFileDrop(cleanedSrc, cleanedDest, destFileinfo, action);
359 default:
360 qWarning() << "executeDropAction: unexpected ItemKind, ignoring drop";
361 return false;
362 }
363}
364
365auto StoreModel::handleDirDrop(const QString &cleanedSrc,
366 const QFileInfo &destFileinfo,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected