Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: HaikuArchives/Calendar
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 12e1362b7b12
Choose a base ref
...
head repository: HaikuArchives/Calendar
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 07ce04b2b5ba
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Dec 22, 2021

  1. Add Help menu item

    Opens Documentation.html.
    Needs to be packaged in $docDir with haikuporter, i.e. it ends up in
    documentation/packages/calendar
    Humdinger committed Dec 22, 2021
    Copy the full SHA
    1c05b51 View commit details
  2. Tint hidden/deleted events red

    to avoid them being mistaken as selected items.
    Fixes #113
    Humdinger committed Dec 22, 2021
    Copy the full SHA
    07ce04b View commit details
Showing with 39 additions and 1 deletion.
  1. +6 −1 src/EventListItem.cpp
  2. +31 −0 src/MainWindow.cpp
  3. +2 −0 src/MainWindow.h
7 changes: 6 additions & 1 deletion src/EventListItem.cpp
Original file line number Diff line number Diff line change
@@ -63,6 +63,11 @@ EventListItem::DrawItem(BView* view, BRect rect, bool complete)
bgColor = ui_color(B_LIST_BACKGROUND_COLOR);
bgColor = TintColor(bgColor, bgColor, severity);

if (severity >= 1) {
rgb_color hideDeleteColor = { 255, 0, 0, 255 };
bgColor = mix_color(bgColor, hideDeleteColor, 64);
}

view->SetHighColor(bgColor);
view->SetLowColor(bgColor);
view->FillRect(rect);
@@ -99,7 +104,7 @@ EventListItem::DrawItem(BView* view, BRect rect, bool complete)
else
textColor = ui_color(B_LIST_ITEM_TEXT_COLOR);
view->SetHighColor(TintColor(textColor, textColor, 1));

view->MovePenTo(offset,
rect.top + timefont.Size() - namefont.Size() + 6 + ((rect.Height()
- (finfo.ascent + finfo.descent + finfo.leading)) / 2)
31 changes: 31 additions & 0 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
@@ -13,6 +13,9 @@
#include <MenuItem.h>
#include <MenuBar.h>
#include <NodeInfo.h>
#include <PathFinder.h>
#include <Roster.h>
#include <StringList.h>
#include <vector>

#include "App.h"
@@ -188,6 +191,9 @@ MainWindow::MessageReceived(BMessage* message)
case kMenuSyncGCAL:
be_app->PostMessage(message);
break;
case kMenuHelp:
_OpenHelp();
break;
case kRefreshCategoryList:
{
_UpdateEventsView();
@@ -235,6 +241,8 @@ MainWindow::_InitInterface()
new BMessage(B_ABOUT_REQUESTED));
item->SetTarget(be_app);
fAppMenu->AddItem(item);
fAppMenu->AddItem(new BMenuItem(B_TRANSLATE("Help" B_UTF8_ELLIPSIS),
new BMessage(kMenuHelp)));
fAppMenu->AddItem(new BMenuItem(B_TRANSLATE("Settings" B_UTF8_ELLIPSIS),
new BMessage(kMenuAppPref), ',', B_COMMAND_KEY));
//
@@ -339,6 +347,29 @@ MainWindow::_LaunchEventManager(Event* event, entry_ref* ref)
}


void
MainWindow::_OpenHelp()
{
BPathFinder pathFinder;
BStringList paths;
BPath path;
BEntry entry;

status_t error = pathFinder.FindPaths(B_FIND_PATH_DOCUMENTATION_DIRECTORY,
"packages/calendar", paths);

for (int i = 0; i < paths.CountStrings(); ++i) {
if (error == B_OK && path.SetTo(paths.StringAt(i)) == B_OK
&& path.Append("Documentation.html") == B_OK) {
entry = path.Path();
entry_ref ref;
entry.GetRef(&ref);
be_roster->Launch(&ref);
}
}
}


void
MainWindow::_SetEventListPopUpEnabled(bool state)
{
2 changes: 2 additions & 0 deletions src/MainWindow.h
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ class SidePanelView;

static const uint32 kMenuAppPref = 'kmap';
static const uint32 kMenuCategoryEdit = 'kmce';
static const uint32 kMenuHelp = 'kmhl';
static const uint32 kMenuSyncGCAL = 'kmsg';

static const int kAddEventMessage = 1005;
@@ -38,6 +39,7 @@ class MainWindow: public BWindow {
private:
void _InitInterface();
void _LaunchEventManager(Event* event, entry_ref* ref = NULL);
void _OpenHelp();
void _SyncWithPreferences();
void _UpdateEventsView();
void _SetEventListPopUpEnabled(bool state);