From b4ff1a2458802e3238d952c69f9dd664f013137b Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 1 Feb 2016 18:05:45 -0600 Subject: don't show calendar event notifications if com.ubuntu.calendar's notifications are blacklisted --- include/datetime/settings.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/datetime/settings.h b/include/datetime/settings.h index 253a00a..d5e81c6 100644 --- a/include/datetime/settings.h +++ b/include/datetime/settings.h @@ -61,6 +61,7 @@ public: core::Property alarm_volume; core::Property alarm_duration; core::Property snooze_duration; + core::Property>> muted_apps; }; } // namespace datetime -- cgit v1.2.3 From 0b4ad877e1a5b083eda5c31227e476d969d00925 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 1 Feb 2016 18:07:18 -0600 Subject: in LiveSettings, add gschema support for notification app blacklisting --- include/datetime/settings-live.h | 8 ++++++-- include/datetime/settings-shared.h | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/datetime/settings-live.h b/include/datetime/settings-live.h index ccf7122..330b8e8 100644 --- a/include/datetime/settings-live.h +++ b/include/datetime/settings-live.h @@ -38,8 +38,10 @@ public: virtual ~LiveSettings(); private: - static void on_changed(GSettings*, gchar*, gpointer); - void update_key(const std::string& key); + static void on_changed_ccid(GSettings*, gchar*, gpointer); + static void on_changed_cunh(GSettings*, gchar*, gpointer); + void update_key_ccid(const std::string& key); + void update_key_cunh(const std::string& key); void update_custom_time_format(); void update_locations(); @@ -60,8 +62,10 @@ private: void update_alarm_duration(); void update_alarm_haptic(); void update_snooze_duration(); + void update_muted_apps(); GSettings* m_settings; + GSettings* m_settings_cunh; // we've got a raw pointer here, so disable copying LiveSettings(const LiveSettings&) =delete; diff --git a/include/datetime/settings-shared.h b/include/datetime/settings-shared.h index bd84a2d..f385e7a 100644 --- a/include/datetime/settings-shared.h +++ b/include/datetime/settings-shared.h @@ -51,4 +51,7 @@ TimeFormatMode; #define SETTINGS_ALARM_HAPTIC_S "alarm-haptic-feedback" #define SETTINGS_SNOOZE_DURATION_S "snooze-duration-minutes" +#define SETTINGS_CUNH_SCHEMA_ID "com.lomiri.notifications.hub" +#define SETTINGS_CUNH_BLACKLIST_S "blacklist" + #endif // INDICATOR_DATETIME_SETTINGS_SHARED -- cgit v1.2.3 From e47d49aca4da2d97c06acccc967abdf5698b044d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 18 Mar 2016 10:17:55 -0500 Subject: get event selection up-to-date with the spec, including showing in-progress events. add unit tests to cover event priority and display order. --- include/datetime/date-time.h | 2 ++ include/datetime/menu.h | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'include') diff --git a/include/datetime/date-time.h b/include/datetime/date-time.h index fc83388..845716d 100644 --- a/include/datetime/date-time.h +++ b/include/datetime/date-time.h @@ -68,7 +68,9 @@ public: int64_t to_unix() const; bool operator<(const DateTime& that) const; + bool operator>(const DateTime& that) const; bool operator<=(const DateTime& that) const; + bool operator>=(const DateTime& that) const; bool operator!=(const DateTime& that) const; bool operator==(const DateTime& that) const; int64_t operator- (const DateTime& that) const; diff --git a/include/datetime/menu.h b/include/datetime/menu.h index acd9ed8..0074ea5 100644 --- a/include/datetime/menu.h +++ b/include/datetime/menu.h @@ -21,6 +21,7 @@ #define INDICATOR_DATETIME_MENU_H #include +#include #include #include // std::shared_ptr @@ -49,6 +50,11 @@ public: Profile profile() const; GMenuModel* menu_model(); + static std::vector get_display_appointments( + const std::vector&, + const DateTime& start, + unsigned int max_items=5); + protected: Menu (Profile profile_in, const std::string& name_in); virtual ~Menu() =default; -- cgit v1.2.3 From d1935f872fe600f224aa89eff3ab70a48d52c16d 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. --- include/datetime/actions-live.h | 4 ++-- include/datetime/actions.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/datetime/actions-live.h b/include/datetime/actions-live.h index 2c348c6..1f84659 100644 --- a/include/datetime/actions-live.h +++ b/include/datetime/actions-live.h @@ -41,12 +41,12 @@ public: bool desktop_has_calendar_app() const override; void desktop_open_alarm_app() override; - void desktop_open_appointment(const Appointment&) override; + void desktop_open_appointment(const Appointment&, const DateTime&) override; void desktop_open_calendar_app(const DateTime&) override; void desktop_open_settings_app() override; void phone_open_alarm_app() override; - void phone_open_appointment(const Appointment&) override; + void phone_open_appointment(const Appointment&, const DateTime &) override; void phone_open_calendar_app(const DateTime&) override; void phone_open_settings_app() override; diff --git a/include/datetime/actions.h b/include/datetime/actions.h index 47931ac..ea163e4 100644 --- a/include/datetime/actions.h +++ b/include/datetime/actions.h @@ -45,12 +45,12 @@ public: virtual bool desktop_has_calendar_app() const =0; virtual void desktop_open_alarm_app() =0; - virtual void desktop_open_appointment(const Appointment&) =0; + virtual void desktop_open_appointment(const Appointment&, const DateTime&) =0; virtual void desktop_open_calendar_app(const DateTime&) =0; virtual void desktop_open_settings_app() =0; virtual void phone_open_alarm_app() =0; - virtual void phone_open_appointment(const Appointment&) =0; + virtual void phone_open_appointment(const Appointment&, const DateTime&) =0; virtual void phone_open_calendar_app(const DateTime&) =0; virtual void phone_open_settings_app() =0; -- cgit v1.2.3 From b5996d6441811eda94b738e79b4d673f3375e6f0 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 2 Jul 2021 02:01:24 +0200 Subject: Drop myself.[h|cpp] --- include/datetime/myself.h | 62 ----------------------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 include/datetime/myself.h (limited to 'include') diff --git a/include/datetime/myself.h b/include/datetime/myself.h deleted file mode 100644 index 67e938d..0000000 --- a/include/datetime/myself.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2016 Canonical Ltd. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - * - * Authors: - * Renato Araujo Oliveira Filho - */ - -#ifndef INDICATOR_DATETIME_MYSELF_H -#define INDICATOR_DATETIME_MYSELF_H - -#include - -#include -#include -#include -#include - -typedef struct _AgManager AgManager; - -namespace ayatana { -namespace indicator { -namespace datetime { - -class Myself -{ -public: - Myself(); - - const core::Property>& emails() - { - return m_emails; - } - - bool isMyEmail(const std::string &email); - -private: - std::shared_ptr m_accounts_manager; - core::Property > m_emails; - - static void on_accounts_changed(AgManager*, guint, Myself*); - void reloadEmails(); - -}; - - -} // namespace datetime -} // namespace indicator -} // namespace ayatana - -#endif // INDICATOR_DATETIME_MYSELF_H -- cgit v1.2.3 From ba0581ac2fd8df5a5023fdc126351dafbbba07ed Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 30 Mar 2016 13:26:14 -0300 Subject: Ignore alarms for events marked as not attending. --- include/datetime/engine-eds.h | 2 +- include/datetime/myself.h | 61 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 include/datetime/myself.h (limited to 'include') diff --git a/include/datetime/engine-eds.h b/include/datetime/engine-eds.h index 12425b3..0b854e5 100644 --- a/include/datetime/engine-eds.h +++ b/include/datetime/engine-eds.h @@ -48,7 +48,7 @@ class EdsEngine: public Engine { public: EdsEngine(); - explicit EdsEngine(const std::shared_ptr &myself); + explicit EdsEngine(const std::unique_ptr &myself); ~EdsEngine(); void get_appointments(const DateTime& begin, diff --git a/include/datetime/myself.h b/include/datetime/myself.h new file mode 100644 index 0000000..c381780 --- /dev/null +++ b/include/datetime/myself.h @@ -0,0 +1,61 @@ +/* + * Copyright 2016 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + * Authors: + * Renato Araujo Oliveira Filho + */ + +#ifndef INDICATOR_DATETIME_MYSELF_H +#define INDICATOR_DATETIME_MYSELF_H + +#include + +#include + +#include +#include +#include + +namespace ayatana { +namespace indicator { +namespace datetime { + +class Myself +{ +public: + Myself(); + + core::Property>& emails() + { + return m_emails; + } + + bool isMyEmail(const std::string &email); + +private: + std::shared_ptr m_accounts_manager; + core::Property > m_emails; + + static void on_accounts_changed(AgManager*, guint, Myself*); + void reloadEmails(); + +}; + + +} // namespace datetime +} // namespace indicator +} // namespace ayatana + +#endif // INDICATOR_DATETIME_MYSELF_H -- cgit v1.2.3 From 8c57742f1e42bf8076b38b4509a109a911b811c7 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 30 Mar 2016 16:52:02 -0300 Subject: Only play a sound alert if the event contains a SOUND reminder. --- include/datetime/appointment.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/datetime/appointment.h b/include/datetime/appointment.h index 950f4bb..5b4c27e 100644 --- a/include/datetime/appointment.h +++ b/include/datetime/appointment.h @@ -34,9 +34,15 @@ namespace datetime { */ struct Alarm { + enum Type { + EMAIL = 0x001, + SOUND = 0x010, + TEXT = 0x100 + }; std::string text; std::string audio_url; DateTime time; + int type; bool operator== (const Alarm& that) const; bool has_sound() const; -- cgit v1.2.3 From 05564ab71ebdadbb100ffac690d278c9982224f5 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 30 Mar 2016 21:41:08 -0300 Subject: Create a constructor for Alarm class. --- include/datetime/appointment.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/datetime/appointment.h b/include/datetime/appointment.h index 5b4c27e..14adb5d 100644 --- a/include/datetime/appointment.h +++ b/include/datetime/appointment.h @@ -42,7 +42,14 @@ struct Alarm std::string text; std::string audio_url; DateTime time; - int type; + int type = TEXT; + + Alarm(const std::string &text_, const std::string &audio_url_, const DateTime & time_, int type_ = TEXT) + : text(text_), audio_url(audio_url_), time(time_), type(type_) + {} + + Alarm() + {} bool operator== (const Alarm& that) const; bool has_sound() const; -- cgit v1.2.3 From 0b5b8b3d31eaff2302c2fd3eb11e68be96f1d219 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 31 Mar 2016 09:41:29 -0300 Subject: Remove constructors from Alarm. --- include/datetime/appointment.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'include') diff --git a/include/datetime/appointment.h b/include/datetime/appointment.h index 14adb5d..2c225fc 100644 --- a/include/datetime/appointment.h +++ b/include/datetime/appointment.h @@ -42,14 +42,7 @@ struct Alarm std::string text; std::string audio_url; DateTime time; - int type = TEXT; - - Alarm(const std::string &text_, const std::string &audio_url_, const DateTime & time_, int type_ = TEXT) - : text(text_), audio_url(audio_url_), time(time_), type(type_) - {} - - Alarm() - {} + int type : SOUND; bool operator== (const Alarm& that) const; bool has_sound() const; -- cgit v1.2.3 From 6874753bfba638ab819bfa92ad8cd7a878ae7701 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 31 Mar 2016 10:55:01 -0300 Subject: Update tests. --- include/datetime/appointment.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/datetime/appointment.h b/include/datetime/appointment.h index 2c225fc..ae9e8ff 100644 --- a/include/datetime/appointment.h +++ b/include/datetime/appointment.h @@ -35,21 +35,21 @@ namespace datetime { struct Alarm { enum Type { + None = 0, EMAIL = 0x001, SOUND = 0x010, TEXT = 0x100 }; + int type; std::string text; std::string audio_url; DateTime time; - int type : SOUND; bool operator== (const Alarm& that) const; - bool has_sound() const; - bool has_text() const; + Alarm(); + Alarm(int type_, const std::string &text_, const std::string& audio_url_, const DateTime &time_); }; - /** * \brief An instance of an appointment; e.g. a calendar event or clock-app alarm * -- cgit v1.2.3 From b1031b1de834f246bba806cd51bfbb22f5c15b16 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 31 Mar 2016 15:51:29 -0300 Subject: Remove type property from Alarm. --- include/datetime/appointment.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/datetime/appointment.h b/include/datetime/appointment.h index ae9e8ff..faf8a18 100644 --- a/include/datetime/appointment.h +++ b/include/datetime/appointment.h @@ -34,20 +34,13 @@ namespace datetime { */ struct Alarm { - enum Type { - None = 0, - EMAIL = 0x001, - SOUND = 0x010, - TEXT = 0x100 - }; - int type; std::string text; std::string audio_url; DateTime time; bool operator== (const Alarm& that) const; - Alarm(); - Alarm(int type_, const std::string &text_, const std::string& audio_url_, const DateTime &time_); + bool has_sound() const; + bool has_text() const; }; /** -- cgit v1.2.3 From 30b0ba7facf333209ea60db9f3b5820dc0f4d5f3 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 31 Mar 2016 16:53:36 -0300 Subject: Update code as requested by reviewer. --- include/datetime/engine-eds.h | 3 +-- include/datetime/myself.h | 9 +++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/datetime/engine-eds.h b/include/datetime/engine-eds.h index 0b854e5..96b0f76 100644 --- a/include/datetime/engine-eds.h +++ b/include/datetime/engine-eds.h @@ -47,8 +47,7 @@ class Myself; class EdsEngine: public Engine { public: - EdsEngine(); - explicit EdsEngine(const std::unique_ptr &myself); + EdsEngine(const std::shared_ptr &myself); ~EdsEngine(); void get_appointments(const DateTime& begin, diff --git a/include/datetime/myself.h b/include/datetime/myself.h index c381780..452fa53 100644 --- a/include/datetime/myself.h +++ b/include/datetime/myself.h @@ -20,13 +20,14 @@ #ifndef INDICATOR_DATETIME_MYSELF_H #define INDICATOR_DATETIME_MYSELF_H -#include - #include #include #include #include +#include + +typedef struct _AgManager AgManager; namespace ayatana { namespace indicator { @@ -37,7 +38,7 @@ class Myself public: Myself(); - core::Property>& emails() + const core::Property>& emails() { return m_emails; } @@ -46,7 +47,7 @@ public: private: std::shared_ptr m_accounts_manager; - core::Property > m_emails; + core::Property > m_emails; static void on_accounts_changed(AgManager*, guint, Myself*); void reloadEmails(); -- cgit v1.2.3 From ba6591e1fb0235d6e4ba5cb00dcb64fb74308ff8 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Fri, 1 Apr 2016 11:53:55 -0300 Subject: Include the correct header for set. --- include/datetime/myself.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/datetime/myself.h b/include/datetime/myself.h index 452fa53..67e938d 100644 --- a/include/datetime/myself.h +++ b/include/datetime/myself.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include -- cgit v1.2.3 From 328cdb7015136ff831a14f686d08f41f4e7421a1 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 8 Apr 2016 15:46:50 -0500 Subject: pull the timezone from timedate1 regardless of whether it appears on the bus before or after we startup --- include/datetime/dbus-shared.h | 42 +++++++++++++++++++++++++++++++++++ include/datetime/timezone-timedated.h | 6 ++--- 2 files changed, 44 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/datetime/dbus-shared.h b/include/datetime/dbus-shared.h index 057ac6b..fd43ae8 100644 --- a/include/datetime/dbus-shared.h +++ b/include/datetime/dbus-shared.h @@ -28,5 +28,47 @@ #define BUS_POWERD_PATH "/com/canonical/powerd" #define BUS_POWERD_INTERFACE "com.canonical.powerd" +namespace ayatana { +namespace indicator { +namespace datetime { + +namespace Bus +{ + namespace Timedate1 + { + static constexpr char const * BUSNAME {"org.freedesktop.timedate1"}; + static constexpr char const * ADDR {"/org/freedesktop/timedate1"}; + static constexpr char const * IFACE {"org.freedesktop.timedate1"}; + + namespace Properties + { + static constexpr char const * TIMEZONE {"Timezone"}; + } + + namespace Methods + { + static constexpr char const * SET_TIMEZONE {"SetTimezone"}; + } + } + + namespace Properties + { + static constexpr char const * IFACE {"org.freedesktop.DBus.Properties"}; + + namespace Methods + { + static constexpr char const * GET {"Get"}; + } + + namespace Signals + { + static constexpr char const * PROPERTIES_CHANGED {"PropertiesChanged"}; + } + } +} + +} // namespace datetime +} // namespace indicator +} // namespace ayatana #endif /* INDICATOR_DATETIME_DBUS_SHARED_H */ diff --git a/include/datetime/timezone-timedated.h b/include/datetime/timezone-timedated.h index 336a148..0857706 100644 --- a/include/datetime/timezone-timedated.h +++ b/include/datetime/timezone-timedated.h @@ -20,8 +20,6 @@ #ifndef INDICATOR_DATETIME_TIMEDATED_TIMEZONE_H #define INDICATOR_DATETIME_TIMEDATED_TIMEZONE_H -#define DEFAULT_FILENAME "/etc/timezone" - #include // base class #include // std::string @@ -31,12 +29,12 @@ namespace indicator { namespace datetime { /** - * \brief A #Timezone that gets its information from monitoring a file, such as /etc/timezone + * \brief A #Timezone that gets its information from org.freedesktop.timedate1 */ class TimedatedTimezone: public Timezone { public: - TimedatedTimezone(std::string filename = DEFAULT_FILENAME); + TimedatedTimezone(); ~TimedatedTimezone(); private: -- cgit v1.2.3 From 5c53bbf1552457307fecb8099e0623f078bd68fb Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 9 Apr 2016 19:07:04 -0500 Subject: update test-live-actions to last commit's TimedatedFixture changes --- include/datetime/dbus-shared.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'include') diff --git a/include/datetime/dbus-shared.h b/include/datetime/dbus-shared.h index fd43ae8..9c80336 100644 --- a/include/datetime/dbus-shared.h +++ b/include/datetime/dbus-shared.h @@ -28,10 +28,6 @@ #define BUS_POWERD_PATH "/com/canonical/powerd" #define BUS_POWERD_INTERFACE "com.canonical.powerd" -namespace ayatana { -namespace indicator { -namespace datetime { - namespace Bus { namespace Timedate1 @@ -67,8 +63,4 @@ namespace Bus } } -} // namespace datetime -} // namespace indicator -} // namespace ayatana - #endif /* INDICATOR_DATETIME_DBUS_SHARED_H */ -- cgit v1.2.3 From ad95b394c94c9ba958d54c5243f376e7854683b8 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 12 Apr 2016 12:03:36 -0500 Subject: in TimedatedTimezone, take a GDBusConnection argument in the ctor to simplify state management --- include/datetime/timezone-timedated.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/datetime/timezone-timedated.h b/include/datetime/timezone-timedated.h index 0857706..e0af184 100644 --- a/include/datetime/timezone-timedated.h +++ b/include/datetime/timezone-timedated.h @@ -22,6 +22,8 @@ #include // base class +#include // GDBusConnection* + #include // std::string namespace ayatana { @@ -34,7 +36,7 @@ namespace datetime { class TimedatedTimezone: public Timezone { public: - TimedatedTimezone(); + TimedatedTimezone(GDBusConnection* connection); ~TimedatedTimezone(); private: -- cgit v1.2.3 From 6c96dc57eff3f64155c913e1b011da5f5a6887fb Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 12 Apr 2016 12:05:11 -0500 Subject: in LiveTimezones, pass the primary timezone to it on construction. We used to create it implicitly but can't do that anymore now that TimedatedTimezone takes its own ctor argument. --- include/datetime/timezones-live.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/datetime/timezones-live.h b/include/datetime/timezones-live.h index e722576..8b8b5fa 100644 --- a/include/datetime/timezones-live.h +++ b/include/datetime/timezones-live.h @@ -23,7 +23,6 @@ #include #include #include -#include #include // shared_ptr<> @@ -38,13 +37,13 @@ namespace datetime { class LiveTimezones: public Timezones { public: - LiveTimezones(const std::shared_ptr& settings); + LiveTimezones(const std::shared_ptr& settings, const std::shared_ptr& primary_timezone); private: void update_geolocation(); void update_timezones(); - TimedatedTimezone m_file; + std::shared_ptr m_primary_timezone; std::shared_ptr m_settings; std::shared_ptr m_geo; }; -- cgit v1.2.3 From 13978702ac61845927889986310085e8f90821da Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Mon, 18 Apr 2016 23:42:53 -0300 Subject: Post message on messaging menu if the notification get timeout. --- include/notifications/notifications.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/notifications/notifications.h b/include/notifications/notifications.h index 0de1e23..2bb6694 100644 --- a/include/notifications/notifications.h +++ b/include/notifications/notifications.h @@ -50,6 +50,8 @@ public: void set_icon_name (const std::string& icon_name); + void set_start_time(uint64_t time); + /* Set an interval, after which the notification will automatically be closed. If not set, the notification server's default timeout is used. */ @@ -62,19 +64,24 @@ public: static constexpr char const * HINT_NONSHAPED_ICON {"x-canonical-non-shaped-icon"}; static constexpr char const * HINT_AFFIRMATIVE_HINT {"x-canonical-private-affirmative-tint"}; static constexpr char const * HINT_REJECTION_TINT {"x-canonical-private-rejection-tint"}; + static constexpr char const * HINT_INTERACTIVE {"x-canonical-switch-to-application"}; /* Add an action button. This may fail if the Engine doesn't support actions. @see Engine::supports_actions() */ void add_action (const std::string& action, const std::string& label); - /** Sets the closed callback. This will be called exactly once. */ + /** Sets the closed callback. This will be called exactly once. After notification dissapear */ void set_closed_callback (std::function); + /** Sets the time-out callback. This will be called exactly once. */ + void set_missed_click_callback (std::function); + + private: friend class Engine; class Impl; - std::unique_ptr impl; + std::shared_ptr impl; }; /** -- cgit v1.2.3 From d39dd6255625021cb5e3596ef4c5b921d59797b5 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Wed, 20 Apr 2016 17:59:25 -0300 Subject: Vibrate only once when notification about calendar events. --- include/notifications/haptic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/notifications/haptic.h b/include/notifications/haptic.h index 535074d..2f4008a 100644 --- a/include/notifications/haptic.h +++ b/include/notifications/haptic.h @@ -41,7 +41,7 @@ public: MODE_PULSE }; - explicit Haptic(const Mode& mode = MODE_PULSE); + explicit Haptic(const Mode& mode = MODE_PULSE, bool repeat = false); ~Haptic(); private: -- cgit v1.2.3 From 32db30a126d9d96de51a2a0fa8d6fa820dc8d341 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Tue, 26 Apr 2016 12:02:03 -0300 Subject: Fixed as reviewer requested. --- include/notifications/notifications.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/notifications/notifications.h b/include/notifications/notifications.h index 2bb6694..4b66800 100644 --- a/include/notifications/notifications.h +++ b/include/notifications/notifications.h @@ -81,7 +81,7 @@ public: private: friend class Engine; class Impl; - std::shared_ptr impl; + std::unique_ptr impl; }; /** -- cgit v1.2.3 From 846dfb9d7b16aec7923444083256a8565f308013 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Thu, 28 Apr 2016 09:35:05 -0300 Subject: Small fixes requeted by charles during the review. --- include/notifications/notifications.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/notifications/notifications.h b/include/notifications/notifications.h index 4b66800..450c45b 100644 --- a/include/notifications/notifications.h +++ b/include/notifications/notifications.h @@ -75,7 +75,7 @@ public: void set_closed_callback (std::function); /** Sets the time-out callback. This will be called exactly once. */ - void set_missed_click_callback (std::function); + void set_timeout_callback (std::function); private: -- cgit v1.2.3 From 85cb430bd147719fed43f4ccf04b9d22cad33bfc 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. --- include/datetime/actions-live.h | 17 ++++++----------- include/datetime/actions.h | 12 ++++-------- 2 files changed, 10 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/include/datetime/actions-live.h b/include/datetime/actions-live.h index 1f84659..1eb34ec 100644 --- a/include/datetime/actions-live.h +++ b/include/datetime/actions-live.h @@ -40,21 +40,16 @@ public: virtual ~LiveActions() =default; bool desktop_has_calendar_app() const override; - void desktop_open_alarm_app() override; - void desktop_open_appointment(const Appointment&, const DateTime&) override; - void desktop_open_calendar_app(const DateTime&) override; - void desktop_open_settings_app() override; - - void phone_open_alarm_app() override; - void phone_open_appointment(const Appointment&, const DateTime &) override; - void phone_open_calendar_app(const DateTime&) override; - void phone_open_settings_app() override; + void open_alarm_app() override; + void open_appointment(const Appointment&, const DateTime&) override; + void open_calendar_app(const DateTime&) override; + void open_settings_app() override; void set_location(const std::string& zone, const std::string& name) override; protected: - virtual void execute_command(const std::string& command); - virtual void dispatch_url(const std::string& url); + + void lomiri_open_appointment(const Appointment& appt, const DateTime& date); }; } // namespace datetime diff --git a/include/datetime/actions.h b/include/datetime/actions.h index ea163e4..d866b00 100644 --- a/include/datetime/actions.h +++ b/include/datetime/actions.h @@ -44,15 +44,11 @@ class Actions public: virtual bool desktop_has_calendar_app() const =0; - virtual void desktop_open_alarm_app() =0; - virtual void desktop_open_appointment(const Appointment&, const DateTime&) =0; - virtual void desktop_open_calendar_app(const DateTime&) =0; - virtual void desktop_open_settings_app() =0; - virtual void phone_open_alarm_app() =0; - virtual void phone_open_appointment(const Appointment&, const DateTime&) =0; - virtual void phone_open_calendar_app(const DateTime&) =0; - virtual void phone_open_settings_app() =0; + virtual void open_alarm_app() =0; + virtual void open_appointment(const Appointment&, const DateTime&) =0; + virtual void open_calendar_app(const DateTime&) =0; + virtual void open_settings_app() =0; virtual void set_location(const std::string& zone, const std::string& name)=0; -- cgit v1.2.3 From 8c7997ad86cffd8fb0b1578e2bc632395744d0b8 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 14 May 2016 12:18:45 -0500 Subject: add a new Snap::Response enum for more flexible handling of snap decisions --- include/datetime/snap.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/datetime/snap.h b/include/datetime/snap.h index a295d9f..099426b 100644 --- a/include/datetime/snap.h +++ b/include/datetime/snap.h @@ -42,11 +42,11 @@ public: const std::shared_ptr& settings); virtual ~Snap(); - typedef std::function appointment_func; + enum class Response { None, Snooze, ShowApp }; + typedef std::function response_func; void operator()(const Appointment& appointment, const Alarm& alarm, - appointment_func snooze, - appointment_func ok); + response_func on_response); private: class Impl; -- cgit v1.2.3 From 9c7c869ae51fffe7ce560faf0d3d2cecf5743563 Mon Sep 17 00:00:00 2001 From: Arthur Mello Date: Wed, 22 Jun 2016 15:37:55 -0300 Subject: Update indicator-datetime to work with the new notification settings --- include/datetime/settings-live.h | 12 ++++++++---- include/datetime/settings-shared.h | 9 +++++++-- include/datetime/settings.h | 6 +++++- 3 files changed, 20 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/datetime/settings-live.h b/include/datetime/settings-live.h index 330b8e8..4aeaa9b 100644 --- a/include/datetime/settings-live.h +++ b/include/datetime/settings-live.h @@ -39,9 +39,9 @@ public: private: static void on_changed_ccid(GSettings*, gchar*, gpointer); - static void on_changed_cunh(GSettings*, gchar*, gpointer); + static void on_changed_cal_notification(GSettings*, gchar*, gpointer); void update_key_ccid(const std::string& key); - void update_key_cunh(const std::string& key); + void update_key_cal_notification(const std::string& key); void update_custom_time_format(); void update_locations(); @@ -62,10 +62,14 @@ private: void update_alarm_duration(); void update_alarm_haptic(); void update_snooze_duration(); - void update_muted_apps(); + void update_cal_notification_enabled(); + void update_cal_notification_sounds(); + void update_cal_notification_vibrations(); + void update_cal_notification_bubbles(); + void update_cal_notification_list(); GSettings* m_settings; - GSettings* m_settings_cunh; + GSettings* m_settings_cal_notification; // we've got a raw pointer here, so disable copying LiveSettings(const LiveSettings&) =delete; diff --git a/include/datetime/settings-shared.h b/include/datetime/settings-shared.h index f385e7a..236b8f1 100644 --- a/include/datetime/settings-shared.h +++ b/include/datetime/settings-shared.h @@ -51,7 +51,12 @@ TimeFormatMode; #define SETTINGS_ALARM_HAPTIC_S "alarm-haptic-feedback" #define SETTINGS_SNOOZE_DURATION_S "snooze-duration-minutes" -#define SETTINGS_CUNH_SCHEMA_ID "com.lomiri.notifications.hub" -#define SETTINGS_CUNH_BLACKLIST_S "blacklist" +#define SETTINGS_NOTIFY_SCHEMA_ID "com.lomiri.notifications.settings" +#define SETTINGS_NOTIFY_CALENDAR_PATH "/com/lomiri/NotificationSettings/com.lomiri.calendar/calendar/" +#define SETTINGS_NOTIFY_ENABLED_KEY "enable-notifications" +#define SETTINGS_NOTIFY_SOUNDS_KEY "use-sounds-notifications" +#define SETTINGS_NOTIFY_VIBRATIONS_KEY "use-vibrations-notifications" +#define SETTINGS_NOTIFY_BUBBLES_KEY "use-bubbles-notifications" +#define SETTINGS_NOTIFY_LIST_KEY "use-list-notifications" #endif // INDICATOR_DATETIME_SETTINGS_SHARED diff --git a/include/datetime/settings.h b/include/datetime/settings.h index d5e81c6..5ae00f6 100644 --- a/include/datetime/settings.h +++ b/include/datetime/settings.h @@ -61,7 +61,11 @@ public: core::Property alarm_volume; core::Property alarm_duration; core::Property snooze_duration; - core::Property>> muted_apps; + core::Property cal_notification_enabled; + core::Property cal_notification_sounds; + core::Property cal_notification_vibrations; + core::Property cal_notification_bubbles; + core::Property cal_notification_list; }; } // namespace datetime -- cgit v1.2.3 From fb29c9e706c143e38726ea057fdb754a8e30c2aa Mon Sep 17 00:00:00 2001 From: Arthur Mello Date: Wed, 29 Jun 2016 21:37:56 -0300 Subject: Fix notifications so it respects if it should or not show bubbles or add to notification list --- include/notifications/notifications.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/notifications/notifications.h b/include/notifications/notifications.h index 450c45b..a76ec45 100644 --- a/include/notifications/notifications.h +++ b/include/notifications/notifications.h @@ -77,6 +77,12 @@ public: /** Sets the time-out callback. This will be called exactly once. */ void set_timeout_callback (std::function); + /** Sets if a notification bubble should be displayed. */ + void set_show_notification_bubble (bool show); + + /** Sets if notification should be posted to messaging menu after it is closed. */ + void set_post_to_messaging_menu (bool post); + private: friend class Engine; -- cgit v1.2.3 From d61975b6145c245bf8df5322942395b101ca57c9 Mon Sep 17 00:00:00 2001 From: Arthur Mello Date: Mon, 4 Jul 2016 16:30:18 -0300 Subject: If in silent mode should only vibrate if the settings say so --- include/datetime/settings-live.h | 4 ++++ include/datetime/settings-shared.h | 2 ++ include/datetime/settings.h | 1 + 3 files changed, 7 insertions(+) (limited to 'include') diff --git a/include/datetime/settings-live.h b/include/datetime/settings-live.h index 4aeaa9b..85071ce 100644 --- a/include/datetime/settings-live.h +++ b/include/datetime/settings-live.h @@ -40,8 +40,10 @@ public: private: static void on_changed_ccid(GSettings*, gchar*, gpointer); static void on_changed_cal_notification(GSettings*, gchar*, gpointer); + static void on_changed_general_notification(GSettings*, gchar*, gpointer); void update_key_ccid(const std::string& key); void update_key_cal_notification(const std::string& key); + void update_key_general_notification(const std::string& key); void update_custom_time_format(); void update_locations(); @@ -67,9 +69,11 @@ private: void update_cal_notification_vibrations(); void update_cal_notification_bubbles(); void update_cal_notification_list(); + void update_vibrate_silent_mode(); GSettings* m_settings; GSettings* m_settings_cal_notification; + GSettings* m_settings_general_notification; // we've got a raw pointer here, so disable copying LiveSettings(const LiveSettings&) =delete; diff --git a/include/datetime/settings-shared.h b/include/datetime/settings-shared.h index 236b8f1..7280c16 100644 --- a/include/datetime/settings-shared.h +++ b/include/datetime/settings-shared.h @@ -51,6 +51,8 @@ TimeFormatMode; #define SETTINGS_ALARM_HAPTIC_S "alarm-haptic-feedback" #define SETTINGS_SNOOZE_DURATION_S "snooze-duration-minutes" +#define SETTINGS_NOTIFY_APPS_SCHEMA_ID "com.lomiri.notifications.settings.applications" +#define SETTINGS_VIBRATE_SILENT_KEY "vibrate-silent-mode" #define SETTINGS_NOTIFY_SCHEMA_ID "com.lomiri.notifications.settings" #define SETTINGS_NOTIFY_CALENDAR_PATH "/com/lomiri/NotificationSettings/com.lomiri.calendar/calendar/" #define SETTINGS_NOTIFY_ENABLED_KEY "enable-notifications" diff --git a/include/datetime/settings.h b/include/datetime/settings.h index 5ae00f6..af9227d 100644 --- a/include/datetime/settings.h +++ b/include/datetime/settings.h @@ -66,6 +66,7 @@ public: core::Property cal_notification_vibrations; core::Property cal_notification_bubbles; core::Property cal_notification_list; + core::Property vibrate_silent_mode; }; } // namespace datetime -- cgit v1.2.3 From 14870108857877b8015bd0f12e2daae4085fa39f Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 6 Oct 2016 12:07:05 -0500 Subject: in Awake, remove an unnecessary async call by passing the system bus into the constructor instead of fetching it asynchronously --- include/notifications/awake.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/notifications/awake.h b/include/notifications/awake.h index b441692..d0b46eb 100644 --- a/include/notifications/awake.h +++ b/include/notifications/awake.h @@ -22,6 +22,8 @@ #include +#include + namespace ayatana { namespace indicator { namespace notifications { @@ -36,7 +38,7 @@ namespace notifications { class Awake { public: - explicit Awake(const std::string& app_name); + explicit Awake(GDBusConnection* system_bus, const std::string& app_name); ~Awake(); private: -- cgit v1.2.3 From 34f44f959b63d64f0eec2f16e322796a5bea7c3a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 6 Oct 2016 12:08:29 -0500 Subject: in Snap, add a constructor arg for the system bus because we need it when instantiating Awake objects --- include/datetime/snap.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/datetime/snap.h b/include/datetime/snap.h index 099426b..baa765b 100644 --- a/include/datetime/snap.h +++ b/include/datetime/snap.h @@ -24,6 +24,9 @@ #include #include +#include + +#include // GDBusConnection #include #include @@ -39,7 +42,9 @@ class Snap { public: Snap(const std::shared_ptr& engine, - const std::shared_ptr& settings); + const std::shared_ptr& sound_builder, + const std::shared_ptr& settings, + GDBusConnection* system_bus); virtual ~Snap(); enum class Response { None, Snooze, ShowApp }; -- cgit v1.2.3 From 217b48352a2591150413c77ca85b6a1ef158e6d5 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 16 Jul 2021 21:52:08 +0200 Subject: Fix failing tests - include/actions-mock.h: Set return value to std::string and return an empty string - include/actions.h: Make open_alarm_app, open_appointment, open_calendar_app and open_settings_app return the uri/command - include/actions-live.h: Make open_alarm_app, open_appointment, open_calendar_app and open_settings_app return the uri/command - src/actions-live.cpp: Make open_alarm_app, open_appointment, open_calendar_app and open_settings_app return the uri/command - tests/test-live-actions.cpp: Drop last_cmd and last_url variables + use return values of actions-live functions for testing + test phone functions on lomiri only - tests/test-live-actions.cpp: test phone functions after setting XDG_CURRENT_DESKTOP - tests/test-settings.cpp: Use SETTINGS_NOTIFY_SCHEMA_ID only if it exists - tests/run-eds-ics-test.sh: Remove return statement - tests/CMakeLists.txt: Enable the timezone unit tests - tests/CMakeLists.txt: Catch race condition while attempting to copy schemas - tests/CMakeLists.txt: Exclude blocking tests on Travis for now - tests/tests-timezones.cpp: Use MockTimezone to construct LiveTimezones + drop section expecting changes after /timezone is modified (not monitored) - tests/test-formater: Change warning to plain message otherwise it can crash the test - .build.yml: Replace libmessaging-menu-dev with ayatana-indicator-messages Git build --- include/datetime/actions-live.h | 8 ++++---- include/datetime/actions.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/datetime/actions-live.h b/include/datetime/actions-live.h index 1eb34ec..136812c 100644 --- a/include/datetime/actions-live.h +++ b/include/datetime/actions-live.h @@ -40,10 +40,10 @@ public: virtual ~LiveActions() =default; bool desktop_has_calendar_app() const override; - void open_alarm_app() override; - void open_appointment(const Appointment&, const DateTime&) override; - void open_calendar_app(const DateTime&) override; - void open_settings_app() override; + std::string open_alarm_app() override; + std::string open_appointment(const Appointment&, const DateTime&) override; + std::string open_calendar_app(const DateTime&) override; + std::string open_settings_app() override; void set_location(const std::string& zone, const std::string& name) override; diff --git a/include/datetime/actions.h b/include/datetime/actions.h index d866b00..5927967 100644 --- a/include/datetime/actions.h +++ b/include/datetime/actions.h @@ -45,10 +45,10 @@ public: virtual bool desktop_has_calendar_app() const =0; - virtual void open_alarm_app() =0; - virtual void open_appointment(const Appointment&, const DateTime&) =0; - virtual void open_calendar_app(const DateTime&) =0; - virtual void open_settings_app() =0; + virtual std::string open_alarm_app() =0; + virtual std::string open_appointment(const Appointment&, const DateTime&) =0; + virtual std::string open_calendar_app(const DateTime&) =0; + virtual std::string open_settings_app() =0; virtual void set_location(const std::string& zone, const std::string& name)=0; -- cgit v1.2.3 From 86ff05f7d1a592f59ec846faaead83ece1513ca1 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Mon, 19 Jul 2021 00:19:07 +0200 Subject: Rename com.canonical.powerd -> com.lomiri.Repowerd --- include/datetime/dbus-shared.h | 6 +++--- include/notifications/dbus-shared.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/datetime/dbus-shared.h b/include/datetime/dbus-shared.h index 9c80336..0b6aa95 100644 --- a/include/datetime/dbus-shared.h +++ b/include/datetime/dbus-shared.h @@ -24,9 +24,9 @@ #define BUS_DATETIME_NAME "org.ayatana.indicator.datetime" #define BUS_DATETIME_PATH "/org/ayatana/indicator/datetime" -#define BUS_POWERD_NAME "com.canonical.powerd" -#define BUS_POWERD_PATH "/com/canonical/powerd" -#define BUS_POWERD_INTERFACE "com.canonical.powerd" +#define BUS_POWERD_NAME "com.lomiri.Repowerd" +#define BUS_POWERD_PATH "/com/lomiri/Repowerd" +#define BUS_POWERD_INTERFACE "com.lomiri.Repowerd" namespace Bus { diff --git a/include/notifications/dbus-shared.h b/include/notifications/dbus-shared.h index 523fb2a..31df219 100644 --- a/include/notifications/dbus-shared.h +++ b/include/notifications/dbus-shared.h @@ -25,9 +25,9 @@ #define BUS_SCREEN_PATH "/com/canonical/Unity/Screen" #define BUS_SCREEN_INTERFACE "com.canonical.Unity.Screen" -#define BUS_POWERD_NAME "com.canonical.powerd" -#define BUS_POWERD_PATH "/com/canonical/powerd" -#define BUS_POWERD_INTERFACE "com.canonical.powerd" +#define BUS_POWERD_NAME "com.lomiri.Repowerd" +#define BUS_POWERD_PATH "/com/lomiri/Repowerd" +#define BUS_POWERD_INTERFACE "com.lomiri.Repowerd" #define BUS_HAPTIC_NAME "com.canonical.usensord" #define BUS_HAPTIC_PATH "/com/canonical/usensord/haptic" -- cgit v1.2.3 From 1297caa82d05f0bfa2b1dd64f0bb56c4a4aca85e Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Wed, 28 Jul 2021 21:53:06 +0200 Subject: Some fixes in UBports patches after a review - debian/control: Add liblomiri-url-dispatcher-dev as optional - .build.yml: Add liblomiri-url-dispatcher-dev dependency - CMakeLists.txt: Remove duplicate enable_testing() - include/datetime/actions-live.h: Remove lomiri_open_appointment --- include/datetime/actions-live.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include') diff --git a/include/datetime/actions-live.h b/include/datetime/actions-live.h index 136812c..857c3a6 100644 --- a/include/datetime/actions-live.h +++ b/include/datetime/actions-live.h @@ -46,10 +46,6 @@ public: std::string open_settings_app() override; void set_location(const std::string& zone, const std::string& name) override; - -protected: - - void lomiri_open_appointment(const Appointment& appt, const DateTime& date); }; } // namespace datetime -- cgit v1.2.3 From e50e951710b4f3342780ad541c4bdc3d16f707dd Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 29 Aug 2021 13:41:10 +0200 Subject: include/notifications/notifications.h: Typo fix in comment. --- include/notifications/notifications.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/notifications/notifications.h b/include/notifications/notifications.h index a76ec45..af6d21f 100644 --- a/include/notifications/notifications.h +++ b/include/notifications/notifications.h @@ -71,7 +71,7 @@ public: @see Engine::supports_actions() */ void add_action (const std::string& action, const std::string& label); - /** Sets the closed callback. This will be called exactly once. After notification dissapear */ + /** Sets the closed callback. This will be called exactly once. After notification disappears */ void set_closed_callback (std::function); /** Sets the time-out callback. This will be called exactly once. */ -- cgit v1.2.3