Selaa lähdekoodia

dselect: New key to set all selections back to what's currently installed

Closes: #151540
Colin Watson 18 vuotta sitten
vanhempi
commit
48b0b1e23c
7 muutettua tiedostoa jossa 38 lisäystä ja 0 poistoa
  1. 9 0
      ChangeLog
  2. 3 0
      debian/changelog
  3. 1 0
      dselect/bindings.cc
  4. 15 0
      dselect/pkgcmds.cc
  5. 2 0
      dselect/pkgkeys.cc
  6. 1 0
      dselect/pkglist.h
  7. 7 0
      man/dselect.1

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+2008-01-21  Colin Watson  <cjwatson@debian.org>
+
+	* dselect/pkgkeys.cc (packagelist_korgbindings): Add 'C'.
+	(packagelist_kinterps): Add 'revertinstalled'.
+	* dselect/bindings.cc (keybindings::descriptions): Likewise.
+	* dselect/pkglist.h (class packagelist): Add kd_revertinstalled.
+	* dselect/pkgcmds.cc (packagelist::kd_revertinstalled): New method.
+	* man/dselect.1: Document new 'C' keybinding.
+
 2008-01-21  Guillem Jover  <guillem@debian.org>
 
 	* dpkg-deb/build.c (getfi): Use m_malloc instead of malloc.

+ 3 - 0
debian/changelog

@@ -3,6 +3,9 @@ dpkg (1.14.17) UNRELEASED; urgency=low
   [ Guillem Jover ]
   * Replace strdup plus error checking usage with a new m_strdup function.
     Closes: #379028
+  * Add new keybinding in dselect to restore all selections back to
+    whatever's currently installed. Closes: #151540
+    Thanks to Colin Watson.
 
  -- Guillem Jover <guillem@debian.org>  Mon, 21 Jan 2008 10:11:55 +0200
 

+ 1 - 0
dselect/bindings.cc

@@ -158,6 +158,7 @@ const keybindings::description keybindings::descriptions[]= {
   { "revert",          N_("Revert to old state for all packages")                },
   { "revertsuggest",   N_("Revert to suggested state for all packages")          },
   { "revertdirect",    N_("Revert to directly requested state for all packages") },
+  { "revertinstalled", N_("Revert to currently installed state for all packages") },
   
   // Actions which apply only to lists of methods.
   { "select-and-quit", N_("Select currently-highlighted access method")          },

+ 15 - 0
dselect/pkgcmds.cc

@@ -264,6 +264,21 @@ void packagelist::kd_revertsuggest() {
   refreshlist(); redrawthisstate();
 }
 
+void
+packagelist::kd_revertinstalled()
+{
+  int i;
+
+  for (i = 0; i < nitems; i++) {
+    if (table[i]->pkg->name)
+      table[i]->selected = reallywant(pkginfo::want_sentinel, table[i]);
+    ldrawnstart = ldrawnend = -1;
+  }
+
+  refreshlist();
+  redrawthisstate();
+}
+
 /* fixme: configurable purge/deselect */
 
 void packagelist::kd_toggleinfo() {

+ 2 - 0
dselect/pkgkeys.cc

@@ -72,6 +72,7 @@ const keybindings::interpretation packagelist_kinterps[] = {
   { "revert",           0,  &packagelist::kd_revert_abort,     qa_noquit           },
   { "revertsuggest",    0,  &packagelist::kd_revertsuggest,    qa_noquit           },
   { "revertdirect",     0,  &packagelist::kd_revertdirect,     qa_noquit           },
+  { "revertinstalled",  0,  &packagelist::kd_revertinstalled,  qa_noquit           },
   {  0,                 0,  0,                                qa_noquit           }
 };
 
@@ -144,6 +145,7 @@ const keybindings::orgbinding packagelist_korgbindings[]= {
   { 'R',            "revert"           },
   { 'U',            "revertsuggest"    },
   { 'D',            "revertdirect"     },
+  { 'C',            "revertinstalled"  },
                                        
   {  -1,             0                 }
 };

+ 1 - 0
dselect/pkglist.h

@@ -183,6 +183,7 @@ protected:
   void kd_revert_abort();
   void kd_revertsuggest();
   void kd_revertdirect();  
+  void kd_revertinstalled();
   void kd_morespecific();
   void kd_lessspecific();
   void kd_swaporder();

+ 7 - 0
man/dselect.1

@@ -423,6 +423,13 @@ keys, any possibly detrimental changes to the requested package
 selections can be backed out completely to the last established
 settings.
 .sp
+If you mistakenly establish some settings and wish to revert all the
+selections to what is currently installed on the system, press the
+\fB'C'\fP key.
+This is somewhat similar to using the unhold command on all packages,
+but provides a more obvious panic button in cases where the user
+pressed \fBenter\fP by accident.
+.sp
 .
 .SH BUGS
 The