Commit 6319f68c authored by Philipp Erhardt's avatar Philipp Erhardt
Browse files

Add possibility to start without specifying a file

parent eb3e3a1a
......@@ -60,11 +60,6 @@ int main(int argc, char *argv[]) {
}
}
if (argv[optind] == NULL) {
cerr << "Not enough arguments" << endl;
return 1;
}
// fork more processes if there are arguments left
if (optind < argc - 1) {
QStringList l;
......@@ -74,11 +69,15 @@ int main(int argc, char *argv[]) {
QProcess::startDetached(argv[0], l);
}
QString file;
Download download;
QString file = download.load(QString::fromUtf8(argv[optind]));
if (file == NULL) {
return 1;
if (argv[optind] != NULL) {
file = download.load(QString::fromUtf8(argv[optind]));
if (file == NULL) {
return 1;
}
}
// else no argument given, "open" empty string
Viewer katarakt(file);
if (!katarakt.is_valid()) {
......
......@@ -197,7 +197,13 @@ void Viewer::update_info_widget() {
if (!res->is_valid() || !search_bar->is_valid()) {
QIcon icon;
if (!res->is_locked()) {
if (file == "") {
icon = QIcon::fromTheme("dialog-information");
info_label_text.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
info_label_text.setText("No file opened.");
info_password.hide();
} else if (!res->is_locked()) {
icon = QIcon::fromTheme("dialog-error");
info_label_text.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
......
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