3 #include "newgroupdialog.h"
4 #include "contactinterface.h"
6 NewGroupDialog::NewGroupDialog(QDialog *parent) :
10 setWindowModality( Qt::ApplicationModal );
11 btngroup_ok_cancel->button(QDialogButtonBox::Ok)->setDisabled(true);
12 groupNmaeEdit->setFocus();
14 connect( btngroup_ok_cancel, SIGNAL( clicked(QAbstractButton*) ), this, SLOT( btn_clicked(QAbstractButton*) ) );
15 connect( groupNmaeEdit, SIGNAL( textEdited(QString) ), this, SLOT( btn_ok_enabled(QString) ) );
18 void NewGroupDialog::btn_clicked(QAbstractButton *button)
20 if( QDialogButtonBox::AcceptRole == btngroup_ok_cancel->buttonRole( button ) )
22 //qDebug() << "new group dialog : new group is" << groupNmaeEdit->text();
24 QString str = groupNmaeEdit->text();
25 ContactInterface::getInstance()->createGroup( str );
26 done( QDialog::Accepted );
27 }else // button cancel
29 done( QDialog::Rejected );
33 void NewGroupDialog::btn_ok_enabled(QString str)
35 if( str.length() > 0 )
37 btngroup_ok_cancel->button(QDialogButtonBox::Ok)->setEnabled(true);
40 btngroup_ok_cancel->button(QDialogButtonBox::Ok)->setDisabled(true);