Bug 129716

Summary: finish transfering music before disconecting media devices (iPod)
Product: [Applications] amarok Reporter: Ryan Neufeld <beatryder>
Component: Collections/iPod iPhoneAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: wishlist CC: matej
Priority: NOR    
Version: 1.4.0   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Ryan Neufeld 2006-06-23 20:27:51 UTC
Version:           1.4.0 (using KDE KDE 3.5.3)
Installed from:    Gentoo Packages
Compiler:          gcc 4 
OS:                Linux

I was thinking that Amarok should prompt the user to finish transferring music to media devices such as an ipod before disconnecting.

currently it does the following
1) user starts transferring music to iPod (or other media device, I have an iPod)
2) user clicks the "disconnect" button, and it disconnects the ipod after finishing its current transfer.

The user ideally should be asked if they are sure, and/or offer to finish sending the list of music to be transferred before disconnecting.

That or have a "Sync" button that does all that in one shot.
Ie: plug in ipod -> click sync -> music I have queued to be sent gets sent, and ipod is ejected.


Just a thought.
Comment 1 Martin Aumueller 2006-07-26 03:16:39 UTC
SVN commit 566401 by aumuell:

sk if transfer to media device should be finished for all queued tracks or should be interrupted
after current track when pressing disconnect
BUG: 129716


 M  +2 -2      ChangeLog  
 M  +24 -0     src/mediabrowser.cpp  
 M  +2 -0      src/mediabrowser.h  


--- trunk/extragear/multimedia/amarok/ChangeLog #566400:566401
@@ -29,8 +29,8 @@
       to iTunes, Firefly Media Server etc. (BR 100513)
 
   CHANGES:
-    * It's now possible to edit scores and ratings for multiple tracks in
-      TagDialog.
+    * Optionally finish transferring all queued tracks to media device after
+      pressing disconnect button. (BR 129716)
     * TagDialog won't make Amarok unresponsive while committing tags changes
       to files anymore.
     * Exact playtime as tooltip in statusbar. Patch by Markus Kaufhold
--- trunk/extragear/multimedia/amarok/src/mediabrowser.cpp #566400:566401
@@ -1828,6 +1828,7 @@
     , m_transferring( false )
     , m_deleting( false )
     , m_deferredDisconnect( false )
+    , m_scheduledDisconnect( false )
     , m_transfer( true )
     , m_configure( true )
     , m_customButton( false )
@@ -2292,6 +2293,24 @@
 void
 MediaBrowser::disconnectClicked()
 {
+    if( currentDevice() && currentDevice()->isTransferring() )
+    {
+        int action = KMessageBox::questionYesNoCancel( MediaBrowser::instance(),
+                i18n( "Transfer in progress. Finish or stop after current track?" ),
+                i18n( "Stop Transfer?" ),
+                KGuiItem(i18n("&Finish"), "goto"),
+                KGuiItem(i18n("&Stop"), "player_eject") );
+        if( action == KMessageBox::Cancel )
+        {
+            return;
+        }
+        else if( action == KMessageBox::Yes )
+        {
+            currentDevice()->scheduleDisconnect();
+            return;
+        }
+    }
+
     m_toolbar->getButton(TRANSFER)->setEnabled( false );
     m_toolbar->getButton(DISCONNECT)->setEnabled( false );
 
@@ -2771,6 +2790,11 @@
         m_deferredDisconnect = false;
         disconnectDevice( m_runDisconnectHook );
     }
+    else if( m_scheduledDisconnect )
+    {
+        disconnectDevice( true );
+    }
+    m_scheduledDisconnect = false;
 }
 
 int
--- trunk/extragear/multimedia/amarok/src/mediabrowser.h #566400:566401
@@ -465,6 +465,7 @@
         virtual void expandItem( QListViewItem *item ) {(void)item; }
         bool connectDevice( bool silent=false );
         bool disconnectDevice( bool postdisconnecthook=true );
+        void scheduleDisconnect() { m_scheduledDisconnect = true; }
 
     protected slots:
         void fileTransferred( KIO::Job *job );
@@ -587,6 +588,7 @@
         bool             m_transferring;
         bool             m_deleting;
         bool             m_deferredDisconnect;
+        bool             m_scheduledDisconnect;
         bool             m_runDisconnectHook;
         bool             m_spacesToUnderscores;
         bool             m_transfer;