From a7a31c68d4c67d4f141f19d56a886413ac8137c5 Mon Sep 17 00:00:00 2001
From: Sascha Markus <sascha.markus@gmail.com>
Date: Wed, 2 May 2018 20:43:31 +0000
Subject: [PATCH] feature-7180-Remove-right-pane-of-WhisperBack

---
 data/whisperback.ui        | 117 +++++++--------------------------------------
 doc/config.py.sample       |  11 -----
 whisperBack/gui.py         |  58 +---------------------
 whisperBack/whisperback.py |   1 -
 4 files changed, 19 insertions(+), 168 deletions(-)

diff --git a/data/whisperback.ui b/data/whisperback.ui
index c1f937d..c092de2 100644
--- a/data/whisperback.ui
+++ b/data/whisperback.ui
@@ -291,7 +291,7 @@ along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
             <property name="position">400</property>
             <property name="position_set">True</property>
             <child>
-              <object class="GtkNotebook" id="notebookLeft">
+              <object class="GtkNotebook" id="notebook">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <child>
@@ -367,11 +367,12 @@ along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="labelMail">
+                      <object class="GtkLinkButton" id="linkGuidelines">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Optional email address to contact you</property>
+                        <property name="label" translatable="yes">Read our bug reporting guidelines.</property>
+                        <property name="uri">https://tails.boum.org/doc/first_steps/bug_reporting/</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -380,6 +381,19 @@ along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
                       </packing>
                     </child>
                     <child>
+                      <object class="GtkLabel" id="labelMail">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Email address (if you want an answer)</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">5</property>
+                      </packing>
+                    </child>
+                    <child>
                       <object class="GtkHBox" id="hbox1">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
@@ -421,7 +435,7 @@ along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">5</property>
+                        <property name="position">6</property>
                       </packing>
                     </child>
                   </object>
@@ -576,101 +590,6 @@ along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
                 </child>
               </object>
             </child>
-            <child>
-              <object class="GtkNotebook" id="notebookRight">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <child>
-                  <object class="GtkVBox" id="vboxRight">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="border_width">11</property>
-                    <property name="spacing">10</property>
-                    <child>
-                      <object class="GtkHButtonBox" id="buttonboxHelp">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="spacing">5</property>
-                        <property name="layout_style">start</property>
-                        <child>
-                          <object class="GtkButton" id="buttonHelpIndex">
-                            <property name="label">gtk-index</property>
-                            <property name="use_action_appearance">False</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="use_stock">True</property>
-                            <signal name="clicked" handler="cb_show_help" swapped="no"/>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkButton" id="buttonHelpPrev">
-                            <property name="label">gtk-go-back</property>
-                            <property name="use_action_appearance">False</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="use_stock">True</property>
-                            <signal name="clicked" handler="cb_help_prev" swapped="no"/>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkScrolledWindow" id="scrolledwindowHelp">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <child>
-                          <placeholder/>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                  </object>
-                </child>
-                <child type="tab">
-                  <object class="GtkLabel" id="labelHelp">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Help</property>
-                  </object>
-                  <packing>
-                    <property name="tab_fill">False</property>
-                  </packing>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child type="tab">
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child type="tab">
-                  <placeholder/>
-                </child>
-              </object>
-            </child>
           </object>
           <packing>
             <property name="expand">True</property>
diff --git a/doc/config.py.sample b/doc/config.py.sample
index f273ea8..8cc15fd 100644
--- a/doc/config.py.sample
+++ b/doc/config.py.sample
@@ -33,17 +33,6 @@ import os.path
 
 # DOCUMENTATION
 
-# The right panel help (HTML string)
-html_help = _("""<h1>Help us fix your bug!</h1>
-<p><strong>Do not include more personal information than
-needed!</strong></p>
-<h2>About giving us an email address</h2>
-<p>If you don't mind disclosing some bits of your identity
-to developers, you can provide an email address to
-let us ask more details about the bug. Additionally entering
-a public PGP key enables us to encrypt such future
-communication.</p>
-""")
 
 # ENCRYPTION
 #
diff --git a/whisperBack/gui.py b/whisperBack/gui.py
index f0a4bf5..62999d2 100644
--- a/whisperBack/gui.py
+++ b/whisperBack/gui.py
@@ -32,7 +32,6 @@ LOCALEDIR = "locale/"
 PACKAGE = "whisperback"
 
 import os
