diff --git a/src/catalog.cpp b/src/catalog.cpp index 32919780d5..e8f32c71b7 100644 --- a/src/catalog.cpp +++ b/src/catalog.cpp @@ -396,6 +396,7 @@ void Catalog::HeaderData::ParseDict() // Parse extended information: SourceCodeCharset = GetHeader("X-Poedit-SourceCharset"); BasePath = GetHeader("X-Poedit-Basepath"); + PotFile = GetHeader("X-Poedit-Potfile"); Keywords.Clear(); wxString kwlist = GetHeader("X-Poedit-KeywordsList"); @@ -955,6 +956,8 @@ Catalog::Catalog() { m_isOk = true; m_header.BasePath = wxEmptyString; + m_header.PotFile = wxEmptyString; + for(int i = BOOKMARK_0; i < BOOKMARK_LAST; i++) { m_header.Bookmarks[i] = -1; @@ -1676,6 +1679,16 @@ bool Catalog::Update(ProgressInfo *progress, bool summary, bool *cancelledByUser return false; } + wxString pot_file = m_header.PotFile; + if (!pot_file.empty()) + { + if (!wxIsAbsolutePath(pot_file)) + pot_file = path + "/" + pot_file; + + return UpdateFromPOT(pot_file, summary, cancelledByUser); + } + + wxSetWorkingDirectory(path); } diff --git a/src/catalog.h b/src/catalog.h index 9ffd487d41..52ba23192f 100644 --- a/src/catalog.h +++ b/src/catalog.h @@ -456,6 +456,7 @@ class Catalog wxArrayString SearchPaths, Keywords; int Bookmarks[BOOKMARK_LAST]; wxString BasePath; + wxString PotFile; wxString Comment; diff --git a/src/edframe.cpp b/src/edframe.cpp index a6a9c9f392..942715a7a8 100644 --- a/src/edframe.cpp +++ b/src/edframe.cpp @@ -2668,7 +2668,7 @@ void PoeditFrame::UpdateMenu() editable && m_catalog->HasDeletedItems()); const bool doupdate = hasCatalog && - !m_catalog->Header().SearchPaths.empty(); + (!m_catalog->Header().SearchPaths.empty() || !m_catalog->Header().PotFile.empty()); toolbar->EnableTool(XRCID("menu_update"), doupdate); menubar->Enable(XRCID("menu_update"), doupdate);