コード例 #1
0
 @Override
 protected Void doInBackground() {
   try {
     publish("Retrieving and decrypting mail list");
     String myMailboxName = Configuration.getMyMailboxName();
     if (myMailboxName != null) {
       TotalListItem[] listItems = WebServiceClient.getMailList(myMailboxName);
       for (TotalListItem item : listItems) {
         // decrypt them now, object will cache decrypted--doing it for the side effect
         item.getEncryptedListItem(Configuration.getMyPrivateKey());
       }
       ListMailController.this.model.setItems(listItems);
       publish("Mail list ready.");
       return null;
     }
     publish("No mailbox currently selected");
     ListMailController.this.model.clearItems();
     return null;
   } catch (CommunicationFailureException e) {
     publish(Utils.ppStackTrace(e));
     return null;
   } catch (FailedCryptException | JavaInstallationMissingComponentsException e) {
     publish(Utils.ppStackTrace(e));
     return null;
   } catch (RuntimeException e) {
     System.out.println(Utils.ppStackTrace(e));
     return null;
   }
 }
コード例 #2
0
    @Override
    public void itemStateChanged(ItemEvent e) {
      if (ListMailController.this.view.getCurrentHost() != null
          && !ListMailController.this
              .view
              .getCurrentHost()
              .equalsIgnoreCase(Configuration.getCurrentHost())) {
        if (ListMailController.this.view.getCurrentHost() != null) {
          Configuration.setCurrentHost(ListMailController.this.view.getCurrentHost());
        }

        for (MailboxNameChangeListener listener : ListMailController.this.nameChangeListeners) {
          listener.nameChanged(new NameChangeEvent(Configuration.getMyMailboxName()));
        }
        (new RefreshListWorker()).execute();
        try {
          MailboxCache.loadAllMailboxesFromServer();
        } catch (IOException
            | JavaInstallationMissingComponentsException
            | FailedCryptException
            | InvalidSignatureException
            | CommunicationFailureException e1) {
          ListMailController.this.view.setInfo(Utils.ppStackTrace(e1));
        }
      }
    }
コード例 #3
0
 @Override
 public void actionPerformed(ActionEvent e) {
   try {
     int selectedRow = ListMailController.this.view.getSelectedRow();
     if (-1 == selectedRow) {
       return;
     }
     int result =
         JOptionPane.showConfirmDialog(
             ListMailController.this.view,
             String.format("Are you sure you want to delete this mail?"),
             "Confirm",
             JOptionPane.YES_NO_OPTION);
     if (result == JOptionPane.YES_OPTION) {
       TotalListItem item = ListMailController.this.model.getItemAtRow(selectedRow);
       EncryptedListItem decryptedItem =
           item.getEncryptedListItem(
               null); // was already decrypted and cached, don't need private key
       WebServiceClient.deleteMessage(item.getId(), decryptedItem.getAttachments());
       new RefreshListWorker().execute();
     }
   } catch (IOException
       | FailedCryptException
       | JavaInstallationMissingComponentsException
       | IllegalStateException
       | CommunicationFailureException e1) {
     ListMailController.this.view.setInfo(Utils.ppStackTrace(e1));
   }
 }
コード例 #4
0
 @Override
 public void actionPerformed(ActionEvent e) {
   try {
     readMail();
   } catch (IOException
       | FailedCryptException
       | JavaInstallationMissingComponentsException
       | IllegalStateException
       | CommunicationFailureException
       | InvalidSignatureException e1) {
     ListMailController.this.view.setInfo(Utils.ppStackTrace(e1));
   }
 }
コード例 #5
0
 @Override
 public void mouseClicked(MouseEvent evt) {
   if (evt.getClickCount() == 2) {
     try {
       readMail();
     } catch (IllegalStateException
         | FailedCryptException
         | JavaInstallationMissingComponentsException
         | IOException
         | CommunicationFailureException
         | InvalidSignatureException e) {
       ListMailController.this.view.setInfo(Utils.ppStackTrace(e));
     }
   }
 }