open decks on double-click in deck storage tab (#5322)

This commit is contained in:
RickyRister 2024-12-24 21:33:48 -08:00 committed by GitHub
parent 4ca1fc083d
commit 2b9d7538bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View file

@ -45,6 +45,8 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_c
localDirView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
localDirView->header()->setSortIndicator(0, Qt::AscendingOrder);
connect(localDirView, &QTreeView::doubleClicked, this, &TabDeckStorage::actLocalDoubleClick);
leftToolBar = new QToolBar;
leftToolBar->setOrientation(Qt::Horizontal);
leftToolBar->setIconSize(QSize(32, 32));
@ -69,6 +71,8 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_c
serverDirView = new RemoteDeckList_TreeWidget(client);
connect(serverDirView, &QTreeView::doubleClicked, this, &TabDeckStorage::actRemoteDoubleClick);
QVBoxLayout *rightVbox = new QVBoxLayout;
rightVbox->addWidget(serverDirView);
rightVbox->addLayout(rightToolBarLayout);
@ -154,6 +158,13 @@ QString TabDeckStorage::getTargetPath() const
}
}
void TabDeckStorage::actLocalDoubleClick(const QModelIndex &curLeft)
{
if (!localDirModel->isDir(curLeft)) {
actOpenLocalDeck();
}
}
void TabDeckStorage::actOpenLocalDeck()
{
QModelIndexList curLefts = localDirView->selectionModel()->selectedRows();
@ -289,6 +300,13 @@ void TabDeckStorage::actDeleteLocalDeck()
}
}
void TabDeckStorage::actRemoteDoubleClick(const QModelIndex &curRight)
{
if (dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(serverDirView->getNode(curRight))) {
actOpenRemoteDeck();
}
}
void TabDeckStorage::actOpenRemoteDeck()
{
for (const auto &curRight : serverDirView->getCurrentSelection()) {

View file

@ -34,6 +34,7 @@ private:
void deleteRemoteDeck(const RemoteDeckList_TreeModel::Node *node);
private slots:
void actLocalDoubleClick(const QModelIndex &curLeft);
void actOpenLocalDeck();
void actUpload();
@ -42,6 +43,7 @@ private slots:
void actNewLocalFolder();
void actDeleteLocalDeck();
void actRemoteDoubleClick(const QModelIndex &curRight);
void actOpenRemoteDeck();
void openRemoteDeckFinished(const Response &r, const CommandContainer &commandContainer);