#include "lyxfunc.h"
#include "LyXView.h"
+using std::endl;
+using std::pair;
LyXVC::LyXVC()
{
fl_hide_form(browser->LaTeXLog);
fl_free_form(browser->LaTeXLog);
}
- if (vcs) {
- delete vcs;
- }
+ delete vcs;
}
}
-bool LyXVC::file_not_found_hook(string const &)
+bool LyXVC::file_not_found_hook(string const & fn)
{
- // file is not under any VCS.
+ // Check if file is under RCS
+ if (!RCS::find_file(fn).empty())
+ return true;
+ if (!CVS::find_file(fn).empty())
+ return true;
return false;
}
}
lyxerr[Debug::LYXVC] << "LyXVC: registrer" << endl;
- string tmp = askForText(_("LyX VC: Initial description"),
- _("(no initial description)"));
- if (tmp.empty()) {
+ pair<bool, string> tmp =
+ askForText(_("LyX VC: Initial description"),
+ _("(no initial description)"));
+ if (!tmp.first || tmp.second.empty()) {
+ // should we insist on checking tmp.second.empty()?
lyxerr[Debug::LYXVC] << "LyXVC: user cancelled" << endl;
- WriteAlert(_("Info"), _("This document has NOT been registered."));
+ WriteAlert(_("Info"),
+ _("This document has NOT been registered."));
return;
}
- vcs->registrer(tmp);
+ vcs->registrer(tmp.second);
}
}
lyxerr[Debug::LYXVC] << "LyXVC: checkIn" << endl;
- string tmp = askForText(_("LyX VC: Log Message"));
- if (tmp.empty()) tmp = "(no log msg)";
-
- vcs->checkIn(tmp);
-
+ pair<bool, string> tmp = askForText(_("LyX VC: Log Message"));
+ if (tmp.first) {
+ if (tmp.second.empty()) {
+ tmp.second = _("(no log message)");
+ }
+ vcs->checkIn(tmp.second);
+ } else {
+ lyxerr[Debug::LYXVC] << "LyXVC: user cancelled" << endl;
+ }
}
void LyXVC::toggleReadOnly()
{
- switch (vcs->stat()) {
+ switch (vcs->status()) {
case VCS::UNLOCKED:
lyxerr[Debug::LYXVC] << "LyXVC: toggle to locked" << endl;
checkOut();