Fix LyX paste from system clipboard when the file format does not match

* src/buffer.C
	(Buffer::readString): Tell readFile that we do not have a file
	(Buffer::readString): readFile(name) returns a bool, not an enum


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16931 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2007-01-29 18:35:56 +00:00
parent cc04805782
commit a76050219a
5 changed files with 36 additions and 14 deletions

View File

@ -136,8 +136,13 @@ AC_DEFUN([QT4_DO_IT_ALL],
dnl Check if it possible to do a pkg-config
QT4_DO_PKG_CONFIG
if test "$pkg_failed" != "no" ; then
if test -n "$qt4_cv_dir" -o -n "$qt4_cv_includes" -o -n "$qt4_cv_libraries"; then
dnl The user gave commandline arguments, override pkg-config
QT4_DO_MANUAL_CONFIG
else
if test "$pkg_failed" != "no" ; then
QT4_DO_MANUAL_CONFIG
fi
fi
AC_PATH_PROGS(MOC4, [moc-qt4 moc],[],$qt4_cv_bin:$PATH)
AC_PATH_PROGS(UIC4, [uic-qt4 uic],[],$qt4_cv_bin:$PATH)
@ -200,7 +205,9 @@ AC_DEFUN([QT4_DO_MANUAL_CONFIG],
QT4_CHECK_COMPILE
QT4_LIB=$qt4_cv_libname;
if test -n "$qt4_cv_libname"; then
QT4_LIB=$qt4_cv_libname;
fi
AC_SUBST(QT4_LIB)
AC_SUBST(QT4_CORE_LIB)

View File

@ -416,6 +416,7 @@ $$
\definecolor{}{}{,,}
\DescribeMacro{}
\discretionary{}{}{}
\email[]{}
\encl{}
\enclname
\enlargethispage{}
@ -447,6 +448,7 @@ $$
\glossaryentry{}{} %only in .glo file (JMarc)
% \graphpaper[](,)(,) %picture
\headtoname
\homepage[]{}
\href{}{translate} % from the hyperref package
\hspace{}
\hspace*{}

View File

@ -576,7 +576,7 @@ bool Buffer::readString(std::string const & s)
std::istringstream is(s);
lex.setStream(is);
FileName const name(tempName());
switch (readFile(lex, name)) {
switch (readFile(lex, name, true)) {
case failure:
return false;
case wrongversion: {
@ -584,7 +584,7 @@ bool Buffer::readString(std::string const & s)
std::ofstream os(name.toFilesystemEncoding().c_str());
os << s;
os.close();
return readFile(name) == success;
return readFile(name);
}
case success:
break;

View File

@ -229,6 +229,13 @@ int QLPainter::text(int x, int y, char_type const * s, size_t ls,
int textwidth;
if (f.family() == LyXFont::ESINT_FAMILY) {
if (ls != 1)
lyxerr << "draw should not happen\n";
else
lyxerr << "draw " << s[0] << " at " << x << "," << y << " color: " << f.realColor() << std::endl;
}
if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
setQPainterPen(f.realColor());
if (font() != fi.font)

View File

@ -256,20 +256,26 @@ FileName const fileSearch(string const & path, string const & name,
// if `name' is an absolute path, we ignore the setting of `path'
// Expand Environmentvariables in 'name'
string const tmpname = replaceEnvironmentPath(name);
lyxerr << "path: '" << path << "' name: '" << name << "' ext: '" << ext << "' tmpname: '" << tmpname << "'" << std::endl;
FileName fullname(makeAbsPath(tmpname, path));
lyxerr << "fullname: '" << fullname << "'";
// search first without extension, then with it.
if (isFileReadable(fullname))
if (isFileReadable(fullname)) {
lyxerr << " return fullname " << std::endl;
return fullname;
if (ext.empty())
}
if (ext.empty()) {
// We are done.
return mode == allow_unreadable ? fullname : FileName();
// Only add the extension if it is not already the extension of
// fullname.
if (getExtension(fullname.absFilename()) != ext)
fullname = FileName(addExtension(fullname.absFilename(), ext));
if (isFileReadable(fullname) || mode == allow_unreadable)
return fullname;
return FileName();
lyxerr << " return FileName " << std::endl;
return FileName();
}
fullname = FileName(changeExtension(fullname.absFilename(), ext));
lyxerr << " fullname: '" << fullname << "'";
if (isFileReadable(fullname))
lyxerr << " return fullname " << std::endl;
else
lyxerr << " return FileName " << std::endl;
return isFileReadable(fullname) ? fullname : FileName();
}