]> git.lyx.org Git - lyx.git/commitdiff
Fix bug 3255
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Wed, 21 Feb 2007 21:47:44 +0000 (21:47 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Wed, 21 Feb 2007 21:47:44 +0000 (21:47 +0000)
* src/frontends/Clipboard.h
(empty): Clarify documentation

* src/frontends/qt4/GuiClipboard.C
(GuiClipboard::empty): Consider also the LyX version, since the text
version is empty if there is only one inset in the clipboard.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17297 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/Clipboard.h
src/frontends/qt4/GuiClipboard.C

index 42ecd6c1a5510770ce6708505f32351027d4e920..67ce307e5226526ae239ff8e3b1ad963e3c5ce88 100644 (file)
@@ -56,6 +56,8 @@ public:
        /// (document contents, dialogs count as external here).
        virtual bool isInternal() const = 0;
        /// Is the clipboard empty?
        /// (document contents, dialogs count as external here).
        virtual bool isInternal() const = 0;
        /// Is the clipboard empty?
+       /// \returns true if both the LyX and the plaintext versions of the
+       /// clipboard are empty.
        virtual bool empty() const = 0;
 };
 
        virtual bool empty() const = 0;
 };
 
index 03388b3c094ca3a748a84831b38b7cbd172203bb..517676e800eb908587cd62d4eb1bb3298aacf27b 100644 (file)
@@ -116,7 +116,13 @@ bool GuiClipboard::isInternal() const
 
 bool GuiClipboard::empty() const
 {
 
 bool GuiClipboard::empty() const
 {
-       return qApp->clipboard()->text(QClipboard::Clipboard).isEmpty();
+       // We need to check both the plaintext and the LyX version of the
+       // clipboard. The plaintext version is empty if the LyX version
+       // contains only one inset, and the LyX version is empry if the
+       // clipboard does not come from LyX.
+       if (!qApp->clipboard()->text(QClipboard::Clipboard).isEmpty())
+               return false;
+       return !hasLyXContents();
 }
 
 } // namespace frontend
 }
 
 } // namespace frontend