void OAuthWizard::registerOAuthClient() { notifyMessage(tr("Registering client ...")); m_clientRegTryCount++; QUrl serverUrl(m_server); serverUrl.setPath("/api/client/register"); qDebug() << serverUrl; QNetworkRequest req; req.setUrl(serverUrl); req.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); QVariantMap post; post["type"] = "client_associate"; post["application_type"] = "native"; post["application_name"] = CLIENT_FANCY_NAME; post["logo_uri"] = "http://saz.im/images/pumpa.png"; QByteArray postData = serializeJson(post); // qDebug() << "data=" << postData; QNetworkReply *reply = m_nam->post(req, postData); connect(reply, SIGNAL(finished()), this, SLOT(onOAuthClientRegDone())); }
void QmlPreviewRunner::start() { ProjectExplorer::Target *target = nullptr; if (ProjectExplorer::RunConfiguration *config = runControl()->runConfiguration()) target = config->target(); m_connectionManager->setTarget(target); m_connectionManager->connectToServer(serverUrl()); reportStarted(); }
void AmpacheListEngine::sendHandshake(const QString server, const QString username, const QString key) { QString timestamp = QString::number(QDateTime::currentDateTime().toTime_t()); QString passPhrase = Utilities::sha256Of(timestamp + key); QString serverUrlStr = QString("%1/server/xml.server.php?action=handshake&auth=%2×tamp=%3&version=350001&user=%4") .arg(server) .arg(passPhrase) .arg(timestamp) .arg(username); KUrl serverUrl(serverUrlStr); if (!serverUrl.isEmpty()) { QString targetFile = QString("bangarang/temp/%1").arg(QString("ampacheResult")); KUrl targetUrl = KUrl(KStandardDirs::locateLocal("data", targetFile, true)); connectDownloader(); emit download(serverUrl, targetUrl); } }
// Called if the user changes the user- or url field. Adjust the texts and // evtl. warnings on the dialog. void OwncloudAdvancedSetupPage::updateStatus() { const QString locFolder = localFolder(); const QString url = static_cast<OwncloudWizard *>(wizard())->ocUrl(); const QString user = static_cast<OwncloudWizard *>(wizard())->getCredentials()->user(); QUrl serverUrl(url); serverUrl.setUserName(user); // check if the local folder exists. If so, and if its not empty, show a warning. QString errorStr = FolderMan::instance()->checkPathValidityForNewFolder(locFolder, serverUrl); _localFolderValid = errorStr.isEmpty(); QString t; _ui.pbSelectLocalFolder->setText(QDir::toNativeSeparators(locFolder)); if (dataChanged()) { if( _remoteFolder.isEmpty() || _remoteFolder == QLatin1String("/") ) { t = ""; } else { t = tr("%1 folder '%2' is synced to local folder '%3'") .arg(Theme::instance()->appName()).arg(_remoteFolder) .arg(QDir::toNativeSeparators(locFolder)); _ui.rSyncEverything->setText(tr("Sync the folder '%1'").arg(_remoteFolder)); } const bool dirNotEmpty(QDir(locFolder).entryList(QDir::AllEntries | QDir::NoDotAndDotDot).count() > 0); if(dirNotEmpty) { t += tr("<p><small><strong>Warning:</strong> The local folder is not empty. " "Pick a resolution!</small></p>"); } _ui.resolutionWidget->setVisible(dirNotEmpty); } else { _ui.resolutionWidget->setVisible(false); } _ui.syncModeLabel->setText(t); _ui.syncModeLabel->setFixedHeight(_ui.syncModeLabel->sizeHint().height()); wizard()->resize(wizard()->sizeHint()); setErrorString(errorStr); emit completeChanged(); }
void SettingsDialog::refreshTodoCalendarList(QStringList items, bool forceReadCheckedState) { // we want to read the checked state from the settings if the // todo calendar list was not empty bool readCheckedState = forceReadCheckedState ? true : ui->todoCalendarListWidget->count() > 0; // clear the todo calendar list ui->todoCalendarListWidget->clear(); QSettings settings; QStringList todoCalendarEnabledList = settings.value( "ownCloud/todoCalendarEnabledList").toStringList(); QListIterator<QString> itr(items); while (itr.hasNext()) { QString url = itr.next(); QUrl serverUrl(ui->serverUrlEdit->text()); // continue if server url isn't valid if (!serverUrl.isValid()) { continue; } QString serverUrlText(serverUrl.toString()); QString serverUrlPath = serverUrl.path(); if (serverUrlPath != "") { // remove the path from the end because we already got it in the url serverUrlText.replace(QRegularExpression( QRegularExpression::escape(serverUrlPath) + "$"), ""); } // only add the server url if it wasn't already added if (!url.startsWith(serverUrlText)) { url = serverUrlText + url; } // get the name out of the url part QRegularExpression regex("\\/([^\\/]*)\\/$"); QRegularExpressionMatch match = regex.match(url); QString name = match.captured(1); // remove percent encoding name = QUrl::fromPercentEncoding(name.toLatin1()); // skip the contact birthdays calendar if (name == "contact_birthdays") { continue; } // skip the Calendar Plus birthday calendar if (name.startsWith("bdaycpltocal_")) { continue; } // create the list widget item and add it to the // todo calendar list widget QListWidgetItem *item = new QListWidgetItem(name); // eventually check if item was checked Qt::CheckState checkedState = readCheckedState ? (todoCalendarEnabledList.contains(name) ? Qt::Checked : Qt::Unchecked) : Qt::Checked; item->setCheckState(checkedState); item->setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); item->setToolTip(url); ui->todoCalendarListWidget->addItem(item); } }