Author: jflesch
Date: 2007-12-15 00:30:14 +0000 (Sat, 15 Dec 2007)
New Revision: 16556
Added:
trunk/apps/Thaw/src/thaw/plugins/miniFrost/Outbox.java
Modified:
trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
trunk/apps/Thaw/src/thaw/i18n/thaw.properties
trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
trunk/apps/Thaw/src/thaw/plugins/miniFrost/BoardTree.java
trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessagePanel.java
trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostPanel.java
trunk/apps/Thaw/src/thaw/plugins/miniFrost/SentMessages.java
trunk/apps/Thaw/src/thaw/plugins/miniFrost/SpecialBoardFactory.java
trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKDraft.java
trunk/apps/Thaw/src/thaw/plugins/miniFrost/interfaces/Draft.java
Log:
Add a new special board in minifrost displaying messages being sent
Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-12-15
00:16:43 UTC (rev 16555)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-12-15
00:30:14 UTC (rev 16556)
@@ -658,7 +658,7 @@
thaw.plugin.miniFrost.actions=[ACTIONS]
thaw.plugin.miniFrost.collision=Collision au moment de l'insertion d'un
message sur la board 'X'.\n Nouvel essai sur un nouveau slot.
-thaw.plugin.miniFrost.outBox=[en cours d'envoi]
+thaw.plugin.miniFrost.outbox=[en cours d'envoi]
thaw.plugin.miniFrost.sentBox=[envoy?s]
thaw.plugin.miniFrost.attachBoards=Attacher des boards
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-12-15 00:16:43 UTC
(rev 16555)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-12-15 00:30:14 UTC
(rev 16556)
@@ -673,7 +673,7 @@
thaw.plugin.miniFrost.actions=[ACTIONS]
thaw.plugin.miniFrost.collision=Collision while inserting a message for the
board 'X'.\n Will try with another slot.
-thaw.plugin.miniFrost.outBox=[outbox]
+thaw.plugin.miniFrost.outbox=[outbox]
thaw.plugin.miniFrost.sentBox=[sent]
thaw.plugin.miniFrost.attachBoards=Attach board(s)
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-12-15 00:16:43 UTC
(rev 16555)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-12-15 00:30:14 UTC
(rev 16556)
@@ -658,7 +658,7 @@
thaw.plugin.miniFrost.actions=[ACTIONS]
thaw.plugin.miniFrost.collision=Collision au moment de l'insertion d'un
message sur la board 'X'.\n Nouvel essai sur un nouveau slot.
-thaw.plugin.miniFrost.outBox=[en cours d'envoi]
+thaw.plugin.miniFrost.outbox=[en cours d'envoi]
thaw.plugin.miniFrost.sentBox=[envoy\u00e9s]
thaw.plugin.miniFrost.attachBoards=Attacher des boards
Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/BoardTree.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/BoardTree.java 2007-12-15
00:16:43 UTC (rev 16555)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/BoardTree.java 2007-12-15
00:30:14 UTC (rev 16556)
@@ -356,15 +356,15 @@
Board b = ((Board)list.getSelectedValue());
- if (b == currentlySelected)
- return;
-
- currentlySelected = b;
-
for (Iterator it = actions.iterator();
it.hasNext();) {
((BoardManagementHelper.BoardAction)it.next()).setTarget(b);
}
+
+ if (b == currentlySelected)
+ return;
+
+ currentlySelected = b;
setChanged();
notifyObservers(b);
Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessagePanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessagePanel.java
2007-12-15 00:16:43 UTC (rev 16555)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/MessagePanel.java
2007-12-15 00:30:14 UTC (rev 16556)
@@ -283,9 +283,14 @@
/* it's dirty, but it should work */
JPanel iPanel = null;
+
+ String rev = "";
+ if (msg.getRev() >= 0)
+ rev = " [r"+Integer.toString(msg.getRev())+"]";
+
subject.setText(I18n.getMessage("thaw.plugin.miniFrost.subject")+":
"+msg.getSubject()+
- " [r"+Integer.toString(msg.getRev())+"]");
+ rev);
Logger.info(this, "Displaying
"+Integer.toString(subMsgs.size())+" sub-msgs");
Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostPanel.java
2007-12-15 00:16:43 UTC (rev 16555)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostPanel.java
2007-12-15 00:30:14 UTC (rev 16556)
@@ -276,6 +276,10 @@
boardTree.updateDraftValues(waitings, postings);
}
+
+ public Vector getDrafts() {
+ return drafts;
+ }
public boolean isInGmailView() {
return gmailView;
Added: trunk/apps/Thaw/src/thaw/plugins/miniFrost/Outbox.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/Outbox.java
(rev 0)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/Outbox.java 2007-12-15
00:30:14 UTC (rev 16556)
@@ -0,0 +1,221 @@
+package thaw.plugins.miniFrost;
+
+import java.util.Vector;
+import java.util.Iterator;
+
+import thaw.plugins.MiniFrost;
+import thaw.plugins.miniFrost.interfaces.Author;
+import thaw.plugins.miniFrost.interfaces.Board;
+import thaw.plugins.miniFrost.interfaces.Draft;
+import thaw.plugins.miniFrost.interfaces.Message;
+import thaw.plugins.signatures.Identity;
+import thaw.core.I18n;
+
+
+public class Outbox implements Board {
+
+ private MiniFrost miniFrost;
+
+ public Outbox(MiniFrost miniFrost) {
+ this.miniFrost = miniFrost;
+ }
+
+ public boolean destroy() {
+ /* just can't */
+ return false;
+ }
+
+ public Draft getDraft(Message inReplyTo) {
+ /* just can't */
+ return null;
+ }
+
+ private static class DraftAuthorShell implements
thaw.plugins.miniFrost.interfaces.Author {
+ private Draft draft;
+
+ public DraftAuthorShell(Draft draft) {
+ this.draft = draft;
+ }
+
+ public Identity getIdentity() {
+ return draft.getAuthorIdentity();
+ }
+
+ public String toString() {
+ return draft.getAuthorNick();
+ }
+
+ public String toString(boolean noDup) {
+ return toString();
+ }
+ }
+
+ private static class DraftSubMessageShell implements
thaw.plugins.miniFrost.interfaces.SubMessage {
+ private Draft draft;
+
+ public DraftSubMessageShell(Draft draft) {
+ this.draft = draft;
+ }
+
+ public Author getAuthor() {
+ return new DraftAuthorShell(draft);
+ }
+
+ public java.util.Date getDate() {
+ return draft.getDate();
+ }
+
+ public String getMessage() {
+ return draft.getText();
+ }
+ }
+
+ private static class DraftShell implements
thaw.plugins.miniFrost.interfaces.Message {
+ private Draft draft;
+
+ public DraftShell(Draft draft) {
+ this.draft = draft;
+ }
+
+ public String getMsgId() {
+ return "kwain.net";
+ }
+
+ public String getInReplyToId() {
+ return null;
+ }
+
+ public String getSubject() {
+ return draft.getSubject();
+ }
+
+ public Author getSender() {
+ return new DraftAuthorShell(draft);
+ }
+
+ public java.util.Date getDate() {
+ return draft.getDate();
+ }
+
+ /**
+ * @return < 0 if must not be displayed
+ */
+ public int getRev() {
+ return -1;
+ }
+
+ public boolean isArchived() {
+ return false;
+ }
+
+ public boolean isRead() {
+ return true;
+ }
+
+ public Identity encryptedFor() {
+ return null;
+ }
+
+ public void setRead(boolean read) {
+ /* ni ! */
+ }
+
+ public void setArchived(boolean archived) {
+ /* ni ! */
+ }
+
+ public Board getBoard() {
+ return draft.getBoard();
+ }
+
+ /**
+ * SubMessage vector. (Don't store / cache !)
+ */
+ public Vector getSubMessages() {
+ Vector v = new Vector();
+ v.add(new DraftSubMessageShell(draft));
+ return v;
+ }
+
+ /**
+ * @return null if none
+ */
+ public Vector getAttachments() {
+ return draft.getAttachments();
+ }
+
+ public boolean equals(Object o) {
+ return (o == this);
+ }
+
+ public int compareTo(Object o) {
+ if (getDate() == null && ((Message)o).getDate() != null)
+ return -1;
+
+ if (getDate() != null && ((Message)o).getDate() == null)
+ return 1;
+
+ if (getDate() == null && ((Message)o).getDate() == null)
+ return 0;
+
+ int c = getDate().compareTo( ((Message)o).getDate());
+
+ return -1 * c;
+ }
+ }
+
+ public Vector getMessages(String[] keywords, int orderBy, boolean desc,
+ boolean archived, boolean read, boolean unsigned, int
minTrustLevel) {
+
+ Vector drafts = miniFrost.getPanel().getDrafts();
+ Vector msgs = new Vector();
+
+ if (drafts == null)
+ return msgs;
+
+ for (Iterator it = drafts.iterator();
+ it.hasNext();) {
+ Draft draft = (Draft)it.next();
+ msgs.add(new DraftShell(draft));
+ }
+
+ return msgs;
+ }
+
+ public String getName() {
+ return I18n.getMessage("thaw.plugin.miniFrost.outbox");
+ }
+
+ public int getNewMessageNumber(boolean unsigned, boolean archived, int
minTrustLevel) {
+ Vector drafts = miniFrost.getPanel().getDrafts();
+
+ return ((drafts == null) ? 0 : drafts.size());
+ }
+
+ public Message getNextUnreadMessage(boolean unsigned, boolean archived,
+ int minTrustLevel) {
+ /* always */
+ return null;
+ }
+
+ public boolean isRefreshing() {
+ /* never refreshing */
+ return false;
+ }
+
+ public void refresh() {
+ /* can't */
+ }
+
+ public int compareTo(Object arg0) {
+ return -1;
+ }
+
+ public boolean equals(Object o) {
+ return false;
+ }
+
+ public String toString() {
+ return getName();
+ }
+}
Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/SentMessages.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/SentMessages.java
2007-12-15 00:16:43 UTC (rev 16555)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/SentMessages.java
2007-12-15 00:30:14 UTC (rev 16556)
@@ -62,6 +62,7 @@
* @return null if none
*/
public Message getNextUnreadMessage(boolean unsigned, boolean archived,
int minTrustLevel) {
+ /* always */
return null;
}
Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/SpecialBoardFactory.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/SpecialBoardFactory.java
2007-12-15 00:16:43 UTC (rev 16555)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/SpecialBoardFactory.java
2007-12-15 00:30:14 UTC (rev 16556)
@@ -40,6 +40,7 @@
Vector v = new Vector();
v.add(new SentMessages(miniFrost));
+ v.add(new Outbox(miniFrost));
return v;
}
Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKDraft.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKDraft.java
2007-12-15 00:16:43 UTC (rev 16555)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKDraft.java
2007-12-15 00:30:14 UTC (rev 16556)
@@ -104,6 +104,10 @@
public void setDate(Date date) {
this.date = date;
}
+
+ public Date getDate() {
+ return date;
+ }
private java.io.File fileToInsert;
Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/interfaces/Draft.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/miniFrost/interfaces/Draft.java
2007-12-15 00:16:43 UTC (rev 16555)
+++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/interfaces/Draft.java
2007-12-15 00:30:14 UTC (rev 16556)
@@ -40,6 +40,7 @@
* @param date the date provided is already GMT-ized
*/
public void setDate(java.util.Date date);
+ public java.util.Date getDate();
/**
* @param i specify the position of the id line in the text