diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp | 2 | ||||
| -rw-r--r-- | src/kvirc/ui/KviChannelWindow.cpp | 57 | ||||
| -rw-r--r-- | src/kvirc/ui/KviIrcView.cpp | 23 | ||||
| -rw-r--r-- | src/kvirc/ui/KviWindow.cpp | 180 | ||||
| -rw-r--r-- | src/modules/objects/KvsObject_trayIcon.cpp | 2 |
5 files changed, 105 insertions, 159 deletions
diff --git a/src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp b/src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp index bc911a93e..ab8b70e91 100644 --- a/src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp +++ b/src/kvirc/sparser/KviIrcServerParser_literalHandlers.cpp @@ -1002,7 +1002,7 @@ void KviIrcServerParser::parseLiteralPrivmsg(KviIrcMessage *msg) KviKvsScript::run("snd.play $0",0,new KviKvsVariantList(new KviKvsVariant(KVI_OPTION_STRING(KviOption_stringOnNewQueryOpenedSound)))); if(KVI_OPTION_BOOL(KviOption_boolPasteLastLogOnQueryJoin)) - query->pasteLastLog(); + query->pasteLastLog(); } } } diff --git a/src/kvirc/ui/KviChannelWindow.cpp b/src/kvirc/ui/KviChannelWindow.cpp index d11dc8659..3c272e5bb 100644 --- a/src/kvirc/ui/KviChannelWindow.cpp +++ b/src/kvirc/ui/KviChannelWindow.cpp @@ -85,7 +85,7 @@ KviChannelWindow::KviChannelWindow(KviConsoleWindow * lpConsole, const QString & : KviWindow(KviWindow::Channel,szName,lpConsole) { // Init some member variables - m_pInput = 0; + m_pInput = nullptr; m_iStateFlags = 0; m_pActionHistory = new KviPointerList<KviChannelAction>; m_pActionHistory->setAutoDelete(true); @@ -137,7 +137,7 @@ KviChannelWindow::KviChannelWindow(KviConsoleWindow * lpConsole, const QString & m_pIrcView->setObjectName(szName); connect(m_pIrcView,SIGNAL(rightClicked()),this,SLOT(textViewRightClicked())); // And the double view (that may be unused) - m_pMessageView = 0; + m_pMessageView = nullptr; // The userlist on the right //m_pEditorsContainer= new KviToolWindowsContainer(m_pSplitter); @@ -152,7 +152,7 @@ KviChannelWindow::KviChannelWindow(KviConsoleWindow * lpConsole, const QString & connect(m_pListViewButton,SIGNAL(clicked()),this,SLOT(toggleListView())); //list modes (bans, bans exceptions, etc) - KviWindowToolPageButton * pButton = 0; + KviWindowToolPageButton * pButton = nullptr; char cMode = 0; QString szDescription = ""; KviIrcConnectionServerInfo * pServerInfo = serverInfo(); @@ -259,14 +259,10 @@ KviChannelWindow::KviChannelWindow(KviConsoleWindow * lpConsole, const QString & KviChannelWindow::~KviChannelWindow() { // Unregister ourself - if(type() == KviWindow::DeadChannel) - { - if(context()) - context()->unregisterDeadChannel(this); - } else { - if(connection()) - connection()->unregisterChannel(this); - } + if(type() == KviWindow::DeadChannel && context()) + context()->unregisterDeadChannel(this); + else if(connection()) + connection()->unregisterChannel(this); // Then remove all the users and free mem m_pUserListView->enableUpdates(false); @@ -450,9 +446,8 @@ void KviChannelWindow::showDoubleView(bool bShow) m_pDoubleViewButton->setChecked(true); if(m_privateBackground.pixmap()) - { m_pMessageView->setPrivateBackgroundPixmap(*(m_privateBackground.pixmap())); - } + connect(m_pMessageView,SIGNAL(rightClicked()),this,SLOT(textViewRightClicked())); m_pMessageView->setMasterView(m_pIrcView); m_pIrcView->splitMessagesTo(m_pMessageView); @@ -497,7 +492,7 @@ void KviChannelWindow::toggleModeEditor() if(m_pModeEditor) { delete m_pModeEditor; - m_pModeEditor = 0; + m_pModeEditor = nullptr; m_pSplitter->setMinimumHeight(20); if(m_pModeEditorButton->isChecked()) @@ -1232,7 +1227,7 @@ void KviChannelWindow::ownMessage(const QString & szBuffer, bool bUserFeedback) return; if(bUserFeedback) { - // ugly,but we must redecode here + // ugly, but we must redecode here QString szRedecoded = decodeText(szEncrypted.ptr()); m_pConsole->outputPrivmsg(this,KVI_OUT_OWNPRIVMSG, QString(),QString(),QString(),szRedecoded,KviConsoleWindow::NoNotifications); @@ -1887,7 +1882,7 @@ void KviChannelWindow::setModeInList(char cMode, const QString & szMask, bool bA } KviPointerList<KviMaskEntry> * pList = m_pModeLists.value(cMode); - KviMaskEditor * pEditor = 0; + KviMaskEditor * pEditor = nullptr; if(m_pListEditors.contains(cMode)) pEditor = m_pListEditors.value(cMode); @@ -1897,7 +1892,7 @@ void KviChannelWindow::setModeInList(char cMode, const QString & szMask, bool bA void KviChannelWindow::internalMask(const QString & szMask, bool bAdd, const QString & szSetBy, unsigned int uSetAt, KviPointerList<KviMaskEntry> * pList, KviMaskEditor ** ppEd, QString & szChangeMask) { - KviMaskEntry * pEntry = 0; + KviMaskEntry * pEntry = nullptr; if(bAdd) { for(pEntry = pList->first(); pEntry; pEntry = pList->next()) @@ -2051,28 +2046,28 @@ void KviChannelWindow::preprocessMessage(QString & szMessage) return; // contains a non standard link that may contain spaces, do not break it. QStringList strings = szMessage.split(" ",QString::KeepEmptyParts); - for(QStringList::Iterator it = strings.begin(); it != strings.end(); ++it) + for(auto& it : strings) { - if(it->contains('\r')) + if(it.contains('\r')) continue; - QString szTmp = KviControlCodes::stripControlBytes(*it).trimmed(); + QString szTmp = KviControlCodes::stripControlBytes(it).trimmed(); if(szTmp.length() < 1) continue; // FIXME: Do we REALLY need this ? - if(findEntry(*it)) + if(findEntry(it)) { - *it = QString("\r!n\r%1\r").arg(*it); + it = QString("\r!n\r%1\r").arg(it); continue; } if(pServerInfo->supportedChannelTypes().contains(szTmp[0])) { - if((*it) == szTmp) - *it = QString("\r!c\r%1\r").arg(*it); + if(it == szTmp) + it = QString("\r!c\r%1\r").arg(it); else - *it = QString("\r!c%1\r%2\r").arg(szTmp, *it); + it = QString("\r!c%1\r%2\r").arg(szTmp, it); } } szMessage = strings.join(" "); @@ -2087,9 +2082,7 @@ void KviChannelWindow::unhighlight() KviIrcConnectionServerInfo * KviChannelWindow::serverInfo() { - if(!connection()) - return 0; - return connection()->serverInfo(); + return connection() ? connection()->serverInfo() : nullptr; } // FIXME: this currently does not work if the user has changed his date format, @@ -2121,12 +2114,12 @@ void KviChannelWindow::pasteLastLog() bool bGzip; QString szFileName; - for(QStringList::Iterator it = logList.begin(); it != logList.end(); ++it) + for(const auto& it : logList) { int iLogYear, iLogMonth, iLogDay; - szFileName = (*it); - QString szTmpName = (*it); + szFileName = it; + QString szTmpName = it; QFileInfo fi(szTmpName); bGzip = false; @@ -2180,7 +2173,7 @@ void KviChannelWindow::pasteLastLog() outputMessage(KVI_OUT_CHANPRIVMSG,szDummy); // Scan the log file - for(unsigned int u = uStart; u < uCount; u++) + for(size_t u = uStart; u < uCount; u++) { QString szLine = QString(list.at(u)); szLine = szLine.section(' ',1); diff --git a/src/kvirc/ui/KviIrcView.cpp b/src/kvirc/ui/KviIrcView.cpp index 42c92286b..e87a77ee0 100644 --- a/src/kvirc/ui/KviIrcView.cpp +++ b/src/kvirc/ui/KviIrcView.cpp @@ -1775,7 +1775,7 @@ wrap_line: return; } else if(ptr->uLineWraps > 128) { - // ooops.. this is looping endlessly: it may happen in certain insane window width / font size configurations... + // oops.. this is looping endlessly: it may happen in certain insane window width / font size configurations... return; } } @@ -2438,7 +2438,8 @@ int KviIrcView::getVisibleCharIndexAt(KviIrcViewLine *, int xPos, int yPos) while(iTop > yPos) { //no lines, go away - if(!l)return -1; + if(!l) + return -1; //subtract from iTop the height of the current line (aka go to the end of the previous / start of the current point) iTop -= ((l->uLineWraps + 1) * m_iFontLineSpacing) + m_iFontDescent; @@ -2456,9 +2457,11 @@ int KviIrcView::getVisibleCharIndexAt(KviIrcViewLine *, int xPos, int yPos) * iTop is the line start y coordinate. Now we have to go through this line's text and find the exact text under the mouse. * The line start x posistion is iLeft; we save iTop to firstRowTop (many rows can be part of this lingle line of text) */ - int iLeft = KVI_IRCVIEW_HORIZONTAL_BORDER; - if(KVI_OPTION_BOOL(KviOption_boolIrcViewShowImages))iLeft += KVI_IRCVIEW_PIXMAP_AND_SEPARATOR; + + if(KVI_OPTION_BOOL(KviOption_boolIrcViewShowImages)) + iLeft += KVI_IRCVIEW_PIXMAP_AND_SEPARATOR; + int firstRowTop = iTop; int i = 0; @@ -2472,12 +2475,9 @@ int KviIrcView::getVisibleCharIndexAt(KviIrcViewLine *, int xPos, int yPos) while(i < l->iBlockCount) { if(l->pBlocks[i].pChunk == 0) - { - //word wrap found - break; - } else { + break; //word wrap found + else i++; - } } if(i >= l->iBlockCount) return -1; //we reached the last chunk... there's something wrong, return else iTop += m_iFontLineSpacing; //we found a word wrap, check the next row. @@ -2502,15 +2502,12 @@ int KviIrcView::getVisibleCharIndexAt(KviIrcViewLine *, int xPos, int yPos) for(;iLeft + l->pBlocks[i].block_width < xPos;) { if(l->pBlocks[i].block_width>0) - { iLeft +=l->pBlocks[i].block_width; - } else if(i < (l->iBlockCount - 1)) + else if(i < (l->iBlockCount - 1)) { // There is another block, check if it is a wrap (we reached the end of the row) if(l->pBlocks[i+1].pChunk == 0) - { break; - } // else simply a zero characters block } i++; diff --git a/src/kvirc/ui/KviWindow.cpp b/src/kvirc/ui/KviWindow.cpp index b3d381249..6a5e90aa1 100644 --- a/src/kvirc/ui/KviWindow.cpp +++ b/src/kvirc/ui/KviWindow.cpp @@ -83,16 +83,16 @@ #include <KWindowSystem> #endif -KVIRC_API KviWindow * g_pActiveWindow = 0; +KVIRC_API KviWindow * g_pActiveWindow = nullptr; -static QMenu * g_pMdiWindowSystemMainPopup = 0; -static QMenu * g_pMdiWindowSystemTextEncodingPopup = 0; -static QMenu * g_pMdiWindowSystemTextEncodingPopupStandard = 0; -static QMenu * g_pMdiWindowSystemTextEncodingPopupSmart = 0; -static QMenu * g_pMdiWindowSystemTextEncodingPopupSmartUtf8 = 0; -static QActionGroup * g_pMdiWindowSystemTextEncodingActionGroup = 0; -static QAction * g_pMdiWindowSystemTextEncodingCurrentAction = 0; -static QAction * g_pMdiWindowSystemTextEncodingDefaultAction = 0; +static QMenu * g_pMdiWindowSystemMainPopup = nullptr; +static QMenu * g_pMdiWindowSystemTextEncodingPopup = nullptr; +static QMenu * g_pMdiWindowSystemTextEncodingPopupStandard = nullptr; +static QMenu * g_pMdiWindowSystemTextEncodingPopupSmart = nullptr; +static QMenu * g_pMdiWindowSystemTextEncodingPopupSmartUtf8 = nullptr; +static QActionGroup * g_pMdiWindowSystemTextEncodingActionGroup = nullptr; +static QAction * g_pMdiWindowSystemTextEncodingCurrentAction = nullptr; +static QAction * g_pMdiWindowSystemTextEncodingDefaultAction = nullptr; unsigned long int g_uUniqueWindowId = 1; @@ -108,24 +108,24 @@ KviWindow::KviWindow(Type eType, const QString & szName, KviConsoleWindow * lpCo g_pApp->registerWindow(this); m_eType = eType; - m_pFocusHandler = 0; - m_pIrcView = 0; - m_pInput = 0; - m_pSplitter = 0; - m_pButtonBox = 0; + m_pFocusHandler = nullptr; + m_pIrcView = nullptr; + m_pInput = nullptr; + m_pSplitter = nullptr; + m_pButtonBox = nullptr; m_pConsole = lpConsole; - m_pLastFocusedChild = 0; - m_pTextCodec = 0; // will be set by loadProperties - m_pTextEncodingButton = 0; - m_pHideToolsButton = 0; - //m_pEditorsContainer = 0; + m_pLastFocusedChild = nullptr; + m_pTextCodec = nullptr; // will be set by loadProperties + m_pTextEncodingButton = nullptr; + m_pHideToolsButton = nullptr; + //m_pEditorsContainer = nullptr; m_bIsDocked = false; - m_pWindowListItem = 0; + m_pWindowListItem = nullptr; m_bProcessingInputEvent = false; #ifdef COMPILE_CRYPT_SUPPORT - m_pCryptControllerButton = 0; - m_pCryptController = 0; - m_pCryptSessionInfo = 0; + m_pCryptControllerButton = nullptr; + m_pCryptController = nullptr; + m_pCryptSessionInfo = nullptr; #endif setMinimumSize(KVI_WINDOW_MIN_WIDTH,KVI_WINDOW_MIN_HEIGHT); @@ -262,7 +262,7 @@ bool KviWindow::setTextEncoding(const QString & szTextEncoding) // and we couldn't find a codec for this } // else it is empty : this means : guess from locale // either empty or not found... - m_pTextCodec = 0; + m_pTextCodec = nullptr; m_szTextEncoding = ""; // empty: we're using the default return false; } @@ -333,9 +333,7 @@ const char * KviWindow::m_typeTable[TypeCount] = const char * KviWindow::typeString() { if(m_eType < TypeCount) - { return m_typeTable[m_eType]; - } return m_typeTable[Unknown]; } @@ -351,7 +349,7 @@ void KviWindow::destroyWindowListItem() if(m_pWindowListItem) { g_pMainWindow->m_pWindowList->removeItem(m_pWindowListItem); - m_pWindowListItem = 0; + m_pWindowListItem = nullptr; } } @@ -414,7 +412,7 @@ void KviWindow::toggleCryptController() if(m_pCryptController) { delete m_pCryptController; - m_pCryptController = 0; + m_pCryptController = nullptr; if(!m_pCryptControllerButton) return; if(m_pCryptControllerButton->isChecked()) @@ -466,7 +464,7 @@ void KviWindow::cryptControllerFinished() KviCryptSessionInfo * pInfo = m_pCryptController->getNewSessionInfo(); setCryptSessionInfo(pInfo); delete m_pCryptController; - m_pCryptController = 0; + m_pCryptController = nullptr; #endif } @@ -474,9 +472,9 @@ void KviWindow::cryptSessionInfoDestroyed() { #ifdef COMPILE_CRYPT_SUPPORT output(KVI_OUT_SYSTEMERROR,__tr2qs("Oops! I've accidentally lost the encryption engine.")); - m_pCryptSessionInfo->m_pEngine = 0; + m_pCryptSessionInfo->m_pEngine = nullptr; delete m_pCryptSessionInfo; - m_pCryptSessionInfo = 0; + m_pCryptSessionInfo = nullptr; #endif } @@ -551,7 +549,7 @@ void KviWindow::getDefaultLogFileName(QString & szBuffer) szLog.append(QString(szTmp).arg(typeString(),szBase,szDate)); - szBuffer=szLog; + szBuffer = szLog; } void KviWindow::getBaseLogFileName(QString & szBuffer) @@ -654,10 +652,10 @@ void KviWindow::createSystemTextEncodingPopup() if(!g_pMdiWindowSystemTextEncodingPopup) { // first time called, create the menu - g_pMdiWindowSystemTextEncodingPopup = new QMenu(); - g_pMdiWindowSystemTextEncodingPopupStandard = new QMenu(); - g_pMdiWindowSystemTextEncodingPopupSmart = new QMenu(); - g_pMdiWindowSystemTextEncodingPopupSmartUtf8 = new QMenu(); + g_pMdiWindowSystemTextEncodingPopup = new QMenu(); + g_pMdiWindowSystemTextEncodingPopupStandard = new QMenu(); + g_pMdiWindowSystemTextEncodingPopupSmart = new QMenu(); + g_pMdiWindowSystemTextEncodingPopupSmartUtf8 = new QMenu(); g_pMdiWindowSystemTextEncodingActionGroup = new QActionGroup(g_pMdiWindowSystemTextEncodingPopup); //default action @@ -685,14 +683,14 @@ void KviWindow::createSystemTextEncodingPopup() g_pMdiWindowSystemTextEncodingCurrentAction->setVisible(false); // other first level menus - g_pMdiWindowSystemTextEncodingPopup->addSeparator(); + g_pMdiWindowSystemTextEncodingPopup->addSeparator(); - QAction * pAction = g_pMdiWindowSystemTextEncodingPopup->addAction(__tr2qs("Standard")); - pAction->setMenu(g_pMdiWindowSystemTextEncodingPopupStandard); - pAction = g_pMdiWindowSystemTextEncodingPopup->addAction(__tr2qs("Smart (Send Local)")); - pAction->setMenu(g_pMdiWindowSystemTextEncodingPopupSmart); - pAction = g_pMdiWindowSystemTextEncodingPopup->addAction(__tr2qs("Smart (Send UTF-8)")); - pAction->setMenu(g_pMdiWindowSystemTextEncodingPopupSmartUtf8); + QAction * pAction = g_pMdiWindowSystemTextEncodingPopup->addAction(__tr2qs("Standard")); + pAction->setMenu(g_pMdiWindowSystemTextEncodingPopupStandard); + pAction = g_pMdiWindowSystemTextEncodingPopup->addAction(__tr2qs("Smart (Send Local)")); + pAction->setMenu(g_pMdiWindowSystemTextEncodingPopupSmart); + pAction = g_pMdiWindowSystemTextEncodingPopup->addAction(__tr2qs("Smart (Send UTF-8)")); + pAction->setMenu(g_pMdiWindowSystemTextEncodingPopupSmartUtf8); // second level menus (encoding groups) QMenu * pPopupStandard[KVI_NUM_ENCODING_GROUPS]; @@ -792,8 +790,7 @@ void KviWindow::systemTextEncodingPopupActivated(QAction * pAction) { if(!pAction || pAction == g_pMdiWindowSystemTextEncodingCurrentAction) return; - if(pAction == g_pMdiWindowSystemTextEncodingDefaultAction) - { + if(pAction == g_pMdiWindowSystemTextEncodingDefaultAction) { setTextEncoding(""); } else { QString szTmp = pAction->text(); @@ -807,11 +804,9 @@ void KviWindow::savePropertiesAsDefault() QString szGroup; getConfigGroupName(szGroup); + // save also the settings for THIS specialized window if(!KviQString::equalCI(szGroup,typeString())) - { - // save also the settings for THIS specialized window g_pMainWindow->saveWindowProperties(this,szGroup); - } g_pMainWindow->saveWindowProperties(this,typeString()); } @@ -858,8 +853,7 @@ void KviWindow::delayedClose() void KviWindow::closeEvent(QCloseEvent * pEvent) { pEvent->ignore(); - if(g_pMainWindow) - { + if(g_pMainWindow) { g_pMainWindow->childWindowCloseRequest(this); } else { /* In kvi_app destructor, g_pMainWindow gets deleted before modules gets unloaded. @@ -903,11 +897,9 @@ void KviWindow::inputMethodEvent(QInputMethodEvent * e) e->accept(); // we always accept the input method events + // recursion detected if(m_bProcessingInputEvent) - { - // recursion detected return; - } m_bProcessingInputEvent = true; @@ -921,7 +913,7 @@ void KviWindow::inputMethodEvent(QInputMethodEvent * e) m_bProcessingInputEvent = false; return; } - + if( m_pFocusHandler && (m_pFocusHandler != m_pLastFocusedChild) && @@ -937,9 +929,6 @@ void KviWindow::inputMethodEvent(QInputMethodEvent * e) m_bProcessingInputEvent = false; } - - - #ifdef FocusIn // Hack for X.h #undef FocusIn @@ -968,10 +957,9 @@ void KviWindow::focusInEvent(QFocusEvent *) if(m_pIrcView) m_pFocusHandler = m_pIrcView; else { - QList<QObject *> list = children(); - for(QList<QObject *>::Iterator it = list.begin(); it != list.end(); ++it) + for(auto& it : children()) { - QObject * pObj = *it; + QObject * pObj = it; if(pObj->isWidgetType()) { m_pFocusHandler = (QWidget *)pObj; @@ -1018,26 +1006,6 @@ bool KviWindow::eventFilter(QObject * pObject, QEvent * pEvent) if(QApplication::overrideCursor()) QApplication::restoreOverrideCursor(); break; -#if 0 - case QEvent::MouseButtonPress: - if((((QWidget *)pObject)->focusPolicy() == Qt::NoFocus) || - (((QWidget *)pObject)->focusPolicy() == Qt::TabFocus)) - { - // this will not focus our window - // set the focus to the focus handler - if(m_pLastFocusedChild) - { - if(m_pLastFocusedChild->hasFocus() && m_pLastFocusedChild->isVisible()) - return false; - } - - if(m_pFocusHandler) - m_pFocusHandler->setFocus(); - else - setFocus(); // we grab the focus (someone must do it, damn :D) - } - break; -#endif case QEvent::ChildAdded: if(((QChildEvent *)pEvent)->child()->isWidgetType()) childInserted((QWidget *)((QChildEvent *)pEvent)->child()); @@ -1073,14 +1041,11 @@ void KviWindow::childInserted(QWidget * pObject) } } - QList<QObject *> list = pObject->children(); - for(QList<QObject *>::Iterator it = list.begin(); it != list.end(); ++it) + for(auto& it : pObject->children()) { - QObject * pObj = *it; + QObject * pObj = it; if(pObj->isWidgetType()) - { childInserted((QWidget *)pObj); - } } } @@ -1095,18 +1060,15 @@ void KviWindow::childRemoved(QWidget * pObject) pObject->removeEventFilter(this); if(pObject == m_pFocusHandler) - m_pFocusHandler = NULL; + m_pFocusHandler = nullptr; if(pObject == m_pLastFocusedChild) - m_pLastFocusedChild = NULL; + m_pLastFocusedChild = nullptr; - QList<QObject *> list = pObject->children(); - for(QList<QObject *>::Iterator it = list.begin();it != list.end();++it) + for(auto& it : pObject->children()) { - QObject * pObj = *it; + QObject * pObj = it; if(pObj->isWidgetType()) - { childRemoved((QWidget *)pObj); - } } } @@ -1138,14 +1100,11 @@ void KviWindow::updateBackgrounds(QObject * pObject) QList<QObject *> list = pObject->children(); if(list.count()) { - for(QList<QObject *>::Iterator it = list.begin(); it != list.end(); ++it) + for(auto& it : list) { - QObject * pChild = *it; + QObject * pChild = it; if(pChild->metaObject()->indexOfProperty("TransparencyCapable") != -1) - { - //if (child->isWidgetType()) ((QWidget *)pChild)->update(); - } updateBackgrounds(pChild); } } @@ -1176,7 +1135,7 @@ void KviWindow::applyOptions() KviWindow * KviWindow::outputProxy() { - return 0; + return nullptr; } void KviWindow::lostUserFocus() @@ -1362,9 +1321,7 @@ void KviWindow::preprocessMessage(QString & szMessage) { // FIXME: slow - if(!m_pConsole) - return; - if(!m_pConsole->connection()) + if(!m_pConsole || !m_pConsole->connection()) return; static QString szNonStandardLinkPrefix = QString::fromLatin1("\r!["); @@ -1375,20 +1332,20 @@ void KviWindow::preprocessMessage(QString & szMessage) // FIXME: This STILL breaks $fmtlink() in certain configurations QStringList strings = szMessage.split(" "); - for(QStringList::Iterator it = strings.begin(); it != strings.end(); ++it ) + for(auto& it : strings) { - if(it->contains('\r')) + if(it.contains('\r')) continue; - QString szTmp(*it); + QString szTmp(it); szTmp = KviControlCodes::stripControlBytes(szTmp).trimmed(); if(szTmp.length() < 1) continue; if(m_pConsole->connection()->serverInfo()->supportedChannelTypes().contains(szTmp[0])) { - if((*it) == szTmp) - *it = QString("\r!c\r%1\r").arg(*it); + if(it == szTmp) + it = QString("\r!c\r%1\r").arg(it); else - *it = QString("\r!c%1\r%2\r").arg(szTmp,*it); + it = QString("\r!c%1\r%2\r").arg(szTmp,it); } } szMessage = strings.join(" "); @@ -1408,10 +1365,9 @@ QTextCodec * KviWindow::defaultTextCodec() KviIrcConnection * KviWindow::connection() { - if(console()) - if(console()->context()) - return console()->context()->connection(); - return 0; + if(console() && console()->context()) + return console()->context()->connection(); + return nullptr; } KviIrcContext * KviWindow::context() @@ -1423,5 +1379,5 @@ KviIrcContext * KviWindow::context() else return console()->context(); } - return 0; + return nullptr; } diff --git a/src/modules/objects/KvsObject_trayIcon.cpp b/src/modules/objects/KvsObject_trayIcon.cpp index e5dc4a2e1..e2591be50 100644 --- a/src/modules/objects/KvsObject_trayIcon.cpp +++ b/src/modules/objects/KvsObject_trayIcon.cpp @@ -205,7 +205,7 @@ KVSO_CLASS_FUNCTION(trayIcon,setContextMenu) c->warning(__tr2qs_ctx("Can't add a non-popupmenu object","objects")); return true; } - m_pTrayIcon->setContextMenu(((QMenu *)(ob->object()))); + m_pTrayIcon->setContextMenu(((QMenu *)(ob->object()))); return true; } KVSO_CLASS_FUNCTION(trayIcon,activatedEvent) |
