Location * LocationsFactory::setNewPath(const QString& uPath, const QString& authUser, const QString& passwd, bool savePassword) { storeValidFileInfo(0); CleanUrl url(uPath); m_lastUrlNeedsAuthentication = false; NetAuthenticationData authData(authUser, passwd); if (authData.isEmpty() && url.hasAuthenticationData()) { authData.user = url.user(); authData.password = url.password(); } Location *location = parse(url.cleanUrl()); if (location) { DirItemInfo *item = validateCurrentUrl(location,authData); if (item) { //now if there is Authentication Data //at this point item is ready and authentication if necessary worked if (item && !authData.isEmpty()) { m_authDataStore->store(item->authenticationPath(), authData.user, authData.password, savePassword); } //isContentReadable() must already carry execution permission if (item->isValid() && item->isBrowsable() && item->isContentReadable()) { location->setInfoItem(item); if (location != m_curLoc) { if (m_curLoc) { m_curLoc->stopWorking(); } emit locationChanged(m_curLoc, location); location->startWorking(); m_curLoc = location; } } else { storeValidFileInfo(item); location = 0; } } else { // not valid location = 0; } } #if DEBUG_MESSAGES qDebug() << Q_FUNC_INFO << "input path:" << uPath << "location result:" << location; #endif return location; }
NewTransferDlg::NewTransferDlg(QWidget* parent) : QDialog(parent), m_bDetails(false), m_bPaused(false), m_nDownLimit(0), m_nUpLimit(0), m_nClass(-1), m_mode(Transfer::Download), m_nQueue(0) { setupUi(this); textURIs->setFocus(Qt::OtherFocusReason); spinDown->setRange(0,INT_MAX); spinUp->setRange(0,INT_MAX); connect(toolBrowse, SIGNAL(pressed()), this, SLOT(browse())); connect(radioDownload, SIGNAL(clicked()), this, SLOT(switchMode())); connect(radioUpload, SIGNAL(clicked()), this, SLOT(switchMode())); connect(pushAddFiles, SIGNAL(clicked()), this, SLOT(browse2())); connect(toolAuth, SIGNAL(clicked()), this, SLOT(authData())); connect(toolAuth2, SIGNAL(clicked()), this, SLOT(authData())); comboClass->addItem(tr("Auto detect")); for(int i=0;i<g_enginesDownload.size();i++) comboClass->addItem(g_enginesDownload[i].longName); comboClass2->addItem(tr("Auto detect")); for(int i=0;i<g_enginesUpload.size();i++) comboClass2->addItem(g_enginesUpload[i].longName); QMenu* menu = new QMenu(toolAddSpecial); QAction* act; act = menu->addAction(tr("Add local files...")); connect(act, SIGNAL(triggered()), this, SLOT(browse2())); act = menu->addAction(tr("Add contents of a text file...")); connect(act, SIGNAL(triggered()), this, SLOT(addTextFile())); act = menu->addAction(tr("Add from clipboard")); connect(act, SIGNAL(triggered()), this, SLOT(addClipboard())); toolAddSpecial->setMenu(menu); }