diff options
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/channelsjoin/channelsjoinwindow.cpp | 68 | ||||
| -rw-r--r-- | src/modules/notifier/notifierwindowtab.cpp | 1 |
2 files changed, 55 insertions, 14 deletions
diff --git a/src/modules/channelsjoin/channelsjoinwindow.cpp b/src/modules/channelsjoin/channelsjoinwindow.cpp index d98953132..cc1317513 100644 --- a/src/modules/channelsjoin/channelsjoinwindow.cpp +++ b/src/modules/channelsjoin/channelsjoinwindow.cpp @@ -162,39 +162,79 @@ void KviChannelsJoinWindow::fillListView() m_pTreeWidget->header()->hide(); + // Registered channels go first + QTreeWidgetItem * par = new QTreeWidgetItem(m_pTreeWidget); + par->setText(0,__tr2qs("Registered Channels")); + par->setExpanded(true); + + KviPointerHashTable<const char *,KviRegisteredChannelList> * d = g_pRegisteredChannelDataBase->channelDict(); + if(d) + { + KviPointerHashTableIterator<const char *,KviRegisteredChannelList> it(*d); + while(it.current()) + { + QTreeWidgetItem * chld = new QTreeWidgetItem(par); + chld->setText(0,it.currentKey()); + chld->setIcon(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CHANNEL))); + ++it; + } + } + + par = new QTreeWidgetItem(m_pTreeWidget); par->setText(0,__tr2qs("Recent Channels")); par->setExpanded(true); + QTreeWidgetItem * chld; + bool bGotChanOnCurrentNetwork = false; + if(m_pConsole) { - QStringList * pList = g_pApp->getRecentChannels(m_pConsole->currentNetworkName()); + QStringList * pList = g_pApp->recentChannelsForNetwork(m_pConsole->currentNetworkName()); if(pList) { - for(QStringList::Iterator it = pList->begin(); it != pList->end(); ++it) + if(pList->count() > 0) { - chld = new QTreeWidgetItem(par); - chld->setText(0,*it); - chld->setIcon(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CHANNEL))); + bGotChanOnCurrentNetwork = true; + + par = new QTreeWidgetItem(par); + par->setText(0,__tr2qs("Current Network")); + par->setExpanded(true); + + for(QStringList::Iterator it = pList->begin(); it != pList->end(); ++it) + { + chld = new QTreeWidgetItem(par); + chld->setText(0,*it); + chld->setIcon(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CHANNEL))); + } } } } - par = new QTreeWidgetItem(m_pTreeWidget); - par->setText(0,__tr2qs("Registered Channels")); - par->setExpanded(true); + KviPointerHashTable<QString,QStringList> * pDict = g_pApp->recentChannels(); + if(!pDict) + return; - KviPointerHashTable<const char *,KviRegisteredChannelList> * d = g_pRegisteredChannelDataBase->channelDict(); - if(d) + par = new QTreeWidgetItem(par); + par->setText(0,__tr2qs("All Networks")); + + if(!bGotChanOnCurrentNetwork) + par->setExpanded(true); // expand this one instead + + QHash<QString,int> hNoDuplicates; + + for(QStringList * pChans = pDict->first();pChans;pChans = pDict->next()) { - KviPointerHashTableIterator<const char *,KviRegisteredChannelList> it(*d); - while(it.current()) + for(QStringList::Iterator it = pChans->begin(); it != pChans->end(); ++it) { + QString chan = *it; + if(hNoDuplicates.contains(chan.toLower())) + continue; + hNoDuplicates.insert(chan.toLower(),1); chld = new QTreeWidgetItem(par); - chld->setText(0,it.currentKey()); + chld->setText(0,chan); chld->setIcon(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CHANNEL))); - ++it; } } } diff --git a/src/modules/notifier/notifierwindowtab.cpp b/src/modules/notifier/notifierwindowtab.cpp index 8c048a4b3..e4a29cf7e 100644 --- a/src/modules/notifier/notifierwindowtab.cpp +++ b/src/modules/notifier/notifierwindowtab.cpp @@ -40,6 +40,7 @@ extern KviNotifierWindow * g_pNotifierWindow; KviNotifierWindowTab::KviNotifierWindowTab(KviWindow * pWnd, QTabWidget *parent) + : QScrollArea(parent) { m_pWnd = pWnd; if(m_pWnd) |
