[glom] Document::get/set_connection_user(): Don't save this in the document.



commit 76c8f74c60ba96687c98ea0afda8dcb4987976d1
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Aug 21 10:46:29 2009 +0200

    Document::get/set_connection_user(): Don't save this in the document.
    
    	* glom/libglom/document/document.[h|cc]:
    get/set_connection_user():
    	Document these as not being saved in the document, because it
    makes no sense
    	to save a single user there, because Glom is a multi-user
    system.
    	* glom/dialog_connection.cc: load_after(), save_before(): Don't
    save the user
    	in the document.

 ChangeLog                         |   10 ++++++++++
 glom/dialog_connection.cc         |    8 --------
 glom/libglom/document/document.cc |    5 ++---
 glom/libglom/document/document.h  |   19 ++++++++++++++++---
 4 files changed, 28 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 51a2596..83f11cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-08-21  Murray Cumming  <murrayc murrayc com>
+
+	Document::get/set_connection_user(): Don't save this in the document.
+	
+	* glom/libglom/document/document.[h|cc]: get/set_connection_user(): 
+	Document these as not being saved in the document, because it makes no sense 
+	to save a single user there, because Glom is a multi-user system.
+	* glom/dialog_connection.cc: load_after(), save_before(): Don't save the user 
+	in the document.
+
 2009-08-19  David King  <davidk openismus com>
 
 	* glom.am:
diff --git a/glom/dialog_connection.cc b/glom/dialog_connection.cc
index f75646a..0e26f0a 100644
--- a/glom/dialog_connection.cc
+++ b/glom/dialog_connection.cc
@@ -153,14 +153,6 @@ sharedptr<SharedConnection> Dialog_Connection::connect_to_server_with_connection
 #endif //GLOM_ENABLE_CLIENT_ONLY
     }
 #endif //GLOM_ENABLE_POSTGRESQL
-
-    /*
-    if(document)
-    {
-      document->set_connection_server(m_entry_host->get_text());
-      document->set_connection_user(m_entry_user->get_text());
-    }
-    */
   }
   else
      std::cerr << "Dialog_Connection::connect_to_server_with_connection_settings(): ConnectionPool::get_instance() failed." << std::endl;
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index 146670d..33b1362 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -381,7 +381,8 @@ void Document::set_connection_user(const Glib::ustring& strVal)
   if(strVal != m_connection_user)
   {
     m_connection_user = strVal;
-    set_modified();
+    
+    //We don't call set_modified(), because this is not saved in the document: set_modified();
   }
 }
 
@@ -2352,7 +2353,6 @@ bool Document::load_after(int& failure_code)
         m_connection_server = get_node_attribute_value(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_SERVER);
         m_connection_port = get_node_attribute_value_as_decimal(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_PORT);
         m_connection_try_other_ports = get_node_attribute_value_as_bool(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_TRY_OTHER_PORTS, true /* default */);
-        m_connection_user = get_node_attribute_value(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_USER);
         m_connection_database = get_node_attribute_value(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_DATABASE);
 
         const Glib::ustring attr_mode = get_node_attribute_value(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_HOSTING_MODE);
@@ -3264,7 +3264,6 @@ bool Document::save_before()
     set_node_attribute_value(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_SERVER, m_connection_server);
     set_node_attribute_value_as_decimal(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_PORT, m_connection_port);
     set_node_attribute_value_as_bool(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_TRY_OTHER_PORTS, m_connection_try_other_ports, true /* default */);
-    set_node_attribute_value(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_USER, m_connection_user);
     set_node_attribute_value(nodeConnection, GLOM_ATTRIBUTE_CONNECTION_DATABASE, m_connection_database);
 
     //Remove existing tables:
diff --git a/glom/libglom/document/document.h b/glom/libglom/document/document.h
index 3187606..d3169eb 100644
--- a/glom/libglom/document/document.h
+++ b/glom/libglom/document/document.h
@@ -123,11 +123,17 @@ public:
   bool get_network_shared() const;
 
   void set_connection_server(const Glib::ustring& strVal);
-  void set_connection_user(const Glib::ustring& strVal);
   void set_connection_database(const Glib::ustring& strVal);
   void set_connection_port(int port_number);
   void set_connection_try_other_ports(bool val);
 
+ /** Temporarily set a username in the document.
+   * Note that this is not saved in the document's file.
+   *
+   * TODO: Remove this, and just store it in ConnectionPool?
+   */
+  void set_connection_user(const Glib::ustring& strVal);
+
   /** If the database should be hosted, this provides the 
     * path to the directory that contains all the files needed to do that.
     * This is usually a specifically-named directory at the same level as the .glom file. 
@@ -137,11 +143,17 @@ public:
   std::string get_connection_self_hosted_directory_uri() const;
 
   Glib::ustring get_connection_server() const;
-  Glib::ustring get_connection_user() const;
   Glib::ustring get_connection_database() const;
   int get_connection_port() const;
   bool get_connection_try_other_ports() const;
 
+  /** Retrieve a username previously set in the document.
+   * Note that this is not saved in the document's file.
+   *
+   * TODO: Remove this, and just store it in ConnectionPool?
+   */
+  Glib::ustring get_connection_user() const;
+
   /** Set the language/locale used by original titles.
    * Title translations are translations of the text in this language.
    * @param locale: For instance, "en_US.UTF-8".
@@ -477,7 +489,8 @@ private:
   HostingMode m_hosting_mode;
   bool m_network_shared;
 
-  Glib::ustring m_connection_server, m_connection_user, m_connection_database;
+  Glib::ustring m_connection_server, m_connection_database;
+  Glib::ustring m_connection_user; //Don't save the user.
   int m_connection_port; //0 means any port. Ignored when self-hosting (which may use a different port each time).
   bool m_connection_try_other_ports; //Set to false for self-hosted or browsed-from-network documents.
 



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