From d3a2d90f9da621eea830633f25ed18d8bda1b258 Mon Sep 17 00:00:00 2001 From: cxl Date: Wed, 2 Jan 2013 22:00:20 +0000 Subject: [PATCH] examples: UWord now checks for correct file types in drop git-svn-id: svn://ultimatepp.org/upp/trunk@5697 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- examples/UWord/UWord.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/examples/UWord/UWord.cpp b/examples/UWord/UWord.cpp index 1c0fc630f..88214b492 100644 --- a/examples/UWord/UWord.cpp +++ b/examples/UWord/UWord.cpp @@ -139,11 +139,24 @@ void UWord::Open() void UWord::DragAndDrop(Point, PasteClip& d) { - if(AcceptFiles(d)) { + if(IsAvailableFiles(d)) { Vector fn = GetFiles(d); - for(int i = 0; i < fn.GetCount(); i++) - if(FileExists(fn[i])) - OpenFile(fn[i]); + for(int open = 0; open < 2; open++) { + for(int i = 0; i < fn.GetCount(); i++) { + String ext = GetFileExt(fn[i]); + if(FileExists(fn[i]) && (ext == ".rtf" || ext == ".qtf")) { + if(open) + OpenFile(fn[i]); + else { + if(d.Accept()) + break; + return; + } + } + } + if(!d.IsAccepted()) + return; + } } }