diff options
author | howon kim <howon.kim@samsung.com> | 2013-12-03 10:09:38 +0900 |
---|---|---|
committer | howon kim <howon.kim@samsung.com> | 2013-12-03 10:09:38 +0900 |
commit | 9b7d3dc6da71ec0baffb724ed0a2532c3b8ac30f (patch) | |
tree | 0b469800f43b4ae05a88d9ed33732849de92ac0c | |
parent | 02aed75cb134257ebf266fd60ed3739b9552f8c5 (diff) | |
download | QrCodeGenerator-9b7d3dc6da71ec0baffb724ed0a2532c3b8ac30f.tar.gz QrCodeGenerator-9b7d3dc6da71ec0baffb724ed0a2532c3b8ac30f.tar.bz2 QrCodeGenerator-9b7d3dc6da71ec0baffb724ed0a2532c3b8ac30f.zip |
Fix Space character
-rw-r--r-- | project/inc/FileManagerForm.h | 1 | ||||
-rw-r--r-- | project/src/FileManagerForm.cpp | 45 |
2 files changed, 45 insertions, 1 deletions
diff --git a/project/inc/FileManagerForm.h b/project/inc/FileManagerForm.h index 0a24ecc..84ebed3 100644 --- a/project/inc/FileManagerForm.h +++ b/project/inc/FileManagerForm.h @@ -68,6 +68,7 @@ private: const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + bool TestAlphaNumeric(Tizen::Base::String& str); private: static const int ID_FORMAT_STRING = 500; diff --git a/project/src/FileManagerForm.cpp b/project/src/FileManagerForm.cpp index 9bee61f..3e1485e 100644 --- a/project/src/FileManagerForm.cpp +++ b/project/src/FileManagerForm.cpp @@ -119,7 +119,30 @@ FileManagerForm::OnActionPerformed (const Tizen::Ui::Control &source, int action { fileName.Append(__extension); } - __currentImagePath = __currentPath + "/" + fileName; + + if(!(TestAlphaNumeric(fileName))) + { + MessageBox msgBox; + int modalResult; + + msgBox.Construct(L"Error", L"Please enter valid file name.\nOnly alphanumeric characters.", MSGBOX_STYLE_OK); + msgBox.ShowAndWait(modalResult); + return; + } + + if(*(fileName.GetPointer()) == '.') + { + MessageBox msgBox; + int modalResult; + + msgBox.Construct(L"Error", L"Please enter valid file name.\nOnly alphanumeric characters.", MSGBOX_STYLE_OK); + msgBox.ShowAndWait(modalResult); + return; + } + + fileName.Trim(); + + __currentImagePath = __currentPath + "/" + fileName; if (IsFile(__currentImagePath)) { @@ -420,6 +443,26 @@ FileManagerForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSce { } +bool +FileManagerForm::TestAlphaNumeric(Tizen::Base::String& str) +{ + Tizen::Base::String supportedSymbols = L"QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890."; + Tizen::Base::String tempStr = str; + + int legnth = supportedSymbols.GetLength(); + wchar_t ch; + + for(int i = 0; i < legnth; ++i) + { + supportedSymbols.GetCharAt(i,ch); + tempStr.Replace(ch," "); + } + tempStr.Trim(); + + return tempStr.IsEmpty(); + +} + void FileManagerForm::OnAppForeGround(void) { |