comparison libgui/src/m-editor/file-editor.cc @ 18685:992b6354c8c6 gui-release

GUI: implement file drag and drop to command and edit window (Bug #41443) * libgui/src/m-editor/file-editor.h, ibgui/src/m-editor/file-editor.cpp (file_editor::file_editor): call setAcceptDrops. (file_editor::dragEnterEvent): New function. (file_editor::dropEvent): New function. * libgui/qterminal/libqterminal/unix/TerminalView.cpp (TerminalView::dropEvent): get URL names on drop event.
author John Donoghue
date Wed, 16 Apr 2014 16:19:45 -0400
parents a827fc5fe59d
children 1b289f45187f
comparison
equal deleted inserted replaced
18673:7cb98e81ecd1 18685:992b6354c8c6
54 ced = QDir::currentPath (); 54 ced = QDir::currentPath ();
55 55
56 construct (); 56 construct ();
57 57
58 setVisible (false); 58 setVisible (false);
59
60 setAcceptDrops(true);
59 } 61 }
60 62
61 file_editor::~file_editor (void) 63 file_editor::~file_editor (void)
62 { 64 {
63 QSettings *settings = resource_manager::get_settings (); 65 QSettings *settings = resource_manager::get_settings ();
1753 1755
1754 if (visible && ! isFloating ()) 1756 if (visible && ! isFloating ())
1755 focus (); 1757 focus ();
1756 } 1758 }
1757 1759
1760 void
1761 file_editor::dragEnterEvent (QDragEnterEvent *event)
1762 {
1763 if (event->mimeData ()->hasUrls ())
1764 {
1765 event->acceptProposedAction();
1766 }
1767 }
1768
1769 void
1770 file_editor::dropEvent (QDropEvent *event)
1771 {
1772 if (event->mimeData ()->hasUrls ())
1773 {
1774 foreach (QUrl url, event->mimeData ()->urls ())
1775 {
1776 request_open_file (url.toLocalFile ());
1777 }
1778 }
1779 }
1780
1758 #endif 1781 #endif