From f4940a1d97ff818114a1163b5a0b36a881ed6fdc Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sat, 10 Nov 2012 14:41:53 +0100 Subject: [PATCH 2/5] Activating download button, if appropiate. * If a file was selected and a HiMD was opened, activate the download button. * Added a dummy on_clicked function for the download button. --- qhimdtransfer/qhimdmainwindow.cpp | 12 ++++++++++++ qhimdtransfer/qhimdmainwindow.h | 1 + 2 files changed, 13 insertions(+) diff --git a/qhimdtransfer/qhimdmainwindow.cpp b/qhimdtransfer/qhimdmainwindow.cpp index 7fc39f0..e2675d9 100644 --- a/qhimdtransfer/qhimdmainwindow.cpp +++ b/qhimdtransfer/qhimdmainwindow.cpp @@ -497,12 +497,19 @@ void QHiMDMainWindow::handle_himd_selection_change(const QItemSelection&, const void QHiMDMainWindow::handle_local_selection_change(const QItemSelection&, const QItemSelection&) { QModelIndex index = ui->localScan->currentIndex(); + bool download_possible = false; if(localmodel.fileInfo(index).isDir()) { ui->updir->setText(localmodel.filePath(index)); settings.setValue("lastUploadDirectory", localmodel.filePath(index)); } + + if(localmodel.fileInfo(index).isFile()) + download_possible = trackmodel.is_open(); + + ui->action_Download->setEnabled(download_possible); + ui->download_button->setEnabled(download_possible); } void QHiMDMainWindow::himd_found(QString HiMDPath) @@ -561,3 +568,8 @@ void QHiMDMainWindow::on_himd_devices_activated(QString device) { open_himd_at(device); } + +void QHiMDMainWindow::on_download_button_clicked() +{ + /*download_of(localmodel.filePath(ui->localScan->currentIndex()));*/ +} diff --git a/qhimdtransfer/qhimdmainwindow.h b/qhimdtransfer/qhimdmainwindow.h index a83191a..85be8ae 100644 --- a/qhimdtransfer/qhimdmainwindow.h +++ b/qhimdtransfer/qhimdmainwindow.h @@ -67,6 +67,7 @@ private slots: void himd_found(QString path); void himd_removed(QString path); void on_himd_devices_activated(QString device); + void on_download_button_clicked(); signals: void himd_busy(QString path); -- 1.8.0