diff options
author | Yana Stamcheva <yana@jitsi.org> | 2011-01-27 12:37:06 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2011-01-27 12:37:06 +0000 |
commit | eff3452de89ce845b0da5eda71f3ec0380d8bcee (patch) | |
tree | 7e02547c93792ef4292d2641bb412ba7a8979c19 /src | |
parent | b8960fe67b8d7ef8a4ea792a1894d9799ffd2765 (diff) | |
download | jitsi-eff3452de89ce845b0da5eda71f3ec0380d8bcee.zip jitsi-eff3452de89ce845b0da5eda71f3ec0380d8bcee.tar.gz jitsi-eff3452de89ce845b0da5eda71f3ec0380d8bcee.tar.bz2 |
Fixes disappearing call history on search in the contact list.
Call history records shown last.
Diffstat (limited to 'src')
16 files changed, 133 insertions, 21 deletions
diff --git a/src/net/java/sip/communicator/impl/callhistory/CallHistoryContactSource.java b/src/net/java/sip/communicator/impl/callhistory/CallHistoryContactSource.java index ac03042..91c3373 100644 --- a/src/net/java/sip/communicator/impl/callhistory/CallHistoryContactSource.java +++ b/src/net/java/sip/communicator/impl/callhistory/CallHistoryContactSource.java @@ -117,6 +117,9 @@ public class CallHistoryContactSource implements ContactSourceService { public void callRecordReceived(CallRecordEvent event) { + if (getStatus() == ContactQuery.QUERY_CANCELED) + return; + SourceContact contact = new CallHistorySourceContact( CallHistoryContactSource.this, event.getCallRecord()); @@ -131,6 +134,17 @@ public class CallHistoryContactSource implements ContactSourceService fireQueryStatusEvent(status); } }); + + Iterator<CallRecord> callRecords + = callHistoryQuery.getCallRecords().iterator(); + + while (callRecords.hasNext()) + { + SourceContact contact = new CallHistorySourceContact( + CallHistoryContactSource.this, + callRecords.next()); + sourceContacts.add(contact); + } } /** @@ -240,6 +254,11 @@ public class CallHistoryContactSource implements ContactSourceService for (ContactQueryListener l : listeners) l.queryStatusChanged(event); } + + public String getQueryString() + { + return callHistoryQuery.getQueryString(); + } } /** diff --git a/src/net/java/sip/communicator/impl/callhistory/CallHistoryQueryImpl.java b/src/net/java/sip/communicator/impl/callhistory/CallHistoryQueryImpl.java index 5ee98a2..b2b0ceb 100644 --- a/src/net/java/sip/communicator/impl/callhistory/CallHistoryQueryImpl.java +++ b/src/net/java/sip/communicator/impl/callhistory/CallHistoryQueryImpl.java @@ -12,6 +12,7 @@ import net.java.sip.communicator.service.callhistory.*; import net.java.sip.communicator.service.callhistory.event.*; import net.java.sip.communicator.service.history.*; import net.java.sip.communicator.service.history.event.*; +import net.java.sip.communicator.service.history.records.*; /** * @@ -53,6 +54,18 @@ public class CallHistoryQueryImpl fireQueryStatusEvent(event.getEventType()); } }); + + Iterator<HistoryRecord> historyRecords + = historyQuery.getHistoryRecords().iterator(); + + while (historyRecords.hasNext()) + { + CallRecord callRecord + = CallHistoryServiceImpl.convertHistoryRecordToCallRecord( + historyRecords.next()); + + callRecords.add(callRecord); + } } /** @@ -142,4 +155,14 @@ public class CallHistoryQueryImpl } } } + + /** + * Returns the query string, this query was created for. + * + * @return the query string, this query was created for + */ + public String getQueryString() + { + return historyQuery.getQueryString(); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/CallHistoryFilter.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/CallHistoryFilter.java index 267d4c5..9a59d0c 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/CallHistoryFilter.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/CallHistoryFilter.java @@ -125,7 +125,8 @@ public class CallHistoryFilter GuiActivator.getContactList() .addContact(uiSource.createUIContact(contactsIter.next()), uiSource.getUIGroup(), - false); + false, + true); } } @@ -151,7 +152,8 @@ public class CallHistoryFilter GuiActivator.getContactList() .addContact(notfications.next(), uiGroup, - false); + false, + true); } } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/PresenceFilter.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/PresenceFilter.java index 4cf5cd7..a79bd2f 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/PresenceFilter.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/PresenceFilter.java @@ -214,6 +214,7 @@ public class PresenceFilter GuiActivator.getContactList().addContact( MetaContactListSource.createUIContact(metaContact), uiGroup, + true, true); query.setInitialResultCount(resultCount); diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFilter.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFilter.java index 1ddd0c5..a4fbcda 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFilter.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFilter.java @@ -252,7 +252,8 @@ public class SearchFilter GuiActivator.getContactList().addContact( sourceUI.createUIContact(sourceContact), sourceUI.getUIGroup(), - false); + false, + true); } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java index a46b98d..36741cc 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java @@ -218,7 +218,7 @@ public class TreeContactList .createUIGroup(parentGroup); } - addContact(uiContact, uiGroup, true); + addContact(uiContact, uiGroup, true, true); } else MetaContactListSource.removeUIContact(metaContact); @@ -351,7 +351,7 @@ public class TreeContactList } if (currentFilter.isMatching(uiContact)) - addContact(uiContact, newUIGroup, true); + addContact(uiContact, newUIGroup, true, true); else MetaContactListSource.removeUIContact(metaContact); } @@ -446,7 +446,7 @@ public class TreeContactList .createUIGroup(parentGroup); } - addContact(uiContact, uiGroup, true); + addContact(uiContact, uiGroup, true, true); } else MetaContactListSource.removeUIContact(metaContact); @@ -520,7 +520,7 @@ public class TreeContactList .createUIGroup(parentGroup); } - addContact(newUIContact, uiGroup, true); + addContact(newUIContact, uiGroup, true, true); } else MetaContactListSource.removeUIContact(newParent); @@ -731,12 +731,16 @@ public class TreeContactList * Adds the given <tt>contact</tt> to this list. * @param contact the <tt>UIContact</tt> to add * @param group the <tt>UIGroup</tt> to add to - * @param isSorted indicates if the contact should be sorted regarding to - * the <tt>GroupNode</tt> policy + * @param isContactSorted indicates if the contact should be sorted + * regarding to the <tt>GroupNode</tt> policy + * @param isGroupSorted indicates if the group should be sorted regarding to + * the <tt>GroupNode</tt> policy in case it doesn't exist and should be + * added */ public void addContact( final UIContact contact, final UIGroup group, - final boolean isSorted) + final boolean isContactSorted, + final boolean isGroupSorted) { if (!SwingUtilities.isEventDispatchThread()) { @@ -744,7 +748,7 @@ public class TreeContactList { public void run() { - addContact(contact, group, isSorted); + addContact(contact, group, isContactSorted, isGroupSorted); } }); return; @@ -761,7 +765,7 @@ public class TreeContactList { GroupNode parentNode = treeModel.getRoot(); - if (isSorted) + if (isGroupSorted) groupNode = parentNode.sortedAddContactGroup(group); else { @@ -772,7 +776,7 @@ public class TreeContactList contact.setParentGroup(groupNode.getGroupDescriptor()); - if (isSorted) + if (isContactSorted) groupNode.sortedAddContact(contact); else groupNode.addContact(contact); @@ -804,7 +808,7 @@ public class TreeContactList // If in the meantime the corresponding query was canceled // we don't proceed with adding. if (query != null && !query.isCanceled()) - addContact(contact, group, isSorted); + addContact(contact, group, isSorted, true); } }); return; @@ -835,7 +839,7 @@ public class TreeContactList if (query != null && currentFilterQuery.containsQuery(query)) { - addContact(contact, group, isSorted); + addContact(contact, group, isSorted, true); } } }); @@ -2138,7 +2142,7 @@ public class TreeContactList if (logger.isInfoEnabled()) logger.info("Add matching contact due to status change: " + uiContact.getDisplayName()); - addContact(uiContact, uiGroup, true); + addContact(uiContact, uiGroup, true, true); } else MetaContactListSource diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ExternalContactSource.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ExternalContactSource.java index a8b48bc..acd33ff 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ExternalContactSource.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/ExternalContactSource.java @@ -121,7 +121,11 @@ public class ExternalContactSource */ public int getSourceIndex() { - return -1; + if (contactSource.getIdentifier() + .equals(ContactSourceService.CALL_HISTORY)) + return Integer.MAX_VALUE; + + return Integer.MAX_VALUE - 1; } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java index fc4afed..1565176 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaContactListSource.java @@ -207,6 +207,7 @@ public class MetaContactListSource GuiActivator.getContactList().addContact( MetaContactListSource.createUIContact(metaContact), uiGroup, + true, true); query.setInitialResultCount(resultCount); diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationContactSource.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationContactSource.java index 9f0f2a2..a4950fd 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationContactSource.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationContactSource.java @@ -8,11 +8,9 @@ package net.java.sip.communicator.impl.gui.main.contactlist.notifsource; import java.util.*; -import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.main.contactlist.*; import net.java.sip.communicator.service.protocol.OperationSetMessageWaiting.MessageType; import net.java.sip.communicator.service.protocol.event.*; -import net.java.sip.communicator.util.*; /** * The <tt>NotificationContactSource</tt> represents a contact source that would diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationGroup.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationGroup.java index a4b257e..8e32f41 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationGroup.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/notifsource/NotificationGroup.java @@ -237,7 +237,7 @@ public class NotificationGroup if (contactList.getCurrentFilter().isMatching(contact)) { if (isNew) - contactList.addContact(contact, this, true); + contactList.addContact(contact, this, true, true); else contactList.refreshContact(contact); } diff --git a/src/net/java/sip/communicator/impl/history/HistoryQueryImpl.java b/src/net/java/sip/communicator/impl/history/HistoryQueryImpl.java index ff5c47d..69beafc 100644 --- a/src/net/java/sip/communicator/impl/history/HistoryQueryImpl.java +++ b/src/net/java/sip/communicator/impl/history/HistoryQueryImpl.java @@ -40,6 +40,22 @@ public class HistoryQueryImpl implements HistoryQuery private boolean isCanceled = false; /** + * The query string we're looking for in this query. + */ + private final String queryString; + + /** + * Creates an instance of <tt>HistoryQueryImpl</tt> by specifying the query + * string it was created for. + * + * @param queryString the query string we're looking for in this query + */ + public HistoryQueryImpl(String queryString) + { + this.queryString = queryString; + } + + /** * Cancels this query. */ public void cancel() @@ -158,4 +174,14 @@ public class HistoryQueryImpl implements HistoryQuery } } } + + /** + * Returns the query string, this query was created for. + * + * @return the query string, this query was created for + */ + public String getQueryString() + { + return queryString; + } } diff --git a/src/net/java/sip/communicator/impl/history/InteractiveHistoryReaderImpl.java b/src/net/java/sip/communicator/impl/history/InteractiveHistoryReaderImpl.java index fca3999..be4c6cb 100644 --- a/src/net/java/sip/communicator/impl/history/InteractiveHistoryReaderImpl.java +++ b/src/net/java/sip/communicator/impl/history/InteractiveHistoryReaderImpl.java @@ -94,7 +94,11 @@ public class InteractiveHistoryReaderImpl final boolean caseSensitive, final int resultCount) { - final HistoryQueryImpl query = new HistoryQueryImpl(); + String queryString = ""; + for (String s : keywords) + queryString += " " + s; + + final HistoryQueryImpl query = new HistoryQueryImpl(queryString); new Thread() { diff --git a/src/net/java/sip/communicator/plugin/addrbook/AsyncContactQuery.java b/src/net/java/sip/communicator/plugin/addrbook/AsyncContactQuery.java index 77d4950..502a7d4 100644 --- a/src/net/java/sip/communicator/plugin/addrbook/AsyncContactQuery.java +++ b/src/net/java/sip/communicator/plugin/addrbook/AsyncContactQuery.java @@ -167,6 +167,16 @@ public abstract class AsyncContactQuery<T extends ContactSourceService> }
/**
+ * Returns the query string, this query was created for.
+ *
+ * @return the query string, this query was created for
+ */
+ public String getQueryString()
+ {
+ return query.toString();
+ }
+
+ /**
* Normalizes a <tt>String</tt> phone number by converting alpha characters
* to their respective digits on a keypad and then stripping non-digit
* characters.
diff --git a/src/net/java/sip/communicator/service/callhistory/CallHistoryQuery.java b/src/net/java/sip/communicator/service/callhistory/CallHistoryQuery.java index 82dba1a..1d872ee 100644 --- a/src/net/java/sip/communicator/service/callhistory/CallHistoryQuery.java +++ b/src/net/java/sip/communicator/service/callhistory/CallHistoryQuery.java @@ -25,6 +25,12 @@ public interface CallHistoryQuery public void cancel(); /** + * Returns the query string, this query was created for. + * @return the query string, this query was created for + */ + public String getQueryString(); + + /** * Returns a collection of the initial results for this query. It's up to * the implementation to determine, which and how many the initial results * would be. diff --git a/src/net/java/sip/communicator/service/contactsource/ContactQuery.java b/src/net/java/sip/communicator/service/contactsource/ContactQuery.java index f0beee3..9bdc587 100644 --- a/src/net/java/sip/communicator/service/contactsource/ContactQuery.java +++ b/src/net/java/sip/communicator/service/contactsource/ContactQuery.java @@ -47,6 +47,12 @@ public interface ContactQuery public ContactSourceService getContactSource(); /** + * Returns the query string, this query was created for. + * @return the query string, this query was created for + */ + public String getQueryString(); + + /** * Returns the list of <tt>SourceContact</tt>s returned by this query. * @return the list of <tt>SourceContact</tt>s returned by this query */ diff --git a/src/net/java/sip/communicator/service/history/HistoryQuery.java b/src/net/java/sip/communicator/service/history/HistoryQuery.java index d11b9aa..aadbbd5 100644 --- a/src/net/java/sip/communicator/service/history/HistoryQuery.java +++ b/src/net/java/sip/communicator/service/history/HistoryQuery.java @@ -26,6 +26,13 @@ public interface HistoryQuery public void cancel(); /** + * Returns the query string, this query was created for. + * + * @return the query string, this query was created for + */ + public String getQueryString(); + + /** * Returns a collection of the results for this query. It's up to * the implementation to determine how and when to fill this list of * results. |