Skip to content

Commit

Permalink
set m_currentPath when opening manga
Browse files Browse the repository at this point in the history
fixes broken bookmarks saving
  • Loading branch information
g-fb committed Jul 15, 2022
1 parent 71f4c6b commit 11c9771
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ int main(int argc, char *argv[])

if (args.count() > 0 && !args.at(0).isEmpty()) {
QUrl url = QUrl::fromUserInput(args.at(0), QDir::currentPath());
w->setCurrentPath(url.toLocalFile());
w->loadImages(url.toLocalFile());
}

Expand Down
9 changes: 8 additions & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ void MainWindow::openMangaArchive()
if (file.isEmpty()) {
return;
}
loadImages(file, true);
m_currentPath = file;
loadImages(file);
}

void MainWindow::openMangaFolder()
Expand All @@ -410,6 +411,7 @@ void MainWindow::openMangaFolder()
if (path.isEmpty()) {
return;
}
m_currentPath = path;
loadImages(path, true);
}

Expand Down Expand Up @@ -1095,3 +1097,8 @@ void MainWindow::dropEvent(QDropEvent *e)
QString fileName = e->mimeData()->urls().first().toLocalFile();
loadImages(fileName);
}

void MainWindow::setCurrentPath(const QString &_currentPath)
{
m_currentPath = _currentPath;
}
2 changes: 2 additions & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class MainWindow : public KXmlGuiWindow
void loadImages(const QString &path, bool recursive = false);
void loadImagesFromMemory(KArchive *archive, const QStringList &files);

void setCurrentPath(const QString &_currentPath);

private:
static void showError(const QString &error);
void init();
Expand Down

0 comments on commit 11c9771

Please sign in to comment.