SVN commit 915556 by descamps: - Now a name or a given name is required when a new contact is created. M +25 -3 kabcitemeditor.cpp M +5 -0 kabcitemeditor.h --- branches/work/nokia-pim-suite/trunk/contact/kabcitemeditor.cpp #915555:915556 @@ -36,7 +36,9 @@ #include #include #include +#include #include +#include using namespace Akonadi; @@ -292,11 +294,31 @@ void KABCItemEditor::slot_saveContact() { kDebug() <<"Save contact"; - this->saveContact(); - //emit signal_changeWindow(Manager::addContactWindow, Manager::mainWindow); - ((StackedManager *)parent())->open_window(StackedManager::mainWindow); + if(check_isFilledFields()) + { + this->saveContact(); + ((StackedManager *)parent())->open_window(StackedManager::mainWindow); + } + else + { + QMessageBox *errDialog = new QMessageBox(QMessageBox::NoIcon,i18n("Error"), i18n("You have to set a name or a givenName"),QMessageBox::Ok, this); + errDialog->exec(); + } + } +/** +* Check if importants fields are filled +*/ +bool KABCItemEditor::check_isFilledFields() +{ + if(d->gui.mGivenName->text().isEmpty() && d->gui.mFamilyName->text().isEmpty()) + { + return false; + } + return true; +} + void KABCItemEditor::slot_cancelAddContact() { kDebug() <<"Cancel new contact"; --- branches/work/nokia-pim-suite/trunk/contact/kabcitemeditor.h #915555:915556 @@ -48,6 +48,11 @@ explicit KABCItemEditor( Mode mode, QWidget *parent = 0 ); /** + * check if some filled has been filled by the user + */ + bool check_isFilledFields(); + + /** * Destroys the contact editor. */ virtual ~KABCItemEditor();