-// AppXesitaCalendar.cpp - Xestia Calendar application form code
-//
-// (c) 2016-2017 Xestia Software Development.
-//
-// This file is part of Xestia Calendar.
-//
-// Xestia Calendar is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation, version 3 of the license.
-//
-// Xestia Calendar is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY 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 Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
-
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Nov 13 2016)
+// C++ code generated with wxFormBuilder (version Dec 21 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
menuBar->Append( mnuCreate, wxT("Create") );
+ mnuView = new wxMenu();
+ wxMenuItem* mnuViewActMgr;
+ mnuViewActMgr = new wxMenuItem( mnuView, wxID_ANY, wxString( wxT("Activity Manager") ) , wxEmptyString, wxITEM_NORMAL );
+ mnuView->Append( mnuViewActMgr );
+
+ menuBar->Append( mnuView, wxT("View") );
+
mnuWindow = new wxMenu();
menuBar->Append( mnuWindow, wxT("Window") );
this->Connect( mnuManageExit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::QuitApp ) );
this->Connect( mnuCreateCalendar->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::CreateNewCalendar ) );
this->Connect( mnuCreateEvent->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::CreateNewEvent ) );
+ this->Connect( mnuViewActMgr->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::ShowActivityManager ) );
this->Connect( mnuHelpShow->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::ShowHelp ) );
this->Connect( mnuHelpUpdate->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::ShowUpdateWindow ) );
this->Connect( mnuHelpAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::ShowAboutWindow ) );
this->Disconnect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::QuitApp ) );
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::CreateNewCalendar ) );
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::CreateNewEvent ) );
+ this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::ShowActivityManager ) );
this->Disconnect( wxID_HELP, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::ShowHelp ) );
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::ShowUpdateWindow ) );
this->Disconnect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( frmMainADT::ShowAboutWindow ) );
lblType->Wrap( -1 );
fgSizer33->Add( lblType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
- wxString cmbServerTypeChoices[] = { wxT("Local") };
+ wxString cmbServerTypeChoices[] = { wxT("Local"), wxT("CalDAV") };
int cmbServerTypeNChoices = sizeof( cmbServerTypeChoices ) / sizeof( wxString );
cmbServerType = new wxChoice( tabType, wxID_ANY, wxDefaultPosition, wxDefaultSize, cmbServerTypeNChoices, cmbServerTypeChoices, 0 );
cmbServerType->SetSelection( 0 );
wxBoxSizer* bSizer322;
bSizer322 = new wxBoxSizer( wxHORIZONTAL );
- btnPrevious = new wxButton( this, wxID_ANY, wxT("< Previous"), wxDefaultPosition, wxDefaultSize, 0 );
+ btnPrevious = new wxButton( this, wxID_PREV, wxT("< Previous"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer322->Add( btnPrevious, 0, wxALL, 5 );
- btnNext = new wxButton( this, wxID_ANY, wxT("Next >"), wxDefaultPosition, wxDefaultSize, 0 );
+ btnNext = new wxButton( this, wxID_NEXT, wxT("Next >"), wxDefaultPosition, wxDefaultSize, 0 );
btnNext->SetDefault();
bSizer322->Add( btnNext, 0, wxALL, 5 );
// Connect Events
cmbServerType->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( frmNewAccountADT::UpdateRequirements ), NULL, this );
txtAccountName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( frmNewAccountADT::CheckAccountName ), NULL, this );
- btnPrevious->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmNewAccountADT::ProcessPrevious ), NULL, this );
- btnNext->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmNewAccountADT::ProcessNext ), NULL, this );
+ btnPrevious->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmNewAccountADT::Navigate ), NULL, this );
+ btnNext->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmNewAccountADT::Navigate ), NULL, this );
btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmNewAccountADT::CloseWindow ), NULL, this );
}
// Disconnect Events
cmbServerType->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( frmNewAccountADT::UpdateRequirements ), NULL, this );
txtAccountName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( frmNewAccountADT::CheckAccountName ), NULL, this );
- btnPrevious->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmNewAccountADT::ProcessPrevious ), NULL, this );
- btnNext->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmNewAccountADT::ProcessNext ), NULL, this );
+ btnPrevious->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmNewAccountADT::Navigate ), NULL, this );
+ btnNext->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmNewAccountADT::Navigate ), NULL, this );
btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmNewAccountADT::CloseWindow ), NULL, this );
}
-// AppXesitaCalendar.h - Xestia Calendar application form code header
-//
-// (c) 2016-2017 Xestia Software Development.
-//
-// This file is part of Xestia Calendar.
-//
-// Xestia Calendar is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation, version 3 of the license.
-//
-// Xestia Calendar is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY 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 Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
-
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Nov 13 2016)
+// C++ code generated with wxFormBuilder (version Dec 21 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
+#define wxID_PREV 1000
+#define wxID_NEXT 1001
///////////////////////////////////////////////////////////////////////////////
/// Class frmMainADT
wxMenuBar* menuBar;
wxMenu* mnuManage;
wxMenu* mnuCreate;
+ wxMenu* mnuView;
wxMenu* mnuWindow;
wxMenu* mnuHelp;
wxBoxSizer* szrMain;
virtual void QuitApp( wxCommandEvent& event ) { event.Skip(); }
virtual void CreateNewCalendar( wxCommandEvent& event ) { event.Skip(); }
virtual void CreateNewEvent( wxCommandEvent& event ) { event.Skip(); }
+ virtual void ShowActivityManager( wxCommandEvent& event ) { event.Skip(); }
virtual void ShowHelp( wxCommandEvent& event ) { event.Skip(); }
virtual void ShowUpdateWindow( wxCommandEvent& event ) { event.Skip(); }
virtual void ShowAboutWindow( wxCommandEvent& event ) { event.Skip(); }
// Virtual event handlers, overide them in your derived class
virtual void UpdateRequirements( wxCommandEvent& event ) { event.Skip(); }
virtual void CheckAccountName( wxCommandEvent& event ) { event.Skip(); }
- virtual void ProcessPrevious( wxCommandEvent& event ) { event.Skip(); }
- virtual void ProcessNext( wxCommandEvent& event ) { event.Skip(); }
+ virtual void Navigate( wxCommandEvent& event ) { event.Skip(); }
virtual void CloseWindow( wxCommandEvent& event ) { event.Skip(); }
COMMONOBJS=common/monthviewgen.o common/file.o common/text.o \
common/uuid.o common/preferences.o common/dirs.o common/defaults.o \
common/random.o common/svrblist.o
-FORM_MAINOBJS=forms/main/frmMain.o forms/main/frmMain-Window.o
+FORM_MAINOBJS=forms/main/frmMain.o forms/main/frmMain-Window.o \
+ forms/main/frmMain-Setup.o
FORM_UPDATEOBJS=forms/update/frmUpdate.o
FORM_EDITACCOUNTOBJS=forms/editaccount/frmEditAccount.o
FORM_NEWACCOUNTOBJS=forms/newaccount/frmNewAccount.o
FORM_EVENTEDITOROBJS=forms/eventeditor/frmEventEditor.o
FORM_PREFERENCESOBJS=forms/preferences/frmPreferences.o
FORM_ABOUTOBJS=forms/about/frmAbout.o
+FORM_ACTMGROBJS=forms/actmgr/frmActivityMgr.o
WIDGETSOBJS=widgets/XCCalendarCtrl.o widgets/XCCalendarDay.o \
widgets/XCCalendarDayEntry.o widgets/XCCalendarMonthView.o \
widgets/XCCalendarMonthViewDayTitle.o \
CALENDAREVENTOBJS=objects/calendarevent/CalendarEvent-Save.o \
objects/calendarevent/CalendarEvent.o
CDSOBJS=libraries/CalendarDataStorage/CalendarDataStorage.o
+CALDAVOBJS=objects/CalDAV/CalDAV.o objects/CalDAV/CalDAV-XMLProcessing.o
default:
$(MAKE) bitmaphelper
forms: form_mainobjs form_editaccountobjs form_newaccountobjs \
form_preferencesobjs form_aboutobjs form_updateobjs \
- form_calendareditorobjs form_eventeditorobjs
+ form_calendareditorobjs form_eventeditorobjs form_actmgrobjs
-xestiacal: mainobjs forms widgetsobjs commonobjs calendarlistobjs calendarobjs calendareventobjs
+xestiacal: mainobjs forms widgetsobjs commonobjs calendarlistobjs \
+ calendarobjs calendareventobjs caldavobjs
$(CPP) -Os $(MAINOBJS) $(FORM_MAINOBJS) $(FORM_PREFERENCESOBJS) \
$(FORM_ABOUTOBJS) $(FORM_UPDATEOBJS) $(FORM_EDITACCOUNTOBJS) \
$(FORM_NEWACCOUNTOBJS) $(FORM_CALENDAREDITOROBJS) \
- $(FORM_EVENTEDITOROBJS) \
+ $(FORM_EVENTEDITOROBJS) $(FORM_ACTMGROBJS) \
$(WIDGETSOBJS) $(COMMONOBJS) $(CALENDARLISTOBJS) $(CALENDAROBJS) \
- $(CALENDAREVENTOBJS) \
+ $(CALENDAREVENTOBJS) $(CALDAVOBJS) \
-o $(XCAL_OUT) $(CPPLIBS)
bitmaphelperobjs: $(BMCOOBJS)
form_aboutobjs: $(FORM_ABOUTOBJS)
+form_actmgrobjs: $(FORM_ACTMGROBJS)
+
widgetsobjs: $(WIDGETSOBJS)
commonobjs: $(COMMONOBJS)
calendareventobjs: $(CALENDAREVENTOBJS)
+caldavobjs: $(CALDAVOBJS)
+
calendardatastorage:
g++ -c -ggdb --std=c++11 libraries/CalendarDataStorage/CalendarDataStorage.cpp -o libraries/CalendarDataStorage/CalendarDataStorage.o -lsqlite3
ar rcs libraries/libCalendarDataStorage.a libraries/CalendarDataStorage/CalendarDataStorage.o
frmActivityMgrADT( parent )
{
+ /*wxMemoryInputStream istream(icons_activitywindow_png, sizeof(icons_activitywindow_png));
+ wxImage icons_activitywindow_pngi(istream, wxBITMAP_TYPE_PNG);
+ wxBitmap activityiconbmp(icons_activitywindow_pngi, -1);
+ wxIcon activityicon;
+ activityicon.CopyFromBitmap(activityiconbmp);
+ this->SetIcon(activityicon);
+
+ wxMemoryInputStream istream2(misc_activitysleep_png, sizeof(misc_activitysleep_png));
+ wxImage misc_activitysleep_pngi(istream2, wxBITMAP_TYPE_PNG);
+ wxBitmap sleepiconbmp(misc_activitysleep_pngi, -1);
+ SleepBitmap = sleepiconbmp;
+ bmpActivity->SetBitmap(SleepBitmap);
+ ActProcessTimer.SetupPointers(this);
+ lblDetails->SetLabel(_("No activity."));
+
+ ActListProcTimer.SetupPointers(&ActivityList, &ActivityListIndex, &ActivityListTaskDetail,
+ &TasksActive, lstActivity, lblDetails, GauProgress, this, &AnimationTimer,
+ &ActProcessTimer, &ActivityListFinDate, &ActivityListConnObject);
+
+ AnimationTimer.SetBitmap(bmpActivity);
+ AnimationTimer.SetSleepBitmap(&SleepBitmap);
+ AnimationTimer.SetupPointer(this->GetParent());
+
+ wxListItem ColumnData;
+ ColumnData.SetId(0);
+ ColumnData.SetText(_("Activity"));
+ ColumnData.SetWidth(175);
+ lstActivity->InsertColumn(0, ColumnData);
+
+ wxListItem ColumnData2;
+ ColumnData2.SetId(1);
+ ColumnData2.SetText(_("Account"));
+ ColumnData2.SetWidth(100);
+ lstActivity->InsertColumn(1, ColumnData2);
+
+ wxListItem ColumnData3;
+ ColumnData3.SetId(2);
+ ColumnData3.SetText(_("Status"));
+ ColumnData3.SetWidth(100);
+ lstActivity->InsertColumn(2, ColumnData3);*/
+
+}
+
+void frmActivityMgr::CloseWindow( wxCommandEvent& event )
+{
+ this->Hide();
}
void frmActivityMgr::CloseWindow( wxCloseEvent& event )
{
-// TODO: Implement CloseWindow
+ this->Hide();
}
void frmActivityMgr::StopTask( wxCommandEvent& event )
Subclass of frmActivityMgrADT, which is generated by wxFormBuilder.
*/
+#include <wx/bitmap.h>
+#include <wx/mstream.h>
+
+#include <map>
+#include <thread>
+#include <list>
+
+#include "svrblist.h"
+#include "../bitmaps.h"
#include "../../AppXestiaCalendar.h"
//// end generated include
+struct ActivityMgrAccountSettings{
+ wxString Address;
+ int Port;
+ wxString Username;
+ wxString Password;
+ bool SSL;
+ wxString Prefix;
+ wxString Dir;
+};
+
/** Implementing frmActivityMgrADT */
class frmActivityMgr : public frmActivityMgrADT
{
+ private:
+ /*wxBitmap SleepBitmap;
+ std::map<int,int> ActivityList;
+ std::map<int,int> ActivityListType;
+ std::map<int,long> ActivityListIndex;
+ std::map<int,wxString> ActivityListData;
+ std::map<int,wxString> ActivityListURL;
+ std::map<int,bool> ActivityListEditMode;
+ std::map<int,wxString> ActivityListTaskDetail;
+ std::map<int,wxString> ActivityListAccount;
+ std::map<int,wxString> ActivityListFilename;
+ std::map<int,wxString> ActivityListFullFilename;
+ //std::map<int,ConnectionObject*> ActivityListConnObject;
+ std::map<int,ActivityMgrAccountSettings> ActivityListAccSettings;
+ std::map<int,wxString> ActivityListETag;
+ std::map<int,wxString> ActivityListETagOriginal;
+ std::map<int,wxDateTime> ActivityListFinDate;
+ std::map<int,wxArrayString> ActivityListLog;*/
protected:
// Handlers for frmActivityMgrADT events.
void CloseWindow( wxCloseEvent& event );
+ void CloseWindow( wxCommandEvent& event );
void StopTask( wxCommandEvent& event );
void StopAllTasks( wxCommandEvent& event );
void RetryTask( wxCommandEvent& event );
--- /dev/null
+// frmMain.h - frmMain setup functions
+//
+// (c) 2016-2017 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Calendar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Calendar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY 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 Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
+
+#include "frmMain.h"
+
+void frmMain::SetupFormIcons()
+{
+ // SSL icons.
+
+ wxMemoryInputStream sslstream(icons_ssl_png, sizeof(icons_ssl_png));
+ wxMemoryInputStream sslwarningstream(icons_sslwarning_png, sizeof(icons_sslwarning_png));
+ wxMemoryInputStream nosslstream(icons_nossl_png, sizeof(icons_nossl_png));
+
+ wxImage icons_ssl_png(sslstream, wxBITMAP_TYPE_PNG);
+ imgSSL = new wxBitmap(icons_ssl_png, -1);
+
+ wxImage icons_sslwarning_png(sslwarningstream, wxBITMAP_TYPE_PNG);
+ imgSSLWarning = new wxBitmap(icons_sslwarning_png, -1);
+
+ wxImage icons_nossl_png(nosslstream, wxBITMAP_TYPE_PNG);
+ imgNoSSL = new wxBitmap(icons_nossl_png, -1);
+
+ // Activity Icon.
+
+ wxMemoryInputStream act1(icons_act1_png, sizeof(icons_act1_png));
+ wxMemoryInputStream act2(icons_act2_png, sizeof(icons_act2_png));
+ wxMemoryInputStream act3(icons_act3_png, sizeof(icons_act3_png));
+ wxMemoryInputStream act4(icons_act4_png, sizeof(icons_act4_png));
+ wxMemoryInputStream actsleep(icons_actsleep_png, sizeof(icons_actsleep_png));
+
+ wxImage icons_actsleep_png(actsleep, wxBITMAP_TYPE_PNG);
+ imgActIconSleep = new wxBitmap (icons_actsleep_png, -1);
+
+ wxImage icons_act1_png(act1, wxBITMAP_TYPE_PNG);
+ imgActIcon1 = new wxBitmap (icons_act1_png, -1);
+ wxIcon wxIAct1icon;
+ wxIAct1icon.CopyFromBitmap(*imgActIcon1);
+
+ wxImage icons_act2_png(act2, wxBITMAP_TYPE_PNG);
+ imgActIcon2 = new wxBitmap (icons_act2_png, -1);
+ wxIcon wxIAct2icon;
+ wxIAct2icon.CopyFromBitmap(*imgActIcon2);
+
+ wxImage icons_act3_png(act3, wxBITMAP_TYPE_PNG);
+ imgActIcon3 = new wxBitmap (icons_act3_png, -1);
+ wxIcon wxIAct3icon;
+ wxIAct3icon.CopyFromBitmap(*imgActIcon3);
+
+ wxImage icons_act4_png(act4, wxBITMAP_TYPE_PNG);
+ imgActIcon4 = new wxBitmap (icons_act4_png, -1);
+ wxIcon wxIAct4icon;
+ wxIAct4icon.CopyFromBitmap(*imgActIcon4);
+
+ // Online/Offline icons.
+
+ wxMemoryInputStream onlinestream(icons_online_png, sizeof(icons_online_png));
+ wxMemoryInputStream offlinestream(icons_offline_png, sizeof(icons_offline_png));
+
+ wxImage icons_online_png(onlinestream, wxBITMAP_TYPE_PNG);
+ imgOnline = new wxBitmap(icons_online_png, -1);
+
+ wxImage icons_offline_png(offlinestream, wxBITMAP_TYPE_PNG);
+ imgOffline = new wxBitmap(icons_offline_png, -1);
+}
+
+void frmMain::SetupStatusBar()
+{
+#if defined(__HAIKU__)
+
+#elif defined(__WIN32__)
+
+ int stbBottomData [3] = { -1, 8, 8 };
+
+#else
+
+ int stbBottomData [3] = { -1, 20, 20 };
+
+#endif
+
+ stbBottom->SetFieldsCount(3, stbBottomData);
+ stbBottom->SetMinHeight(16);
+
+ wxRect rectOnline;
+ wxRect rectSSL;
+ wxRect rectActivity;
+ stbBottom->GetFieldRect(1, rectOnline);
+ stbBottom->GetFieldRect(2, rectActivity);
+
+ sslToolTip = new wxToolTip(wxT(""));
+
+ imgConnStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectOnline.GetX()),(rectOnline.GetY())), wxDefaultSize, 0 );
+ imgConnStatus->SetBitmap(*imgOnline);
+ // TODO: imgConnStatus->Connect( wxEVT_LEFT_DCLICK, wxCommandEventHandler( frmMain::ToggleConnectionStatus ), NULL, this );
+
+ imgActivityStatus = new wxStaticBitmap(stbBottom, wxID_ANY, wxNullBitmap, wxPoint((rectActivity.GetX()),(rectActivity.GetY())), wxDefaultSize, 0);
+ imgActivityStatus->SetBitmap(*imgActIconSleep);
+ // TODO: imgActivityStatus->Connect( wxEVT_LEFT_DCLICK, wxCommandEventHandler( frmMain::ShowActivityWindow ), NULL, this );
+}
+
+void frmMain::SetupPointers(frmActivityMgr *activityManager)
+{
+ this->activityManager = activityManager;
+}
#include "frmMain.h"
-void frmMain::WindowAdd( wxCommandEvent &event ){
+void frmMain::WindowAdd( wxCommandEvent &event )
+{
// Add a window to the window list.
wxString windowTitle = frmEventEditorPtr->GetTitle();
mnuNewItem->SetItemLabel(windowTitle);
- WindowListPointersMenu.insert(std::make_pair(receivedWindowData->WindowID, mnuNewItem));
- WindowListPointers.insert(std::make_pair(receivedWindowData->WindowID, receivedWindowData->WindowPointer));
- WindowListType.insert(std::make_pair(receivedWindowData->WindowID, 0));
+ windowListPointersMenu.insert(std::make_pair(receivedWindowData->WindowID, mnuNewItem));
+ windowListPointers.insert(std::make_pair(receivedWindowData->WindowID, receivedWindowData->WindowPointer));
+ windowListType.insert(std::make_pair(receivedWindowData->WindowID, 0));
delete receivedWindowData;
receivedWindowData = NULL;
}
-void frmMain::WindowUpdate( wxCommandEvent &event ){
+void frmMain::WindowUpdate( wxCommandEvent &event )
+{
// Add a window to the window list.
wxString windowTitle = frmEventEditorPtr->GetTitle();
- std::map<int, wxMenuItem*>::iterator MenuIter = WindowListPointersMenu.find(receivedWindowData->WindowID);
+ std::map<int, wxMenuItem*>::iterator MenuIter = windowListPointersMenu.find(receivedWindowData->WindowID);
MenuIter->second->SetItemLabel(windowTitle);
}
-void frmMain::WindowDelete( wxCommandEvent &event ){
+void frmMain::WindowDelete( wxCommandEvent &event )
+{
// Delete the window from the window list.
size_t pos;
- std::map<int, wxMenuItem*>::iterator menuIter = WindowListPointersMenu.find(receivedWindowData->WindowID);
+ std::map<int, wxMenuItem*>::iterator menuIter = windowListPointersMenu.find(receivedWindowData->WindowID);
mnuWindow->Destroy(menuIter->second);
- WindowListPointersMenu.erase(receivedWindowData->WindowID);
- WindowListPointers.erase(receivedWindowData->WindowID);
- WindowListType.erase(receivedWindowData->WindowID);
+ windowListPointersMenu.erase(receivedWindowData->WindowID);
+ windowListPointers.erase(receivedWindowData->WindowID);
+ windowListType.erase(receivedWindowData->WindowID);
delete receivedWindowData;
receivedWindowData = NULL;
}
-void frmMain::ShowEventWindow( wxCommandEvent &event ){
+void frmMain::ShowEventWindow( wxCommandEvent &event )
+{
// Show a contact window from the window list.
- std::map<int, void*>::iterator WindowIter = WindowListPointers.find(event.GetId());
+ std::map<int, void*>::iterator WindowIter = windowListPointers.find(event.GetId());
frmEventEditor *frmEventEditorPtr = static_cast<frmEventEditor*>(WindowIter->second);
{
// Attempt to close all windows.
- if (WindowListPointersMenu.size() == 0)
+ if (windowListPointersMenu.size() == 0)
{
return true;
}
if (wxMessageBox(_("Before preforming the action, all windows that are open will need to close. Do you wish to continue?"), _("Close All Windowss"), wxYES_NO) == wxYES)
{
- for(std::map<int, void*>::iterator windowIter = WindowListPointers.begin();
- windowIter != WindowListPointers.end(); windowIter++)
+ for(std::map<int, void*>::iterator windowIter = windowListPointers.begin();
+ windowIter != windowListPointers.end(); windowIter++)
{
wxWindow *windowPointer = static_cast<wxWindow*>(windowIter->second);
windowPointer->Close();
{
return false;
}
-}
\ No newline at end of file
+}
LoadAccountData();
+ // Setup the form icons.
+
+ SetupFormIcons();
+ SetupStatusBar();
+
// Setup the form control.
mainCalendarCtrl = new XCCalendarCtrl(this, &calendarData);
}
-void frmMain::LoadAccountData(){
+void frmMain::LoadAccountData()
+{
// Get the list of accounts and put into the calendar data storage.
}
-void frmMain::CreateNewEvent( wxCommandEvent& event ){
+void frmMain::CreateNewEvent( wxCommandEvent& event )
+{
frmEventEditor *frameNewEvent = new frmEventEditor ( this );
frameNewEvent->SetupForm(&calendarData, preferences);
}
-void frmMain::EditEvent( wxCommandEvent& event ){
+void frmMain::EditEvent( wxCommandEvent& event )
+{
frmEventEditor *frameEditEvent = new frmEventEditor ( this );
frameEditEvent->SetEventID(event.GetInt());
}
-void frmMain::DeleteEvent( wxCommandEvent& event ){
+void frmMain::DeleteEvent( wxCommandEvent& event )
+{
EventProperties *eventInfo = (EventProperties*)event.GetClientData();
wxMessageBox(_("The help documentation will be implemented in a future version of Xestia Calendar."), _("Unimplemented"));
-}
\ No newline at end of file
+}
+
+void frmMain::ShowActivityManager( wxCommandEvent &event )
+{
+
+ activityManager->Show();
+
+}
#include <map>
#include <sys/types.h>
#include <wx/dir.h>
+#include <wx/tooltip.h>
#include "../../AppXestiaCalendar.h"
#include "../newaccount/frmNewAccount.h"
#include "../calendareditor/frmCalendarEditor.h"
#include "../eventeditor/frmEventEditor.h"
+#include "../actmgr/frmActivityMgr.h"
#include "../../widgets/XCCalendarCtrl.h"
#include "../../libraries/CalendarDataStorage/CalendarDataStorage.h"
CalendarDataStorage calendarData;
ColourUpdateProperties updateColourData;
bool reloadAccounts = false;
- std::map<int,wxMenuItem*> WindowListPointersMenu;
- std::map<int,void*> WindowListPointers;
- std::map<int,int> WindowListType;
+ std::map<int,wxMenuItem*> windowListPointersMenu;
+ std::map<int,void*> windowListPointers;
+ std::map<int,int> windowListType;
int WindowMenuItemID = 0;
-
+ wxBitmap *imgActIcon1 = nullptr;
+ wxBitmap *imgActIcon2 = nullptr;
+ wxBitmap *imgActIcon3 = nullptr;
+ wxBitmap *imgActIcon4 = nullptr;
+ wxBitmap *imgActIconSleep = nullptr;
+ wxBitmap *imgSSL = nullptr;
+ wxBitmap *imgNoSSL = nullptr;
+ wxBitmap *imgSSLWarning = nullptr;
+ wxBitmap *imgOnline = nullptr;
+ wxBitmap *imgOffline = nullptr;
+ wxStaticBitmap *imgConnStatus = nullptr;
+ wxStaticBitmap *imgActivityStatus = nullptr;
+ wxToolTip *sslToolTip = nullptr;
+ frmActivityMgr *activityManager = nullptr;
+
+ void SetupFormIcons();
+ void SetupStatusBar();
protected:
void QuitApp( wxCloseEvent& event );
void QuitApp( wxCommandEvent& event );
void ShowUpdateWindow( wxCommandEvent& event );
void ShowAboutWindow( wxCommandEvent& event );
void OpenNewAccountDialog( wxCommandEvent& event );
+ void ShowActivityManager( wxCommandEvent& event );
void ProcessCalendar( wxCommandEvent& event );
void LoadAccountData();
void CloseWindow( wxCommandEvent& event );
public:
/** Constructor */
frmMain( wxWindow* parent );
+ void SetupPointers(frmActivityMgr *activityManager);
//// end generated class members
};
#include "frmNewAccount.h"
+DEFINE_EVENT_TYPE(UPDATERESULTS);
+DEFINE_EVENT_TYPE(RUNCALDAVTEST);
+
+BEGIN_EVENT_TABLE(frmNewAccount, wxDialog)
+EVT_COMMAND(wxID_ANY, UPDATERESULTS, frmNewAccount::UpdateResults)
+EVT_COMMAND(wxID_ANY, RUNCALDAVTEST, frmNewAccount::RunCalDAVTest)
+END_EVENT_TABLE()
+
frmNewAccount::frmNewAccount( wxWindow* parent )
:
frmNewAccountADT( parent )
void frmNewAccount::UpdateRequirements( wxCommandEvent& event )
{
-// TODO: Implement UpdateRequirements
-}
-
-void frmNewAccount::ProcessPrevious( wxCommandEvent& event )
-{
-// TODO: Implement ProcessPrevious
+ // Update the options.
+
+ if (cmbServerType->GetCurrentSelection() == 1){
+
+ txtServerAddress->Enable();
+ txtServerPort->Enable();
+ txtUsername->Enable();
+ txtPassword->Enable();
+ chkUseSSL->Enable();
+
+ } else if (cmbServerType->GetCurrentSelection() == 0){
+
+ txtServerAddress->Disable();
+ txtServerPort->Disable();
+ txtUsername->Disable();
+ txtPassword->Disable();
+ chkUseSSL->Disable();
+
+ }
}
-void frmNewAccount::ProcessNext( wxCommandEvent& event )
+void frmNewAccount::Navigate( wxCommandEvent& event )
{
- pageSeek++;
-
- if (pageSeek == 1){
+ if (event.GetId() == wxID_NEXT)
pageSeek++;
- }
+ else
+ pageSeek--;
if (pageSeek == 1){
// Skip this page.
+
+ btnPrevious->Disable();
+ btnNext->Enable();
+
+ tabConn->Hide();
+ tabFinish->Hide();
+ tabType->Show();
+ btnNext->SetLabel(_("Next >"));
} else if (pageSeek == 2){
+
+ if (cmbServerType->GetCurrentSelection() == 0){
+
+ tabType->Hide();
+ tabConn->Hide();
+ tabFinish->Show();
+ szrNewAccount->RecalcSizes();
+ pageSeek = 2;
+
+ btnNext->Disable();
+ btnPrevious->Enable();
+ btnNext->SetLabel(_("Finish"));
+ return;
+
+ }
+
+ // Check if server address matches against the blacklist.
+ // Bring up warning message if it does.
+
+ if (CheckBlacklist(txtServerAddress->GetValue())){
+
+ int MessageBoxResult = wxMessageBox(_("The server with the address given does not support the CalDAV protocol properly and shouldn't be used.\n\nData loss is very likely.\n\nDo you still want to continue using this server?"), _("Server warning"), wxYES_NO, this);
+
+ if (MessageBoxResult == wxNO){
+ pageSeek--;
+ return;
+ }
+
+ }
+
+ btnNext->Disable();
+
+ bool ServerResult = FALSE;
+ bool ServerAction = FALSE;
+ bool UseSSL = TRUE;
+ wxString ServerMessage;
+
+ // Connection test screen.
+
+ tabType->Hide();
+ tabConn->Show();
+ tabFinish->Hide();
+ szrNewAccount->RecalcSizes();
+ btnPrevious->Disable();
+
+ // Reset screen.
+
+ lblServerConnResult->SetLabel(wxT(""));
+ lblServerResponse->SetLabel(wxT(""));
+ lblServerSSLResult->SetLabel(wxT(""));
+ lblServerSSLValid->SetLabel(wxT(""));
+ lblAbleToLoginResult->SetLabel(wxT(""));
+ lblCalDAVSupportResult->SetLabel(wxT(""));
+
+ // Depending on account type, run the test.
+
+ if (cmbServerType->GetCurrentSelection() == 1){
+ wxCommandEvent RunTest(RUNCALDAVTEST);
+ wxPostEvent(this, RunTest);
+ }
+
+ } else if (pageSeek == 3){
// Finish screen.
szrNewAccount->RecalcSizes();
btnNext->Disable();
+ btnPrevious->Enable();
btnNext->SetLabel(_("Finish"));
if (txtAccountName->IsEmpty() && pageSeek == 2){
}
- } else if (pageSeek == 3){
+ } else if (pageSeek == 4){
// Finished.
}
- if (cmbServerType->GetCurrentSelection() == 0){
+ if (cmbServerType->GetCurrentSelection() == 1){
// Create the account directory.
}
- if (cmbServerType->GetCurrentSelection() == 0){
+ if (cmbServerType->GetCurrentSelection() == 1){
// Create the account directory.
cfgFileIn->Write(wxT("refresh"), wxT("1800"));
cfgFileIn->Write(wxT("type"), accountType);
+}
+
+void frmNewAccount::UpdateResults( wxCommandEvent &event )
+{
+
+}
+
+void frmNewAccount::RunCalDAVTest( wxCommandEvent &event )
+{
+ NewAccountResult *resultData = new NewAccountResult;
+
+ lblServerConnResult->SetLabel(_("Testing..."));
+ lblCalDAVSupportResult->SetLabel(wxT(""));
+ lblServerResponse->SetLabel(wxT(""));
+ lblServerSSLResult->SetLabel(wxT(""));
+ lblServerSSLValid->SetLabel(wxT(""));
+ lblAbleToLoginResult->SetLabel(wxT(""));
+ bool usingSSLBypass = false;
+
+ // Setup a CalDAV connection object for testing.
+
+ CalDAVConnectionData connData;
+ connData.hostname = txtServerAddress->GetValue().ToStdString();
+ connData.port = wxAtoi(txtServerPort->GetValue());
+ connData.username = txtUsername->GetValue().ToStdString();
+ connData.password = txtPassword->GetValue().ToStdString();
+ connData.useSSL = chkUseSSL->GetValue() ? true : false);
+
+ CalDAV testConnection;
+ testConnection.SetupConnectionData(&connData);
+
+ /*CardDAV2 TestConnection(txtServerAddress->GetValue().ToStdString(),
+ wxAtoi(txtServerPort->GetValue()),
+ txtUsername->GetValue().ToStdString(),
+ txtPassword->GetValue().ToStdString(),
+ chkUseSSL->GetValue() ? true : false);*/
+
+ // Test the connection.
+
+ testConnection.SetupConnectionObject();
+ CalDAVServerResult testConnectionResult = testConnection.Connect(false);
+
+ // If server is using SSL, verify that the SSL connection is valid.
+
+ if (testConnection.SSLVerify() == COSSL_UNABLETOVERIFY){
+#if defined(__APPLE__)
+
+ testConnection.BypassSSLVerification(true);
+
+ CalDAVServerResult testConnection = testConnection.Connect(false);
+
+ testConnection.BypassSSLVerification(false);
+
+ int SSLResult = DisplayTrustPanel(&TestConnection);
+
+ if (SSLResult != NSOKButton){
+
+ lblServerConnResult->SetLabel(_("Failed"));
+ lblServerResponse->SetLabel(_("Not applicable"));
+ lblServerSSLResult->SetLabel(_("Used"));
+ lblServerSSLValid->SetLabel(_("No"));
+ lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + TestConnection.GetErrorMessage());
+ btnPrevious->Enable(true);
+ return;
+
+ } else {
+
+ // Evalulate the trust object.
+
+ SecTrustResultType evalResult = ProcessResultType(&testConnection);
+
+ switch(evalResult){
+ case kSecTrustResultProceed:
+ lblServerSSLValid->SetLabel(_("Verified"));
+ break;
+ case kSecTrustResultConfirm:
+ lblServerSSLValid->SetLabel(_("Verified (user)"));
+ break;
+ default:
+ lblServerSSLValid->SetLabel(_("Unable to verify"));
+ }
+
+ lblServerResponse->SetLabel(_("Not applicable"));
+ lblServerSSLResult->SetLabel(_("Used"));
+
+ if (evalResult != kSecTrustResultProceed){
+ return;
+ }
+
+ }
+
+#elif defined(__WIN32__)
+
+ testConnection.BypassSSLVerification(true);
+
+ CalDAVServerResult testConnectionResult = testConnection.Connect(false);
+
+ testConnection.BypassSSLVerification(false);
+
+ bool modifiedCertificateData = false;
+
+ CRYPTUI_VIEWCERTIFICATE_STRUCTW certificateDialogData = BuildCertificateData(&testConnection, (HWND)this->GetHandle());
+
+ if (!CryptUIDlgViewCertificate(&certificateDialogData, &modifiedCertificateData)){
+ wxMessageBox(_("An error occured while trying to open the certificate dialog."), _("Error opening Certificate Information dialog"));
+ }
+
+ if (modifiedCertificateData == false){
+
+ lblServerConnResult->SetLabel(_("Failed"));
+ lblServerResponse->SetLabel(_("Not applicable"));
+ lblServerSSLResult->SetLabel(_("Used"));
+ lblServerSSLValid->SetLabel(_("No"));
+ lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + testConnection.GetErrorMessage());
+ btnPrevious->Enable(true);
+ return;
+
+ }
+
+#else
+
+ // Connect again and fetch SSL certificate information.
+
+ testConnection.BypassSSLVerification(true);
+
+ CalDAVServerResult testConnectionResult = testConnection.Connect(false);
+
+ testConnection.BypassSSLVerification(false);
+
+ SSLCertCollectionString certData = testConnection.BuildSSLCollection();
+ frmInvalidSSLCertificate *frmICPtr = new frmInvalidSSLCertificate(this);
+
+ frmICPtr->LoadDataNew(CertData, txtServerAddress->GetValue().ToStdString());
+ frmICPtr->ShowModal();
+
+ int sslResult = frmICPtr->GetResult();
+
+ // Clean up before processing response.
+
+ delete frmICPtr;
+ frmICPtr = NULL;
+
+ // Process the response from the user.
+
+ if (sslResult == 1){
+
+ // Accept the Certificate.
+
+ usingSSLBypass = true;
+ testConnection.BypassSSLVerification(true);
+
+ CalDAVServerResult testConnectionResult = testConnection.Connect(true);
+
+ testConnection.BypassSSLVerification(false);
+
+ } else if (sslResult == 2){
+
+ // Reject the certificate, abort the task and mark as failed.
+
+ // TODO: Integrate into the code.
+
+ //lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + CardDAVConn.GetErrorMessage() + wxString::Format(wxT(" (%i)\n%s"), sslcode, CardDAVConn.GetErrorBuffer().mb_str()));
+
+ }
+
+#endif
+ }
+
+ testConnectionResult = testConnection.Connect(true);
+
+ // Get the server prefix if the connection was successful.
+
+ if (testConnectionResult == COCONNECT_OK){
+
+ if (usingSSLBypass == true){
+ testConnection.BypassSSLVerification(true);
+ }
+
+ std::string receivedServerPrefix;
+
+ receivedServerPrefix = testConnection.GetUserPrincipal();
+ serverPrefix = receivedServerPrefix;
+
+ if (usingSSLBypass == true){
+ testConnection.BypassSSLVerification(true);
+ }
+
+ }
+
+ testConnectionResult == COCONNECT_OK ? resultData->Connected = true : resultData->Connected = false;
+
+ resultData->SSLStatus = TestConnection.CanDoSSL();
+ resultData->SSLVerified = TestConnection.SSLVerify();
+ resultData->ValidResponse = TestConnection.HasValidResponse();
+ resultData->AuthPassed = TestConnection.AbleToLogin();
+ resultData->CanProcess = TestConnection.CanDoProcessing();
+ resultData->ErrorMessage = TestConnection.GetErrorMessage();
+
+ // Post event back confirming the tests.
+
+ wxCommandEvent resultsEvent(UPDATERESULTS);
+ resultsEvent.SetClientData(resultData);
+ wxPostEvent(this, resultsEvent);
}
\ No newline at end of file
#include "../../AppXestiaCalendar.h"
#include "../../libraries/CalendarDataStorage/CalendarDataStorage.h"
+#include "../objects/CalDAV/CalDAV.h"
+#include "svrblist.h"
#include "dirs.h"
+DECLARE_EVENT_TYPE(UPDATERESULTS, wxID_ANY);
+DECLARE_EVENT_TYPE(RUNCALDAVTEST, wxID_ANY);
+
+
//// end generated include
/** Implementing frmNewAccountADT */
class frmNewAccount : public frmNewAccountADT
{
private:
- int pageSeek = 0;
+ int pageSeek = 1;
wxString serverPrefix;
bool *reloadAccountConfig = NULL;
+ struct NewAccountResult{
+ bool Connected = false;
+ bool SSLStatus = false;
+ COSSLVerified SSLVerified = COSSL_NORESULT;
+ bool ValidResponse = false;
+ bool AuthPassed = false;
+ bool CanProcess = false;
+ std::string ErrorMessage = "";
+ };
protected:
// Handlers for frmNewAccountADT events.
- void UpdateRequirements( wxCommandEvent& event );
- void CheckAccountName( wxCommandEvent& event );
- void ProcessPrevious( wxCommandEvent& event );
- void ProcessNext( wxCommandEvent& event );
+ void UpdateRequirements( wxCommandEvent &event );
+ void UpdateResults( wxCommandEvent &event );
+ void RunCalDAVTest( wxCommandEvent &event );
+ void CheckAccountName( wxCommandEvent &event );
+ void Navigate( wxCommandEvent& event );
void CloseWindow( wxCommandEvent& event );
void WriteAccountDetails( wxFileConfig *cfgFileIn, wxString accountType, wxString directoryName );
+#if defined(__APPLE__)
+ int DisplayTrustPanel(ConnectionObject *Connection);
+ SecTrustResultType ProcessResultType(ConnectionObject *Connection);
+#endif
public:
/** Constructor */
frmNewAccount( wxWindow* parent );
void SetupPointers(bool *reloadAccountInc, CalendarDataStorage *dataStorage);
+ DECLARE_EVENT_TABLE()
//// end generated class members
};
#include "version.h"
#include "bitmaps.h"
#include "forms/main/frmMain.h"
+#include "forms/actmgr/frmActivityMgr.h"
#include "defaults.h"
class XestiaCALApp: public wxApp
SetupDefaultSettings();
SetupDefaultCalendar();
+ // Setup the main form.
+
frmMain *frameMain = new frmMain( NULL );
wxMemoryInputStream istream(bigimgs_appicon48_png, sizeof(bigimgs_appicon48_png));
appIcon.CopyFromBitmap(appIconBMP);
+ // Setup the activity manager.
+
+ frmActivityMgr *frameActMgr = new frmActivityMgr ( frameMain );
+
frameMain->SetIcon(appIcon);
frameMain->Show(true);
+ frameMain->SetupPointers(frameActMgr);
SetTopWindow(frameMain);
//
// THANK YOU FOR YOUR ATTENTION!
-#define XSDCAL_VERSION "0.05"
-#define XSDCAL_USERAGENT "XestiaCalendar/0.05"
+#define XSDCAL_VERSION "0.06"
+#define XSDCAL_USERAGENT "XestiaCalendar/0.06"
#define XSDCAL_SOURCE "source"
#define XSDCAL_RELEASE 0
#define XSDCAL_COPYRIGHT "(c)2016-2017 Xestia Software Development"