Changeset 6097 for trunk/qt4-gui/src/core
- Timestamp:
- 03/15/08 06:23:52 (9 months ago)
- Location:
- trunk/qt4-gui/src/core
- Files:
-
- 6 modified
-
gui-defines.h (modified) (1 diff)
-
licqgui.cpp (modified) (17 diffs)
-
licqgui.h (modified) (1 diff)
-
mainwin.cpp (modified) (2 diffs)
-
usermenu.cpp (modified) (1 diff)
-
usermenu.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt4-gui/src/core/gui-defines.h
r6001 r6097 47 47 { 48 48 49 enum UserFunctions { 50 mnuUserView, 51 mnuUserSendMsg, 52 mnuUserSendUrl, 53 mnuUserSendChat, 54 mnuUserSendFile, 55 mnuUserSendContact, 56 mnuUserSendSms, 57 mnuUserGeneral, 49 // Event types, used by event dialog but placed here since callers to 50 // LicqGui::showEventDialog also needs them 51 enum EventType 52 { 53 MessageEvent, 54 UrlEvent, 55 ChatEvent, 56 FileEvent, 57 ContactEvent, 58 SmsEvent, 58 59 }; 60 61 // Constant used to select opening page when calling LicqGui::showInfoDialog 62 // Leave it for now as the fcn parameter may be needed when user info dialog has been remade 63 static const int mnuUserGeneral = 0; 59 64 60 65 } // namespace LicqQtGui -
trunk/qt4-gui/src/core/licqgui.cpp
r6096 r6097 840 840 } 841 841 842 User EventCommon* LicqGui::showEventDialog(int fcn, QString id, unsigned long ppid, int convoId)842 UserViewEvent* LicqGui::showViewEventDialog(QString id, unsigned long ppid) 843 843 { 844 844 if (id.isEmpty() || ppid == 0) 845 845 return NULL; 846 846 847 switch (fcn) 848 { 849 case mnuUserView: 847 for (int i = 0; i < myUserViewList.size(); ++i) 848 { 849 UserViewEvent* e = myUserViewList.at(i); 850 if (id.compare(e->id(), Qt::CaseInsensitive) == 0 && e->ppid() == ppid) 851 { 852 e->show(); 853 if (Config::Chat::instance()->autoFocus() && 854 (!qApp->activeWindow() || !qApp->activeWindow()->inherits("UserEventCommon"))) 850 855 { 851 for (int i = 0; i < myUserViewList.size(); ++i) 856 e->raise(); 857 e->activateWindow(); 858 } 859 return e; 860 } 861 } 862 863 UserViewEvent* e = new UserViewEvent(id, ppid); 864 connect(e, SIGNAL(viewUrl(QWidget*, QString)), SLOT(viewUrl(QWidget*, QString))); 865 866 e->show(); 867 userEventFinished(id, ppid); 868 connect(e, SIGNAL(finished(QString, unsigned long)), SLOT(userEventFinished(QString, unsigned long))); 869 myUserViewList.append(e); 870 871 return e; 872 } 873 874 UserEventCommon* LicqGui::showEventDialog(int fcn, QString id, unsigned long ppid, int convoId) 875 { 876 if (id.isEmpty() || ppid == 0) 877 return NULL; 878 879 if (Config::Chat::instance()->msgChatView()) 880 { 881 for (int i = 0; i < myUserSendList.size(); ++i) 882 { 883 UserSendCommon* e = myUserSendList.at(i); 884 885 // Protocols (MSN only atm) that support convo ids are differentiated from 886 // the icq protocol because the convo id will be the server socket.. which does 887 // not meet the requirement that convo ids must be unique for each conversation. 888 if ( ((ppid == MSN_PPID && e->ppid() == MSN_PPID) && (e->isUserInConvo(id) || 889 (e->convoId() == (unsigned long)(convoId) && e->convoId() != (unsigned long)(-1)))) || 890 (e->isUserInConvo(id) && e->ppid() == ppid)) 891 { 892 //if (!e->FindUserInConvo(id)) 893 // e->convoJoin(id); 894 895 if (myUserEventTabDlg && myUserEventTabDlg->tabExists(e)) 852 896 { 853 UserViewEvent* e = myUserViewList.at(i);854 if ( id.compare(e->id(), Qt::CaseInsensitive) == 0 && e->ppid() == ppid)897 myUserEventTabDlg->show(); 898 if (Config::Chat::instance()->autoFocus()) 855 899 { 856 e->show(); 857 if (Config::Chat::instance()->autoFocus() && 858 (!qApp->activeWindow() || !qApp->activeWindow()->inherits("UserEventCommon"))) 859 { 860 e->raise(); 861 e->activateWindow(); 862 } 863 return e; 900 myUserEventTabDlg->selectTab(e); 901 myUserEventTabDlg->raise(); 902 myUserEventTabDlg->activateWindow(); 864 903 } 865 904 } 866 } 867 break; 868 case mnuUserSendMsg: 869 case mnuUserSendUrl: 870 case mnuUserSendChat: 871 case mnuUserSendFile: 872 case mnuUserSendContact: 873 case mnuUserSendSms: 874 { 875 if (!Config::Chat::instance()->msgChatView()) 876 break; 877 878 for (int i = 0; i < myUserSendList.size(); ++i) 905 else 879 906 { 880 UserSendCommon* e = myUserSendList.at(i); 881 882 // Protocols (MSN only atm) that support convo ids are differentiated from 883 // the icq protocol because the convo id will be the server socket.. which does 884 // not meet the requirement that convo ids must be unique for each conversation. 885 if ( ((ppid == MSN_PPID && e->ppid() == MSN_PPID) && (e->isUserInConvo(id) || 886 (e->convoId() == (unsigned long)(convoId) && e->convoId() != (unsigned long)(-1)))) || 887 (e->isUserInConvo(id) && e->ppid() == ppid)) 907 e->show(); 908 if (Config::Chat::instance()->autoFocus() && 909 (!qApp->activeWindow() || !qApp->activeWindow()->inherits("UserEventCommon"))) 888 910 { 889 //if (!e->FindUserInConvo(id)) 890 // e->convoJoin(id); 891 892 if (myUserEventTabDlg && myUserEventTabDlg->tabExists(e)) 893 { 894 myUserEventTabDlg->show(); 895 if (Config::Chat::instance()->autoFocus()) 896 { 897 myUserEventTabDlg->selectTab(e); 898 myUserEventTabDlg->raise(); 899 myUserEventTabDlg->activateWindow(); 900 } 901 } 902 else 903 { 904 e->show(); 905 if (Config::Chat::instance()->autoFocus() && 906 (!qApp->activeWindow() || !qApp->activeWindow()->inherits("UserEventCommon"))) 907 { 908 e->raise(); 909 e->activateWindow(); 910 } 911 } 912 // Make the existing event dialog change to the new event type 913 switch (fcn) 914 { 915 case mnuUserSendMsg: e->changeEventType(ET_MESSAGE); break; 916 case mnuUserSendUrl: e->changeEventType(ET_URL); break; 917 case mnuUserSendChat: e->changeEventType(ET_CHAT); break; 918 case mnuUserSendFile: e->changeEventType(ET_FILE); break; 919 case mnuUserSendContact: e->changeEventType(ET_CONTACT); break; 920 case mnuUserSendSms: e->changeEventType(ET_SMS); break; 921 } 922 return e; 911 e->raise(); 912 e->activateWindow(); 923 913 } 924 914 } 915 // Make the existing event dialog change to the new event type 916 e->changeEventType(fcn); 917 return e; 925 918 } 926 default: 927 break; 919 } 928 920 } 929 921 … … 954 946 switch (fcn) 955 947 { 956 case mnuUserView: 957 { 958 e = new UserViewEvent(id, ppid); 959 break; 960 } 961 case mnuUserSendMsg: 962 { 963 e = new UserSendMsgEvent(id, ppid, parent); 964 break; 965 } 966 case mnuUserSendUrl: 967 { 968 e = new UserSendUrlEvent(id, ppid, parent); 969 break; 970 } 971 case mnuUserSendChat: 972 { 973 e = new UserSendChatEvent(id, ppid, parent); 974 break; 975 } 976 case mnuUserSendFile: 977 { 978 e = new UserSendFileEvent(id, ppid, parent); 979 break; 980 } 981 case mnuUserSendContact: 982 { 983 e = new UserSendContactEvent(id, ppid, parent); 984 break; 985 } 986 case mnuUserSendSms: 987 { 988 e = new UserSendSmsEvent(id, ppid, parent); 989 break; 990 } 948 case MessageEvent: 949 e = new UserSendMsgEvent(id, ppid, parent); 950 break; 951 952 case UrlEvent: 953 e = new UserSendUrlEvent(id, ppid, parent); 954 break; 955 956 case ChatEvent: 957 e = new UserSendChatEvent(id, ppid, parent); 958 break; 959 960 case FileEvent: 961 e = new UserSendFileEvent(id, ppid, parent); 962 break; 963 964 case ContactEvent: 965 e = new UserSendContactEvent(id, ppid, parent); 966 break; 967 968 case SmsEvent: 969 e = new UserSendSmsEvent(id, ppid, parent); 970 break; 971 991 972 default: 992 973 gLog.Warn("%sunknown callFunction() fcn: %d\n", L_WARNxSTR, fcn); … … 996 977 connect(e, SIGNAL(viewUrl(QWidget*, QString)), SLOT(viewUrl(QWidget*, QString))); 997 978 998 if (Config::Chat::instance()->tabbedChatting() && fcn != mnuUserView)979 if (Config::Chat::instance()->tabbedChatting()) 999 980 { 1000 981 myUserEventTabDlg->addTab(e); … … 1018 999 // there might be more than one send window open 1019 1000 // make sure we only remember one, or it will get complicated 1020 if (fcn == mnuUserView) 1021 { 1022 userEventFinished(id, ppid); 1023 connect(e, SIGNAL(finished(QString, unsigned long)), SLOT(userEventFinished(QString, unsigned long))); 1024 myUserViewList.append(static_cast<UserViewEvent*>(e)); 1025 } 1026 else 1027 { 1028 sendEventFinished(id, ppid); 1029 connect(e, SIGNAL(finished(QString, unsigned long)), SLOT(sendEventFinished(QString, unsigned long))); 1030 myUserSendList.append(static_cast<UserSendCommon*>(e)); 1031 } 1001 sendEventFinished(id, ppid); 1002 connect(e, SIGNAL(finished(QString, unsigned long)), SLOT(sendEventFinished(QString, unsigned long))); 1003 myUserSendList.append(static_cast<UserSendCommon*>(e)); 1004 1032 1005 return e; 1033 1006 } … … 1043 1016 void LicqGui::showMessageDialog(QString id, unsigned long ppid) 1044 1017 { 1045 showEventDialog( mnuUserSendMsg, id, ppid);1018 showEventDialog(MessageEvent, id, ppid); 1046 1019 } 1047 1020 1048 1021 void LicqGui::sendMsg(QString id, unsigned long ppid, const QString& message) 1049 1022 { 1050 UserSendCommon* event = dynamic_cast<UserSendCommon*>(showEventDialog( mnuUserSendMsg, id, ppid));1023 UserSendCommon* event = dynamic_cast<UserSendCommon*>(showEventDialog(MessageEvent, id, ppid)); 1051 1024 if (event == 0) 1052 1025 return; … … 1057 1030 void LicqGui::sendFileTransfer(QString id, unsigned long ppid, const QString& filename, const QString& description) 1058 1031 { 1059 UserSendFileEvent* event = dynamic_cast<UserSendFileEvent*>(showEventDialog( mnuUserSendFile, id, ppid));1032 UserSendFileEvent* event = dynamic_cast<UserSendFileEvent*>(showEventDialog(FileEvent, id, ppid)); 1060 1033 if (event == 0) 1061 1034 return; … … 1066 1039 void LicqGui::sendChatRequest(QString id, unsigned long ppid) 1067 1040 { 1068 UserSendCommon* event = dynamic_cast<UserSendCommon*>(showEventDialog( mnuUserSendChat, id, ppid));1041 UserSendCommon* event = dynamic_cast<UserSendCommon*>(showEventDialog(ChatEvent, id, ppid)); 1069 1042 if (event == 0) 1070 1043 return; … … 1147 1120 // set default function to read or send depending on whether or not 1148 1121 // there are new messages 1149 int fcn = (u->NewMessages() == 0 ? mnuUserSendMsg : mnuUserView);1150 if ( fcn == mnuUserView&& Config::Chat::instance()->msgChatView())1122 bool send = (u->NewMessages() == 0); 1123 if (!send && Config::Chat::instance()->msgChatView()) 1151 1124 { 1152 1125 // if one of the new events is a msg in chatview mode, … … 1157 1130 { 1158 1131 convoId = u->EventPeek(i)->ConvoId(); 1159 fcn = mnuUserSendMsg;1132 send = true; 1160 1133 break; 1161 1134 } … … 1163 1136 gUserManager.DropUser(u); 1164 1137 1138 if (!send) 1139 { 1140 // Messages pending and not open in chatview mode so open view event dialog 1141 showViewEventDialog(id, ppid); 1142 return; 1143 } 1144 1165 1145 // See if the clipboard contains a url 1166 if ( fcn == mnuUserSendMsg &&Config::Chat::instance()->sendFromClipboard())1146 if (Config::Chat::instance()->sendFromClipboard()) 1167 1147 { 1168 1148 QClipboard* clip = QApplication::clipboard(); … … 1179 1159 if (c.left(5) == "http:" || c.left(4) == "ftp:" || c.left(6) == "https:") 1180 1160 { 1181 UserEventCommon* ec = showEventDialog( mnuUserSendUrl, id, ppid);1161 UserEventCommon* ec = showEventDialog(UrlEvent, id, ppid); 1182 1162 if (!ec || ec->objectName() != "UserSendUrlEvent") 1183 1163 return; … … 1191 1171 else if (c.left(5) == "file:" || c.left(1) == "/") 1192 1172 { 1193 UserEventCommon* ec = showEventDialog( mnuUserSendFile, id, ppid);1173 UserEventCommon* ec = showEventDialog(FileEvent, id, ppid); 1194 1174 if (!ec || ec->objectName() != "UserSendFileEvent") 1195 1175 return; … … 1208 1188 } 1209 1189 1210 showEventDialog( fcn, id, ppid, convoId);1190 showEventDialog(MessageEvent, id, ppid, convoId); 1211 1191 } 1212 1192 … … 1223 1203 1224 1204 if (nNumMsg > 0) 1225 show EventDialog(mnuUserView,id, (*_ppit)->PPID());1205 showViewEventDialog(id, (*_ppit)->PPID()); 1226 1206 } 1227 1207 FOR_EACH_PROTO_PLUGIN_END … … 1305 1285 { 1306 1286 gUserManager.DropUser(u); 1307 showEventDialog( mnuUserSendMsg, id, ppid, u->EventPeek(i)->ConvoId());1287 showEventDialog(MessageEvent, id, ppid, u->EventPeek(i)->ConvoId()); 1308 1288 return; 1309 1289 } … … 1312 1292 } 1313 1293 1314 show EventDialog(mnuUserView,id, ppid);1294 showViewEventDialog(id, ppid); 1315 1295 } 1316 1296 } … … 1542 1522 1543 1523 if (bCallSendMsg) 1544 showEventDialog( mnuUserSendMsg, id, ppid, sig->CID());1524 showEventDialog(MessageEvent, id, ppid, sig->CID()); 1545 1525 if (bCallUserView) 1546 show EventDialog(mnuUserView, id, ppid, sig->CID());1526 showViewEventDialog(id, ppid); 1547 1527 } 1548 1528 } -
trunk/qt4-gui/src/core/licqgui.h
r6093 r6097 130 130 131 131 /** 132 * Show contact view event dialog (used when chat mode is disabled) 133 * 134 * @param id Contact id 135 * @param ppid Contact protocol id 136 */ 137 UserViewEvent* showViewEventDialog(QString id, unsigned long ppid); 138 139 /** 132 140 * Show contact event dialog 133 141 * -
trunk/qt4-gui/src/core/mainwin.cpp
r6090 r6097 161 161 a->setData(data); 162 162 163 ADD_USERFUNCACTION(Qt::CTRL + Qt::Key_V, mnuUserView)164 ADD_USERFUNCACTION(Qt::CTRL + Qt::Key_S, mnuUserSendMsg)165 ADD_USERFUNCACTION(Qt::CTRL + Qt::Key_U, mnuUserSendUrl)166 ADD_USERFUNCACTION(Qt::CTRL + Qt::Key_C, mnuUserSendChat)167 ADD_USERFUNCACTION(Qt::CTRL + Qt::Key_F, mnuUserSendFile)163 ADD_USERFUNCACTION(Qt::CTRL + Qt::Key_V, -1) 164 ADD_USERFUNCACTION(Qt::CTRL + Qt::Key_S, MessageEvent) 165 ADD_USERFUNCACTION(Qt::CTRL + Qt::Key_U, UrlEvent) 166 ADD_USERFUNCACTION(Qt::CTRL + Qt::Key_C, ChatEvent) 167 ADD_USERFUNCACTION(Qt::CTRL + Qt::Key_F, FileEvent) 168 168 #undef ADD_USERFUNCACTION 169 169 addActions(userFuncGroup->actions()); … … 520 520 myUserView->MainWindowSelectedItemUser(id, ppid); 521 521 522 LicqGui::instance()->showEventDialog(index, id, ppid); 522 if (index == -1) 523 LicqGui::instance()->showViewEventDialog(id, ppid); 524 else 525 LicqGui::instance()->showEventDialog(index, id, ppid); 523 526 } 524 527 -
trunk/qt4-gui/src/core/usermenu.cpp
r6000 r6097 345 345 void UserMenu::viewEvent() 346 346 { 347 LicqGui::instance()->show EventDialog(mnuUserView,myId, myPpid);347 LicqGui::instance()->showViewEventDialog(myId, myPpid); 348 348 } 349 349 -
trunk/qt4-gui/src/core/usermenu.h
r5822 r6097 107 107 enum SendModes 108 108 { 109 SendMessage = mnuUserSendMsg,110 SendUrl = mnuUserSendUrl,111 SendChat = mnuUserSendChat,112 SendFile = mnuUserSendFile,113 SendContact = mnuUserSendContact,114 SendSms = mnuUserSendSms,109 SendMessage = MessageEvent, 110 SendUrl = UrlEvent, 111 SendChat = ChatEvent, 112 SendFile = FileEvent, 113 SendContact = ContactEvent, 114 SendSms = SmsEvent, 115 115 SendAuthorize, 116 116 SendReqAuthorize,
