📄 jhylafax.java
字号:
if (filenames.length > 0 || numbers.length > 0) { SendDialog dialog = new SendDialog(this); for (String number : numbers) { // FIXME should invoke addNumber() dialog.setNumber(number); } if (filenames.length > 0) { dialog.setDocument(filenames[0]); for (int i = 1; i < filenames.length; i++) { dialog.addDocument(filenames[i]); } } dialog.setQuitAfterSending(handler.getQuitAfterSending()); dialog.setLocationRelativeTo(JHylaFAX.this); dialog.setVisible(true); } } private File saveStdInToFile() { File tempFile; try { tempFile = File.createTempFile("jhylafax", null); tempFile.deleteOnExit(); } catch (IOException e) { logger.debug("Error creating temporary file", e); ErrorDialog.showError(JHylaFAX.getInstance(), i18n.tr("Error creating temporary file"), i18n.tr("JHylaFAX Error"), e); return null; } // TODO use FileHelper.copy() and display progress try { BufferedInputStream in = new BufferedInputStream(System.in); try { BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(tempFile)); try { byte[] buf = new byte[BUFFER_SIZE]; while (true) { int bytesRead = in.read(buf); if (bytesRead <= 0) { break; } out.write(buf, 0, bytesRead); } } finally { out.close(); } } finally { in.close(); } } catch (IOException e) { logger.debug("Error creating temporary file", e); ErrorDialog.showError(JHylaFAX.getInstance(), i18n.tr("Error creating temporary file"), i18n.tr("JHylaFAX Error"), e); return null; } return tempFile; } public void updateTables() { updateTables(JobHelper.updateStatus()); } public void updateTables(StatusResponse response) { jobQueue.setLastUpdate(System.currentTimeMillis()); if (response != null) { updateServerInfo(); statusLabel.setText(response.status); statusLabel.setToolTipText("<html><pre><b>" + response.verboseStatus + "</b></pre>"); recvqPanel.setData(response.recvq); sendqPanel.setData(response.sendq); pollqPanel.setData(response.pollq); doneqPanel.setData(response.doneq); docqPanel.setData(response.docq); } } private class AboutAction extends AbstractXNapAction { private AboutDialog dialog; public AboutAction() { putValue(ICON_FILENAME, "jhylafax.png"); } public void actionPerformed(ActionEvent e) { if (dialog == null) { dialog = new AboutDialog(); dialog.setTitle(i18n.tr("About JHylaFax {0}", getVersion())); dialog.setLocationRelativeTo(JHylaFAX.this); dialog.addHTMLTab(i18n.tr("General Information"), "about.html", true); JTextArea textArea = dialog.addTab(i18n.tr("License"), "LICENSE.jhylafax"); textArea.setFont(new Font("Monospaced", Font.PLAIN, 10)); dialog.addHTMLTab(i18n.tr("3rd Party Software"), "LICENSE.other.html", true); dialog.getTabbedPane().setSelectedIndex(0); } if (!dialog.isVisible()) { dialog.setVisible(true); } } } private class AddressBookAction extends AbstractXNapAction { public AddressBookAction() { putValue(ICON_FILENAME, "contents.png"); } public void actionPerformed(ActionEvent e) { getAddressBook().setVisible(true); } } private class SendAction extends AbstractXNapAction { public SendAction() { putValue(ICON_FILENAME, "mail_new.png"); } public void actionPerformed(ActionEvent e) { SendDialog dialog = new SendDialog(JHylaFAX.this); dialog.setLocationRelativeTo(JHylaFAX.this); dialog.setVisible(true); } } private class PollAction extends AbstractXNapAction { public PollAction() { putValue(ICON_FILENAME, "mail_get.png"); } public void actionPerformed(ActionEvent e) { PollDialog dialog = new PollDialog(JHylaFAX.this); dialog.setLocationRelativeTo(JHylaFAX.this); dialog.setVisible(true); } } private class SettingsDialogAction extends AbstractXNapAction implements LocaleChangeListener { private SettingsDialog dialog; public SettingsDialogAction() { putValue(ICON_FILENAME, "configure.png"); } public void updateLabels() { if (dialog != null) { dialog.updateLabels(); } } public void actionPerformed(ActionEvent e) { if (dialog == null) { dialog = new SettingsDialog(JHylaFAX.this); dialog.setLocationRelativeTo(JHylaFAX.this); } if (!dialog.isVisible()) { dialog.revert(); dialog.setVisible(true); } } } private class SettingsWizardAction extends AbstractXNapAction implements LocaleChangeListener { public SettingsWizardAction() { putValue(ICON_FILENAME, "wizard.png"); } public void updateLabels() { } public void actionPerformed(ActionEvent e) { SettingsWizard wizard = new SettingsWizard(JHylaFAX.this); wizard.setLocationRelativeTo(JHylaFAX.this); wizard.setVisible(true); } } private class ExitAction extends AbstractXNapAction { public ExitAction() { putValue(ICON_FILENAME, "exit.png"); } public void actionPerformed(ActionEvent e) { exit(); } } private class UpdateStatusAction extends AbstractXNapAction { public UpdateStatusAction() { putValue(ICON_FILENAME, "reload.png"); } public void actionPerformed(ActionEvent e) { updateTables(); } } private class ConnectionHandler implements ConnectionListener { public void connectionOpened(ConnectionEvent event) { logger.info("Connected to " + event.getRemoteInetAddress().getHostAddress() + ":" + event.getRemotePort()); } public void connectionClosed(ConnectionEvent event) { logger.info("Disconnected from " + event.getRemoteInetAddress().getHostAddress() + ":" + event.getRemotePort()); connection.removeConnectionListener(this); connection = null; } public void connectionFailed(Exception e) { logger.info("Connection failed", e); connection.removeConnectionListener(this); connection = null; } } public AddressBook getAddressBook() { if (addressBook == null) { addressBook = new AddressBook(); //addressBook.setLocationRelativeTo(JHylaFAX.this); addressBook.restoreLayout(new SettingStore(Settings.backstore)); try { addressBookFile = getAddressBookFile(); if (addressBookFile.exists()) { addressBook.load(addressBookFile); } } catch (Exception e) { logger.debug("Error loading addressbook", e); ErrorDialog.showError(JHylaFAX.this, i18n.tr("Could not load addressbook"), i18n.tr("JHylaFAX Error"), e); } } return addressBook; } public void showError(String message, Exception e) { ErrorDialog.showError(this, message, i18n.tr("JHylaFAX Error"), e); } public void showError(String message) { Dialogs.showError(this, message, i18n.tr("JHylaFAX Error")); } public void resetAllTables() { recvqPanel.resetTable(); sendqPanel.resetTable(); pollqPanel.resetTable(); doneqPanel.resetTable(); docqPanel.resetTable(); } public void runNotification(Notification notification) { jobQueue.addNotification(notification); } public void settingsUpdated() { notificationTimer.settingsUpdated(); } public synchronized static String getVersion() { if (version == null) { try { InputStream in = JHylaFAX.class.getResourceAsStream("version.properties"); try { Properties p = new Properties(); p.load(in); version = p.getProperty("jhylafax.version", ""); } finally { in.close(); } } catch (IOException e) { logger.debug("Error loading version properties", e); } } return version; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -