QString ownCloudTheme::about() const { QString devString; #ifdef GIT_SHA1 const QString githubPrefix(QLatin1String( " https://github.com/owncloud/mirall/commit/")); const QString gitSha1(QLatin1String(GIT_SHA1)); devString = QCoreApplication::translate("ownCloudTheme::about()", "<p><small>Built from Git revision <a href=\"%1\">%2</a>" " on %3, %4<br>using OCsync %5 and Qt %6.</small><p>") .arg(githubPrefix+gitSha1).arg(gitSha1.left(6)) .arg(__DATE__).arg(__TIME__) .arg(MIRALL_STRINGIFY(LIBCSYNC_VERSION)) .arg(QT_VERSION_STR); #endif return QCoreApplication::translate("ownCloudTheme::about()", "<p><b>%1 Client Version %2</b></p>" "<p><b>Authors</b>" "<br><a href=\"mailto:[email protected]\">" "Klaas Freitag</a>, ownCloud, Inc." "<br><a href=\"mailto:[email protected]\">" "Daniel Molkentin</a>, ownCloud, Inc." "<br><br>Based on Mirall by Duncan Mac-Vicar P.</p>" "<p>For more information visit <a href=\"%3\">%4</a>.</p>" "%7" ) .arg(appName()) .arg(MIRALL_STRINGIFY(MIRALL_VERSION)) .arg("http://" MIRALL_STRINGIFY(APPLICATION_DOMAIN)) .arg(MIRALL_STRINGIFY(APPLICATION_DOMAIN)) .arg(devString); }
QString ownCloudTheme::about() const { QString devString; #ifdef GIT_SHA1 const QString githubPrefix(QLatin1String( "https://github.com/owncloud/mirall/commit/")); const QString gitSha1(QLatin1String(GIT_SHA1)); devString = QCoreApplication::translate("ownCloudTheme::about()", "<p><small>Built from Git revision <a href=\"%1\">%2</a>" " on %3, %4 using Qt %5.</small></p>") .arg(githubPrefix+gitSha1).arg(gitSha1.left(6)) .arg(__DATE__).arg(__TIME__) .arg(QT_VERSION_STR); #endif return QCoreApplication::translate("ownCloudTheme::about()", "<p>Version %2. " "For more information visit <a href=\"%3\">%4</a></p>" "<p><small>By Klaas Freitag, Daniel Molkentin, Jan-Christoph Borchardt, ownCloud Inc.<br>" "Based on Mirall by Duncan Mac-Vicar P.</small></p>" "%7" ) .arg(MIRALL_VERSION_STRING) .arg("http://" MIRALL_STRINGIFY(APPLICATION_DOMAIN)) .arg(MIRALL_STRINGIFY(APPLICATION_DOMAIN)) .arg(devString); }
QByteArray Utility::userAgentString() { return QString::fromLatin1("Mozilla/5.0 (%1) mirall/%2") .arg(Utility::platform()) .arg(QLatin1String(MIRALL_STRINGIFY(MIRALL_VERSION))) .toLatin1(); }
void UpdateDetector::versionCheck( Theme *theme ) { connect(_accessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotVersionInfoArrived(QNetworkReply*)) ); QUrl url(Theme::instance()->updateCheckUrl()); QString platform = QLatin1String("stranger"); #ifdef Q_OS_LINUX platform = QLatin1String("linux"); #endif #ifdef Q_OS_WIN platform = QLatin1String( "win32" ); #endif #ifdef Q_OS_MAC platform = QLatin1String( "macos" ); #endif qDebug() << "00 client update check to " << url.toString(); QString sysInfo = getSystemInfo(); if( !sysInfo.isEmpty() ) { url.addQueryItem(QLatin1String("client"), sysInfo ); } url.addQueryItem( QLatin1String("version"), QLatin1String(MIRALL_STRINGIFY(MIRALL_VERSION_FULL)) ); url.addQueryItem( QLatin1String("platform"), platform ); url.addQueryItem( QLatin1String("oem"), theme->appName() ); QNetworkRequest req( url ); req.setRawHeader( QByteArray("User-Agent"), Utility::userAgentString() ); _accessManager->get( req ); }
QString ownCloudTheme::about() const { QString devString; devString = trUtf8("<p>Version %2. For more information visit <a href=\"%3\">%4</a></p>" "<p><small>By Klaas Freitag, Daniel Molkentin, Jan-Christoph Borchardt, " "Olivier Goffart, Markus Götz and others.<br/>" "Based on Mirall by Duncan Mac-Vicar P.</small></p>" "<p>Copyright ownCloud, Inc.</p>" "<p>Licensed under the GNU General Public License (GPL) Version 2.0<br/>" "ownCloud and the ownCloud Logo are registered trademarks of ownCloud, " "Inc. in the United States, other countries, or both</p>" ) .arg(MIRALL_VERSION_STRING) .arg("http://" MIRALL_STRINGIFY(APPLICATION_DOMAIN)) .arg(MIRALL_STRINGIFY(APPLICATION_DOMAIN)); devString += gitSHA1(); return devString; }
void UpdateDetector::showDialog() { QDialog *msgBox = new QDialog; QIcon info = msgBox->style()->standardIcon(QStyle::SP_MessageBoxInformation, 0, 0); int iconSize = msgBox->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, 0); msgBox->setWindowIcon(info); QVBoxLayout *layout = new QVBoxLayout(msgBox); QHBoxLayout *hlayout = new QHBoxLayout; layout->addLayout(hlayout); msgBox->setWindowTitle(tr("New Version Available")); QLabel *ico = new QLabel; ico->setFixedSize(iconSize, iconSize); ico->setPixmap(info.pixmap(iconSize)); QLabel *lbl = new QLabel; QString txt = tr("<p>A new version of the %1 Client is available.</p>" "<p><b>%2</b> is available for download. The installed version is %3.<p>") .arg(Theme::instance()->appNameGUI()).arg(ocClient.versionstring()) .arg(QLatin1String(MIRALL_STRINGIFY(MIRALL_VERSION_FULL))); lbl->setText(txt); lbl->setTextFormat(Qt::RichText); lbl->setWordWrap(true); hlayout->addWidget(ico); hlayout->addWidget(lbl); QDialogButtonBox *bb = new QDialogButtonBox; bb->setWindowFlags(bb->windowFlags() & ~Qt::WindowContextHelpButtonHint); QPushButton *skip = bb->addButton(tr("Skip update"), QDialogButtonBox::ResetRole); QPushButton *reject = bb->addButton(tr("Skip this time"), QDialogButtonBox::AcceptRole); QPushButton *getupdate = bb->addButton(tr("Get update"), QDialogButtonBox::AcceptRole); connect(skip, SIGNAL(clicked()), msgBox, SLOT(reject())); connect(reject, SIGNAL(clicked()), msgBox, SLOT(reject())); connect(getupdate, SIGNAL(clicked()), msgBox, SLOT(accept())); connect(skip, SIGNAL(clicked()), SLOT(slotSetVersionSeen())); connect(getupdate, SIGNAL(clicked()), SLOT(slotOpenUpdateUrl())); layout->addWidget(bb); msgBox->open(); msgBox->resize(400, msgBox->sizeHint().height()); }
QString ConfigFile::updateChannel() const { QString defaultUpdateChannel = QStringLiteral("stable"); QString suffix = QString::fromLatin1(MIRALL_STRINGIFY(MIRALL_VERSION_SUFFIX)); if (suffix.startsWith("daily") || suffix.startsWith("nightly") || suffix.startsWith("alpha") || suffix.startsWith("rc") || suffix.startsWith("beta")) { defaultUpdateChannel = QStringLiteral("beta"); } QSettings settings(configFile(), QSettings::IniFormat); return settings.value(QLatin1String(updateChannelC), defaultUpdateChannel).toString(); }
QNetworkReply* ownCloudInfo::mkdirRequest( const QString& dir ) { qDebug() << "OCInfo Making dir " << dir; MirallConfigFile cfgFile( _configHandle ); QUrl url = QUrl( cfgFile.ownCloudUrl( _connection, true ) + dir ); QHttp::ConnectionMode conMode = QHttp::ConnectionModeHttp; if (url.scheme() == "https") conMode = QHttp::ConnectionModeHttps; QHttp* qhttp = new QHttp(QString(url.encodedHost()), conMode, 0, this); connect(qhttp, SIGNAL(requestStarted(int)), this,SLOT(qhttpRequestStarted(int))); connect(qhttp, SIGNAL(requestFinished(int, bool)), this,SLOT(qhttpRequestFinished(int,bool))); connect(qhttp, SIGNAL(responseHeaderReceived(QHttpResponseHeader)), this, SLOT(qhttpResponseHeaderReceived(QHttpResponseHeader))); //connect(qhttp, SIGNAL(authenticationRequired(QString,quint16,QAuthenticator*)), this, SLOT(qhttpAuthenticationRequired(QString,quint16,QAuthenticator*))); QHttpRequestHeader header("MKCOL", QString(url.encodedPath()), 1,1); /* header */ header.setValue("Host", QString(url.encodedHost())); header.setValue("User-Agent", QString("mirall-%1").arg(MIRALL_STRINGIFY(MIRALL_VERSION)).toAscii() ); header.setValue("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); header.setValue("Accept-Language", "it,de-de;q=0.8,it-it;q=0.6,en-us;q=0.4,en;q=0.2"); header.setValue("Connection", "keep-alive"); header.setContentType("application/x-www-form-urlencoded"); //important header.setContentLength(0); QString con = _configHandle; if( con.isEmpty() ) con = DEFAULT_CONNECTION; if( _credentials.contains(con)) { oCICredentials creds = _credentials.value(con); QString concatenated = creds.user + QLatin1Char(':') + creds.passwd; const QString b(QLatin1String("Basic ")); QByteArray data = b.toLocal8Bit() + concatenated.toLocal8Bit().toBase64(); header.setValue("Authorization", data); qhttp->setUser( creds.user, creds.passwd ); } int david = qhttp->request(header,0,0); //////////////// connect(davinfo, SIGNAL(dataSendProgress(int,int)), this, SLOT(SendStatus(int, int))); /////////////////connect(davinfo, SIGNAL(done(bool)), this,SLOT(DavWake(bool))); //connect(_http, SIGNAL(requestFinished(int, bool)), this,SLOT(qhttpRequestFinished(int,bool))); ///////////connect(davinfo, SIGNAL(responseHeaderReceived(constQHttpResponseHeader &)), this, SLOT(RegisterBackHeader(constQHttpResponseHeader &))); return NULL; }
void ownCloudInfo::mkdirRequest( const QString& dir ) { qDebug() << "OCInfo Making dir " << dir; MirallConfigFile cfgFile( _configHandle ); QUrl url = QUrl( cfgFile.ownCloudUrl( _connection, true ) + dir ); QHttp::ConnectionMode conMode = QHttp::ConnectionModeHttp; if (url.scheme() == "https") conMode = QHttp::ConnectionModeHttps; QHttp* qhttp = new QHttp(url.host(), conMode, 0, this); qhttp->setUser( cfgFile.ownCloudUser( _connection ), cfgFile.ownCloudPasswd( _connection )); connect(qhttp, SIGNAL(requestStarted(int)), this,SLOT(qhttpRequestStarted(int))); connect(qhttp, SIGNAL(requestFinished(int, bool)), this,SLOT(qhttpRequestFinished(int,bool))); connect(qhttp, SIGNAL(responseHeaderReceived(QHttpResponseHeader)), this, SLOT(qhttpResponseHeaderReceived(QHttpResponseHeader))); //connect(qhttp, SIGNAL(authenticationRequired(QString,quint16,QAuthenticator*)), this, SLOT(qhttpAuthenticationRequired(QString,quint16,QAuthenticator*))); QHttpRequestHeader header("MKCOL", url.path(), 1,1); /* header */ header.setValue("Host", url.host() ); header.setValue("User-Agent", QString("mirall-%1").arg(MIRALL_STRINGIFY(MIRALL_VERSION)).toAscii() ); header.setValue("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); header.setValue("Accept-Language", "it,de-de;q=0.8,it-it;q=0.6,en-us;q=0.4,en;q=0.2"); header.setValue("Connection", "keep-alive"); header.setContentType("application/x-www-form-urlencoded"); //important header.setContentLength(0); header.setValue("Authorization", cfgFile.basicAuthHeader()); int david = qhttp->request(header,0,0); //////////////// connect(davinfo, SIGNAL(dataSendProgress(int,int)), this, SLOT(SendStatus(int, int))); /////////////////connect(davinfo, SIGNAL(done(bool)), this,SLOT(DavWake(bool))); //connect(_http, SIGNAL(requestFinished(int, bool)), this,SLOT(qhttpRequestFinished(int,bool))); ///////////connect(davinfo, SIGNAL(responseHeaderReceived(constQHttpResponseHeader &)), this, SLOT(RegisterBackHeader(constQHttpResponseHeader &))); }
QString Theme::version() const { return QString::fromLocal8Bit( MIRALL_STRINGIFY( MIRALL_VERSION )); }