mirror of
https://github.com/YACReader/yacreader
synced 2025-07-23 07:24:58 -04:00
new class for controlling navigation in LibraryWindow (NavigationController), code refactoring
This commit is contained in:
@ -12,17 +12,19 @@ ComicFilesManager::ComicFilesManager(QObject *parent) :
|
||||
{
|
||||
}
|
||||
|
||||
void ComicFilesManager::copyComicsTo(const QList<QPair<QString,QString> > &sourceComics, const QString &folderDest)
|
||||
void ComicFilesManager::copyComicsTo(const QList<QPair<QString,QString> > &sourceComics, const QString &folderDest, const QModelIndex & dest)
|
||||
{
|
||||
comics = sourceComics;
|
||||
folder = folderDest;
|
||||
folderDestinationModelIndex = dest;
|
||||
move = false;
|
||||
}
|
||||
|
||||
void ComicFilesManager::moveComicsTo(const QList<QPair<QString, QString> > &sourceComics, const QString &folderDest)
|
||||
void ComicFilesManager::moveComicsTo(const QList<QPair<QString, QString> > &sourceComics, const QString &folderDest, const QModelIndex &dest)
|
||||
{
|
||||
comics = sourceComics;
|
||||
folder = folderDest;
|
||||
folderDestinationModelIndex = dest;
|
||||
move = true;
|
||||
}
|
||||
|
||||
@ -34,17 +36,24 @@ QList<QPair<QString, QString> > ComicFilesManager::getDroppedFiles(const QList<Q
|
||||
foreach(QUrl url, urls)
|
||||
{
|
||||
currentPath = url.toLocalFile();
|
||||
if(currentPath.endsWith('/'))
|
||||
currentPath = currentPath.remove(currentPath.length()-1,1); //QTBUG-35896 QUrl.toLocalFile inconsistency.
|
||||
if(Comic::fileIsComic(currentPath))
|
||||
dropedFiles << QPair<QString, QString>(currentPath,"/");
|
||||
else
|
||||
{
|
||||
QLOG_DEBUG() << "XXXXXXXXXXXX :" << currentPath;
|
||||
QFileInfo info(currentPath);
|
||||
if(info.isDir())
|
||||
{
|
||||
QLOG_DEBUG() << "origin path prior to absoluteFilePath : " << info.absolutePath();
|
||||
foreach(QString comicPath, Comic::findValidComicFilesInFolder(info.absoluteFilePath()))
|
||||
{
|
||||
QFileInfo comicInfo(comicPath);
|
||||
QString path = comicInfo.absolutePath();
|
||||
QLOG_DEBUG() << "comic path : " << comicPath;
|
||||
QLOG_DEBUG() << "full comic path : " << path;
|
||||
QLOG_DEBUG() << "origin path : " << info.absolutePath();
|
||||
dropedFiles << QPair<QString, QString>(comicPath, path.remove(info.absolutePath()));
|
||||
}
|
||||
}
|
||||
@ -64,7 +73,7 @@ void ComicFilesManager::process()
|
||||
if(canceled)
|
||||
{
|
||||
if(successProcesingFiles)
|
||||
emit success();
|
||||
emit success(folderDestinationModelIndex);
|
||||
emit finished();
|
||||
|
||||
return; //TODO rollback?
|
||||
@ -88,7 +97,7 @@ void ComicFilesManager::process()
|
||||
}
|
||||
|
||||
if(successProcesingFiles)
|
||||
emit success();
|
||||
emit success(folderDestinationModelIndex);
|
||||
emit finished();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user