On Saturday 11 October 2008 21:15:44 Vardhman Jain wrote:
> this is indeed sad to hear. I did perform quite a few test uploads and was
> sure things would work great now. Unfortunately I don't get enough time to
> try it on anything other than Kubuntu Virtual machine that I have on my Mac
> laptop.
>
> I will try checking it again and also fix the other issues reported by
> Dragon meanwhile.

Vardman,

The patch that I had applied, which didn't work for dragon is attached,  I 
don't know if you can spot any obvious mistakes.

Mark
diff -Nur -x '*.orig' -x '*~' kipi-plugins-0.1.5/kipi-plugins/picasawebexport/picasawebtalker.cpp kipi-plugins-0.1.5.new/kipi-plugins/picasawebexport/picasawebtalker.cpp
--- kipi-plugins-0.1.5/kipi-plugins/picasawebexport/picasawebtalker.cpp	2008-03-11 01:49:37.000000000 +1100
+++ kipi-plugins-0.1.5.new/kipi-plugins/picasawebexport/picasawebtalker.cpp	2008-09-27 23:22:41.000000000 +1000
@@ -37,6 +37,7 @@
 #include <qlineedit.h>
 #include <qmessagebox.h>
 #include <kio/jobclasses.h>
+#include <kurl.h>
 #include <qdom.h>
 #include <cstring>
 #include <cstdio>
@@ -330,7 +331,7 @@
 	}
 
 	bool PicasawebTalker::addPhoto(  const QString& photoPath,
-			FPhotoInfo& info, const QString& albumName,
+			FPhotoInfo& info, const QString& albumId,
 			bool  rescale, int maxDim, int imageQuality )
 	{
         // Disabling this totally may be checking the m_state and doing selecting 
@@ -340,11 +341,11 @@
 			m_job->kill();
 			m_job = 0;
 		}*/
-		QString album_name = albumName;
-        if (album_name.length() == 0)
-            album_name = "test";
-		QString postUrl = "http://www.picasaweb.google.com/data/feed/api/user/"; + m_username + "/album/" + album_name;
-		QString path = photoPath;
+		QString album_id = albumId;
+        if (album_id.length() == 0)
+            album_id = "test";
+		QString postUrl = "http://www.picasaweb.google.com/data/feed/api/user/"; + KURL::encode_string(m_username) + "/albumid/" + album_id;
+		QString path = postUrl;
 		QStringList headers; 
 		MPForm form;
 		QString auth_string = "GoogleLogin auth=" + m_token;
@@ -616,8 +617,12 @@
 				while(!detailsNode.isNull()){
 					if(detailsNode.isElement()){
 						if(detailsNode.nodeName() == "id"){
-							album_id = detailsNode.toElement().text();
-                            //this is what is obtained from data.
+							// The node data is a URL of which album id is the string following the last /
+							// like <id>http://www.picasaweb.google.com/.../AlbumID<id>
+							QString albumIdUrl = detailsNode.toElement().text();
+							int index = albumIdUrl.findRev("/");
+							int length = albumIdUrl.length();
+							QString album_id = albumIdUrl.right(length - index - 1);
 							fps.id = album_id;
                         }
 						if(detailsNode.nodeName() == "title"){
diff -Nur -x '*.orig' -x '*~' kipi-plugins-0.1.5/kipi-plugins/picasawebexport/picasawebwindow.cpp kipi-plugins-0.1.5.new/kipi-plugins/picasawebexport/picasawebwindow.cpp
--- kipi-plugins-0.1.5/kipi-plugins/picasawebexport/picasawebwindow.cpp	2008-03-11 01:49:37.000000000 +1100
+++ kipi-plugins-0.1.5.new/kipi-plugins/picasawebexport/picasawebwindow.cpp	2008-09-27 23:26:56.000000000 +1000
@@ -420,6 +420,7 @@
     slotAddPhotoNext();
 }
 
+
 void PicasawebWindow::slotAddPhotoNext()
 {
     if ( m_uploadQueue.isEmpty() )
@@ -436,8 +437,23 @@
     int upload_image_size;
     int upload_image_quality;
     
+    // Get the albums' Id from the name.
+    QString albumId = "";
+    QString selectedAlbumName = m_albumsListComboBox->currentText();
+
+    QValueList<PicasaWebAlbum>::iterator it = m_talker->m_albumsList->begin();
+    while(it != m_talker->m_albumsList->end()) {
+       PicasaWebAlbum pwa=*it;
+       QString name = pwa.title;
+       if (name == selectedAlbumName) {
+           albumId = pwa.id;
+           break;
+       }
+       it++;
+    }
+
     bool res = m_talker->addPhoto( pathComments.first, //the file path
-                                   info, m_albumsListComboBox->currentText(),
+                                   info, albumId,
 				                   m_resizeCheckBox->isChecked(),
                                    m_dimensionSpinBox->value(), m_imageQualitySpinBox->value() );
     if (!res)

Reply via email to