diff --git a/.gitignore b/.gitignore index 96586cd..dbce6af 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -objects*/ +main/objects*/ +daemon/objects*/ +Calendar.pld diff --git a/daemon/Makefile b/daemon/Makefile new file mode 100644 index 0000000..542897c --- /dev/null +++ b/daemon/Makefile @@ -0,0 +1,146 @@ +## Haiku Generic Makefile v2.6 ## + +## Fill in this file to specify the project being created, and the referenced +## Makefile-Engine will do all of the hard work for you. This handles any +## architecture of Haiku. +## +## For more information, see: +## file:///system/develop/documentation/makefile-engine.html + +# The name of the binary. +NAME = CalendarDaemon + +# The type of binary, must be one of: +# APP: Application +# SHARED: Shared library or add-on +# STATIC: Static library archive +# DRIVER: Kernel driver +TYPE = APP + +# If you plan to use localization, specify the application's MIME signature. +APP_MIME_SIG = application/x-vnd.CalendarDaemon + +# The following lines tell Pe and Eddie where the SRCS, RDEFS, and RSRCS are +# so that Pe and Eddie can fill them in for you. +#%{ +# @src->@ + +# Specify the source files to use. Full paths or paths relative to the +# Makefile can be included. All files, regardless of directory, will have +# their object files created in the common object directory. Note that this +# means this Makefile will not work correctly if two source files with the +# same name (source.c or source.cpp) are included from different directories. +# Also note that spaces in folder names do not work well with this Makefile. +SRCS = \ + src/CalendarDaemon.cpp \ + ../main/src/model/Event.cpp \ + ../main/src/model/Category.cpp \ + ../main/src/utils/ColorConverter.cpp \ + ../main/src/utils/ResourceLoader.cpp \ + ../main/src/db/QueryDBManager.cpp + + +# Specify the resource definition files to use. Full or relative paths can be +# used. +RDEFS = src/CalendarDaemon.rdef + + +# Specify the resource files to use. Full or relative paths can be used. +# Both RDEFS and RSRCS can be utilized in the same Makefile. +RSRCS = + + +# End Pe/Eddie support. +# @<-src@ +#%} + +#%} + +# Specify libraries to link against. +# There are two acceptable forms of library specifications: +# - if your library follows the naming pattern of libXXX.so or libXXX.a, +# you can simply specify XXX for the library. (e.g. the entry for +# "libtracker.so" would be "tracker") +# +# - for GCC-independent linking of standard C++ libraries, you can use +# $(STDCPPLIBS) instead of the raw "stdc++[.r4] [supc++]" library names. +# +# - if your library does not follow the standard library naming scheme, +# you need to specify the path to the library and it's name. +# (e.g. for mylib.a, specify "mylib.a" or "path/mylib.a") +LIBS = be tracker shared localestub sqlite3 bnetapi network netservices $(STDCPPLIBS) + +# Specify additional paths to directories following the standard libXXX.so +# or libXXX.a naming scheme. You can specify full paths or paths relative +# to the Makefile. The paths included are not parsed recursively, so +# include all of the paths where libraries must be found. Directories where +# source files were specified are automatically included. +LIBPATHS = + +# Additional paths to look for system headers. These use the form +# "#include
". 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) \ + $(shell findpaths -e B_FIND_PATH_HEADERS_DIRECTORY private/netservices) \ + $(shell findpaths -e B_FIND_PATH_HEADERS_DIRECTORY private/shared) \ + $(shell findpaths -e B_FIND_PATH_HEADERS_DIRECTORY private/support) + +# Additional paths paths to look for local headers. These use the form +# #include "header". Directories that contain the files in SRCS are +# automatically included. +LOCAL_INCLUDE_PATHS = + +# Specify the level of optimization that you want. Specify either NONE (O0), +# SOME (O1), FULL (O3), or leave blank (for the default optimization level). +OPTIMIZE := FULL + +# Specify the codes for languages you are going to support in this +# application. The default "en" one must be provided too. "make catkeys" +# will recreate only the "locales/en.catkeys" file. Use it as a template +# for creating catkeys for other languages. All localization files must be +# placed in the "locales" subdirectory. +LOCALES = en + +# Specify all the preprocessor symbols to be defined. The symbols will not +# have their values set automatically; you must supply the value (if any) to +# use. For example, setting DEFINES to "DEBUG=1" will cause the compiler +# option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG" would pass +# "-DDEBUG" on the compiler's command line. +DEFINES = + +# Specify the warning level. Either NONE (suppress all warnings), +# ALL (enable all warnings), or leave blank (enable default warnings). +WARNINGS = + +# With image symbols, stack crawls in the debugger are meaningful. +# If set to "TRUE", symbols will be created. +SYMBOLS := + +# Includes debug information, which allows the binary to be debugged easily. +# If set to "TRUE", debug info will be created. +DEBUGGER := + +# Specify any additional compiler flags to be used. +COMPILER_FLAGS = + +# Specify any additional linker flags to be used. +LINKER_FLAGS = + +# Specify the version of this binary. Example: +# -app 3 4 0 d 0 -short 340 -long "340 "`echo -n -e '\302\251'`"1999 GNU GPL" +# This may also be specified in a resource. +APP_VERSION := + +# (Only used when "TYPE" is "DRIVER"). Specify the desired driver install +# location in the /dev hierarchy. Example: +# DRIVER_PATH = video/usb +# will instruct the "driverinstall" rule to place a symlink to your driver's +# binary in ~/add-ons/kernel/drivers/dev/video/usb, so that your driver will +# appear at /dev/video/usb when loaded. The default is "misc". +DRIVER_PATH = + +## Include the Makefile-Engine +DEVEL_DIRECTORY := \ + $(shell findpaths -r "makefile_engine" B_FIND_PATH_DEVELOP_DIRECTORY) +include $(DEVEL_DIRECTORY)/etc/makefile-engine diff --git a/daemon/README.md b/daemon/README.md new file mode 100644 index 0000000..31eecd1 --- /dev/null +++ b/daemon/README.md @@ -0,0 +1,2 @@ +# calendar_daemon +A daemon app which will be responsible for sending reminders for the Calendar Application on Haiku OS diff --git a/daemon/locales/en.catkeys b/daemon/locales/en.catkeys new file mode 100644 index 0000000..2b18e58 --- /dev/null +++ b/daemon/locales/en.catkeys @@ -0,0 +1,22 @@ +1 English application/x-vnd.CalendarDaemon 3971020027 +Couldn't restore the deleted event― you might want to look in the Trash to find this event and manually restore it. QueryDBManager Couldn't restore the deleted event― you might want to look in the Trash to find this event and manually restore it. +Couldn't open event file because permission was denied. It usually means that you don't have read permissions to the event file or its parent directory, usually within the settings directory.Find out the file's location and try changing its permissions. QueryDBManager Couldn't open event file because permission was denied. It usually means that you don't have read permissions to the event file or its parent directory, usually within the settings directory.Find out the file's location and try changing its permissions. +Event file QueryDBManager Event file +{0, plural,=1{1 hour!}other{# hours!}} Daemon {0, plural,=1{1 hour!}other{# hours!}} +OK QueryDBManager OK +Birthday QueryDBManager Birthday +Couldn't restore the deleted event― it seems that it couldn't be found or doesn't exist. You might want to look in the Trash to find this event and manually restore it. QueryDBManager Couldn't restore the deleted event― it seems that it couldn't be found or doesn't exist. You might want to look in the Trash to find this event and manually restore it. +{0, plural,=1{1 second!}other{# seconds!}} Daemon {0, plural,=1{1 second!}other{# seconds!}} +Couldn't open event file because the path is not specified. It usually means that the programmer made a mistake. There is nothing you can do about it. Sorry. QueryDBManager Couldn't open event file because the path is not specified. It usually means that the programmer made a mistake. There is nothing you can do about it. Sorry. +{0, plural,=1{1 minute!}other{# minutes!}} Daemon {0, plural,=1{1 minute!}other{# minutes!}} +Couldn't open category file because permission was denied. It usually means that you don't have read permissions to the event file or its parent directory, usually within the settings directory.Find out the file's location and try changing its permissions. QueryDBManager Couldn't open category file because permission was denied. It usually means that you don't have read permissions to the event file or its parent directory, usually within the settings directory.Find out the file's location and try changing its permissions. +Restoring event QueryDBManager Restoring event +Couldn't move the event to Trash― you might want to use a Tracker query to find this event and manually delete it. QueryDBManager Couldn't move the event to Trash― you might want to use a Tracker query to find this event and manually delete it. +Category file QueryDBManager Category file +Couldn't open category file because the path is not specified. It usually means that the programmer made a mistake. There is nothing you can do about it. Sorry. QueryDBManager Couldn't open category file because the path is not specified. It usually means that the programmer made a mistake. There is nothing you can do about it. Sorry. +Couldn't move the event to trash― it seems that the event couldn't be found or doesn't exist. You might want to use a Tracker query to find this event and manually delete it. QueryDBManager Couldn't move the event to trash― it seems that the event couldn't be found or doesn't exist. You might want to use a Tracker query to find this event and manually delete it. +Default QueryDBManager Default +There is not enough memory available on your system to save the category file. If you want to have event updates saved, try closing a fewapplications and try again. QueryDBManager There is not enough memory available on your system to save the category file. If you want to have event updates saved, try closing a fewapplications and try again. +Calendar notification!\n\nEvent:\t%eventName%\nPlace:\t%eventPlace%\n\nThe event starts in Daemon Calendar notification!\n\nEvent:\t%eventName%\nPlace:\t%eventPlace%\n\nThe event starts in +There is not enough memory available on your system to save the event file. If you want to have event updates saved, try closing a few applications and try again. QueryDBManager There is not enough memory available on your system to save the event file. If you want to have event updates saved, try closing a few applications and try again. +Moving to Trash QueryDBManager Moving to Trash diff --git a/daemon/src/CalendarDaemon.cpp b/daemon/src/CalendarDaemon.cpp new file mode 100644 index 0000000..a8d8740 --- /dev/null +++ b/daemon/src/CalendarDaemon.cpp @@ -0,0 +1,347 @@ +/* + * Copyright 2022, Harshit Sharma, harshits908@gmail.com + * All rights reserved. Distributed under the terms of the MIT license. + */ + +#include "CalendarDaemon.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define START_ATTR "Event:Start" +#define DESCRIPTION_ATTR "Event:Description" +#define PLACE_ATTR "Event:Place" +#define NAME_ATTR "Event:Name" +#define CATNAME_ATTR "Event:Category" +#define REMINDER_ATTR "Event:Reminder" + +const char* kApplicationSignature = "application/x-vnd.CalendarDaemon"; + +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "Daemon" + + +void signalHandler(int signum) +{ + std::cout << "Interrupted Signal: " << signum << std::endl; + exit(signum); +} + + +int main() +{ + signal(SIGINT, signalHandler); + + CalendarDaemon app; + app.Run(); + + return 0; +} + + +/*! + CalendarDaemon Class Definitions +*/ + + +CalendarDaemon::CalendarDaemon() + : + BApplication(kApplicationSignature), + fQuitting(false), + fEventList() +{ + std::cout << "Creating Daemon" << std::endl; + + fEventLock = create_sem(1, "EventLock"); + fNotify = create_sem(0, "Notify"); + + BVolumeRoster volRoster; + volRoster.GetBootVolume(&fQueryVolume); + + BPath trashPath; + find_directory(B_TRASH_DIRECTORY, &trashPath); + fTrashDir = new BDirectory(trashPath.Path()); + + fDBManager = new QueryDBManager(); + + fEventLoop = spawn_thread(EventLoop, "EventLoop", B_NORMAL_PRIORITY, this); + resume_thread(fEventLoop); +} + + +void +CalendarDaemon::ReadyToRun() +{ + LockEvents(); + + fQuery.SetVolume(&fQueryVolume); + fQuery.PushAttr(REMINDER_ATTR); + fQuery.PushUInt32(time(NULL)); + fQuery.PushOp(B_GE); + + if (fQuery.SetTarget(this) != B_OK) + std::cout << "Query Target not set" << std::endl; + + fQuery.Fetch(); + entry_ref ref; + + while (fQuery.GetNextRef(&ref) == B_OK) + AddEventToList(&ref); + fEventList.SortItems(_CompareFunction); + ShowEvents(); + + UnlockEvents(); +} + + +CalendarDaemon::~CalendarDaemon() +{ + std::cout << "Stopping Daemon, Clearing Memory, Good Bye! ;)" << std::endl; + fEventList.MakeEmpty(); + stop_watching(be_app_messenger); + fQuitting = true; + Notify(); + + int32 res; + wait_for_thread(fEventLoop, &res); +} + + +void +CalendarDaemon::MessageReceived(BMessage *message) +{ + switch (message->what) { + case B_QUERY_UPDATE: + { + std::cout << "\nEvents Changed - Live Query" << std::endl; + RefreshEventList(); + break; + } + case B_NODE_MONITOR: + { + std::cout << "\nAttribute Changed - Node Monitor" << std::endl; + int32 opCode; + message->FindInt32("opcode", &opCode); + + if (opCode == B_ATTR_CHANGED) + RefreshEventList(); + break; + } + case B_QUIT_REQUESTED: + QuitRequested(); + break; + default: + BApplication::MessageReceived(message); + break; + } +} + + +void +CalendarDaemon::AddEventToList(entry_ref* ref) +{ + Event* event = _FileToEvent(ref); + + BEntry evEntry(ref); + bool inTrash = fTrashDir->Contains(&evEntry); + if (!inTrash) { + fEventList.AddItem(event); + + BNode node(ref); + node_ref nodeRef; + node.GetNodeRef(&nodeRef); + watch_node(&nodeRef, B_WATCH_ATTR, be_app_messenger); + } +} + + +int32 +CalendarDaemon::EventLoop(void* data) +{ + CalendarDaemon *app = (CalendarDaemon*)data; + + while (!app->fQuitting) { + app->LockEvents(); + + std::cout << "Thread Running" << std::endl; + app->fEventList.SortItems(_CompareFunction); + + while (app->fEventList.CountItems() > 0) { + Event* event = (Event*)app->fEventList.ItemAt(0); + + if (event->GetReminderTime() > real_time_clock()) { + std::cout << "Not yet" << std::endl; + break; + } + + time_t deltaTime = event->GetStartDateTime() - event->GetReminderTime(); + + BString alertText(B_TRANSLATE("Calendar notification!\n\n" + "Event:\t%eventName%\n" + "Place:\t%eventPlace%\n\n" + "The event starts in ")); + + alertText.ReplaceAll("%eventName%", event->GetName()); + alertText.ReplaceAll("%eventPlace%", event->GetPlace()); + + if (deltaTime%3600 == 0) { + deltaTime /= 3600; + static BStringFormat format(B_TRANSLATE("{0, plural," + "=1{1 hour!}" + "other{# hours!}}")); + format.Format(alertText, deltaTime); + } else if (deltaTime%60 == 0) { + deltaTime /= 60; + static BStringFormat format(B_TRANSLATE("{0, plural," + "=1{1 minute!}" + "other{# minutes!}}")); + format.Format(alertText, deltaTime); + } else { + static BStringFormat format(B_TRANSLATE("{0, plural," + "=1{1 second!}" + "other{# seconds!}}")); + format.Format(alertText, deltaTime); + } + BAlert* alert = new BAlert("Reminder!", alertText.String(), + "OK", NULL, NULL, B_WIDTH_AS_USUAL, + B_OFFSET_SPACING, B_WARNING_ALERT); + alert->SetShortcut(0, B_ESCAPE); + alert->Go(); + app->fEventList.RemoveItemAt((int32)0); + } + + bigtime_t timeout = -1; + if (app->fEventList.CountItems() > 0) { + Event* event = (Event*)app->fEventList.ItemAt(0); + timeout = (event->GetReminderTime() - real_time_clock()) * 1000000; + } + app->UnlockEvents(); + + if (timeout >= 0) + acquire_sem_etc(app->fNotify, 1, B_RELATIVE_TIMEOUT, timeout); + else + acquire_sem(app->fNotify); + } + + std::cout << "Thread Stopped!\n"; + return 0; +} + + +void +CalendarDaemon::RefreshEventList() +{ + stop_watching(be_app_messenger); + LockEvents(); + + fQuery.Clear(); + fQuery.SetVolume(&fQueryVolume); + fQuery.PushAttr(REMINDER_ATTR); + fQuery.PushUInt32(time(NULL)); + fQuery.PushOp(B_GE); + + if (fQuery.SetTarget(this) != B_OK) + std::cout << "Query Target not set" << std::endl; + + fQuery.Fetch(); + entry_ref ref; + fEventList.MakeEmpty(); + + while (fQuery.GetNextRef(&ref) == B_OK) + AddEventToList(&ref); + fEventList.SortItems(_CompareFunction); + + std::cout << "Unlocking after refreshing\n"; + ShowEvents(); + UnlockEvents(); + + if (fEventLoop) + Notify(); +} + + +void +CalendarDaemon::ShowEvents() +{ + if (fEventList.IsEmpty()) { + std::cout << "The List is empty!" << std::endl; + return; + } + + Event* event; + std::cout << std::endl; + for (int32 i=0 ; iGetName() << "\n"; + std::cout << "Event Place: " << event->GetPlace() << "\n\n"; + } + delete(event); +} + + +bool +CalendarDaemon::QuitRequested() +{ + return true; +} + + +Event* +CalendarDaemon::_FileToEvent(entry_ref* ref) +{ + BNode node(ref); + BEntry entry(ref); + if (node.InitCheck() != B_OK || entry.InitCheck() != B_OK) + return NULL; + + BString name = BString(); + BString catName = BString(); + BString idStr = BString(); + BString desc = BString(); + BString place = BString(); + BString statusStr = BString(); + node.ReadAttrString(NAME_ATTR, &name); + node.ReadAttrString(CATNAME_ATTR, &catName); + node.ReadAttrString("Calendar:ID", &idStr); + node.ReadAttrString(DESCRIPTION_ATTR, &desc); + node.ReadAttrString(PLACE_ATTR, &place); + node.ReadAttrString("Event:Status", &statusStr); + + time_t start = time(NULL); + time_t end = time(NULL); + time_t updated = time(NULL); + time_t reminder = time(NULL); + node.ReadAttr(START_ATTR, B_TIME_TYPE, 0, &start, sizeof(time_t)); + node.ReadAttr("Event:End", B_TIME_TYPE, 0, &end, sizeof(time_t)); + node.ReadAttr("Event:Updated", B_TIME_TYPE, 0, &updated, sizeof(time_t)); + node.ReadAttr(REMINDER_ATTR, B_TIME_TYPE, 0, &reminder, sizeof(time_t)); + + return new Event(name.String(), place.String(), desc.String(), false, + start, end, fDBManager->EnsureCategory(catName.String()), true, + reminder, updated, 0, idStr.String()); +} + + +int +CalendarDaemon::_CompareFunction(const Event* a, const Event* b) +{ + if (difftime(a->GetReminderTime(), b->GetReminderTime()) < 0) + return -1; + else if (difftime(a->GetReminderTime(), b->GetReminderTime()) > 0) + return 1; + else + return 0; +} diff --git a/daemon/src/CalendarDaemon.h b/daemon/src/CalendarDaemon.h new file mode 100644 index 0000000..9ec04f7 --- /dev/null +++ b/daemon/src/CalendarDaemon.h @@ -0,0 +1,79 @@ +/* + * Copyright 2018, Your Name + * All rights reserved. Distributed under the terms of the MIT license. + */ + +#ifndef CALENDAR_DAEMON_H +#define CALENDAR_DAEMON_H + +#include + +#include +#include +#include +#include + +#include "QueryDBManager.h" + +enum +{ + kEventAdded, + kEventRemoved, + kEventChanged, + kEventNotify, +}; + +class BMessage; +class BString; +class BVolume; +class BQuery; +class BDirectory; + + +/*! + CalendarDaemon Class Declaration +*/ + + +class CalendarDaemon : public BApplication +{ +public: + CalendarDaemon(); + ~CalendarDaemon(); + + void MessageReceived(BMessage* message); + bool QuitRequested(); + void ReadyToRun(); + //void Pulse(); + void SetFlags(uint32 mask); + + void AddEventToList(entry_ref* ref); + void ShowEvent(entry_ref* ref); + int32 CountEvents(); + void LockEvents() { acquire_sem(fEventLock); }; + void UnlockEvents() { release_sem(fEventLock); }; + void Notify() { release_sem(fNotify); }; + static int32 EventLoop(void* data); + void ShowEvents(); + void RefreshEventList(); + +private: + + Event* _FileToEvent(entry_ref* ref); + static int _CompareFunction(const Event* a, const Event* b); + + QueryDBManager* fDBManager; + + BDirectory* fTrashDir; + EventList fEventList; + BVolume fQueryVolume; + sem_id fEventLock; + sem_id fNotify; + thread_id fEventLoop; + bool fQuitting; + BQuery fQuery; +}; + +int main(); + +#endif diff --git a/daemon/src/CalendarDaemon.rdef b/daemon/src/CalendarDaemon.rdef new file mode 100644 index 0000000..53fb3f9 --- /dev/null +++ b/daemon/src/CalendarDaemon.rdef @@ -0,0 +1,12 @@ +resource app_signature "application/x-vnd.CalendarDaemon"; + +resource app_version { + short_info = "Calendar daemon", + long_info = "Notifies about upcoming events scheduled with Calendar" +}; + +resource app_flags B_SINGLE_LAUNCH | B_BACKGROUND_APP; + +resource file_types message { + "types" = "application/x-calendar-event" +}; \ No newline at end of file diff --git a/Makefile b/main/Makefile similarity index 96% rename from Makefile rename to main/Makefile index 2606712..594392b 100644 --- a/Makefile +++ b/main/Makefile @@ -52,11 +52,7 @@ SRCS = \ src/utils/ResourceLoader.cpp \ src/model/Category.cpp \ src/model/Event.cpp \ - src/db/QueryDBManager.cpp \ - src/db/SQLiteManager.cpp \ - src/plugin/GoogleCalendar/EventSync.cpp \ - src/plugin/GoogleCalendar/EventSyncWindow.cpp \ - src/plugin/GoogleCalendar/SynchronizationLoop.cpp + src/db/QueryDBManager.cpp # Specify the resource definition files to use. Full or relative paths can be # used. diff --git a/locales/ca.catkeys b/main/locales/ca.catkeys similarity index 100% rename from locales/ca.catkeys rename to main/locales/ca.catkeys diff --git a/locales/cs.catkeys b/main/locales/cs.catkeys similarity index 100% rename from locales/cs.catkeys rename to main/locales/cs.catkeys diff --git a/locales/de.catkeys b/main/locales/de.catkeys similarity index 100% rename from locales/de.catkeys rename to main/locales/de.catkeys diff --git a/locales/en.catkeys b/main/locales/en.catkeys similarity index 100% rename from locales/en.catkeys rename to main/locales/en.catkeys diff --git a/locales/en_GB.catkeys b/main/locales/en_GB.catkeys similarity index 100% rename from locales/en_GB.catkeys rename to main/locales/en_GB.catkeys diff --git a/locales/eo.catkeys b/main/locales/eo.catkeys similarity index 100% rename from locales/eo.catkeys rename to main/locales/eo.catkeys diff --git a/locales/es.catkeys b/main/locales/es.catkeys similarity index 100% rename from locales/es.catkeys rename to main/locales/es.catkeys diff --git a/locales/fur.catkeys b/main/locales/fur.catkeys similarity index 100% rename from locales/fur.catkeys rename to main/locales/fur.catkeys diff --git a/locales/it.catkeys b/main/locales/it.catkeys similarity index 100% rename from locales/it.catkeys rename to main/locales/it.catkeys diff --git a/locales/ro.catkeys b/main/locales/ro.catkeys similarity index 100% rename from locales/ro.catkeys rename to main/locales/ro.catkeys diff --git a/locales/sv.catkeys b/main/locales/sv.catkeys similarity index 100% rename from locales/sv.catkeys rename to main/locales/sv.catkeys diff --git a/locales/tr.catkeys b/main/locales/tr.catkeys similarity index 100% rename from locales/tr.catkeys rename to main/locales/tr.catkeys diff --git a/src/App.cpp b/main/src/App.cpp similarity index 98% rename from src/App.cpp rename to main/src/App.cpp index b19f500..6e2b50a 100644 --- a/src/App.cpp +++ b/main/src/App.cpp @@ -17,7 +17,6 @@ #include #include "CategoryWindow.h" -#include "EventSyncWindow.h" #include "EventWindow.h" #include "MainWindow.h" #include "PreferenceWindow.h" @@ -149,7 +148,7 @@ App::MessageReceived(BMessage* message) fCategoryWindow = NULL; break; - case kMenuSyncGCAL: + /*case kMenuSyncGCAL: { if (fEventSyncWindow == NULL) { fEventSyncWindow = new EventSyncWindow(); @@ -162,7 +161,7 @@ App::MessageReceived(BMessage* message) case kEventSyncWindowQuitting: fEventSyncWindow = NULL; - break; + break;*/ case kPreferenceWindowQuitting: fPreferenceWindow = NULL; diff --git a/src/App.h b/main/src/App.h similarity index 100% rename from src/App.h rename to main/src/App.h diff --git a/src/CalendarMenuWindow.cpp b/main/src/CalendarMenuWindow.cpp similarity index 100% rename from src/CalendarMenuWindow.cpp rename to main/src/CalendarMenuWindow.cpp diff --git a/src/CalendarMenuWindow.h b/main/src/CalendarMenuWindow.h similarity index 100% rename from src/CalendarMenuWindow.h rename to main/src/CalendarMenuWindow.h diff --git a/src/CalendarView.cpp b/main/src/CalendarView.cpp similarity index 100% rename from src/CalendarView.cpp rename to main/src/CalendarView.cpp diff --git a/src/CalendarView.h b/main/src/CalendarView.h similarity index 100% rename from src/CalendarView.h rename to main/src/CalendarView.h diff --git a/src/CategoryEditWindow.cpp b/main/src/CategoryEditWindow.cpp similarity index 100% rename from src/CategoryEditWindow.cpp rename to main/src/CategoryEditWindow.cpp diff --git a/src/CategoryEditWindow.h b/main/src/CategoryEditWindow.h similarity index 100% rename from src/CategoryEditWindow.h rename to main/src/CategoryEditWindow.h diff --git a/src/CategoryListItem.cpp b/main/src/CategoryListItem.cpp similarity index 100% rename from src/CategoryListItem.cpp rename to main/src/CategoryListItem.cpp diff --git a/src/CategoryListItem.h b/main/src/CategoryListItem.h similarity index 100% rename from src/CategoryListItem.h rename to main/src/CategoryListItem.h diff --git a/src/CategoryWindow.cpp b/main/src/CategoryWindow.cpp similarity index 99% rename from src/CategoryWindow.cpp rename to main/src/CategoryWindow.cpp index 8b2282a..543ae72 100644 --- a/src/CategoryWindow.cpp +++ b/main/src/CategoryWindow.cpp @@ -18,6 +18,7 @@ #include "App.h" #include "CategoryEditWindow.h" #include "CategoryListItem.h" +#include "Preferences.h" #include "QueryDBManager.h" #undef B_TRANSLATION_CONTEXT diff --git a/src/CategoryWindow.h b/main/src/CategoryWindow.h similarity index 100% rename from src/CategoryWindow.h rename to main/src/CategoryWindow.h diff --git a/src/ColorPreview.cpp b/main/src/ColorPreview.cpp similarity index 100% rename from src/ColorPreview.cpp rename to main/src/ColorPreview.cpp diff --git a/src/ColorPreview.h b/main/src/ColorPreview.h similarity index 100% rename from src/ColorPreview.h rename to main/src/ColorPreview.h diff --git a/src/DateHeaderButton.cpp b/main/src/DateHeaderButton.cpp similarity index 100% rename from src/DateHeaderButton.cpp rename to main/src/DateHeaderButton.cpp diff --git a/src/DateHeaderButton.h b/main/src/DateHeaderButton.h similarity index 100% rename from src/DateHeaderButton.h rename to main/src/DateHeaderButton.h diff --git a/src/EventListItem.cpp b/main/src/EventListItem.cpp similarity index 100% rename from src/EventListItem.cpp rename to main/src/EventListItem.cpp diff --git a/src/EventListItem.h b/main/src/EventListItem.h similarity index 100% rename from src/EventListItem.h rename to main/src/EventListItem.h diff --git a/src/EventListView.cpp b/main/src/EventListView.cpp similarity index 100% rename from src/EventListView.cpp rename to main/src/EventListView.cpp diff --git a/src/EventListView.h b/main/src/EventListView.h similarity index 100% rename from src/EventListView.h rename to main/src/EventListView.h diff --git a/src/EventTabView.cpp b/main/src/EventTabView.cpp similarity index 99% rename from src/EventTabView.cpp rename to main/src/EventTabView.cpp index dff20e4..8865a4e 100644 --- a/src/EventTabView.cpp +++ b/main/src/EventTabView.cpp @@ -15,6 +15,7 @@ #include "App.h" #include "EventListItem.h" #include "EventListView.h" +#include "Preferences.h" #include "QueryDBManager.h" #include "SidePanelView.h" diff --git a/src/EventTabView.h b/main/src/EventTabView.h similarity index 100% rename from src/EventTabView.h rename to main/src/EventTabView.h diff --git a/src/EventWindow.cpp b/main/src/EventWindow.cpp similarity index 88% rename from src/EventWindow.cpp rename to main/src/EventWindow.cpp index 97927a5..c1e117b 100644 --- a/src/EventWindow.cpp +++ b/main/src/EventWindow.cpp @@ -6,6 +6,7 @@ #include "EventWindow.h" #include +#include #include #include @@ -83,6 +84,10 @@ EventWindow::MessageReceived(BMessage* message) OnCheckBoxToggle(); break; + case kReminderPressed: + OnReminderCheckBoxToggle(); + break; + case kCancelPressed: PostMessage(B_QUIT_REQUESTED); break; @@ -253,6 +258,7 @@ EventWindow::OnSaveClick() time_t start; time_t end; + time_t reminderTime; BTime startTime; BTime endTime; @@ -301,10 +307,26 @@ EventWindow::OnSaveClick() Category* c = fCategoryList->ItemAt(index); category = new Category(*c); + if (fReminderCheckBox->Value() == B_CONTROL_ON) { + time_t deltaTime = std::stoi(fTextReminderTime->Text()); + BMenuItem* mI = fReminderMenu->FindMarked(); + int32 ind = fReminderMenu->IndexOf(mI); + + if (ind == 0) // hours + deltaTime *= 3600; + else if (ind == 1) // minutes + deltaTime *= 60; + + reminderTime = start - deltaTime; + } else { + reminderTime = -1; + } + Event newEvent(fTextName->Text(), fTextPlace->Text(), fTextDescription->Text(), fAllDayCheckBox->Value() == B_CONTROL_ON, - start, end, category, time(NULL), status); + start, end, category, fReminderCheckBox->Value() == B_CONTROL_ON, + reminderTime, time(NULL), status); if ((fNew == true) && (fDBManager->AddEvent(&newEvent))) CloseWindow(); @@ -384,6 +406,20 @@ EventWindow::OnCheckBoxToggle() } } +void +EventWindow::OnReminderCheckBoxToggle() +{ + if (fReminderCheckBox->Value() == B_CONTROL_ON) { + fTextReminderTime->SetText("0"); + fTextReminderTime->SetEnabled(true); + fReminderMenuField->SetEnabled(true); + } else { + fTextReminderTime->SetText(""); + fTextReminderTime->SetEnabled(false); + fReminderMenuField->SetEnabled(false); + } +} + void EventWindow::_InitInterface() @@ -397,6 +433,9 @@ EventWindow::_InitInterface() fTextEndDate = new BTextControl("EndDate", NULL, NULL, NULL); fTextStartTime = new BTextControl("StartTime", NULL, NULL, NULL); fTextEndTime = new BTextControl("EndTime", NULL, NULL, NULL); + fTextReminderTime = new BTextControl("ReminderTime", + B_TRANSLATE("Notify before Event:"), NULL, NULL); + fTextReminderTime->SetEnabled(false); const char* tooltip = B_TRANSLATE("Enter the time in HH:mm (24 hour) format."); @@ -411,6 +450,8 @@ EventWindow::_InitInterface() fAllDayCheckBox->SetValue(B_CONTROL_OFF); fCancelledCheckBox = new BCheckBox(B_TRANSLATE("Cancelled"), NULL); fHiddenCheckBox = new BCheckBox(B_TRANSLATE("Hidden"), NULL); + fReminderCheckBox = new BCheckBox(NULL, + new BMessage(kReminderPressed)); fEveryMonth = new BRadioButton( "EveryMonth", B_TRANSLATE("Monthly"), new BMessage(kOptEveryMonth)); @@ -465,12 +506,24 @@ EventWindow::_InitInterface() fCategoryMenu->SetLabelFromMarked(true); fCategoryMenu->ItemAt(0)->SetMarked(true); + fReminderMenu = new BMenu("ReminderMenu"); + fReminderMenu->AddItem(new BMenuItem("hours", NULL)); + fReminderMenu->AddItem(new BMenuItem("minutes", NULL)); + fReminderMenu->AddItem(new BMenuItem("seconds", NULL)); + fReminderMenu->SetRadioMode(true); + fReminderMenu->SetLabelFromMarked(true); + fReminderMenu->ItemAt(1)->SetMarked(true); + fStartDateEdit = new BMenu(B_TRANSLATE("Start date")); fEndDateEdit = new BMenu(B_TRANSLATE("End date")); fCategoryMenuField = new BMenuField("CategoryMenuField", NULL, fCategoryMenu); + fReminderMenuField + = new BMenuField("ReminderMenuField", NULL, fReminderMenu); + fReminderMenuField->SetEnabled(false); + BBox* fStatusBox = new BBox("StatusBox"); BLayoutBuilder::Group<>(fStatusBox, B_VERTICAL, B_USE_HALF_ITEM_SPACING) .SetInsets(B_USE_ITEM_INSETS) @@ -537,6 +590,11 @@ EventWindow::_InitInterface() .End() .Add(fDescriptionLabel) .Add(fTextDescription) + .AddGroup(B_HORIZONTAL) + .Add(fReminderCheckBox) + .Add(fTextReminderTime) + .Add(fReminderMenuField) + .End() .AddGrid() .Add(fCategoryLabel, 0, 0) .Add(fCategoryMenuField, 1, 0) @@ -612,6 +670,31 @@ EventWindow::_PopulateWithEvent(Event* event) fTextEndTime->SetText(GetLocaleTimeString(event->GetEndDateTime())); } + if (event->IsReminded()) { + fReminderCheckBox->SetValue(B_CONTROL_ON); + fTextReminderTime->SetEnabled(true); + fReminderMenuField->SetEnabled(true); + time_t deltaTime = event->GetStartDateTime() - event->GetReminderTime(); + int32 ind = 2; + + if (deltaTime%3600 == 0) { // hours + ind = 0; + deltaTime /= 3600; + } + else if (deltaTime%60 == 0) { // minutes + ind = 1; + deltaTime /= 60; + } + + fTextReminderTime->SetText(std::to_string(deltaTime).c_str()); + + fReminderMenu->ItemAt(ind)->SetMarked(true); + } else { + fReminderCheckBox->SetValue(B_CONTROL_OFF); + fTextReminderTime->SetEnabled(false); + fReminderMenuField->SetEnabled(false); + } + uint16 status = 0; if (event != NULL) status = event->GetStatus(); diff --git a/src/EventWindow.h b/main/src/EventWindow.h similarity index 93% rename from src/EventWindow.h rename to main/src/EventWindow.h index 1df19ab..0c3b2e8 100644 --- a/src/EventWindow.h +++ b/main/src/EventWindow.h @@ -50,6 +50,7 @@ class EventWindow : public BWindow void SetEndDate(BDate& date); void OnCheckBoxToggle(); + void OnReminderCheckBoxToggle(); void OnSaveClick(); void OnDeleteClick(); void CloseWindow(); @@ -71,6 +72,7 @@ class EventWindow : public BWindow static const uint32 kAllDayPressed = 1003; static const uint32 kOptEveryMonth = 1004; static const uint32 kOptEveryYear = 1005; + static const uint32 kReminderPressed = 1006; BTextControl* fTextName; BTextControl* fTextPlace; @@ -78,6 +80,7 @@ class EventWindow : public BWindow BTextControl* fTextEndDate; BTextControl* fTextStartTime; BTextControl* fTextEndTime; + BTextControl* fTextReminderTime; BTextView* fTextDescription; BView* fMainView; @@ -85,8 +88,10 @@ class EventWindow : public BWindow BMenu* fCategoryMenu; BMenu* fStartDateEdit; BMenu* fEndDateEdit; + BMenu* fReminderMenu; BMenuField* fCategoryMenuField; + BMenuField* fReminderMenuField; BStringView* fNameLabel; BStringView* fPlaceLabel; @@ -108,6 +113,7 @@ class EventWindow : public BWindow BCheckBox* fAllDayCheckBox; BCheckBox* fCancelledCheckBox; BCheckBox* fHiddenCheckBox; + BCheckBox* fReminderCheckBox; BBox* fStartDateBox; BBox* fEndDateBox; diff --git a/src/MainView.cpp b/main/src/MainView.cpp similarity index 100% rename from src/MainView.cpp rename to main/src/MainView.cpp diff --git a/src/MainView.h b/main/src/MainView.h similarity index 100% rename from src/MainView.h rename to main/src/MainView.h diff --git a/src/MainWindow.cpp b/main/src/MainWindow.cpp similarity index 99% rename from src/MainWindow.cpp rename to main/src/MainWindow.cpp index d5b436a..c06bed1 100644 --- a/src/MainWindow.cpp +++ b/main/src/MainWindow.cpp @@ -24,7 +24,6 @@ #include "CategoryEditWindow.h" #include "Event.h" #include "EventListView.h" -#include "EventSyncWindow.h" #include "EventTabView.h" #include "EventWindow.h" #include "MainView.h" @@ -131,9 +130,11 @@ MainWindow::MessageReceived(BMessage* message) fEventsView->MessageReceived(message); break; case kSelectedDateChanged: - case kSynchronizationComplete: _UpdateEventsView(); break; + /*case kSynchronizationComplete: + _UpdateEventsView(); + break;*/ case kSelectionMessage: fSidePanelView->MessageReceived(message); break; diff --git a/src/MainWindow.h b/main/src/MainWindow.h similarity index 100% rename from src/MainWindow.h rename to main/src/MainWindow.h diff --git a/src/NotificationLoop.cpp b/main/src/NotificationLoop.cpp similarity index 100% rename from src/NotificationLoop.cpp rename to main/src/NotificationLoop.cpp diff --git a/src/PreferenceWindow.cpp b/main/src/PreferenceWindow.cpp similarity index 100% rename from src/PreferenceWindow.cpp rename to main/src/PreferenceWindow.cpp diff --git a/src/PreferenceWindow.h b/main/src/PreferenceWindow.h similarity index 100% rename from src/PreferenceWindow.h rename to main/src/PreferenceWindow.h diff --git a/src/Preferences.cpp b/main/src/Preferences.cpp similarity index 100% rename from src/Preferences.cpp rename to main/src/Preferences.cpp diff --git a/src/Preferences.h b/main/src/Preferences.h similarity index 100% rename from src/Preferences.h rename to main/src/Preferences.h diff --git a/src/SidePanelView.cpp b/main/src/SidePanelView.cpp similarity index 100% rename from src/SidePanelView.cpp rename to main/src/SidePanelView.cpp diff --git a/src/SidePanelView.h b/main/src/SidePanelView.h similarity index 100% rename from src/SidePanelView.h rename to main/src/SidePanelView.h diff --git a/src/calendar.rdef b/main/src/calendar.rdef similarity index 100% rename from src/calendar.rdef rename to main/src/calendar.rdef diff --git a/src/db/QueryDBManager.cpp b/main/src/db/QueryDBManager.cpp similarity index 97% rename from src/db/QueryDBManager.cpp rename to main/src/db/QueryDBManager.cpp index cfc001d..a697077 100644 --- a/src/db/QueryDBManager.cpp +++ b/main/src/db/QueryDBManager.cpp @@ -17,16 +17,14 @@ #include #include -#include "App.h" -#include "Preferences.h" #include "ResourceLoader.h" -#include "SQLiteManager.h" #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "QueryDBManager" const char* kEventDir = "events"; const char* kCategoryDir = "categories"; +const char* kDirectoryName = "Calendar"; QueryDBManager::QueryDBManager() @@ -71,9 +69,9 @@ QueryDBManager::_Initialize() } // Migrate from SQL, if necessary - BPath sqlPath = _SettingsPath(kDatabaseName); + /*BPath sqlPath = _SettingsPath(kDatabaseName); if (BEntry(sqlPath.Path()).Exists()) - _ImportFromSQL(sqlPath); + _ImportFromSQL(sqlPath);*/ // Migrate pre-"Cancel/Delete"-dichtonomy events BPath cancelPath = _SettingsPath("cancelled"); @@ -456,7 +454,7 @@ QueryDBManager::GetAllCategories() BFile catFile; Category* category; - BString defaultCat = ((App*) be_app)->GetPreferences()->fDefaultCategory; + BString defaultCat = "Default"; while (query.GetNextRef(&ref) == B_OK) { if (fTrashDir->Contains(BPath(&ref).Path()) == true) @@ -626,6 +624,12 @@ QueryDBManager::_FileToEvent(entry_ref* ref) && end <= dayEnd + 59) allDay = true; + time_t reminder = time(NULL); + bool reminded = true; + if (node.ReadAttr("Event:Reminder", B_TIME_TYPE, 0, &reminder, sizeof(time_t)) + == B_ENTRY_NOT_FOUND) + reminded = false; + uint16 status = 0; if (statusStr.FindFirst("Notified") >= 0) status |= EVENT_NOTIFIED; @@ -637,8 +641,8 @@ QueryDBManager::_FileToEvent(entry_ref* ref) status |= EVENT_DELETED; return new Event(name.String(), place.String(), desc.String(), allDay, - start, end, EnsureCategory(catName.String()), updated, status, - idStr.String()); + start, end, EnsureCategory(catName.String()), reminded, reminder, + updated, status, idStr.String()); } @@ -741,6 +745,10 @@ QueryDBManager::_EventToFile(Event* event, BFile* file) time_t end = event->GetEndDateTime(); file->WriteAttr("Event:End", B_TIME_TYPE, 0, &end, sizeof(time_t)); + time_t reminder = event->GetReminderTime(); + if (reminder != -1) + file->WriteAttr("Event:Reminder", B_TIME_TYPE, 0, &reminder, sizeof(time_t)); + const char* icon_type = "EVENT_ICON"; if (statusInt & EVENT_HIDDEN) icon_type = "EVENT_HIDDEN_ICON"; @@ -987,6 +995,7 @@ QueryDBManager::_EventMimetype() _AddAttribute(info, "Event:Description", "Description", B_STRING_TYPE, true, 200); _AddAttribute(info, "Event:Place", "Place", B_STRING_TYPE, true, 200); _AddAttribute(info, "Event:Updated", "Updated", B_TIME_TYPE, true, 150); + _AddAttribute(info, "Event:Reminder", "Reminder", B_TIME_TYPE, true, 150); _AddAttribute(info, "Event:Status", "Status", B_STRING_TYPE, true, 50); _AddAttribute(info, "Calendar:ID", "ID", B_STRING_TYPE, true, 100); @@ -1017,6 +1026,7 @@ QueryDBManager::_AddIndices() fs_create_index(device, "Event:Start", B_INT32_TYPE, 0); fs_create_index(device, "Event:End", B_INT32_TYPE, 0); fs_create_index(device, "Event:Updated", B_INT32_TYPE, 0); + fs_create_index(device, "Event:Reminder", B_INT32_TYPE, 0); fs_create_index(device, "Event:Status", B_STRING_TYPE, 0); fs_create_index(device, "Calendar:ID", B_STRING_TYPE, 0); fs_create_index(device, "Category:Name", B_STRING_TYPE, 0); @@ -1039,7 +1049,7 @@ QueryDBManager::_AddAttribute(BMessage& msg, const char* name, } -void +/*void QueryDBManager::_ImportFromSQL(BPath dbPath) { SQLiteManager* sql = new SQLiteManager(); @@ -1054,7 +1064,7 @@ QueryDBManager::_ImportFromSQL(BPath dbPath) delete (sql); BEntry(dbPath.Path()).Rename("events.sql.bak"); -} +}*/ // "Cancelled" was previously synonymous with "Deleted"― so on first run after diff --git a/src/db/QueryDBManager.h b/main/src/db/QueryDBManager.h similarity index 99% rename from src/db/QueryDBManager.h rename to main/src/db/QueryDBManager.h index 2683771..ec554e5 100644 --- a/src/db/QueryDBManager.h +++ b/main/src/db/QueryDBManager.h @@ -13,7 +13,6 @@ #include "Category.h" #include "Event.h" -#include "Preferences.h" class Category; class Event; diff --git a/src/db/SQLiteManager.cpp b/main/src/db/SQLiteManager.cpp similarity index 100% rename from src/db/SQLiteManager.cpp rename to main/src/db/SQLiteManager.cpp diff --git a/src/db/SQLiteManager.h b/main/src/db/SQLiteManager.h similarity index 100% rename from src/db/SQLiteManager.h rename to main/src/db/SQLiteManager.h diff --git a/src/model/Category.cpp b/main/src/model/Category.cpp similarity index 100% rename from src/model/Category.cpp rename to main/src/model/Category.cpp diff --git a/src/model/Category.h b/main/src/model/Category.h similarity index 100% rename from src/model/Category.h rename to main/src/model/Category.h diff --git a/src/model/Event.cpp b/main/src/model/Event.cpp similarity index 80% rename from src/model/Event.cpp rename to main/src/model/Event.cpp index e8b0b5e..85c0e40 100644 --- a/src/model/Event.cpp +++ b/main/src/model/Event.cpp @@ -11,8 +11,8 @@ Event::Event(const char* name, const char* place, const char* description, bool allday, time_t start, time_t end, Category* category, - time_t updated /*=time(NULL)*/, uint16 status /*= 0 */, - const char* id /*= NULL*/) + bool reminded, time_t reminderTime, time_t updated /*=time(NULL)*/, + uint16 status /*= 0 */, const char* id /*= NULL*/) { fName = name; fPlace = place; @@ -25,6 +25,9 @@ Event::Event(const char* name, const char* place, const char* description, fCategory = new Category(*category); + fReminded = reminded; + fReminderTime = reminderTime; + if (id == NULL) fId = BUuid().SetToRandom().ToString(); else @@ -44,6 +47,8 @@ Event::Event(Event& event) fEnd = event.GetEndDateTime(); fUpdated = event.GetUpdated(); fStatus = event.GetStatus(); + fReminded = event.IsReminded(); + fReminderTime = event.GetReminderTime(); } @@ -179,3 +184,27 @@ Event::Equals(Event& e) const { return (fId == e.GetId()); } + +bool +Event::IsReminded() const +{ + return fReminded; +} + +void +Event::SetReminded(bool reminded) +{ + fReminded = reminded; +} + +time_t +Event::GetReminderTime() const +{ + return fReminderTime; +} + +void +Event::SetReminderTime(time_t reminderTime) +{ + fReminderTime = reminderTime; +} diff --git a/src/model/Event.h b/main/src/model/Event.h similarity index 82% rename from src/model/Event.h rename to main/src/model/Event.h index 547e631..af94691 100644 --- a/src/model/Event.h +++ b/main/src/model/Event.h @@ -25,7 +25,8 @@ class Event public: Event(const char* name, const char* place, const char* description, bool allday, time_t start, time_t end, Category* category, - time_t updated = time(NULL), uint16 status = 0, const char* id = NULL); + bool reminded, time_t reminderTime, time_t updated = time(NULL), + uint16 status = 0, const char* id = NULL); Event(Event& event); time_t GetStartDateTime() const; @@ -54,6 +55,12 @@ class Event time_t GetUpdated() const; void SetUpdated(time_t updated); + time_t GetReminderTime() const; + void SetReminderTime(time_t reminderTime); + + bool IsReminded() const; + void SetReminded(bool reminded); + bool Equals(Event& e) const; private: @@ -65,8 +72,10 @@ class Event time_t fStart; time_t fEnd; time_t fUpdated; + time_t fReminderTime; bool fAllDay; + bool fReminded; int16 fStatus; Category* fCategory; diff --git a/src/plugin/GoogleCalendar/EventSync.cpp b/main/src/plugin/GoogleCalendar/EventSync.cpp similarity index 100% rename from src/plugin/GoogleCalendar/EventSync.cpp rename to main/src/plugin/GoogleCalendar/EventSync.cpp diff --git a/src/plugin/GoogleCalendar/EventSync.h b/main/src/plugin/GoogleCalendar/EventSync.h similarity index 100% rename from src/plugin/GoogleCalendar/EventSync.h rename to main/src/plugin/GoogleCalendar/EventSync.h diff --git a/src/plugin/GoogleCalendar/EventSyncWindow.cpp b/main/src/plugin/GoogleCalendar/EventSyncWindow.cpp similarity index 100% rename from src/plugin/GoogleCalendar/EventSyncWindow.cpp rename to main/src/plugin/GoogleCalendar/EventSyncWindow.cpp diff --git a/src/plugin/GoogleCalendar/EventSyncWindow.h b/main/src/plugin/GoogleCalendar/EventSyncWindow.h similarity index 100% rename from src/plugin/GoogleCalendar/EventSyncWindow.h rename to main/src/plugin/GoogleCalendar/EventSyncWindow.h diff --git a/src/plugin/GoogleCalendar/Requests.h b/main/src/plugin/GoogleCalendar/Requests.h similarity index 100% rename from src/plugin/GoogleCalendar/Requests.h rename to main/src/plugin/GoogleCalendar/Requests.h diff --git a/src/plugin/GoogleCalendar/SynchronizationLoop.cpp b/main/src/plugin/GoogleCalendar/SynchronizationLoop.cpp similarity index 100% rename from src/plugin/GoogleCalendar/SynchronizationLoop.cpp rename to main/src/plugin/GoogleCalendar/SynchronizationLoop.cpp diff --git a/src/utils/ColorConverter.cpp b/main/src/utils/ColorConverter.cpp similarity index 100% rename from src/utils/ColorConverter.cpp rename to main/src/utils/ColorConverter.cpp diff --git a/src/utils/ColorConverter.h b/main/src/utils/ColorConverter.h similarity index 100% rename from src/utils/ColorConverter.h rename to main/src/utils/ColorConverter.h diff --git a/src/utils/ICal.cpp b/main/src/utils/ICal.cpp similarity index 99% rename from src/utils/ICal.cpp rename to main/src/utils/ICal.cpp index c9738f7..e9801fd 100644 --- a/src/utils/ICal.cpp +++ b/main/src/utils/ICal.cpp @@ -207,7 +207,7 @@ VEventToEvent(BStringList* vevent, QueryDBManager* DBManager) delete properties; return new Event(name.String(), place.String(), desc.String(), allDay, - start.Time_t(), end.Time_t(), category, updated.Time_t(), status, + start.Time_t(), end.Time_t(), category, true, start.Time_t(), updated.Time_t(), status, uid.String()); } diff --git a/src/utils/ICal.h b/main/src/utils/ICal.h similarity index 100% rename from src/utils/ICal.h rename to main/src/utils/ICal.h diff --git a/src/utils/ResourceLoader.cpp b/main/src/utils/ResourceLoader.cpp similarity index 100% rename from src/utils/ResourceLoader.cpp rename to main/src/utils/ResourceLoader.cpp diff --git a/src/utils/ResourceLoader.h b/main/src/utils/ResourceLoader.h similarity index 100% rename from src/utils/ResourceLoader.h rename to main/src/utils/ResourceLoader.h