#include "frontends/Alert.h"
#include "frontends/Application.h"
#include "frontends/FileDialog.h"
+#include "frontends/LyXView.h"
#include "support/filefilterlist.h"
#include "support/filetools.h"
using support::addName;
using support::bformat;
using support::FileFilterList;
+using support::FileName;
using support::ForkedProcess;
using support::isLyXFilename;
using support::libFileSearch;
class AutoSaveBuffer : public ForkedProcess {
public:
///
- AutoSaveBuffer(BufferView & bv, string const & fname)
+ AutoSaveBuffer(BufferView & bv, FileName const & fname)
: bv_(bv), fname_(fname) {}
///
virtual shared_ptr<ForkedProcess> clone() const
virtual int generateChild();
///
BufferView & bv_;
- string fname_;
+ FileName fname_;
};
int AutoSaveBuffer::start()
{
- command_ = to_utf8(bformat(_("Auto-saving %1$s"), from_utf8(fname_)));
+ command_ = to_utf8(bformat(_("Auto-saving %1$s"), from_utf8(fname_.absFilename())));
return run(DontWait);
}
// anyway.
bool failed = false;
- string const tmp_ret = tempName(string(), "lyxauto");
+ FileName const tmp_ret(tempName(string(), "lyxauto"));
if (!tmp_ret.empty()) {
- bv_.buffer()->writeFile(tmp_ret);
+ bv_.buffer()->writeFile(tmp_ret.absFilename());
// assume successful write of tmp_ret
if (!rename(tmp_ret, fname_)) {
failed = true;
if (failed) {
// failed to write/rename tmp_ret so try writing direct
- if (!bv_.buffer()->writeFile(fname_)) {
+ if (!bv_.buffer()->writeFile(fname_.absFilename())) {
// It is dangerous to do this in the child,
// but safe in the parent, so...
if (pid == -1)
fname += onlyFilename(bv->buffer()->fileName());
fname += '#';
- AutoSaveBuffer autosave(*bv, fname);
+ AutoSaveBuffer autosave(*bv, FileName(fname));
autosave.start();
bv->buffer()->markBakClean();
// This function runs "configure" and then rereads lyx.defaults to
// reconfigure the automatic settings.
-void reconfigure(BufferView * bv)
+void reconfigure(LyXView & lv)
{
// emit message signal.
- bv->buffer()->message(_("Running configure..."));
+ lv.message(_("Running configure..."));
// Run configure in user lyx directory
support::Path p(package().user_support());
one.startscript(Systemcall::Wait, configure_command);
p.pop();
// emit message signal.
- bv->buffer()->message(_("Reloading configuration..."));
+ lv.message(_("Reloading configuration..."));
lyxrc.read(libFileSearch(string(), "lyxrc.defaults"));
// Re-read packages.lst
LaTeXFeatures::getAvailable();