diff options
| author | 2011-03-09 15:19:50 +0000 | |
|---|---|---|
| committer | 2011-03-09 15:19:50 +0000 | |
| commit | 9eea29bb5129a9682c43b86fd042c75107b9f23a (patch) | |
| tree | e7962ff3e2ccdfaa36fd3c335233f7f6c8eab0bd | |
| parent | bump spanish translation (diff) | |
| download | KVIrc-9eea29bb5129a9682c43b86fd042c75107b9f23a.tar.gz KVIrc-9eea29bb5129a9682c43b86fd042c75107b9f23a.tar.bz2 KVIrc-9eea29bb5129a9682c43b86fd042c75107b9f23a.zip | |
If we have an open query to a service, use it for the notices instead of sending messages to active or to console.
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5560 17fca916-40b9-46aa-a4ea-0a15b648b75c
| -rw-r--r-- | src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp | 18 | ||||
| -rw-r--r-- | src/kvirc/ui/KviIrcView.h | 2 | ||||
| -rw-r--r-- | src/kvirc/ui/KviIrcView_events.cpp | 92 |
3 files changed, 67 insertions, 45 deletions
diff --git a/src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp b/src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp index 42cbfac11..adb6824b1 100644 --- a/src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp +++ b/src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp @@ -1124,6 +1124,10 @@ void KviIrcServerParser::parseLiteralNotice(KviIrcMessage *msg) QString szMsgText = msg->connection()->decodeText(msg->safeTrailing()); KviIrcMask talker(szNick,szUser,szHost); KviNickServRule * rule = 0; + + // Figure out early if we have a query window open: if we have it then use it unconditionally + KviQueryWindow * query = msg->connection()->findQuery(szNick); + //check per-network nickserver settings KviNickServRuleSet * r = msg->connection()->target()->network()->nickServRuleSet(); if(r) @@ -1145,6 +1149,9 @@ void KviIrcServerParser::parseLiteralNotice(KviIrcMessage *msg) msg->setHaltOutput(); if(!msg->haltOutput()) { + if(query) + goto output_to_query_window; // use the query unconditionally + KviWindow * pOut = KVI_OPTION_BOOL(KviOption_boolServicesNoticesToActiveWindow) ? console->activeWindow() : (KviWindow *)(console); pOut->output(KVI_OUT_NICKSERV,"\r!n\r%Q\r [%Q@\r!h\r%Q\r]: %Q",&szNick,&szUser,&szHost,&szMsgText); @@ -1166,6 +1173,9 @@ void KviIrcServerParser::parseLiteralNotice(KviIrcMessage *msg) msg->setHaltOutput(); if(!msg->haltOutput()) { + if(query) + goto output_to_query_window; // use the query unconditionally + KviWindow * pOut = KVI_OPTION_BOOL(KviOption_boolServicesNoticesToActiveWindow) ? console->activeWindow() : (KviWindow *)(console); pOut->output(KVI_OUT_NICKSERV,"\r!n\r%Q\r [%Q@\r!h\r%Q\r]: %Q",&szNick,&szUser,&szHost,&szMsgText); @@ -1181,6 +1191,9 @@ void KviIrcServerParser::parseLiteralNotice(KviIrcMessage *msg) msg->setHaltOutput(); if(!msg->haltOutput()) { + if(query) + goto output_to_query_window; // use the query unconditionally + KviWindow * pOut = KVI_OPTION_BOOL(KviOption_boolServicesNoticesToActiveWindow) ? console->activeWindow() : (KviWindow *)(console); pOut->output(KVI_OUT_CHANSERV,"\r!n\r%Q\r [%Q@\r!h\r%Q\r]: %Q",&szNick,&szUser,&szHost,&szMsgText); @@ -1196,6 +1209,9 @@ void KviIrcServerParser::parseLiteralNotice(KviIrcMessage *msg) msg->setHaltOutput(); if(!msg->haltOutput()) { + if(query) + goto output_to_query_window; // use the query unconditionally + KviWindow * pOut = KVI_OPTION_BOOL(KviOption_boolServicesNoticesToActiveWindow) ? console->activeWindow() : (KviWindow *)(console); pOut->output(KVI_OUT_MEMOSERV,"\r!n\r%Q\r [%Q@\r!h\r%Q\r]: %Q",&szNick,&szUser,&szHost,&szMsgText); @@ -1207,7 +1223,6 @@ void KviIrcServerParser::parseLiteralNotice(KviIrcMessage *msg) // A query request // do we have a matching window ? - KviQueryWindow * query = msg->connection()->findQuery(szNick); if(!query) { @@ -1276,6 +1291,7 @@ void KviIrcServerParser::parseLiteralNotice(KviIrcMessage *msg) // ok, now we either have a query or not if(query) { +output_to_query_window: // ok, we have the query. Trigger the user action anyway query->userAction(szNick,szUser,szHost,KVI_USERACTION_NOTICE); // decrypt it if needed diff --git a/src/kvirc/ui/KviIrcView.h b/src/kvirc/ui/KviIrcView.h index 4ac324130..c7ccd6e99 100644 --- a/src/kvirc/ui/KviIrcView.h +++ b/src/kvirc/ui/KviIrcView.h @@ -198,7 +198,6 @@ protected: virtual void paintEvent(QPaintEvent *); virtual void resizeEvent(QResizeEvent *); virtual void mousePressEvent(QMouseEvent * e); - virtual void mouseRealPressEvent(QMouseEvent * e); virtual void mouseReleaseEvent(QMouseEvent *); virtual void mouseDoubleClickEvent(QMouseEvent * e); virtual void mouseMoveEvent(QMouseEvent * e); @@ -211,6 +210,7 @@ protected: void maybeTip(const QPoint & pnt); virtual void leaveEvent(QEvent *); private: + void triggerMouseRelatedKvsEvents(QMouseEvent * e); void setCursorLine(KviIrcViewLine * l); void ensureLineVisible(KviIrcViewLine * pLineToShow); KviIrcViewLine * getVisibleLineAt(int yPos); diff --git a/src/kvirc/ui/KviIrcView_events.cpp b/src/kvirc/ui/KviIrcView_events.cpp index 39ff910e4..518cac0d2 100644 --- a/src/kvirc/ui/KviIrcView_events.cpp +++ b/src/kvirc/ui/KviIrcView_events.cpp @@ -241,63 +241,65 @@ void KviIrcView::mouseDoubleClickEvent(QMouseEvent *e) void KviIrcView::mousePressEvent(QMouseEvent * e) { - if(m_pKviWindow->input()) m_pKviWindow->input()->setFocus(); + if(m_pKviWindow->input()) + m_pKviWindow->input()->setFocus(); - if(e->button() & Qt::LeftButton) + if(!(e->button() & Qt::LeftButton)) { - // We are inside the line marker - if(checkMarkerArea(m_lineMarkArea,e->pos())) - { - scrollToMarker(); - } + triggerMouseRelatedKvsEvents(e); + return; } + + // Left button handler - if(e->button() & Qt::LeftButton) + // We are inside the line marker + if(checkMarkerArea(m_lineMarkArea,e->pos())) { - // This is the beginning of a selection... - // We just set the mouse to be "down" and - // await mouseMove events... + scrollToMarker(); + } - m_pSelectionInitLine = getVisibleLineAt(e->pos().y()); - m_pSelectionEndLine = m_pSelectionInitLine; - if(m_pSelectionInitLine) - { - m_iSelectionInitCharIndex = getVisibleCharIndexAt(m_pSelectionInitLine, e->pos().x(), e->pos().y()); - m_iSelectionEndCharIndex=m_iSelectionInitCharIndex; - } + // This is the beginning of a selection... + // We just set the mouse to be "down" and + // await mouseMove events... - if(m_pToolWidget) - { - m_pCursorLine = m_pSelectionInitLine; - repaint(); - } + m_pSelectionInitLine = getVisibleLineAt(e->pos().y()); + m_pSelectionEndLine = m_pSelectionInitLine; + if(m_pSelectionInitLine) + { + m_iSelectionInitCharIndex = getVisibleCharIndexAt(m_pSelectionInitLine, e->pos().x(), e->pos().y()); + m_iSelectionEndCharIndex=m_iSelectionInitCharIndex; + } + + if(m_pToolWidget) + { + m_pCursorLine = m_pSelectionInitLine; + repaint(); + } - m_mousePressPos = e->pos(); - m_mouseCurrentPos = e->pos(); + m_mousePressPos = e->pos(); + m_mouseCurrentPos = e->pos(); - m_bMouseIsDown = true; + m_bMouseIsDown = true; - m_bShiftPressed = (e->modifiers() & Qt::ShiftModifier); - } + m_bShiftPressed = (e->modifiers() & Qt::ShiftModifier); - if(e->button() & Qt::LeftButton) + if(m_iMouseTimer) // clicked at least twice within the doubleClickInterval(): this is a double click then... { - if(m_iMouseTimer) - { - killTimer(m_iMouseTimer); - m_iMouseTimer=0; - delete m_pLastEvent; - m_pLastEvent = 0; - } else { - m_iMouseTimer = startTimer(QApplication::doubleClickInterval()); - m_pLastEvent = new QMouseEvent(*e); - } + killTimer(m_iMouseTimer); + m_iMouseTimer=0; + delete m_pLastEvent; + m_pLastEvent = 0; } else { - mouseRealPressEvent(e); + // This is used to avoid triggering the single click KVS events + // if a double click is issued instead... + // We actually trigger the click event after the double click interval + // is elapsed without a second click. + m_iMouseTimer = startTimer(QApplication::doubleClickInterval()); + m_pLastEvent = new QMouseEvent(*e); } } -void KviIrcView::mouseRealPressEvent(QMouseEvent *e) +void KviIrcView::triggerMouseRelatedKvsEvents(QMouseEvent *e) { QString linkCmd; QString linkText; @@ -314,7 +316,6 @@ void KviIrcView::mouseRealPressEvent(QMouseEvent *e) pParams->append(linkText); pParams->append(szCmd); - if(!(e->modifiers() & Qt::ControlModifier))//(e->button() & Qt::RightButton) && ( { if(!linkCmd.isEmpty()) @@ -750,18 +751,23 @@ void KviIrcView::timerEvent(QTimerEvent *e) if(e->timerId() == m_iSelectTimer) { repaint(); + return; } + if(e->timerId() == m_iMouseTimer) { killTimer(m_iMouseTimer); m_iMouseTimer=0; - mouseRealPressEvent(m_pLastEvent); + triggerMouseRelatedKvsEvents(m_pLastEvent); delete m_pLastEvent; m_pLastEvent=0; + return; } + if(e->timerId() == m_iFlushTimer) { flushLog(); + return; } } |
