From f390a594a314abee491ba473b4f25a4ee221cd2a Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Thu, 10 May 2012 17:47:52 +0200 Subject: [PATCH] Not open a file previously opened --- jni/appl/Buffer/BufferManager.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/jni/appl/Buffer/BufferManager.cpp b/jni/appl/Buffer/BufferManager.cpp index 3c91970..d82b42f 100644 --- a/jni/appl/Buffer/BufferManager.cpp +++ b/jni/appl/Buffer/BufferManager.cpp @@ -200,6 +200,9 @@ void classBufferManager::OnReceiveMessage(ewol::EObject * CallerObject, const ch m_idSelected = newOne; SendMultiCast(ednMsgBufferId, m_idSelected); SendMultiCast(ednMsgBufferListChange); + } else { + // TODO : notify user that we can not open the request file... + APPL_ERROR("Can not open the file : \"" << myFile << "\""); } } } else if (eventId == ednMsgGuiSave) { @@ -370,12 +373,16 @@ int32_t classBufferManager::Create(void) */ int32_t classBufferManager::Open(etk::File &myFile) { - // TODO : Check here if the file is already open ==> and display it if needed - // allocate a new Buffer - Buffer *myBuffer = new BufferText(myFile); - // Add at the list of element - listBuffer.PushBack(myBuffer); - return listBuffer.Size() - 1; + if (false == Exist(myFile)) { + // allocate a new Buffer + Buffer *myBuffer = new BufferText(myFile); + // Add at the list of element + listBuffer.PushBack(myBuffer); + return listBuffer.Size() - 1; + } else { + // the buffer already existed ==> we open it ... + return GetId(myFile); + } }