diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-02 17:28:14 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-02 17:28:14 +0300 |
commit | 4aec2692c26aea72dd75c2e39cd23e05ba18ff3c (patch) | |
tree | e2b1640ed6a14793cc85407624da5a0b635e9832 | |
parent | 3876f9c668826a2da2f306683fff6243fa522c4e (diff) |
partially fixes #1241 = extra icons translation
-rw-r--r-- | src/mir_app/src/BaseExtraIcon.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/ExtraIconGroup.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/extraicons.cpp | 23 |
3 files changed, 10 insertions, 19 deletions
diff --git a/src/mir_app/src/BaseExtraIcon.cpp b/src/mir_app/src/BaseExtraIcon.cpp index 61b2c0859a..8614eadde3 100644 --- a/src/mir_app/src/BaseExtraIcon.cpp +++ b/src/mir_app/src/BaseExtraIcon.cpp @@ -50,7 +50,7 @@ int BaseExtraIcon::getID() const const wchar_t* BaseExtraIcon::getDescription() const
{
- return m_tszDescription;
+ return TranslateW_LP(m_tszDescription, m_hLangpack);
}
void BaseExtraIcon::setDescription(const wchar_t *desc)
diff --git a/src/mir_app/src/ExtraIconGroup.cpp b/src/mir_app/src/ExtraIconGroup.cpp index 7911a50797..c7d8b6a453 100644 --- a/src/mir_app/src/ExtraIconGroup.cpp +++ b/src/mir_app/src/ExtraIconGroup.cpp @@ -120,14 +120,14 @@ int ExtraIconGroup::setIconByName(int id, MCONTACT hContact, const char *value) return internalSetIcon(id, hContact, (void*)value, true);
}
-int ExtraIconGroup::internalSetIcon(int id, MCONTACT hContact, void *value, bool bByName)
+int ExtraIconGroup::internalSetIcon(int id, MCONTACT hContact, HANDLE value, bool bByName)
{
if (m_insideApply) {
for (auto &p : m_items)
if (p->getID() == id) {
if (bByName)
return p->setIconByName(id, hContact, (const char*)value);
- return p->setIcon(id, hContact, (HANDLE)value);
+ return p->setIcon(id, hContact, value);
}
return -1;
diff --git a/src/mir_app/src/extraicons.cpp b/src/mir_app/src/extraicons.cpp index 6428fc4b11..1e905d12ae 100644 --- a/src/mir_app/src/extraicons.cpp +++ b/src/mir_app/src/extraicons.cpp @@ -318,7 +318,7 @@ void fnSetAllExtraIcons(MCONTACT hContact) ///////////////////////////////////////////////////////////////////////////////
// external functions
-static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int flags, int _hLang)
+static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int flags)
{
char setting[512];
mir_snprintf(setting, "Position_%s", name);
@@ -337,8 +337,6 @@ static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int flags, int }
extra->setSlot(slot);
- extra->m_hLangpack = _hLang;
-
registeredExtraIcons.insert(extra);
extraIconsByHandle.insert(extra);
@@ -389,11 +387,11 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const return nullptr;
ptrW tszDesc(mir_a2u(description));
- wchar_t *desc = TranslateW_LP(tszDesc, _hLang);
int id = registeredExtraIcons.getCount() + 1;
- BaseExtraIcon *extra = new CallbackExtraIcon(id, name, desc, descIcon == nullptr ? "" : descIcon, RebuildIcons, ApplyIcon, OnClick, onClickParam);
- EI_PostCreate(extra, name, flags, _hLang);
+ BaseExtraIcon *extra = new CallbackExtraIcon(id, name, tszDesc, descIcon == nullptr ? "" : descIcon, RebuildIcons, ApplyIcon, OnClick, onClickParam);
+ extra->m_hLangpack = _hLang;
+ EI_PostCreate(extra, name, flags);
return (HANDLE)id;
}
@@ -404,7 +402,6 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch return nullptr;
ptrW tszDesc(mir_a2u(description));
- wchar_t *desc = TranslateW_LP(tszDesc, _hLang);
BaseExtraIcon *extra = GetExtraIconByName(name);
if (extra != nullptr) {
@@ -412,13 +409,6 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch return nullptr;
// Found one, now merge it
- if (mir_wstrcmpi(extra->getDescription(), desc)) {
- CMStringW newDesc = extra->getDescription();
- newDesc += L" / ";
- newDesc += desc;
- extra->setDescription(newDesc.c_str());
- }
-
if (!IsEmpty(descIcon))
extra->setDescIcon(descIcon);
@@ -436,8 +426,9 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch }
int id = registeredExtraIcons.getCount() + 1;
- extra = new IcolibExtraIcon(id, name, desc, descIcon == nullptr ? "" : descIcon, OnClick, onClickParam);
- EI_PostCreate(extra, name, flags, _hLang);
+ extra = new IcolibExtraIcon(id, name, tszDesc, descIcon == nullptr ? "" : descIcon, OnClick, onClickParam);
+ extra->m_hLangpack = _hLang;
+ EI_PostCreate(extra, name, flags);
return (HANDLE)id;
}
|