open next/previous after leaving client mode fixed

This commit is contained in:
Luis Ángel San Martín 2013-07-24 17:44:38 +02:00
parent 79fe9a3f2d
commit 2674a1b9c0

View File

@ -615,8 +615,8 @@ void MainWindowViewer::open(QString path, ComicDB & comic, QList<ComicDB> & sibl
void MainWindowViewer::openComicFromPath(QString pathFile) void MainWindowViewer::openComicFromPath(QString pathFile)
{ {
currentDirectory = pathFile;
QFileInfo fi(pathFile); QFileInfo fi(pathFile);
currentDirectory = fi.dir().absolutePath();
getSiblingComics(fi.absolutePath(),fi.fileName()); getSiblingComics(fi.absolutePath(),fi.fileName());
setWindowTitle("YACReader - " + fi.fileName()); setWindowTitle("YACReader - " + fi.fileName());
@ -625,6 +625,8 @@ void MainWindowViewer::openComicFromPath(QString pathFile)
viewer->open(pathFile); viewer->open(pathFile);
isClient = false;
} }
void MainWindowViewer::openFolder() void MainWindowViewer::openFolder()
@ -634,6 +636,7 @@ void MainWindowViewer::openFolder()
if (!pathDir.isEmpty()) if (!pathDir.isEmpty())
{ {
openFolderFromPath(pathDir); openFolderFromPath(pathDir);
isClient = false;
} }
} }
@ -866,16 +869,13 @@ void MainWindowViewer::closeEvent ( QCloseEvent * event )
void MainWindowViewer::openPreviousComic() void MainWindowViewer::openPreviousComic()
{ {
YACReaderLocalClient client; YACReaderLocalClient client;
if(!siblingComics.isEmpty()) if(!siblingComics.isEmpty() && isClient)
{ {
if(isClient)
{
currentComicDB.info.currentPage = viewer->getCurrentPageNumber()+1; currentComicDB.info.currentPage = viewer->getCurrentPageNumber()+1;
currentComicDB.info.hasBeenOpened = true; currentComicDB.info.hasBeenOpened = true;
//viewer->getBookmarks(); //viewer->getBookmarks();
client.sendComicInfo(libraryId,currentComicDB); client.sendComicInfo(libraryId,currentComicDB);
}
int currentIndex = siblingComics.indexOf(currentComicDB); int currentIndex = siblingComics.indexOf(currentComicDB);
if (currentIndex == -1) if (currentIndex == -1)
@ -900,15 +900,12 @@ void MainWindowViewer::openPreviousComic()
void MainWindowViewer::openNextComic() void MainWindowViewer::openNextComic()
{ {
YACReaderLocalClient client; YACReaderLocalClient client;
if(!siblingComics.isEmpty()) if(!siblingComics.isEmpty() && isClient)
{
if(isClient)
{ {
currentComicDB.info.currentPage = viewer->getCurrentPageNumber()+1; currentComicDB.info.currentPage = viewer->getCurrentPageNumber()+1;
currentComicDB.info.hasBeenOpened = true; currentComicDB.info.hasBeenOpened = true;
//viewer->getBookmarks(); //viewer->getBookmarks();
client.sendComicInfo(libraryId,currentComicDB); client.sendComicInfo(libraryId,currentComicDB);
}
int currentIndex = siblingComics.indexOf(currentComicDB); int currentIndex = siblingComics.indexOf(currentComicDB);
if (currentIndex == -1) if (currentIndex == -1)
@ -999,6 +996,8 @@ void MainWindowViewer::dropEvent(QDropEvent *event)
else else
if(info.isDir()) if(info.isDir())
openFolderFromPath(fName); openFolderFromPath(fName);
isClient = false;
} }
} }