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

List:       kde-commits
Subject:    kdeaddons/kicker-applets/mediacontrol
From:       Michael Pyne <michael.pyne () kdemail ! net>
Date:       2004-07-06 2:55:28
Message-ID: 20040706025528.D3A6E99AA () office ! kde ! org
[Download RAW message or body]

CVS commit by mpyne: 

JuK does so support drag-and-drop. :-D

I've modified the media control applet to perform the drag-and-drop correctly, and \
also to start playing one of the dropped files as described in bug 83113.

The auto-play thing won't work until I ask Scott about including a new DCOP function \
to JuK, which I've already written.

CCMAIL:sgehn@gmx.net
CCMAIL:wheeler@kde.org
CCMAIL:tpr@d5k.net
CCMAIL:83113@bugs.kde.org


  M +30 -12    jukInterface.cpp   1.8


--- kdeaddons/kicker-applets/mediacontrol/jukInterface.cpp  #1.7:1.8
@@ -128,26 +128,44 @@ void JuKInterface::updateSlider ()
 // Drag-n-Drop stuff \
=================================================================  
-void JuKInterface::dragEnterEvent(QDragEnterEvent* /*event*/)
+void JuKInterface::dragEnterEvent(QDragEnterEvent* event)
 {
-/* JuK doesn't support drag'n'dropping..
-        //kdDebug(90200) << "JuKInterface::dragEnterEvent()" << endl;
+//      kdDebug(90200) << "JuKInterface::dragEnterEvent()" << endl;
         event->accept( KURLDrag::canDecode(event) );
-*/
 }
 
-void JuKInterface::dropEvent(QDropEvent* /*event*/)
+void JuKInterface::dropEvent(QDropEvent* event)
 {
-
-/* JuK doesn't support drag'n'dropping, is this right way to disable this?
-        //kdDebug(90200) << "JuKInterface::dropEvent()" << endl;
+//      kdDebug(90200) << "JuKInterface::dropEvent()" << endl;
         KURL::List list;
         if (KURLDrag::decode(event, list))
         {
-                QByteArray data;
+                QByteArray data, replyData;
+                QStringList fileList;
+                QCString replyType;
                 QDataStream arg(data, IO_WriteOnly);
-                arg << list.toStringList() << false;
-                if (!kapp->dcopClient()->send(mAppId, "Player", \
"openFile(QStringList)",data)) +
+                // Juk doesn't handle KURL's yet, so we need to form a list
+                // that contains the local paths.
+                for (KURL::List::ConstIterator it = list.begin(); it != list.end(); \
++it) +                        fileList += (*it).path();
+
+                arg << fileList << false;
+
+                // Use call instead of send to make sure the files are added
+                // before we try to play.
+                if (!kapp->dcopClient()->call(mAppId, "Collection", \
"openFile(QStringList)", data, +                              replyType, replyData, \
true)) +                {
                         kdDebug(90200) << "Couldn't send drop to juk" << endl;
-}*/
+                }
+
+                // Apparently we should auto-play?
+                QByteArray strData;
+                QDataStream strArg(strData, IO_WriteOnly);
+                strArg << *fileList.begin();
+
+                if (!kapp->dcopClient()->send(mAppId, "Player", "play(QString)", \
strData)) +                        kdDebug(90200) << "Couldn't send play command to \
juk" << endl; +        }
 }
 


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

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