[Aptitude-svn-commit] r3561 - in branches/aptitude-0.3/aptitude: . src

Daniel Burrows dburrows@costa.debian.org
Sat, 02 Jul 2005 18:11:45 +0000


Author: dburrows
Date: Sat Jul  2 18:11:43 2005
New Revision: 3561

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/pkg_view.cc
Log:
Update the pkg_view code for wide characters and the new interfaces.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sat Jul  2 18:11:43 2005
@@ -1,5 +1,9 @@
 2005-07-02  Daniel Burrows  <dburrows@debian.org>
 
+	* src/pkg_view.cc:
+
+	  Update the pkg_view code for wide characters and new interfaces.
+
 	* src/pkg_info_screen.cc:
 
 	  Fix the pkg_info_screen code to pass a wstring to desc_parse.

Modified: branches/aptitude-0.3/aptitude/src/pkg_view.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/pkg_view.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/pkg_view.cc	Sat Jul  2 18:11:43 2005
@@ -37,6 +37,7 @@
 #include <vscreen/vs_text_layout.h>
 #include <vscreen/vscreen_widget.h>
 #include <vscreen/config/keybindings.h>
+#include <vscreen/transcode.h>
 
 #include <generic/apt.h>
 #include <generic/config_signal.h>
@@ -131,7 +132,7 @@
   if(!transcode(format.c_str(), wformat))
     _error->Errno("iconv", _("Couldn't transcode column definition"));
   else
-    columns=parse_columns(format,
+    columns=parse_columns(wformat,
 			  pkg_item::pkg_columnizer::parse_column_type,
 			  pkg_item::pkg_columnizer::defaults);
 
@@ -148,12 +149,16 @@
   void set_package(const pkgCache::PkgIterator &pkg,
 		   const pkgCache::VerIterator &ver)
   {
-    string newdesc;
+    wstring newdesc;
 
     if(!pkg.end() && !ver.end())
-      newdesc=apt_package_records->Lookup(ver.FileList()).LongDesc();
-    else
-      newdesc="";
+      {
+	if(!transcode(apt_package_records->Lookup(ver.FileList()).LongDesc(), newdesc))
+	  {
+	    if(!transcode(_("Encoding error in long description."), newdesc))
+	      newdesc=L"Encoding error in long description.";
+	  }
+      }
 
     fragment *frag=make_desc_fragment(newdesc);
 
@@ -191,7 +196,7 @@
 
   pkgCache::PkgIterator lastPkg;
   pkgCache::VerIterator lastVer;
-  string lastDesc;
+  wstring lastDesc;
 
   /** True if the package had breakage the last time we checked. */
   bool hadBreakage;
@@ -306,7 +311,7 @@
    *
    *  \param s the new description
    */
-  void set_description(string s)
+  void set_description(const std::wstring &s)
   {
     if(s!=lastDesc)
       {