[Kde-imaging] [Bug 96352] Can not login into Gallery2
Angelo Naselli
anaselli at linux.it
Sat May 20 19:20:29 CEST 2006
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=96352
anaselli linux it changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From anaselli linux it 2006-05-20 19:20 -------
SVN commit 542934 by anaselli:
applied patches by Boris Kavod, Colin Guthrie and David Bremner
BUG: 96352
M +8 -0 galleryitem.h
M +2 -1 gallerympform.cpp
M +34 -23 gallerytalker.cpp
M +9 -8 gallerywindow.cpp
--- trunk/extragear/libs/kipi-plugins/galleryexport/galleryitem.h #542933:542934
@ -60,6 +60,14 @
create_sub = false;
}
+ bool operator<(const GAlbum& rhs) const
+ {
+ if (parent_ref_num == rhs.parent_ref_num)
+ return ref_num < rhs.ref_num;
+
+ return parent_ref_num < rhs.parent_ref_num;
+ }
+
int ref_num;
int parent_ref_num;
QString name;
--- trunk/extragear/libs/kipi-plugins/galleryexport/gallerympform.cpp #542933:542934
@ -57,6 +57,7 @
str += "--";
str += m_boundary;
str += "--";
+ str += "\r\n";
QTextStream ts(m_buffer, IO_Append|IO_WriteOnly);
ts.setEncoding(QTextStream::UnicodeUTF8);
@ -111,7 +112,7 @
str += m_boundary;
str += "\r\n";
str += "Content-Disposition: form-data; name=\"";
- str += "userfile";
+ str += "g2_userfile";
str += "\"; ";
str += "filename=\"";
str += QFile::encodeName(KURL(path).filename());
--- trunk/extragear/libs/kipi-plugins/galleryexport/gallerytalker.cpp #542933:542934
@ -62,10 +62,11 @
m_url = url;
GalleryMPForm form;
- form.addPair("cmd", "login");
- form.addPair("protocol_version", "2.3");
- form.addPair("uname", name);
- form.addPair("password", passwd);
+ form.addPair("g2_form[cmd]", "login");
+ form.addPair("g2_controller", "remote:GalleryRemote");
+ form.addPair("g2_form[protocol_version]", "2.3");
+ form.addPair("g2_form[uname]", name);
+ form.addPair("g2_form[password]", passwd);
form.finish();
KIO::TransferJob* job = KIO::http_post(m_url, form.formData(), false);
@ -85,8 +86,9 @
void GalleryTalker::listAlbums()
{
GalleryMPForm form;
- form.addPair("cmd", "fetch-albums");
- form.addPair("protocol_version", "2.3");
+ form.addPair("g2_form[cmd]", "fetch-albums-prune");
+ form.addPair("g2_controller", "remote:GalleryRemote");
+ form.addPair("g2_form[protocol_version]", "2.3");
form.finish();
KIO::TransferJob* job = KIO::http_post(m_url, form.formData(), false);
@ -113,9 +115,10 @
}
GalleryMPForm form;
- form.addPair("cmd", "fetch-album-images");
- form.addPair("protocol_version", "2.3");
- form.addPair("set_albumName", albumName);
+ form.addPair("g2_form[cmd]", "fetch-album-images");
+ form.addPair("g2_controller", "remote:GalleryRemote");
+ form.addPair("g2_form[protocol_version]", "2.3");
+ form.addPair("g2_form[set_albumName]", albumName);
form.finish();
KIO::TransferJob* job = KIO::http_post(m_url, form.formData(), false);
@ -145,15 +148,16 @
}
GalleryMPForm form;
- form.addPair("cmd", "new-album");
- form.addPair("protocol_version", "2.3");
- form.addPair("set_albumName", parentAlbumName);
+ form.addPair("g2_form[cmd]", "new-album");
+ form.addPair("g2_controller", "remote:GalleryRemote");
+ form.addPair("g2_form[protocol_version", "2.3");
+ form.addPair("g2_form[set_albumName]", parentAlbumName);
if (!albumName.isEmpty())
- form.addPair("newAlbumName", albumName);
+ form.addPair("g2_form[newAlbumName]", albumName);
if (!albumTitle.isEmpty())
- form.addPair("newAlbumTitle", albumTitle);
+ form.addPair("g2_form[newAlbumTitle]", albumTitle);
if (!albumCaption.isEmpty())
- form.addPair("newAlbumDesc", albumCaption);
+ form.addPair("g2_form[newAlbumDesc]", albumCaption);
form.finish();
KIO::TransferJob* job = KIO::http_post(m_url, form.formData(), false);
@ -185,12 +189,13 @
QString path = photoPath;
GalleryMPForm form;
- form.addPair("cmd", "add-item");
- form.addPair("protocol_version", "2.3");
- form.addPair("set_albumName", albumName);
- form.addPair("userfile_name", QFile::encodeName(KURL(path).filename()));
+ form.addPair("g2_form[cmd]", "add-item");
+ form.addPair("g2_controller", "remote:GalleryRemote");
+ form.addPair("g2_form[protocol_version]", "2.3");
+ form.addPair("g2_form[set_albumName]", albumName);
+ form.addPair("g2_userfile_name", QFile::encodeName(KURL(path).filename()));
if (!caption.isEmpty())
- form.addPair("caption", caption);
+ form.addPair("g2_form[caption]", caption);
QImage image(photoPath);
@ -371,7 +376,8 @
{
GAlbum album;
album.name = value;
- album.ref_num = key.section(".", 2, 2).toInt();
+ album.ref_num = value.toInt();
+ //album.ref_num = key.section(".", 2, 2).toInt();
iter = albumList.append(album);
}
else if (key.startsWith("album.title"))
@ -430,6 +436,9 @
return;
}
+ // We need parent albums to come first for rest of the code to work
+ qHeapSort(albumList);
+
emit signalAlbums( albumList );
}
@ -457,8 +466,10 @
}
else
{
- QStringList strlist = QStringList::split("=", line);
- if (strlist.count() == 2)
+ // Boris the Gallery default URL contains "=" char. So we will split the string only from the first "=" char
+ QStringList strlist = QStringList();
+ strlist << line.left(line.find('=')) << line.mid(line.find('=')+1);
+ if (strlist.count() >= 2)
{
QString key = strlist[0];
QString value = strlist[1];
--- trunk/extragear/libs/kipi-plugins/galleryexport/gallerywindow.cpp #542933:542934
@ -238,7 +238,7 @
url.setHost(dlg.url());
}
if (!url.url().endsWith(".php"))
- url.addPath("gallery_remote2.php");
+ url.addPath("main.php");
m_url = url.url();
m_user = dlg.name();
@ -327,7 +327,7 @
{
kdWarning() << "Failed to find parent for album "
<< album.name
- << "with id " << album.ref_num;
+ << " with id " << album.ref_num << "\n";
}
}
}
@ -388,19 +388,20 @
for ( iter = photoList.begin(); iter != photoList.end(); ++iter )
{
const GPhoto& photo = *iter;
- KURL imageurl(photo.albumURL);
- KURL thumburl(photo.albumURL);
- imageurl.addPath(photo.name);
- thumburl.addPath(photo.thumbName);
+ KURL imageurl(photo.albumURL + photo.name);
+ KURL thumburl(photo.albumURL + photo.thumbName);
+ // Boris : gallery use complex URLs (with = & etc.). the addPath seems not working in this context
+ //imageurl.addPath(photo.name);
+ //thumburl.addPath(photo.thumbName);
m_photoView->write( "<tr><td class='photo'>"
+ QString("<a href='%1'>")
.arg(imageurl.url())
- + QString("<img border=1 src=%1><br>")
+ + QString("<img border=1 src=\"%1\"><br>")
.arg(thumburl.url())
+ photo.name
+ ( photo.caption.isEmpty() ? QString() :
- QString("<br><i>%1<i>")
+ QString("<br><i>%1</i>")
.arg(photo.caption) )
+ "</a></td></tr>" );
}
More information about the Kde-imaging
mailing list