+// frmMain.cpp - Main window form.
+//
+// (c) 2012-2015 Xestia Software Development.
+//
+// This file is part of Xestia Address Book.
+//
+// Xestia Address Book 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 Address Book 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 Address Book. If not, see <http://www.gnu.org/licenses/>
+
#include <iostream>
#include <algorithm>
#include <vector>
#include <wx/stdpaths.h>
#include <wx/fileconf.h>
#include <wx/gdicmn.h>
-//#include <boost/filesystem/fstream.hpp>
// Include the forms.
#include "frmAbout.h"
#include "frmPreferences.h"
#include "frmNewAccount.h"
-#include "frmActivityMgr.h"
+#include "actmgr/frmActivityMgr.h"
#include "frmContact.h"
#include "frmConflictResolution.h"
#include "frmInvalidSSLCertificate.h"
-#include "frmSearch.h"
+#include "search/frmSearch.h"
#include "frmSSLCertificate.h"
#include "frmUpdate.h"
#include "import/frmImportResults.h"
AccCtrl->SetPopupMaxHeight(175);
AccCtrl->SetPopupMinWidth(250);
treAccounts->AssignImageList(AccImgList);
- //bmpIcon->Hide();
-
- /*wxStaticBitmap* BeepBoop = new wxStaticBitmap(AccCtrl, wxID_ANY, wxNullBitmap, wxPoint(AccTextCtrlSize.GetX() + 3, AccTextCtrlSize.GetY() + 2), wxDefaultSize, 0);
-
- icons_accgroup_png.SetMask(new wxMask(icons_accgroup_png, wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND)));
-
- BeepBoop->SetBackgroundColour(AccCtrl->GetBackgroundColour());
- BeepBoop->SetBitmap(icons_accgroup_png);*/
-
- //szrContactList->Insert(0, XABV2, 1, wxEXPAND | wxALL, 0);
-
- /*AccControl->UseAltPopupWindow();
- AccControl->SetPopupControl(treAccounts);
- AccControl->SetPopupMaxHeight(175);
-
- treAccounts->AssignImageList(AccImgList);
- szrContactList->Insert(0, AccControl, 1, wxEXPAND|wxALL, 0);
- szrAccList->Add(AccIcon, 0, wxLEFT|wxTOP|wxEXPAND, 3);
-
- */
-
- //szrContactList->Layout();
- //szrContactList->RecalcSizes();
wxListItem ColumnData;
ColumnData.SetId(0);
ColumnData.SetWidth(320);
lstContacts->InsertColumn(0, ColumnData);
- //Connect(wxID_ANY, ContactConflictCmdEnv,
- // ContactConflictEventHandler(frmMain::ConflictResolution), NULL, this);
-
- //Connect(wxID_ANY, MyFooCommandEvent,
- // MyFooEventHandler(frmMain::DoSomething), NULL, this);
-
- //Bind(ContactConflictCmdEnv, ContactConflictEventHandler(frmMain::ConflictResolution), this, wxID_ANY);
-
treAccounts->Connect(wxEVT_LEFT_DCLICK, wxTreeEventHandler(frmMain::LoadContactList), NULL, this);
treAccounts->Connect(wxEVT_TREE_SEL_CHANGED, wxTreeEventHandler(frmMain::LoadContactList), NULL, this);
ContactsFileIndex.Clear();
- //wxString vcardfilenamewxs;
wxString vCardFilename;
wxString vCardFilenameFull;
wxString vCardDataString;
wxStringTokenizer vcardfileline;
wxString lwxs;
wxString setname, setvalue;
- //vCardNames = new std::map<wxString, wxString, std::greater<wxString>>;
std::multimap<wxString, wxString, std::greater<wxString>> vCardNamesAsc;
std::multimap<wxString, wxString, std::less<wxString>> vCardNamesDsc;
long ContactIndex = 1;
std::multimap<wxTreeItemId, int>::iterator AGTiter = AccountGroupTreeId.find(ActiveItemId);
std::multimap<int, wxString>::iterator AGFiter = AccountGroupFilename.find(AGTiter->second);
- //std::multimap<wxTreeItemId, int>::iterator AGFiter = AccountGroupTreeId.find(ActiveItemId);
-
+
Group.LoadFile(AGFiter->second);
ArrayvCardOutData vCardMember = Group.GetByPartial(wxT("MEMBER"));
long intSelected = -1;
long ContactSeekNum = -1;
- // intSelected = lstContacts->GetSelection();
-
// Check if several contacts have been selected.
int ContactTotal = 0;
if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
wxSPropertyNextLine.Remove(0, 1);
- //wxSPropertyNextLine.Trim(FALSE);
- //ContactLine.Trim();
ContactLine.Append(wxSPropertyNextLine);
} else {
long intSelected = -1;
long intContactSeekNum = -1;
-
- // intSelected = lstContacts->GetSelection();
-
+
intSelected = lstContacts->GetNextItem(intSelected,
wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED);
wxString setname, setvalue;
vCard Person;
wxString nextchar;
- //std::fstream vcardfile;
Person.LoadFile(uc->ContactFilename);
AccountSyncTimers.clear();
- /*
- for (int i = (preferences.accounts.GetCount() - 1); i > 0; --i){
- treAccounts->AppendItem(RootNode, preferences.accounts.GetAccountName(i));
- }
- */
-
wxString AccDir;
wxString AccDirFull;
wxString AccDirFullSfx;
if (preferences.accounts.GetAccountType(i) == wxT("CardDAV") ||
preferences.accounts.GetAccountType(i) == wxT("carddav")){
- // Check if the directory exists before doing anything.
+ // TODO: Check if the directory exists before doing anything.
wxString vCardFilename;
wxString vCardDataString;
wxString vCardFilenameFull;
- //bool ProcFiles = FALSE;
-
+
bool ProcFiles = vcardaccdir.GetFirst(&vCardFilename, wxEmptyString, wxDIR_FILES);
while(ProcFiles){
vCardConflictObj *vCardConfObj = (vCardConflictObj*)event.GetClientData();
vCard *ClientDataPtr = vCardConfObj->vCardLocalData;
vCard *ServerDataPtr = vCardConfObj->vCardServerData;
- //vCard *ServerDataPtr = vCardConfObj->vCardServerData;
- //wxString Moo = ClientDataPtr->WriteString();
- //vCard *ServerDataPtr = vCardConfObj->vCardServerData;
frameCR->LoadData(ClientDataPtr, ServerDataPtr, &MemoryFileList);
- //frameCR->LoadData(vCardConfObj->vCardLocalData, vCardConfObj->vCardServerData, &MemoryFileList);
frameCR->ShowModal();
int FinalConflictResult = frameCR->GetResult();
void frmMain::RemoveContactsWindowPointer(wxCommandEvent& event){
- //frmSearch *frameSCH = static_cast<frmSearch*>(ActMgrPtr);
void *frameSCH = (void*)event.GetClientData();
SearchWindowList.erase(frameSCH);
}
-void frmMain::UpdateWindowList(wxCommandEvent& event){
-
- // Update the Window List.
-
- // Delete the existing items in the window menu.
-
- // Get the list of contacts.
-
- // Insert a separator.
-
- // Get the list of search windows.
-
-}
-
void frmMain::RevealContact(wxCommandEvent& event){
UCNotif *uc = (UCNotif*)event.GetClientData();
std::map<int, wxMenuItem*>::iterator MenuIter = WindowListPointersMenu.find(WData->WindowID);
MenuIter->second->SetItemLabel(WindowTitle);
-
- //mnuWindow->FindChildItem(intID, &pos);
- //wxMenuItem *mnuNewItem = new wxMenuItem(NULL, WData->WindowID, WindowTitle, WData->WindowID), wxEmptyString, wxITEM_NORMAL, NULL);
- //mnuNewItem->SetId(WData->WindowID);
- //ContactWindowListPointersMenu.insert(std::make_pair(WData->WindowID, mnuNewItem));
- //ContactWindowListPointers.insert(std::make_pair(WData->WindowID, WData->WindowPointer));
- //mnuWindow->Insert((pos + 1), mnuNewItem);
- //this->Connect(mnuNewItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::ShowContactWindow));
-
+
} else if (WData->DataType == 1){
// Get the window title and use that.
}
- //mnuWindow->FindChildItem(intID, &pos);
- //wxMenuItem *mnuNewItem = new wxMenuItem(NULL, WData->WindowID, WindowTitle, WData->WindowID), wxEmptyString, wxITEM_NORMAL, NULL);
- //mnuNewItem->SetId(WData->WindowID);
- //ContactEditorWindowListPointersMenu.insert(std::make_pair(WData->WindowID, mnuNewItem));
- //ContactEditorWindowListPointers.insert(std::make_pair(WData->WindowID, WData->WindowPointer));
- //mnuWindow->Insert((pos + 1), mnuNewItem);
- //this->Connect(mnuNewItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(frmMain::ShowContactEditorWindow));
-
}
delete WData;