Edit messages sent to yourself.

Copy inline keyboard link to clipboard.
Fixed webpage type=video layout with document attach.
Inline GIF results can be manually downloaded before sending.
This commit is contained in:
John Preston 2016-05-19 18:02:07 +03:00
parent 0e66288a69
commit bdc8b3585d
6 changed files with 31 additions and 10 deletions

View File

@ -78,7 +78,7 @@ bool Processor::write(const structure::Module &module) const {
"codegen_style", "codegen_style",
srcFile.fileName(), srcFile.fileName(),
"stdafx.h", "stdafx.h",
!options_.rebuildDependencies, // forceReGenerate false,//!options_.rebuildDependencies, // forceReGenerate
}; };
SpriteGenerator spriteGenerator(module); SpriteGenerator spriteGenerator(module);

View File

@ -2553,6 +2553,26 @@ public:
_fullDisplayed = full; _fullDisplayed = full;
} }
// Copy to clipboard support.
void copyToClipboard() const override {
if (auto button = getButton()) {
if (button->type == HistoryMessageReplyMarkup::Button::Url) {
auto url = QString::fromUtf8(button->data);
if (!url.isEmpty()) {
QApplication::clipboard()->setText(url);
}
}
}
}
QString copyToClipboardContextItemText() const override {
if (auto button = getButton()) {
if (button->type == HistoryMessageReplyMarkup::Button::Url) {
return lang(lng_context_copy_link);
}
}
return QString();
}
// Finds the corresponding button in the items markup struct. // Finds the corresponding button in the items markup struct.
// If the button is not found it returns nullptr. // If the button is not found it returns nullptr.
// Note: it is possible that we will point to the different button // Note: it is possible that we will point to the different button
@ -3116,7 +3136,7 @@ bool HistoryItem::canEdit(const QDateTime &cur) const {
auto channel = _history->peer->asChannel(); auto channel = _history->peer->asChannel();
return (channel->amCreator() || (channel->amEditor() && out())); return (channel->amCreator() || (channel->amEditor() && out()));
} }
return out(); return out() || (peerToUser(_history->peer->id) == MTP::authedId());
} }
return false; return false;
} }
@ -5831,7 +5851,7 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, u
_attach->draw(p, r.translated(-attachLeft, -attachTop), attachSelection, ms); _attach->draw(p, r.translated(-attachLeft, -attachTop), attachSelection, ms);
int32 pixwidth = _attach->currentWidth(), pixheight = _attach->height(); int32 pixwidth = _attach->currentWidth(), pixheight = _attach->height();
if (_data->type == WebPageVideo) { if (_data->type == WebPageVideo && _attach->type() == MediaTypePhoto) {
if (_data->siteName == qstr("YouTube")) { if (_data->siteName == qstr("YouTube")) {
p.drawSprite(QPoint((pixwidth - st::youtubeIcon.pxWidth()) / 2, (pixheight - st::youtubeIcon.pxHeight()) / 2), st::youtubeIcon); p.drawSprite(QPoint((pixwidth - st::youtubeIcon.pxWidth()) / 2, (pixheight - st::youtubeIcon.pxHeight()) / 2), st::youtubeIcon);
} else { } else {

View File

@ -1111,7 +1111,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
} }
} }
} }
if (msg && (!msg->emptyText() || mediaHasTextForCopy)) { if (msg && !_contextMenuLnk && (!msg->emptyText() || mediaHasTextForCopy)) {
_menu->addAction(lang(lng_context_copy_text), this, SLOT(copyContextText()))->setEnabled(true); _menu->addAction(lang(lng_context_copy_text), this, SLOT(copyContextText()))->setEnabled(true);
} }
} }

View File

@ -209,6 +209,7 @@ bool Result::onChoose(Layout::ItemBase *layout) {
_photo->thumb->loadEvenCancelled(); _photo->thumb->loadEvenCancelled();
_photo->medium->loadEvenCancelled(); _photo->medium->loadEvenCancelled();
} }
return false;
} }
if (_document && ( if (_document && (
_type == Type::Video || _type == Type::Video ||
@ -224,9 +225,9 @@ bool Result::onChoose(Layout::ItemBase *layout) {
} else { } else {
DocumentOpenClickHandler::doOpen(_document, ActionOnLoadNone); DocumentOpenClickHandler::doOpen(_document, ActionOnLoadNone);
} }
} else { return false;
return true;
} }
return true;
} }
return true; return true;
} }

View File

@ -2338,8 +2338,8 @@
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Rcc%27ing %(Identity)...</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Rcc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(FullPath);.\Resources\art\icon256.png;%(AdditionalInputs)</AdditionalInputs> <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(FullPath);.\Resources\art\icon256.png;.\Resources\art\sprite_125x.png;.\Resources\art\sprite_150x.png;%(AdditionalInputs)</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">%(FullPath);.\Resources\art\icon256.png;%(AdditionalInputs)</AdditionalInputs> <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">%(FullPath);.\Resources\art\icon256.png;.\Resources\art\sprite_125x.png;.\Resources\art\sprite_150x.png;%(AdditionalInputs)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Rcc%27ing %(Identity)...</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Rcc%27ing %(Identity)...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Rcc%27ing %(Identity)...</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Rcc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs)</Outputs>

View File

@ -1591,9 +1591,9 @@
<CodegenStyleItem Include="Resources\all_files.style"> <CodegenStyleItem Include="Resources\all_files.style">
<Filter>Resources</Filter> <Filter>Resources</Filter>
</CodegenStyleItem> </CodegenStyleItem>
<CodegenStyleItem Include="Resources\basic.style"> <CustomBuild Include="Resources\basic.style">
<Filter>Resources</Filter> <Filter>Resources</Filter>
</CodegenStyleItem> </CustomBuild>
<CodegenStyleItem Include="Resources\basic_types.style"> <CodegenStyleItem Include="Resources\basic_types.style">
<Filter>Resources</Filter> <Filter>Resources</Filter>
</CodegenStyleItem> </CodegenStyleItem>