extragear/multimedia/amarok
Casey Link
unnamedrambler at gmail.com
Sat Feb 14 16:51:56 CET 2009
SVN commit 926043 by link:
Add the delete action the local collection. There are still a few TODOs:
* The confirmation dialog should be improved (and abstracted outside SqlCollection)
* The CollectionTreeView/Model still shows the deleted tracks until a
rescan is performed, the model should show the track's removal right
away.
CCMAIL: amarok-devel at kde.org
BUG: 170999
M +1 -0 ChangeLog
M +0 -11 src/browsers/collectionbrowser/CollectionTreeView.cpp
M +1 -0 src/collection/sqlcollection/CMakeLists.txt
M +55 -1 src/collection/sqlcollection/SqlCollection.cpp
M +4 -0 src/collection/sqlcollection/SqlCollection.h
A src/collection/sqlcollection/SqlCollectionCapability.cpp [License: GPL (v2+)]
A src/collection/sqlcollection/SqlCollectionCapability.h [License: GPL (v2+)]
--- trunk/extragear/multimedia/amarok/ChangeLog #926042:926043
@@ -5,6 +5,7 @@
VERSION 2.1
FEATURES:
+ * Deleting tracks from the local collection is now possible. (BR 170999)
* Add a filter-by-date-added to the collection browser. Use added:"today" or added:<2m2d
* Add a tab bar in the current track applet for showing also the favorite
tracks in the collection.
--- trunk/extragear/multimedia/amarok/src/browsers/collectionbrowser/CollectionTreeView.cpp #926042:926043
@@ -777,17 +777,6 @@
qm->deleteLater();
}
-// Sample delete action skeleton, will be replaced
- /*
-
- PopupDropperAction *deleteAction = new PopupDropperAction( The::svgHandler()->getRenderer( "amarok/images/pud_items.svg" ),
- "delete", KIcon( "remove-amarok" ), i18n( "&Delete Tracks" ), 0 );
-
- connect( deleteAction, SIGNAL( triggered() ), this, SLOT( slotDeleteTracks() ) );
-
- actions.append( deleteAction );
- */
-
return actions;
}
--- trunk/extragear/multimedia/amarok/src/collection/sqlcollection/CMakeLists.txt #926042:926043
@@ -31,6 +31,7 @@
ScanManager.cpp
ScanResultProcessor.cpp
SqlBookmarkThisCapability.cpp
+ SqlCollectionCapability.cpp
SqlCollection.cpp
SqlCollectionDBusHandler.cpp
SqlCollectionLocation.cpp
--- trunk/extragear/multimedia/amarok/src/collection/sqlcollection/SqlCollection.cpp #926042:926043
@@ -19,6 +19,8 @@
#include "SqlCollection.h"
+#include "meta/capabilities/CollectionCapability.h"
+#include "SqlCollectionCapability.h"
#include "DatabaseUpdater.h"
#include "Debug.h"
#include "MySqlEmbeddedCollection.h"
@@ -26,6 +28,7 @@
#include "SqlCollectionLocation.h"
#include "SqlQueryMaker.h"
#include "SqliteCollection.h"
+#include "SvgHandler.h"
#ifdef Q_OS_WIN32
class XesamCollectionBuilder
@@ -38,7 +41,8 @@
#endif
#include <klocale.h>
-
+#include <KIcon>
+#include <KMessageBox> // TODO put the delete confirmation code somewhere else?
#include <QTimer>
AMAROK_EXPORT_PLUGIN( SqlCollectionFactory )
@@ -305,5 +309,55 @@
m_xesamBuilder = new XesamCollectionBuilder( this );
}
+bool
+SqlCollection::hasCapabilityInterface( Meta::Capability::Type type ) const
+{
+ DEBUG_BLOCK
+ switch( type )
+ {
+ case Meta::Capability::Collection:
+ return true;
+ default:
+ return false;
+ }
+}
+
+Meta::Capability*
+SqlCollection::asCapabilityInterface( Meta::Capability::Type type )
+{
+ DEBUG_BLOCK
+ switch( type )
+ {
+ case Meta::Capability::Collection:
+ return new Meta::SqlCollectionCapability( this );
+ default:
+ return 0;
+ }
+}
+
+void
+SqlCollection::deleteTracksSlot( Meta::TrackList tracklist )
+{
+
+ DEBUG_BLOCK
+
+ // TODO put the delete confirmation code somewhere else?
+ const QString text( i18nc( "@info", "Do you really want to delete these %1 tracks?", tracklist.count() ) );
+ const bool del = KMessageBox::warningContinueCancel(0,
+ text,
+ QString() ) == KMessageBox::Continue;
+ if( !del )
+ return;
+
+ // remove the tracks from the collection maps
+ //TODO make unblocking
+ foreach( Meta::TrackPtr track, tracklist )
+ location()->remove( track );
+
+ // inform treeview collection has updated
+ emit updated();
+}
+
+
#include "SqlCollection.moc"
--- trunk/extragear/multimedia/amarok/src/collection/sqlcollection/SqlCollection.h #926042:926043
@@ -99,8 +99,12 @@
virtual void vacuum() const;
+ virtual bool hasCapabilityInterface( Meta::Capability::Type type ) const;
+ virtual Meta::Capability* asCapabilityInterface( Meta::Capability::Type type );
+
public slots:
void updateTrackUrls( TrackUrls changedUrls );
+ void deleteTracksSlot( Meta::TrackList tracklist );
signals:
void scanFinished();
More information about the Amarok-devel
mailing list