implemented full search
authortanya <tanyshk@gmail.com>
Tue, 22 Jun 2010 13:17:37 +0000 (16:17 +0300)
committertanya <tanyshk@gmail.com>
Tue, 22 Jun 2010 13:17:37 +0000 (16:17 +0300)
controller.py
database/SQLite.py
ui/hildon_ui.py
ui/hildon_ui.pyo

index 907124e..f2f348f 100644 (file)
@@ -64,6 +64,14 @@ class MeabookController:
         return [(name, internal_name, 'd') for name, internal_name in \
             self.model.get_folders()]
 
+    def get_files_by_pattern_ex(self, key, pattern=''):
+        """Gets all peoples matched pattern."""
+
+        files_dict = self.model.get_files_by_pattern(['cn', 'o', 'ou'], key, pattern, True)
+        return [("%s" % files_dict[internal_name]['cn'], "%s / %s" % (
+            files_dict[internal_name]['o'], files_dict[internal_name]['ou']), \
+            internal_name, TYPE_FILE) for internal_name in files_dict]
+
 
     def get_files_by_pattern(self, pattern=''):
         """Gets all peoples matched pattern."""
index c3d0b0a..62c4bc0 100644 (file)
@@ -179,7 +179,7 @@ class SQLite:
 
         items_dict = {}
         if key not in fields:
-            fields = fields + (key,)
+            fields.append(str(key))
         execute = self.conn.execute
         fields = dict(execute("SELECT id, name FROM fields WHERE name IN (%s)" \
             % ','.join('%r' % (field,) for field in fields)).fetchall())
index df0eb6f..1a08484 100644 (file)
@@ -171,7 +171,7 @@ class HildonMeabook(MeabookUI):
         else:
             widgets_box = gtk.VBox()
             container = hildon.PannableArea()
-            container.add_with_viewport(items_box)
+            container.add_with_viewport(widgets_box)
             set_box_content(widgets_box, self._show_item_dialog, items)
         window.add(container)
         window.show_all()
@@ -285,7 +285,9 @@ class HildonMeabook(MeabookUI):
         dialog = SearchDialog(controller)
         param = dialog.run()
         if param:
-            print(param)
+            self._show_items_dialog(_('Search results'), 
+                self.controller.get_files_by_pattern_ex(param[0], param[1]), 
+                touch_selector_view=False)
 
 
     # Hildon UI callbacks
@@ -432,7 +434,7 @@ class SearchDialog:
             dialog.destroy()
             return result
         dialog.destroy()
-        return (False, None)
+        return False
 
 
 
index b03c679..dea958c 100644 (file)
Binary files a/ui/hildon_ui.pyo and b/ui/hildon_ui.pyo differ