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 dnl Check if it possible to do a pkg-config
QT4_DO_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 QT4_DO_MANUAL_CONFIG
else
if test "$pkg_failed" != "no" ; then
QT4_DO_MANUAL_CONFIG
fi
fi fi
AC_PATH_PROGS(MOC4, [moc-qt4 moc],[],$qt4_cv_bin:$PATH) AC_PATH_PROGS(MOC4, [moc-qt4 moc],[],$qt4_cv_bin:$PATH)
AC_PATH_PROGS(UIC4, [uic-qt4 uic],[],$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_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_LIB)
AC_SUBST(QT4_CORE_LIB) AC_SUBST(QT4_CORE_LIB)

View File

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

View File

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

View File

@ -229,6 +229,13 @@ int QLPainter::text(int x, int y, char_type const * s, size_t ls,
int textwidth; 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) { if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
setQPainterPen(f.realColor()); setQPainterPen(f.realColor());
if (font() != fi.font) 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' // if `name' is an absolute path, we ignore the setting of `path'
// Expand Environmentvariables in 'name' // Expand Environmentvariables in 'name'
string const tmpname = replaceEnvironmentPath(name); string const tmpname = replaceEnvironmentPath(name);
lyxerr << "path: '" << path << "' name: '" << name << "' ext: '" << ext << "' tmpname: '" << tmpname << "'" << std::endl;
FileName fullname(makeAbsPath(tmpname, path)); FileName fullname(makeAbsPath(tmpname, path));
lyxerr << "fullname: '" << fullname << "'";
// search first without extension, then with it. // search first without extension, then with it.
if (isFileReadable(fullname)) if (isFileReadable(fullname)) {
lyxerr << " return fullname " << std::endl;
return fullname; return fullname;
if (ext.empty()) }
if (ext.empty()) {
// We are done. // We are done.
return mode == allow_unreadable ? fullname : FileName(); lyxerr << " return FileName " << std::endl;
// Only add the extension if it is not already the extension of return FileName();
// fullname. }
if (getExtension(fullname.absFilename()) != ext) fullname = FileName(changeExtension(fullname.absFilename(), ext));
fullname = FileName(addExtension(fullname.absFilename(), ext)); lyxerr << " fullname: '" << fullname << "'";
if (isFileReadable(fullname) || mode == allow_unreadable) if (isFileReadable(fullname))
return fullname; lyxerr << " return fullname " << std::endl;
return FileName(); else
lyxerr << " return FileName " << std::endl;
return isFileReadable(fullname) ? fullname : FileName();
} }