[PATCH 2/7] Add dialogs to prompt for passphrases of existing encrypted partitions.

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

 



As a convenience, a checkbox allows the user to indicate that the passphrase they are entering should also be used to access all subsequently discovered encrypted devices.
---
 text.py                 |   45 +++++++++++++++
 ui/lukspassphrase.glade |  141 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 186 insertions(+), 0 deletions(-)

diff --git a/text.py b/text.py
index 6238be4..000c4d8 100644
--- a/text.py
+++ b/text.py
@@ -269,6 +269,45 @@ class MainExceptionWindow:
         self.screen.popWindow()
 	self.screen.refresh()
 
+class PassphraseEntryWindow:
+    def __init__(self, screen, device):
+        self.screen = screen
+        self.txt = _("Partition %s is encrypted. In order to "
+                     "access the partition's contents during "
+                     "installation you must enter the device's "
+                     "passphrase below.") % (device,)
+        self.rc = None
+
+    def run(self):
+        toplevel = GridForm(self.screen, _("Passphrase"), 1, 4)
+
+        txt = TextboxReflowed(65, self.txt)
+        toplevel.add(txt, 0, 0)
+
+        passphraseentry = Entry(128, password = 1)
+        toplevel.add(passphraseentry, 0, 1, (0,0,0,1))
+
+        globalcheckbox = Checkbox(_("This is a global passphrase"))
+        toplevel.add(globalcheckbox, 0, 2)
+
+        buttons = ButtonBar(self.screen, [TEXT_OK_BUTTON, TEXT_CANCEL_BUTTON])
+        toplevel.add(buttons, 0, 3, growx=1)
+
+        rc = toplevel.run()
+        res = buttons.buttonPressed(rc)
+
+        passphrase = None
+        isglobal = False
+        if res == TEXT_OK_CHECK:
+            passphrase = passphraseentry.value().strip()
+            isglobal = globalcheckbox.selected()
+
+        self.rc = (passphrase, isglobal)
+        return self.rc
+
+    def pop(self):
+        self.screen.popWindow()
+
 class InstallInterface:
     def helpWindow(self, screen, key):
         if key == "helponhelp":
@@ -409,6 +448,12 @@ class InstallInterface:
         r.strip()
         return r
 
+    def passphraseEntryWindow(self, device):
+        w = PassphraseEntryWindow(self.screen, device)
+        (passphrase, isglobal) = w.run()
+        w.pop()
+        return (passphrase, isglobal)
+
     def getInstallKey(self, anaconda, key = ""):
         ic = anaconda.id.instClass
         keyname = _(ic.instkeyname)
diff --git a/ui/lukspassphrase.glade b/ui/lukspassphrase.glade
index 38631d4..31f08b3 100644
--- a/ui/lukspassphrase.glade
+++ b/ui/lukspassphrase.glade
@@ -220,4 +220,145 @@
   </child>
 </widget>
 
+<widget class="GtkDialog" id="passphraseEntryDialog">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Passphrase</property>
+  <property name="type">GTK_WINDOW_POPUP</property>
+  <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+  <property name="modal">True</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog2-vbox1">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+	<widget class="GtkHButtonBox" id="dialog2-action_area1">
+	  <property name="visible">True</property>
+	  <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+	  <child>
+	    <widget class="GtkButton" id="cancelbutton2">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-cancel</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-6</property>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="okbutton2">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-ok</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-5</property>
+	    </widget>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">True</property>
+	  <property name="pack_type">GTK_PACK_END</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkVBox" id="vbox2">
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">0</property>
+
+	  <child>
+	    <widget class="GtkLabel" id="passphraseLabel">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">label1</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0.5</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkEntry" id="passphraseEntry">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="editable">True</property>
+	      <property name="visibility">False</property>
+	      <property name="max_length">0</property>
+	      <property name="text" translatable="yes"></property>
+	      <property name="has_frame">True</property>
+	      <property name="invisible_char">â?¢</property>
+	      <property name="activates_default">False</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkCheckButton" id="globalcheckbutton">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">This is a global passphrase</property>
+	      <property name="use_underline">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="active">False</property>
+	      <property name="inconsistent">False</property>
+	      <property name="draw_indicator">True</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
 </glade-interface>
-- 
1.5.3.7

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux