Commit 180f14eb authored by Hans-Peter Deifel's avatar Hans-Peter Deifel 🐢 Committed by Hans-Peter Deifel
Browse files

viewer: Add API to open a specific file

parent 7a0d9c31
......@@ -188,19 +188,23 @@ void Viewer::reload(bool clamp) {
canvas->reload(clamp);
}
void Viewer::open(QString new_file) {
res->set_file(new_file);
QFileInfo info(new_file);
// different file - clear jumplist
// e.g. in inotify-caused reload it doesn't hurt to keep the old jumplist
// search is always cleared, see reload()
res->clear_jumps();
// TODO reset rotation?
setWindowTitle(QString::fromUtf8("%1 \u2014 katarakt").arg(info.fileName()));
reload();
}
void Viewer::open() {
QString new_file = QFileDialog::getOpenFileName(this, "Open File", "", "PDF Files (*.pdf)");
if (!new_file.isNull()) {
res->set_file(new_file);
QFileInfo info(new_file);
// different file - clear jumplist
// e.g. in inotify-caused reload it doesn't hurt to keep the old jumplist
// search is always cleared, see reload()
res->clear_jumps();
// TODO reset rotation?
setWindowTitle(QString::fromUtf8("%1 \u2014 katarakt").arg(info.fileName()));
reload();
open(new_file);
}
}
......
......@@ -37,7 +37,8 @@ public slots:
void toggle_fullscreen();
void close_search();
void reload(bool clamp = true);
void open();
void open(); // ask user for filename
void open(QString filename);
void save();
void jump_back();
void jump_forward();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment