grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026/** BEGIN COPYRIGHT BLOCK * This Program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; version 2 of the License. * * This Program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place, Suite 330, Boston, MA 02111-1307 USA. * * Copyright (C) 2005 Red Hat, Inc. * All rights reserved. * END COPYRIGHT BLOCK **/ imports.gi.versions.Gtk = '3.0' const Gtk = imports.gi.Gtk; const Lang = imports.lang; const Gio = imports.gi.Gio; const GObject = imports.gi.GObject; const GLib = imports.gi.GLib; const TMP_FILE_NAME = "v135tr"; const PIN_OPERATION = "Password"; function pinDialog(app) { if(!app) return; this.app = app; } pinDialog.prototype = { launchPinPrompt: function(notify) { this.notify = notify; this.message = "Token Pin Entry"; this.dialog = new Gtk.Dialog ({ transient_for: this.app._window, modal: true, expand: false, title: this.message ,border_width: 20, deletable: false }); this.area = this.dialog.get_content_area(); this.grid = new Gtk.Grid ({row_spacing: 10, column_spacing: 20}); this.actionArea = this.dialog.get_action_area(); this.pinBox = new Gtk.Entry(); this.pinBox.set_visibility(false); this.grid.add(this.pinBox); this.oKButton = Gtk.Button.new_from_stock (Gtk.STOCK_OK); this.grid.add (this.oKButton); this.actionArea.add(this.grid); // Connect the button to the function that handles what it does this.oKButton.connect ("clicked", this.oKHandler.bind(this)); this.dialog.show_all(); }, clearTempFile() { this.saveToTempFile(this.tempFileName,true); }, saveToTempFile(name,clear) { if (name == null) { return null; } let contents = ""; if(clear == false) contents = this.pinBox.get_text(); else contents = ""; try { GLib.file_set_contents(name , contents); } catch(e) { return null; } }, oKHandler: function() { if(this.dialog) { this.tempFileName = this.app._getConfigPath() + "/" + TMP_FILE_NAME; this.saveToTempFile(this.tempFileName,false); if(this.notify) { this.notify(this.tempFileName); } this.clearTempFile(); this.dialog.destroy(); this.dialog = null; } }, getTempFileName() { return this.tempFileName; } }