LRESULT FavoriteHubsFrame::onOpenHubLog(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { if (ctrlHubs.GetSelectedCount() == 1) { int i = ctrlHubs.GetNextItem(-1, LVNI_SELECTED); FavoriteHubEntry* entry = (FavoriteHubEntry*)ctrlHubs.GetItemData(i); StringMap params; params["hubNI"] = entry->getName(); params["hubURL"] = entry->getServer(); params["myNI"] = entry->getNick(); WinUtil::openLog(SETTING(LOG_FILE_MAIN_CHAT), params, TSTRING(NO_LOG_FOR_HUB)); } return 0; }
LRESULT FavoriteHubsFrame::onOpenHubLog(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { if(ctrlHubs.GetSelectedCount() == 1) { int i = ctrlHubs.GetNextItem(-1, LVNI_SELECTED); FavoriteHubEntry* entry = (FavoriteHubEntry*)ctrlHubs.GetItemData(i); StringMap params; params["hubNI"] = entry->getName(); params["hubURL"] = entry->getServer(); params["myNI"] = entry->getNick(); tstring filename = Text::toT(Util::validateFileName(SETTING(LOG_DIRECTORY) + Util::formatParams(SETTING(LOG_FILE_MAIN_CHAT), params, false))); if(Util::fileExists(Text::fromT(filename))){ ShellExecute(NULL, NULL, filename.c_str(), NULL, NULL, SW_SHOWNORMAL); } else { MessageBox(CTSTRING(NO_LOG_FOR_HUB), CTSTRING(NO_LOG_FOR_HUB), MB_OK ); } } return 0; }
LRESULT FavoriteHubsFrame::onEdit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { int i = -1; if((i = ctrlHubs.GetNextItem(i, LVNI_SELECTED)) != -1) { FavoriteHubEntry* e = (FavoriteHubEntry*)ctrlHubs.GetItemData(i); dcassert(e != NULL); FavHubProperties dlg(e); if(dlg.DoModal(m_hWnd) == IDOK) { ctrlHubs.SetItemText(i, COLUMN_NAME, Text::toT(e->getName()).c_str()); ctrlHubs.SetItemText(i, COLUMN_DESCRIPTION, Text::toT(e->getDescription()).c_str()); ctrlHubs.SetItemText(i, COLUMN_SERVER, Text::toT(e->getServer()).c_str()); ctrlHubs.SetItemText(i, COLUMN_NICK, Text::toT(e->getNick(false)).c_str()); ctrlHubs.SetItemText(i, COLUMN_PASSWORD, tstring(e->getPassword().size(), '*').c_str()); ctrlHubs.SetItemText(i, COLUMN_USERDESCRIPTION, Text::toT(e->getUserDescription()).c_str()); } } return 0; }
void Client::reloadSettings(bool updateNick) { FavoriteHubEntry* hub = FavoriteManager::getInstance()->getFavoriteHubEntry(getHubUrl()); if(hub) { if(updateNick) { setCurrentNick(checkNick(hub->getNick(true))); } if(!hub->getUserDescription().empty()) { setCurrentDescription(hub->getUserDescription()); } else { setCurrentDescription(SETTING(DESCRIPTION)); } if(!hub->getPassword().empty()) setPassword(hub->getPassword()); } else { if(updateNick) { setCurrentNick(checkNick(SETTING(NICK))); } setCurrentDescription(SETTING(DESCRIPTION)); } }
void FavoriteHubs::init(){ model = new FavoriteHubModel(); setUnload(false); treeView->setModel(model); fakeNMDCTags = QStringList(); fakeADCTags = QStringList(); fakeNMDCTags << QString("%1").arg(fullVersionString) << "++ V:0.782" << "++ V:0.791" << "StrgDC++ V:2.42" << "ApexDC++ V:1.3.6" << "ApexDC++ V:1.5.1" << "FlylinkDC++ V:r500" << "FlylinkDC++ V:r500-x64" << "FlylinkDC++ V:r501-beta60" << "HomeDC++ V:2.22" << "FakeDC++ V:1.3"; fakeADCTags << QString("%1").arg(fullADCVersionString) << "++ 0.782" << "++ 0.791" << "StrgDC++ 2.42" << "ApexDC++ 1.3.6" << "ApexDC++ 1.5.1" << "FlylinkDC++ r500" << "FlylinkDC++ r500-x64" << "FlylinkDC++ r501-beta60" << "HomeDC++ 2.22" << "FakeDC++ 1.3"; const FavoriteHubEntryList& fl = FavoriteManager::getInstance()->getFavoriteHubs(); for(FavoriteHubEntryList::const_iterator i = fl.begin(); i != fl.end(); ++i) { FavoriteHubEntry* entry = *i; QList<QVariant> data; data << entry->getConnect() << _q(entry->getName()) << _q(entry->getDescription()) << _q(entry->getServer()) << _q(entry->getNick()) << _q(entry->getPassword()) << _q(entry->getUserDescription()) << WulforUtil::getInstance()->dcEnc2QtEnc(_q(entry->getEncoding())); model->addResult(data); } treeView->setRootIsDecorated(false); treeView->setContextMenuPolicy(Qt::CustomContextMenu); treeView->header()->setContextMenuPolicy(Qt::CustomContextMenu); treeView->viewport()->setAcceptDrops(false); // temporary treeView->setDragEnabled(false); // temporary treeView->setAcceptDrops(false); // temporary WulforUtil *WU = WulforUtil::getInstance(); add_newButton->setIcon(WU->getPixmap(WulforUtil::eiBOOKMARK_ADD)); changeButton->setIcon(WU->getPixmap(WulforUtil::eiEDIT)); removeButton->setIcon(WU->getPixmap(WulforUtil::eiEDITDELETE)); connectButton->setIcon(WU->getPixmap(WulforUtil::eiCONNECT)); load(); int row_num = model->rowCount(); if (row_num == 0){ changeButton->setEnabled(false); removeButton->setEnabled(false); connectButton->setEnabled(false); } connect(treeView, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotContexMenu(const QPoint&))); connect(treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(slotClicked(QModelIndex))); connect(treeView->header(), SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotHeaderMenu())); connect(treeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotDblClicked())); connect(add_newButton, SIGNAL(clicked()), this, SLOT(slotAdd_newButtonClicked())); connect(changeButton, SIGNAL(clicked()), this, SLOT(slotChangeButtonClicked())); connect(removeButton, SIGNAL(clicked()), this, SLOT(slotRemoveButtonClicked())); connect(connectButton, SIGNAL(clicked()), this, SLOT(slotConnectButtonClicked())); connect(WulforSettings::getInstance(), SIGNAL(strValueChanged(QString,QString)), this, SLOT(slotSettingsChanged(QString,QString))); ArenaWidget::setState( ArenaWidget::Flags(ArenaWidget::state() | ArenaWidget::Singleton | ArenaWidget::Hidden) ); }