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

List:       kde-commits
Subject:    extragear/graphics/kipi-plugins/smug
From:       Luka Renko <lure () kubuntu ! org>
Date:       2010-02-28 0:06:47
Message-ID: 1267315607.915421.8789.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1096949 by lure:

SmugMug now also uses ImagesList progress indication
window can now transfer images in background (no modal progress
dialog)

 M  +33 -25    smugwindow.cpp  
 M  +1 -2      smugwindow.h  


--- trunk/extragear/graphics/kipi-plugins/smug/smugwindow.cpp #1096948:1096949
@@ -90,8 +90,8 @@
 
     setMainWidget(m_widget);
     setWindowIcon(KIcon("smugmug"));
-    setButtons(Help|User1|Close);
-    setDefaultButton(Close);
+    setButtons(Help|User1|Cancel);
+    setDefaultButton(Cancel);
     setModal(false);
 
     if (import)
@@ -124,9 +124,6 @@
     connect(m_widget->m_newAlbumBtn, SIGNAL( clicked() ),
             this, SLOT( slotNewAlbumRequest()) );
 
-    connect(this, SIGNAL( closeClicked() ),
-            this, SLOT( slotClose()) );
-
     connect(this, SIGNAL( user1Clicked() ),
             this, SLOT( slotStartTransfer()) );
 
@@ -259,14 +256,31 @@
     e->accept();
 }
 
-void SmugWindow::slotClose()
+void SmugWindow::slotButtonClicked(int button)
 {
-    if (m_talker->loggedIn())
-        m_talker->logout();
-
-    writeSettings();
-    m_widget->imagesList()->listView()->clear();
-    done(Close);
+    switch (button)
+    {
+        case Cancel:
+            if (m_widget->progressBar()->isHidden())
+            {
+                writeSettings();
+                m_widget->imagesList()->listView()->clear();
+                done(Close);
+            }
+            else // cancel login/transfer
+            {
+                m_talker->cancel();
+                m_transferQueue.clear();
+                m_widget->m_imgList->processed(false);
+                m_widget->progressBar()->hide();
+            }
+            break;
+        case User1:
+            slotStartTransfer();
+            break;
+        default:
+             KDialog::slotButtonClicked(button);
+    }
 }
 
 void SmugWindow::reactivate()
@@ -648,6 +662,7 @@
     }
     else
     {
+        m_widget->m_imgList->clearProcessedStatus();
         m_transferQueue = m_widget->m_imgList->imageUrls();
 
         if (m_transferQueue.isEmpty())
@@ -722,11 +737,13 @@
         return;
     }
 
-    m_widget->progressBar()->setMaximum(m_imagesTotal);
-    m_widget->progressBar()->setValue(m_imagesCount);
+    m_widget->m_imgList->processing(m_transferQueue.first());
     
     QString imgPath = m_transferQueue.first().path();
 
+    m_widget->progressBar()->setMaximum(m_imagesTotal);
+    m_widget->progressBar()->setValue(m_imagesCount);
+
     // check if we have to RAW file -> use preview image then
     QString rawFilesExt(KDcrawIface::KDcraw::rawFiles());
     QFileInfo fileInfo(imgPath);
@@ -764,12 +781,11 @@
         m_tmpPath.clear();
     }
 
+    m_widget->m_imgList->processed(errCode == 0);
+
     if (errCode == 0)
     {
-        // Remove photo uploaded from the list
-        m_widget->m_imgList->removeItemByUrl(m_transferQueue.first());
         m_transferQueue.pop_front();
-
         m_imagesCount++;
     }
     else
@@ -859,14 +875,6 @@
     downloadNextPhoto();
 }
 
-void SmugWindow::slotTransferCancel()
-{
-    m_transferQueue.clear();
-    m_widget->progressBar()->hide();
-
-    m_talker->cancel();
-}
-
 void SmugWindow::slotCreateAlbumDone(int errCode, const QString& errMsg,
                                      int newAlbumID)
 {
--- trunk/extragear/graphics/kipi-plugins/smug/smugwindow.h #1096948:1096949
@@ -102,11 +102,10 @@
     void slotUserChangeRequest(bool anonymous);
     void slotReloadAlbumsRequest();
     void slotNewAlbumRequest();
-    void slotTransferCancel();
     void slotHelp();
-    void slotClose();
     void slotStartTransfer();
     void slotImageListChanged();
+    void slotButtonClicked(int button);
     void slotTemplateSelectionChanged(int index);
     void slotCategorySelectionChanged(int index);
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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