diff options
| author | Mike Skec <skec@protonmail.ch> | 2021-01-07 16:17:58 +1100 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2021-01-07 10:05:00 +0100 |
| commit | 19046566a62f9e616a23584ebbe045ddbc132023 (patch) | |
| tree | 903ed2a82eddd1c318574725b498fc1938f6c472 /src/mainwindow.cpp | |
| parent | 772cad15cef23559986869733f541b5f3ea4d130 (diff) | |
| download | kristall-19046566a62f9e616a23584ebbe045ddbc132023.tar.gz | |
favourite popup: adding group combobox!
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f46ed75..d93cac8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -189,6 +189,21 @@ void MainWindow::setUiDensity(UIDensity density, bool previewing) } } +QString MainWindow::newGroupDialog() +{ + QInputDialog dialog { this }; + + dialog.setInputMode(QInputDialog::TextInput); + dialog.setLabelText(tr("Enter name of the new group:")); + + if(dialog.exec() != QDialog::Accepted) + return QString { }; + + kristall::favourites.addGroup(dialog.textValue()); + + return dialog.textValue(); +} + void MainWindow::mousePressEvent(QMouseEvent *event) { QMainWindow::mousePressEvent(event); @@ -565,15 +580,7 @@ void MainWindow::on_favourites_view_customContextMenuRequested(const QPoint pos) QMenu menu; connect(menu.addAction("Create new group..."), &QAction::triggered, [this]() { - QInputDialog dialog { this }; - - dialog.setInputMode(QInputDialog::TextInput); - dialog.setLabelText(tr("Enter name of the new group:")); - - if(dialog.exec() != QDialog::Accepted) - return; - - kristall::favourites.addGroup(dialog.textValue()); + this->newGroupDialog(); }); menu.exec(this->ui->favourites_view->mapToGlobal(pos)); |
