mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: Bug [0000033] DC cancels shutdown in KDE
This commit is contained in:
parent
6f2bea6c31
commit
7ebb6c14f2
1 changed files with 46 additions and 6 deletions
|
|
@ -46,7 +46,11 @@ uses
|
|||
uCmdBox, uFilePanelSelect, uBriefFileView,
|
||||
uFileView, uColumnsFileView, uFileSource, uFileViewNotebook, uFile,
|
||||
uOperationsManager, uFileSourceOperation, uDrivesList, uTerminal, uClassesEx,
|
||||
uXmlConfig, uDrive, uDriveWatcher, uDCVersion, uMainCommands, uFormCommands;
|
||||
uXmlConfig, uDrive, uDriveWatcher, uDCVersion, uMainCommands, uFormCommands
|
||||
{$IFDEF LCLQT}
|
||||
, Qt4, QtWidgets
|
||||
{$ENDIF}
|
||||
;
|
||||
|
||||
const
|
||||
cHistoryFile='cmdhistory.txt';
|
||||
|
|
@ -493,6 +497,11 @@ type
|
|||
procedure OnUniqueInstanceMessage(Sender: TObject; Params: array of UTF8String; ParamCount: Integer);
|
||||
procedure tbPasteClick(Sender: TObject);
|
||||
procedure AllProgressOnUpdateTimer(Sender: TObject);
|
||||
{$IFDEF LCLQT}
|
||||
private
|
||||
QEventHook: QObject_hookH;
|
||||
function QObjectEventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl;
|
||||
{$ENDIF}
|
||||
private
|
||||
{ Private declarations }
|
||||
PanelSelected: TFilePanelSelect;
|
||||
|
|
@ -657,11 +666,7 @@ uses
|
|||
uFileSourceOperationTypes, uFileSourceCopyOperation, uFileSourceMoveOperation,
|
||||
fFileOpDlg, uFileSourceProperty, uFileSourceExecuteOperation, uArchiveFileSource,
|
||||
uShellExecute, fSymLink, fHardLink, uExceptions, uUniqueInstance, Clipbrd,
|
||||
uFileSourceOperationOptionsUI, uDebug, uHotkeyManager, uFileSourceUtil
|
||||
{$IFDEF LCLQT}
|
||||
, qtwidgets
|
||||
{$ENDIF}
|
||||
;
|
||||
uFileSourceOperationOptionsUI, uDebug, uHotkeyManager, uFileSourceUtil;
|
||||
|
||||
const
|
||||
HotkeysCategory = 'Main';
|
||||
|
|
@ -671,6 +676,11 @@ var
|
|||
LastActiveWindow: TCustomForm = nil;
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF LCLQT}
|
||||
var
|
||||
CloseQueryResult: Boolean = False;
|
||||
{$ENDIF}
|
||||
|
||||
function HistoryIndexesToTag(aFileSourceIndex, aPathIndex: Integer): Longint;
|
||||
begin
|
||||
Result := (aFileSourceIndex << 16) or aPathIndex;
|
||||
|
|
@ -793,6 +803,13 @@ begin
|
|||
UpdateWindowView;
|
||||
//DCDebug('frmMain.FormCreate Done');
|
||||
Draging:=false;
|
||||
|
||||
{$IFDEF LCLQT}
|
||||
// Fixes bug - [0000033] "DC cancels shutdown in KDE"
|
||||
// http://doublecmd.sourceforge.net/mantisbt/view.php?id=33
|
||||
QEventHook:= QObject_hook_create(TQtWidget(Self.Handle).Widget);
|
||||
QObject_hook_hook_events(QEventHook, @QObjectEventFilter);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TfrmMain.btnLeftClick(Sender: TObject);
|
||||
|
|
@ -1113,6 +1130,10 @@ begin
|
|||
|
||||
FreeAndNil(DrivesList);
|
||||
|
||||
{$IFDEF LCLQT}
|
||||
QObject_hook_destroy(QEventHook);
|
||||
{$ENDIF}
|
||||
|
||||
DCDebug('Main form destroyed');
|
||||
end;
|
||||
|
||||
|
|
@ -1126,6 +1147,9 @@ begin
|
|||
end
|
||||
else
|
||||
CanClose := True;
|
||||
{$IFDEF LCLQT}
|
||||
CloseQueryResult:= CanClose;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TfrmMain.FormDropFiles(Sender: TObject; const FileNames: array of String);
|
||||
|
|
@ -4852,6 +4876,22 @@ begin
|
|||
FrameRight.ReloadIfNeeded;
|
||||
end;
|
||||
|
||||
{$IFDEF LCLQT}
|
||||
function TfrmMain.QObjectEventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl;
|
||||
begin
|
||||
Result:= False;
|
||||
if QEvent_type(Event) = QEventClose then
|
||||
begin
|
||||
TQtWidget(Self.Handle).SlotClose;
|
||||
Result:= CloseQueryResult;
|
||||
if Result then
|
||||
QEvent_accept(Event)
|
||||
else
|
||||
QEvent_ignore(Event);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
initialization
|
||||
TFormCommands.RegisterCommandsForm(TfrmMain, HotkeysCategory, @rsHotkeyCategoryMain);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue