fixed OS X PopupMenu behaviour and directory name in error msg

This commit is contained in:
John Preston 2015-11-02 18:30:28 -05:00
parent 29befef3ea
commit 9a83c26731
4 changed files with 13 additions and 11 deletions

View File

@ -20,8 +20,8 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/
#pragma once
static const int32 AppVersion = 9008;
static const wchar_t *AppVersionStr = L"0.9.8";
static const int32 AppVersion = 9009;
static const wchar_t *AppVersionStr = L"0.9.9";
static const bool DevVersion = true;
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";

View File

@ -50,6 +50,7 @@ PopupMenu::PopupMenu(QMenu *menu, const style::PopupMenu &st) : TWidget(0)
, _mouseSelection(false)
, _shadow(_st.shadow)
, _selected(-1)
, _childMenuIndex(-1)
, a_opacity(1)
, _a_hide(animFunc(this, &PopupMenu::animStep_hide))
, _deleteOnHide(true) {
@ -301,11 +302,7 @@ void PopupMenu::keyPressEvent(QKeyEvent *e) {
void PopupMenu::enterEvent(QEvent *e) {
QPoint mouse = QCursor::pos();
if (_inner.marginsRemoved(QMargins(0, _st.skip, 0, _st.skip)).contains(mapFromGlobal(mouse))) {
_mouseSelection = true;
_mouse = mouse;
updateSelected();
} else {
if (!_inner.marginsRemoved(QMargins(0, _st.skip, 0, _st.skip)).contains(mapFromGlobal(mouse))) {
if (_mouseSelection && _childMenuIndex < 0) {
_mouseSelection = false;
setSelected(-1);
@ -385,6 +382,12 @@ void PopupMenu::focusOutEvent(QFocusEvent *e) {
hideMenu();
}
void PopupMenu::hideEvent(QHideEvent *e) {
if (_deleteOnHide) {
deleteLater();
}
}
void PopupMenu::hideMenu(bool fast) {
if (isHidden()) return;
if (_parent && !_a_hide.animating()) {
@ -419,9 +422,6 @@ void PopupMenu::childHiding(PopupMenu *child) {
void PopupMenu::hideFinish() {
hide();
if (_deleteOnHide) {
deleteLater();
}
}
bool PopupMenu::animStep_hide(float64 ms) {
@ -482,6 +482,7 @@ void PopupMenu::showMenu(const QPoint &p, PopupMenu *parent, PressSource source)
}
move(w);
_mouseSelection = (source == PressSourceMouse);
setSelected((source == PressSourceMouse || _actions.isEmpty()) ? -1 : 0);
psUpdateOverlayed(this);
show();

View File

@ -47,6 +47,7 @@ protected:
void leaveEvent(QEvent *e);
void enterEvent(QEvent *e);
void focusOutEvent(QFocusEvent *e);
void hideEvent(QHideEvent *e);
public slots:

View File

@ -405,7 +405,7 @@ void FileLoadTask::finish() {
}
if (_result->filesize == -1) { // dir
App::main()->onSendFileCancel(_result);
App::wnd()->replaceLayer(new InformBox(lng_send_folder(lt_name, QFileInfo(_filepath).fileName())));
App::wnd()->replaceLayer(new InformBox(lng_send_folder(lt_name, QFileInfo(_filepath).dir().dirName())));
return;
}
if (_result->filesize > MaxUploadDocumentSize) {