(parent);
+
if(pContainer)
{
m_pShowThisDialogAtStartupSelector = addBoolSelector(pContainer,__tr2qs_ctx("Show this dialog at startup","options"),KviOption_boolShowServersConnectDialogOnStart);
@@ -1488,8 +1457,10 @@ OptionsWidget_servers::~OptionsWidget_servers()
if(m_pClipboard)
delete m_pClipboard;
+
if(m_pServerDetailsDialog)
delete m_pServerDetailsDialog;
+
if(m_pNetworkDetailsDialog)
delete m_pNetworkDetailsDialog;
}
@@ -1523,6 +1494,7 @@ void OptionsWidget_servers::recentServersPopupClicked(QAction *pAction)
szItemText.remove(QChar('&'));
if(szItemText.isEmpty())
return;
+
if(szItemText == __tr2qs("Clear Recent Servers List"))
{
KviKvsScript::run("option stringlistRecentServers",c);
@@ -1575,10 +1547,13 @@ void OptionsWidget_servers::selectBestServerByUrl(const QString &szUrl)
if(pServerData->hostName().toLower() == oParts.szHost.toLower())
uScore++;
+
if(pServerData->port() == oParts.iPort)
uScore++;
+
if(pServerData->isIPv6() == oParts.bIPv6)
uScore++;
+
if(pServerData->useSSL() == oParts.bSsl)
uScore++;
@@ -1632,6 +1607,7 @@ void OptionsWidget_servers::fillServerList()
{
unsigned icon = s->favorite() ? KviIconManager::ServerFavorite : KviIconManager::Server;
srv = new IrcServerOptionsTreeWidgetItem(net,*(g_pIconManager->getSmallIcon(icon)),s);
+
if((s == r->currentServer()) && bCurrent)
{
srv->setSelected(true);
@@ -1687,6 +1663,7 @@ void OptionsWidget_servers::currentItemChanged(QTreeWidgetItem *it,QTreeWidgetIt
if(m_pConnectCurrent)
m_pConnectCurrent->setEnabled(false);
+
m_pSrvNetLabel->setEnabled(false);
m_pSrvNetEdit->setEnabled(false);
m_pSrvNetEdit->setText(__tr2qs_ctx("No selection","options"));
@@ -1739,6 +1716,7 @@ void OptionsWidget_servers::filterTextEdited(const QString &)
ch->m_pServerData->description().contains(szFilter, Qt::CaseInsensitive))
bHidden=false;
}
+
if(!bHidden)
uServers++;
ch->setHidden(bHidden);
@@ -1759,6 +1737,7 @@ void OptionsWidget_servers::saveLastItem()
QString tmp = m_pSrvNetEdit->text();
if(tmp.isEmpty())
tmp = QString::fromLatin1("irc.unknown.net");
+
m_pLastEditedItem->m_pServerData->setHostName(tmp);
m_pLastEditedItem->updateVisibleStrings();
} else if(m_pLastEditedItem->m_pNetworkData)
@@ -1766,6 +1745,7 @@ void OptionsWidget_servers::saveLastItem()
QString tmp = m_pSrvNetEdit->text();
if(tmp.isEmpty())
tmp = __tr2qs_ctx("UnknownNet","options");
+
m_pLastEditedItem->m_pNetworkData->setName(tmp);
m_pLastEditedItem->updateVisibleStrings();
}
@@ -1783,6 +1763,7 @@ void OptionsWidget_servers::commit()
network=(IrcServerOptionsTreeWidgetItem *) m_pTreeWidget->topLevelItem(i);
QString tmp = network->m_pNetworkData->name();
KviIrcNetwork * pNetwork = g_pServerDataBase->findNetwork(tmp);
+
if(pNetwork)
{
pNetwork->copyFrom(*(network->m_pNetworkData));
@@ -1791,6 +1772,7 @@ void OptionsWidget_servers::commit()
pNetwork->copyFrom(*(network->m_pNetworkData));
g_pServerDataBase->addNetwork(pNetwork);
}
+
if(network == m_pLastEditedItem)g_pServerDataBase->setCurrentNetwork(pNetwork->name());
IrcServerOptionsTreeWidgetItem * ch;
@@ -1798,17 +1780,20 @@ void OptionsWidget_servers::commit()
{
KviIrcServer *srv;
ch=(IrcServerOptionsTreeWidgetItem *)network->child(j);
+
if(ch->m_pServerData)
{
if(!ch->m_pServerData->hostName().isEmpty())
{
srv = pNetwork->findServer(ch->m_pServerData);
+
if(!srv)
{
srv = new KviIrcServer(*(ch->m_pServerData));
pNetwork->insertServer(srv);
} else *srv = *(ch->m_pServerData);
if(srv->id().isEmpty())srv->generateUniqueId();
+
if(ch == m_pLastEditedItem)
{
g_pServerDataBase->setCurrentNetwork(pNetwork->name());
@@ -1819,14 +1804,13 @@ void OptionsWidget_servers::commit()
}
}
-
- KVI_OPTION_BOOL(KviOption_boolShowFavoriteServersOnly) = m_pShowFavoritesOnlyButton->isChecked();
+ KVI_OPTION_BOOL(KviOption_boolShowFavoriteServersOnly) = m_pShowFavoritesOnlyButton->isChecked();
KviOptionsWidget::commit();
- // Ensure saving of the server DB
- g_pApp->saveIrcServerDataBase();
+ g_pApp->saveIrcServerDataBase(); // Ensure saving of the server DB
+
}
void OptionsWidget_servers::customContextMenuRequested(const QPoint &pnt)
@@ -1838,7 +1822,9 @@ void OptionsWidget_servers::customContextMenuRequested(const QPoint &pnt)
m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::NewNetwork)),__tr2qs_ctx("New Network","options"),this,SLOT(newNetwork()));
m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Remove)),__tr2qs_ctx("Remove Network","options"),this,SLOT(removeCurrent()))
->setEnabled(!bServer);
+
m_pContextPopup->addSeparator();
+
m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::NewServer)),__tr2qs_ctx("&New Server","options"),this,SLOT(newServer()));
m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::ServerFavorite)),
__tr2qs_ctx(bFavorite?"Unfavorite Server":"Favorite Server","options"),this,SLOT(favoriteServer()));
@@ -1849,7 +1835,9 @@ void OptionsWidget_servers::customContextMenuRequested(const QPoint &pnt)
m_pContextPopup->setEnabled(bServer);
m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Paste)),__tr2qs_ctx("&Paste Server","options"),this,SLOT(pasteServer()))
->setEnabled(m_pClipboard);
+
m_pContextPopup->addSeparator();
+
m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Folder)),__tr2qs_ctx("Import Server List","options"))->setMenu(m_pImportPopup);
m_pContextPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Remove)),__tr2qs_ctx("Clear Server List","options"),this,SLOT(clearList()));
m_pContextPopup->popup(QCursor::pos());
@@ -1926,6 +1914,7 @@ void OptionsWidget_servers::importerDead()
void OptionsWidget_servers::importServer(const KviIrcServer &s,const QString &network)
{
IrcServerOptionsTreeWidgetItem * net = findNetItem(network);
+
if(!net)
{
KviIrcNetwork d(network);
@@ -1977,6 +1966,7 @@ void OptionsWidget_servers::newServer()
if(m_pLastEditedItem)
{
IrcServerOptionsTreeWidgetItem * net;
+
if(m_pLastEditedItem->m_pServerData)
{
net = (IrcServerOptionsTreeWidgetItem *)m_pLastEditedItem->parent();
@@ -2041,11 +2031,8 @@ void OptionsWidget_servers::updateFavoritesFilter(bool bSet)
}
network->setHidden(!uServers);
}
-
- m_pShowFavoritesOnlyButton->setIcon(
- *(g_pIconManager->getSmallIcon(bSet ? KviIconManager::Favorite : KviIconManager::FavoriteOff))
- );
+ m_pShowFavoritesOnlyButton->setIcon(*(g_pIconManager->getSmallIcon(bSet ? KviIconManager::Favorite : KviIconManager::FavoriteOff)));
}
void OptionsWidget_servers::copyServer()
@@ -2075,8 +2062,7 @@ void OptionsWidget_servers::pasteServer()
}
else net = m_pLastEditedItem;
- IrcServerOptionsTreeWidgetItem * it = new IrcServerOptionsTreeWidgetItem(net,
- *(g_pIconManager->getSmallIcon(KviIconManager::Server)),m_pClipboard);
+ IrcServerOptionsTreeWidgetItem * it = new IrcServerOptionsTreeWidgetItem(net,*(g_pIconManager->getSmallIcon(KviIconManager::Server)),m_pClipboard);
it->m_pServerData->generateUniqueId(); // FIXME: This isn't necessarily unique...
@@ -2132,7 +2118,7 @@ void OptionsWidget_servers::clearList()
{
QString txt = "";
txt += __tr2qs_ctx("If you click Yes, all of your saved networks, servers, settings, and passwords will be lost.
"
- "Would you like to continue?","options");
+ "Would you like to continue?","options");
txt += "
";
if(QMessageBox::question(this,
--
cgit v1.3.1-10-gc9f91