ekiga r7265 - in trunk: lib/engine/addressbook/evolution lib/engine/addressbook/ldap lib/engine/components/resource-list lib/engine/framework lib/engine/presence/local-roster src/endpoints



Author: jpuydt
Date: Sun Oct 19 08:12:38 2008
New Revision: 7265
URL: http://svn.gnome.org/viewvc/ekiga?rev=7265&view=rev

Log:
Fixed bug #556867 : Ekiga::FormRequestSimple now always calls the callback -- submitted or cancelled

Added:
   trunk/lib/engine/framework/form.cpp
Modified:
   trunk/lib/engine/addressbook/evolution/evolution-book.cpp
   trunk/lib/engine/addressbook/evolution/evolution-book.h
   trunk/lib/engine/addressbook/evolution/evolution-contact.cpp
   trunk/lib/engine/addressbook/evolution/evolution-contact.h
   trunk/lib/engine/addressbook/ldap/ldap-book.cpp
   trunk/lib/engine/addressbook/ldap/ldap-book.h
   trunk/lib/engine/addressbook/ldap/ldap-source.cpp
   trunk/lib/engine/addressbook/ldap/ldap-source.h
   trunk/lib/engine/components/resource-list/rl-cluster.cpp
   trunk/lib/engine/components/resource-list/rl-cluster.h
   trunk/lib/engine/components/resource-list/rl-heap.cpp
   trunk/lib/engine/components/resource-list/rl-heap.h
   trunk/lib/engine/framework/Makefile.am
   trunk/lib/engine/framework/form-request-simple.cpp
   trunk/lib/engine/framework/form-request-simple.h
   trunk/lib/engine/framework/form.h
   trunk/lib/engine/presence/local-roster/local-heap.cpp
   trunk/lib/engine/presence/local-roster/local-heap.h
   trunk/lib/engine/presence/local-roster/local-presentity.cpp
   trunk/lib/engine/presence/local-roster/local-presentity.h
   trunk/src/endpoints/opal-account.cpp
   trunk/src/endpoints/opal-account.h
   trunk/src/endpoints/opal-bank.cpp
   trunk/src/endpoints/opal-bank.h

