void FavoriteHubsFrame::openSelected() { if (!checkNick()) return; int i = -1; while ((i = ctrlHubs.GetNextItem(i, LVNI_SELECTED)) != -1) { FavoriteHubEntry* entry = (FavoriteHubEntry*)ctrlHubs.GetItemData(i); RecentHubEntry r; r.setName(entry->getName()); r.setDescription(entry->getDescription()); r.setUsers("*"); r.setShared("*"); r.setServer(entry->getServer()); FavoriteManager::getInstance()->addRecent(r); HubFrame::openWindow(true, entry->getServer(), entry->getName(), entry->getRawOne(), entry->getRawTwo(), entry->getRawThree(), entry->getRawFour(), entry->getRawFive(), entry->getWindowPosX(), entry->getWindowPosY(), entry->getWindowSizeX(), entry->getWindowSizeY(), entry->getWindowType(), entry->getChatUserSplit(), entry->getUserListState(), entry->getSuppressChatAndPM()); } return; }
void FavoriteHubsFrame::openSelected() { if(!checkNick()) return; int i = -1; while( (i = ctrlHubs.GetNextItem(i, LVNI_SELECTED)) != -1) { FavoriteHubEntry* entry = (FavoriteHubEntry*)ctrlHubs.GetItemData(i); RecentHubEntryPtr r = new RecentHubEntry(entry->getServer()); r->setName(entry->getName()); r->setDescription(entry->getDescription()); ClientManager::getInstance()->createClient(r); // no multithreading because of disorder! } return; }
void FavoriteHubsFrame::openSelected() { if(!checkNick()) return; int i = -1; while( (i = ctrlHubs.GetNextItem(i, LVNI_SELECTED)) != -1) { FavoriteHubEntry* entry = (FavoriteHubEntry*)ctrlHubs.GetItemData(i); RecentHubEntry r; r.setName(entry->getName()); r.setDescription(entry->getDescription()); r.setUsers("*"); r.setShared("*"); r.setServer(entry->getServer()); FavoriteManager::getInstance()->addRecent(r); HubFrame::openWindow(Text::toT(entry->getServer()) , entry->getChatUserSplit(), entry->getUserListState()); } return; }
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 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) ); }