X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;ds=sidebyside;f=source%2Fcontacteditor%2FfrmContactEditorIM.cpp;h=40bfef1485d94b68b51da11012ede86e00283ca7;hb=e1c0c1ab4c6eea19a2022993124da7cabfc0066c;hp=98ef20d3cb807ad52c18d4d0a0124a35632c3fc1;hpb=45729fca56479bd9158486e0cda0c4a94b4dd1dc;p=xestiaab%2F.git
diff --git a/source/contacteditor/frmContactEditorIM.cpp b/source/contacteditor/frmContactEditorIM.cpp
index 98ef20d..40bfef1 100644
--- a/source/contacteditor/frmContactEditorIM.cpp
+++ b/source/contacteditor/frmContactEditorIM.cpp
@@ -1,3 +1,21 @@
+// frmContactEditorIM.cpp - frmContactEditorIM 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
+
#include "frmContactEditorIM.h"
#include
#include
@@ -19,6 +37,7 @@ frmContactEditorIMADT( parent )
cmbIMType->Append(wxT("Skype"));
cmbIMType->Append(wxT("XMPP"));
cmbIMType->Append(wxT("Yahoo"));
+ cmbIMType->Append(_("Other"));
}
@@ -63,8 +82,7 @@ void frmContactEditorIM::ProcessAction( wxCommandEvent& event )
// Add the address to the list (maps).
wxString strIMAddress;
- wxString strValue;
-
+
// Strip out the colons.
strIMAddress.Replace(wxT(":"), wxT(""), TRUE);
@@ -75,38 +93,36 @@ void frmContactEditorIM::ProcessAction( wxCommandEvent& event )
if (strIMTypeValue == wxT("AIM")){
- strIMAddress.Append(wxT("aim:"));
+ strIMAddress.Append(wxT("aim"));
} else if (strIMTypeValue == wxT("Gadu-Gadu")){
- strIMAddress.Append(wxT("gg:"));
+ strIMAddress.Append(wxT("gg"));
} else if (strIMTypeValue == wxT("ICQ")){
- strIMAddress.Append(wxT("icq:"));
+ strIMAddress.Append(wxT("icq"));
} else if (strIMTypeValue == wxT("Skype")){
- strIMAddress.Append(wxT("skype:"));
+ strIMAddress.Append(wxT("skype"));
} else if (strIMTypeValue == wxT("XMPP")){
- strIMAddress.Append(wxT("xmpp:"));
+ strIMAddress.Append(wxT("xmpp"));
} else if (strIMTypeValue == wxT("Yahoo")){
- strIMAddress.Append(wxT("yahoo:"));
+ strIMAddress.Append(wxT("yahoo"));
} else {
- strIMAddress.Append(strIMTypeValue + wxT(":"));
+ strIMAddress.Append(strIMTypeValue);
}
- strIMAddress.Append(strValue);
- strIMAddress.Append(txtUsername->GetValue());
-
- IMListPtr->insert(std::make_pair(IMListIndex, strIMAddress));
+ IMListTypeInfoPtr->insert(std::make_pair(IMListIndex, strIMAddress));
+ IMListPtr->insert(std::make_pair(IMListIndex, txtUsername->GetValue()));
// Set the type.
@@ -160,52 +176,47 @@ void frmContactEditorIM::ProcessAction( wxCommandEvent& event )
// Edit the address in the list.
wxString strIMAddress;
- wxString strValue;
long longSelected = -1;
- // Strip out the colons.
-
- strIMAddress.Replace(wxT(":"), wxT(""), TRUE);
-
// Specify the type.
strIMTypeValue = cmbIMType->GetString(cmbIMType->GetSelection());
-
+
if (strIMTypeValue == wxT("AIM")){
- strIMAddress.Append(wxT("aim:"));
+ strIMAddress.Append(wxT("aim"));
} else if (strIMTypeValue == wxT("Gadu-Gadu")){
- strIMAddress.Append(wxT("gg:"));
+ strIMAddress.Append(wxT("gg"));
} else if (strIMTypeValue == wxT("ICQ")){
- strIMAddress.Append(wxT("icq:"));
+ strIMAddress.Append(wxT("icq"));
} else if (strIMTypeValue == wxT("Skype")){
- strIMAddress.Append(wxT("skype:"));
+ strIMAddress.Append(wxT("skype"));
} else if (strIMTypeValue == wxT("XMPP")){
- strIMAddress.Append(wxT("xmpp:"));
+ strIMAddress.Append(wxT("xmpp"));
} else if (strIMTypeValue == wxT("Yahoo")){
- strIMAddress.Append(wxT("yahoo:"));
+ strIMAddress.Append(wxT("yahoo"));
} else {
- strIMAddress.Append(strIMTypeValue + wxT(":"));
+ strIMAddress.Append(strIMTypeValue);
}
-
- strIMAddress.Append(strValue);
- strIMAddress.Append(txtUsername->GetValue());
-
+
IMListPtr->erase(IMListIndex);
- IMListPtr->insert(std::make_pair(IMListIndex, strIMAddress));
+ IMListPtr->insert(std::make_pair(IMListIndex, txtUsername->GetValue()));
+
+ IMListTypeInfoPtr->erase(IMListIndex);
+ IMListTypeInfoPtr->insert(std::make_pair(IMListIndex, strIMAddress));
// Set the priority.
@@ -278,8 +289,8 @@ void frmContactEditorIM::SetEditorMode(bool EditMode, SectionType SectType)
wxString strValue;
wxString strIMType;
wxString strIMUser;
-
- // Setup the IM Type.
+
+ // Setup the IM Type.
striter = IMListPtr->find(IMListIndex);
@@ -287,39 +298,45 @@ void frmContactEditorIM::SetEditorMode(bool EditMode, SectionType SectType)
strValue = striter->second;
- }
+ }
- wxStringTokenizer IMAddressToken(strValue, wxT(":"));
- strIMType = IMAddressToken.GetNextToken();
- strIMUser = IMAddressToken.GetNextToken();
+ strIMUser = IMListPtr->find(IMListIndex)->second;
+ strIMType = IMListTypeInfoPtr->find(IMListIndex)->second;
if (strIMType == wxT("aim")){
cmbIMType->SetValue(wxT("AIM"));
+ cmbIMType->SetSelection(0);
} else if (strIMType == wxT("gg")){
cmbIMType->SetValue(wxT("Gadu-Gadu"));
+ cmbIMType->SetSelection(1);
} else if (strIMType == wxT("icq")){
cmbIMType->SetValue(wxT("ICQ"));
+ cmbIMType->SetSelection(2);
} else if (strIMType == wxT("skype")){
cmbIMType->SetValue(wxT("Skype"));
+ cmbIMType->SetSelection(3);
} else if (strIMType == wxT("xmpp")){
- cmbIMType->SetValue(wxT("XMPP"));
+ cmbIMType->SetValue(wxT("XMPP"));
+ cmbIMType->SetSelection(4);
} else if (strIMType == wxT("yahoo")){
cmbIMType->SetValue(wxT("Yahoo"));
+ cmbIMType->SetSelection(5);
} else {
cmbIMType->SetValue(strIMType);
+ cmbIMType->SetSelection(6);
}
@@ -349,6 +366,7 @@ void frmContactEditorIM::SetupPointers( std::map *IMList,
std::map *IMListAltID,
std::map *IMListPID,
std::map *IMListType,
+ std::map *IMListTypeInfo,
std::map *IMListTokens,
std::map *IMListMediatype,
std::map *IMListPref,
@@ -360,6 +378,7 @@ void frmContactEditorIM::SetupPointers( std::map *IMList,
IMListAltIDPtr = IMListAltID;
IMListPIDPtr = IMListPID;
IMListTypePtr = IMListType;
+ IMListTypeInfoPtr = IMListTypeInfo;
IMListTokensPtr = IMListTokens;
IMListMediatypePtr = IMListMediatype;
IMListPrefPtr = IMListPref;