Modified: trunk/lib/engine/addressbook/evolution/evolution-book.cpp
==============================================================================
--- trunk/lib/engine/addressbook/evolution/evolution-book.cpp	(original)
+++ trunk/lib/engine/addressbook/evolution/evolution-book.cpp	Sun Oct 19 08:12:38 2008
@@ -282,7 +282,8 @@
 void
 Evolution::Book::new_contact_action ()
 {
-  Ekiga::FormRequestSimple request;
+  Ekiga::FormRequestSimple request(sigc::mem_fun (this,
+						  &Evolution::Book::on_new_contact_form_submitted));
 
   request.title (_("New contact"));
 
@@ -295,9 +296,6 @@
   request.text ("cell", _("_Cell phone:"), "");
   request.text ("pager", _("_Pager:"), "");
 
-  request.submitted.connect (sigc::mem_fun (this,
-					    &Evolution::Book::on_new_contact_form_submitted));
-
   if (!questions.handle_request (&request)) {
 
     // FIXME: better error reporting
@@ -325,8 +323,12 @@
 }
 
 void
-Evolution::Book::on_new_contact_form_submitted (Ekiga::Form &result)
+Evolution::Book::on_new_contact_form_submitted (bool submitted,
+						Ekiga::Form &result)
 {
+  if ( !submitted)
+    return;
+
   try {
     EContact *econtact = NULL;
 

Modified: trunk/lib/engine/addressbook/evolution/evolution-book.h
==============================================================================
--- trunk/lib/engine/addressbook/evolution/evolution-book.h	(original)
+++ trunk/lib/engine/addressbook/evolution/evolution-book.h	Sun Oct 19 08:12:38 2008
@@ -93,7 +93,8 @@
     void set_econtact_attribute_value (EContact *contact,
 				       const std::string subtype,
 				       const std::string value) const;
-    void on_new_contact_form_submitted (Ekiga::Form &result);
+    void on_new_contact_form_submitted (bool submitted,
+					Ekiga::Form &result);
 
     Ekiga::ServiceCore &services;
     EBook *book;

Modified: trunk/lib/engine/addressbook/evolution/evolution-contact.cpp
==============================================================================
--- trunk/lib/engine/addressbook/evolution/evolution-contact.cpp	(original)
+++ trunk/lib/engine/addressbook/evolution/evolution-contact.cpp	Sun Oct 19 08:12:38 2008
@@ -320,7 +320,8 @@
 void
 Evolution::Contact::edit_action ()
 {
-  Ekiga::FormRequestSimple request;
+  Ekiga::FormRequestSimple request(sigc::mem_fun (this,
+						  &Evolution::Contact::on_edit_form_submitted));;
 
   request.title (_("Edit contact"));
 
@@ -342,9 +343,6 @@
     request.text ("pager", _("_Pager:"), pager_uri);
   }
 
-  request.submitted.connect (sigc::mem_fun (this,
-					    &Evolution::Contact::on_edit_form_submitted));
-
   if (!questions.handle_request (&request)) {
 
     // FIXME: better error reporting
@@ -356,8 +354,12 @@
 }
 
 void
-Evolution::Contact::on_edit_form_submitted (Ekiga::Form &result)
+Evolution::Contact::on_edit_form_submitted (bool submitted,
+					    Ekiga::Form &result)
 {
+  if (!submitted)
+    return;
+
   try {
 
     std::string name = result.text ("name");
@@ -386,7 +388,8 @@
 void
 Evolution::Contact::remove_action ()
 {
-  Ekiga::FormRequestSimple request;
+  Ekiga::FormRequestSimple request(sigc::mem_fun (this,
+						  &Evolution::Contact::on_remove_form_submitted));;
   gchar* instructions = NULL;
 
   request.title (_("Remove contact"));
@@ -395,9 +398,6 @@
   request.instructions (instructions);
   g_free (instructions);
 
-  request.submitted.connect (sigc::mem_fun (this,
-					    &Evolution::Contact::on_remove_form_submitted));
-
   if (!questions.handle_request (&request)) {
 
     // FIXME: better error reporting
@@ -409,7 +409,9 @@
 }
 
 void
-Evolution::Contact::on_remove_form_submitted (Ekiga::Form& /*result*/)
+Evolution::Contact::on_remove_form_submitted (bool submitted,
+					      Ekiga::Form& /*result*/)
 {
-  remove ();
+  if (submitted)
+    remove ();
 }

Modified: trunk/lib/engine/addressbook/evolution/evolution-contact.h
==============================================================================
--- trunk/lib/engine/addressbook/evolution/evolution-contact.h	(original)
+++ trunk/lib/engine/addressbook/evolution/evolution-contact.h	Sun Oct 19 08:12:38 2008
@@ -104,11 +104,13 @@
 
     void edit_action ();
 
-    void on_edit_form_submitted (Ekiga::Form &result);
+    void on_edit_form_submitted (bool submitted,
+				 Ekiga::Form &result);
 
     void remove_action ();
 
-    void on_remove_form_submitted (Ekiga::Form &result);
+    void on_remove_form_submitted (bool submitted,
+				   Ekiga::Form &result);
   };
 
 /**

Modified: trunk/lib/engine/addressbook/ldap/ldap-book.cpp
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-book.cpp	(original)
+++ trunk/lib/engine/addressbook/ldap/ldap-book.cpp	Sun Oct 19 08:12:38 2008
@@ -464,8 +464,12 @@
 }
 
 void
-OPENLDAP::Book::on_sasl_form_submitted (Ekiga::Form &result)
+OPENLDAP::Book::on_sasl_form_submitted (bool submitted,
+					Ekiga::Form &result)
 {
+  if (!submitted)
+    return;
+
   result.visit (*saslform);
 }
 
@@ -532,7 +536,8 @@
 
   /* If there are missing items, try to get them all in one dialog */
   if (nprompts) {
-    Ekiga::FormRequestSimple request;
+    Ekiga::FormRequestSimple request(sigc::mem_fun (ctx->book,
+						    &OPENLDAP::Book::on_sasl_form_submitted));
     Ekiga::FormBuilder result;
     std::string prompt;
     std::string ctxt = "";
@@ -599,8 +604,6 @@
 
     /* Save a pointer for storing the form result */
     ctx->book->saslform = &result;
-    request.submitted.connect (sigc::mem_fun (ctx->book,
-					    &OPENLDAP::Book::on_sasl_form_submitted));
     if (!ctx->book->questions.handle_request (&request)) {
       return LDAP_LOCAL_ERROR;
     }
@@ -909,8 +912,9 @@
 }
 
 void
-OPENLDAP::BookForm (Ekiga::FormRequestSimple &request, struct BookInfo &info,
-  std::string title)
+OPENLDAP::BookForm (Ekiga::FormRequestSimple &request,
+		    struct BookInfo &info,
+		    std::string title)
 {
   std::string callAttr = "";
 
@@ -969,13 +973,11 @@
 void
 OPENLDAP::Book::edit ()
 {
-  Ekiga::FormRequestSimple request;
+  Ekiga::FormRequestSimple request(sigc::mem_fun (this,
+						  &OPENLDAP::Book::on_edit_form_submitted));
 
   OPENLDAP::BookForm (request, bookinfo, std::string(_("Edit LDAP directory")));
 
-  request.submitted.connect (sigc::mem_fun (this,
-					    &OPENLDAP::Book::on_edit_form_submitted));
-
   if (!questions.handle_request (&request)) {
 
     // FIXME: better error reporting
@@ -987,8 +989,9 @@
 }
 
 int
-OPENLDAP::BookFormInfo (Ekiga::Form &result, struct BookInfo &bookinfo,
-  std::string &errmsg)
+OPENLDAP::BookFormInfo (Ekiga::Form &result,
+			struct BookInfo &bookinfo,
+			std::string &errmsg)
 {
   LDAPURLDesc *url_base = NULL, *url_host = NULL;
   char *url_str;
@@ -1080,17 +1083,20 @@
 }
 
 void
-OPENLDAP::Book::on_edit_form_submitted (Ekiga::Form &result)
+OPENLDAP::Book::on_edit_form_submitted (bool submitted,
+					Ekiga::Form &result)
 {
+  if (!submitted)
+    return;
+
   try {
     std::string errmsg;
     if (OPENLDAP::BookFormInfo (result, bookinfo, errmsg)) {
-      Ekiga::FormRequestSimple request;
+      Ekiga::FormRequestSimple request(sigc::mem_fun (this,
+						      &OPENLDAP::Book::on_edit_form_submitted));
 
       result.visit (request);
       request.error (errmsg);
-      request.submitted.connect (sigc::mem_fun (this,
-					    &OPENLDAP::Book::on_edit_form_submitted));
 
       if (!questions.handle_request (&request)) {
 

Modified: trunk/lib/engine/addressbook/ldap/ldap-book.h
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-book.h	(original)
+++ trunk/lib/engine/addressbook/ldap/ldap-book.h	Sun Oct 19 08:12:38 2008
@@ -113,7 +113,7 @@
     sigc::signal<void> trigger_saving;
 
     /* public for access from C */
-    void on_sasl_form_submitted (Ekiga::Form &);
+    void on_sasl_form_submitted (bool, Ekiga::Form &);
     Ekiga::FormBuilder *saslform;
 
   private:
@@ -127,7 +127,8 @@
     void parse_uri();
 
     void edit ();
-    void on_edit_form_submitted (Ekiga::Form &);
+    void on_edit_form_submitted (bool submitted,
+				 Ekiga::Form &form);
 
     Ekiga::ServiceCore &core;
     xmlNodePtr node;

Modified: trunk/lib/engine/addressbook/ldap/ldap-source.cpp
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-source.cpp	(original)
+++ trunk/lib/engine/addressbook/ldap/ldap-source.cpp	Sun Oct 19 08:12:38 2008
@@ -141,7 +141,8 @@
 void
 OPENLDAP::Source::new_book ()
 {
-  Ekiga::FormRequestSimple request;
+  Ekiga::FormRequestSimple request(sigc::mem_fun (this,
+						  &OPENLDAP::Source::on_new_book_form_submitted));
 
   bookinfo.name = "";
   bookinfo.uri = "ldap://localhost/dc=net?cn,telephoneNumber?sub?(cn=$)",
@@ -155,9 +156,6 @@
   OPENLDAP::BookInfoParse (bookinfo);
   OPENLDAP::BookForm (request, bookinfo, _("Create LDAP directory"));
 
-  request.submitted.connect (sigc::mem_fun (this,
-					    &OPENLDAP::Source::on_new_book_form_submitted));
-
   if (!questions.handle_request (&request)) {
 
     // FIXME: better error reporting
@@ -186,18 +184,21 @@
 }
 
 void
-OPENLDAP::Source::on_new_book_form_submitted (Ekiga::Form &result)
+OPENLDAP::Source::on_new_book_form_submitted (bool submitted,
+					      Ekiga::Form &result)
 {
+  if (!submitted)
+    return;
+
   try {
     std::string errmsg;
 
     if (OPENLDAP::BookFormInfo (result, bookinfo, errmsg)) {
-      Ekiga::FormRequestSimple request;
+      Ekiga::FormRequestSimple request(sigc::mem_fun (this,
+						      &OPENLDAP::Source::on_new_book_form_submitted));
 
       result.visit (request);
       request.error (errmsg);
-      request.submitted.connect (sigc::mem_fun (this,
-					    &OPENLDAP::Source::on_new_book_form_submitted));
 
       if (!questions.handle_request (&request)) {
 

Modified: trunk/lib/engine/addressbook/ldap/ldap-source.h
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-source.h	(original)
+++ trunk/lib/engine/addressbook/ldap/ldap-source.h	Sun Oct 19 08:12:38 2008
@@ -94,7 +94,8 @@
     
     void new_ekiga_net_book ();
 
-    void on_new_book_form_submitted (Ekiga::Form &result);
+    void on_new_book_form_submitted (bool submitted,
+				     Ekiga::Form &result);
   };
 
 /**

Modified: trunk/lib/engine/components/resource-list/rl-cluster.cpp
==============================================================================
--- trunk/lib/engine/components/resource-list/rl-cluster.cpp	(original)
+++ trunk/lib/engine/components/resource-list/rl-cluster.cpp	Sun Oct 19 08:12:38 2008
@@ -158,7 +158,7 @@
 		       const std::string password,
 		       const std::string user)
 {
-  Ekiga::FormRequestSimple request;
+  Ekiga::FormRequestSimple request(sigc::mem_fun (this, &RL::Cluster::on_new_heap_form_submitted));
 
   request.title (_("Add new resource-list"));
   request.instructions (_("Please fill in this form to add a new "
@@ -169,8 +169,6 @@
   request.private_text ("password", _("Password:"), password);
   request.text ("user", _("User:"), user);
 
-  request.submitted.connect (sigc::mem_fun (this, &RL::Cluster::on_new_heap_form_submitted));
-
   if (!questions.handle_request (&request)) {
 
     // FIXME: better error reporting
@@ -182,8 +180,12 @@
 }
 
 void
-RL::Cluster::on_new_heap_form_submitted (Ekiga::Form& result)
+RL::Cluster::on_new_heap_form_submitted (bool submitted,
+					 Ekiga::Form& result)
 {
+  if (!submitted)
+    return;
+
   try {
 
     const std::string name = result.text ("name");

Modified: trunk/lib/engine/components/resource-list/rl-cluster.h
==============================================================================
--- trunk/lib/engine/components/resource-list/rl-cluster.h	(original)
+++ trunk/lib/engine/components/resource-list/rl-cluster.h	Sun Oct 19 08:12:38 2008
@@ -82,7 +82,8 @@
 		   const std::string password,
 		   const std::string user);
 
-    void on_new_heap_form_submitted (Ekiga::Form& result);
+    void on_new_heap_form_submitted (bool submitted,
+				     Ekiga::Form& result);
 
     void on_presence_received (std::string uri,
 			       std::string presence);

Modified: trunk/lib/engine/components/resource-list/rl-heap.cpp
==============================================================================
--- trunk/lib/engine/components/resource-list/rl-heap.cpp	(original)
+++ trunk/lib/engine/components/resource-list/rl-heap.cpp	Sun Oct 19 08:12:38 2008
@@ -368,7 +368,9 @@
 void
 RL::Heap::edit ()
 {
-  Ekiga::FormRequestSimple request;
+  Ekiga::FormRequestSimple request(sigc::mem_fun (this,
+						  &RL::Heap::on_edit_form_submitted));
+
   std::string name_str;
   std::string root_str;
   std::string username_str;
@@ -407,8 +409,6 @@
   request.text ("username", _("Server username"), username_str);
   request.private_text ("password", _("Server password"), password_str);
 
-  request.submitted.connect (sigc::mem_fun (this,
-					    &RL::Heap::on_edit_form_submitted));
   if (!questions.handle_request (&request)) {
 
     // FIXME: better error reporting
@@ -420,8 +420,12 @@
 }
 
 void
-RL::Heap::on_edit_form_submitted (Ekiga::Form& result)
+RL::Heap::on_edit_form_submitted (bool submitted,
+				  Ekiga::Form& result)
 {
+  if (!submitted)
+    return;
+
   try {
 
     std::string name_str = result.text ("name");

Modified: trunk/lib/engine/components/resource-list/rl-heap.h
==============================================================================
--- trunk/lib/engine/components/resource-list/rl-heap.h	(original)
+++ trunk/lib/engine/components/resource-list/rl-heap.h	Sun Oct 19 08:12:38 2008
@@ -115,7 +115,8 @@
     void on_entry_removed (gmref_ptr<Entry> entry);
 
     void edit ();
-    void on_edit_form_submitted (Ekiga::Form& result);
+    void on_edit_form_submitted (bool submitted,
+				 Ekiga::Form& result);
   };
 };
 

Modified: trunk/lib/engine/framework/Makefile.am
==============================================================================
--- trunk/lib/engine/framework/Makefile.am	(original)
+++ trunk/lib/engine/framework/Makefile.am	Sun Oct 19 08:12:38 2008
@@ -18,6 +18,7 @@
 	$(framework_dir)/form-builder.h \
 	$(framework_dir)/form-dumper.h \
 	$(framework_dir)/form.h \
+	$(framework_dir)/form.cpp \
 	$(framework_dir)/form-request.h \
 	$(framework_dir)/form-request-simple.h \
 	$(framework_dir)/robust-xml.h \

Modified: trunk/lib/engine/framework/form-request-simple.cpp
==============================================================================
--- trunk/lib/engine/framework/form-request-simple.cpp	(original)
+++ trunk/lib/engine/framework/form-request-simple.cpp	Sun Oct 19 08:12:38 2008
@@ -37,23 +37,28 @@
 
 #include "form-request-simple.h"
 
-Ekiga::FormRequestSimple::FormRequestSimple ()
+Ekiga::FormRequestSimple::FormRequestSimple (sigc::slot<void, bool, Form&> callback_): callback(callback_)
 {
   // nothing
 }
 
 Ekiga::FormRequestSimple::~FormRequestSimple ()
 {
+  if (!answered)
+    cancel ();
 }
 
 void
 Ekiga::FormRequestSimple::cancel ()
 {
-  cancelled.emit ();
+  Ekiga::EmptyForm empty;
+  answered = true;
+  callback (false, empty);
 }
 
 void
 Ekiga::FormRequestSimple::submit (Ekiga::Form &form)
 {
-  submitted.emit (form);
+  answered = true;
+  callback (true, form);
 }

Modified: trunk/lib/engine/framework/form-request-simple.h
==============================================================================
--- trunk/lib/engine/framework/form-request-simple.h	(original)
+++ trunk/lib/engine/framework/form-request-simple.h	Sun Oct 19 08:12:38 2008
@@ -54,7 +54,12 @@
   {
   public:
 
-    FormRequestSimple ();
+    /* the callbacks gets two informations :
+     * - a boolean, which is true if something was submitted, and false if
+     * the request was cancelled ;
+     * - a form, which contains the submitted answer (or is empty otherwise)
+     */
+    FormRequestSimple (sigc::slot<void, bool, Form&> callback_);
 
     ~FormRequestSimple ();
 
@@ -62,8 +67,10 @@
 
     void submit (Form &);
 
-    sigc::signal<void> cancelled;
-    sigc::signal<void, Form &> submitted;
+  private:
+
+    bool answered;
+    sigc::slot<void,bool,Form&> callback;
 
   };
 

Added: trunk/lib/engine/framework/form.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/framework/form.cpp	Sun Oct 19 08:12:38 2008
@@ -0,0 +1,107 @@
+
+/*
+ * Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+
+ * This program is free software; you can  redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Ekiga is licensed under the GPL license and as a special exception, you
+ * have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
+ * applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
+ * programs, as long as you do follow the requirements of the GNU GPL for all
+ * the rest of the software thus combined.
+ */
+
+
+/*
+ *                         form.cpp  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2008 by Julien Puydt
+ *   copyright            : (c) 2008 by Julien Puydt
+ *   description          : implementation of the empty form
+ *
+ */
+
+#include "form.h"
+
+
+Ekiga::EmptyForm::EmptyForm ()
+{
+}
+
+Ekiga::EmptyForm::~EmptyForm ()
+{
+}
+
+void
+Ekiga::EmptyForm::visit (FormVisitor &/*visitor*/) const
+
+{
+}
+
+const std::string
+Ekiga::EmptyForm::hidden (const std::string name) const
+{
+  throw Form::not_found (name);
+  return "";
+}
+
+bool Ekiga::EmptyForm::boolean (const std::string name) const
+{
+  throw Form::not_found (name);
+  return false;
+}
+
+const std::string
+Ekiga::EmptyForm::text (const std::string name) const
+{
+  throw Form::not_found (name);
+  return "";
+}
+
+const std::string
+Ekiga::EmptyForm::private_text (const std::string name) const
+{
+  throw Form::not_found (name);
+  return "";
+}
+
+
+const std::string
+Ekiga::EmptyForm::multi_text (const std::string name) const
+{
+  throw Form::not_found (name);
+  return "";
+}
+
+const std::string
+Ekiga::EmptyForm::single_choice (const std::string name) const
+{
+  throw Form::not_found (name);
+  return "";
+}
+
+const std::set<std::string>
+Ekiga::EmptyForm::multiple_choice (const std::string name) const
+{
+  throw Form::not_found (name);
+  return std::set<std::string>();
+}
+
+const std::set<std::string>
+Ekiga::EmptyForm::editable_set (const std::string name) const
+{
+  throw Form::not_found (name);
+  return std::set<std::string>();
+}

Modified: trunk/lib/engine/framework/form.h
==============================================================================
--- trunk/lib/engine/framework/form.h	(original)
+++ trunk/lib/engine/framework/form.h	Sun Oct 19 08:12:38 2008
@@ -63,7 +63,7 @@
       const char* what() const throw() { return "form field not found"; }
 
       const std::string name;
-      
+
     };
 
     virtual ~Form () {}
@@ -91,6 +91,33 @@
  * @}
  */
 
+  class EmptyForm: public Form
+  {
+  public:
+
+    EmptyForm ();
+
+    ~EmptyForm ();
+
+    void visit (FormVisitor &visitor) const;
+
+    const std::string hidden (const std::string name) const;
+
+    bool boolean (const std::string name) const;
+
+    const std::string text (const std::string name) const;
+
+    const std::string private_text (const std::string name) const;
+
+    const std::string multi_text (const std::string name) const;
+
+    const std::string single_choice (const std::string name) const;
+
+    const std::set<std::string> multiple_choice (const std::string name) const;
+
+    const std::set<std::string> editable_set (const std::string name) const;
+  };
+
 };
 
 #endif

Modified: trunk/lib/engine/presence/local-roster/local-heap.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-heap.cpp	(original)
+++ trunk/lib/engine/presence/local-roster/local-heap.cpp	Sun Oct 19 08:12:38 2008
@@ -173,7 +173,7 @@
   if (!has_presentity_with_uri (uri)) {
 
     gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
-    Ekiga::FormRequestSimple request;
+    Ekiga::FormRequestSimple request(sigc::mem_fun (this, &Local::Heap::new_presentity_form_submitted));
     std::set<std::string> groups = existing_groups ();
 
     request.title (_("Add to local roster"));
@@ -197,8 +197,6 @@
 			  _("Put contact in groups:"),
 			  std::set<std::string>(), groups);
 
-    request.submitted.connect (sigc::mem_fun (this, &Local::Heap::new_presentity_form_submitted));
-
     if (!questions.handle_request (&request)) {
 
     // FIXME: better error reporting
@@ -274,8 +272,12 @@
 
 
 void
-Local::Heap::new_presentity_form_submitted (Ekiga::Form &result)
+Local::Heap::new_presentity_form_submitted (bool submitted,
+					    Ekiga::Form &result)
 {
+  if (!submitted)
+    return;
+
   try {
 
     gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
@@ -296,14 +298,14 @@
       save ();
     } else {
 
-      Ekiga::FormRequestSimple request;
+      Ekiga::FormRequestSimple request(sigc::mem_fun (this, &Local::Heap::new_presentity_form_submitted));
 
       result.visit (request);
       if (!presence_core->is_supported_uri (uri))
 	request.error (_("You supplied an unsupported address"));
       else
 	request.error (_("You already have a contact with this address!"));
-      request.submitted.connect (sigc::mem_fun (this, &Local::Heap::new_presentity_form_submitted));
+
       if (!questions.handle_request (&request)) {
 
 	// FIXME: better error handling
@@ -325,14 +327,12 @@
 void
 Local::Heap::on_rename_group (std::string name)
 {
-  Ekiga::FormRequestSimple request;
+  Ekiga::FormRequestSimple request(sigc::bind<0>(sigc::mem_fun (this, &Local::Heap::rename_group_form_submitted), name));
 
   request.title (_("Rename group"));
   request.instructions (_("Please edit this group name"));
   request.text ("name", _("Name:"), name);
 
-  request.submitted.connect (sigc::bind<0>(sigc::mem_fun (this, &Local::Heap::rename_group_form_submitted), name));
-
   if (!questions.handle_request (&request)) {
 
     // FIXME: better error reporting
@@ -345,8 +345,12 @@
 
 void
 Local::Heap::rename_group_form_submitted (std::string old_name,
+					  bool submitted,
 					  Ekiga::Form& result)
 {
+  if (!submitted)
+    return;
+
   try {
     const std::string new_name = result.text ("name");
 

Modified: trunk/lib/engine/presence/local-roster/local-heap.h
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-heap.h	(original)
+++ trunk/lib/engine/presence/local-roster/local-heap.h	Sun Oct 19 08:12:38 2008
@@ -177,7 +177,8 @@
      * It does error checking and adds the Presentity to the
      * Heap if everything is valid.
      */
-    void new_presentity_form_submitted (Ekiga::Form &form);
+    void new_presentity_form_submitted (bool submitted,
+					Ekiga::Form &form);
 
     /** Triggered when the user decides to rename a group.
      * @param The group name
@@ -187,6 +188,7 @@
     /**
      */
     void rename_group_form_submitted (std::string old_name,
+				      bool submitted,
 				      Ekiga::Form& result);
 
     Ekiga::ServiceCore &core;

Modified: trunk/lib/engine/presence/local-roster/local-presentity.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-presentity.cpp	(original)
+++ trunk/lib/engine/presence/local-roster/local-presentity.cpp	Sun Oct 19 08:12:38 2008
@@ -213,7 +213,7 @@
 Local::Presentity::edit_presentity ()
 {
   gmref_ptr<Cluster> cluster = core.get ("local-cluster");
-  Ekiga::FormRequestSimple request;
+  Ekiga::FormRequestSimple request(sigc::mem_fun (this, &Local::Presentity::edit_presentity_form_submitted));
 
   std::set<std::string> all_groups = cluster->existing_groups ();
 
@@ -226,8 +226,6 @@
   request.editable_set ("groups", _("Choose groups:"),
 			groups, all_groups);
 
-  request.submitted.connect (sigc::mem_fun (this, &Local::Presentity::edit_presentity_form_submitted));
-
   if (!questions.handle_request (&request)) {
 
     // FIXME: better error reporting
@@ -240,8 +238,12 @@
 
 
 void
-Local::Presentity::edit_presentity_form_submitted (Ekiga::Form &result)
+Local::Presentity::edit_presentity_form_submitted (bool submitted,
+						   Ekiga::Form &result)
 {
+  if (!submitted)
+    return;
+
   try {
 
     /* we first fetch all data before making any change, so if there's

Modified: trunk/lib/engine/presence/local-roster/local-presentity.h
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-presentity.h	(original)
+++ trunk/lib/engine/presence/local-roster/local-presentity.h	Sun Oct 19 08:12:38 2008
@@ -167,7 +167,8 @@
      * private 'trigger_saving' signal to trigger saving
      * from the Local::Heap.
      */
-    void edit_presentity_form_submitted (Ekiga::Form &result);
+    void edit_presentity_form_submitted (bool submitted,
+					 Ekiga::Form &result);
 
 
     Ekiga::ServiceCore &core;

Modified: trunk/src/endpoints/opal-account.cpp
==============================================================================
--- trunk/src/endpoints/opal-account.cpp	(original)
+++ trunk/src/endpoints/opal-account.cpp	Sun Oct 19 08:12:38 2008
@@ -343,7 +343,7 @@
 
 void Opal::Account::edit ()
 {
-  Ekiga::FormRequestSimple request;
+  Ekiga::FormRequestSimple request(sigc::mem_fun (this, &Opal::Account::on_edit_form_submitted));
   std::stringstream str;
 
   str << get_timeout ();
@@ -367,8 +367,6 @@
   request.text ("timeout", _("Timeout:"), str.str ());
   request.boolean ("enabled", _("Enable Account"), enabled);
 
-  request.submitted.connect (sigc::mem_fun (this, &Opal::Account::on_edit_form_submitted));
-
   if (!questions.handle_request (&request)) {
 
     // FIXME: better error reporting
@@ -380,13 +378,14 @@
 }
 
 
-void Opal::Account::on_edit_form_submitted (Ekiga::Form &result)
+void Opal::Account::on_edit_form_submitted (bool submitted,
+					    Ekiga::Form &result)
 {
-  try {
+  if (!submitted)
+    return;
 
-    Ekiga::FormRequestSimple request;
+  try {
 
-    std::string error;
     std::string new_name = result.text ("name");
     std::string new_host = result.text ("host");
     std::string new_user = result.text ("user");
@@ -396,8 +395,7 @@
     std::string new_password = result.private_text ("password");
     bool new_enabled = result.boolean ("enabled");
     unsigned new_timeout = atoi (result.text ("timeout").c_str ());
-
-    result.visit (request);
+    std::string error;
 
     if (new_name.empty ()) 
       error = _("You did not supply a name for that account.");
@@ -409,8 +407,10 @@
       error = _("The timeout should have a bigger value.");
 
     if (!error.empty ()) {
+
+      Ekiga::FormRequestSimple request(sigc::mem_fun (this, &Opal::Account::on_edit_form_submitted));
+      result.visit (request);
       request.error (error);
-      request.submitted.connect (sigc::mem_fun (this, &Opal::Account::on_edit_form_submitted));
 
       if (!questions.handle_request (&request)) {
 #ifdef __GNUC__

Modified: trunk/src/endpoints/opal-account.h
==============================================================================
--- trunk/src/endpoints/opal-account.h	(original)
+++ trunk/src/endpoints/opal-account.h	Sun Oct 19 08:12:38 2008
@@ -110,7 +110,8 @@
     sigc::signal<void> trigger_saving;
  
 private:
-    void on_edit_form_submitted (Ekiga::Form &result);
+    void on_edit_form_submitted (bool submitted,
+				 Ekiga::Form &result);
     void on_consult (const std::string url);
     
     // Triggered for our own event

Modified: trunk/src/endpoints/opal-bank.cpp
==============================================================================
--- trunk/src/endpoints/opal-bank.cpp	(original)
+++ trunk/src/endpoints/opal-bank.cpp	Sun Oct 19 08:12:38 2008
@@ -69,7 +69,7 @@
                               std::string username,
                               std::string password)
 {
-  Ekiga::FormRequestSimple request;
+  Ekiga::FormRequestSimple request(sigc::bind (sigc::mem_fun (this, &Opal::Bank::on_new_account_form_submitted), t));
 
   request.title (_("Edit account"));
   request.instructions (_("Please update the following fields."));
@@ -118,10 +118,8 @@
   }
   request.boolean ("enabled", _("Enable Account"), true);
 
-  request.submitted.connect (sigc::bind (sigc::mem_fun (this, &Opal::Bank::on_new_account_form_submitted), t));
-
   if (!username.empty () && !password.empty ())
-    request.submitted.emit (request);
+    request.submit (request);
   else
     if (!questions.handle_request (&request)) {
 #ifdef __GNUC__
@@ -132,12 +130,16 @@
 }
 
 
-void Opal::Bank::on_new_account_form_submitted (Ekiga::Form &result,
+void Opal::Bank::on_new_account_form_submitted (bool submitted,
+						Ekiga::Form &result,
                                                 Account::Type t)
 {
+  if (!submitted)
+    return;
+
   try {
 
-    Ekiga::FormRequestSimple request;
+    Ekiga::FormRequestSimple request(sigc::bind (sigc::mem_fun (this, &Opal::Bank::on_new_account_form_submitted) ,t));
 
     std::string error;
     std::string new_name = (t == Opal::Account::SIP || t == Opal::Account::H323) ? result.text ("name") : result.hidden ("name");
@@ -162,7 +164,6 @@
 
     if (!error.empty ()) {
       request.error (error);
-      request.submitted.connect (sigc::bind (sigc::mem_fun (this, &Opal::Bank::on_new_account_form_submitted) ,t));
 
       if (!questions.handle_request (&request)) {
 #ifdef __GNUC__

Modified: trunk/src/endpoints/opal-bank.h
==============================================================================
--- trunk/src/endpoints/opal-bank.h	(original)
+++ trunk/src/endpoints/opal-bank.h	Sun Oct 19 08:12:38 2008
@@ -71,7 +71,9 @@
                       std::string password = "");
 
 private:
-    void on_new_account_form_submitted (Ekiga::Form & form, Account::Type t);
+    void on_new_account_form_submitted (bool submitted,
+					Ekiga::Form& form,
+					Account::Type t);
 
     void add (Account::Type t,
               std::string name, 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]