Commit 7591c097 authored by Martin Klapetek's avatar Martin Klapetek
Browse files

Port KUrl -> QUrl

parent 410c3e6e
......@@ -41,8 +41,9 @@ void OCreateCalendar::startByContact()
const QString OCreateCalendar::davUrl()
{
KUrl url(m_config.readEntry("server", ""));
url.addPath("remote.php/caldav/");
QUrl url(m_config.readEntry("server", ""));
url = url.adjusted(QUrl::StripTrailingSlash);
url.setPath(url.path() + '/' + "remote.php/caldav/");
QString str("$default$|CalDav|");
str.append(url.url());
......
......@@ -74,8 +74,9 @@ void OCreateContact::createResource()
const QString OCreateContact::davUrl()
{
KUrl url(m_config.readEntry("server", ""));
url.addPath("remote.php/carddav/");
QUrl url(m_config.readEntry("server", ""));
url = url.adjusted(QUrl::StripTrailingSlash);
url.setPath(url.path() + '/' + "remote.php/carddav/");
QString str("$default$|CardDav|");
str.append(url.url());
......
......@@ -107,7 +107,7 @@ void OwnCloudWizard::setPassword(const QString& password)
m_password = password;
}
void OwnCloudWizard::setServer(const KUrl& server)
void OwnCloudWizard::setServer(const QUrl &server)
{
m_server = server;
}
......@@ -122,7 +122,7 @@ const QString OwnCloudWizard::password() const
return m_password;
}
const KUrl OwnCloudWizard::server() const
const QUrl OwnCloudWizard::server() const
{
return m_server;
}
......
......@@ -21,7 +21,7 @@
#include <QtGui/QWizard>
#include <kurl.h>
#include <QUrl>
class OwnCloudWizard : public QWizard
{
......@@ -34,11 +34,11 @@ class OwnCloudWizard : public QWizard
void setUsername(const QString &username);
void setPassword(const QString &password);
void setServer(const KUrl &server);
void setServer(const QUrl &server);
const QString username() const;
const QString password() const;
const KUrl server() const;
const QUrl server() const;
void activateOption(const QString& name, bool checked);
......@@ -48,7 +48,7 @@ class OwnCloudWizard : public QWizard
private:
QString m_username;
QString m_password;
KUrl m_server;
QUrl m_server;
QHash<QString, int> m_services;
};
......
......@@ -24,6 +24,7 @@
#include <kpixmapsequenceoverlaypainter.h>
#include <KIO/Job>
#include <KIO/global.h>
BasicInfo::BasicInfo(OwnCloudWizard* parent)
: QWizardPage(parent)
......@@ -106,15 +107,16 @@ void BasicInfo::checkServer(const QString &path)
fixedUrl = path;
}
KUrl url(fixedUrl);
m_json.clear();
url.setFileName("status.php");
QUrl url(fixedUrl);
url = url.adjusted(QUrl::StripTrailingSlash);
url.setPath(url.path() + '/' + "status.php");
checkServer(url);
}
void BasicInfo::checkServer(const KUrl& url)
void BasicInfo::checkServer(const QUrl &url)
{
kDebug() << url;
setResult(false);
......@@ -128,18 +130,18 @@ void BasicInfo::checkServer(const KUrl& url)
void BasicInfo::figureOutServer(const QString& urlStr)
{
KUrl url(urlStr);
if (url.directory(KUrl::AppendTrailingSlash) == "/") {
if (urlStr == QLatin1String("/") || urlStr.isEmpty()) {
setResult(false);
return;
}
m_json.clear();
url.setFileName("");
url = url.upUrl();
url.setFileName("status.php");
checkServer(url);
QUrl url(urlStr);
url = KIO::upUrl(urlStr);
url.setPath(url.path() + '/' + "status.php");
checkServer(url.adjusted(QUrl::NormalizePathSegments));
}
void BasicInfo::dataReceived(KIO::Job* job, const QByteArray& data)
......
......@@ -50,14 +50,14 @@ class BasicInfo : public QWizardPage, Ui_Owncloud
private:
bool validData() const;
void checkServer(const QString &path);
void checkServer(const KUrl &url);
void checkServer(const QUrl &url);
void figureOutServer(const QString& urlStr);
void setWorking(bool start);
void setResult(bool result);
private:
KUrl m_server;
QUrl m_server;
bool m_validServer;
QByteArray m_json;
KPixmapSequenceOverlayPainter *m_painter;
......
......@@ -55,12 +55,13 @@ void Connecting::initializePage()
void Connecting::checkAuth()
{
KUrl url(m_wizard->server());
QUrl url(m_wizard->server());
url.setUser(m_wizard->username());
url.setPass(m_wizard->password());
url.setUserName(m_wizard->username());
url.setPassword(m_wizard->password());
url.addPath("apps/calendar/caldav.php/");
url = url.adjusted(QUrl::StripTrailingSlash);
url.setPath(url.path() + '/' + "apps/calendar/caldav.php/");
kDebug() << "FinalUrL: " << url;
KIO::TransferJob *job = KIO::get(url, KIO::NoReload, KIO::HideProgressInfo);
connect(job, SIGNAL(finished(KJob*)), this, SLOT(httpResult(KJob*)));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment