diff --git a/data/io.github.jhaygood86.mauborgne.appdata.xml.in b/data/io.github.jhaygood86.mauborgne.appdata.xml.in
index d5c83cd..8c8db36 100644
--- a/data/io.github.jhaygood86.mauborgne.appdata.xml.in
+++ b/data/io.github.jhaygood86.mauborgne.appdata.xml.in
@@ -11,13 +11,25 @@
+
+
+ New Features
+
+ - Importing pads from image files containing QR Codes
+
+ New Translations
+
+
+
Bugfixes
- Detect dark mode on GNOME versions that do not support the freedesktop color scheme setting
- Updated Translations
+ New Translations
diff --git a/po/es.po b/po/es.po
index a7e6a73..902be2c 100644
--- a/po/es.po
+++ b/po/es.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: io.github.jhaygood86.mauborgne\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-11-13 11:10-0500\n"
+"POT-Creation-Date: 2021-11-13 11:27-0500\n"
"PO-Revision-Date: 2021-10-24 00:58+0000\n"
"Last-Translator: Justin Haygood \n"
"Language-Team: Spanish \n"
"Language-Team: French \n"
"Language-Team: LANGUAGE \n"
@@ -21,31 +21,35 @@ msgstr ""
msgid "Mauborgne"
msgstr ""
-#: src/MainWindow.vala:68 src/Widgets/OneTimePadView.vala:43
+#: src/MainWindow.vala:68 src/Widgets/OneTimePadView.vala:44
msgid "Add Pad From Screenshot"
msgstr ""
-#: src/MainWindow.vala:72
-msgid "Add Pad From Camera"
+#: src/MainWindow.vala:72 src/Widgets/OneTimePadView.vala:50
+msgid "Add Pad From QR Code Image File"
msgstr ""
#: src/MainWindow.vala:76
-msgid "Add Pad From Token"
+msgid "Add Pad From Camera"
msgstr ""
#: src/MainWindow.vala:80
+msgid "Add Pad From Token"
+msgstr ""
+
+#: src/MainWindow.vala:84
msgid "Add Pad(s) From Aegis Encrypted JSON"
msgstr ""
-#: src/MainWindow.vala:91
+#: src/MainWindow.vala:96
msgid "Add One Time Pad…"
msgstr ""
-#: src/MainWindow.vala:247
+#: src/MainWindow.vala:282
msgid "Time-based One Time Pads"
msgstr ""
-#: src/MainWindow.vala:248
+#: src/MainWindow.vala:283
msgid "Counter-based One Time Pads"
msgstr ""
@@ -61,55 +65,59 @@ msgstr ""
msgid "Unable to lock vault. Please try a different password"
msgstr ""
-#: src/Widgets/OneTimePadView.vala:40
+#: src/Widgets/OneTimePadView.vala:41
msgid "Add a One Time Pad"
msgstr ""
-#: src/Widgets/OneTimePadView.vala:41
+#: src/Widgets/OneTimePadView.vala:42
msgid "Add a one time pad from a provider"
msgstr ""
-#: src/Widgets/OneTimePadView.vala:44
+#: src/Widgets/OneTimePadView.vala:45
msgid "Add a pad using a screenshot of a QR code"
msgstr ""
-#: src/Widgets/OneTimePadView.vala:46
+#: src/Widgets/OneTimePadView.vala:47
msgid "Add Pad From Aegis JSON"
msgstr ""
-#: src/Widgets/OneTimePadView.vala:47
+#: src/Widgets/OneTimePadView.vala:48
msgid "Add a pad using an export of an Aegis encrypted JSON vault file"
msgstr ""
#: src/Widgets/OneTimePadView.vala:51
+msgid "Add a pad using an image file that contains a QR Code"
+msgstr ""
+
+#: src/Widgets/OneTimePadView.vala:55
msgid "One Time Pad"
msgstr ""
-#: src/Widgets/OneTimePadView.vala:91
+#: src/Widgets/OneTimePadView.vala:95
msgid "Copy"
msgstr ""
-#: src/Widgets/OneTimePadView.vala:100
+#: src/Widgets/OneTimePadView.vala:104
msgid "Export as QR Code"
msgstr ""
-#: src/Widgets/OneTimePadView.vala:104
+#: src/Widgets/OneTimePadView.vala:108
msgid "Export this pad as Aegis Vault JSON"
msgstr ""
-#: src/Widgets/OneTimePadView.vala:108
+#: src/Widgets/OneTimePadView.vala:112
msgid "Export all pads as Aegis Vault JSON"
msgstr ""
-#: src/Widgets/OneTimePadView.vala:118
+#: src/Widgets/OneTimePadView.vala:122
msgid "Export"
msgstr ""
-#: src/Widgets/OneTimePadView.vala:139
+#: src/Widgets/OneTimePadView.vala:143
msgid "Delete"
msgstr ""
-#: src/Widgets/OneTimePadView.vala:151
+#: src/Widgets/OneTimePadView.vala:155
msgid "Edit"
msgstr ""
@@ -152,65 +160,78 @@ msgid ""
msgstr ""
#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:16
-msgid "Bugfixes"
+msgid "New Features"
msgstr ""
#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:18
-msgid ""
-"Detect dark mode on GNOME versions that do not support the freedesktop color "
-"scheme setting"
+msgid "Importing pads from image files containing QR Codes"
msgstr ""
#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:20
-msgid "Updated Translations"
+#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:32
+msgid "New Translations"
msgstr ""
#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:22
-msgid "Italian"
+msgid "Portuguese (Brazil)"
msgstr ""
#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:28
-#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:38
-msgid "Feature Release"
+msgid "Bugfixes"
msgstr ""
#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:30
msgid ""
+"Detect dark mode on GNOME versions that do not support the freedesktop color "
+"scheme setting"
+msgstr ""
+
+#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:34
+msgid "Italian"
+msgstr ""
+
+#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:40
+#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:50
+msgid "Feature Release"
+msgstr ""
+
+#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:42
+msgid ""
"Add support for copying codes, including pasting the current code on TOTP "
"pads"
msgstr ""
-#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:31
+#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:43
msgid "Remove access to AccountService thanks to elementary OS updates"
msgstr ""
-#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:32
+#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:44
msgid "Add support for editing pads, issuer names, and account names"
msgstr ""
-#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:40
+#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:52
msgid "Adds support for exporting pad(s) in Aegis encrypted JSON format"
msgstr ""
-#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:41
+#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:53
msgid "Fix crashes when deleting a pad"
msgstr ""
-#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:42
+#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:54
msgid "Adds missing button to import from Aegis files on welcome screen"
msgstr ""
-#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:43
+#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:55
msgid ""
"Clean up account names for accounts where the issuer name is repeated in the "
"account name"
msgstr ""
-#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:44
+#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:56
msgid "Updated icons!"
msgstr ""
-#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:86
+#: data/io.github.jhaygood86.mauborgne.appdata.xml.in:98
msgid "Justin Haygood"
msgstr ""
diff --git a/po/it.po b/po/it.po
index 1ba901e..7bbce32 100644
--- a/po/it.po
+++ b/po/it.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: io.github.jhaygood86.mauborgne\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-11-13 11:10-0500\n"
+"POT-Creation-Date: 2021-11-13 11:27-0500\n"
"PO-Revision-Date: 2021-10-31 12:20+0000\n"
"Last-Translator: albanobattistella \n"
"Language-Team: Italian \n"
"Language-Team: Norwegian Bokmål \n"
"Language-Team: Portuguese (Brazil) {
+ add_code_from_qr_code_file ();
+ });
+
onetimepad_view.code_retrieved.connect(() => {
otp_library.save.begin(onetimepad_view.pad);
});
@@ -187,6 +197,10 @@ public class Mauborgne.MainWindow : Hdy.ApplicationWindow {
add_codes_from_aegis_encrypted_json ();
}
+ private void acquire_from_qr_code_file_clicked(Gtk.Button button) {
+ add_code_from_qr_code_file ();
+ }
+
private void add_codes_from_aegis_encrypted_json () {
var chooser = new Gtk.FileChooserNative ("Open Aegis Vault File", this, Gtk.FileChooserAction.OPEN, null, null);
@@ -215,33 +229,54 @@ public class Mauborgne.MainWindow : Hdy.ApplicationWindow {
var otp = new OneTimePad.from_uri(qr_code_uri);
otp_library.add.begin(otp);
}
-
});
}
+ private void add_code_from_qr_code_file () {
+ var chooser = new Gtk.FileChooserNative ("Open QR Code Image File", this, Gtk.FileChooserAction.OPEN, null, null);
+
+ var response = chooser.run ();
+
+ if (response == Gtk.ResponseType.ACCEPT) {
+ var filename = chooser.get_filename ();
+
+ var file = File.new_for_path(filename);
+ var qr_code_uri = acquire_from_file (file);
+
+ if(qr_code_uri.length > 0){
+ var otp = new OneTimePad.from_uri(qr_code_uri);
+ otp_library.add.begin(otp);
+ }
+ }
+ }
+
private async string acquire_from_screenshot() {
try {
var parent_window = Xdp.ParentWindow.new_gtk (this);
var screenshot_uri = yield portal.take_screenshot(parent_window, Xdp.ScreenshotFlags.INTERACTIVE);
var file = File.new_for_uri(screenshot_uri);
- var file_stream = file.read ();
-
- var pixbuf = new Gdk.Pixbuf.from_stream (file_stream);
-
- var payload = QrHelpers.get_payload_from_pixbuf (pixbuf);
-
- print("payload: %s\n",payload);
-
- file_stream.close();
-
- return payload;
-
+ return acquire_from_file (file);
} catch (GLib.Error error) {
return "";
}
}
-
+
+
+ private string acquire_from_file (File file) {
+ var file_stream = file.read ();
+
+ var pixbuf = new Gdk.Pixbuf.from_stream (file_stream);
+
+ var payload = QrHelpers.get_payload_from_pixbuf (pixbuf);
+
+ print("payload: %s\n",payload);
+
+ file_stream.close();
+
+ return payload;
+ }
+
private void bind_pads_to_source_list() {
var totp_item = new Granite.Widgets.SourceList.ExpandableItem(_("Time-based One Time Pads"));
diff --git a/src/Widgets/OneTimePadView.vala b/src/Widgets/OneTimePadView.vala
index baedad4..51c1c7c 100644
--- a/src/Widgets/OneTimePadView.vala
+++ b/src/Widgets/OneTimePadView.vala
@@ -2,6 +2,7 @@ public class OneTimePadView : Gtk.Grid {
public signal void add_code_from_screenshot_clicked ();
public signal void add_code_from_aegis_clicked ();
+ public signal void add_code_from_qr_code_image_clicked ();
public signal void code_retrieved ();
public signal void delete_requested (OneTimePad pad);
@@ -46,6 +47,9 @@ public class OneTimePadView : Gtk.Grid {
welcome_screen.append ("aegis", _("Add Pad From Aegis JSON"),
_("Add a pad using an export of an Aegis encrypted JSON vault file"));
+ welcome_screen.append ("image-x-generic", _("Add Pad From QR Code Image File"),
+ _("Add a pad using an image file that contains a QR Code"));
+
welcome_screen.activated.connect (welcome_screen_activated);
title_label = new Gtk.Label (_("One Time Pad"));
@@ -178,6 +182,10 @@ public class OneTimePadView : Gtk.Grid {
if (index == 1) {
add_code_from_aegis_clicked ();
}
+
+ if (index == 2) {
+ add_code_from_qr_code_image_clicked ();
+ }
}
private void on_pad_set() {