diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7b2cce9..4275c07 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -419,6 +420,13 @@ void MainWindow::onEditCaption() if (path.isEmpty()) return; + if (::access(path.constData(), W_OK) != 0) { + QMessageBox::warning(this, tr("Cannot Edit Caption"), + tr("The file is write-protected and cannot be edited.\n\n%1") + .arg(QString::fromLocal8Bit(path))); + return; + } + ExifData data = ExifReader::read(path); QDialog dlg(this);