File indexing completed on 2024-05-19 04:49:18
0001 /**************************************************************************************** 0002 * Copyright (c) 2010 Rick W. Chen <stuffcorpse@archlinux.us> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef TRASHCOLLECTIONLOCATION_H 0018 #define TRASHCOLLECTIONLOCATION_H 0019 0020 #include "core/collections/CollectionLocation.h" 0021 #include <KIOCore/KIO/Job> 0022 0023 class KJob; 0024 0025 namespace Collections { 0026 0027 /** 0028 * Utility class that allows moving tracks to the KIO trash using standard 0029 * CollectionLocation API. It is not intended to be a collection, but more 0030 * as a black hole destination. 0031 */ 0032 class TrashCollectionLocation : public CollectionLocation 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 TrashCollectionLocation(); 0038 ~TrashCollectionLocation() override; 0039 0040 QString prettyLocation() const override; 0041 bool isWritable() const override; 0042 0043 protected: 0044 void copyUrlsToCollection( const QMap<Meta::TrackPtr, QUrl> &sources, 0045 const Transcoding::Configuration &configuration ) override; 0046 void showDestinationDialog( const Meta::TrackList &tracks, bool removeSources, 0047 const Transcoding::Configuration &configuration ) override; 0048 0049 private Q_SLOTS: 0050 void slotTrashJobFinished( KJob *job ); 0051 0052 private: 0053 bool m_trashConfirmed; 0054 QHash<KJob*, Meta::TrackList> m_trashJobs; 0055 }; 0056 0057 } //namespace Collections 0058 0059 #endif // TRASHCOLLECTIONLOCATION_H