glom r1446 - in trunk: . glom/libglom/document po



Author: murrayc
Date: Wed Mar  5 17:05:11 2008
New Revision: 1446
URL: http://svn.gnome.org/viewvc/glom?rev=1446&view=rev

Log:
2008-03-05  Murray Cumming  <murrayc murrayc com>

* glom/libglom/document/document_glom.cc:
get_data_layout_groups_default(): Restored the code that creates 
the default layouts, which was lost somehow.
Bug #517665 (Johannes Schmid).

Modified:
   trunk/ChangeLog
   trunk/glom/libglom/document/document_glom.cc
   trunk/po/Makefile.in.in

Modified: trunk/glom/libglom/document/document_glom.cc
==============================================================================
--- trunk/glom/libglom/document/document_glom.cc	(original)
+++ trunk/glom/libglom/document/document_glom.cc	Wed Mar  5 17:05:11 2008
@@ -680,7 +680,7 @@
       }
     }
 
-     //Remove field from any reports:
+    //Remove field from any reports:
     for(DocumentTableInfo::type_reports::iterator iterReports = info.m_reports.begin(); iterReports != info.m_reports.end(); ++iterReports)
     {
       sharedptr<Report> report = iterReports->second;
@@ -1347,11 +1347,80 @@
 
   type_list_layout_groups result;
 
+ //Add one if necessary:
+  sharedptr<LayoutGroup> pTopLevel;
+  sharedptr<LayoutGroup> pOverview;
+  sharedptr<LayoutGroup> pDetails;
+
   sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::create();
   group->set_name("main");
   group->m_columns_count = 1;
   result.push_back(group);
-  
+  pTopLevel = group;
+
+  if(layout_name == "details") //The Details default layOut is a bit more complicated.
+  {
+    sharedptr<LayoutGroup> overview = sharedptr<LayoutGroup>::create();;
+    overview->set_name("overview");
+    overview->set_title_original("Overview"); //Don't translate this, but TODO: add standard translations.
+    overview->m_columns_count = 2;
+
+    pTopLevel->add_item(overview);
+    pOverview = sharedptr<LayoutGroup>::cast_dynamic(overview);
+
+    sharedptr<LayoutGroup> details = sharedptr<LayoutGroup>::create();
+    details->set_name("details");
+    details->set_title_original("Details"); //Don't translate this, but TODO: add standard translations.
+    details->m_columns_count = 2;
+    
+    pTopLevel->add_item(details);
+    pDetails = sharedptr<LayoutGroup>::cast_dynamic(details);
+  }
+
+  //If, for some reason, we didn't create the-subgroups, add everything to the top level group:
+  if(!pOverview)
+    pOverview = pTopLevel;
+
+  if(!pDetails)
+    pDetails = pTopLevel;
+
+
+  //Discover new fields, and add them:
+  type_vecFields all_fields = get_table_fields(parent_table_name);
+  for(type_vecFields::const_iterator iter = all_fields.begin(); iter != all_fields.end(); ++iter)
+  {
+    const Glib::ustring field_name = (*iter)->get_name();
+    if(!field_name.empty())
+    {
+      //See whether it's already in the result:
+      //TODO_Performance: There is a lot of iterating and comparison here:
+      bool found = false; //TODO: This is horrible.
+      for(type_list_layout_groups::const_iterator iterFind = result.begin(); iterFind != result.end(); ++iterFind)
+      {
+        sharedptr<const LayoutGroup> group = *iterFind;
+        if(group && group->has_field(field_name))
+        {
+          found = true;
+          break;
+        }
+      }
+
+      if(!found)
+      {
+        sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+        layout_item->set_full_field_details(*iter);
+        //layout_item.set_table_name(child_table_name); //TODO: Allow viewing of fields through relationships.
+        //layout_item.m_sequence = sequence;  add_item() will fill this.
+
+        //std::cout << "  debug: add_item(): " << layout_item.get_name() << std::endl;
+        if(pOverview && layout_item->get_full_field_details()->get_primary_key())
+          pOverview->add_item(layout_item);
+        else if(pDetails)
+          pDetails->add_item(layout_item);
+      }
+    }
+  }
+
   return result;
 }
 

Modified: trunk/po/Makefile.in.in
==============================================================================
--- trunk/po/Makefile.in.in	(original)
+++ trunk/po/Makefile.in.in	Wed Mar  5 17:05:11 2008
@@ -1,10 +1,10 @@
 # Makefile for program source directory in GNU NLS utilities package.
 # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper gnu ai mit edu>
+# Copyright (C) 2004-2008 Rodney Dawes <dobey pwns gmail com>
 #
-# This file file be copied and used freely without restrictions.  It can
-# be used in projects which are not available under the GNU Public License
+# This file may be copied and used freely without restrictions.  It may
+# be used in projects which are not available under a GNU Public License,
 # but which still want to provide support for the GNU gettext functionality.
-# Please note that the actual code is *not* freely available.
 #
 # - Modified by Owen Taylor <otaylor redhat com> to use GETTEXT_PACKAGE
 #   instead of PACKAGE and to look for po2tbl in ./ not in intl/
@@ -12,7 +12,7 @@
 # - Modified by jacob berkman <jacob ximian com> to install
 #   Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
 #
-# - Modified by Rodney Dawes <dobey novell com> for use with intltool
+# - Modified by Rodney Dawes <dobey pwns gmail com> for use with intltool
 #
 # We have the following line for use by intltoolize:
 # INTLTOOL_MAKEFILE



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