include_config_file(WrtAccess)
-message(__________________________________${TARGET_POPUP_ACE_RUNNER_LIB})
-
pkg_search_module(plugin-types REQUIRED wrt-plugins-types)
pkg_search_module(ace-client REQUIRED security-client)
pkg_search_module(dpl-event REQUIRED dpl-event-efl)
namespace Wrt {
enum PopupType {
- ACE_PROMPT = 1,
+ INFO_PROMPT = 1,
YES_NO_PROMPT
};
}
${WRT_POPUP_COMMON_SRCS}
wrt-popup.cpp
YesNoPopup.cpp
+ InfoPopup.cpp
)
ADD_EXECUTABLE(${TARGET_POPUP_WRT}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+/**
+ * @file InfoPopup.cpp
+ * @author Lukasz Marek(l.marek@samsung.com)
+ * @version 1.0
+ * @brief Popup that displays information. Inplementation
+ */
+
+#include "InfoPopup.h"
+#include <memory>
+#include <string.h>
+#include <dpl/popup/popup_manager.h>
+#include <dpl/popup/popup.h>
+#include "PopupSerializer.h"
+
+namespace Wrt {
+namespace Popup {
+
+using namespace DPL::Popup;
+
+void InfoPopup::show(DPL::BinaryQueueAutoPtr data, WrtPopup* parent)
+{
+ LogDebug("Entered");
+ std::string title = PopupSerializer::getStringArg(*data);
+ std::string message = PopupSerializer::getStringArg(*data);
+ std::string button = PopupSerializer::getStringArg(*data);
+ Assert(data->Empty());
+ LogDebug("title: " << title << " message: " << message);
+
+ m_parent = parent;
+
+ CtrlPopupPtr popup = PopupControllerSingleton::Instance().CreatePopup();
+
+ popup->SetTitle(title);
+ popup->Append(new PopupObject::Label(message));
+
+ popup->Append(new PopupObject::Button(button, 0));
+
+ ListenForAnswer(popup);
+
+ ShowPopupEventShort event(popup,
+ MakeAnswerCallback(
+ this,
+ &InfoPopup::responseCallback));
+
+ CONTROLLER_POST_EVENT(PopupController,
+ event);
+
+ LogDebug("Exited");
+ return;
+}
+
+void InfoPopup::responseCallback(const DPL::Popup::AnswerCallbackData &answer)
+{
+ DPL::BinaryQueue retValue;
+ PopupSerializer::appendArg(answer.buttonAnswer, retValue);
+ m_parent->response(retValue);
+}
+
+} // Popup
+} // Wrt
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+/**
+ * @file InfoPopup.h
+ * @author Andrzej Surdej (a.surdej@samsung.com)
+ * @version 1.0
+ * @brief Popup that contains 'Yes' and 'No' buttons
+ */
+
+#ifndef WRT_INFO_POPUP_H
+#define WRT_INFO_POPUP_H
+
+#include "wrt-popup.h"
+
+namespace Wrt {
+namespace Popup {
+
+class InfoPopup : public IPopup
+{
+public:
+ virtual void show(DPL::BinaryQueueAutoPtr data, WrtPopup* parent);
+
+private:
+
+ void responseCallback(const DPL::Popup::AnswerCallbackData &answer);
+ WrtPopup* m_parent;
+};
+
+} // Popup
+} // Wrt
+
+#endif /* WRT_INFO_POPUP_H */
+
#define WRT_YES_NO_POPUP_H
#include "wrt-popup.h"
-#include <dpl/popup/popup.h>
namespace Wrt {
namespace Popup {
#include "PopupEnum.h"
#include "PopupSerializer.h"
#include "YesNoPopup.h"
+#include "InfoPopup.h"
namespace Wrt {
namespace Popup {
m_popup.reset(new YesNoPopup());
m_popup->show(data, this);
break;
+ case INFO_PROMPT:
+ m_popup.reset(new InfoPopup());
+ m_popup->show(data, this);
+ break;
default:
Assert(false);
}
{
public:
virtual void show(DPL::BinaryQueueAutoPtr data, WrtPopup* parent) = 0;
+ virtual ~IPopup() {}
};
typedef std::unique_ptr<IPopup> IPopupPtr;
return false;
}
+void PopupInvoker::showInfo(const std::string& title,
+ const std::string& message,
+ const std::string& buttonLabel)
+{
+ Try
+ {
+ DPL::BinaryQueue data;
+ PopupSerializer::appendArg(INFO_PROMPT, data);
+ PopupSerializer::appendArg(title, data);
+ PopupSerializer::appendArg(message, data);
+ PopupSerializer::appendArg(buttonLabel, data);
+ DPL::NamedInputPipe tmp;
+ tmp.Open(m_outputName);
+ m_output.Open(m_outputName);
+ m_input.Open(m_inputName);
+ m_output.Write(data, data.Size());
+
+ executePopup();
+
+ //ignore result
+
+ tmp.Close();
+ m_input.Close();
+ m_output.Close();
+ }
+ Catch(DPL::Exception)
+ {
+ LogError("error occured");
+ }
+}
+
void PopupInvoker::executePopup()
{
pid_t pid = fork();
~PopupInvoker();
bool askYesNo(const std::string &title, const std::string &message);
+ void showInfo(const std::string &title,
+ const std::string &message,
+ const std::string &buttonLabel = std::string("OK"));
private: