# HG changeset patch # User Andre Heinecke # Date 1434716876 -7200 # Node ID c3000fa6ca5695b9be39abceb59c3c409eebc562 # Parent b8c7644a9d49eca194b1061b76ec3f4038de463f Add back button to subfolder selection dialog diff -r b8c7644a9d49 -r c3000fa6ca56 src/folderselectdialog.cpp --- a/src/folderselectdialog.cpp Fri Jun 19 14:27:15 2015 +0200 +++ b/src/folderselectdialog.cpp Fri Jun 19 14:27:56 2015 +0200 @@ -108,6 +108,11 @@ mGoButton = new QPushButton(tr("Go")); mGoButton->setEnabled(false); + + QPushButton *backBtn = new QPushButton; + backBtn->setIcon(QApplication::style()->standardIcon(QStyle::SP_ArrowBack)); + backBtn->setToolTip(tr("Back to exam selection.")); + folderChangeArea->addWidget(mGoButton); connect(mGoButton, &QPushButton::clicked, this, &FolderSelectDialog::goClicked); @@ -142,6 +147,16 @@ connect(mOkButton, &QPushButton::clicked, this, &FolderSelectDialog::wantToAccept); bottomButtons->addStretch(-1); + + QPushButton *backBtn = NULL; + if (!mShowPathSelection) { + backBtn = new QPushButton(tr("Back")); + backBtn->setToolTip(tr("Back to exam selection.")); + connect(backBtn, &QPushButton::clicked, this, + &FolderSelectDialog::backClicked); + bottomButtons->addWidget(backBtn); + } + bottomButtons->addWidget(mOkButton); setLayout(base); } @@ -149,6 +164,9 @@ void FolderSelectDialog::selectionChanged (const QItemSelection& selected, const QItemSelection& deselected) { mOkButton->setEnabled(!selected.indexes().isEmpty()); + if (mOkButton->isEnabled()) { + mOkButton->setFocus(); + } } void FolderSelectDialog::pathLineChanged() { diff -r b8c7644a9d49 -r c3000fa6ca56 src/folderselectdialog.h --- a/src/folderselectdialog.h Fri Jun 19 14:27:15 2015 +0200 +++ b/src/folderselectdialog.h Fri Jun 19 14:27:56 2015 +0200 @@ -67,6 +67,9 @@ /** @brief emited before the dialog is closed when a folder is selected */ void folderSelected(const QString& folder); + /** @brief Back button was clicked */ + void backClicked(); + private: QTableView *mView; FilterWidget *mFilterWidget; diff -r b8c7644a9d49 -r c3000fa6ca56 src/mainwindow.cpp --- a/src/mainwindow.cpp Fri Jun 19 14:27:15 2015 +0200 +++ b/src/mainwindow.cpp Fri Jun 19 14:27:56 2015 +0200 @@ -201,6 +201,10 @@ connect(fsDialog, &FolderSelectDialog::folderSelected, this, &MainWindow::setFolder); + connect(fsDialog, &FolderSelectDialog::backClicked, + this, &MainWindow::showWithFolderSelect); + connect(fsDialog, &FolderSelectDialog::backClicked, + fsDialog, &QDialog::close); fsDialog->show(); // connect(fsDialog, &QDialog::closeEvent, fsDialog, &QObject::deleteLater); }