--- /dev/null
+#include <QDebug>
+
+#include "newgroupdialog.h"
+#include "contactinterface.h"
+
+NewGroupDialog::NewGroupDialog(QDialog *parent) :
+ QDialog(parent)
+{
+ setupUi(this);
+ setWindowModality( Qt::ApplicationModal );
+ btngroup_ok_cancel->button(QDialogButtonBox::Ok)->setDisabled(true);
+ groupNmaeEdit->setFocus();
+
+ connect( btngroup_ok_cancel, SIGNAL( clicked(QAbstractButton*) ), this, SLOT( btn_clicked(QAbstractButton*) ) );
+ connect( groupNmaeEdit, SIGNAL( textEdited(QString) ), this, SLOT( btn_ok_enabled(QString) ) );
+}
+
+void NewGroupDialog::btn_clicked(QAbstractButton *button)
+{
+ if( QDialogButtonBox::AcceptRole == btngroup_ok_cancel->buttonRole( button ) )
+ {
+ //qDebug() << "new group dialog : new group is" << groupNmaeEdit->text();
+
+ QString str = groupNmaeEdit->text();
+ ContactInterface::getInstance()->createGroup( str );
+ done( QDialog::Accepted );
+ }else // button cancel
+ {
+ done( QDialog::Rejected );
+ }
+}
+
+void NewGroupDialog::btn_ok_enabled(QString str)
+{
+ if( str.length() > 0 )
+ {
+ btngroup_ok_cancel->button(QDialogButtonBox::Ok)->setEnabled(true);
+ }else
+ {
+ btngroup_ok_cancel->button(QDialogButtonBox::Ok)->setDisabled(true);
+ }
+}