Changeset 6103 for trunk/qt4-gui/src/userevents
- Timestamp:
- 03/16/08 04:09:36 (9 months ago)
- Location:
- trunk/qt4-gui/src/userevents
- Files:
-
- 3 modified
-
usereventcommon.cpp (modified) (2 diffs)
-
usereventcommon.h (modified) (1 diff)
-
usersendcommon.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt4-gui/src/userevents/usereventcommon.cpp
r6048 r6103 74 74 } 75 75 76 // Find out what's supported for this protocol 77 mySendFuncs = 0xFFFFFFFF; 78 if (ppid != LICQ_PPID) 79 { 80 FOR_EACH_PROTO_PLUGIN_START(gLicqDaemon) 81 { 82 if ((*_ppit)->PPID() == ppid) 83 { 84 mySendFuncs = (*_ppit)->SendFunctions(); 85 break; 86 } 87 } 88 FOR_EACH_PROTO_PLUGIN_END 89 } 90 76 91 myCodec = QTextCodec::codecForLocale(); 77 92 myIsOwner = (gUserManager.FindOwner(myUsers.front().c_str(), myPpid) != NULL); … … 131 146 mySecure->setShortcut(Qt::ALT + Qt::Key_E); 132 147 pushToolTip(mySecure, tr("Open / Close secure channel")); 148 if (!(mySendFuncs & PP_SEND_SECURE)) 149 mySecure->setEnabled(false); 133 150 134 151 tmrTime = NULL; -
trunk/qt4-gui/src/userevents/usereventcommon.h
r6097 r6103 71 71 time_t myRemoteTimeOffset; 72 72 list<string> myUsers; 73 unsigned long mySendFuncs; 73 74 74 75 // ID of the higest event we've processed. Helps determine -
trunk/qt4-gui/src/userevents/usersendcommon.cpp
r6101 r6103 48 48 #endif 49 49 50 #include <licq_icq.h> 50 51 #include <licq_icqd.h> 51 52 #include <licq_log.h> … … 129 130 130 131 QAction* action; 131 132 action = new QAction(tr("Message"), grpSendType); 133 action->setData(MessageEvent); 134 action->setCheckable(true); 135 136 action = new QAction(tr("URL"), grpSendType); 137 action->setData(UrlEvent); 138 action->setCheckable(true); 139 140 action = new QAction(tr("Chat Request"), grpSendType); 141 action->setData(ChatEvent); 142 action->setCheckable(true); 143 144 action = new QAction(tr("File Transfer"), grpSendType); 145 action->setData(FileEvent); 146 action->setCheckable(true); 147 148 action = new QAction(tr("Contact List"), grpSendType); 149 action->setData(ContactEvent); 150 action->setCheckable(true); 151 152 action = new QAction(tr("SMS"), grpSendType); 153 action->setData(SmsEvent); 154 action->setCheckable(true); 132 int eventTypesCount = 0; 133 134 #define ADD_SENDTYPE(eventFlag, eventType, caption) \ 135 if (mySendFuncs & eventFlag) { \ 136 action = new QAction(caption, grpSendType); \ 137 action->setData(eventType); \ 138 action->setCheckable(true); \ 139 eventTypesCount++; \ 140 } 141 142 // Populated menu for switching event type 143 ADD_SENDTYPE(PP_SEND_MSG, MessageEvent, tr("Message")); 144 ADD_SENDTYPE(PP_SEND_URL, UrlEvent, tr("URL")); 145 ADD_SENDTYPE(PP_SEND_CHAT, ChatEvent, tr("Chat Request")); 146 ADD_SENDTYPE(PP_SEND_FILE, FileEvent, tr("File Transfer")); 147 ADD_SENDTYPE(PP_SEND_CONTACT, ContactEvent, tr("Contact List")); 148 ADD_SENDTYPE(PP_SEND_SMS, SmsEvent, tr("SMS")); 149 150 #undef ADD_SENDTYPE 155 151 156 152 QMenu* mnuSendType = new QMenu(this); … … 161 157 pushToolTip(cmbSendType, tr("Select type of message to send")); 162 158 cmbSendType->setMenu(mnuSendType); 163 if ( ppid == MSN_PPID)159 if (eventTypesCount <= 1) 164 160 cmbSendType->setEnabled(false); 165 161 … … 169 165 chkSendServer->setCheckable(true); 170 166 167 bool canSendDirect = (mySendFuncs & PP_SEND_DIRECT); 168 171 169 ICQUser* u = gUserManager.FetchUser(myUsers.front().c_str(), myPpid, LOCK_R); 172 170 173 if (u != 0)171 if (u != NULL) 174 172 { 175 173 chkSendServer->setChecked(u->SendServer() || … … 177 175 178 176 if (u->GetInGroup(GROUPS_SYSTEM, GROUP_INVISIBLE_LIST) || 179 u->PPID() == MSN_PPID ||180 177 (u->Port() == 0 && u->SocketDesc(ICQ_CHNxNONE) == -1)) 181 { 182 chkSendServer->setChecked(true); 183 chkSendServer->setEnabled(false); 184 } 178 canSendDirect = false; 185 179 186 180 gUserManager.DropUser(u); 187 181 } 188 else182 if (!canSendDirect) 189 183 { 190 184 chkSendServer->setChecked(true); … … 700 694 { 701 695 case MessageEvent: 702 e = new UserSendMsgEvent(myUsers.front().c_str(), myPpid, parent); 696 if (mySendFuncs & PP_SEND_MSG) 697 e = new UserSendMsgEvent(myUsers.front().c_str(), myPpid, parent); 703 698 break; 704 699 case UrlEvent: 705 e = new UserSendUrlEvent(myUsers.front().c_str(), myPpid, parent); 700 if (mySendFuncs & PP_SEND_URL) 701 e = new UserSendUrlEvent(myUsers.front().c_str(), myPpid, parent); 706 702 break; 707 703 case ChatEvent: 708 e = new UserSendChatEvent(myUsers.front().c_str(), myPpid, parent); 704 if (mySendFuncs & PP_SEND_CHAT) 705 e = new UserSendChatEvent(myUsers.front().c_str(), myPpid, parent); 709 706 break; 710 707 case FileEvent: 711 e = new UserSendFileEvent(myUsers.front().c_str(), myPpid, parent); 708 if (mySendFuncs & PP_SEND_FILE) 709 e = new UserSendFileEvent(myUsers.front().c_str(), myPpid, parent); 712 710 break; 713 711 case ContactEvent: 714 e = new UserSendContactEvent(myUsers.front().c_str(), myPpid, parent); 712 if (mySendFuncs & PP_SEND_CONTACT) 713 e = new UserSendContactEvent(myUsers.front().c_str(), myPpid, parent); 715 714 break; 716 715 case SmsEvent: 717 e = new UserSendSmsEvent(myUsers.front().c_str(), myPpid, parent); 716 if (mySendFuncs & PP_SEND_SMS) 717 e = new UserSendSmsEvent(myUsers.front().c_str(), myPpid, parent); 718 718 break; 719 719 default: … … 721 721 } 722 722 723 if (e != 0)723 if (e != NULL) 724 724 { 725 725 if (e->mleSend != 0 && mleSend != 0)
