--- a/cbrpager-maemo/branches/MAEMO_0_9_20/src/garchivereadercommandline.c
+++ b/cbrpager-maemo/branches/MAEMO_0_9_20/src/garchivereadercommandline.c
@@ -33,12 +33,6 @@
 
 extern int debug;
 
-static gint
-compare_pages(gconstpointer s1, gconstpointer s2)
-{
-    return strcmp(*(const char**)s1, *(const char**)s2);
-}
-
 static gboolean extension_handled(const char* filename)
 {
     static const char* extensions[] = {
@@ -230,7 +224,8 @@
     }
     else
     {
-	g_array_sort(reader->page_list, compare_pages);
+	g_array_sort(reader->page_list,
+		     g_archive_reader_translate_strategy(reader->strategy));
     }
     return reader->page_list;
 }
@@ -253,13 +248,14 @@
     int pfd[2];
     ssize_t num_bytes;
     GArchiveReaderCommandLine* reader = G_ARCHIVE_READER_COMMAND_LINE(reader_iface);    
-
-    if(page_number < 0 || page_number >= get_file_list(reader_iface)->len)
+    GArray* file_list = get_file_list(reader_iface);
+
+    if(page_number < 0 || !file_list || page_number >= file_list->len)
     {
 	set_last_error(reader, g_strdup_printf(_("Page number %d out of range"), page_number));
 	return NULL;
     }	
-    filename = (const gchar*)g_array_index(get_file_list(reader_iface), gchar*, page_number);
+    filename = (const gchar*)g_array_index(file_list, gchar*, page_number);
 
     if(reader->decompress_command_file_needs_escape)
     {
@@ -364,6 +360,16 @@
     return last_error;
 }
 
+static void
+set_sort_strategy(GArchiveReader* reader_iface, SortStrategy strategy)
+{
+    GArchiveReaderCommandLine* reader = G_ARCHIVE_READER_COMMAND_LINE(reader_iface);
+    SortStrategy old_strategy = reader->strategy;
+    reader->strategy = strategy;
+    if(strategy != old_strategy && reader->page_list && reader->page_list->len > 0)
+	g_array_sort(reader->page_list, g_archive_reader_translate_strategy(strategy));
+}
+
 /* class instance housekeeping stuff */
 
 static void
@@ -375,6 +381,7 @@
     klass->get_file_list = get_file_list;
     klass->get_page = get_page;
     klass->get_last_error = get_last_error;
+    klass->set_sort_strategy = set_sort_strategy;
 }
 
 static void
@@ -395,6 +402,7 @@
     reader->current_filename = NULL;
     reader->last_error = NULL;
     reader->page_list = NULL;
+    reader->strategy = SORT_ASCII;
 }
 
 G_DEFINE_TYPE_EXTENDED(GArchiveReaderCommandLine,
@@ -451,6 +459,7 @@
 
     reader->buf = buf;
     reader->buf_size = buf_size;
+    reader->strategy = SORT_ASCII;
     
     reader->list_command = g_strdupv(list_command);
     reader->decompress_command = g_strdupv(decompress_command);