mirror of
https://github.com/YACReader/yacreader
synced 2025-07-25 00:15:07 -04:00
completed drag comics from comics view to reading lists
This commit is contained in:
@ -47,16 +47,17 @@ QMimeData *ComicModel::mimeData(const QModelIndexList &indexes) const
|
||||
QList<qulonglong> ids;
|
||||
foreach(QModelIndex index, indexes)
|
||||
{
|
||||
QLOG_DEBUG() << "dragging : " << index.data(IdRole).toULongLong();
|
||||
ids << index.data(IdRole).toULongLong();
|
||||
|
||||
}
|
||||
|
||||
QByteArray data;
|
||||
QBuffer buffer(&data);
|
||||
QDataStream out(&buffer);
|
||||
QDataStream out(&data,QIODevice::WriteOnly);
|
||||
out << ids; //serialize the list of identifiers
|
||||
|
||||
QMimeData * mimeData = new QMimeData();
|
||||
mimeData->setData("application/yacreaderlibrary-comics-ids", data);
|
||||
mimeData->setData(YACReader::YACReaderLibrarComiscSelectionMimeDataFormat, data);
|
||||
|
||||
return mimeData;
|
||||
}
|
||||
@ -137,6 +138,8 @@ QVariant ComicModel::data(const QModelIndex &index, int role) const
|
||||
return item->data(ReadColumn).toBool();
|
||||
else if (role == HasBeenOpenedRole)
|
||||
return item->data(ComicModel::HasBeenOpened);
|
||||
else if (role == IdRole)
|
||||
return item->data(Id);
|
||||
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
@ -705,7 +708,18 @@ QModelIndex ComicModel::getIndexFromId(quint64 id)
|
||||
i++;
|
||||
}
|
||||
|
||||
return index(i,0);
|
||||
return index(i,0);
|
||||
}
|
||||
|
||||
//TODO completely inefficiently
|
||||
QList<QModelIndex> ComicModel::getIndexesFromIds(const QList<qulonglong> &comicIds)
|
||||
{
|
||||
QList<QModelIndex> comicsIndexes;
|
||||
|
||||
foreach(qulonglong id,comicIds)
|
||||
comicsIndexes << getIndexFromId(id);
|
||||
|
||||
return comicsIndexes;
|
||||
}
|
||||
|
||||
void ComicModel::startTransaction()
|
||||
@ -720,8 +734,6 @@ void ComicModel::finishTransaction()
|
||||
dbTransaction.commit();
|
||||
dbTransaction.close();
|
||||
QSqlDatabase::removeDatabase(_databasePath);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ComicModel::removeInTransaction(int row)
|
||||
@ -800,6 +812,11 @@ void ComicModel::resetComicRating(const QModelIndex &mi)
|
||||
QSqlDatabase::removeDatabase(_databasePath);
|
||||
}
|
||||
|
||||
void ComicModel::addComicsToFavorites(const QList<qulonglong> &comicIds)
|
||||
{
|
||||
addComicsToFavorites(getIndexesFromIds(comicIds));
|
||||
}
|
||||
|
||||
void ComicModel::addComicsToFavorites(const QList<QModelIndex> & comicsList)
|
||||
{
|
||||
QList<ComicDB> comics = getComics(comicsList);
|
||||
@ -812,6 +829,11 @@ void ComicModel::addComicsToFavorites(const QList<QModelIndex> & comicsList)
|
||||
QSqlDatabase::removeDatabase(_databasePath);
|
||||
}
|
||||
|
||||
void ComicModel::addComicsToLabel(const QList<qulonglong> &comicIds, qulonglong labelId)
|
||||
{
|
||||
addComicsToLabel(getIndexesFromIds(comicIds),labelId);
|
||||
}
|
||||
|
||||
void ComicModel::addComicsToLabel(const QList<QModelIndex> &comicsList, qulonglong labelId)
|
||||
{
|
||||
QList<ComicDB> comics = getComics(comicsList);
|
||||
@ -824,6 +846,23 @@ void ComicModel::addComicsToLabel(const QList<QModelIndex> &comicsList, qulonglo
|
||||
QSqlDatabase::removeDatabase(_databasePath);
|
||||
}
|
||||
|
||||
void ComicModel::addComicsToReadingList(const QList<qulonglong> &comicIds, qulonglong readingListId)
|
||||
{
|
||||
addComicsToReadingList(getIndexesFromIds(comicIds),readingListId);
|
||||
}
|
||||
|
||||
void ComicModel::addComicsToReadingList(const QList<QModelIndex> &comicsList, qulonglong readingListId)
|
||||
{
|
||||
QList<ComicDB> comics = getComics(comicsList);
|
||||
|
||||
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
||||
|
||||
DBHelper::insertComicsInReadingList(comics,readingListId,db);
|
||||
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(_databasePath);
|
||||
}
|
||||
|
||||
void ComicModel::deleteComicsFromFavorites(const QList<QModelIndex> &comicsList)
|
||||
{
|
||||
QList<ComicDB> comics = getComics(comicsList);
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
QList<ComicDB> getComics(QList<QModelIndex> list); //--> recupera la información común a los comics seleccionados
|
||||
QList<ComicDB> getAllComics();
|
||||
QModelIndex getIndexFromId(quint64 id);
|
||||
QList<QModelIndex> getIndexesFromIds(const QList<qulonglong> &comicIds);
|
||||
//setcomicInfo(QModelIndex & mi); --> inserta en la base datos
|
||||
//setComicInfoForAllComics(); --> inserta la información común a todos los cómics de una sola vez.
|
||||
//setComicInfoForSelectedComis(QList<QModelIndex> list); -->inserta la información común para los comics seleccionados
|
||||
@ -64,8 +65,11 @@ public:
|
||||
void removeInTransaction(int row);
|
||||
void reload(const ComicDB & comic);
|
||||
void resetComicRating(const QModelIndex & mi);
|
||||
|
||||
|
||||
void addComicsToFavorites(const QList<QModelIndex> &comicsList);
|
||||
void addComicsToLabel(const QList<QModelIndex> &comicsList, qulonglong labelId);
|
||||
void addComicsToReadingList(const QList<QModelIndex> &comicsList, qulonglong readingListId);
|
||||
|
||||
void deleteComicsFromFavorites(const QList<QModelIndex> &comicsList);
|
||||
void deleteComicsFromLabel(const QList<QModelIndex> &comicsList, qulonglong labelId);
|
||||
@ -115,6 +119,10 @@ public slots:
|
||||
void finishTransaction();
|
||||
void updateRating(int rating, QModelIndex mi);
|
||||
|
||||
void addComicsToFavorites(const QList<qulonglong> &comicIds);
|
||||
void addComicsToLabel(const QList<qulonglong> &comicIds, qulonglong labelId);
|
||||
void addComicsToReadingList(const QList<qulonglong> &comicIds, qulonglong readingListId);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
@ -170,7 +170,7 @@ qulonglong ReadingListItem::getId() const
|
||||
{
|
||||
if(itemData.count()>1)
|
||||
{
|
||||
return YACReader::LabelColors(itemData.at(1).toULongLong());
|
||||
return itemData.at(1).toULongLong();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,10 @@ QVariant ReadingListModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
|
||||
if (role == ReadingListModel::IDRole)
|
||||
{
|
||||
QLOG_DEBUG() << "getting role";
|
||||
return item->getId();
|
||||
}
|
||||
|
||||
if (role == ReadingListModel::SpecialListTypeRole && typeid(*item) == typeid(SpecialListItem))
|
||||
{
|
||||
@ -131,20 +134,20 @@ QModelIndex ReadingListModel::index(int row, int column, const QModelIndex &pare
|
||||
{
|
||||
int separatorsCount = labels.isEmpty()?1:2;
|
||||
|
||||
if(row >= 0 && row < specialLists.count())
|
||||
if(rowIsSpecialList(row,parent))
|
||||
return createIndex(row, column, specialLists.at(row));
|
||||
|
||||
if(row == specialLists.count())
|
||||
return createIndex(row,column,separator1);
|
||||
|
||||
if(row > specialLists.count() && row <= specialLists.count() + labels.count())
|
||||
if(rowIsLabel(row,parent))
|
||||
return createIndex(row,column,labels.at(row-specialLists.count()-1));
|
||||
|
||||
if(separatorsCount == 2)
|
||||
if(row == specialLists.count() + labels.count() + 1)
|
||||
return createIndex(row,column,separator2);
|
||||
|
||||
if(row >= specialLists.count() + labels.count() + separatorsCount)
|
||||
if(rowIsReadingList(row,parent))
|
||||
return createIndex(row,column,rootItem->child(row - (specialLists.count() + labels.count() + separatorsCount)));
|
||||
|
||||
} else //sublist
|
||||
@ -188,13 +191,71 @@ QModelIndex ReadingListModel::parent(const QModelIndex &index) const
|
||||
|
||||
bool ReadingListModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
return data->formats().contains("application/yacreaderlibrary-comics-ids");
|
||||
QLOG_DEBUG() << "trying to drop into row = " << row << "column column = " << column << "parent" << parent;
|
||||
|
||||
if(row == -1)
|
||||
return false;
|
||||
|
||||
if(!parent.isValid()) //top level items
|
||||
{
|
||||
if(row == -1) //no list
|
||||
return false;
|
||||
|
||||
if(row == 1) //reading is just an smart list
|
||||
return false;
|
||||
|
||||
if(rowIsSeparator(row,parent))
|
||||
return false;
|
||||
}
|
||||
|
||||
return data->formats().contains(YACReader::YACReaderLibrarComiscSelectionMimeDataFormat);
|
||||
}
|
||||
|
||||
bool ReadingListModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
|
||||
{
|
||||
QLOG_DEBUG() << "drop mimedata into row = " << row << "column column = " << column << "parent" << parent;
|
||||
return true;
|
||||
QLOG_DEBUG() << "drop mimedata into row = " << row << " column = " << column << "parent" << parent;
|
||||
|
||||
QList<qulonglong> comicIds;
|
||||
QByteArray rawData = data->data(YACReader::YACReaderLibrarComiscSelectionMimeDataFormat);
|
||||
QDataStream in(&rawData,QIODevice::ReadOnly);
|
||||
in >> comicIds; //deserialize the list of indentifiers
|
||||
|
||||
QLOG_DEBUG() << "dropped : " << comicIds;
|
||||
|
||||
QModelIndex dest;
|
||||
QModelIndex parentDest;
|
||||
|
||||
if(row == -1)
|
||||
{
|
||||
dest = parent;
|
||||
}
|
||||
else
|
||||
dest = index(row,column,parent);
|
||||
|
||||
parentDest = dest.parent();
|
||||
|
||||
if(rowIsSpecialList(dest.row(),parentDest)) {
|
||||
if(dest.row() == 0) //add to favorites
|
||||
{
|
||||
QLOG_DEBUG() << "-------addComicsToFavorites : " << comicIds << " to " << dest.data(IDRole).toULongLong();
|
||||
emit addComicsToFavorites(comicIds);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(rowIsLabel(dest.row(),parentDest)) {
|
||||
QLOG_DEBUG() << "+++++++++++addComicsToLabel : " << comicIds << " to " << dest.data(IDRole).toULongLong();
|
||||
emit addComicsToLabel(comicIds, dest.data(IDRole).toULongLong());
|
||||
return true;
|
||||
}
|
||||
|
||||
if(rowIsReadingList(dest.row(),parentDest)) {
|
||||
QLOG_DEBUG() << "///////////addComicsToReadingList : " << comicIds << " to " << dest.data(IDRole).toULongLong();
|
||||
emit addComicsToReadingList(comicIds, dest.data(IDRole).toULongLong());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ReadingListModel::setupReadingListsData(QString path)
|
||||
@ -498,8 +559,55 @@ int ReadingListModel::addLabelIntoList(LabelItem *item)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ReadingListModel::rowIsSpecialList(int row, const QModelIndex &parent) const
|
||||
{
|
||||
if(parent.isValid())
|
||||
return false; //by now no sublists in special list
|
||||
|
||||
if(row >=0 && row < specialLists.count())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ReadingListModel::rowIsLabel(int row, const QModelIndex &parent) const
|
||||
{
|
||||
if(parent.isValid())
|
||||
return false; //by now no sublists in labels
|
||||
|
||||
if(row > specialLists.count() && row <= specialLists.count() + labels.count())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ReadingListModel::rowIsReadingList(int row, const QModelIndex &parent) const
|
||||
{
|
||||
if(parent.isValid())
|
||||
return true; //only lists with sublists
|
||||
|
||||
int separatorsCount = labels.isEmpty()?1:2;
|
||||
|
||||
if(row >= specialLists.count() + labels.count() + separatorsCount)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ReadingListModel::rowIsSeparator(int row, const QModelIndex &parent) const
|
||||
{
|
||||
if(parent.isValid())
|
||||
return false; //only separators at top level
|
||||
|
||||
if(row == specialLists.count())
|
||||
return true;
|
||||
|
||||
int separatorsCount = labels.isEmpty()?1:2;
|
||||
if(separatorsCount == 2 && row == specialLists.count() + labels.count() + 1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ReadingListModelProxy::ReadingListModelProxy(QObject *parent)
|
||||
:QSortFilterProxyModel(parent)
|
||||
|
@ -74,6 +74,10 @@ public:
|
||||
|
||||
signals:
|
||||
|
||||
void addComicsToFavorites(const QList<qulonglong> & comicIds);
|
||||
void addComicsToLabel(const QList<qulonglong> & comicIds, qulonglong labelId);
|
||||
void addComicsToReadingList(const QList<qulonglong> & comicIds, qulonglong readingListId);
|
||||
|
||||
private:
|
||||
void cleanAll();
|
||||
void setupReadingListsData(QSqlQuery &sqlquery, ReadingListItem *parent);
|
||||
@ -82,6 +86,11 @@ private:
|
||||
void setupReadingLists(QSqlDatabase &db);
|
||||
int addLabelIntoList(LabelItem *item);
|
||||
|
||||
bool rowIsSpecialList(int row, const QModelIndex & parent = QModelIndex()) const;
|
||||
bool rowIsLabel(int row, const QModelIndex & parent = QModelIndex()) const;
|
||||
bool rowIsReadingList(int row, const QModelIndex & parent = QModelIndex()) const;
|
||||
bool rowIsSeparator(int row, const QModelIndex & parent = QModelIndex()) const;
|
||||
|
||||
//Special lists
|
||||
QList<SpecialListItem *> specialLists;
|
||||
|
||||
|
@ -474,11 +474,6 @@ qulonglong DBHelper::insertReadingList(const QString &name, QSqlDatabase &db)
|
||||
|
||||
void DBHelper::insertComicsInFavorites(const QList<ComicDB> &comicsList, QSqlDatabase &db)
|
||||
{
|
||||
/*QSqlQuery getNumComicsInFavoritesQuery("SELECT count(*) from comic_reading_list;",db);
|
||||
getNumComicsInFavoritesQuery.next();
|
||||
QSqlRecord record = getNumComicsInFavoritesQuery.record();
|
||||
int numComics = record.value(0).toInt();*/
|
||||
|
||||
db.transaction();
|
||||
|
||||
QSqlQuery query(db);
|
||||
@ -512,6 +507,30 @@ void DBHelper::insertComicsInLabel(const QList<ComicDB> &comicsList, qulonglong
|
||||
|
||||
db.commit();
|
||||
}
|
||||
|
||||
void DBHelper::insertComicsInReadingList(const QList<ComicDB> &comicsList, qulonglong readingListId, QSqlDatabase &db)
|
||||
{
|
||||
QSqlQuery getNumComicsInFavoritesQuery("SELECT count(*) from comic_reading_list;",db);
|
||||
getNumComicsInFavoritesQuery.next();
|
||||
QSqlRecord record = getNumComicsInFavoritesQuery.record();
|
||||
int numComics = record.value(0).toInt();
|
||||
|
||||
db.transaction();
|
||||
|
||||
QSqlQuery query(db);
|
||||
query.prepare("INSERT INTO comic_reading_list (reading_list_id, comic_id, ordering) "
|
||||
"VALUES (:reading_list_id, :comic_id, :ordering)");
|
||||
|
||||
foreach(ComicDB comic, comicsList)
|
||||
{
|
||||
query.bindValue(":reading_list_id", readingListId);
|
||||
query.bindValue(":comic_id", comic.id);
|
||||
query.bindValue(":ordering", numComics++);
|
||||
query.exec();
|
||||
}
|
||||
|
||||
db.commit();
|
||||
}
|
||||
//queries
|
||||
QList<LibraryItem *> DBHelper::getFoldersFromParent(qulonglong parentId, QSqlDatabase & db, bool sort)
|
||||
{
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
static qulonglong insertReadingList(const QString & name, QSqlDatabase & db);
|
||||
static void insertComicsInFavorites(const QList<ComicDB> & comicsList, QSqlDatabase & db);
|
||||
static void insertComicsInLabel(const QList<ComicDB> & comicsList, qulonglong labelId, QSqlDatabase & db);
|
||||
static void insertComicsInReadingList(const QList<ComicDB> & comicsList, qulonglong readingListId, QSqlDatabase & db);
|
||||
//updates
|
||||
static void update(qulonglong libraryId, ComicInfo & comicInfo);
|
||||
static void update(ComicDB * comics, QSqlDatabase & db);
|
||||
|
@ -169,7 +169,29 @@ void GridComicsView::requestedContextMenu(const QPoint &point)
|
||||
QSize GridComicsView::sizeHint()
|
||||
{
|
||||
QLOG_INFO() << "sizeHint";
|
||||
return QSize(1280,768);
|
||||
return QSize(1280,768);
|
||||
}
|
||||
|
||||
QByteArray GridComicsView::getMimeDataFromSelection()
|
||||
{
|
||||
QByteArray data;
|
||||
|
||||
QMimeData * mimeData = model->mimeData(_selectionModel->selectedIndexes());
|
||||
data = mimeData->data(YACReader::YACReaderLibrarComiscSelectionMimeDataFormat);
|
||||
|
||||
delete mimeData;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void GridComicsView::startDrag()
|
||||
{
|
||||
QLOG_DEBUG() << "performDrag";
|
||||
QDrag *drag = new QDrag(this);
|
||||
drag->setMimeData(model->mimeData(_selectionModel->selectedRows()));
|
||||
drag->setPixmap(QPixmap(":/images/openInYACReader.png")); //TODO add better image
|
||||
|
||||
Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
|
||||
}
|
||||
|
||||
//helper
|
||||
|
@ -28,6 +28,8 @@ public:
|
||||
void updateConfig(QSettings * settings);
|
||||
void enableFilterMode(bool enabled);
|
||||
QSize sizeHint();
|
||||
QByteArray getMimeDataFromSelection();
|
||||
|
||||
|
||||
signals:
|
||||
void comicRated(int,QModelIndex);
|
||||
@ -48,6 +50,8 @@ public slots:
|
||||
//rating
|
||||
void rate(int index, int rating);
|
||||
|
||||
void startDrag();
|
||||
|
||||
protected slots:
|
||||
void requestedContextMenu(const QPoint & point);
|
||||
|
||||
|
@ -1148,6 +1148,9 @@ void LibraryWindow::createConnections()
|
||||
connect(addLabelAction,SIGNAL(triggered()),this,SLOT(showAddNewLabelDialog()));
|
||||
connect(renameListAction,SIGNAL(triggered()),this,SLOT(showRenameCurrentList()));
|
||||
|
||||
connect(listsModel,SIGNAL(addComicsToFavorites(QList<qulonglong>)),comicsModel,SLOT(addComicsToFavorites(QList<qulonglong>)));
|
||||
connect(listsModel,SIGNAL(addComicsToLabel(QList<qulonglong>,qulonglong)),comicsModel,SLOT(addComicsToLabel(QList<qulonglong>,qulonglong)));
|
||||
connect(listsModel,SIGNAL(addComicsToReadingList(QList<qulonglong>,qulonglong)),comicsModel,SLOT(addComicsToReadingList(QList<qulonglong>,qulonglong)));
|
||||
//--
|
||||
|
||||
connect(addToFavoritesAction,SIGNAL(triggered()),this,SLOT(addSelectedComicsToFavorites()));
|
||||
|
@ -1,6 +1,6 @@
|
||||
import QtQuick 2.3
|
||||
import QtQuick.Controls 1.0
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import QtQuick.Controls 1.2
|
||||
import QtGraphicalEffects 1.0
|
||||
import comicModel 1.0
|
||||
|
||||
@ -39,13 +39,21 @@ Rectangle {
|
||||
id: realCell
|
||||
|
||||
property int position : 0
|
||||
|
||||
property bool dragging: false;
|
||||
Drag.active: mouseArea.drag.active
|
||||
Drag.hotSpot.x: 32
|
||||
Drag.hotSpot.y: 32
|
||||
Drag.dragType: Drag.Automatic
|
||||
Drag.mimeData: { "text/plain": titleText.text }
|
||||
//Drag.mimeData: { "x": 1 }
|
||||
Drag.proposedAction: Qt.CopyAction
|
||||
Drag.onActiveChanged: {
|
||||
if(!dragging)
|
||||
{
|
||||
comicsSelectionHelper.startDrag();
|
||||
dragging = true;
|
||||
}else
|
||||
dragging = false;
|
||||
}
|
||||
|
||||
width: 156; height: 287
|
||||
color: ((dummyValue || !dummyValue) && comicsSelectionHelper.isSelectedIndex(index)) || grid.currentIndex === index?selectedColor:cellColor;
|
||||
@ -65,8 +73,8 @@ Rectangle {
|
||||
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onDoubleClicked: {
|
||||
|
||||
onDoubleClicked: {
|
||||
comicsSelectionHelper.clear();
|
||||
|
||||
comicsSelectionHelper.selectIndex(index);
|
||||
@ -74,13 +82,14 @@ Rectangle {
|
||||
comicsSelectionHelper.selectedItem(index);
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
onPressed: {
|
||||
//grid.currentIndex = index
|
||||
//comicsSelection.setCurrentIndex(index,0x0002)
|
||||
var ci = grid.currentIndex;
|
||||
if(mouse.button != Qt.RightButton && !(mouse.modifiers & Qt.ControlModifier || mouse.modifiers & Qt.ShiftModifier))
|
||||
{
|
||||
comicsSelectionHelper.clear();
|
||||
if(!comicsSelectionHelper.isSelectedIndex(index))
|
||||
comicsSelectionHelper.clear();
|
||||
}
|
||||
|
||||
if(mouse.modifiers & Qt.ShiftModifier)
|
||||
@ -126,9 +135,8 @@ Rectangle {
|
||||
anchors {horizontalCenter: parent.horizontalCenter; top: realCell.top; topMargin: 4}
|
||||
source: cover_path
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
//smooth: true
|
||||
smooth: true
|
||||
mipmap: true
|
||||
//antialiasing: true
|
||||
asynchronous : true
|
||||
cache: false //TODO clear cache only when it is neede
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ void YACReaderFoldersView::dragLeaveEvent(QDragLeaveEvent *event)
|
||||
void YACReaderFoldersView::dragMoveEvent(QDragMoveEvent *event)
|
||||
{
|
||||
YACReaderTreeView::dragMoveEvent(event);
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
void YACReaderFoldersView::dropEvent(QDropEvent *event)
|
||||
@ -58,7 +59,6 @@ void YACReaderFoldersView::dropEvent(QDropEvent *event)
|
||||
|
||||
if(validAction)
|
||||
{
|
||||
|
||||
QList<QPair<QString, QString> > droppedFiles = ComicFilesManager::getDroppedFiles(event->mimeData()->urls());
|
||||
QModelIndex destinationIndex = indexAt(event->pos());
|
||||
|
||||
|
@ -14,6 +14,14 @@ void YACReaderReadingListsView::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
YACReaderTreeView::dragEnterEvent(event);
|
||||
|
||||
/*QModelIndex destinationIndex = indexAt(event->pos());
|
||||
if(model()->canDropMimeData(event->mimeData(), event->proposedAction(), destinationIndex.row(), destinationIndex.column(), destinationIndex.parent()))*/
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
void YACReaderReadingListsView::dragMoveEvent(QDragMoveEvent *event)
|
||||
{
|
||||
YACReaderTreeView::dragMoveEvent(event);
|
||||
QModelIndex destinationIndex = indexAt(event->pos());
|
||||
if(model()->canDropMimeData(event->mimeData(), event->proposedAction(), destinationIndex.row(), destinationIndex.column(), destinationIndex.parent()))
|
||||
event->acceptProposedAction();
|
||||
|
@ -14,6 +14,7 @@ public:
|
||||
protected:
|
||||
//Drop to import
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
};
|
||||
|
||||
class YACReaderReadingListsViewItemDeletegate: public QStyledItemDelegate
|
||||
|
Reference in New Issue
Block a user