Skip to content

Commit

Permalink
fixed OS X PopupMenu behaviour and directory name in error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Nov 2, 2015
1 parent 29befef commit 9a83c26
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)";
Expand Down
17 changes: 9 additions & 8 deletions Telegram/SourceFiles/gui/popupmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -419,9 +422,6 @@ void PopupMenu::childHiding(PopupMenu *child) {

void PopupMenu::hideFinish() {
hide();
if (_deleteOnHide) {
deleteLater();
}
}

bool PopupMenu::animStep_hide(float64 ms) {
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions Telegram/SourceFiles/gui/popupmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class PopupMenu : public TWidget {
void leaveEvent(QEvent *e);
void enterEvent(QEvent *e);
void focusOutEvent(QFocusEvent *e);
void hideEvent(QHideEvent *e);

public slots:

Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/localimageloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9a83c26

Please sign in to comment.