diff options
| author | 2008-02-24 20:21:08 +0000 | |
|---|---|---|
| committer | 2008-02-24 20:21:08 +0000 | |
| commit | c62ac2d28b386fc64504cea5ef08671e4fc4b7b6 (patch) | |
| tree | a81f609d9044902840064ddd4666d7c48fb29dd1 | |
| parent | fixed doc (diff) | |
| download | KVIrc-c62ac2d28b386fc64504cea5ef08671e4fc4b7b6.tar.gz KVIrc-c62ac2d28b386fc64504cea5ef08671e4fc4b7b6.tar.bz2 KVIrc-c62ac2d28b386fc64504cea5ef08671e4fc4b7b6.zip | |
Fixed ticket 63 and 67
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1148 17fca916-40b9-46aa-a4ea-0a15b648b75c
| -rw-r--r-- | src/kvilib/core/kvi_pointerlist.h | 29 | ||||
| -rw-r--r-- | src/kvirc/kvs/kvi_kvs_parser_specialcommands.cpp | 18 | ||||
| -rw-r--r-- | src/modules/notifier/notifierwindowtabs.cpp | 7 |
3 files changed, 40 insertions, 14 deletions
diff --git a/src/kvilib/core/kvi_pointerlist.h b/src/kvilib/core/kvi_pointerlist.h index afe08e526..b36813768 100644 --- a/src/kvilib/core/kvi_pointerlist.h +++ b/src/kvilib/core/kvi_pointerlist.h @@ -642,7 +642,7 @@ public: /// /// Sets the iteration pointer to the next item in the list /// and returns that item (or 0 if the end of the list has been reached) - /// A call to this function MUST be preceded by a call to + /// A call to this function MUST be preceded by a _succesfull_ call to /// first(),last(),at() or findRef() /// T * next() @@ -653,9 +653,22 @@ public: } /// + /// Sets the iteration pointer to the next item in the list + /// and returns that item (or 0 if the end of the list has been reached) + /// Calls to this function are safer than next(): you can call safeNext() + /// even if first(),last(),at() or a previous call of next() has failed. + /// + T * safeNext() + { + if(!m_pAux)return NULL; + return next(); + } + + + /// /// Sets the iteration pointer to the previous item in the list /// and returns that item (or 0 if the beginning of the list has been reached) - /// A call to this function MUST be preceded by a call to + /// A call to this function MUST be preceded by a _succesfull_ call to /// first(),last(),at() or findRef() /// T * prev() @@ -666,6 +679,18 @@ public: } /// + /// Sets the iteration pointer to the previous item in the list + /// and returns that item (or 0 if the beginning of the list has been reached) + /// Calls to this function are safer than next(): you can call safeNext() + /// even if first(),last(),at() or a previous call of next() has failed. + /// + T * safePrev() + { + if(!m_pAux)return NULL; + return prev(); + } + + /// /// Sets the iteration pointer to the nTh item in the list /// and returns that item (or 0 if the index is out of range) /// diff --git a/src/kvirc/kvs/kvi_kvs_parser_specialcommands.cpp b/src/kvirc/kvs/kvi_kvs_parser_specialcommands.cpp index 756cd25f2..aa0eafe55 100644 --- a/src/kvirc/kvs/kvi_kvs_parser_specialcommands.cpp +++ b/src/kvirc/kvs/kvi_kvs_parser_specialcommands.cpp @@ -1705,9 +1705,9 @@ KviKvsTreeNodeSpecialCommandDefpopupLabelPopup * KviKvsParser::parseSpecialComma delete pPopup; return 0; } - QString * pIcon = pParameters->next(); + QString * pIcon = pParameters->safeNext(); if(KVSP_curCharUnicode == ';')KVSP_skipChar; - QString * pItemName = pParameters->next(); + QString * pItemName = pParameters->safeNext(); pPopup->addLabel(new KviKvsTreeNodeSpecialCommandDefpopupLabelLabel(pLabelBegin,szCondition,*pText,pIcon ? *pIcon : QString::null,pItemName ? *pItemName : QString::null)); delete pParameters; } else if(szLabelLow == "popup") @@ -1724,8 +1724,8 @@ KviKvsTreeNodeSpecialCommandDefpopupLabelPopup * KviKvsParser::parseSpecialComma delete pPopup; return 0; } - QString * pIcon = pParameters->next(); - QString * pItemName = pParameters->next(); + QString * pIcon = pParameters->safeNext(); + QString * pItemName = pParameters->safeNext(); KviKvsTreeNodeSpecialCommandDefpopupLabelPopup * pSubPopup = parseSpecialCommandDefpopupLabelPopup(); if(!pSubPopup) @@ -1755,8 +1755,8 @@ KviKvsTreeNodeSpecialCommandDefpopupLabelPopup * KviKvsParser::parseSpecialComma delete pPopup; return 0; } - QString * pIcon = pParameters->next(); - QString * pItemName = pParameters->next(); + QString * pIcon = pParameters->safeNext(); + QString * pItemName = pParameters->safeNext(); const QChar * pBegin = KVSP_curCharPointer; KviKvsTreeNodeInstruction * pInstruction = parseInstruction(); @@ -1803,7 +1803,7 @@ KviKvsTreeNodeSpecialCommandDefpopupLabelPopup * KviKvsParser::parseSpecialComma delete pPopup; return 0; } - QString * pName = pParameters->next(); + QString * pName = pParameters->safeNext(); if(!pName) { error(pLabelBegin,__tr2qs("Unexpected empty <name> field in extpopup parameters. See /help defpopup for the syntax")); @@ -1811,8 +1811,8 @@ KviKvsTreeNodeSpecialCommandDefpopupLabelPopup * KviKvsParser::parseSpecialComma delete pPopup; return 0; } - QString * pIcon = pParameters->next(); - QString * pItemName = pParameters->next(); + QString * pIcon = pParameters->safeNext(); + QString * pItemName = pParameters->safeNext(); if(KVSP_curCharUnicode == ';')KVSP_skipChar; pPopup->addLabel(new KviKvsTreeNodeSpecialCommandDefpopupLabelExtpopup(pLabelBegin,szCondition,*pText,pIcon ? *pIcon : QString::null,*pName,pItemName ? *pItemName : QString::null)); delete pParameters; diff --git a/src/modules/notifier/notifierwindowtabs.cpp b/src/modules/notifier/notifierwindowtabs.cpp index e13a8f219..937e4055a 100644 --- a/src/modules/notifier/notifierwindowtabs.cpp +++ b/src/modules/notifier/notifierwindowtabs.cpp @@ -77,7 +77,7 @@ KviNotifierWindowTab::~KviNotifierWindowTab() void KviNotifierWindowTab::setNextMessageAsCurrent() { if(!m_pCurrentMessage)return; - m_pMessageList->findRef(m_pCurrentMessage); + if(m_pMessageList->findRef(m_pCurrentMessage) == -1)return; m_pCurrentMessage = m_pMessageList->next(); if(!m_pCurrentMessage)m_pCurrentMessage = m_pMessageList->last(); } @@ -85,7 +85,7 @@ void KviNotifierWindowTab::setNextMessageAsCurrent() void KviNotifierWindowTab::setPrevMessageAsCurrent() { if(!m_pCurrentMessage)return; - m_pMessageList->findRef(m_pCurrentMessage); + if(!m_pMessageList->findRef(m_pCurrentMessage) == -1)return; m_pCurrentMessage = m_pMessageList->prev(); if(!m_pCurrentMessage)m_pCurrentMessage = m_pMessageList->first(); } @@ -185,7 +185,8 @@ KviNotifierWindowTabs::KviNotifierWindowTabs(QRect r) m_pWndTabFocused = 0; m_iTabToStartFrom = 0; - m_tabPtrList.clear(); + m_tabPtrList.setAutoDelete(false); // FIXME: should take a closer look at this + m_lastVisitedTabPtrList.setAutoDelete(false); loadImages(); initConfig(); |
