mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-20 01:12:15 -07:00
support multi upload
This commit is contained in:
parent
bfd0b5fe79
commit
b9c8365009
2 changed files with 19 additions and 3 deletions
|
|
@ -164,16 +164,29 @@ void TabDeckStorage::actOpenLocalDeck()
|
||||||
|
|
||||||
void TabDeckStorage::actUpload()
|
void TabDeckStorage::actUpload()
|
||||||
{
|
{
|
||||||
QModelIndex curLeft = localDirView->selectionModel()->currentIndex();
|
QModelIndexList curLefts = localDirView->selectionModel()->selectedRows();
|
||||||
if (localDirModel->isDir(curLeft))
|
if (curLefts.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QString targetPath = getTargetPath();
|
QString targetPath = getTargetPath();
|
||||||
if (targetPath.length() > MAX_NAME_LENGTH) {
|
if (targetPath.length() > MAX_NAME_LENGTH) {
|
||||||
qCritical() << "target path to upload to is too long" << targetPath;
|
qCritical() << "target path to upload to is too long" << targetPath;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString filePath = localDirModel->filePath(curLeft);
|
for (const auto &curLeft : curLefts) {
|
||||||
|
if (localDirModel->isDir(curLeft)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString filePath = localDirModel->filePath(curLeft);
|
||||||
|
uploadDeck(filePath, targetPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabDeckStorage::uploadDeck(const QString &filePath, const QString &targetPath)
|
||||||
|
{
|
||||||
QFile deckFile(filePath);
|
QFile deckFile(filePath);
|
||||||
QFileInfo deckFileInfo(deckFile);
|
QFileInfo deckFileInfo(deckFile);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,9 @@ private:
|
||||||
|
|
||||||
QAction *aOpenLocalDeck, *aUpload, *aDeleteLocalDeck, *aOpenRemoteDeck, *aDownload, *aNewFolder, *aDeleteRemoteDeck;
|
QAction *aOpenLocalDeck, *aUpload, *aDeleteLocalDeck, *aOpenRemoteDeck, *aDownload, *aNewFolder, *aDeleteRemoteDeck;
|
||||||
QString getTargetPath() const;
|
QString getTargetPath() const;
|
||||||
|
|
||||||
|
void uploadDeck(const QString &filePath, const QString &targetPath);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void actOpenLocalDeck();
|
void actOpenLocalDeck();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue