summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2016-04-13 04:49:56 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2016-04-13 04:49:56 +0000
commit3269e1db8b4365187485d600cb2ebdda4894996a (patch)
treec85e4a2d8c80b7bdad48cc3eac2d811478076c4a /protocols/VKontakte/src
parent1bc1672368e1ba87a68fca21b846c70156e71f05 (diff)
VKontakte:
radiobox group settings -> combobox (patch by MikalaiR, edited) remove unneeded methods git-svn-id: http://svn.miranda-ng.org/main/trunk@16634 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src')
-rw-r--r--protocols/VKontakte/src/misc.cpp2
-rw-r--r--protocols/VKontakte/src/resource.h6
-rw-r--r--protocols/VKontakte/src/vk_options.cpp80
-rw-r--r--protocols/VKontakte/src/vk_options.h10
-rw-r--r--protocols/VKontakte/src/vk_proto.h2
-rw-r--r--protocols/VKontakte/src/vk_struct.cpp25
-rw-r--r--protocols/VKontakte/src/vk_struct.h33
7 files changed, 64 insertions, 94 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 37274b0e79..bc1bcbe504 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -189,7 +189,7 @@ MCONTACT CVkProto::FindUser(LONG dwUserid, bool bCreate)
MCONTACT hNewContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD);
Proto_AddToContact(hNewContact, m_szModuleName);
setDword(hNewContact, "ID", dwUserid);
- db_set_ts(hNewContact, "CList", "Group", getGroup());
+ db_set_ts(hNewContact, "CList", "Group", m_vkOptions.ptszDefaultGroup);
return hNewContact;
}
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h
index 1a4dfb007a..b5c9ec2042 100644
--- a/protocols/VKontakte/src/resource.h
+++ b/protocols/VKontakte/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Включаемый файл, созданный в Microsoft Visual C++.
-// Используется d:\svn\protocols\VKontakte\res\resource.rc
+// Используется D:\svn\protocols\VKontakte\res\resource.rc
//
#define IDOPENBROWSER 3
#define IDD_ACCMGRUI 101
@@ -121,6 +121,8 @@
#define IDC_SHOW_MENU4 1105
#define IDC_SHOW_MENU5 1106
#define IDC_SHOW_MENU6 1107
+#define IDC_COMBO_MARKASREAD 1108
+#define IDC_COMBO_SYNCHISTORY 1109
// Next default values for new objects
//
@@ -129,7 +131,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 123
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1108
+#define _APS_NEXT_CONTROL_VALUE 1110
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp
index 4db911fabd..bdad14b496 100644
--- a/protocols/VKontakte/src/vk_options.cpp
+++ b/protocols/VKontakte/src/vk_options.cpp
@@ -121,6 +121,22 @@ static CVKLang vkLangCodes[] = {
{ _T("it"), LPGENT("Italian") },
};
+static CVKSync vkHistorySyncMethods[] =
+{
+ { TranslateT("off"), SyncHistoryMetod::syncOff },
+ { TranslateT("automatically"), SyncHistoryMetod::syncAuto },
+ { TranslateT("for last 1 day"), SyncHistoryMetod::sync1Days },
+ { TranslateT("for last 3 days"), SyncHistoryMetod::sync3Days }
+};
+
+static CVKMarkMsgRead vkMarkMsgAsReadMethods[] =
+{
+ { TranslateT("on read"), MarkMsgReadOn::markOnRead },
+ { TranslateT("on receive"), MarkMsgReadOn::markOnReceive },
+ { TranslateT("on reply"), MarkMsgReadOn::markOnReply },
+ { TranslateT("on typing"), MarkMsgReadOn::markOnTyping }
+};
+
CVkOptionAccountForm::CVkOptionAccountForm(CVkProto *proto):
CVkDlgBase(proto, IDD_OPT_MAIN, false),
m_edtLogin(this, IDC_LOGIN),
@@ -131,21 +147,14 @@ CVkOptionAccountForm::CVkOptionAccountForm(CVkProto *proto):
m_cbDelivery(this, IDC_DELIVERY),
m_cbUseLocalTime(this, IDC_USE_LOCAL_TIME),
m_cbAutoClean(this, IDC_AUTOCLEAN),
- m_cbMarkMessageOnRead(this, IDC_ONREAD),
- m_cbMarkMessageOnReceive(this, IDC_ONRECEIVE),
- m_cbMarkMessageOnReply(this, IDC_ONREPLY),
- m_cbMarkMessageOnTyping(this, IDC_ONTYPING),
- m_cbSyncHistoryOff(this, IDC_SYNC_OFF),
- m_cbSyncHistoryAuto(this, IDC_SYNC_AUTO),
- m_cbSyncHistoryForLast1Day(this, IDC_SYNC_LAST1DAY),
- m_cbSyncHistoryForLast3Day(this, IDC_SYNC_LAST3DAY)
+ m_cbxMarkAsRead(this, IDC_COMBO_MARKASREAD),
+ m_cbxSyncHistory(this, IDC_COMBO_SYNCHISTORY)
{
CreateLink(m_edtLogin, "Login", _T(""));
- CreateLink(m_edtGroupName, "ProtoGroup", _T("VKontakte"));
+ CreateLink(m_edtGroupName, m_proto->m_vkOptions.ptszDefaultGroup);
CreateLink(m_cbDelivery, m_proto->m_vkOptions.bServerDelivery);
CreateLink(m_cbUseLocalTime, m_proto->m_vkOptions.bUseLocalTime);
CreateLink(m_cbAutoClean, m_proto->m_vkOptions.bAutoClean);
-
}
void CVkOptionAccountForm::OnInitDialog()
@@ -159,15 +168,17 @@ void CVkOptionAccountForm::OnInitDialog()
m_ptszOldGroup = m_edtGroupName.GetText();
- m_cbMarkMessageOnRead.SetState(m_proto->m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnRead);
- m_cbMarkMessageOnReceive.SetState(m_proto->m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnReceive);
- m_cbMarkMessageOnReply.SetState(m_proto->m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnReply);
- m_cbMarkMessageOnTyping.SetState(m_proto->m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnTyping);
+ for (size_t i = 0; i < _countof(vkMarkMsgAsReadMethods); i++) {
+ int cur = m_cbxMarkAsRead.AddString(vkMarkMsgAsReadMethods[i].type, vkMarkMsgAsReadMethods[i].data);
+ if (vkMarkMsgAsReadMethods[i].data == m_proto->m_vkOptions.iMarkMessageReadOn)
+ m_cbxMarkAsRead.SetCurSel(cur);
+ }
- m_cbSyncHistoryOff.SetState(m_proto->m_vkOptions.iSyncHistoryMetod == SyncHistoryMetod::syncOff);
- m_cbSyncHistoryAuto.SetState(m_proto->m_vkOptions.iSyncHistoryMetod == SyncHistoryMetod::syncAuto);
- m_cbSyncHistoryForLast1Day.SetState(m_proto->m_vkOptions.iSyncHistoryMetod == SyncHistoryMetod::sync1Days);
- m_cbSyncHistoryForLast3Day.SetState(m_proto->m_vkOptions.iSyncHistoryMetod == SyncHistoryMetod::sync3Days);
+ for (size_t i = 0; i < _countof(vkHistorySyncMethods); i++) {
+ int cur = m_cbxSyncHistory.AddString(vkHistorySyncMethods[i].type, vkHistorySyncMethods[i].data);
+ if (vkHistorySyncMethods[i].data == m_proto->m_vkOptions.iSyncHistoryMetod)
+ m_cbxSyncHistory.SetCurSel(cur);
+ }
for (size_t i = 0; i < _countof(vkLangCodes); i++) {
m_cbxVKLang.AddString(TranslateTS(vkLangCodes[i].szDescription), (LPARAM)vkLangCodes[i].szCode);
@@ -179,33 +190,13 @@ void CVkOptionAccountForm::OnInitDialog()
void CVkOptionAccountForm::OnApply()
{
- if (m_cbSyncHistoryOff.GetState())
- m_proto->m_vkOptions.iSyncHistoryMetod = SyncHistoryMetod::syncOff;
- if (m_cbSyncHistoryAuto.GetState())
- m_proto->m_vkOptions.iSyncHistoryMetod = SyncHistoryMetod::syncAuto;
- if (m_cbSyncHistoryForLast1Day.GetState())
- m_proto->m_vkOptions.iSyncHistoryMetod = SyncHistoryMetod::sync1Days;
- if (m_cbSyncHistoryForLast3Day.GetState())
- m_proto->m_vkOptions.iSyncHistoryMetod = SyncHistoryMetod::sync3Days;
-
- if (m_cbMarkMessageOnRead.GetState())
- m_proto->m_vkOptions.iMarkMessageReadOn = MarkMsgReadOn::markOnRead;
- if (m_cbMarkMessageOnReceive.GetState())
- m_proto->m_vkOptions.iMarkMessageReadOn = MarkMsgReadOn::markOnReceive;
- if (m_cbMarkMessageOnReply.GetState())
- m_proto->m_vkOptions.iMarkMessageReadOn = MarkMsgReadOn::markOnReply;
- if (m_cbMarkMessageOnTyping.GetState())
- m_proto->m_vkOptions.iMarkMessageReadOn = MarkMsgReadOn::markOnTyping;
-
+ m_proto->m_vkOptions.iSyncHistoryMetod = m_cbxSyncHistory.GetItemData(m_cbxSyncHistory.GetCurSel());
+ m_proto->m_vkOptions.iMarkMessageReadOn = m_cbxMarkAsRead.GetItemData(m_cbxMarkAsRead.GetCurSel());
m_proto->m_vkOptions.ptszVKLang = (TCHAR *)m_cbxVKLang.GetItemData(m_cbxVKLang.GetCurSel());
- if (!IsEmpty(m_proto->m_vkOptions.ptszVKLang))
- m_proto->setTString("VKLang", m_proto->m_vkOptions.ptszVKLang);
- else
- m_proto->delSetting("VKLang");
ptrT ptszGroupName(m_edtGroupName.GetText());
if (mir_tstrcmp(m_ptszOldGroup, ptszGroupName)) {
- m_proto->setGroup(ptszGroupName);
+ Clist_CreateGroup(NULL, ptszGroupName);
m_ptszOldGroup = ptszGroupName;
}
@@ -252,22 +243,19 @@ CVkOptionAdvancedForm::CVkOptionAdvancedForm(CVkProto *proto):
CreateLink(m_cbMesAsUnread, m_proto->m_vkOptions.bMesAsUnread);
CreateLink(m_cbForceInvisibleStatus, m_proto->m_vkOptions.bUserForceInvisibleOnActivity);
CreateLink(m_edtInvInterval, m_proto->m_vkOptions.iInvisibleInterval);
-
CreateLink(m_cbUseNonStandardNotifications, m_proto->m_vkOptions.bUseNonStandardNotifications);
CreateLink(m_cbUseNonStandardUrlEncode, m_proto->m_vkOptions.bUseNonStandardUrlEncode);
CreateLink(m_cbReportAbuse, m_proto->m_vkOptions.bReportAbuse);
CreateLink(m_cbClearServerHistory, m_proto->m_vkOptions.bClearServerHistory);
CreateLink(m_cbRemoveFromFrendlist, m_proto->m_vkOptions.bRemoveFromFrendlist);
CreateLink(m_cbRemoveFromCList, m_proto->m_vkOptions.bRemoveFromCList);
-
- CreateLink(m_edtReturnChatMessage, "ReturnChatMessage", TranslateT("I\'m back"));
+ CreateLink(m_edtReturnChatMessage, m_proto->m_vkOptions.ptszReturnChatMessage);
m_cbForceInvisibleStatus.OnChange = Callback(this, &CVkOptionAdvancedForm::On_cbForceInvisibleStatusChange);
}
void CVkOptionAdvancedForm::OnInitDialog()
{
-
m_cbMusicSendOff.SetState(m_proto->m_vkOptions.iMusicSendMetod == MusicSendMetod::sendNone);
m_cbMusicSendBroadcastAndStatus.SetState(m_proto->m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastAndStatus);
m_cbSendMetodBroadcast.SetState(m_proto->m_vkOptions.iMusicSendMetod == MusicSendMetod::sendBroadcastOnly);
@@ -289,8 +277,6 @@ void CVkOptionAdvancedForm::OnApply()
m_proto->m_vkOptions.iMusicSendMetod = MusicSendMetod::sendBroadcastOnly;
if (m_cbMusicSendStatus.GetState())
m_proto->m_vkOptions.iMusicSendMetod = MusicSendMetod::sendStatusOnly;
-
- m_proto->m_vkOptions.ptszReturnChatMessage = m_edtReturnChatMessage.GetText();
}
void CVkOptionAdvancedForm::On_cbForceInvisibleStatusChange(CCtrlCheck *)
diff --git a/protocols/VKontakte/src/vk_options.h b/protocols/VKontakte/src/vk_options.h
index 578a907513..3bb05c6efd 100644
--- a/protocols/VKontakte/src/vk_options.h
+++ b/protocols/VKontakte/src/vk_options.h
@@ -51,14 +51,8 @@ class CVkOptionAccountForm : public CVkDlgBase
CCtrlCheck m_cbDelivery;
CCtrlCheck m_cbUseLocalTime;
CCtrlCheck m_cbAutoClean;
- CCtrlCheck m_cbMarkMessageOnRead;
- CCtrlCheck m_cbMarkMessageOnReceive;
- CCtrlCheck m_cbMarkMessageOnReply;
- CCtrlCheck m_cbMarkMessageOnTyping;
- CCtrlCheck m_cbSyncHistoryOff;
- CCtrlCheck m_cbSyncHistoryAuto;
- CCtrlCheck m_cbSyncHistoryForLast1Day;
- CCtrlCheck m_cbSyncHistoryForLast3Day;
+ CCtrlCombo m_cbxSyncHistory;
+ CCtrlCombo m_cbxMarkAsRead;
pass_ptrT m_ptszOldPass;
ptrT m_ptszOldLogin;
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 478c4a43e1..dea5af4195 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -116,8 +116,6 @@ struct CVkProto : public PROTO<CVkProto>
void CreateNewChat(LPCSTR uids, LPCTSTR ptrszTitle);
__forceinline bool IsOnline() const { return m_bOnline; }
- __forceinline LPCTSTR getGroup() const { return m_vkOptions.ptszDefaultGroup; }
- __forceinline void setGroup(LPCTSTR grp) { m_vkOptions.ptszDefaultGroup = mir_tstrdup(grp); }
void OnTimerTic();
void ClearAccessToken();
TCHAR* GetUserStoredPassword(void);
diff --git a/protocols/VKontakte/src/vk_struct.cpp b/protocols/VKontakte/src/vk_struct.cpp
index 7d04d03ea1..8abcc68bb9 100644
--- a/protocols/VKontakte/src/vk_struct.cpp
+++ b/protocols/VKontakte/src/vk_struct.cpp
@@ -229,28 +229,9 @@ CVKOptions::CVKOptions(PROTO_INTERFACE *proto) :
iInvisibleInterval(proto, "InvisibleInterval", 10),
iMaxFriendsCount(proto, "MaxFriendsCount", 1000),
- ptszDefaultGroup(NULL),
- ptszReturnChatMessage(NULL),
- ptszVKLang(NULL),
+ ptszDefaultGroup(proto, "ProtoGroup", _T("VKontakte")),
+ ptszReturnChatMessage(proto, "ReturnChatMessage", TranslateT("I\'m back")),
+ ptszVKLang(proto, "VKLang", NULL)
- m_proto((CVkProto*)proto)
-
-{
- ReloadStrings();
-}
-
-void CVKOptions::ReloadStrings()
{
- if (!m_proto)
- return;
-
- ptszDefaultGroup = m_proto->getTStringA("ProtoGroup");
- ptszReturnChatMessage = m_proto->getTStringA("ReturnChatMessage");
- ptszVKLang = m_proto->getTStringA("VKLang");
-
- if (IsEmpty(ptszDefaultGroup))
- ptszDefaultGroup = mir_tstrdup(_T("VKontakte"));
-
- if (IsEmpty(ptszReturnChatMessage))
- ptszReturnChatMessage = mir_tstrdup(TranslateT("I\'m back"));
}
diff --git a/protocols/VKontakte/src/vk_struct.h b/protocols/VKontakte/src/vk_struct.h
index f3871c4830..fff9bd9bab 100644
--- a/protocols/VKontakte/src/vk_struct.h
+++ b/protocols/VKontakte/src/vk_struct.h
@@ -220,8 +220,8 @@ struct CVKNewsItem : public MZeroedObject {
bool bIsRepost;
};
-enum VKBBCType { vkbbcB, vkbbcI, vkbbcS, vkbbcU, vkbbcCode, vkbbcImg, vkbbcUrl, vkbbcSize, vkbbcColor };
-enum BBCSupport { bbcNo, bbcBasic, bbcAdvanced };
+enum VKBBCType : BYTE { vkbbcB, vkbbcI, vkbbcS, vkbbcU, vkbbcCode, vkbbcImg, vkbbcUrl, vkbbcSize, vkbbcColor };
+enum BBCSupport : BYTE { bbcNo, bbcBasic, bbcAdvanced };
struct CVKBBCItem {
VKBBCType vkBBCType;
@@ -249,10 +249,20 @@ struct CVKLang {
TCHAR *szDescription;
};
-enum MarkMsgReadOn { markOnRead, markOnReceive, markOnReply, markOnTyping };
-enum SyncHistoryMetod { syncOff, syncAuto, sync1Days, sync3Days };
-enum MusicSendMetod { sendNone, sendStatusOnly, sendBroadcastOnly, sendBroadcastAndStatus };
-enum IMGBBCSypport { imgNo, imgFullSize, imgPreview130, imgPreview604 };
+enum MarkMsgReadOn : BYTE { markOnRead, markOnReceive, markOnReply, markOnTyping };
+enum SyncHistoryMetod : BYTE { syncOff, syncAuto, sync1Days, sync3Days };
+enum MusicSendMetod : BYTE { sendNone, sendStatusOnly, sendBroadcastOnly, sendBroadcastAndStatus };
+enum IMGBBCSypport : BYTE { imgNo, imgFullSize, imgPreview130, imgPreview604 };
+
+struct CVKSync {
+ const TCHAR *type;
+ SyncHistoryMetod data;
+};
+
+struct CVKMarkMsgRead {
+ const TCHAR *type;
+ MarkMsgReadOn data;
+};
struct CVkCookie
{
@@ -327,16 +337,15 @@ struct CVKOptions {
CMOption<DWORD> iInvisibleInterval;
CMOption<DWORD> iMaxFriendsCount;
- ptrT ptszDefaultGroup;
- ptrT ptszReturnChatMessage;
- ptrT ptszVKLang;
+ CMOption<TCHAR*> ptszDefaultGroup;
+ CMOption<TCHAR*> ptszReturnChatMessage;
+ CMOption<TCHAR*> ptszVKLang;
CVkProto *m_proto;
CVKOptions(PROTO_INTERFACE *proto);
- void ReloadStrings();
- __forceinline BBCSupport BBCForNews() { return (BBCSupport)(int)iBBCForNews; };
- __forceinline BBCSupport BBCForAttachments() { return (BBCSupport)(int)iBBCForAttachments; };
+ __forceinline BBCSupport BBCForNews() { return (BBCSupport)(BYTE)iBBCForNews; };
+ __forceinline BBCSupport BBCForAttachments() { return (BBCSupport)(BYTE)iBBCForAttachments; };
}; \ No newline at end of file