[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/pim/kblogger
From:       Antonio Aloisio <antonio.aloisio () gmail ! com>
Date:       2008-05-08 20:40:24
Message-ID: 1210279224.986146.26159.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 805595 by aloisio:

UploadMediaDialog works again: KBlogger doesn't create thumbnail yet.


 M  +1 -0      TODO  
 M  +34 -19    src/media/uploadmediadialog.cpp  


--- trunk/playground/pim/kblogger/TODO #805594:805595
@@ -36,6 +36,7 @@
      - rename itemlist.h/cpp to itemslistwidget.h/cpp [gnuton]
      - add thumbnail regexp for other blog systems. [gnuton, duns]
      - fix compilation warnings 
+     - fix khtml preview. It doesn't show local media
 
 Code review for classes:
 
--- trunk/playground/pim/kblogger/src/media/uploadmediadialog.cpp #805594:805595
@@ -120,19 +120,33 @@
     }
 
     // prepare the composer for media insertion
-    ComposerEditor *compEditor = qobject_cast<ComposerEditor*> (parent());
-    if (!compEditor){
-        kDebug() << "casting error from parent() to ComposerEditor*.";
-    }
+    ComposerEditor *composer = qobject_cast<ComposerEditor*> (parent());
+    Q_ASSERT(composer);
 
+    //Get required data: Media data, MimeType, blogName
     QByteArray mediaData( qobject_cast<KIO::StoredTransferJob*>(job)->data() );
     QString mediaMimetype( qobject_cast<KIO::TransferJob*>(job)->mimetype() );
-
-    if (mBlogname.isEmpty())
+    if ( mBlogname.isEmpty() ){
         mBlogname = mBlogChooser->blogCombo->currentText();
-    kDebug() << "media created with success" << endl;
+    }
 
-    // TODO check for mediatypes, since most blogs only support image + a view else
+    //TODO check for mediatypes, since most blogs only support image + a view else
+    
+    //Create Media
+    //NOTE: Data will be saved in the kblogger cache automatically.
+     if ( mediaMimetype.indexOf( "image" ) != -1 ){
+         QString msg = i18n( "Thumbnails are not supported yet." );
+         KMessageBox::sorry ( this, msg );
+     }
+     mMedia=new Media ( mediaData, 
+                        NameLineEdit->text(), //FileName
+                        mediaMimetype,
+                        mBlogname ); 
+     ItemsManager::self()->addMedia(mMedia);
+     composer->insertMedia(mMedia);
+     
+
+    /*
     // create a thumbnail for images
     // TODO check the mimetype of images better
     if( mediaMimetype.indexOf( "image" ) != -1 ){
@@ -159,7 +173,7 @@
         if ( mMedia->isCached() && mThumbnail->isCached() ) {
             ItemsManager::self()->addMedia(mMedia);
             ItemsManager::self()->addMedia(mThumbnail);
-            if(compEditor) compEditor->insertThumbnail(mThumbnail,mMedia);
+            if(composer) composer->insertThumbnail(mThumbnail,mMedia);
         }
         else {
             QString msg = i18n("Impossible to copy the file %1 in the cache",
@@ -175,16 +189,17 @@
                               NameLineEdit->text(),
                               mediaMimetype,
                               mBlogname
-                           );
-    if ( mMedia->isCached() ) {
-         ItemsManager::self()->addMedia(mMedia);
-         if(compEditor) compEditor->insertMedia(mMedia);
-    }
-    else {
-        QString msg = i18n("Impossible to copy the file %1 in the cache",
-                           FilekURLRequester->url().url() );
-        KMessageBox::sorry ( this, msg );
-    }
+                         );
+*/  
+//     if ( mMedia->isCached() ) {
+//          ItemsManager::self()->addMedia(mMedia);
+//          if(composer) composer->insertMedia(mMedia);
+//     }
+//     else {
+//         QString msg = i18n("Impossible to copy the file %1 in the cache",
+//                            FilekURLRequester->url().url() );
+//         KMessageBox::sorry ( this, msg );
+//     }
     close();
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic