mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
fixed opening of uncompressed image sent from clipboard, intro refactoring finished
This commit is contained in:
@@ -657,10 +657,10 @@ void HistoryInner::onDragExec() {
|
||||
mimeData->setData(qsl("application/x-td-forward-pressed"), "1");
|
||||
}
|
||||
if (lnkDocument) {
|
||||
QString already = static_cast<DocumentOpenLink*>(textlnkDown().data())->document()->already(true);
|
||||
if (!already.isEmpty()) {
|
||||
QString filepath = static_cast<DocumentOpenLink*>(textlnkDown().data())->document()->filepath(DocumentData::FilePathResolveChecked);
|
||||
if (!filepath.isEmpty()) {
|
||||
QList<QUrl> urls;
|
||||
urls.push_back(QUrl::fromLocalFile(already));
|
||||
urls.push_back(QUrl::fromLocalFile(filepath));
|
||||
mimeData->setUrls(urls);
|
||||
}
|
||||
}
|
||||
@@ -892,7 +892,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
if (lnkDocument && lnkDocument->document()->loaded() && lnkDocument->document()->isGifv()) {
|
||||
_menu->addAction(lang(lng_context_save_gif), this, SLOT(saveContextGif()))->setEnabled(true);
|
||||
}
|
||||
if (lnkDocument && !lnkDocument->document()->already(true).isEmpty()) {
|
||||
if (lnkDocument && !lnkDocument->document()->filepath(DocumentData::FilePathResolveChecked).isEmpty()) {
|
||||
_menu->addAction(lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_context_show_in_finder : lng_context_show_in_folder), this, SLOT(showContextInFolder()))->setEnabled(true);
|
||||
}
|
||||
_menu->addAction(lang(lnkIsVideo ? lng_context_save_video : (lnkIsAudio ? lng_context_save_audio : lng_context_save_file)), this, SLOT(saveContextFile()))->setEnabled(true);
|
||||
@@ -976,7 +976,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||
if (doc->isGifv()) {
|
||||
_menu->addAction(lang(lng_context_save_gif), this, SLOT(saveContextGif()))->setEnabled(true);
|
||||
}
|
||||
if (!doc->already(true).isEmpty()) {
|
||||
if (!doc->filepath(DocumentData::FilePathResolveChecked).isEmpty()) {
|
||||
_menu->addAction(lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_context_show_in_finder : lng_context_show_in_folder), this, SLOT(showContextInFolder()))->setEnabled(true);
|
||||
}
|
||||
_menu->addAction(lang(lng_context_save_file), this, SLOT(saveContextFile()))->setEnabled(true);
|
||||
@@ -1101,17 +1101,19 @@ void HistoryInner::cancelContextDownload() {
|
||||
}
|
||||
|
||||
void HistoryInner::showContextInFolder() {
|
||||
QString already;
|
||||
QString filepath;
|
||||
if (DocumentLink *lnkDocument = dynamic_cast<DocumentLink*>(_contextMenuLnk.data())) {
|
||||
already = lnkDocument->document()->already(true);
|
||||
filepath = lnkDocument->document()->filepath(DocumentData::FilePathResolveChecked);
|
||||
} else if (HistoryItem *item = App::contextItem()) {
|
||||
if (HistoryMedia *media = item->getMedia()) {
|
||||
if (DocumentData *doc = media->getDocument()) {
|
||||
already = doc->already(true);
|
||||
filepath = doc->filepath(DocumentData::FilePathResolveChecked);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!already.isEmpty()) psShowInFolder(already);
|
||||
if (!filepath.isEmpty()) {
|
||||
psShowInFolder(filepath);
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryInner::saveContextFile() {
|
||||
|
Reference in New Issue
Block a user