-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reminders for Events #123
Reminders for Events #123
Conversation
…ReminderEventList
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need to put the code in an additional "main" folder.
The main Calendar app, howver, should move into a "main" folder, i.e. rename "src" to "main".
The events should be gathered with a query instead of reading the whole "events" folder. After all, in the end we only want to have events with a "Reminder" attribute in our schedule.
Also, I suggest to use a BAlert instead of a BNotification. |
I disagree, the BAlert does not seem an option to me. All major OS use notifications coupled with a sound and so do third party apps like Outlook. Notifications seem the best way to, well... notify the user, IMO. |
We should use what works with the task at now. Once Haiku's notification services have improved, it's trivial to replace the BAlert with a BNotification. |
…ugh the whole Events directory
Hey @humdingerb ! Can you please check out the folder structure now? |
Personally, I'd remove the "src" folders and have the source right under main | daemon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are quite few stray whitespaces in the code. You can configure Koder to show them, if that's your editor of choice.
Hello! Let me summarize what I did:
I have tested the program. It is showing notifications on the Event Start time and is taking the Adding/Removing of events fruitfully (But the event changes is not Refreshing the list) |
So your next job is to find out why live queries are not working. |
Also... I was looking at the Calendar source code. Can you tell me what QueryDBManager::GetEventsToNotify() does and where it is used? |
I did not find an example, but this documentation. And I tested it out as follows: In the constructor -
As the target is now set, the query can send the
But the message is not receiving, in any change case of the events (Adding, Removing, or Attr Change) Still doesn't work. |
There are two reasons it is not working:
|
Though this might be a useful utility, but it certainly needs some work. Also, when the |
Thanks for the suggestion! I moved the query "build-up" to I still am not able to use the |
0b11b2b
to
8e628d3
Compare
The Query is only able to fetch the Addition and Removal of Events, as only So, the Refreshing is not working when an Event's start time is changed. How can we approach to solve this? |
One possibility is to node-monitor the events folder and if some event changed, check if it's a "remindable" event and update the list of events returned by your query. Another is to send a BMessage from the main Calendar app to the daemon, telling it which event needs to be updated. The second approach feels simpler, however, if a user changes an event's attribute in Tracker or Terminal or any other way outside the Calendar app, only the first approach works 100%. |
For node-monitoring the events folder, we need to watch the events directory using the Another thing is to watch using the |
I suppose you'll have to watch every entry returned by your query. |
cc82019
to
78d7b52
Compare
A simply approached towards this as follows: While adding the event to the list, called for But a wierd error is happening and I am not able to figure this out: Whenever the ATTR of any event is changed, that event (updated) is added two times in the list! Also, after the node monitoring, the update for any change (adding/removing) is happening multiple times |
calendar_daemon crashes on launch: |
The SQLiteManager is still needed to migrate older data to the new attribute system. Only after a few releases, when can assume most users have updated, the migrating code the SQLiteManager can be retired. |
Yes, that seems to be the case, but what should be done with the other classes? And I haven't made any progress on the Node Monitor issue, can you help me with that? |
Don't know about GoogleCalendar and ICal. AFAIK, both currently don't work. Maybe the code can still be used as a starting point for a future effort to support them? Maybe a note about both not working should be added to the ReadMe. WRT node monitoring issues, even if I probably won't be capable of helping, we need a detailed description of the problem. (Or did I just miss that? It's a bit unfortunate that everything is in this one big PR...) |
What is the node monitoring issue again? I tried to look through the thread here, but all I am finding is that sometimes you get multiple notifications. How is that an issue? |
Hey! Sorry for being inactive here for some period. I was working on resolving some confusing bugs on Saving/Loading of Events with/without Reminder. Now the Saving/Loading bug is resolved. And The Calendar only writes |
Here I'm having a weird bug, when I try to fetch the events using the It should be optimum to fetch the events with this condition:
But it isn't fetching any event. Yet when it is used with the |
The new attribute needs to be added to the index to be queryable. See QueryDBManager::_AddIndices() |
... and the MIME type, see QueryDBManager::_EventMimetype() above it. |
Thanks for the suggestion! |
How to test the daemon?
Also, it is not necessary to get the Daemon running before the Calendar. The Daemon can read through the events while starting itself as well. |
From a quick test, the daemon picks up remindable events fine. The alert is missing the event name and place. The text could also be improved, suggestion:
|
daemon/src/CalendarDaemon.cpp
Outdated
|
||
time_t deltaTime = event->GetStartDateTime() - event->GetReminderTime(); | ||
|
||
BString buff = "Remider!\n\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be localizable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Localization done in code!
daemon/src/CalendarDaemon.cpp
Outdated
buff << "\n\n"; | ||
if (deltaTime%3600 == 0) { | ||
deltaTime /= 3600; | ||
buff << "Is starting in " << deltaTime << " hours!"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be properly translatable, including possible plural forms, you'll nee to use BStringFormat(). For a very terse intro, see https://www.haiku-os.org/community/getting-involved/translating/3rdparty/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, thanks for the reference!
I have done the Localization in the code, please check that out! |
|
@nielx: I find this huge PR increasingly unwieldy. You think it'd be OK to merge after Hashit's next changes and have smaller, separate PRs to address open issues? |
752eee5
to
4f59b6c
Compare
Agreed that the PR is unwieldy. I also don't know what I am reviewing and I feel like it is spiraling out of control, especially the changes in the original code. I don't want to merge this as is though, it needs to be cleaned up, but it CANNOT get any new changes added. In the email last week I outlined what I think the scope of the PR should be. I will review it accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started the review, but I left some fundamental questions that should be answered before going through every line of code.
# "#include <header>". Directories that contain the files in SRCS are | ||
# NOT auto-included here. | ||
SYSTEM_INCLUDE_PATHS = \ | ||
$(shell findpaths -e B_FIND_PATH_HEADERS_DIRECTORY private/interface) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these includes necessary for the daemon? Please remove them one by one and keep the ones you need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
@@ -0,0 +1,2 @@ | |||
# calendar_daemon | |||
A daemon app which will be responsible for sending reminders for the Calendar Application on Haiku OS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine for now, but make a note to expand either the top level readme in the future, or this one, once you have figured out and implemented how this is going to be started/stopped and triggered.
@@ -0,0 +1,22 @@ | |||
1 English application/x-vnd.CalendarDaemon 3971020027 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should remove the locale changes in the daemon for now, as I think there is a better way. We will discuss this separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Should I remove only the catkeys or the code changes as well?
#include "CalendarDaemon.h" | ||
|
||
#include <csignal> | ||
#include <iostream> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this include needed? See more comments below.
|
||
void signalHandler(int signum) | ||
{ | ||
std::cout << "Interrupted Signal: " << signum << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can leave this debug output here for this PR, but it must be improved as part of this project. We need to make a decision on what to log to the system log, and under what conditions we want debug output to the standard output or to stderr. We can discuss this separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted.
void signalHandler(int signum) | ||
{ | ||
std::cout << "Interrupted Signal: " << signum << std::endl; | ||
exit(signum); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the way to go? Would there be a reason to cleanly exit the BApplication by requesting it to quit?
(This is not a rhetorical question!)
{ | ||
std::cout << "Creating Daemon" << std::endl; | ||
|
||
fEventLock = create_sem(1, "EventLock"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still not convinced you need semaphores and a separate thread in an object that is designed to be a message based event loop! See my earlier comments. Focus on reworking this. I understand you previously had issues with node monitoring and with Pulse, but we should resolve those as they are most likely programming errors and not fundamental issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, this can be handled more effectively through the BMessageRunner
itself. I'll work on that.
Should I start working on this in this PR, or should we merge this and create a separate PR for removing the separate thread?
|
||
fDBManager = new QueryDBManager(); | ||
|
||
fEventLoop = spawn_thread(EventLoop, "EventLoop", B_NORMAL_PRIORITY, this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments on event loop earlier
{ | ||
LockEvents(); | ||
|
||
fQuery.SetVolume(&fQueryVolume); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really necessary?
The way I see it, the daemon needs to know one thing: what is the next event I need to warn for, and when is it? It should of course accommodating for the chance that there are two or more events that are raised simultaneously, but that's the only edge case I can think off.
Do you then need a running query? Or is this more of a single call to the QueryDBManager, which is meant to be the abstract parent anyway?
So in pseudo code
- daemon start
- list nextEvents = fQueryDbManager->GetNextReminders()
- sleep until reminder
- remind
- list nextEvents = fQueryDbManager->GetNextReminders()
- sleep until reminder
- remind
If the data on the disk changes, then it should be a trigger to reload the next reminders list. That's what node monitoring is for.
So I am wondering why you need the live query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I think humdinger already alluded to it, you don't need to use Pulse, you can use BMessageRunner to set a timer to wake up your application when it is time to notify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I am wondering why you need the live query.
TBH, we do not seem to need the Live Query to gather the events, Node Monitoring will suffice for that. But it was the idea from the beginning to use the Live Queries, so here we are. Should we remove the Live Query?
} | ||
case B_NODE_MONITOR: | ||
{ | ||
std::cout << "\nAttribute Changed - Node Monitor" << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't node monitoring also be called when new events are added or events are removed (files created/removed)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Files created/removed is handled by the Live Query. For now, The Node Monitoring is only used for tracking the changes in the attributes.
Should we remove the live query and get the work done with Node Monitor only?
What's the current status on this one? |
Closing; this PR has been superseeded by individual PRs |
For Issue: #122
Started working on the
calendar_daemon
Currently I tested out sending Notifications from the Application with the help of
BNotification
I'm submitting this PR for regular updates regarding the coding and their review