diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/datetime/actions-live.h | 17 | ||||
-rw-r--r-- | include/datetime/actions.h | 12 | ||||
-rw-r--r-- | include/datetime/appointment.h | 1 | ||||
-rw-r--r-- | include/datetime/date-time.h | 2 | ||||
-rw-r--r-- | include/datetime/dbus-shared.h | 40 | ||||
-rw-r--r-- | include/datetime/engine-eds.h | 3 | ||||
-rw-r--r-- | include/datetime/menu.h | 6 | ||||
-rw-r--r-- | include/datetime/settings-live.h | 16 | ||||
-rw-r--r-- | include/datetime/settings-shared.h | 10 | ||||
-rw-r--r-- | include/datetime/settings.h | 6 | ||||
-rw-r--r-- | include/datetime/snap.h | 13 | ||||
-rw-r--r-- | include/datetime/timezone-timedated.h | 8 | ||||
-rw-r--r-- | include/datetime/timezones-live.h | 5 | ||||
-rw-r--r-- | include/notifications/awake.h | 4 | ||||
-rw-r--r-- | include/notifications/dbus-shared.h | 6 | ||||
-rw-r--r-- | include/notifications/haptic.h | 2 | ||||
-rw-r--r-- | include/notifications/notifications.h | 15 |
17 files changed, 120 insertions, 46 deletions
diff --git a/include/datetime/actions-live.h b/include/datetime/actions-live.h index 2c348c6..6f536c4 100644 --- a/include/datetime/actions-live.h +++ b/include/datetime/actions-live.h @@ -40,21 +40,12 @@ public: virtual ~LiveActions() =default; bool desktop_has_calendar_app() const override; - void desktop_open_alarm_app() override; - void desktop_open_appointment(const Appointment&) 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_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); }; } // namespace datetime diff --git a/include/datetime/actions.h b/include/datetime/actions.h index 47931ac..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&) =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_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; diff --git a/include/datetime/appointment.h b/include/datetime/appointment.h index 950f4bb..faf8a18 100644 --- a/include/datetime/appointment.h +++ b/include/datetime/appointment.h @@ -43,7 +43,6 @@ struct Alarm bool has_text() const; }; - /** * \brief An instance of an appointment; e.g. a calendar event or clock-app alarm * 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/dbus-shared.h b/include/datetime/dbus-shared.h index 057ac6b..0b6aa95 100644 --- a/include/datetime/dbus-shared.h +++ b/include/datetime/dbus-shared.h @@ -24,9 +24,43 @@ #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 +{ + 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"}; + } + } +} #endif /* INDICATOR_DATETIME_DBUS_SHARED_H */ diff --git a/include/datetime/engine-eds.h b/include/datetime/engine-eds.h index 12425b3..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::shared_ptr<Myself> &myself); + EdsEngine(const std::shared_ptr<Myself> &myself); ~EdsEngine(); void get_appointments(const DateTime& begin, 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 <datetime/actions.h> +#include <datetime/appointment.h> #include <datetime/state.h> #include <memory> // std::shared_ptr @@ -49,6 +50,11 @@ public: Profile profile() const; GMenuModel* menu_model(); + static std::vector<Appointment> get_display_appointments( + const std::vector<Appointment>&, + const DateTime& start, + unsigned int max_items=5); + protected: Menu (Profile profile_in, const std::string& name_in); virtual ~Menu() =default; diff --git a/include/datetime/settings-live.h b/include/datetime/settings-live.h index ccf7122..85071ce 100644 --- a/include/datetime/settings-live.h +++ b/include/datetime/settings-live.h @@ -38,8 +38,12 @@ 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_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(); @@ -60,8 +64,16 @@ private: void update_alarm_duration(); void update_alarm_haptic(); void update_snooze_duration(); + 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(); + 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 bd84a2d..7280c16 100644 --- a/include/datetime/settings-shared.h +++ b/include/datetime/settings-shared.h @@ -51,4 +51,14 @@ 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" +#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 253a00a..af9227d 100644 --- a/include/datetime/settings.h +++ b/include/datetime/settings.h @@ -61,6 +61,12 @@ public: core::Property<unsigned int> alarm_volume; core::Property<unsigned int> alarm_duration; core::Property<unsigned int> snooze_duration; + core::Property<bool> cal_notification_enabled; + core::Property<bool> cal_notification_sounds; + core::Property<bool> cal_notification_vibrations; + core::Property<bool> cal_notification_bubbles; + core::Property<bool> cal_notification_list; + core::Property<bool> vibrate_silent_mode; }; } // namespace datetime diff --git a/include/datetime/snap.h b/include/datetime/snap.h index a295d9f..baa765b 100644 --- a/include/datetime/snap.h +++ b/include/datetime/snap.h @@ -24,6 +24,9 @@ #include <datetime/settings.h> #include <notifications/notifications.h> +#include <notifications/sound.h> + +#include <gio/gio.h> // GDBusConnection #include <functional> #include <memory> @@ -39,14 +42,16 @@ class Snap { public: Snap(const std::shared_ptr<ayatana::indicator::notifications::Engine>& engine, - const std::shared_ptr<const Settings>& settings); + const std::shared_ptr<ayatana::indicator::notifications::SoundBuilder>& sound_builder, + const std::shared_ptr<const Settings>& settings, + GDBusConnection* system_bus); virtual ~Snap(); - typedef std::function<void(const Appointment&, const Alarm&)> appointment_func; + enum class Response { None, Snooze, ShowApp }; + typedef std::function<void(const Appointment&, const Alarm&, const Response&)> response_func; void operator()(const Appointment& appointment, const Alarm& alarm, - appointment_func snooze, - appointment_func ok); + response_func on_response); private: class Impl; diff --git a/include/datetime/timezone-timedated.h b/include/datetime/timezone-timedated.h index 336a148..e0af184 100644 --- a/include/datetime/timezone-timedated.h +++ b/include/datetime/timezone-timedated.h @@ -20,10 +20,10 @@ #ifndef INDICATOR_DATETIME_TIMEDATED_TIMEZONE_H #define INDICATOR_DATETIME_TIMEDATED_TIMEZONE_H -#define DEFAULT_FILENAME "/etc/timezone" - #include <datetime/timezone.h> // base class +#include <gio/gio.h> // GDBusConnection* + #include <string> // std::string namespace ayatana { @@ -31,12 +31,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(GDBusConnection* connection); ~TimedatedTimezone(); private: 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 <datetime/settings.h> #include <datetime/timezones.h> #include <datetime/timezone-geoclue.h> -#include <datetime/timezone-timedated.h> #include <memory> // shared_ptr<> @@ -38,13 +37,13 @@ namespace datetime { class LiveTimezones: public Timezones { public: - LiveTimezones(const std::shared_ptr<const Settings>& settings); + LiveTimezones(const std::shared_ptr<const Settings>& settings, const std::shared_ptr<Timezone>& primary_timezone); private: void update_geolocation(); void update_timezones(); - TimedatedTimezone m_file; + std::shared_ptr<Timezone> m_primary_timezone; std::shared_ptr<const Settings> m_settings; std::shared_ptr<GeoclueTimezone> m_geo; }; 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 <memory> +#include <gio/gio.h> + 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: 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" 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: diff --git a/include/notifications/notifications.h b/include/notifications/notifications.h index 0de1e23..af6d21f 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,15 +64,26 @@ 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 disappears */ void set_closed_callback (std::function<void(const std::string& action)>); + /** Sets the time-out callback. This will be called exactly once. */ + void set_timeout_callback (std::function<void()>); + + /** 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; class Impl; |