-import webbrowser
 
 # Import these because we need the exception they raise
 import smtplib
@@ -41,7 +40,6 @@ import socket
 # GIR imports
 from gi.repository import GObject
 from gi.repository import Gtk
-from gi.repository import WebKit
 
 # Import our modules
 import whisperBack.exceptions
@@ -70,8 +68,7 @@ class WhisperBackUI(object):
 
         self.main_window = builder.get_object("windowMain")
         self.hpaned_main = builder.get_object("hpanedMain")
-        self.notebook_right = builder.get_object("notebookLeft")
-        self.notebook_left = builder.get_object("notebookRight")
+        self.notebook = builder.get_object("notebook")
         self.progression_dialog = builder.get_object("dialogProgression")
         self.progression_main_text = builder.get_object("progressLabelMain")
         self.progression_progressbar = builder.get_object("progressProgressbar")
@@ -93,7 +90,6 @@ class WhisperBackUI(object):
         self.appended_details = builder.get_object("textviewAppendedInfo")
         self.include_appended_details = \
             builder.get_object("checkbuttonIncludeAppendedInfo")
-        self.help_container = builder.get_object("scrolledwindowHelp")
         self.send_button = builder.get_object("buttonSend")
 
         try:
@@ -117,28 +113,6 @@ class WhisperBackUI(object):
             + "\n"*4,
             self.message.get_buffer().create_tag(family="Monospace"))
 
-        #pylint: disable=E1101
-        self.htmlhelp = WebKit.WebView()
-
-        # Load only local ressources in the embedded webkit
-        # Loading untrusted ressources in such an unprotected browser
-        # wouldn't be safe
-        #pylint: disable=C0111,R0913
-        def cb_request_starting(web_view, web_frame, web_ressource, request,
-                                response, user_data=None):
-            if not request.get_uri().startswith("file://"):
-                webbrowser.open_new(request.get_uri())
-                request.set_uri(web_frame.get_uri())
-        self.htmlhelp.connect("resource-request-starting", cb_request_starting)
-        self.htmlhelp.get_settings().set_property("user-stylesheet-uri", "file://" +
-            whisperBack.utils.get_datadir() + "/style.css")
-
-        # set the two main window areas size on big screens
-        if self.main_window.get_screen().get_width() > 800:
-            self.notebook_left.set_size_request(400, -1)
-            self.notebook_right.set_size_request(400, -1)
-            self.hpaned_main.set_position(self.main_window.get_screen().get_width()
-                - max(self.main_window.get_screen().get_width()/3, 400))
 
         self.main_window.maximize()
 
@@ -153,11 +127,6 @@ class WhisperBackUI(object):
                 self.cb_close_application)
             return
 
-        # Loads help
-        self.load_htmlhelp()
-        self.help_container.add_child(builder, self.htmlhelp, None)
-        self.htmlhelp.show()
-
         # Shows the debugging details
         self.prepended_details.get_buffer().set_text(
             self.backend.prepended_data.rstrip())
@@ -171,31 +140,6 @@ class WhisperBackUI(object):
         """
         self.close_application()
         return False
-
-    def load_htmlhelp(self):
-        """Loads help into the help browser
-
-        """
-        self.htmlhelp.load_string(self.backend.html_help,
-            "text/html",
-            "UTF-8",
-            "file:///")
-
-    def cb_help_prev(self, widget, data=None):
-        """Callback function to go back in help browser
-
-        """
-        if self.htmlhelp.can_go_back():
-            self.htmlhelp.go_back()
-        else:
-            self.load_htmlhelp()
-
-    def cb_show_help(self, widget, data=None):
-        """Callback function display help main page in help browser
-
-        """
-        self.load_htmlhelp()
-
     def cb_show_about(self, widget, data=None):
         """Callback function to show the "about" dialog
 
diff --git a/whisperBack/whisperback.py b/whisperBack/whisperback.py
index c2a8fa9..4cfe4ae 100644
--- a/whisperBack/whisperback.py
+++ b/whisperBack/whisperback.py
@@ -89,7 +89,6 @@ class WhisperBack(object):
         self.__error_output = None
 
         # Initialize config variables
-        self.html_help = ""
         self.gnupg_keyring = None
         self.to_address = None
         self.to_fingerprint = None
-- 
2.11.0

