コード例 #1
0
 /* (non-Javadoc)
  * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
  */
 public void mouseDoubleClick(MouseEvent e) {
   // 如果当前提示窗口处于显示状态,隐藏之
   main.getTipHelper().closeFriendTipShell();
   // 得到源model,如果是好友,则开发好友消息窗口或者短消息窗口
   // 如果是群,则打开群消息窗口
   QTree tree = (QTree) e.getSource();
   QItem item = tree.getItemUnderMouse();
   if (item == null) return;
   Model model = (Model) item.getData();
   switch (model.type) {
     case USER:
       User u = (User) model;
       // 首先判断是否双击在手机图标上
       if (item.getMouseOnAttachment() == 3) {
         // 如果u是在最近联系人中,不使用这个model
         if (u.group.isLatest()) {
           u = ModelRegistry.getUser(u.qq);
           if (u == null) return;
         }
         SMSWindow window = main.getShellLauncher().openSMSWindow(u);
         window.setReceiver(String.valueOf(u.qq));
       } else if (u.isContactable()) {
         // 如果u是在最近联系人中,不使用这个model
         // 假如不做这个操作,那么当真正的model有消息时,动画
         // 将不会正常停止
         if (u.group.isLatest()) {
           u = ModelRegistry.getUser(u.qq);
           if (u == null) return;
         }
         // 是好友,是陌生人,是最近联系人,则打开消息窗口
         if (main.getMessageQueue().isNextTempSessionMessage(u.qq))
           main.getShellLauncher().openTempSessionIMWindow(u.qq);
         else main.getShellLauncher().openNormalIMWindow(u);
         main.getBlindHelper().refreshGroup(u.group);
       } else {
         // 如果是群内成员,缺省显示群名片页,否则显示缺省页
         if (u.group.isCluster()) {
           if (u.qq == main.getMyModel().qq) u.info = main.getMyModel().info;
           UserInfoWindow uiw =
               main.getShellLauncher()
                   .openUserInfoWindow(
                       u,
                       (u.qq == main.getMyModel().qq)
                           ? UserInfoWindow.EDITABLE
                           : UserInfoWindow.READ_ONLY);
           uiw.setCurrentPage(UserInfoWindow.CARD);
         } else main.getShellLauncher().openUserInfoWindow(u, UserInfoWindow.READ_ONLY);
       }
       break;
     case CLUSTER:
       Cluster c = ModelRegistry.getCluster(((Cluster) model).clusterId);
       if (c == null) return;
       else main.getShellLauncher().openClusterIMWindow(c);
       break;
     default:
       break;
   }
 }
コード例 #2
0
  /**
   * 处理得到自定义头像信息成功事件
   *
   * @param e
   */
  private synchronized void processGetCustomHeadInfoSuccess(QQEvent e) {
    GetCustomHeadInfoReplyPacket packet = (GetCustomHeadInfoReplyPacket) e.getSource();
    FaceRegistry reg = FaceRegistry.getInstance();
    for (CustomHead head : packet.heads) {
      User u = ModelRegistry.getUser(head.qq);
      if (u.customHeadTimestamp < head.timestamp || !reg.hasFace(reg.getMd5ById(u.customHeadId)))
        headInfo.add(head);
    }

    postGetCustomHeadInfo();
  }