From 0d0d0a7c237a2c16c39c458ad1d7f8afa22e0797 Mon Sep 17 00:00:00 2001 From: Si Yong Kim Date: Sat, 6 Feb 2021 11:48:13 -0800 Subject: [PATCH] Add empty name error handling on new category dialog --- src/gui/torrentcategorydialog.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/torrentcategorydialog.cpp b/src/gui/torrentcategorydialog.cpp index d3ce24519..076776d05 100644 --- a/src/gui/torrentcategorydialog.cpp +++ b/src/gui/torrentcategorydialog.cpp @@ -29,6 +29,7 @@ #include "torrentcategorydialog.h" #include +#include #include "base/bittorrent/session.h" #include "ui_torrentcategorydialog.h" @@ -40,6 +41,13 @@ TorrentCategoryDialog::TorrentCategoryDialog(QWidget *parent) m_ui->setupUi(this); m_ui->comboSavePath->setMode(FileSystemPathEdit::Mode::DirectorySave); m_ui->comboSavePath->setDialogCaption(tr("Choose save path")); + + // disable save button + m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); + connect(m_ui->textCategoryName, &QLineEdit::textChanged, this, [this](const QString &text) + { + m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!text.isEmpty()); + }); } TorrentCategoryDialog::~TorrentCategoryDialog()