From c62f5c257ef2874f7abccd727c3915ee456dec59 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 16 Mar 2016 11:42:06 -0300 Subject: calls 'calendar://eventId=' when clicking on an event in the indicator. --- src/actions-live.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/actions-live.cpp') diff --git a/src/actions-live.cpp b/src/actions-live.cpp index 271d2f3..6ac1878 100644 --- a/src/actions-live.cpp +++ b/src/actions-live.cpp @@ -25,6 +25,8 @@ #include +#include + namespace ayatana { namespace indicator { namespace datetime { @@ -159,15 +161,27 @@ void LiveActions::phone_open_appointment(const Appointment& appt) phone_open_alarm_app(); break; + case Appointment::EVENT: + if (!appt.source_uid.empty() && !appt.uid.empty()) + { + std::stringstream cmd; + // event-id format: / + cmd << "calendar://eventid=" + << appt.source_uid + << "/" + << appt.uid; + dispatch_url(cmd.str()); + break; + } default: phone_open_calendar_app(appt.begin); } } -void LiveActions::phone_open_calendar_app(const DateTime&) +void LiveActions::phone_open_calendar_app(const DateTime& dt) { - // does calendar app have a mechanism for specifying dates? - dispatch_url("appid://com.ubuntu.calendar/calendar/current-user-version"); + auto cmd = dt.format("calendar:///?startdate=%Y%m%dT%H%M%SZ"); + dispatch_url(cmd); } void LiveActions::phone_open_settings_app() -- cgit v1.2.3 From bbf8fdba0f3a8d57dcea96d2cfbc55e833c39adb Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Fri, 18 Mar 2016 22:20:03 -0300 Subject: Lauch calendar app using the event start time. --- src/actions-live.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/actions-live.cpp') diff --git a/src/actions-live.cpp b/src/actions-live.cpp index 6ac1878..4fe2f39 100644 --- a/src/actions-live.cpp +++ b/src/actions-live.cpp @@ -162,25 +162,16 @@ void LiveActions::phone_open_appointment(const Appointment& appt) break; case Appointment::EVENT: - if (!appt.source_uid.empty() && !appt.uid.empty()) - { - std::stringstream cmd; - // event-id format: / - cmd << "calendar://eventid=" - << appt.source_uid - << "/" - << appt.uid; - dispatch_url(cmd.str()); - break; - } default: phone_open_calendar_app(appt.begin); + break; } } void LiveActions::phone_open_calendar_app(const DateTime& dt) { - auto cmd = dt.format("calendar:///?startdate=%Y%m%dT%H%M%SZ"); + const auto utc = dt.to_timezone("UTC"); + auto cmd = utc.format("calendar://startdate=%Y-%m-%dT%H:%M:%S+00:00"); dispatch_url(cmd); } -- cgit v1.2.3 From 7fde2181c74fada11d537e2f09ccbb8e5745ae8c Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Mon, 21 Mar 2016 14:32:39 -0300 Subject: Make sure that the ocurrence time is used to build the url to launch external application. --- src/actions-live.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/actions-live.cpp') diff --git a/src/actions-live.cpp b/src/actions-live.cpp index 4fe2f39..231fb33 100644 --- a/src/actions-live.cpp +++ b/src/actions-live.cpp @@ -127,9 +127,9 @@ void LiveActions::desktop_open_alarm_app() execute_command("evolution -c calendar"); } -void LiveActions::desktop_open_appointment(const Appointment& appt) +void LiveActions::desktop_open_appointment(const Appointment&, const DateTime& date) { - desktop_open_calendar_app(appt.begin); + desktop_open_calendar_app(date); } void LiveActions::desktop_open_calendar_app(const DateTime& dt) @@ -148,7 +148,7 @@ void LiveActions::phone_open_alarm_app() dispatch_url("appid://com.ubuntu.clock/clock/current-user-version"); } -void LiveActions::phone_open_appointment(const Appointment& appt) +void LiveActions::phone_open_appointment(const Appointment& appt, const DateTime& date) { if (!appt.activation_url.empty()) @@ -163,7 +163,7 @@ void LiveActions::phone_open_appointment(const Appointment& appt) case Appointment::EVENT: default: - phone_open_calendar_app(appt.begin); + phone_open_calendar_app(date); break; } } -- cgit v1.2.3 From 8b3ba566108578f5e49ed50129f341bab2429dab Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 9 Apr 2016 19:03:57 -0500 Subject: in actions-live, don't hardcode the bus strings --- src/actions-live.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/actions-live.cpp') diff --git a/src/actions-live.cpp b/src/actions-live.cpp index 231fb33..e3237b7 100644 --- a/src/actions-live.cpp +++ b/src/actions-live.cpp @@ -17,6 +17,7 @@ * Charles Kerr */ +#include #include #ifdef HAS_URLDISPATCHER @@ -240,7 +241,7 @@ on_datetime1_proxy_ready (GObject * object G_GNUC_UNUSED, else { g_dbus_proxy_call(proxy, - "SetTimezone", + Bus::Timedate1::Methods::SET_TIMEZONE, g_variant_new ("(sb)", data->tzid.c_str(), TRUE), G_DBUS_CALL_FLAGS_NONE, -1, @@ -268,9 +269,9 @@ void LiveActions::set_location(const std::string& tzid, const std::string& name) g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, nullptr, - "org.freedesktop.timedate1", - "/org/freedesktop/timedate1", - "org.freedesktop.timedate1", + Bus::Timedate1::BUSNAME, + Bus::Timedate1::ADDR, + Bus::Timedate1::IFACE, nullptr, on_datetime1_proxy_ready, data); -- cgit v1.2.3 From a6422822a9b9a18bae705e56f2b53ee0b61ff1dc Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 28 Apr 2016 11:56:11 -0300 Subject: Detect desktop to launch applications. --- src/actions-live.cpp | 126 ++++++++++++++++++--------------------------------- 1 file changed, 45 insertions(+), 81 deletions(-) (limited to 'src/actions-live.cpp') diff --git a/src/actions-live.cpp b/src/actions-live.cpp index e3237b7..11643cd 100644 --- a/src/actions-live.cpp +++ b/src/actions-live.cpp @@ -20,14 +20,15 @@ #include #include -#ifdef HAS_URLDISPATCHER -#include -#endif - #include #include +extern "C" +{ + #include +} + namespace ayatana { namespace indicator { namespace datetime { @@ -41,53 +42,55 @@ LiveActions::LiveActions(const std::shared_ptr& state_in): { } -void LiveActions::execute_command(const std::string& cmdstr) -{ - const auto cmd = cmdstr.c_str(); - g_debug("Issuing command '%s'", cmd); +/*** +**** +***/ - GError* error = nullptr; - if (!g_spawn_command_line_async(cmd, &error)) +void LiveActions::open_alarm_app() +{ + if (ayatana_common_utils_is_lomiri()) { - g_warning("Unable to start \"%s\": %s", cmd, error->message); - g_error_free(error); + ayatana_common_utils_open_url("appid://com.lomiri.clock/clock/current-user-version"); + } + else + { + ayatana_common_utils_execute_command("evolution -c calendar"); } } -void LiveActions::dispatch_url(const std::string& url) +void LiveActions::open_calendar_app(const DateTime& dt) { - g_debug("Dispatching url '%s'", url.c_str()); -#ifdef HAS_URLDISPATCHER - lomiri_url_dispatch_send(url.c_str(), nullptr, nullptr); -#else - // FIXME: Deal with this, if we build without liburl-dispatcher... -#endif + if (ayatana_common_utils_is_lomiri()) + { + const auto utc = dt.to_timezone("UTC"); + auto cmd = utc.format("calendar://startdate=%Y-%m-%dT%H:%M:%S+00:00"); + ayatana_common_utils_open_url(cmd.c_str()); + } + else + { + const auto utc = dt.start_of_day().to_timezone("UTC"); + auto cmd = utc.format("evolution \"calendar:///?startdate=%Y%m%dT%H%M%SZ\""); + ayatana_common_utils_execute_command(cmd.c_str()); + } } -/*** -**** -***/ - -void LiveActions::desktop_open_settings_app() +void LiveActions::open_settings_app() { - if (g_getenv ("MIR_SOCKET") != nullptr) + if (ayatana_common_utils_is_lomiri()) + { + ayatana_common_utils_open_url("settings:///system/time-date"); + } + else if (ayatana_common_utils_is_unity()) { - dispatch_url("settings:///system/time-date"); + ayatana_common_utils_execute_command("unity-control-center datetime"); + } + else if (ayatana_common_utils_is_mate()) + { + ayatana_common_utils_execute_command("mate-time-admin"); } else { - if ((g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0)) - { - execute_command("unity-control-center datetime"); - } - else if ((g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "MATE") == 0)) - { - execute_command("mate-time-admin"); - } - else - { - execute_command("gnome-control-center datetime"); - } + ayatana_common_utils_execute_command("gnome-control-center datetime"); } } @@ -123,64 +126,25 @@ bool LiveActions::desktop_has_calendar_app() const return have_calendar; } -void LiveActions::desktop_open_alarm_app() -{ - execute_command("evolution -c calendar"); -} - -void LiveActions::desktop_open_appointment(const Appointment&, const DateTime& date) -{ - desktop_open_calendar_app(date); -} - -void LiveActions::desktop_open_calendar_app(const DateTime& dt) -{ - const auto utc = dt.start_of_day().to_timezone("UTC"); - auto cmd = utc.format("evolution \"calendar:///?startdate=%Y%m%dT%H%M%SZ\""); - execute_command(cmd.c_str()); -} - -/*** -**** -***/ - -void LiveActions::phone_open_alarm_app() -{ - dispatch_url("appid://com.ubuntu.clock/clock/current-user-version"); -} - -void LiveActions::phone_open_appointment(const Appointment& appt, const DateTime& date) +void LiveActions::open_appointment(const Appointment& appt, const DateTime& date) { - if (!appt.activation_url.empty()) { - dispatch_url(appt.activation_url); + ayatana_common_utils_open_url(appt.activation_url.c_str()); } else switch (appt.type) { case Appointment::UBUNTU_ALARM: - phone_open_alarm_app(); + open_alarm_app(); break; case Appointment::EVENT: default: - phone_open_calendar_app(date); + open_calendar_app(date); break; } } -void LiveActions::phone_open_calendar_app(const DateTime& dt) -{ - const auto utc = dt.to_timezone("UTC"); - auto cmd = utc.format("calendar://startdate=%Y-%m-%dT%H:%M:%S+00:00"); - dispatch_url(cmd); -} - -void LiveActions::phone_open_settings_app() -{ - dispatch_url("settings:///system/time-date"); -} - /*** **** ***/ -- cgit v1.2.3 From 5b5755d1c4f3fc9823e98be43c18201740393679 Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Wed, 1 Feb 2017 16:55:16 -0500 Subject: Update app name usage to match snaps. --- src/actions-live.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/actions-live.cpp') diff --git a/src/actions-live.cpp b/src/actions-live.cpp index 11643cd..8fa894d 100644 --- a/src/actions-live.cpp +++ b/src/actions-live.cpp @@ -50,7 +50,7 @@ void LiveActions::open_alarm_app() { if (ayatana_common_utils_is_lomiri()) { - ayatana_common_utils_open_url("appid://com.lomiri.clock/clock/current-user-version"); + ayatana_common_utils_open_url("appid://lomiri-clock-app/lomiri-clock-app/current-user-version"); } else { -- cgit v1.2.3 From 376c1bb19d81382c20e9453e58a69a5aa93270d0 Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Wed, 31 Oct 2018 21:16:15 -0400 Subject: Fix clock app URL. --- src/actions-live.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/actions-live.cpp') diff --git a/src/actions-live.cpp b/src/actions-live.cpp index 8fa894d..5c49bc4 100644 --- a/src/actions-live.cpp +++ b/src/actions-live.cpp @@ -50,7 +50,7 @@ void LiveActions::open_alarm_app() { if (ayatana_common_utils_is_lomiri()) { - ayatana_common_utils_open_url("appid://lomiri-clock-app/lomiri-clock-app/current-user-version"); + ayatana_common_utils_open_url("alarm://"); } else { -- cgit v1.2.3