From 3172e1f530b46a4a3475f30473d844038a72249b Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 29 Jun 2010 08:44:56 +0000 Subject: [PATCH] Fix tables appearance in Web UI Fix empty array parsing in JSON --- src/eventmanager.cpp | 1 + src/httpconnection.cpp | 2 +- src/httpserver.cpp | 4 ++-- src/json.h | 3 ++- src/webui/preferences_content.html | 8 +++++--- src/webui/prop-files.html | 2 +- src/webui/prop-trackers.html | 2 +- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/eventmanager.cpp b/src/eventmanager.cpp index 36f296875..ce7be499d 100644 --- a/src/eventmanager.cpp +++ b/src/eventmanager.cpp @@ -152,6 +152,7 @@ void EventManager::setGlobalPreferences(QVariantMap m) const { } int i = 0; foreach(const QString &new_folder, new_folders) { + qDebug("New watched folder: %s", qPrintable(new_folder)); // Update new folders if(!old_folders.contains(new_folder)) { BTSession->getScanFoldersModel()->addPath(new_folder, download_at_path.at(i)); diff --git a/src/httpconnection.cpp b/src/httpconnection.cpp index 5dba3d391..22382ceb0 100644 --- a/src/httpconnection.cpp +++ b/src/httpconnection.cpp @@ -150,7 +150,7 @@ void HttpConnection::respond() { write(); return; } - qDebug("Auth: %s", qPrintable(auth.split(" ").first())); + //qDebug("Auth: %s", qPrintable(auth.split(" ").first())); if (QString::compare(auth.split(" ").first(), "Digest", Qt::CaseInsensitive) != 0 || !parent->isAuthorized(auth.toLocal8Bit(), parser.method())) { // Update failed attempt counter parent->increaseNbFailedAttemptsForIp(peer_ip); diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 8d916dd00..4e74a3869 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -177,12 +177,12 @@ void HttpServer::setAuthorization(QString _username, QString _password_ha1) { // Parse HTTP AUTH string // http://tools.ietf.org/html/rfc2617 bool HttpServer::isAuthorized(QByteArray auth, QString method) const { - qDebug("AUTH string is %s", auth.data()); + //qDebug("AUTH string is %s", auth.data()); // Get user name QRegExp regex_user(".*username=\"([^\"]+)\".*"); // Must be a quoted string if(regex_user.indexIn(auth) < 0) return false; QString prop_user = regex_user.cap(1); - qDebug("AUTH: Proposed username is %s, real username is %s", prop_user.toLocal8Bit().data(), username.data()); + //qDebug("AUTH: Proposed username is %s, real username is %s", prop_user.toLocal8Bit().data(), username.data()); if(prop_user != username) { // User name is invalid, we can reject already qDebug("AUTH-PROB: Username is invalid"); diff --git a/src/json.h b/src/json.h index 22ceadccb..f047517e5 100644 --- a/src/json.h +++ b/src/json.h @@ -109,6 +109,7 @@ namespace json { } QVariantMap fromJson(QString json) { + qDebug("JSON is %s", qPrintable(json)); QVariantMap m; if(json.startsWith("{") && json.endsWith("}")) { json.chop(1); @@ -144,7 +145,7 @@ namespace json { if(value_str.startsWith("[") && value_str.endsWith("]")) { value_str.chop(1); value_str.replace(0, 1, ""); - QStringList list_elems = value_str.split(","); + QStringList list_elems = value_str.split(",", QString::SkipEmptyParts); QVariantList varlist; foreach(QString list_val, list_elems) { if(list_val.startsWith("\"") && list_val.endsWith("\"")) { diff --git a/src/webui/preferences_content.html b/src/webui/preferences_content.html index bc5ce33ec..3737eb7dc 100644 --- a/src/webui/preferences_content.html +++ b/src/webui/preferences_content.html @@ -110,10 +110,10 @@ - - +
_(Watched Folder)_(Download here)
+ - +
_(Watched Folder)_(Download here)
Add
Add
@@ -711,10 +711,12 @@ updatePeerProxyAuthSettings = function() { getWatchedFolders = function() { var nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length; + alert(nb_folders); var folders = Array(); var download_in_place = Array(); for(var i=0; i 0) { folders[folders.length] = folder_path; if($defined($("cb_watch_"+i).get('checked')) && $("cb_watch_"+i).get('checked')) { diff --git a/src/webui/prop-files.html b/src/webui/prop-files.html index b4c9107bd..d62c6c447 100644 --- a/src/webui/prop-files.html +++ b/src/webui/prop-files.html @@ -1,5 +1,5 @@ - +
diff --git a/src/webui/prop-trackers.html b/src/webui/prop-trackers.html index fc01d9520..666009b0f 100644 --- a/src/webui/prop-trackers.html +++ b/src/webui/prop-trackers.html @@ -1,5 +1,5 @@ -
  _(Downloaded)
+
_(URL)