From 988e3aea716c5c5ee31a8030a50e513b9f2e7275 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 2 Sep 2008 13:28:51 +0000 Subject: Client: Added the ability to disable Unread Refs #49 --- .../fourisland/instadisc/AdvancedSettingsForm.form | 46 +++++++++++++++--- .../fourisland/instadisc/AdvancedSettingsForm.java | 45 ++++++++++++++--- .../com/fourisland/instadisc/FirstRun/Step2.java | 1 + .../instadisc/IDItemListCellRenderer.java | 5 +- .../com/fourisland/instadisc/InstaDiscView.form | 3 ++ .../com/fourisland/instadisc/InstaDiscView.java | 56 ++++++++++++++++------ .../fourisland/instadisc/UnreadFlagPopupMenu.java | 1 - .../resources/AdvancedSettingsForm.properties | 3 ++ 8 files changed, 128 insertions(+), 32 deletions(-) (limited to 'client/trunk/src/com') diff --git a/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.form b/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.form index f561077..7dcc441 100644 --- a/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.form +++ b/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.form @@ -28,6 +28,10 @@ + + + + @@ -64,16 +68,21 @@ + + + + + - - - - + + + + @@ -107,10 +116,17 @@ - + + + + + + + + - + @@ -200,5 +216,23 @@ + + + + + + + + + + + + + + + + + + diff --git a/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.java b/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.java index 597aca8..98ae88b 100644 --- a/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.java +++ b/client/trunk/src/com/fourisland/instadisc/AdvancedSettingsForm.java @@ -47,6 +47,8 @@ public class AdvancedSettingsForm extends javax.swing.JDialog { } else { jComboBox1.setSelectedIndex(1); } + + jCheckBox1.setSelected(Wrapper.getConfig("useUnreadFlag").equals("true")); } /** This method is called from within the constructor to @@ -70,6 +72,9 @@ public class AdvancedSettingsForm extends javax.swing.JDialog { jSpinner3 = new javax.swing.JSpinner(); jComboBox1 = new javax.swing.JComboBox(); jLabel8 = new javax.swing.JLabel(); + jLabel9 = new javax.swing.JLabel(); + jCheckBox1 = new javax.swing.JCheckBox(); + jLabel10 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setName("Form"); // NOI18N @@ -117,6 +122,15 @@ public class AdvancedSettingsForm extends javax.swing.JDialog { jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N jLabel8.setName("jLabel8"); // NOI18N + jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N + jLabel9.setName("jLabel9"); // NOI18N + + jCheckBox1.setText(resourceMap.getString("jCheckBox1.text")); // NOI18N + jCheckBox1.setName("jCheckBox1"); // NOI18N + + jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N + jLabel10.setName("jLabel10"); // NOI18N + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -126,6 +140,9 @@ public class AdvancedSettingsForm extends javax.swing.JDialog { .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(36, 36, 36) .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGap(36, 36, 36) + .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(36, 36, 36) .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)) @@ -153,13 +170,17 @@ public class AdvancedSettingsForm extends javax.swing.JDialog { .addGroup(layout.createSequentialGroup() .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jSpinner2, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)))) - .addGroup(layout.createSequentialGroup() - .addContainerGap(341, Short.MAX_VALUE) - .addComponent(jButton1)) + .addComponent(jSpinner2, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel9) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jCheckBox1)))) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(36, 36, 36) - .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 351, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 351, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addContainerGap(341, Short.MAX_VALUE) + .addComponent(jButton1))) .addContainerGap()) ); layout.setVerticalGroup( @@ -187,10 +208,16 @@ public class AdvancedSettingsForm extends javax.swing.JDialog { .addComponent(jSpinner3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel9) + .addComponent(jCheckBox1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton1) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) ); pack(); @@ -201,6 +228,7 @@ public class AdvancedSettingsForm extends javax.swing.JDialog { Wrapper.setConfig("verIDBufferSize", ((Integer) jSpinner2.getValue()).toString()); Wrapper.setConfig("ipCheckValue", ((Integer) jSpinner3.getValue()).toString()); Wrapper.setConfig("ipCheckUnit", (String) jComboBox1.getSelectedItem()); + Wrapper.setConfig("useUnreadFlag", ((Boolean) jCheckBox1.isSelected()).toString()); ((InstaDiscView) InstaDiscApp.getApplication().getMainView()).updateTimer(); @@ -226,8 +254,10 @@ public class AdvancedSettingsForm extends javax.swing.JDialog { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; + private javax.swing.JCheckBox jCheckBox1; private javax.swing.JComboBox jComboBox1; private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; @@ -235,6 +265,7 @@ public class AdvancedSettingsForm extends javax.swing.JDialog { private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; + private javax.swing.JLabel jLabel9; private javax.swing.JSpinner jSpinner1; private javax.swing.JSpinner jSpinner2; private javax.swing.JSpinner jSpinner3; diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java index 7133f6f..e327271 100644 --- a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java @@ -170,6 +170,7 @@ public class Step2 extends javax.swing.JDialog { Wrapper.setConfig("nextFilterID", "0"); Wrapper.setConfig("ipCheckValue", "1"); Wrapper.setConfig("ipCheckUnit", "day"); + Wrapper.setConfig("useUnreadFlag", "true"); Wrapper.setConfig("initCheck", "done"); StepEndResults.ok = true; diff --git a/client/trunk/src/com/fourisland/instadisc/IDItemListCellRenderer.java b/client/trunk/src/com/fourisland/instadisc/IDItemListCellRenderer.java index dd14b21..20bb76e 100644 --- a/client/trunk/src/com/fourisland/instadisc/IDItemListCellRenderer.java +++ b/client/trunk/src/com/fourisland/instadisc/IDItemListCellRenderer.java @@ -32,8 +32,7 @@ public class IDItemListCellRenderer extends JLabel implements ListCellRenderer { { this.setText("" + Wrapper.getSubscription(item.getSubscription()).getTitle() + ", " + item.getTitle() + " by " + item.getAuthor()); } - - if (item.getUnread()) + if ((Wrapper.getConfig("useUnreadFlag").equals("true")) && (item.getUnread())) { this.setText(this.getText() + "
New at " + new SimpleDateFormat("EEEE, MMMM d yyyy k:mm aa").format(item.getRecieved())); } @@ -46,7 +45,7 @@ public class IDItemListCellRenderer extends JLabel implements ListCellRenderer { { this.setForeground(arg0.getForeground()); - if (item.getUnread()) + if ((Wrapper.getConfig("useUnreadFlag").equals("true")) && (item.getUnread())) { this.setBackground(java.awt.Color.yellow); } else diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form index c08ee2f..f570bb8 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.form @@ -110,6 +110,9 @@ + + + diff --git a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java index 3448197..24364b4 100644 --- a/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java +++ b/client/trunk/src/com/fourisland/instadisc/InstaDiscView.java @@ -233,6 +233,15 @@ public class InstaDiscView extends FrameView { jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N jMenu1.setName("jMenu1"); // NOI18N + jMenu1.addMenuListener(new javax.swing.event.MenuListener() { + public void menuCanceled(javax.swing.event.MenuEvent evt) { + } + public void menuDeselected(javax.swing.event.MenuEvent evt) { + } + public void menuSelected(javax.swing.event.MenuEvent evt) { + jMenu1MenuSelected(evt); + } + }); jMenuItem7.setText(resourceMap.getString("jMenuItem7.text")); // NOI18N jMenuItem7.setName("jMenuItem7"); // NOI18N @@ -347,7 +356,11 @@ public class InstaDiscView extends FrameView { try { if (java.awt.Desktop.isDesktopSupported()) { - Wrapper.setUnreadFlagItem(item.getID(), false); + if (Wrapper.getConfig("useUnreadFlag").equals("true")) + { + Wrapper.setUnreadFlagItem(item.getID(), false); + } + refreshItemPane(); java.awt.Desktop.getDesktop().browse(new URI(item.getURL())); @@ -415,34 +428,47 @@ public class InstaDiscView extends FrameView { }//GEN-LAST:event_jMenuItem7ActionPerformed private void jList1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseReleased - int i = jList1.locationToIndex(evt.getPoint()); - if ((evt.isPopupTrigger()) && (i != -1)) + if (Wrapper.getConfig("useUnreadFlag").equals("true")) { - jList1.setSelectedIndex(i); - new UnreadFlagPopupMenu((Item) jList1.getSelectedValue()).show(jList1, evt.getX(), evt.getY()); + int i = jList1.locationToIndex(evt.getPoint()); + if ((evt.isPopupTrigger()) && (i != -1)) + { + jList1.setSelectedIndex(i); + new UnreadFlagPopupMenu((Item) jList1.getSelectedValue()).show(jList1, evt.getX(), evt.getY()); + } } }//GEN-LAST:event_jList1MouseReleased private void jList1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MousePressed - int i = jList1.locationToIndex(evt.getPoint()); - if ((evt.isPopupTrigger()) && (i != -1)) + if (Wrapper.getConfig("useUnreadFlag").equals("true")) { - jList1.setSelectedIndex(i); - new UnreadFlagPopupMenu((Item) jList1.getSelectedValue()).show(jList1, evt.getX(), evt.getY()); + int i = jList1.locationToIndex(evt.getPoint()); + if ((evt.isPopupTrigger()) && (i != -1)) + { + jList1.setSelectedIndex(i); + new UnreadFlagPopupMenu((Item) jList1.getSelectedValue()).show(jList1, evt.getX(), evt.getY()); + } } }//GEN-LAST:event_jList1MousePressed private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed - Item[] items = Wrapper.getAllItem(); - int i = 0; - for (i=0; i < items.length; i++) + if (Wrapper.getConfig("useUnreadFlag").equals("true")) { - Wrapper.setUnreadFlagItem(items[i].getID(), false); - } + Item[] items = Wrapper.getAllItem(); + int i = 0; + for (i=0; i < items.length; i++) + { + Wrapper.setUnreadFlagItem(items[i].getID(), false); + } - refreshItemPane(); + refreshItemPane(); + } }//GEN-LAST:event_jMenuItem8ActionPerformed + private void jMenu1MenuSelected(javax.swing.event.MenuEvent evt) {//GEN-FIRST:event_jMenu1MenuSelected + jMenuItem8.setEnabled(Wrapper.getConfig("useUnreadFlag").equals("true")); + }//GEN-LAST:event_jMenu1MenuSelected + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JList jList1; private javax.swing.JMenu jMenu1; diff --git a/client/trunk/src/com/fourisland/instadisc/UnreadFlagPopupMenu.java b/client/trunk/src/com/fourisland/instadisc/UnreadFlagPopupMenu.java index 25cca54..673524b 100644 --- a/client/trunk/src/com/fourisland/instadisc/UnreadFlagPopupMenu.java +++ b/client/trunk/src/com/fourisland/instadisc/UnreadFlagPopupMenu.java @@ -4,7 +4,6 @@ import com.fourisland.instadisc.Database.Item; import com.fourisland.instadisc.Database.Wrapper; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.JList; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; diff --git a/client/trunk/src/com/fourisland/instadisc/resources/AdvancedSettingsForm.properties b/client/trunk/src/com/fourisland/instadisc/resources/AdvancedSettingsForm.properties index e05a8fb..44a1ff2 100644 --- a/client/trunk/src/com/fourisland/instadisc/resources/AdvancedSettingsForm.properties +++ b/client/trunk/src/com/fourisland/instadisc/resources/AdvancedSettingsForm.properties @@ -9,3 +9,6 @@ jLabel6.text=If this is a higher value, less viral Items will get in, but jButton1.text=Done jLabel7.text=IP Timer Interval: jLabel8.text=This is how often InstaDisc contacts the Central Server to see if your IP Address has changed. If your IP Address has changed and the Central Server doesn't know about it yet, you won't be able to recieve InstaDisc Items. +jLabel9.text=Use Unread Flag? +jCheckBox1.text= +jLabel10.text=If this is checked, all incoming items will automatically be marked as read. -- cgit 1.4.1