From b00f462eb861873feb78cae9a72ceb1fa796992a Mon Sep 17 00:00:00 2001 From: Christian Klinger Date: Wed, 27 Apr 2016 17:54:11 +0200 Subject: delete button in the toolbar. --- src/server/mainwindow/mainwindow.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/server/mainwindow/mainwindow.cpp') diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 7d27434..3719d2a 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -110,6 +110,7 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) : connect(ui->action_Lock, SIGNAL(toggled(bool)), this, SLOT(onButtonLock(bool))); connect(ui->action_Help, SIGNAL(triggered()), this, SLOT(onButtonHelp())); connect(ui->actionReload_Room_Configuration, SIGNAL(triggered()), this, SLOT(onButtonReloadRoomConfig())); + connect(ui->action_DeleteClient, SIGNAL(triggered()), this, SLOT(onDeleteClient())); /* Stuff for the button lock */ //Setup a timeout @@ -1320,3 +1321,32 @@ void MainWindow::EnableButtons() foreach (QAction* a, _lockingButtons) a->setEnabled(true); } + + +void MainWindow::onDeleteClient() { + // If no frame is selected, warning. + ConnectionFrame* frame = getSelectedFrame(); + if (frame == NULL) { + QMessageBox::critical(this, tr("Selection"), tr("No client is selected.")); + return; + } + if (frame->client() != NULL) { + QMessageBox::critical(this, tr("Selection"), tr("This client is still connected.")); + return; + } else { + qDebug() << "Now delete the client"; + int ret = QMessageBox::question(this, "Warning", tr("Sure, You want to delete selected client?"), 0, 1, 2); + if (ret == 1) { + frame->hide(); + frame->deleteLater(); + _clientFrames.removeOne(frame); + return; + } else { + frame->move(frame->getPreviousPosition()); + return; + } + } + + + +} -- cgit v1.2.3-55-g7522