summaryrefslogblamecommitdiffstats
path: root/src/gui/dialog.cpp
blob: 5f24009c662422eaacd860fbbb04a4e1b8802ad3 (plain) (tree)































                                                                               
                                                                            








































                                                      
/*
# Copyright (c) 2009 - OpenSLX Project, Computer Center University of Freiburg
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your suggestions, praise, or complaints to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
# dialog.cpp
	Dialog to get message to send to client
# -----------------------------------------------------------------------------
*/

#include "dialog.h"
#include "ui_dialog.h"
#include <src/gui/mainWindow.h>

Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    dui(new Ui::MsgDialog)
{
    dui->setupUi(this);

    dui->send->setDisabled(true);

    setWindowTitle(tr("Enter the Text for the client(s)"));

    connect( dui->send, SIGNAL( clicked()), this, SLOT( send()));
    connect( dui->cancel, SIGNAL( clicked()), this, SLOT( NotSend()));
    connect( dui->message, SIGNAL(textChanged()), this, SLOT(textchange()));
}

Dialog::~Dialog()
{
    delete dui;
}

void Dialog::send()
{
	QString mesge = dui->message->toPlainText();
	MainWindow::getWindow()->setMsgDialog(mesge);
	dui->message->clear();
	emit accept();
}

void Dialog::NotSend()
{
	dui->message->clear();
	emit reject();
}

void Dialog::textchange()
{
	QString message = dui->message->toPlainText();
	if(message.length()>0)
		dui->send->setDisabled(false);
	else
		dui->send->setDisabled(true);
}

void Dialog::changeEvent(QEvent *e)
{
    QDialog::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        dui->retranslateUi(this);
        break;
    default:
        break;
    }
}