TizenRefApp-8778 Implement app control for launching messages settings. 37/136437/2
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Thu, 29 Jun 2017 11:29:58 +0000 (14:29 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Thu, 29 Jun 2017 11:45:32 +0000 (14:45 +0300)
Change-Id: Ic1b97f76cba1b80d640b7b3cd793ee9e8aae2ad2
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
src/Common/AppControl/inc/AppControlCommand.h
src/Common/AppControl/inc/AppControlSettings.h [new file with mode: 0644]
src/Common/AppControl/src/AppControlParser.cpp
src/Common/Controller/inc/NaviFrameController.h
src/Common/Controller/src/App.cpp
src/Common/Controller/src/NaviFrameController.cpp
tizen-manifest.xml

index 6948161f553af6237a1a62cedbc76a0be9e3488c..ccd706ea9d4219cf6c11f22f3132d8a138157d3b 100644 (file)
@@ -31,7 +31,8 @@ namespace Msg {
             {
                 OpUnknown,
                 OpDefault,
-                OpComposeFamily /** For operations Compose, Share, MultiShare and ShareText */
+                OpComposeFamily, /** For operations Compose, Share, MultiShare and ShareText */
+                OpSettings
             };
 
         public:
diff --git a/src/Common/AppControl/inc/AppControlSettings.h b/src/Common/AppControl/inc/AppControlSettings.h
new file mode 100644 (file)
index 0000000..0ba91e2
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2016  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AppControlSettings_h_
+#define AppControlSettings_h_
+
+#include "AppControlCommand.h"
+
+namespace Msg {
+    class AppControlSettings;
+    typedef std::shared_ptr<AppControlSettings> AppControlSettingsRef;
+
+    class AppControlSettings
+        : public AppControlCommand {
+        public:
+            AppControlSettings(const std::string &opMsg, app_control_h handle);
+            virtual ~AppControlSettings();
+
+            static constexpr const char* getOpName();
+    };
+
+    inline AppControlSettings::AppControlSettings(const std::string &opMsg, app_control_h handle)
+        : AppControlCommand(opMsg, OpSettings)
+    {
+    }
+
+    inline AppControlSettings::~AppControlSettings()
+    {
+    }
+
+    inline constexpr const char* AppControlSettings::getOpName()
+    {
+        return "http://tizen.org/appcontrol/operation/setting/messages";
+    }
+}
+
+#endif /* AppControlSettings_h_ */
index 0c4604b8d20b78620adaed5ccfb5f3eb592e9147..c8508d2b5615ac52553d465cab943a3705cb9e0a 100644 (file)
@@ -19,6 +19,7 @@
 #include "AppControlCommand.h"
 #include "AppControlDefault.h"
 #include "AppControlCompose.h"
+#include "AppControlSettings.h"
 
 #include <app_control.h>
 #include <string>
@@ -38,7 +39,8 @@ namespace
         {APP_CONTROL_OPERATION_COMPOSE, AppControlCommand::OpComposeFamily},
         {APP_CONTROL_OPERATION_SHARE, AppControlCommand::OpComposeFamily},
         {APP_CONTROL_OPERATION_MULTI_SHARE, AppControlCommand::OpComposeFamily},
-        {APP_CONTROL_OPERATION_SHARE_TEXT, AppControlCommand::OpComposeFamily}
+        {APP_CONTROL_OPERATION_SHARE_TEXT, AppControlCommand::OpComposeFamily},
+        {AppControlSettings::getOpName(), AppControlCommand::OpSettings}
     };
 
     AppControlCommand::OperationType getOperation(const char *op)
@@ -68,10 +70,12 @@ AppControlCommandRef AppControlParser::parse(app_control_h handle)
         case AppControlCommand::OpDefault:
             cmd = std::make_shared<AppControlDefault>(opStr, handle);
             break;
-
         case AppControlCommand::OpComposeFamily:
             cmd = std::make_shared<AppControlCompose>(opStr, handle);
             break;
+        case AppControlCommand::OpSettings:
+            cmd = std::make_shared<AppControlSettings>(opStr, handle);
+            break;
         default:
         case AppControlCommand::OpUnknown:
             cmd = std::make_shared<AppControlCommand>(opStr, opType);
index 25255938863e22f6bc60432d785ff1d5b103ef66..4978c32ec2fd897c58c44fa5a9185a0d5884650c 100644 (file)
@@ -21,6 +21,7 @@
 #include "AppControlCommand.h"
 #include "AppControlCompose.h"
 #include "AppControlDefault.h"
+#include "AppControlSettings.h"
 #include "App.h"
 
 namespace Msg {
@@ -50,6 +51,11 @@ namespace Msg {
              */
             void execCmd(const AppControlDefaultRef &cmd);
 
+            /**
+             * @brief Executes app control command of Settings type.
+             */
+            void execCmd(const AppControlSettingsRef &cmd);
+
             /**
              * @brief Executes app control command of compose type. This is Compose, Share, MultiShare, ShareText.
              */
index 4f1451c308f428037641b1cf320c8e7705ef185a..10be534175bdacd1ade97f39e2d0e7abbb24c303 100644 (file)
@@ -26,6 +26,7 @@
 #include "AppControlParser.h"
 #include "AppControlDefault.h"
 #include "AppControlCompose.h"
+#include "AppControlSettings.h"
 #include "PathUtils.h"
 #include "Config.h"
 #include "SystemSettingsManager.h"
@@ -324,6 +325,10 @@ void App::onAppControl(app_control_h appControl)
             if (m_pNaviFrame)
                 m_pNaviFrame->execCmd(std::static_pointer_cast<AppControlCompose>(cmd));
             break;
+        case AppControlCommand::OpSettings:
+            if (m_pNaviFrame)
+                m_pNaviFrame->execCmd(std::static_pointer_cast<AppControlSettings>(cmd));
+            break;
         case AppControlCommand::OpUnknown:
         default:
             MSG_LOG_WARN("Not supported command");
index b3f163d5bfae0a5c74e40ec7e2bad8610cebe2f6..f9448a57362c6924fe739f7d89363cfbcdaab471 100644 (file)
@@ -131,6 +131,20 @@ void NaviFrameController::execCmd(const AppControlComposeRef &cmd)
     }
 }
 
+void NaviFrameController::execCmd(const AppControlSettingsRef &cmd)
+{
+    if (prepare(*cmd)) {
+        AppControlLauncher::getInst().terminate();
+        auto *frame = findTopFrame<SettingsFrame>();
+        if (frame) {
+            promote(*frame);
+        } else {
+            auto *frame = new SettingsFrame(*this);
+            push(*frame);
+        }
+    }
+}
+
 template<typename T>
 T *NaviFrameController::findTopFrame() const
 {
index f18118a6d106722a30badf66c31ac0a10101b5f7..1deadffc367be274a56babb07891018f32ef2db0 100644 (file)
@@ -98,6 +98,9 @@
             <operation name="http://tizen.org/appcontrol/operation/share_text"/>
             <uri name="mmsto"/>
         </app-control>
+        <app-control>
+            <operation name="http://tizen.org/appcontrol/operation/setting/messages"/>
+        </app-control>
     </ui-application>
     <privileges>
         <privilege>http://tizen.org/privilege/datasharing</privilege>