[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/nokia-pim-suite/trunk/contact
From:       Cedric Descamps <ced.descamps () gmail ! com>
Date:       2009-01-23 12:34:50
Message-ID: 1232714090.257738.1787.nullmailer () svn ! kde ! org
[Download RAW message or body]

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 <akonadi/monitor.h>
 #include <akonadi/session.h>
 #include <QPushButton>
+#include <KLocale>
 #include <kdebug.h>
+#include <QMessageBox>
 
 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();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic