aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kvirc/kernel/kvi_app.cpp113
-rw-r--r--src/kvirc/kernel/kvi_app.h15
-rw-r--r--src/kvirc/kernel/kvi_options.cpp2
-rw-r--r--src/kvirc/kernel/kvi_options.h2
-rw-r--r--src/kvirc/ui/kvi_console.cpp2
-rw-r--r--src/modules/channelsjoin/channelsjoinwindow.cpp68
-rw-r--r--src/modules/notifier/notifierwindowtab.cpp1
7 files changed, 130 insertions, 73 deletions
diff --git a/src/kvirc/kernel/kvi_app.cpp b/src/kvirc/kernel/kvi_app.cpp
index 471e0c9b1..42c986b93 100644
--- a/src/kvirc/kernel/kvi_app.cpp
+++ b/src/kvirc/kernel/kvi_app.cpp
@@ -187,13 +187,13 @@ KviApp::KviApp(int &argc,char ** argv)
m_bCreateConfig = false;
m_bShowSplashScreen = true;
m_bUpdateGuiPending = false;
- m_pPendingAvatarChanges = 0;
- m_pRecentChannelsDict = 0;
+ m_pPendingAvatarChanges = NULL;
+ m_pRecentChannelDict = NULL;
#ifndef COMPILE_NO_IPC
- m_pIpcSentinel = 0;
+ m_pIpcSentinel = NULL;
#endif
m_iHeartbeatTimerId = -1;
- defaultFont = font();
+ m_fntDefaultFont = font();
// next step is setup()
m_bSetupDone = false;
kvi_socket_flushTrafficCounters();
@@ -597,7 +597,8 @@ KviApp::~KviApp()
saveOptions();
saveIdentities();
KviUserIdentityManager::done();
- if(m_pRecentChannelsDict) delete m_pRecentChannelsDict;
+ if(m_pRecentChannelDict)
+ delete m_pRecentChannelDict;
// now kill the stuff that the frame depends on
saveIrcServerDataBase();
delete g_pServerDataBase;
@@ -1204,15 +1205,11 @@ void KviApp::updateApplicationFont()
{
setFont(KVI_OPTION_FONT(KviOption_fontApplication));
if(g_pFrame)
- {
g_pFrame->setFont(font());
- }
} else {
- setFont(defaultFont);
+ setFont(m_fntDefaultFont);
if(g_pFrame)
- {
- g_pFrame->setFont(defaultFont);
- }
+ g_pFrame->setFont(m_fntDefaultFont);
}
}
@@ -1697,75 +1694,86 @@ void KviApp::addRecentNickname(const QString& newNick)
void KviApp::addRecentChannel(const QString& szChan,const QString& net)
{
- if(!m_pRecentChannelsDict)
+ if(!m_pRecentChannelDict)
buildRecentChannels();
- QStringList* pList=m_pRecentChannelsDict->find(net.toUtf8().data());
- if(pList)
- {
- if(!pList->contains(szChan)) pList->append(szChan);
- }
- else
+
+ QStringList * pList = m_pRecentChannelDict->find(net);
+ if(!pList)
{
- pList=new QStringList(szChan);
- m_pRecentChannelsDict->insert(net.toUtf8().data(),pList);
+ pList = new QStringList(szChan);
+ m_pRecentChannelDict->insert(net,pList);
}
+
+ if(!pList->contains(szChan))
+ pList->append(szChan);
}
+
void KviApp::buildRecentChannels()
{
- if(m_pRecentChannelsDict)
- delete m_pRecentChannelsDict;
- m_pRecentChannelsDict = new KviPointerHashTable<const char *,QStringList>;
- m_pRecentChannelsDict->setAutoDelete(TRUE);
+ if(m_pRecentChannelDict)
+ delete m_pRecentChannelDict;
+
+ m_pRecentChannelDict = new KviPointerHashTable<QString,QStringList>;
+ m_pRecentChannelDict->setAutoDelete(TRUE);
+
QString szChan,szNet;
+
for (
QStringList::Iterator it = KVI_OPTION_STRINGLIST(KviOption_stringlistRecentChannels).begin();
it != KVI_OPTION_STRINGLIST(KviOption_stringlistRecentChannels).end();
++it
)
{
- if(!(*it).isEmpty())
+ if((*it).isEmpty())
+ continue;
+
+ szChan = (*it).section(KVI_RECENT_CHANNELS_SEPARATOR,0,0);
+ szNet = (*it).section(KVI_RECENT_CHANNELS_SEPARATOR,1);
+
+ if(szNet.isEmpty())
+ continue;
+
+ QStringList* pList = m_pRecentChannelDict->find(szNet);
+ if(!pList)
{
- szChan = (*it).section( KVI_RECENT_CHANNELS_SEPARATOR, 0, 0 );
- szNet = (*it).section( KVI_RECENT_CHANNELS_SEPARATOR, 1 );
- if(!szNet.isEmpty())
- {
- QStringList* pList=m_pRecentChannelsDict->find(szNet.toUtf8().data());
- if(pList)
- {
- if(!pList->contains(szChan)) pList->append(szChan);
- }
- else
- {
- pList=new QStringList(szChan);
- m_pRecentChannelsDict->insert(szNet.toUtf8().data(),pList);
- }
- }
+ pList=new QStringList(szChan);
+ m_pRecentChannelDict->insert(szNet,pList);
}
+
+ if(!pList->contains(szChan))
+ pList->append(szChan);
}
}
void KviApp::saveRecentChannels()
{
- if(!m_pRecentChannelsDict) return;
+ if(!m_pRecentChannelDict)
+ return;
+
QString szTmp;
+
KVI_OPTION_STRINGLIST(KviOption_stringlistRecentChannels).clear();
- KviPointerHashTableIterator<const char *,QStringList> it( *m_pRecentChannelsDict );
+
+ KviPointerHashTableIterator<QString,QStringList> it( *m_pRecentChannelDict );
+
for( ; it.current(); ++it )
{
- for ( QStringList::Iterator it_str = it.current()->begin(); it_str != it.current()->end(); ++it_str ) {
+ for(QStringList::Iterator it_str = it.current()->begin(); it_str != it.current()->end(); ++it_str)
+ {
szTmp=*it_str;
szTmp.append(KVI_RECENT_CHANNELS_SEPARATOR);
szTmp.append(it.currentKey());
KVI_OPTION_STRINGLIST(KviOption_stringlistRecentChannels).append(szTmp);
}
- }
+ }
}
-QStringList* KviApp::getRecentChannels(const QString& net)
+QStringList * KviApp::recentChannelsForNetwork(const QString& net)
{
- if(!m_pRecentChannelsDict) buildRecentChannels();
- return m_pRecentChannelsDict->find(net.toUtf8().data());
+ if(!m_pRecentChannelDict)
+ buildRecentChannels();
+ return m_pRecentChannelDict->find(net);
}
void KviApp::addRecentServer(const QString& server)
@@ -1809,17 +1817,18 @@ void KviApp::fillRecentChannelsPopup(KviTalPopupMenu * m,KviConsole * pConsole)
{
m->clear();
int id;
- QStringList* pList=getRecentChannels(pConsole->currentNetworkName());
+ QStringList* pList = recentChannelsForNetwork(pConsole->currentNetworkName());
if(pList)
{
for(QStringList::Iterator it = pList->begin(); it != pList->end(); ++it)
{
- if(*it == "") continue;
+ if(*it == "")
+ continue; // ?
id = m->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CHANNEL)),*it);
- if(!pConsole->isConnected())m->setItemEnabled(id,false);
- else {
+ if(!pConsole->isConnected())
+ m->setItemEnabled(id,false);
+ else
m->setItemEnabled(id,!(pConsole->connection()->findChannel(*it)));
- }
}
}
}
diff --git a/src/kvirc/kernel/kvi_app.h b/src/kvirc/kernel/kvi_app.h
index 6526cc947..ebd1cfd29 100644
--- a/src/kvirc/kernel/kvi_app.h
+++ b/src/kvirc/kernel/kvi_app.h
@@ -34,8 +34,6 @@
#include "kvi_time.h"
#include "kvi_pointerhashtable.h" // ?
-#define KVI_RECENT_CHANNELS_SEPARATOR ":"
-
#ifdef COMPILE_ON_WINDOWS
// The brain damaged MSVC compiler can't instantiate templates without this
#include "kvi_frame.h"
@@ -104,14 +102,14 @@ protected:
bool m_bUpdateGuiPending;
KviPointerList<KviPendingAvatarChange> * m_pPendingAvatarChanges;
bool m_bSetupDone;
- KviPointerHashTable<const char *,QStringList> * m_pRecentChannelsDict;
+ KviPointerHashTable<QString,QStringList> * m_pRecentChannelDict;
#ifdef COMPILE_PSEUDO_TRANSPARENCY
bool m_bUpdatePseudoTransparencyPending;
#endif
#ifndef COMPILE_NO_IPC
KviIpcSentinel * m_pIpcSentinel;
#endif
- QFont defaultFont;
+ QFont m_fntDefaultFont;
public:
// setup stuff (accessed from kvi_main.cpp: consider private othwerise)
QString m_szConfigFile; // setup
@@ -276,7 +274,14 @@ public:
void addRecentNickname(const QString& newNick);
void addRecentChannel(const QString& chan,const QString& net);
- QStringList* getRecentChannels(const QString& net);
+
+ QStringList * recentChannelsForNetwork(const QString& net);
+
+ KviPointerHashTable<QString,QStringList> * recentChannels() const
+ {
+ return m_pRecentChannelDict;
+ }
+
void addRecentServer(const QString& server);
void fillRecentServersPopup(KviTalPopupMenu * m);
diff --git a/src/kvirc/kernel/kvi_options.cpp b/src/kvirc/kernel/kvi_options.cpp
index 0401b30e3..01841dbc2 100644
--- a/src/kvirc/kernel/kvi_options.cpp
+++ b/src/kvirc/kernel/kvi_options.cpp
@@ -422,7 +422,7 @@ KviStringListOption g_stringlistOptionsTable[KVI_NUM_STRINGLIST_OPTIONS]=
{
STRINGLIST_OPTION("HighlightWords",KviOption_sectFlagIrcView),
STRINGLIST_OPTION("SpamWords",KviOption_sectFlagAntiSpam),
- STRINGLIST_OPTION_WITHDEFAULT("RecentChannels",KviOption_sectFlagRecent,"#kvirc"),
+ STRINGLIST_OPTION_WITHDEFAULT("RecentChannels",KviOption_sectFlagRecent,"#kvirc" KVI_RECENT_CHANNELS_SEPARATOR "freenode"),
STRINGLIST_OPTION("RecentServers",KviOption_sectFlagRecent),
STRINGLIST_OPTION("RecentNicknames",KviOption_sectFlagRecent),
STRINGLIST_OPTION("ModuleExtensionToolbars",KviOption_sectFlagFrame),
diff --git a/src/kvirc/kernel/kvi_options.h b/src/kvirc/kernel/kvi_options.h
index 609fdb552..378136daf 100644
--- a/src/kvirc/kernel/kvi_options.h
+++ b/src/kvirc/kernel/kvi_options.h
@@ -697,6 +697,8 @@ extern KVIRC_API KviStringListOption g_stringlistOptionsTable[KVI_NUM_STRINGLIST
#define SET_ANTI_ALIASING(p) (p).setRenderHint(QPainter::TextAntialiasing);
+#define KVI_RECENT_CHANNELS_SEPARATOR ":"
+
#if defined(_KVI_OPTIONS_CPP_) || defined(_WANT_OPTION_FLAGS_)
// flag definitions
diff --git a/src/kvirc/ui/kvi_console.cpp b/src/kvirc/ui/kvi_console.cpp
index 99ebcd01f..2baf9d558 100644
--- a/src/kvirc/ui/kvi_console.cpp
+++ b/src/kvirc/ui/kvi_console.cpp
@@ -254,7 +254,7 @@ void KviConsole::completeChannel(const QString &word,KviPointerList<QString> * m
if(kvi_strEqualCIN(c->windowName(),word.ptr(),word.len()))matches->append(new KviStr((*it)
}
*/
- QStringList *pList = g_pApp->getRecentChannels(currentNetworkName());
+ QStringList *pList = g_pApp->recentChannelsForNetwork(currentNetworkName());
if(pList)
{
for(QStringList::Iterator it = pList->begin(); it != pList->end(); ++it)
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)